remote-desktop-session: Don't recreate virtual device over and over
In 'remote-desktop-session: Create virtual input devices on demand' the intention was to create input devices on-demand, but during a refactorization of the code, instead the virtual input device was recreated over and over. Lets fix that. Fixes: a0af52caf00ed Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1799 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1858>
This commit is contained in:
parent
2f651c337e
commit
a49dc78396
@ -153,24 +153,29 @@ ensure_virtual_device (MetaRemoteDesktopSession *session,
|
|||||||
MetaBackend *backend = meta_remote_desktop_get_backend (remote_desktop);
|
MetaBackend *backend = meta_remote_desktop_get_backend (remote_desktop);
|
||||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||||
|
ClutterVirtualInputDevice **virtual_device_ptr = NULL;
|
||||||
|
|
||||||
switch (device_type)
|
switch (device_type)
|
||||||
{
|
{
|
||||||
case CLUTTER_POINTER_DEVICE:
|
case CLUTTER_POINTER_DEVICE:
|
||||||
session->virtual_pointer =
|
virtual_device_ptr = &session->virtual_pointer;
|
||||||
clutter_seat_create_virtual_device (seat, CLUTTER_POINTER_DEVICE);
|
|
||||||
break;
|
break;
|
||||||
case CLUTTER_KEYBOARD_DEVICE:
|
case CLUTTER_KEYBOARD_DEVICE:
|
||||||
session->virtual_keyboard =
|
virtual_device_ptr = &session->virtual_keyboard;
|
||||||
clutter_seat_create_virtual_device (seat, CLUTTER_KEYBOARD_DEVICE);
|
|
||||||
break;
|
break;
|
||||||
case CLUTTER_TOUCHSCREEN_DEVICE:
|
case CLUTTER_TOUCHSCREEN_DEVICE:
|
||||||
session->virtual_touchscreen =
|
virtual_device_ptr = &session->virtual_touchscreen;
|
||||||
clutter_seat_create_virtual_device (seat, CLUTTER_TOUCHSCREEN_DEVICE);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert (virtual_device_ptr);
|
||||||
|
|
||||||
|
if (*virtual_device_ptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
*virtual_device_ptr = clutter_seat_create_virtual_device (seat, device_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user