backends/native: Pass ClutterSeat into virtual input device constructor
Avoid passing the MetaSeatImpl, since it may be potentially null at MetaSeatNative construction time. An example of this triggering issues are mousekeys, since those work on an emulated pointer device created indirectly after a keyboard device is added (and the right settings are enabled) at a time that the MetaSeatImpl is still being created, so the MetaSeatNative cannot yet have a reference to it. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2869 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3278>
This commit is contained in:
parent
00bb4190b3
commit
e056ce0ea3
@ -1554,11 +1554,13 @@ meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
|
|||||||
* Create a new virtual ClutterInputDevice of the given type.
|
* Create a new virtual ClutterInputDevice of the given type.
|
||||||
*/
|
*/
|
||||||
ClutterInputDevice *
|
ClutterInputDevice *
|
||||||
meta_input_device_native_new_virtual (MetaSeatImpl *seat_impl,
|
meta_input_device_native_new_virtual (ClutterSeat *seat,
|
||||||
ClutterInputDeviceType type,
|
ClutterInputDeviceType type,
|
||||||
ClutterInputMode mode)
|
ClutterInputMode mode)
|
||||||
{
|
{
|
||||||
MetaInputDeviceNative *device;
|
MetaInputDeviceNative *device;
|
||||||
|
MetaBackend *backend =
|
||||||
|
meta_seat_native_get_backend (META_SEAT_NATIVE (seat));
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -1578,11 +1580,11 @@ meta_input_device_native_new_virtual (MetaSeatImpl *seat_impl,
|
|||||||
};
|
};
|
||||||
|
|
||||||
device = g_object_new (META_TYPE_INPUT_DEVICE_NATIVE,
|
device = g_object_new (META_TYPE_INPUT_DEVICE_NATIVE,
|
||||||
"backend", meta_seat_impl_get_backend (seat_impl),
|
"backend", backend,
|
||||||
"name", name,
|
"name", name,
|
||||||
"device-type", type,
|
"device-type", type,
|
||||||
"device-mode", mode,
|
"device-mode", mode,
|
||||||
"seat", seat_impl->seat_native,
|
"seat", seat,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return CLUTTER_INPUT_DEVICE (device);
|
return CLUTTER_INPUT_DEVICE (device);
|
||||||
|
@ -135,7 +135,7 @@ GType meta_input_device_native_get_type (void) G_GNUC
|
|||||||
ClutterInputDevice * meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
|
ClutterInputDevice * meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
|
||||||
struct libinput_device *libinput_device);
|
struct libinput_device *libinput_device);
|
||||||
|
|
||||||
ClutterInputDevice * meta_input_device_native_new_virtual (MetaSeatImpl *seat_impl,
|
ClutterInputDevice * meta_input_device_native_new_virtual (ClutterSeat *seat,
|
||||||
ClutterInputDeviceType type,
|
ClutterInputDeviceType type,
|
||||||
ClutterInputMode mode);
|
ClutterInputMode mode);
|
||||||
|
|
||||||
|
@ -2964,7 +2964,7 @@ meta_seat_impl_constructed (GObject *object)
|
|||||||
ClutterInputDevice *device;
|
ClutterInputDevice *device;
|
||||||
|
|
||||||
device = meta_input_device_native_new_virtual (
|
device = meta_input_device_native_new_virtual (
|
||||||
seat_impl, CLUTTER_POINTER_DEVICE,
|
CLUTTER_SEAT (seat_impl->seat_native), CLUTTER_POINTER_DEVICE,
|
||||||
CLUTTER_INPUT_MODE_LOGICAL);
|
CLUTTER_INPUT_MODE_LOGICAL);
|
||||||
seat_impl->pointer_x = INITIAL_POINTER_X;
|
seat_impl->pointer_x = INITIAL_POINTER_X;
|
||||||
seat_impl->pointer_y = INITIAL_POINTER_Y;
|
seat_impl->pointer_y = INITIAL_POINTER_Y;
|
||||||
@ -2974,7 +2974,7 @@ meta_seat_impl_constructed (GObject *object)
|
|||||||
seat_impl->core_pointer = device;
|
seat_impl->core_pointer = device;
|
||||||
|
|
||||||
device = meta_input_device_native_new_virtual (
|
device = meta_input_device_native_new_virtual (
|
||||||
seat_impl, CLUTTER_KEYBOARD_DEVICE,
|
CLUTTER_SEAT (seat_impl->seat_native), CLUTTER_KEYBOARD_DEVICE,
|
||||||
CLUTTER_INPUT_MODE_LOGICAL);
|
CLUTTER_INPUT_MODE_LOGICAL);
|
||||||
seat_impl->core_keyboard = device;
|
seat_impl->core_keyboard = device;
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@ meta_virtual_input_device_native_constructed (GObject *object)
|
|||||||
|
|
||||||
virtual_evdev->impl_state = g_new0 (ImplState, 1);
|
virtual_evdev->impl_state = g_new0 (ImplState, 1);
|
||||||
virtual_evdev->impl_state->device =
|
virtual_evdev->impl_state->device =
|
||||||
meta_input_device_native_new_virtual (virtual_evdev->seat->impl,
|
meta_input_device_native_new_virtual (CLUTTER_SEAT (virtual_evdev->seat),
|
||||||
device_type,
|
device_type,
|
||||||
CLUTTER_INPUT_MODE_PHYSICAL);
|
CLUTTER_INPUT_MODE_PHYSICAL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user