Skip to content

Commit a35b0a0

Browse files
committed
tiling: When tiling at the end of a grab, use the initial position
and size from when the grab began instead of it's last position before tiling. When dragging a window to a tiled state, the final position could be off the screen depending on the size of the window and the anchor (grip) position from the start of the grab. If the window was un-tiled later via keyboard shortcut, the window could return to its original size, but its position would be incorrect, and probably up against the edge of the workarea. This is related to the previous commit (d30b0b0) (similar symptom, different cause).
1 parent d30b0b0 commit a35b0a0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/core/display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,7 @@ meta_display_end_grab_op (MetaDisplay *display,
20262026
display->grab_window = NULL;
20272027
display->grab_tile_mode = META_TILE_NONE;
20282028
display->grab_tile_monitor_number = -1;
2029+
memset(&display->grab_initial_window_pos, 0, sizeof(MetaRectangle));
20292030

20302031
meta_display_update_cursor (display);
20312032

src/core/window.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3428,7 +3428,20 @@ meta_window_tile (MetaWindow *window,
34283428
else
34293429
directions = META_MAXIMIZE_VERTICAL;
34303430

3431-
meta_window_maximize_internal (window, directions, was_already_tiled ? &window->saved_rect : NULL);
3431+
3432+
GdkRectangle *maybe_saved_rect = NULL;
3433+
3434+
if (window->display->grab_op != META_GRAB_OP_NONE)
3435+
{
3436+
maybe_saved_rect = &window->display->grab_initial_window_pos;
3437+
}
3438+
else
3439+
if (was_already_tiled)
3440+
{
3441+
maybe_saved_rect = &window->saved_rect;
3442+
}
3443+
3444+
meta_window_maximize_internal (window, directions, maybe_saved_rect);
34323445
meta_display_update_tile_preview (window->display, FALSE);
34333446

34343447
/* Setup the edge constraints */

0 commit comments

Comments
 (0)