Commit f7189894 authored by verdre's avatar verdre

Move tracking the number of touch sequences to ClutterInputDevice

Move the tracking of the number of touch sequences on the screen to
determine whether the sequence is pointer emulating from
MetaGestureTracker to ClutterInputDevice. To do this, add new API to get
the number of touches to ClutterInputDevice and remove the API from
MetaGestureTracker.

This is a first step for removing the sequence tracking inside
meta-gesture-tracker, also it makes the check more clear since we can
compare the number against 1 now (the number of sequences of the input
device is already updated at this point).

GNOME/mutter!790
parent dd6227e3
Pipeline #113786 failed with stages
in 2 minutes and 37 seconds
......@@ -2212,6 +2212,23 @@ clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
return g_hash_table_lookup (device->sequence_grab_actors, sequence);
}
/**
* clutter_input_device_get_n_sequences:
* @device: a #ClutterInputDevice
*
* Retrieves the number of sequences that are active on the
* @device right now.
*
* Return value: the current number of sequences on the device
*/
guint
clutter_input_device_get_n_sequences (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
return g_hash_table_size (device->touch_sequences_info);
}
/**
* clutter_input_device_get_vendor_id:
* @device: a slave #ClutterInputDevice
......
......@@ -129,6 +129,8 @@ void clutter_input_device_sequence_ungrab (ClutterInputDev
CLUTTER_EXPORT
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
guint clutter_input_device_get_n_sequences (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
......
......@@ -133,9 +133,8 @@ static gboolean
sequence_is_pointer_emulated (MetaDisplay *display,
const ClutterEvent *event)
{
ClutterEventSequence *sequence;
sequence = clutter_event_get_event_sequence (event);
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterInputDevice *device = clutter_event_get_device (event);
if (!sequence)
return FALSE;
......@@ -154,16 +153,9 @@ sequence_is_pointer_emulated (MetaDisplay *display,
* on screen gets the "pointer emulated" flag, and it won't get assigned
* to another sequence until the next first touch on an idle touchscreen.
*/
if (META_IS_BACKEND_NATIVE (backend))
{
MetaGestureTracker *tracker;
tracker = meta_display_get_gesture_tracker (display);
if (event->type == CLUTTER_TOUCH_BEGIN &&
meta_gesture_tracker_get_n_current_touches (tracker) == 0)
return TRUE;
}
if (META_IS_BACKEND_NATIVE (backend) &&
clutter_input_device_get_n_sequences (device) == 1)
return TRUE;
#endif /* HAVE_NATIVE_BACKEND */
return FALSE;
......
......@@ -72,6 +72,5 @@ gboolean meta_gesture_tracker_set_sequence_state (MetaGestureTracker
MetaSequenceState state);
MetaSequenceState meta_gesture_tracker_get_sequence_state (MetaGestureTracker *tracker,
ClutterEventSequence *sequence);
gint meta_gesture_tracker_get_n_current_touches (MetaGestureTracker *tracker);
#endif /* META_GESTURE_TRACKER_PRIVATE_H */
......@@ -573,14 +573,3 @@ meta_gesture_tracker_get_sequence_state (MetaGestureTracker *tracker,
return info->state;
}
gint
meta_gesture_tracker_get_n_current_touches (MetaGestureTracker *tracker)
{
MetaGestureTrackerPrivate *priv;
g_return_val_if_fail (META_IS_GESTURE_TRACKER (tracker), 0);
priv = meta_gesture_tracker_get_instance_private (tracker);
return g_hash_table_size (priv->sequences);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment