From a1517cae1cef7267886e9f197cf81c5abfd46c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 29 Jan 2018 14:23:39 +0800 Subject: [PATCH] clutter/device-manager: Add way to check virtual device support This is needed so that mutter can let applications using the remote desktop API to know whether touch screens are supported. --- clutter/clutter/clutter-device-manager.c | 15 +++++++++++++++ clutter/clutter/clutter-device-manager.h | 14 ++++++++++++++ .../clutter/evdev/clutter-device-manager-evdev.c | 9 +++++++++ .../clutter/x11/clutter-device-manager-core-x11.c | 8 ++++++++ clutter/clutter/x11/clutter-device-manager-xi2.c | 8 ++++++++ 5 files changed, 54 insertions(+) diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c index cc8007aac..20ef03388 100644 --- a/clutter/clutter/clutter-device-manager.c +++ b/clutter/clutter/clutter-device-manager.c @@ -516,6 +516,21 @@ clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_man device_type); } +/** + * clutter_device_manager_supported_virtua_device_types: (skip) + */ +ClutterVirtualDeviceType +clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager) +{ + ClutterDeviceManagerClass *manager_class; + + g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), + CLUTTER_VIRTUAL_DEVICE_TYPE_NONE); + + manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); + return manager_class->get_supported_virtual_device_types (device_manager); +} + void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager, ClutterEvent *event, diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h index 2a152c932..aebfc4b5d 100644 --- a/clutter/clutter/clutter-device-manager.h +++ b/clutter/clutter/clutter-device-manager.h @@ -44,6 +44,16 @@ typedef struct _ClutterDeviceManager ClutterDeviceManager; typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate; typedef struct _ClutterDeviceManagerClass ClutterDeviceManagerClass; +/** + * ClutterVirtualDeviceType: + */ +typedef enum _ClutterVirtualDeviceType +{ + CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0, + CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0, + CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1, + CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2, +} ClutterVirtualDeviceType; /** * ClutterKbdA11ySettings: @@ -104,6 +114,7 @@ struct _ClutterDeviceManagerClass ClutterStage *stage); ClutterVirtualInputDevice *(* create_virtual_device) (ClutterDeviceManager *device_manager, ClutterInputDeviceType device_type); + ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterDeviceManager *device_manager); void (* compress_motion) (ClutterDeviceManager *device_manger, ClutterEvent *event, const ClutterEvent *to_discard); @@ -135,6 +146,9 @@ CLUTTER_AVAILABLE_IN_ALL ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager, ClutterInputDeviceType device_type); +CLUTTER_AVAILABLE_IN_ALL +ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager); + CLUTTER_AVAILABLE_IN_ALL void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager, ClutterKbdA11ySettings *settings); diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index 161c90524..bc9549de9 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -1866,6 +1866,14 @@ clutter_device_manager_evdev_create_virtual_device (ClutterDeviceManager *manag NULL); } +static ClutterVirtualDeviceType +clutter_device_manager_evdev_get_supported_virtual_device_types (ClutterDeviceManager *device_manager) +{ + return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD | + CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER | + CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN); +} + static void clutter_device_manager_evdev_compress_motion (ClutterDeviceManager *device_manger, ClutterEvent *event, @@ -2044,6 +2052,7 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass) manager_class->get_core_device = clutter_device_manager_evdev_get_core_device; manager_class->get_device = clutter_device_manager_evdev_get_device; manager_class->create_virtual_device = clutter_device_manager_evdev_create_virtual_device; + manager_class->get_supported_virtual_device_types = clutter_device_manager_evdev_get_supported_virtual_device_types; manager_class->compress_motion = clutter_device_manager_evdev_compress_motion; manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings; } diff --git a/clutter/clutter/x11/clutter-device-manager-core-x11.c b/clutter/clutter/x11/clutter-device-manager-core-x11.c index baad58c99..34178c1ad 100644 --- a/clutter/clutter/x11/clutter-device-manager-core-x11.c +++ b/clutter/clutter/x11/clutter-device-manager-core-x11.c @@ -490,6 +490,13 @@ clutter_device_manager_x11_create_virtual_device (ClutterDeviceManager *device_ return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11, NULL); } +static ClutterVirtualDeviceType +clutter_device_manager_x11_get_supported_virtual_device_types (ClutterDeviceManager *device_manager) +{ + return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD | + CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER); +} + static void clutter_device_manager_x11_set_property (GObject *gobject, guint prop_id, @@ -537,6 +544,7 @@ clutter_device_manager_x11_class_init (ClutterDeviceManagerX11Class *klass) manager_class->get_core_device = clutter_device_manager_x11_get_core_device; manager_class->get_device = clutter_device_manager_x11_get_device; manager_class->create_virtual_device = clutter_device_manager_x11_create_virtual_device; + manager_class->get_supported_virtual_device_types = clutter_device_manager_x11_get_supported_virtual_device_types; manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings; } diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c index d2610cc26..01ecd5cc2 100644 --- a/clutter/clutter/x11/clutter-device-manager-xi2.c +++ b/clutter/clutter/x11/clutter-device-manager-xi2.c @@ -2024,6 +2024,13 @@ clutter_device_manager_xi2_create_virtual_device (ClutterDeviceManager *manage NULL); } +static ClutterVirtualDeviceType +clutter_device_manager_xi2_get_supported_virtual_device_types (ClutterDeviceManager *device_manager) +{ + return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD | + CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER); +} + static void clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass) { @@ -2052,6 +2059,7 @@ clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass) manager_class->get_device = clutter_device_manager_xi2_get_device; manager_class->select_stage_events = clutter_device_manager_xi2_select_stage_events; manager_class->create_virtual_device = clutter_device_manager_xi2_create_virtual_device; + manager_class->get_supported_virtual_device_types = clutter_device_manager_xi2_get_supported_virtual_device_types; manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings; }