1
0
Fork 0

core: Pass "frame action" grab operations as an "unconstrained" grab op

The frame_action boolean is only used by constraints.c code, in order to
determine whether a moving window should be able to move past the top
bar or not.

We can avoid the special casing by passing this information as a
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED flag passed with the grab op.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
Carlos Garnacho 2022-09-29 15:55:11 +02:00 committed by Marge Bot
parent 589ec26b04
commit 2d8fa26c8e
4 changed files with 12 additions and 4 deletions

View file

@ -1769,7 +1769,8 @@ constrain_titlebar_visible (MetaWindow *window,
* clicking on the frame to start the move. * clicking on the frame to start the move.
*/ */
unconstrained_user_action = unconstrained_user_action =
info->is_user_action && !window->display->grab_frame_action; info->is_user_action &&
(window->display->grab_op & META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED) != 0;
/* Exit early if we know the constraint won't apply--note that this constraint /* Exit early if we know the constraint won't apply--note that this constraint
* is only meant for normal windows (e.g. we don't want docks to be shoved * is only meant for normal windows (e.g. we don't want docks to be shoved

View file

@ -172,7 +172,6 @@ struct _MetaDisplay
int grab_latest_motion_y; int grab_latest_motion_y;
guint grab_have_pointer : 1; guint grab_have_pointer : 1;
guint grab_have_keyboard : 1; guint grab_have_keyboard : 1;
guint grab_frame_action : 1;
MetaRectangle grab_initial_window_pos; MetaRectangle grab_initial_window_pos;
int grab_initial_x, grab_initial_y; /* These are only relevant for */ int grab_initial_x, grab_initial_y; /* These are only relevant for */
gboolean grab_threshold_movement_reached; /* raise_on_click == FALSE. */ gboolean grab_threshold_movement_reached; /* raise_on_click == FALSE. */

View file

@ -1670,6 +1670,8 @@ meta_display_notify_window_created (MetaDisplay *display,
static MetaCursor static MetaCursor
meta_cursor_for_grab_op (MetaGrabOp op) meta_cursor_for_grab_op (MetaGrabOp op)
{ {
op &= ~(META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
switch (op) switch (op)
{ {
case META_GRAB_OP_RESIZING_SE: case META_GRAB_OP_RESIZING_SE:
@ -1880,6 +1882,9 @@ meta_display_begin_grab_op (MetaDisplay *display,
return FALSE; return FALSE;
} }
if (!frame_action)
op |= META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED;
event_route = get_event_route_from_grab_op (op); event_route = get_event_route_from_grab_op (op);
if (event_route == META_EVENT_ROUTE_WINDOW_OP) if (event_route == META_EVENT_ROUTE_WINDOW_OP)
@ -1957,7 +1962,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_latest_motion_x = root_x; display->grab_latest_motion_x = root_x;
display->grab_latest_motion_y = root_y; display->grab_latest_motion_y = root_y;
display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT; display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT;
display->grab_frame_action = frame_action;
meta_display_update_cursor (display); meta_display_update_cursor (display);
@ -2047,7 +2051,6 @@ meta_display_end_grab_op (MetaDisplay *display,
display->grab_latest_motion_x = 0; display->grab_latest_motion_x = 0;
display->grab_latest_motion_y = 0; display->grab_latest_motion_y = 0;
display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT; display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT;
display->grab_frame_action = FALSE;
meta_display_update_cursor (display); meta_display_update_cursor (display);
@ -2564,6 +2567,8 @@ meta_resize_gravity_from_grab_op (MetaGrabOp op)
{ {
MetaGravity gravity; MetaGravity gravity;
op &= ~(META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
gravity = -1; gravity = -1;
switch (op) switch (op)
{ {

View file

@ -110,6 +110,7 @@ enum
{ {
META_GRAB_OP_WINDOW_FLAG_KEYBOARD = 0x0100, META_GRAB_OP_WINDOW_FLAG_KEYBOARD = 0x0100,
META_GRAB_OP_WINDOW_FLAG_UNKNOWN = 0x0200, META_GRAB_OP_WINDOW_FLAG_UNKNOWN = 0x0200,
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED = 0x0400,
META_GRAB_OP_WINDOW_DIR_WEST = 0x1000, META_GRAB_OP_WINDOW_DIR_WEST = 0x1000,
META_GRAB_OP_WINDOW_DIR_EAST = 0x2000, META_GRAB_OP_WINDOW_DIR_EAST = 0x2000,
META_GRAB_OP_WINDOW_DIR_SOUTH = 0x4000, META_GRAB_OP_WINDOW_DIR_SOUTH = 0x4000,
@ -119,6 +120,7 @@ enum
/* WGO = "window grab op". shorthand for below */ /* WGO = "window grab op". shorthand for below */
_WGO_K = META_GRAB_OP_WINDOW_FLAG_KEYBOARD, _WGO_K = META_GRAB_OP_WINDOW_FLAG_KEYBOARD,
_WGO_U = META_GRAB_OP_WINDOW_FLAG_UNKNOWN, _WGO_U = META_GRAB_OP_WINDOW_FLAG_UNKNOWN,
_WGO_C = META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
_WGO_W = META_GRAB_OP_WINDOW_DIR_WEST, _WGO_W = META_GRAB_OP_WINDOW_DIR_WEST,
_WGO_E = META_GRAB_OP_WINDOW_DIR_EAST, _WGO_E = META_GRAB_OP_WINDOW_DIR_EAST,
_WGO_S = META_GRAB_OP_WINDOW_DIR_SOUTH, _WGO_S = META_GRAB_OP_WINDOW_DIR_SOUTH,
@ -133,6 +135,7 @@ typedef enum
META_GRAB_OP_WINDOW_BASE, META_GRAB_OP_WINDOW_BASE,
META_GRAB_OP_MOVING = META_GRAB_OP_WINDOW_BASE, META_GRAB_OP_MOVING = META_GRAB_OP_WINDOW_BASE,
META_GRAB_OP_MOVING_UNCONSTRAINED = META_GRAB_OP_WINDOW_BASE | _WGO_C,
META_GRAB_OP_RESIZING_NW = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_W, META_GRAB_OP_RESIZING_NW = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_W,
META_GRAB_OP_RESIZING_N = META_GRAB_OP_WINDOW_BASE | _WGO_N, META_GRAB_OP_RESIZING_N = META_GRAB_OP_WINDOW_BASE | _WGO_N,
META_GRAB_OP_RESIZING_NE = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_E, META_GRAB_OP_RESIZING_NE = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_E,