backends: Unify touch sequence to slot conversion

We had code in both backends that sort of independently associated
sequences to slots. Make both transform slots to sequences the same
way, so they may share the implementation convert those back to slots.

This helper now lives in Clutter API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
This commit is contained in:
Carlos Garnacho
2020-12-08 12:51:56 +01:00
committed by Marge Bot
parent 9f5c453fc7
commit eaa04ecee5
10 changed files with 18 additions and 37 deletions

View File

@ -154,23 +154,3 @@ meta_event_native_get_relative_motion (const ClutterEvent *event,
else
return FALSE;
}
/**
* meta_event_native_sequence_get_slot:
* @sequence: a #ClutterEventSequence
*
* Retrieves the touch slot triggered by this @sequence
*
* Returns: the libinput touch slot.
*
* Since: 1.20
* Stability: unstable
**/
int32_t
meta_event_native_sequence_get_slot (const ClutterEventSequence *sequence)
{
if (!sequence)
return -1;
return GPOINTER_TO_INT (sequence) - 1;
}

View File

@ -42,6 +42,4 @@ gboolean meta_event_native_get_relative_motion (const ClutterEvent *eve
double *dx_unaccel,
double *dy_unaccel);
int32_t meta_event_native_sequence_get_slot (const ClutterEventSequence *sequence);
#endif /* META_EVENT_NATIVE_H */

View File

@ -2890,7 +2890,7 @@ meta_seat_impl_query_state (MetaSeatImpl *seat_impl,
MetaTouchState *touch_state;
int slot;
slot = meta_event_native_sequence_get_slot (sequence);
slot = clutter_event_sequence_get_slot (sequence);
touch_state = meta_seat_impl_lookup_touch_state_in_impl (seat_impl, slot);
if (!touch_state)
goto out;