Skip to content

Commit 65e1dcd

Browse files
committed
window.c: If maximizing a tiled window via titlebar, use the window's
current, not its unconstrained position and size to pass to the constraints call. If you tile a window against a monitor edge that's got a neighbor, depending on where you gripped the window while tiling it the final unconstrained position before tiling could be mostly on the neighboring window, and cause the window to maximize on *that* window instead of the one it's currently tiled on. Also, make sure to update the window's stored current monitor after the grab ends (to make sure this is correct for the same reasons above).
1 parent de61d67 commit 65e1dcd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/core/window.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,12 +2963,16 @@ meta_window_maximize (MetaWindow *window,
29632963
return;
29642964
}
29652965

2966+
gboolean from_tiled = FALSE;
2967+
MetaRectangle resize_rect;
2968+
29662969
if (window->tile_mode != META_TILE_NONE)
29672970
{
29682971
saved_rect = &window->saved_rect;
29692972

29702973
window->maximized_vertically = FALSE;
29712974
window->tile_mode = META_TILE_NONE;
2975+
from_tiled = TRUE;
29722976
}
29732977

29742978
meta_window_maximize_internal (window,
@@ -2984,12 +2988,20 @@ meta_window_maximize (MetaWindow *window,
29842988
META_SIZE_CHANGE_MAXIMIZE,
29852989
&old_frame_rect, &old_buffer_rect);
29862990

2991+
resize_rect = window->unconstrained_rect;
2992+
2993+
if (from_tiled)
2994+
{
2995+
resize_rect.x = old_frame_rect.x;
2996+
resize_rect.y = old_frame_rect.y;
2997+
}
2998+
29872999
meta_window_move_resize_internal (window,
29883000
(META_MOVE_RESIZE_MOVE_ACTION |
29893001
META_MOVE_RESIZE_RESIZE_ACTION |
29903002
META_MOVE_RESIZE_STATE_CHANGED),
29913003
META_GRAVITY_NORTH_WEST,
2992-
window->unconstrained_rect);
3004+
resize_rect);
29933005
}
29943006
}
29953007

@@ -6786,6 +6798,8 @@ end_grab_op (MetaWindow *window,
67866798
}
67876799
window->display->preview_tile_mode = META_TILE_NONE;
67886800

6801+
meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP);
6802+
67896803
if (!(window->maximized_horizontally && window->maximized_vertically))
67906804
window->saved_maximize = FALSE;
67916805

0 commit comments

Comments
 (0)