mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 11:30:45 -05:00
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,
|
||||
} EventsUnfreezeMethod;
|
||||
|
||||
static gboolean
|
||||
stage_has_key_focus (MetaDisplay *display)
|
||||
static ClutterStage *
|
||||
stage_from_display (MetaDisplay *display)
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
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
|
||||
stage_has_grab (MetaDisplay *display)
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||
ClutterStage *stage = stage_from_display (display);
|
||||
|
||||
return clutter_stage_get_grab_actor (CLUTTER_STAGE (stage)) != NULL;
|
||||
return clutter_stage_get_grab_actor (stage) != NULL;
|
||||
}
|
||||
|
||||
static MetaWindow *
|
||||
@ -393,7 +398,9 @@ meta_display_handle_event (MetaDisplay *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_clutter = FALSE;
|
||||
|
@ -58,6 +58,7 @@ GType meta_gesture_tracker_get_type (void) G_GNUC_CONST
|
||||
MetaGestureTracker * meta_gesture_tracker_new (void);
|
||||
|
||||
gboolean meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
||||
ClutterStage *stage,
|
||||
const ClutterEvent *event);
|
||||
gboolean meta_gesture_tracker_set_sequence_state (MetaGestureTracker *tracker,
|
||||
ClutterEventSequence *sequence,
|
||||
|
@ -421,13 +421,13 @@ meta_gesture_tracker_untrack_stage (MetaGestureTracker *tracker)
|
||||
|
||||
gboolean
|
||||
meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
||||
ClutterStage *stage,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaGestureTrackerPrivate *priv;
|
||||
ClutterEventSequence *sequence;
|
||||
MetaSequenceState state;
|
||||
MetaSequenceInfo *info;
|
||||
ClutterActor *stage;
|
||||
gfloat x, y;
|
||||
|
||||
sequence = clutter_event_get_event_sequence (event);
|
||||
@ -436,13 +436,12 @@ meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
|
||||
return FALSE;
|
||||
|
||||
priv = meta_gesture_tracker_get_instance_private (tracker);
|
||||
stage = CLUTTER_ACTOR (clutter_event_get_stage (event));
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
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);
|
||||
g_hash_table_insert (priv->sequences, sequence, info);
|
||||
|
Loading…
Reference in New Issue
Block a user