core: Move away from MetaEventRoute
We can check MetaGrabOp for the same effect, just do that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
parent
bb9cab1491
commit
ee94b07159
@ -69,7 +69,7 @@ meta_window_show_close_dialog (MetaWindow *window)
|
||||
meta_close_dialog_show (window->close_dialog);
|
||||
|
||||
if (window->display &&
|
||||
window->display->event_route == META_EVENT_ROUTE_NORMAL &&
|
||||
window->display->grab_op == META_GRAB_OP_NONE &&
|
||||
window == window->display->focus_window)
|
||||
meta_close_dialog_focus (window->close_dialog);
|
||||
}
|
||||
|
@ -1267,13 +1267,10 @@ meta_display_windows_are_interactable (MetaDisplay *display)
|
||||
if (clutter_stage_get_grab_actor (CLUTTER_STAGE (stage)))
|
||||
return FALSE;
|
||||
|
||||
switch (display->event_route)
|
||||
{
|
||||
case META_EVENT_ROUTE_NORMAL:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
if (display->grab_op == META_GRAB_OP_NONE)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1880,16 +1877,13 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
|
||||
event_route = get_event_route_from_grab_op (op);
|
||||
|
||||
if (event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
else
|
||||
{
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
else
|
||||
{
|
||||
display->grab_initial_x = root_x;
|
||||
display->grab_initial_y = root_y;
|
||||
display->grab_threshold_movement_reached = FALSE;
|
||||
}
|
||||
display->grab_initial_x = root_x;
|
||||
display->grab_initial_y = root_y;
|
||||
display->grab_threshold_movement_reached = FALSE;
|
||||
}
|
||||
|
||||
grab_window = window;
|
||||
@ -1928,17 +1922,14 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
}
|
||||
|
||||
/* Grab keys when beginning window ops; see #126497 */
|
||||
if (event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
{
|
||||
display->grab_have_keyboard = meta_window_grab_all_keys (grab_window, timestamp);
|
||||
display->grab_have_keyboard = meta_window_grab_all_keys (grab_window, timestamp);
|
||||
|
||||
if (!display->grab_have_keyboard)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer");
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
display->grab_have_pointer = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
if (!display->grab_have_keyboard)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer");
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
display->grab_have_pointer = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
display->event_route = event_route;
|
||||
@ -1973,8 +1964,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
g_signal_emit (display, display_signals[GRAB_OP_BEGIN], 0,
|
||||
display->grab_window, display->grab_op);
|
||||
|
||||
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
meta_window_grab_op_began (display->grab_window, display->grab_op);
|
||||
meta_window_grab_op_began (display->grab_window, display->grab_op);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -1989,7 +1979,7 @@ meta_display_end_grab_op (MetaDisplay *display,
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Ending grab op %u at time %u", grab_op, timestamp);
|
||||
|
||||
if (display->event_route == META_EVENT_ROUTE_NORMAL)
|
||||
if (display->grab_op == META_GRAB_OP_NONE)
|
||||
return;
|
||||
|
||||
g_assert (grab_window != NULL);
|
||||
@ -1999,23 +1989,20 @@ meta_display_end_grab_op (MetaDisplay *display,
|
||||
* up to date. */
|
||||
display->grab_op = META_GRAB_OP_NONE;
|
||||
|
||||
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
{
|
||||
/* Clear out the edge cache */
|
||||
meta_display_cleanup_edges (display);
|
||||
/* Clear out the edge cache */
|
||||
meta_display_cleanup_edges (display);
|
||||
|
||||
/* Only raise the window in orthogonal raise
|
||||
* ('do-not-raise-on-click') mode if the user didn't try to move
|
||||
* or resize the given window by at least a threshold amount.
|
||||
* For raise on click mode, the window was raised at the
|
||||
* beginning of the grab_op.
|
||||
*/
|
||||
if (!meta_prefs_get_raise_on_click () &&
|
||||
!display->grab_threshold_movement_reached)
|
||||
meta_window_raise (display->grab_window);
|
||||
/* Only raise the window in orthogonal raise
|
||||
* ('do-not-raise-on-click') mode if the user didn't try to move
|
||||
* or resize the given window by at least a threshold amount.
|
||||
* For raise on click mode, the window was raised at the
|
||||
* beginning of the grab_op.
|
||||
*/
|
||||
if (!meta_prefs_get_raise_on_click () &&
|
||||
!display->grab_threshold_movement_reached)
|
||||
meta_window_raise (display->grab_window);
|
||||
|
||||
meta_window_grab_op_ended (grab_window, grab_op);
|
||||
}
|
||||
meta_window_grab_op_ended (grab_window, grab_op);
|
||||
|
||||
if (display->grab_have_pointer)
|
||||
{
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
#endif
|
||||
|
||||
#define META_GRAB_OP_GET_BASE_TYPE(op) (op & 0x00FF)
|
||||
|
||||
#define IS_GESTURE_EVENT(e) ((e)->type == CLUTTER_TOUCHPAD_SWIPE || \
|
||||
(e)->type == CLUTTER_TOUCHPAD_PINCH || \
|
||||
(e)->type == CLUTTER_TOUCHPAD_HOLD || \
|
||||
@ -85,9 +87,9 @@ get_window_for_event (MetaDisplay *display,
|
||||
const ClutterEvent *event,
|
||||
ClutterActor *event_actor)
|
||||
{
|
||||
switch (display->event_route)
|
||||
switch (META_GRAB_OP_GET_BASE_TYPE (display->grab_op))
|
||||
{
|
||||
case META_EVENT_ROUTE_NORMAL:
|
||||
case META_GRAB_OP_NONE:
|
||||
{
|
||||
MetaWindowActor *window_actor;
|
||||
|
||||
@ -107,7 +109,7 @@ get_window_for_event (MetaDisplay *display,
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
case META_EVENT_ROUTE_WINDOW_OP:
|
||||
case META_GRAB_OP_WINDOW_BASE:
|
||||
return display->grab_window;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@ -387,7 +389,7 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
if (display->grab_op != META_GRAB_OP_NONE)
|
||||
{
|
||||
if (meta_window_handle_mouse_grab_op_event (window, event))
|
||||
{
|
||||
@ -413,7 +415,7 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
/* Do not pass keyboard events to Wayland if key focus is not on the
|
||||
* stage in normal mode (e.g. during keynav in the panel)
|
||||
*/
|
||||
if (display->event_route == META_EVENT_ROUTE_NORMAL)
|
||||
if (display->grab_op == META_GRAB_OP_NONE)
|
||||
{
|
||||
if (IS_KEY_EVENT (event) && !stage_has_key_focus (display))
|
||||
{
|
||||
@ -482,7 +484,7 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
* event, and if it doesn't, replay the event to release our
|
||||
* own sync grab. */
|
||||
|
||||
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||
if (display->grab_op != META_GRAB_OP_NONE)
|
||||
{
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
|
@ -4642,7 +4642,7 @@ meta_window_focus (MetaWindow *window,
|
||||
backend = backend_from_window (window);
|
||||
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
|
||||
if (window->display->event_route == META_EVENT_ROUTE_NORMAL &&
|
||||
if (window->display->grab_op == META_GRAB_OP_NONE &&
|
||||
clutter_stage_get_grab_actor (stage) == NULL)
|
||||
clutter_stage_set_key_focus (stage, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user