summaryrefslogtreecommitdiff
path: root/src/core/keybindings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/keybindings.c')
-rw-r--r--src/core/keybindings.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 83dc4f93..8176b96f 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1394,6 +1394,10 @@ process_mouse_move_resize_grab (MetaDisplay *display,
if (keysym == XK_Escape)
{
+ /* Restore the original tile mode */
+ window->tile_mode = display->grab_tile_mode;
+ window->tile_monitor_number = display->grab_tile_monitor_number;
+
/* End move or resize and restore to original state. If the
* window was a maximized window that had been "shaken loose" we
* need to remaximize it. In normal cases, we need to do a
@@ -1405,6 +1409,8 @@ process_mouse_move_resize_grab (MetaDisplay *display,
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
+ else if (window->tile_mode == META_TILE_LEFT || window->tile_mode == META_TILE_RIGHT)
+ meta_window_tile (window);
else if (!display->grab_wireframe_active)
meta_window_move_resize (display->grab_window,
TRUE,
@@ -3016,6 +3022,43 @@ handle_toggle_above (MetaDisplay *display,
meta_window_make_above (window);
}
+/* TODO: actually use this keybinding, without messing up the existing keybinding schema */
+static void
+handle_toggle_tiled (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ XEvent *event,
+ MetaKeyBinding *binding)
+{
+ MetaTileMode mode = binding->handler->data;
+
+ if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
+ (META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
+ {
+ window->tile_mode = META_TILE_NONE;
+
+ if (window->saved_maximize)
+ meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
+ META_MAXIMIZE_HORIZONTAL);
+ else
+ meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
+ META_MAXIMIZE_HORIZONTAL);
+ }
+ else if (meta_window_can_tile (window))
+ {
+ window->tile_mode = mode;
+ window->tile_monitor_number = meta_screen_get_xinerama_for_window (window->screen, window)->number;
+ /* Maximization constraints beat tiling constraints, so if the window
+ * is maximized, tiling won't have any effect unless we unmaximize it
+ * horizontally first; rather than calling meta_window_unmaximize(),
+ * we just set the flag and rely on meta_window_tile() syncing it to
+ * save an additional roundtrip.
+ */
+ window->maximized_horizontally = FALSE;
+ meta_window_tile (window);
+ }
+}
+
static void
handle_toggle_maximized (MetaDisplay *display,
MetaScreen *screen,