mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
window: Really fix portrait orientation check for tiling
Commit3bfcb6d1
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:
parent
493e799398
commit
bc74d166dd
@ -1160,10 +1160,10 @@ update_move_maybe_tile (MetaWindowDrag *window_drag,
|
||||
/* Check if the cursor is in a position which triggers tiling
|
||||
* and set tile_mode accordingly.
|
||||
*/
|
||||
if (meta_window_can_tile_side_by_side (window) &&
|
||||
if (meta_window_can_tile_side_by_side (window, logical_monitor->number) &&
|
||||
x >= logical_monitor->rect.x && x < (work_area.x + shake_threshold))
|
||||
window_drag->preview_tile_mode = META_TILE_LEFT;
|
||||
else if (meta_window_can_tile_side_by_side (window) &&
|
||||
else if (meta_window_can_tile_side_by_side (window, logical_monitor->number) &&
|
||||
x >= work_area.x + work_area.width - shake_threshold &&
|
||||
x < (logical_monitor->rect.x + logical_monitor->rect.width))
|
||||
window_drag->preview_tile_mode = META_TILE_RIGHT;
|
||||
|
@ -2668,7 +2668,7 @@ handle_toggle_tiled (MetaDisplay *display,
|
||||
{
|
||||
meta_window_untile (window);
|
||||
}
|
||||
else if (meta_window_can_tile_side_by_side (window))
|
||||
else if (meta_window_can_tile_side_by_side (window, window->monitor->number))
|
||||
{
|
||||
window->tile_monitor_number = window->monitor->number;
|
||||
/* Maximization constraints beat tiling constraints, so if the window
|
||||
|
@ -778,7 +778,8 @@ void meta_window_update_for_monitors_changed (MetaWindow *window);
|
||||
void meta_window_on_all_workspaces_changed (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_should_attach_to_parent (MetaWindow *window);
|
||||
gboolean meta_window_can_tile_side_by_side (MetaWindow *window);
|
||||
gboolean meta_window_can_tile_side_by_side (MetaWindow *window,
|
||||
int monitor_number);
|
||||
|
||||
void meta_window_compute_tile_match (MetaWindow *window);
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user