diff --git a/src/core/keybindings.c b/src/core/keybindings.c index bbf98720b..ef36cff77 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2221,12 +2221,14 @@ process_mouse_move_resize_grab (MetaDisplay *display, if (event->keyval == CLUTTER_KEY_Escape) { + MetaTileMode tile_mode; + /* Hide the tiling preview if necessary */ if (screen->preview_tile_mode != META_TILE_NONE) meta_screen_hide_tile_preview (screen); /* Restore the original tile mode */ - window->tile_mode = display->grab_tile_mode; + 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 @@ -2234,10 +2236,10 @@ process_mouse_move_resize_grab (MetaDisplay *display, * need to remaximize it. In normal cases, we need to do a * moveresize now to get the position back to the original. */ - if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED) + if (window->shaken_loose || tile_mode == META_TILE_MAXIMIZED) meta_window_maximize (window, META_MAXIMIZE_BOTH); - else if (window->tile_mode != META_TILE_NONE) - meta_window_tile (window); + else if (tile_mode != META_TILE_NONE) + meta_window_tile (window, tile_mode); else meta_window_move_resize_frame (display->grab_window, TRUE, @@ -3184,7 +3186,6 @@ handle_toggle_tiled (MetaDisplay *display, else if (meta_window_can_tile_side_by_side (window)) { window->tile_monitor_number = window->monitor->number; - window->tile_mode = mode; /* 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(), @@ -3192,7 +3193,7 @@ handle_toggle_tiled (MetaDisplay *display, * save an additional roundtrip. */ window->maximized_horizontally = FALSE; - meta_window_tile (window); + meta_window_tile (window, mode); } } diff --git a/src/core/window-private.h b/src/core/window-private.h index d50beae8b..443bcf4d8 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -577,7 +577,8 @@ void meta_window_unmanage (MetaWindow *window, guint32 timestamp); void meta_window_queue (MetaWindow *window, guint queuebits); -void meta_window_tile (MetaWindow *window); +void meta_window_tile (MetaWindow *window, + MetaTileMode mode); void meta_window_maximize_internal (MetaWindow *window, MetaMaximizeFlags directions, MetaRectangle *saved_rect); diff --git a/src/core/window.c b/src/core/window.c index 88a9f22a2..d4fb40456 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2969,11 +2969,14 @@ meta_window_requested_dont_bypass_compositor (MetaWindow *window) } void -meta_window_tile (MetaWindow *window) +meta_window_tile (MetaWindow *window, + MetaTileMode tile_mode) { MetaMaximizeFlags directions; MetaRectangle old_frame_rect, old_buffer_rect; + window->tile_mode = tile_mode; + /* Don't do anything if no tiling is requested */ if (window->tile_mode == META_TILE_NONE) return; @@ -6123,9 +6126,8 @@ end_grab_op (MetaWindow *window, { if (meta_grab_op_is_moving (window->display->grab_op)) { - window->tile_mode = window->screen->preview_tile_mode; - if (window->tile_mode != META_TILE_NONE) - meta_window_tile (window); + if (window->screen->preview_tile_mode != META_TILE_NONE) + meta_window_tile (window, window->screen->preview_tile_mode); else update_move (window, modifiers & CLUTTER_SHIFT_MASK,