[mutter/wip/multitouch: 8/8] window: Implement tiling/maximizing through touch events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/multitouch: 8/8] window: Implement tiling/maximizing through touch events
- Date: Sat, 6 Aug 2011 09:16:38 +0000 (UTC)
commit 86a3b0923120c668c8f2227db72a2ad81c5b4100
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 2 19:33:20 2011 +0200
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.
src/core/window-private.h | 4 ++++
src/core/window.c | 41 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 687c140..ed06c50 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -413,6 +413,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 6dc9fd2..f8476fc 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8462,6 +8462,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;
}
@@ -10672,9 +10693,16 @@ meta_window_update_touch (MetaWindow *window,
1, 0,
evtime,
x, y);
+ window->initial_touch_area_width = width;
+ window->initial_touch_area_height = height;
}
else if (window->cur_grab)
- update_move (window, device, FALSE, x, y);
+ {
+ window->cur_touch_area_width = width;
+ window->cur_touch_area_height = height;
+
+ update_move (window, device, FALSE, x, y);
+ }
}
return FALSE;
@@ -10700,6 +10728,17 @@ meta_window_end_touch (MetaWindow *window,
device = meta_input_event_get_device (window->display, event);
meta_display_end_grab_op (window->display, device, evtime);
+
+ 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 (window->tile_mode != META_TILE_NONE)
+ {
+ meta_window_tile (window);
+ update_tile_mode (window);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]