backends: Drop extra layer of touch info handling
We have a hashtable in the device that does not add much on top to the seat handling. Make all the places rely on the seat accounting instead. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
This commit is contained in:
parent
c9a405ff9e
commit
e28007edb9
3 changed files with 6 additions and 69 deletions
|
@ -67,10 +67,6 @@ meta_input_device_native_finalize (GObject *object)
|
|||
if (device_evdev->libinput_device)
|
||||
libinput_device_unref (device_evdev->libinput_device);
|
||||
|
||||
meta_input_device_native_release_touch_slots (device_evdev,
|
||||
g_get_monotonic_time ());
|
||||
g_clear_pointer (&device_evdev->touches, g_hash_table_unref);
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
meta_seat_native_release_device_id (META_SEAT_NATIVE (seat), device);
|
||||
|
@ -1228,45 +1224,6 @@ meta_input_device_native_a11y_maybe_notify_toggle_keys (MetaInputDeviceNative *d
|
|||
meta_input_device_native_bell_notify (device);
|
||||
}
|
||||
|
||||
static void
|
||||
release_device_touch_slot (gpointer value)
|
||||
{
|
||||
MetaTouchState *touch_state = value;
|
||||
|
||||
meta_seat_native_release_touch_state (touch_state->seat,
|
||||
touch_state->seat_slot);
|
||||
}
|
||||
|
||||
MetaTouchState *
|
||||
meta_input_device_native_acquire_touch_state (MetaInputDeviceNative *device,
|
||||
int device_slot)
|
||||
{
|
||||
MetaTouchState *touch_state;
|
||||
|
||||
touch_state = meta_seat_native_acquire_touch_state (device->seat,
|
||||
device_slot);
|
||||
g_hash_table_insert (device->touches,
|
||||
GINT_TO_POINTER (device_slot),
|
||||
touch_state);
|
||||
|
||||
return touch_state;
|
||||
}
|
||||
|
||||
MetaTouchState *
|
||||
meta_input_device_native_lookup_touch_state (MetaInputDeviceNative *device,
|
||||
int device_slot)
|
||||
{
|
||||
return g_hash_table_lookup (device->touches, GINT_TO_POINTER (device_slot));
|
||||
}
|
||||
|
||||
void
|
||||
meta_input_device_native_release_touch_state (MetaInputDeviceNative *device,
|
||||
MetaTouchState *touch_state)
|
||||
{
|
||||
g_hash_table_remove (device->touches,
|
||||
GINT_TO_POINTER (touch_state->device_slot));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_device_native_class_init (MetaInputDeviceNativeClass *klass)
|
||||
{
|
||||
|
@ -1306,9 +1263,6 @@ meta_input_device_native_init (MetaInputDeviceNative *self)
|
|||
cairo_matrix_init_identity (&self->device_matrix);
|
||||
self->device_aspect_ratio = 0;
|
||||
self->output_ratio = 0;
|
||||
|
||||
self->touches = g_hash_table_new_full (NULL, NULL,
|
||||
NULL, release_device_touch_slot);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -69,8 +69,6 @@ struct _MetaInputDeviceNative
|
|||
double device_aspect_ratio; /* w:h */
|
||||
double output_ratio; /* w:h */
|
||||
|
||||
GHashTable *touches;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKeyboardA11yFlags a11y_flags;
|
||||
GList *slow_keys_list;
|
||||
|
@ -125,15 +123,6 @@ void meta_input_device_native_translate_coordinates (Clutte
|
|||
void meta_input_device_native_apply_kbd_a11y_settings (MetaInputDeviceNative *device,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
MetaTouchState * meta_input_device_native_acquire_touch_state (MetaInputDeviceNative *device,
|
||||
int device_slot);
|
||||
|
||||
MetaTouchState * meta_input_device_native_lookup_touch_state (MetaInputDeviceNative *device,
|
||||
int device_slot);
|
||||
|
||||
void meta_input_device_native_release_touch_state (MetaInputDeviceNative *device,
|
||||
MetaTouchState *touch_state);
|
||||
|
||||
void meta_input_device_native_a11y_maybe_notify_toggle_keys (MetaInputDeviceNative *device_evdev);
|
||||
|
||||
struct libinput_device * meta_input_device_native_get_libinput_device (ClutterInputDevice *device);
|
||||
|
|
|
@ -546,8 +546,6 @@ meta_virtual_input_device_native_notify_touch_down (ClutterVirtualInputDevice *v
|
|||
{
|
||||
MetaVirtualInputDeviceNative *virtual_evdev =
|
||||
META_VIRTUAL_INPUT_DEVICE_NATIVE (virtual_device);
|
||||
MetaInputDeviceNative *device_evdev =
|
||||
META_INPUT_DEVICE_NATIVE (virtual_evdev->device);
|
||||
MetaTouchState *touch_state;
|
||||
guint seat_slot;
|
||||
|
||||
|
@ -557,8 +555,8 @@ meta_virtual_input_device_native_notify_touch_down (ClutterVirtualInputDevice *v
|
|||
time_us = g_get_monotonic_time ();
|
||||
|
||||
seat_slot = virtual_evdev->slot_base + (guint) device_slot;
|
||||
touch_state = meta_input_device_native_acquire_touch_state (device_evdev,
|
||||
seat_slot);
|
||||
touch_state = meta_seat_native_acquire_touch_state (virtual_evdev->seat,
|
||||
seat_slot);
|
||||
if (!touch_state)
|
||||
return;
|
||||
|
||||
|
@ -583,8 +581,6 @@ meta_virtual_input_device_native_notify_touch_motion (ClutterVirtualInputDevice
|
|||
{
|
||||
MetaVirtualInputDeviceNative *virtual_evdev =
|
||||
META_VIRTUAL_INPUT_DEVICE_NATIVE (virtual_device);
|
||||
MetaInputDeviceNative *device_evdev =
|
||||
META_INPUT_DEVICE_NATIVE (virtual_evdev->device);
|
||||
MetaTouchState *touch_state;
|
||||
guint seat_slot;
|
||||
|
||||
|
@ -594,8 +590,8 @@ meta_virtual_input_device_native_notify_touch_motion (ClutterVirtualInputDevice
|
|||
time_us = g_get_monotonic_time ();
|
||||
|
||||
seat_slot = virtual_evdev->slot_base + (guint) device_slot;
|
||||
touch_state = meta_input_device_native_lookup_touch_state (device_evdev,
|
||||
seat_slot);
|
||||
touch_state = meta_seat_native_lookup_touch_state (virtual_evdev->seat,
|
||||
seat_slot);
|
||||
if (!touch_state)
|
||||
return;
|
||||
|
||||
|
@ -618,8 +614,6 @@ meta_virtual_input_device_native_notify_touch_up (ClutterVirtualInputDevice *vir
|
|||
{
|
||||
MetaVirtualInputDeviceNative *virtual_evdev =
|
||||
META_VIRTUAL_INPUT_DEVICE_NATIVE (virtual_device);
|
||||
MetaInputDeviceNative *device_evdev =
|
||||
META_INPUT_DEVICE_NATIVE (virtual_evdev->device);
|
||||
MetaTouchState *touch_state;
|
||||
guint seat_slot;
|
||||
|
||||
|
@ -629,8 +623,8 @@ meta_virtual_input_device_native_notify_touch_up (ClutterVirtualInputDevice *vir
|
|||
time_us = g_get_monotonic_time ();
|
||||
|
||||
seat_slot = virtual_evdev->slot_base + (guint) device_slot;
|
||||
touch_state = meta_input_device_native_lookup_touch_state (device_evdev,
|
||||
seat_slot);
|
||||
touch_state = meta_seat_native_lookup_touch_state (virtual_evdev->seat,
|
||||
seat_slot);
|
||||
if (!touch_state)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue