backends/native: Avoid meta_input_device_native_get_seat_impl()

These objects already have a pointer to the ClutterSeat that has a
pointer to the MetaSeatImpl in its native implementation. This data
may be considered pretty much immutable (a pointer to the seat is
held, and the native implementation will shut down the implementation
thread within ClutterSeat finalization.

Avoids some awkward code, since the MetaInputDeviceNative needs to
be aware of the Clutter object implementation and the implementation
object.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3278>
This commit is contained in:
Carlos Garnacho 2023-09-13 18:54:05 +02:00
parent 48c9b638f3
commit 4ce97fba6c
4 changed files with 8 additions and 14 deletions

View File

@ -1563,12 +1563,6 @@ meta_input_device_native_new_virtual (MetaSeatImpl *seat_impl,
return CLUTTER_INPUT_DEVICE (device); return CLUTTER_INPUT_DEVICE (device);
} }
MetaSeatImpl *
meta_input_device_native_get_seat_impl (MetaInputDeviceNative *device)
{
return device->seat_impl;
}
void void
meta_input_device_native_update_leds_in_impl (MetaInputDeviceNative *device, meta_input_device_native_update_leds_in_impl (MetaInputDeviceNative *device,
enum libinput_led leds) enum libinput_led leds)

View File

@ -139,8 +139,6 @@ ClutterInputDevice * meta_input_device_native_new_virtual (MetaSeatImpl
ClutterInputDeviceType type, ClutterInputDeviceType type,
ClutterInputMode mode); ClutterInputMode mode);
MetaSeatImpl * meta_input_device_native_get_seat_impl (MetaInputDeviceNative *device);
void meta_input_device_native_update_leds_in_impl (MetaInputDeviceNative *device, void meta_input_device_native_update_leds_in_impl (MetaInputDeviceNative *device,
enum libinput_led leds); enum libinput_led leds);

View File

@ -803,9 +803,11 @@ meta_seat_impl_notify_button_in_impl (MetaSeatImpl *seat_impl,
static MetaSeatImpl * static MetaSeatImpl *
seat_impl_from_device (ClutterInputDevice *device) seat_impl_from_device (ClutterInputDevice *device)
{ {
MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device); ClutterSeat *seat;
return meta_input_device_native_get_seat_impl (device_native); seat = clutter_input_device_get_seat (device);
return META_SEAT_NATIVE (seat)->impl;
} }
static void static void

View File

@ -158,19 +158,19 @@ static gboolean
release_device_in_impl (GTask *task) release_device_in_impl (GTask *task)
{ {
ImplState *impl_state = g_task_get_task_data (task); ImplState *impl_state = g_task_get_task_data (task);
MetaInputDeviceNative *device_native; ClutterSeat *seat;
MetaSeatImpl *seat_impl; MetaSeatImpl *seat_impl;
int code; int code;
uint64_t time_us; uint64_t time_us;
ClutterEvent *device_event; ClutterEvent *device_event;
device_native = META_INPUT_DEVICE_NATIVE (impl_state->device); seat = clutter_input_device_get_seat (impl_state->device);
seat_impl = meta_input_device_native_get_seat_impl (device_native); seat_impl = META_SEAT_NATIVE (seat)->impl;
time_us = g_get_monotonic_time (); time_us = g_get_monotonic_time ();
meta_topic (META_DEBUG_INPUT, meta_topic (META_DEBUG_INPUT,
"Releasing pressed buttons while destroying virtual input device " "Releasing pressed buttons while destroying virtual input device "
"(device %p)", device_native); "(device %p)", impl_state->device);
for (code = 0; code < G_N_ELEMENTS (impl_state->button_count); code++) for (code = 0; code < G_N_ELEMENTS (impl_state->button_count); code++)
{ {