compositor: Fix handling of keyboard-driven window resize

The introduction of the META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
flag threw off some checks around keyboard-driven resize. This
was partly because there were some == checks that did not account
for that flag maybe being enabled, but also the handling
of META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN into a definite
resize direction was maybe unsetting that flag. Fix both things
at the same time.

Fixes: 2d8fa26c8e ("core: Pass "frame action" grab operations as an "unconstrained" grab op")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2629
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2871>
This commit is contained in:
Carlos Garnacho 2023-02-27 12:57:32 +01:00 committed by Marge Bot
parent 022e20e87e
commit 5bdc08099e
2 changed files with 17 additions and 5 deletions

View File

@ -722,10 +722,14 @@ process_keyboard_resize_grab_op_change (MetaWindowDrag *window_drag,
MetaWindow *window,
ClutterKeyEvent *event)
{
MetaGrabOp op, unconstrained;
gboolean handled;
op = (window_drag->grab_op & ~META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
unconstrained = (window_drag->grab_op & META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
handled = FALSE;
switch (window_drag->grab_op)
switch (op)
{
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
switch (event->keyval)
@ -828,6 +832,8 @@ process_keyboard_resize_grab_op_change (MetaWindowDrag *window_drag,
break;
}
window_drag->grab_op |= unconstrained;
if (handled)
{
update_keyboard_resize (window_drag, TRUE);
@ -1091,7 +1097,8 @@ process_key_event (MetaWindowDrag *window_drag,
if (window_drag->grab_op & META_GRAB_OP_WINDOW_FLAG_KEYBOARD)
{
if (window_drag->grab_op == META_GRAB_OP_KEYBOARD_MOVING)
if ((window_drag->grab_op & META_GRAB_OP_KEYBOARD_MOVING) ==
META_GRAB_OP_KEYBOARD_MOVING)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard move");
@ -1454,9 +1461,12 @@ update_resize (MetaWindowDrag *window_drag,
if (dx == 0 && dy == 0)
return;
if (window_drag->grab_op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)
if ((window_drag->grab_op & META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN) ==
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)
{
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE | META_GRAB_OP_WINDOW_FLAG_KEYBOARD;
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE |
META_GRAB_OP_WINDOW_FLAG_KEYBOARD |
(window_drag->grab_op & META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
if (dx > 0)
op |= META_GRAB_OP_WINDOW_DIR_EAST;

View File

@ -1198,7 +1198,9 @@ meta_grab_op_is_keyboard (MetaGrabOp op)
gboolean
meta_grab_op_is_resizing (MetaGrabOp op)
{
return (op & META_GRAB_OP_WINDOW_DIR_MASK) != 0 || op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN;
return (op & META_GRAB_OP_WINDOW_DIR_MASK) != 0 ||
(op & META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN) ==
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN;
}
gboolean