window: Really fix portrait orientation check for tiling

Commit 3bfcb6d1 fixed the check for tiling via keybindings, but
ignored a subtle edge case when tiling with the pointer: The
monitor used for tiling is the monitor with the pointer, which
is not necessarily the one that contains the largest part of the
window.

That is, the correct monitor to check against depends on the
context where the function is called. We can either figure
it out automatically via the current window drag, or make it
a parameter.

The latter is clearer, because the callers already decide which
monitor to use for tiling anyway.

Fixes: 3bfcb6d1b9 ("window: Fix portrait orientation check for tiling")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3248>
This commit is contained in:
Florian Müllner
2023-09-06 12:24:00 +02:00
committed by Marge Bot
parent 493e799398
commit bc74d166dd
4 changed files with 8 additions and 8 deletions

View File

@ -3043,7 +3043,8 @@ meta_window_can_tile_maximized (MetaWindow *window)
}
gboolean
meta_window_can_tile_side_by_side (MetaWindow *window)
meta_window_can_tile_side_by_side (MetaWindow *window,
int monitor_number)
{
MtkRectangle tile_area;
MtkRectangle client_rect;
@ -3051,9 +3052,7 @@ meta_window_can_tile_side_by_side (MetaWindow *window)
if (!meta_window_can_tile_maximized (window))
return FALSE;
meta_window_get_work_area_for_monitor (window,
window->monitor->number,
&tile_area);
meta_window_get_work_area_for_monitor (window, monitor_number, &tile_area);
/* Do not allow tiling in portrait orientation */
if (tile_area.height > tile_area.width)