0001-window-Pass-flag-to-meta_window_update_monitor-inste.patch

This commit is contained in:
Ray Strode 2019-01-14 10:06:44 -05:00
parent a8db59908f
commit 4035955fc0
5 changed files with 34 additions and 20 deletions

View File

@ -121,6 +121,12 @@ typedef enum
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1 << 5, META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1 << 5,
} MetaPlacementConstraintAdjustment; } MetaPlacementConstraintAdjustment;
typedef enum _MetaWindowUpdateMonitorFlags
{
META_WINDOW_UPDATE_MONITOR_FLAGS_NONE = 0,
META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP = 1 << 0,
} MetaWindowUpdateMonitorFlags;
typedef struct _MetaPlacementRule typedef struct _MetaPlacementRule
{ {
MetaRectangle anchor_rect; MetaRectangle anchor_rect;
@ -549,8 +555,8 @@ struct _MetaWindowClass
cairo_surface_t **icon, cairo_surface_t **icon,
cairo_surface_t **mini_icon); cairo_surface_t **mini_icon);
uint32_t (*get_client_pid) (MetaWindow *window); uint32_t (*get_client_pid) (MetaWindow *window);
void (*update_main_monitor) (MetaWindow *window, void (*update_main_monitor) (MetaWindow *window,
gboolean user_op); MetaWindowUpdateMonitorFlags flags);
void (*main_monitor_changed) (MetaWindow *window, void (*main_monitor_changed) (MetaWindow *window,
const MetaLogicalMonitor *old); const MetaLogicalMonitor *old);
void (*force_restore_shortcuts) (MetaWindow *window, void (*force_restore_shortcuts) (MetaWindow *window,
@ -768,8 +774,8 @@ void meta_window_activate_full (MetaWindow *window,
MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *window); MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *window);
MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window); MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window);
void meta_window_update_monitor (MetaWindow *window, void meta_window_update_monitor (MetaWindow *window,
gboolean user_op); MetaWindowUpdateMonitorFlags flags);
void meta_window_set_urgent (MetaWindow *window, void meta_window_set_urgent (MetaWindow *window,
gboolean urgent); gboolean urgent);

View File

@ -3802,7 +3802,8 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
if (window->override_redirect || window->type == META_WINDOW_DESKTOP) if (window->override_redirect || window->type == META_WINDOW_DESKTOP)
{ {
meta_window_update_monitor (window, FALSE); meta_window_update_monitor (window,
META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
return; return;
} }
@ -3837,18 +3838,19 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
} }
else else
{ {
meta_window_update_monitor (window, FALSE); meta_window_update_monitor (window,
META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
} }
} }
void void
meta_window_update_monitor (MetaWindow *window, meta_window_update_monitor (MetaWindow *window,
gboolean user_op) MetaWindowUpdateMonitorFlags flags)
{ {
const MetaLogicalMonitor *old; const MetaLogicalMonitor *old;
old = window->monitor; old = window->monitor;
META_WINDOW_GET_CLASS (window)->update_main_monitor (window, user_op); META_WINDOW_GET_CLASS (window)->update_main_monitor (window, flags);
if (old != window->monitor) if (old != window->monitor)
{ {
meta_window_on_all_workspaces_changed (window); meta_window_on_all_workspaces_changed (window);
@ -3862,7 +3864,8 @@ meta_window_update_monitor (MetaWindow *window,
* That should be handled by explicitly moving the window before changing the * That should be handled by explicitly moving the window before changing the
* workspace. * workspace.
*/ */
if (meta_prefs_get_workspaces_only_on_primary () && user_op && if (meta_prefs_get_workspaces_only_on_primary () &&
flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP &&
meta_window_is_on_primary_monitor (window) && meta_window_is_on_primary_monitor (window) &&
window->screen->active_workspace != window->workspace) window->screen->active_workspace != window->workspace)
meta_window_change_workspace (window, window->screen->active_workspace); meta_window_change_workspace (window, window->screen->active_workspace);
@ -3905,6 +3908,7 @@ meta_window_move_resize_internal (MetaWindow *window,
MetaRectangle constrained_rect; MetaRectangle constrained_rect;
MetaMoveResizeResultFlags result = 0; MetaMoveResizeResultFlags result = 0;
gboolean moved_or_resized = FALSE; gboolean moved_or_resized = FALSE;
MetaWindowUpdateMonitorFlags update_monitor_flags;
g_return_if_fail (!window->override_redirect); g_return_if_fail (!window->override_redirect);
@ -4005,13 +4009,17 @@ meta_window_move_resize_internal (MetaWindow *window,
did_placement); did_placement);
} }
update_monitor_flags = META_WINDOW_UPDATE_MONITOR_FLAGS_NONE;
if (flags & META_MOVE_RESIZE_USER_ACTION)
update_monitor_flags |= META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP;
if (window->monitor) if (window->monitor)
{ {
guint old_output_winsys_id; guint old_output_winsys_id;
old_output_winsys_id = window->monitor->winsys_id; old_output_winsys_id = window->monitor->winsys_id;
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION); meta_window_update_monitor (window, update_monitor_flags);
if (old_output_winsys_id != window->monitor->winsys_id && if (old_output_winsys_id != window->monitor->winsys_id &&
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION) flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
@ -4019,7 +4027,7 @@ meta_window_move_resize_internal (MetaWindow *window,
} }
else else
{ {
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION); meta_window_update_monitor (window, update_monitor_flags);
} }
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds) if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)

View File

@ -83,7 +83,7 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
meta_wayland_surface_role_get_surface (surface_role); meta_wayland_surface_role_get_surface (surface_role);
meta_wayland_surface_set_window (surface, window); meta_wayland_surface_set_window (surface, window);
meta_window_update_monitor (window, FALSE); meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
} }
void void

View File

@ -371,8 +371,8 @@ scale_rect_size (MetaRectangle *rect,
} }
static void static void
meta_window_wayland_update_main_monitor (MetaWindow *window, meta_window_wayland_update_main_monitor (MetaWindow *window,
gboolean user_op) MetaWindowUpdateMonitorFlags flags)
{ {
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager = MetaMonitorManager *monitor_manager =
@ -392,7 +392,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
toplevel_window = meta_wayland_surface_get_toplevel_window (window->surface); toplevel_window = meta_wayland_surface_get_toplevel_window (window->surface);
if (toplevel_window != window) if (toplevel_window != window)
{ {
meta_window_update_monitor (toplevel_window, user_op); meta_window_update_monitor (window, flags);
window->monitor = toplevel_window->monitor; window->monitor = toplevel_window->monitor;
return; return;
} }
@ -413,7 +413,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
return; return;
} }
if (!user_op) if (flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP)
{ {
window->monitor = to; window->monitor = to;
return; return;

View File

@ -1483,8 +1483,8 @@ meta_window_x11_update_icon (MetaWindow *window,
} }
static void static void
meta_window_x11_update_main_monitor (MetaWindow *window, meta_window_x11_update_main_monitor (MetaWindow *window,
gboolean user_op) MetaWindowUpdateMonitorFlags flags)
{ {
window->monitor = meta_window_calculate_main_logical_monitor (window); window->monitor = meta_window_calculate_main_logical_monitor (window);
} }
@ -3314,7 +3314,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
priv->client_rect = window->rect; priv->client_rect = window->rect;
window->buffer_rect = window->rect; window->buffer_rect = window->rect;
meta_window_update_monitor (window, FALSE); meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
/* Whether an override-redirect window is considered fullscreen depends /* Whether an override-redirect window is considered fullscreen depends
* on its geometry. * on its geometry.