|
|
776610 |
From fa495286a1037d610051ab49f0aa1e8b20e38066 Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
776610 |
Date: Tue, 6 Nov 2018 13:35:31 +0100
|
|
|
776610 |
Subject: [PATCH] window: Really force update monitor on hot plugs
|
|
|
776610 |
|
|
|
776610 |
Commit 8d3e05305 ("window: Force update monitor on hot plugs") added the
|
|
|
776610 |
flag `META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE` passed to
|
|
|
776610 |
`update_monitor()` from `update_for_monitors_changed()`.
|
|
|
776610 |
|
|
|
776610 |
However, `update_for_monitors_changed()` may choose to call another code
|
|
|
776610 |
path to `move_between_rects()` and `meta_window_move_resize_internal()`
|
|
|
776610 |
eventually.
|
|
|
776610 |
|
|
|
776610 |
As `meta_window_move_resize_internal()` does not use the "force" flag,
|
|
|
776610 |
we may still end up in case where the window->monitor is left unchanged.
|
|
|
776610 |
|
|
|
776610 |
To avoid that problem, add a new `MetaMoveResizeFlags` that
|
|
|
776610 |
`update_for_monitors_changed()` can use to force the monitor update from
|
|
|
776610 |
`meta_window_move_resize_internal()`.
|
|
|
776610 |
|
|
|
776610 |
Fixes: 8d3e05305 ("window: Force update monitor on hot plugs")
|
|
|
776610 |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/189
|
|
|
776610 |
---
|
|
|
776610 |
src/core/window-private.h | 1 +
|
|
|
776610 |
src/core/window.c | 16 +++++++++++++---
|
|
|
776610 |
2 files changed, 14 insertions(+), 3 deletions(-)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/core/window-private.h b/src/core/window-private.h
|
|
|
776610 |
index 6fc943f72..4cc05d934 100644
|
|
|
776610 |
--- a/src/core/window-private.h
|
|
|
776610 |
+++ b/src/core/window-private.h
|
|
|
776610 |
@@ -80,6 +80,7 @@ typedef enum
|
|
|
776610 |
META_MOVE_RESIZE_UNMAXIMIZE = 1 << 6,
|
|
|
776610 |
META_MOVE_RESIZE_FORCE_MOVE = 1 << 7,
|
|
|
776610 |
META_MOVE_RESIZE_WAYLAND_STATE_CHANGED = 1 << 8,
|
|
|
776610 |
+ META_MOVE_RESIZE_FORCE_UPDATE_MONITOR = 1 << 9,
|
|
|
776610 |
} MetaMoveResizeFlags;
|
|
|
776610 |
|
|
|
776610 |
typedef enum
|
|
|
776610 |
diff --git a/src/core/window.c b/src/core/window.c
|
|
|
776610 |
index d00719e23..4d9e51d8c 100644
|
|
|
776610 |
--- a/src/core/window.c
|
|
|
776610 |
+++ b/src/core/window.c
|
|
|
776610 |
@@ -120,6 +120,7 @@ static gboolean queue_calc_showing_func (MetaWindow *window,
|
|
|
776610 |
void *data);
|
|
|
776610 |
|
|
|
776610 |
static void meta_window_move_between_rects (MetaWindow *window,
|
|
|
776610 |
+ MetaMoveResizeFlags move_resize_flags,
|
|
|
776610 |
const MetaRectangle *old_area,
|
|
|
776610 |
const MetaRectangle *new_area);
|
|
|
776610 |
|
|
|
776610 |
@@ -3864,6 +3865,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|
|
776610 |
* monitors changed and the same index could be refereing
|
|
|
776610 |
* to a different monitor. */
|
|
|
776610 |
meta_window_move_between_rects (window,
|
|
|
776610 |
+ META_MOVE_RESIZE_FORCE_UPDATE_MONITOR,
|
|
|
776610 |
&old->rect,
|
|
|
776610 |
&new->rect);
|
|
|
776610 |
}
|
|
|
776610 |
@@ -4045,6 +4047,8 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
776610 |
update_monitor_flags = META_WINDOW_UPDATE_MONITOR_FLAGS_NONE;
|
|
|
776610 |
if (flags & META_MOVE_RESIZE_USER_ACTION)
|
|
|
776610 |
update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP;
|
|
|
776610 |
+ if (flags & META_MOVE_RESIZE_FORCE_UPDATE_MONITOR)
|
|
|
776610 |
+ update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE;
|
|
|
776610 |
|
|
|
776610 |
if (window->monitor)
|
|
|
776610 |
{
|
|
|
776610 |
@@ -4104,6 +4108,7 @@ meta_window_move_frame (MetaWindow *window,
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
meta_window_move_between_rects (MetaWindow *window,
|
|
|
776610 |
+ MetaMoveResizeFlags move_resize_flags,
|
|
|
776610 |
const MetaRectangle *old_area,
|
|
|
776610 |
const MetaRectangle *new_area)
|
|
|
776610 |
{
|
|
|
776610 |
@@ -4127,7 +4132,12 @@ meta_window_move_between_rects (MetaWindow *window,
|
|
|
776610 |
window->saved_rect.x = window->unconstrained_rect.x;
|
|
|
776610 |
window->saved_rect.y = window->unconstrained_rect.y;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_move_resize_now (window);
|
|
|
776610 |
+ meta_window_move_resize_internal (window,
|
|
|
776610 |
+ move_resize_flags |
|
|
|
776610 |
+ META_MOVE_RESIZE_MOVE_ACTION |
|
|
|
776610 |
+ META_MOVE_RESIZE_RESIZE_ACTION,
|
|
|
776610 |
+ NorthWestGravity,
|
|
|
776610 |
+ window->unconstrained_rect);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
/**
|
|
|
776610 |
@@ -4188,14 +4198,14 @@ meta_window_move_to_monitor (MetaWindow *window,
|
|
|
776610 |
window->unconstrained_rect.height == 0 ||
|
|
|
776610 |
!meta_rectangle_overlap (&window->unconstrained_rect, &old_area))
|
|
|
776610 |
{
|
|
|
776610 |
- meta_window_move_between_rects (window, NULL, &new_area);
|
|
|
776610 |
+ meta_window_move_between_rects (window, 0, NULL, &new_area);
|
|
|
776610 |
}
|
|
|
776610 |
else
|
|
|
776610 |
{
|
|
|
776610 |
if (monitor == window->monitor->number)
|
|
|
776610 |
return;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_move_between_rects (window, &old_area, &new_area);
|
|
|
776610 |
+ meta_window_move_between_rects (window, 0, &old_area, &new_area);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
|
|
776610 |
--
|
|
|
776610 |
2.20.1
|
|
|
776610 |
|