mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 11:30:45 -05:00
events: Make the ungrabbed button press handling more bullet proof
Instead of returning a value based on whether or not we handled it, we have this logic: either we have taken a grab on the window, in which case we have a grab op and have handled it ourselves, or we did not take a grab and *need* to replay the event to the window. Handle this in events.c by checking the grab operation in the same way that we check the other grab ops.
This commit is contained in:
parent
bb977c00ca
commit
31361e464a
@ -251,17 +251,23 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
bypass_clutter = TRUE;
|
bypass_clutter = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Under X11, we have a Sync grab and in order to send it back to
|
meta_window_handle_ungrabbed_event (window, event);
|
||||||
* clients, we have to explicitly replay it.
|
|
||||||
*
|
/* This might start a grab op. If it does, then filter out the
|
||||||
* Under Wayland, we retrieve all events and we have to make sure
|
* event, and if it doesn't, replay the event to release our
|
||||||
* to filter them out from Wayland clients.
|
* own sync grab. */
|
||||||
*/
|
|
||||||
if (meta_window_handle_ungrabbed_event (window, event))
|
if (display->grab_window == window &&
|
||||||
|
meta_grab_op_is_moving_or_resizing (display->grab_op))
|
||||||
{
|
{
|
||||||
|
bypass_clutter = TRUE;
|
||||||
bypass_wayland = TRUE;
|
bypass_wayland = TRUE;
|
||||||
}
|
}
|
||||||
else if (!clutter_event_get_event_sequence (event))
|
else
|
||||||
|
{
|
||||||
|
/* Only replay button press events, since that's where we
|
||||||
|
* have the synchronous grab. */
|
||||||
|
if (event->type == CLUTTER_BUTTON_PRESS)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
if (META_IS_BACKEND_X11 (backend))
|
if (META_IS_BACKEND_X11 (backend))
|
||||||
@ -273,6 +279,7 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
XIReplayDevice, event->button.time);
|
XIReplayDevice, event->button.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ void meta_window_handle_enter (MetaWindow *window,
|
|||||||
guint root_y);
|
guint root_y);
|
||||||
void meta_window_handle_leave (MetaWindow *window);
|
void meta_window_handle_leave (MetaWindow *window);
|
||||||
|
|
||||||
gboolean meta_window_handle_ungrabbed_event (MetaWindow *window,
|
void meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
void meta_window_get_client_area_rect (const MetaWindow *window,
|
void meta_window_get_client_area_rect (const MetaWindow *window,
|
||||||
|
@ -7871,7 +7871,7 @@ meta_window_handle_leave (MetaWindow *window)
|
|||||||
meta_window_lower (window);
|
meta_window_lower (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
meta_window_handle_ungrabbed_event (MetaWindow *window,
|
meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
@ -7880,17 +7880,17 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
gboolean is_window_grab;
|
gboolean is_window_grab;
|
||||||
|
|
||||||
if (event->type != CLUTTER_BUTTON_PRESS)
|
if (event->type != CLUTTER_BUTTON_PRESS)
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
if (display->grab_op != META_GRAB_OP_NONE)
|
if (display->grab_op != META_GRAB_OP_NONE)
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
/* Some windows might not ask for input, in which case we might be here
|
/* Some windows might not ask for input, in which case we might be here
|
||||||
* because we selected for ButtonPress on the root window. In that case,
|
* because we selected for ButtonPress on the root window. In that case,
|
||||||
* we have to take special care not to act for an override-redirect window.
|
* we have to take special care not to act for an override-redirect window.
|
||||||
*/
|
*/
|
||||||
if (window->override_redirect)
|
if (window->override_redirect)
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
/* We have three passive button grabs:
|
/* We have three passive button grabs:
|
||||||
* - on any button, without modifiers => focuses and maybe raises the window
|
* - on any button, without modifiers => focuses and maybe raises the window
|
||||||
@ -7941,7 +7941,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
|
|
||||||
meta_verbose ("Allowing events time %u\n",
|
meta_verbose ("Allowing events time %u\n",
|
||||||
(unsigned int)event->button.time);
|
(unsigned int)event->button.time);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_resize ())
|
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_resize ())
|
||||||
{
|
{
|
||||||
@ -7991,7 +7990,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
event->button.x,
|
event->button.x,
|
||||||
event->button.y);
|
event->button.y);
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_menu ())
|
else if (is_window_grab && (int) event->button.button == meta_prefs_get_mouse_button_menu ())
|
||||||
{
|
{
|
||||||
@ -8001,7 +7999,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
META_WINDOW_MENU_WM,
|
META_WINDOW_MENU_WM,
|
||||||
event->button.x,
|
event->button.x,
|
||||||
event->button.y);
|
event->button.y);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
else if (is_window_grab && (int) event->button.button == 1)
|
else if (is_window_grab && (int) event->button.button == 1)
|
||||||
{
|
{
|
||||||
@ -8019,10 +8016,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
event->button.x,
|
event->button.x,
|
||||||
event->button.y);
|
event->button.y);
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user