core: Simplify handling of ungrabbing condition
Unlike the comment suggests, this piece of event handling manages the ungrabbing of a window on button press in the following 2 conditions: - If a keyboard grab operation was triggered, the window does additionally follow the pointer, and first button press ends the grab. - If a button-press grab is ongoing on the window, but more buttons are pressed. We can simplify this to just happen every time a button press event is received while a window grab op is ongoing. The only case where this might diverge a bit is same button presses from different pointer devices, and it's not a big stretch to also undo the grab in that situation. This also happens to make the "button" argument in meta_display_begin_grab_op() completely unused. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
parent
2d8fa26c8e
commit
43081fc8bd
@ -6300,22 +6300,14 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
{
|
||||
ClutterModifierType grab_mods = meta_display_get_compositor_modifiers (window->display);
|
||||
|
||||
/* This is the keybinding or menu case where we've
|
||||
* been dragging around the window without the button
|
||||
* pressed. */
|
||||
|
||||
if ((meta_grab_op_is_mouse (window->display->grab_op) &&
|
||||
(event->button.modifier_state & grab_mods) == grab_mods &&
|
||||
window->display->grab_button != (int) event->button.button) ||
|
||||
meta_grab_op_is_keyboard (window->display->grab_op))
|
||||
{
|
||||
* pressed, or the case of pressing extra mouse buttons
|
||||
* while a grab op is ongoing.
|
||||
*/
|
||||
end_grab_op (window, event);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case CLUTTER_TOUCH_END:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
|
Loading…
Reference in New Issue
Block a user