|
|
776610 |
From 30266605b58e02b017e793fc898917874590e01c Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
776610 |
Date: Fri, 24 Aug 2018 12:54:50 +0200
|
|
|
776610 |
Subject: [PATCH 1/2] window: Pass flag to meta_window_update_monitor() instead
|
|
|
776610 |
of bool
|
|
|
776610 |
|
|
|
776610 |
The bool determines whether the call was directly from a user operation
|
|
|
776610 |
or not. To add more state into the call without having to add more
|
|
|
776610 |
boolenas, change the boolean to a flag (so far with 'none' and 'user-op'
|
|
|
776610 |
as possible values). No functional changes were made.
|
|
|
776610 |
|
|
|
776610 |
https://gitlab.gnome.org/GNOME/mutter/issues/192
|
|
|
776610 |
|
|
|
776610 |
(cherry picked from commit f4d07caa38e51d09ee73bab20334a6b5c28952d6)
|
|
|
776610 |
---
|
|
|
776610 |
src/core/window-private.h | 14 ++++++++++----
|
|
|
776610 |
src/core/window.c | 24 ++++++++++++++++--------
|
|
|
776610 |
src/wayland/meta-wayland-shell-surface.c | 2 +-
|
|
|
776610 |
src/wayland/meta-window-wayland.c | 8 ++++----
|
|
|
776610 |
src/x11/window-x11.c | 6 +++---
|
|
|
776610 |
5 files changed, 34 insertions(+), 20 deletions(-)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/core/window-private.h b/src/core/window-private.h
|
|
|
776610 |
index eb86b642c..bed2fc7f6 100644
|
|
|
776610 |
--- a/src/core/window-private.h
|
|
|
776610 |
+++ b/src/core/window-private.h
|
|
|
776610 |
@@ -121,6 +121,12 @@ typedef enum
|
|
|
776610 |
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1 << 5,
|
|
|
776610 |
} MetaPlacementConstraintAdjustment;
|
|
|
776610 |
|
|
|
776610 |
+typedef enum _MetaWindowUpdateMonitorFlags
|
|
|
776610 |
+{
|
|
|
776610 |
+ META_WINDOW_UPDATE_MONITOR_FLAGS_NONE = 0,
|
|
|
776610 |
+ META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP = 1 << 0,
|
|
|
776610 |
+} MetaWindowUpdateMonitorFlags;
|
|
|
776610 |
+
|
|
|
776610 |
typedef struct _MetaPlacementRule
|
|
|
776610 |
{
|
|
|
776610 |
MetaRectangle anchor_rect;
|
|
|
776610 |
@@ -549,8 +555,8 @@ struct _MetaWindowClass
|
|
|
776610 |
cairo_surface_t **icon,
|
|
|
776610 |
cairo_surface_t **mini_icon);
|
|
|
776610 |
uint32_t (*get_client_pid) (MetaWindow *window);
|
|
|
776610 |
- void (*update_main_monitor) (MetaWindow *window,
|
|
|
776610 |
- gboolean user_op);
|
|
|
776610 |
+ void (*update_main_monitor) (MetaWindow *window,
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags flags);
|
|
|
776610 |
void (*main_monitor_changed) (MetaWindow *window,
|
|
|
776610 |
const MetaLogicalMonitor *old);
|
|
|
776610 |
void (*force_restore_shortcuts) (MetaWindow *window,
|
|
|
776610 |
@@ -768,8 +774,8 @@ void meta_window_activate_full (MetaWindow *window,
|
|
|
776610 |
MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *window);
|
|
|
776610 |
|
|
|
776610 |
MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window);
|
|
|
776610 |
-void meta_window_update_monitor (MetaWindow *window,
|
|
|
776610 |
- gboolean user_op);
|
|
|
776610 |
+void meta_window_update_monitor (MetaWindow *window,
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags flags);
|
|
|
776610 |
|
|
|
776610 |
void meta_window_set_urgent (MetaWindow *window,
|
|
|
776610 |
gboolean urgent);
|
|
|
776610 |
diff --git a/src/core/window.c b/src/core/window.c
|
|
|
776610 |
index cc0813ac4..5547169d8 100644
|
|
|
776610 |
--- a/src/core/window.c
|
|
|
776610 |
+++ b/src/core/window.c
|
|
|
776610 |
@@ -3804,7 +3804,8 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|
|
776610 |
|
|
|
776610 |
if (window->override_redirect || window->type == META_WINDOW_DESKTOP)
|
|
|
776610 |
{
|
|
|
776610 |
- meta_window_update_monitor (window, FALSE);
|
|
|
776610 |
+ meta_window_update_monitor (window,
|
|
|
776610 |
+ META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
|
|
|
776610 |
return;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
@@ -3839,18 +3840,19 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|
|
776610 |
}
|
|
|
776610 |
else
|
|
|
776610 |
{
|
|
|
776610 |
- meta_window_update_monitor (window, FALSE);
|
|
|
776610 |
+ meta_window_update_monitor (window,
|
|
|
776610 |
+ META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
|
|
|
776610 |
}
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
void
|
|
|
776610 |
-meta_window_update_monitor (MetaWindow *window,
|
|
|
776610 |
- gboolean user_op)
|
|
|
776610 |
+meta_window_update_monitor (MetaWindow *window,
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags flags)
|
|
|
776610 |
{
|
|
|
776610 |
const MetaLogicalMonitor *old;
|
|
|
776610 |
|
|
|
776610 |
old = window->monitor;
|
|
|
776610 |
- META_WINDOW_GET_CLASS (window)->update_main_monitor (window, user_op);
|
|
|
776610 |
+ META_WINDOW_GET_CLASS (window)->update_main_monitor (window, flags);
|
|
|
776610 |
if (old != window->monitor)
|
|
|
776610 |
{
|
|
|
776610 |
meta_window_on_all_workspaces_changed (window);
|
|
|
776610 |
@@ -3864,7 +3866,8 @@ meta_window_update_monitor (MetaWindow *window,
|
|
|
776610 |
* That should be handled by explicitly moving the window before changing the
|
|
|
776610 |
* workspace.
|
|
|
776610 |
*/
|
|
|
776610 |
- if (meta_prefs_get_workspaces_only_on_primary () && user_op &&
|
|
|
776610 |
+ if (meta_prefs_get_workspaces_only_on_primary () &&
|
|
|
776610 |
+ flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP &&
|
|
|
776610 |
meta_window_is_on_primary_monitor (window) &&
|
|
|
776610 |
window->screen->active_workspace != window->workspace)
|
|
|
776610 |
meta_window_change_workspace (window, window->screen->active_workspace);
|
|
|
776610 |
@@ -3907,6 +3910,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
776610 |
MetaRectangle constrained_rect;
|
|
|
776610 |
MetaMoveResizeResultFlags result = 0;
|
|
|
776610 |
gboolean moved_or_resized = FALSE;
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags update_monitor_flags;
|
|
|
776610 |
|
|
|
776610 |
g_return_if_fail (!window->override_redirect);
|
|
|
776610 |
|
|
|
776610 |
@@ -4007,13 +4011,17 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
776610 |
did_placement);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
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 |
+
|
|
|
776610 |
if (window->monitor)
|
|
|
776610 |
{
|
|
|
776610 |
guint old_output_winsys_id;
|
|
|
776610 |
|
|
|
776610 |
old_output_winsys_id = window->monitor->winsys_id;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
|
|
776610 |
+ meta_window_update_monitor (window, update_monitor_flags);
|
|
|
776610 |
|
|
|
776610 |
if (old_output_winsys_id != window->monitor->winsys_id &&
|
|
|
776610 |
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
|
|
|
776610 |
@@ -4021,7 +4029,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|
|
776610 |
}
|
|
|
776610 |
else
|
|
|
776610 |
{
|
|
|
776610 |
- meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
|
|
776610 |
+ meta_window_update_monitor (window, update_monitor_flags);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
|
|
776610 |
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
|
|
|
776610 |
index b5f3acacf..72b3557c7 100644
|
|
|
776610 |
--- a/src/wayland/meta-wayland-shell-surface.c
|
|
|
776610 |
+++ b/src/wayland/meta-wayland-shell-surface.c
|
|
|
776610 |
@@ -83,7 +83,7 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
|
|
776610 |
meta_wayland_surface_role_get_surface (surface_role);
|
|
|
776610 |
|
|
|
776610 |
meta_wayland_surface_set_window (surface, window);
|
|
|
776610 |
- meta_window_update_monitor (window, FALSE);
|
|
|
776610 |
+ meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
void
|
|
|
776610 |
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
|
|
|
776610 |
index 8bafb252f..544c60b5b 100644
|
|
|
776610 |
--- a/src/wayland/meta-window-wayland.c
|
|
|
776610 |
+++ b/src/wayland/meta-window-wayland.c
|
|
|
776610 |
@@ -371,8 +371,8 @@ scale_rect_size (MetaRectangle *rect,
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
-meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
- gboolean user_op)
|
|
|
776610 |
+meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags flags)
|
|
|
776610 |
{
|
|
|
776610 |
MetaBackend *backend = meta_get_backend ();
|
|
|
776610 |
MetaMonitorManager *monitor_manager =
|
|
|
776610 |
@@ -392,7 +392,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
toplevel_window = meta_wayland_surface_get_toplevel_window (window->surface);
|
|
|
776610 |
if (toplevel_window != window)
|
|
|
776610 |
{
|
|
|
776610 |
- meta_window_update_monitor (toplevel_window, user_op);
|
|
|
776610 |
+ meta_window_update_monitor (window, flags);
|
|
|
776610 |
window->monitor = toplevel_window->monitor;
|
|
|
776610 |
return;
|
|
|
776610 |
}
|
|
|
776610 |
@@ -413,7 +413,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
return;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
- if (!user_op)
|
|
|
776610 |
+ if (flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP)
|
|
|
776610 |
{
|
|
|
776610 |
window->monitor = to;
|
|
|
776610 |
return;
|
|
|
776610 |
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
|
776610 |
index e9bd8ae65..e1c34412d 100644
|
|
|
776610 |
--- a/src/x11/window-x11.c
|
|
|
776610 |
+++ b/src/x11/window-x11.c
|
|
|
776610 |
@@ -1483,8 +1483,8 @@ meta_window_x11_update_icon (MetaWindow *window,
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
-meta_window_x11_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
- gboolean user_op)
|
|
|
776610 |
+meta_window_x11_update_main_monitor (MetaWindow *window,
|
|
|
776610 |
+ MetaWindowUpdateMonitorFlags flags)
|
|
|
776610 |
{
|
|
|
776610 |
window->monitor = meta_window_calculate_main_logical_monitor (window);
|
|
|
776610 |
}
|
|
|
776610 |
@@ -3314,7 +3314,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
|
|
|
776610 |
priv->client_rect = window->rect;
|
|
|
776610 |
window->buffer_rect = window->rect;
|
|
|
776610 |
|
|
|
776610 |
- meta_window_update_monitor (window, FALSE);
|
|
|
776610 |
+ meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
|
|
|
776610 |
|
|
|
776610 |
/* Whether an override-redirect window is considered fullscreen depends
|
|
|
776610 |
* on its geometry.
|
|
|
776610 |
--
|
|
|
776610 |
2.19.0
|
|
|
776610 |
|