backends: Do not use clutter_event_[set|is]_pointer_emulated()

Add a new ClutterEventFlag to propagate this information, affecting
a few selected events on each backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2023-07-21 18:44:17 +02:00
parent 9e96b523ea
commit a08eea7f10
5 changed files with 11 additions and 8 deletions

View File

@ -706,6 +706,7 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
CLUTTER_EVENT_FLAG_REPEATED = 1 << 2, CLUTTER_EVENT_FLAG_REPEATED = 1 << 2,
CLUTTER_EVENT_FLAG_RELATIVE_MOTION = 1 << 3, CLUTTER_EVENT_FLAG_RELATIVE_MOTION = 1 << 3,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY = 1 << 4, CLUTTER_EVENT_FLAG_GRAB_NOTIFY = 1 << 4,
CLUTTER_EVENT_FLAG_POINTER_EMULATED = 1 << 5,
} ClutterEventFlags; } ClutterEventFlags;
/** /**

View File

@ -1130,7 +1130,8 @@ notify_scroll (ClutterInputDevice *input_device,
event->scroll.scroll_source = scroll_source; event->scroll.scroll_source = scroll_source;
event->scroll.finish_flags = flags; event->scroll.finish_flags = flags;
_clutter_event_set_pointer_emulated (event, emulated); if (emulated)
event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
queue_event (seat_impl, event); queue_event (seat_impl, event);
} }
@ -1163,7 +1164,8 @@ notify_discrete_scroll (ClutterInputDevice *input_device,
clutter_event_set_source_device (event, input_device); clutter_event_set_source_device (event, input_device);
event->scroll.scroll_source = scroll_source; event->scroll.scroll_source = scroll_source;
_clutter_event_set_pointer_emulated (event, emulated); if (emulated)
event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
queue_event (seat_impl, event); queue_event (seat_impl, event);
} }

View File

@ -2320,7 +2320,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
} }
if (xev->flags & XIPointerEmulated) if (xev->flags & XIPointerEmulated)
_clutter_event_set_pointer_emulated (event, TRUE); event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
if (xi_event->evtype == XI_ButtonPress) if (xi_event->evtype == XI_ButtonPress)
meta_stage_x11_set_user_time (stage_x11, event->button.time); meta_stage_x11_set_user_time (stage_x11, event->button.time);
@ -2403,7 +2403,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
&xev->valuators); &xev->valuators);
if (xev->flags & XIPointerEmulated) if (xev->flags & XIPointerEmulated)
_clutter_event_set_pointer_emulated (event, TRUE); event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)", g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
@ -2475,7 +2475,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
event->touch.sequence = GINT_TO_POINTER (MAX (1, xev->detail + 1)); event->touch.sequence = GINT_TO_POINTER (MAX (1, xev->detail + 1));
if (xev->flags & XITouchEmulatingPointer) if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE); event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
g_debug ("touch %s: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)", g_debug ("touch %s: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end", event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
@ -2523,7 +2523,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
event->touch.modifier_state |= CLUTTER_BUTTON1_MASK; event->touch.modifier_state |= CLUTTER_BUTTON1_MASK;
if (xev->flags & XITouchEmulatingPointer) if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE); event->any.flags |= CLUTTER_EVENT_FLAG_POINTER_EMULATED;
meta_seat_x11_update_touchpoint (seat, meta_seat_x11_update_touchpoint (seat,
event->touch.sequence, event->touch.sequence,

View File

@ -138,7 +138,7 @@ sequence_is_pointer_emulated (MetaDisplay *display,
if (!sequence) if (!sequence)
return FALSE; return FALSE;
if (clutter_event_is_pointer_emulated (event)) if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_POINTER_EMULATED)
return TRUE; return TRUE;
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND

View File

@ -767,7 +767,7 @@ handle_scroll_event (MetaWaylandPointer *pointer,
MetaWaylandPointerClient *client; MetaWaylandPointerClient *client;
gboolean is_discrete_event = FALSE, is_value120_event = FALSE; gboolean is_discrete_event = FALSE, is_value120_event = FALSE;
if (clutter_event_is_pointer_emulated (event)) if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_POINTER_EMULATED)
return; return;
client = pointer->focus_client; client = pointer->focus_client;