[mutter] remote-desktop-session: Don't recreate virtual device over and over
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] remote-desktop-session: Don't recreate virtual device over and over
- Date: Fri, 7 May 2021 13:42:31 +0000 (UTC)
commit a49dc78396bda45da43ac111ffdceeca2892800d
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri May 7 15:01:44 2021 +0200
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>
src/backends/meta-remote-desktop-session.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
index c24f91f636..e15bd63de6 100644
--- a/src/backends/meta-remote-desktop-session.c
+++ b/src/backends/meta-remote-desktop-session.c
@@ -153,24 +153,29 @@ ensure_virtual_device (MetaRemoteDesktopSession *session,
MetaBackend *backend = meta_remote_desktop_get_backend (remote_desktop);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
+ ClutterVirtualInputDevice **virtual_device_ptr = NULL;
switch (device_type)
{
case CLUTTER_POINTER_DEVICE:
- session->virtual_pointer =
- clutter_seat_create_virtual_device (seat, CLUTTER_POINTER_DEVICE);
+ virtual_device_ptr = &session->virtual_pointer;
break;
case CLUTTER_KEYBOARD_DEVICE:
- session->virtual_keyboard =
- clutter_seat_create_virtual_device (seat, CLUTTER_KEYBOARD_DEVICE);
+ virtual_device_ptr = &session->virtual_keyboard;
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
- session->virtual_touchscreen =
- clutter_seat_create_virtual_device (seat, CLUTTER_TOUCHSCREEN_DEVICE);
+ virtual_device_ptr = &session->virtual_touchscreen;
break;
default:
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]