mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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.
This commit is contained in:
parent
03a12f9458
commit
8dd377da38
@ -43,6 +43,14 @@
|
|||||||
#define META_REMOTE_DESKTOP_DBUS_SERVICE "org.gnome.Mutter.RemoteDesktop"
|
#define META_REMOTE_DESKTOP_DBUS_SERVICE "org.gnome.Mutter.RemoteDesktop"
|
||||||
#define META_REMOTE_DESKTOP_DBUS_PATH "/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
|
struct _MetaRemoteDesktop
|
||||||
{
|
{
|
||||||
MetaDBusRemoteDesktopSkeleton parent;
|
MetaDBusRemoteDesktopSkeleton parent;
|
||||||
@ -224,10 +232,36 @@ meta_remote_desktop_new (MetaDbusSessionWatcher *session_watcher)
|
|||||||
return remote_desktop;
|
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
|
static void
|
||||||
meta_remote_desktop_init (MetaRemoteDesktop *remote_desktop)
|
meta_remote_desktop_init (MetaRemoteDesktop *remote_desktop)
|
||||||
{
|
{
|
||||||
remote_desktop->sessions = g_hash_table_new (g_str_hash, g_str_equal);
|
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
|
static void
|
||||||
|
@ -17,6 +17,17 @@
|
|||||||
<arg name="session_path" type="o" direction="out" />
|
<arg name="session_path" type="o" direction="out" />
|
||||||
</method>
|
</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>
|
</interface>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
Loading…
Reference in New Issue
Block a user