[mutter] remote-desktop: Add support for discovering supported device types
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] remote-desktop: Add support for discovering supported device types
- Date: Fri, 23 Feb 2018 12:52:19 +0000 (UTC)
commit 8dd377da384b308e87aee21cf50f4a9c6620aa0a
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Jan 29 14:51:01 2018 +0800
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.
src/backends/meta-remote-desktop.c | 34 ++++++++++++++++++++++++++++++++++
src/org.gnome.Mutter.RemoteDesktop.xml | 11 +++++++++++
2 files changed, 45 insertions(+)
---
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>
<!--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]