summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2011-08-02 19:33:20 +0200
committerJasper St. Pierre <jstpierre@mecheye.net>2012-11-03 20:00:21 -0400
commitde0d9e4da8b47c777aa13a6913c1cc253a13da98 (patch)
treeacf659494e66e6e44df5512d3bdfa669ac2b22fb
parent900b91f3854388a0f5dfd540b5dff41d7c290b9d (diff)
downloadmutter-de0d9e4da8b47c777aa13a6913c1cc253a13da98.tar.gz
window: Implement tiling/maximizing through touch events
If during a multitouch drag, the area height is 1.5x the original size, the window is tiled to the closest side the hotspot is on (left/right). If both with/height are 1.5x the original, the window is maximized.
-rw-r--r--src/core/window-private.h4
-rw-r--r--src/core/window.c32
2 files changed, 36 insertions, 0 deletions
diff --git a/src/core/window-private.h b/src/core/window-private.h
index f9a796fb7..f2a928d4c 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -431,6 +431,10 @@ struct _MetaWindow
MetaFocusInfo *cur_focus;
GHashTable *cur_touches;
+ gdouble initial_touch_area_width;
+ gdouble initial_touch_area_height;
+ gdouble cur_touch_area_width;
+ gdouble cur_touch_area_height;
};
struct _MetaWindowClass
diff --git a/src/core/window.c b/src/core/window.c
index b42244ff5..d5a948352 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8827,6 +8827,27 @@ update_move (MetaWindow *window,
else if (meta_window_can_tile_maximized (window) &&
y >= monitor->rect.y && y <= work_area.y)
window->tile_mode = META_TILE_MAXIMIZED;
+ else if (window->cur_touches &&
+ g_hash_table_size (window->cur_touches) == 3)
+ {
+ window->tile_mode = META_TILE_NONE;
+
+ if (window->cur_touch_area_height >
+ window->initial_touch_area_height * 1.5)
+ {
+ if (window->cur_touch_area_width >
+ window->initial_touch_area_width * 1.5 &&
+ meta_window_can_tile_maximized (window))
+ window->tile_mode = META_TILE_MAXIMIZED;
+ else if (meta_window_can_tile_side_by_side (window, device))
+ {
+ if (x < (monitor->rect.x + (monitor->rect.width / 2)))
+ window->tile_mode = META_TILE_LEFT;
+ else
+ window->tile_mode = META_TILE_RIGHT;
+ }
+ }
+ }
else
window->tile_mode = META_TILE_NONE;
@@ -11345,6 +11366,11 @@ meta_window_end_touch (MetaWindow *window,
n_touches = g_hash_table_size (window->cur_touches);
+ window->initial_touch_area_width = 0;
+ window->initial_touch_area_height = 0;
+ window->cur_touch_area_width = 0;
+ window->cur_touch_area_height = 0;
+
if (n_touches == 2)
{
MetaDevice *device;
@@ -11352,4 +11378,10 @@ meta_window_end_touch (MetaWindow *window,
device = meta_input_event_get_device (window->display, event);
meta_display_end_grab_op (window->display, device, evtime);
}
+ else if (n_touches == 0 &&
+ window->tile_mode != META_TILE_NONE)
+ {
+ meta_window_tile (window);
+ update_tile_mode (window);
+ }
}