window: Fix portrait orientation check for tiling

Use work area from the monitor that the window is currently on to
determine if tiling should be allowed.

Window tiling is disabled for monitors with portrait orientation, but
the work area we use to detect portrait orientation is taken from the
monitor that currently has the mouse pointer.

This works fine for edge tiling using the mouse, but this is broken when
using keybindings for window tiling because your mouse pointer could be
on a different monitor that has horizontal orientation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3199>
This commit is contained in:
Uzair Ahmad 2023-08-20 01:32:16 -04:00 committed by Robert Mader
parent 81a12a7db4
commit 3bfcb6d1b9

View File

@ -3045,15 +3045,15 @@ meta_window_can_tile_maximized (MetaWindow *window)
gboolean
meta_window_can_tile_side_by_side (MetaWindow *window)
{
int monitor;
MtkRectangle tile_area;
MtkRectangle client_rect;
if (!meta_window_can_tile_maximized (window))
return FALSE;
monitor = meta_display_get_current_monitor (window->display);
meta_window_get_work_area_for_monitor (window, monitor, &tile_area);
meta_window_get_work_area_for_monitor (window,
window->monitor->number,
&tile_area);
/* Do not allow tiling in portrait orientation */
if (tile_area.height > tile_area.width)