core: Pass ClutterStage explicitly to MetaGestureTracker
Pass a ClutterStage argument explicitly, instead of fetching it from the event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
parent
77510ca72d
commit
85b13ebd18
@ -63,24 +63,29 @@ typedef enum
|
|||||||
EVENTS_UNFREEZE_REPLAY,
|
EVENTS_UNFREEZE_REPLAY,
|
||||||
} EventsUnfreezeMethod;
|
} EventsUnfreezeMethod;
|
||||||
|
|
||||||
static gboolean
|
static ClutterStage *
|
||||||
stage_has_key_focus (MetaDisplay *display)
|
stage_from_display (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
MetaContext *context = meta_display_get_context (display);
|
MetaContext *context = meta_display_get_context (display);
|
||||||
MetaBackend *backend = meta_context_get_backend (context);
|
MetaBackend *backend = meta_context_get_backend (context);
|
||||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
|
||||||
|
|
||||||
return clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == stage;
|
return CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
stage_has_key_focus (MetaDisplay *display)
|
||||||
|
{
|
||||||
|
ClutterStage *stage = stage_from_display (display);
|
||||||
|
|
||||||
|
return clutter_stage_get_key_focus (stage) == CLUTTER_ACTOR (stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
stage_has_grab (MetaDisplay *display)
|
stage_has_grab (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
MetaContext *context = meta_display_get_context (display);
|
ClutterStage *stage = stage_from_display (display);
|
||||||
MetaBackend *backend = meta_context_get_backend (context);
|
|
||||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
|
||||||
|
|
||||||
return clutter_stage_get_grab_actor (CLUTTER_STAGE (stage)) != NULL;
|
return clutter_stage_get_grab_actor (stage) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaWindow *
|
static MetaWindow *
|
||||||
@ -393,7 +398,9 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
|
|
||||||
gesture_tracker = meta_display_get_gesture_tracker (display);
|
gesture_tracker = meta_display_get_gesture_tracker (display);
|
||||||
|
|
||||||
if (meta_gesture_tracker_handle_event (gesture_tracker, event))
|
if (meta_gesture_tracker_handle_event (gesture_tracker,
|
||||||
|
stage_from_display (display),
|
||||||
|
event))
|
||||||
{
|
{
|
||||||
bypass_wayland = TRUE;
|
bypass_wayland = TRUE;
|
||||||
bypass_clutter = FALSE;
|
bypass_clutter = FALSE;
|
||||||
|
@ -58,6 +58,7 @@ GType meta_gesture_tracker_get_type (void) G_GNUC_CONST
|
|||||||
MetaGestureTracker * meta_gesture_tracker_new (void);
|
MetaGestureTracker * meta_gesture_tracker_new (void);
|
||||||
|
|
||||||
gboolean meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
gboolean meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
||||||
|
ClutterStage *stage,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
gboolean meta_gesture_tracker_set_sequence_state (MetaGestureTracker *tracker,
|
gboolean meta_gesture_tracker_set_sequence_state (MetaGestureTracker *tracker,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
|
@ -421,13 +421,13 @@ meta_gesture_tracker_untrack_stage (MetaGestureTracker *tracker)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
||||||
|
ClutterStage *stage,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaGestureTrackerPrivate *priv;
|
MetaGestureTrackerPrivate *priv;
|
||||||
ClutterEventSequence *sequence;
|
ClutterEventSequence *sequence;
|
||||||
MetaSequenceState state;
|
MetaSequenceState state;
|
||||||
MetaSequenceInfo *info;
|
MetaSequenceInfo *info;
|
||||||
ClutterActor *stage;
|
|
||||||
gfloat x, y;
|
gfloat x, y;
|
||||||
|
|
||||||
sequence = clutter_event_get_event_sequence (event);
|
sequence = clutter_event_get_event_sequence (event);
|
||||||
@ -436,13 +436,12 @@ meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
priv = meta_gesture_tracker_get_instance_private (tracker);
|
priv = meta_gesture_tracker_get_instance_private (tracker);
|
||||||
stage = CLUTTER_ACTOR (clutter_event_get_stage (event));
|
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case CLUTTER_TOUCH_BEGIN:
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
if (g_hash_table_size (priv->sequences) == 0)
|
if (g_hash_table_size (priv->sequences) == 0)
|
||||||
meta_gesture_tracker_track_stage (tracker, stage);
|
meta_gesture_tracker_track_stage (tracker, CLUTTER_ACTOR (stage));
|
||||||
|
|
||||||
info = meta_sequence_info_new (tracker, event);
|
info = meta_sequence_info_new (tracker, event);
|
||||||
g_hash_table_insert (priv->sequences, sequence, info);
|
g_hash_table_insert (priv->sequences, sequence, info);
|
||||||
|
Loading…
Reference in New Issue
Block a user