mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
window: Pass flag to meta_window_update_monitor() instead of bool
The bool determines whether the call was directly from a user operation or not. To add more state into the call without having to add more boolenas, change the boolean to a flag (so far with 'none' and 'user-op' as possible values). No functional changes were made. https://gitlab.gnome.org/GNOME/mutter/issues/192
This commit is contained in:
parent
8a6d502e68
commit
f4d07caa38
@ -121,6 +121,12 @@ typedef enum
|
||||
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 1 << 5,
|
||||
} MetaPlacementConstraintAdjustment;
|
||||
|
||||
typedef enum _MetaWindowUpdateMonitorFlags
|
||||
{
|
||||
META_WINDOW_UPDATE_MONITOR_FLAGS_NONE = 0,
|
||||
META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP = 1 << 0,
|
||||
} MetaWindowUpdateMonitorFlags;
|
||||
|
||||
typedef struct _MetaPlacementRule
|
||||
{
|
||||
MetaRectangle anchor_rect;
|
||||
@ -549,7 +555,7 @@ struct _MetaWindowClass
|
||||
cairo_surface_t **mini_icon);
|
||||
uint32_t (*get_client_pid) (MetaWindow *window);
|
||||
void (*update_main_monitor) (MetaWindow *window,
|
||||
gboolean user_op);
|
||||
MetaWindowUpdateMonitorFlags flags);
|
||||
void (*main_monitor_changed) (MetaWindow *window,
|
||||
const MetaLogicalMonitor *old);
|
||||
void (*force_restore_shortcuts) (MetaWindow *window,
|
||||
@ -767,7 +773,7 @@ MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *win
|
||||
|
||||
MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window);
|
||||
void meta_window_update_monitor (MetaWindow *window,
|
||||
gboolean user_op);
|
||||
MetaWindowUpdateMonitorFlags flags);
|
||||
|
||||
void meta_window_set_urgent (MetaWindow *window,
|
||||
gboolean urgent);
|
||||
|
@ -3825,7 +3825,8 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -3860,19 +3861,20 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_window_update_monitor (window, FALSE);
|
||||
meta_window_update_monitor (window,
|
||||
META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_update_monitor (MetaWindow *window,
|
||||
gboolean user_op)
|
||||
MetaWindowUpdateMonitorFlags flags)
|
||||
{
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
const MetaLogicalMonitor *old;
|
||||
|
||||
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)
|
||||
{
|
||||
meta_window_on_all_workspaces_changed (window);
|
||||
@ -3886,7 +3888,8 @@ meta_window_update_monitor (MetaWindow *window,
|
||||
* That should be handled by explicitly moving the window before changing the
|
||||
* 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) &&
|
||||
workspace_manager->active_workspace != window->workspace)
|
||||
meta_window_change_workspace (window, workspace_manager->active_workspace);
|
||||
@ -3930,6 +3933,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
MetaRectangle constrained_rect;
|
||||
MetaMoveResizeResultFlags result = 0;
|
||||
gboolean moved_or_resized = FALSE;
|
||||
MetaWindowUpdateMonitorFlags update_monitor_flags;
|
||||
|
||||
g_return_if_fail (!window->override_redirect);
|
||||
|
||||
@ -4030,13 +4034,17 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
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)
|
||||
{
|
||||
guint old_output_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 &&
|
||||
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
|
||||
@ -4044,7 +4052,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
||||
}
|
||||
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)
|
||||
|
@ -91,7 +91,7 @@ meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
|
||||
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
|
||||
|
@ -372,7 +372,7 @@ scale_rect_size (MetaRectangle *rect,
|
||||
|
||||
static void
|
||||
meta_window_wayland_update_main_monitor (MetaWindow *window,
|
||||
gboolean user_op)
|
||||
MetaWindowUpdateMonitorFlags flags)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
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);
|
||||
if (toplevel_window != window)
|
||||
{
|
||||
meta_window_update_monitor (toplevel_window, user_op);
|
||||
meta_window_update_monitor (window, flags);
|
||||
window->monitor = toplevel_window->monitor;
|
||||
return;
|
||||
}
|
||||
@ -413,7 +413,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user_op)
|
||||
if (flags & META_WINDOW_UPDATE_MONITOR_FLAGS_USER_OP)
|
||||
{
|
||||
window->monitor = to;
|
||||
return;
|
||||
|
@ -1502,7 +1502,7 @@ meta_window_x11_update_icon (MetaWindow *window,
|
||||
|
||||
static void
|
||||
meta_window_x11_update_main_monitor (MetaWindow *window,
|
||||
gboolean user_op)
|
||||
MetaWindowUpdateMonitorFlags flags)
|
||||
{
|
||||
window->monitor = meta_window_calculate_main_logical_monitor (window);
|
||||
}
|
||||
@ -3339,7 +3339,7 @@ meta_window_x11_configure_notify (MetaWindow *window,
|
||||
priv->client_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
|
||||
* on its geometry.
|
||||
|
Loading…
Reference in New Issue
Block a user