mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
window: Really force update monitor on hot plugs
Commit8d3e05305
("window: Force update monitor on hot plugs") added the flag `META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE` passed to `update_monitor()` from `update_for_monitors_changed()`. However, `update_for_monitors_changed()` may choose to call another code path to `move_between_rects()` and `meta_window_move_resize_internal()` eventually. As `meta_window_move_resize_internal()` does not use the "force" flag, we may still end up in case where the window->monitor is left unchanged. To avoid that problem, add a new `MetaMoveResizeFlags` that `update_for_monitors_changed()` can use to force the monitor update from `meta_window_move_resize_internal()`. Fixes:8d3e05305
("window: Force update monitor on hot plugs") Closes: https://gitlab.gnome.org/GNOME/mutter/issues/189 (cherry picked from commitfa495286a1
) (cherry picked from commit8eabfaaa8b
)
This commit is contained in:
parent
00cd99c3a7
commit
ce808f6792
@ -82,6 +82,7 @@ typedef enum
|
|||||||
META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6,
|
META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6,
|
||||||
META_MOVE_RESIZE_FORCE_MOVE = 1 << 7,
|
META_MOVE_RESIZE_FORCE_MOVE = 1 << 7,
|
||||||
META_MOVE_RESIZE_WAYLAND_STATE_CHANGED = 1 << 8,
|
META_MOVE_RESIZE_WAYLAND_STATE_CHANGED = 1 << 8,
|
||||||
|
META_MOVE_RESIZE_FORCE_UPDATE_MONITOR = 1 << 9,
|
||||||
} MetaMoveResizeFlags;
|
} MetaMoveResizeFlags;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -119,6 +119,7 @@ static gboolean queue_calc_showing_func (MetaWindow *window,
|
|||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
static void meta_window_move_between_rects (MetaWindow *window,
|
static void meta_window_move_between_rects (MetaWindow *window,
|
||||||
|
MetaMoveResizeFlags move_resize_flags,
|
||||||
const MetaRectangle *old_area,
|
const MetaRectangle *old_area,
|
||||||
const MetaRectangle *new_area);
|
const MetaRectangle *new_area);
|
||||||
|
|
||||||
@ -3839,6 +3840,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|||||||
* monitors changed and the same index could be refereing
|
* monitors changed and the same index could be refereing
|
||||||
* to a different monitor. */
|
* to a different monitor. */
|
||||||
meta_window_move_between_rects (window,
|
meta_window_move_between_rects (window,
|
||||||
|
META_MOVE_RESIZE_FORCE_UPDATE_MONITOR,
|
||||||
&old->rect,
|
&old->rect,
|
||||||
&new->rect);
|
&new->rect);
|
||||||
}
|
}
|
||||||
@ -4018,6 +4020,8 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
update_monitor_flags = META_WINDOW_UPDATE_MONITOR_FLAGS_NONE;
|
update_monitor_flags = META_WINDOW_UPDATE_MONITOR_FLAGS_NONE;
|
||||||
if (flags & META_MOVE_RESIZE_USER_ACTION)
|
if (flags & META_MOVE_RESIZE_USER_ACTION)
|
||||||
update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP;
|
update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP;
|
||||||
|
if (flags & META_MOVE_RESIZE_FORCE_UPDATE_MONITOR)
|
||||||
|
update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE;
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
@ -4077,6 +4081,7 @@ meta_window_move_frame (MetaWindow *window,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_move_between_rects (MetaWindow *window,
|
meta_window_move_between_rects (MetaWindow *window,
|
||||||
|
MetaMoveResizeFlags move_resize_flags,
|
||||||
const MetaRectangle *old_area,
|
const MetaRectangle *old_area,
|
||||||
const MetaRectangle *new_area)
|
const MetaRectangle *new_area)
|
||||||
{
|
{
|
||||||
@ -4100,7 +4105,12 @@ meta_window_move_between_rects (MetaWindow *window,
|
|||||||
window->saved_rect.x = window->unconstrained_rect.x;
|
window->saved_rect.x = window->unconstrained_rect.x;
|
||||||
window->saved_rect.y = window->unconstrained_rect.y;
|
window->saved_rect.y = window->unconstrained_rect.y;
|
||||||
|
|
||||||
meta_window_move_resize_now (window);
|
meta_window_move_resize_internal (window,
|
||||||
|
move_resize_flags |
|
||||||
|
META_MOVE_RESIZE_MOVE_ACTION |
|
||||||
|
META_MOVE_RESIZE_RESIZE_ACTION,
|
||||||
|
NorthWestGravity,
|
||||||
|
window->unconstrained_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4161,14 +4171,14 @@ meta_window_move_to_monitor (MetaWindow *window,
|
|||||||
window->unconstrained_rect.height == 0 ||
|
window->unconstrained_rect.height == 0 ||
|
||||||
!meta_rectangle_overlap (&window->unconstrained_rect, &old_area))
|
!meta_rectangle_overlap (&window->unconstrained_rect, &old_area))
|
||||||
{
|
{
|
||||||
meta_window_move_between_rects (window, NULL, &new_area);
|
meta_window_move_between_rects (window, 0, NULL, &new_area);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (monitor == window->monitor->number)
|
if (monitor == window->monitor->number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_window_move_between_rects (window, &old_area, &new_area);
|
meta_window_move_between_rects (window, 0, &old_area, &new_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user