summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2018-01-29 14:51:01 +0800
committerJonas Ådahl <jadahl@gmail.com>2018-02-23 19:33:31 +0800
commit8dd377da384b308e87aee21cf50f4a9c6620aa0a (patch)
treeb165e5b8c3df9aaf5d9b87a38a4d795668cefdfa
parent03a12f9458c818ed06a65e4640818407be4e9141 (diff)
downloadmutter-8dd377da384b308e87aee21cf50f4a9c6620aa0a.tar.gz
remote-desktop: Add support for discovering supported device types
This is so that application will not try to send touch events when touch is not supported.
-rw-r--r--src/backends/meta-remote-desktop.c34
-rw-r--r--src/org.gnome.Mutter.RemoteDesktop.xml11
2 files changed, 45 insertions, 0 deletions
diff --git a/src/backends/meta-remote-desktop.c b/src/backends/meta-remote-desktop.c
index 38dbb57ae..1282818c0 100644
--- a/src/backends/meta-remote-desktop.c
+++ b/src/backends/meta-remote-desktop.c
@@ -43,6 +43,14 @@
#define META_REMOTE_DESKTOP_DBUS_SERVICE "org.gnome.Mutter.RemoteDesktop"
#define META_REMOTE_DESKTOP_DBUS_PATH "/org/gnome/Mutter/RemoteDesktop"
+typedef enum _MetaRemoteDesktopDeviceTypes
+{
+ META_REMOTE_DESKTOP_DEVICE_TYPE_NONE = 0,
+ META_REMOTE_DESKTOP_DEVICE_TYPE_KEYBOARD = 1 << 0,
+ META_REMOTE_DESKTOP_DEVICE_TYPE_POINTER = 1 << 1,
+ META_REMOTE_DESKTOP_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
+} MetaRemoteDesktopDeviceTypes;
+
struct _MetaRemoteDesktop
{
MetaDBusRemoteDesktopSkeleton parent;
@@ -224,10 +232,36 @@ meta_remote_desktop_new (MetaDbusSessionWatcher *session_watcher)
return remote_desktop;
}
+static MetaRemoteDesktopDeviceTypes
+calculate_supported_device_types (void)
+{
+ ClutterDeviceManager *device_manager =
+ clutter_device_manager_get_default ();
+ ClutterVirtualDeviceType device_types;
+ MetaRemoteDesktopDeviceTypes supported_devices =
+ META_REMOTE_DESKTOP_DEVICE_TYPE_NONE;
+
+ device_types =
+ clutter_device_manager_get_supported_virtual_device_types (device_manager);
+
+ if (device_types & CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD)
+ supported_devices |= META_REMOTE_DESKTOP_DEVICE_TYPE_KEYBOARD;
+ if (device_types & CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER)
+ supported_devices |= META_REMOTE_DESKTOP_DEVICE_TYPE_POINTER;
+ if (device_types & CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN)
+ supported_devices |= META_REMOTE_DESKTOP_DEVICE_TYPE_TOUCHSCREEN;
+
+ return supported_devices;
+}
+
static void
meta_remote_desktop_init (MetaRemoteDesktop *remote_desktop)
{
remote_desktop->sessions = g_hash_table_new (g_str_hash, g_str_equal);
+
+ meta_dbus_remote_desktop_set_supported_device_types (
+ META_DBUS_REMOTE_DESKTOP (remote_desktop),
+ calculate_supported_device_types ());
}
static void
diff --git a/src/org.gnome.Mutter.RemoteDesktop.xml b/src/org.gnome.Mutter.RemoteDesktop.xml
index dddc59a16..dc86cf342 100644
--- a/src/org.gnome.Mutter.RemoteDesktop.xml
+++ b/src/org.gnome.Mutter.RemoteDesktop.xml
@@ -17,6 +17,17 @@
<arg name="session_path" type="o" direction="out" />
</method>
+ <!--
+ SupportedDeviceTypes:
+ @short_description: Bit mask of supported device types
+
+ Device types:
+ 1: keyboard
+ 2: pointer
+ 4: touchscreen
+ -->
+ <property name="SupportedDeviceTypes" type="u" access="read" />
+
</interface>
<!--