From 59be5bf3b198cd8bb5350b7431fb4a60b217fcc7 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 13 May 2016 12:18:48 +0200 Subject: [PATCH] backends: Add function to lookup the mapping for a given tablet At least for wayland, this needs implementing within mutter. So add a function to look this setting up. --- src/backends/meta-input-settings-private.h | 3 +++ src/backends/meta-input-settings.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index 237557444..a7e6ea095 100644 --- a/src/backends/meta-input-settings-private.h +++ b/src/backends/meta-input-settings-private.h @@ -99,4 +99,7 @@ GType meta_input_settings_get_type (void) G_GNUC_CONST; MetaInputSettings * meta_input_settings_create (void); +GDesktopTabletMapping meta_input_settings_get_tablet_mapping (MetaInputSettings *settings, + ClutterInputDevice *device); + #endif /* META_INPUT_SETTINGS_PRIVATE_H */ diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 3aeb09cf5..51f45d550 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -1018,3 +1018,22 @@ meta_input_settings_create (void) return NULL; } + +GDesktopTabletMapping +meta_input_settings_get_tablet_mapping (MetaInputSettings *settings, + ClutterInputDevice *device) +{ + MetaInputSettingsPrivate *priv; + DeviceMappingInfo *info; + + g_return_val_if_fail (META_IS_INPUT_SETTINGS (settings), + G_DESKTOP_TABLET_MAPPING_ABSOLUTE); + g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), + G_DESKTOP_TABLET_MAPPING_ABSOLUTE); + + priv = meta_input_settings_get_instance_private (settings); + info = g_hash_table_lookup (priv->mappable_devices, device); + g_return_val_if_fail (info != NULL, G_DESKTOP_TABLET_MAPPING_ABSOLUTE); + + return g_settings_get_enum (info->settings, "mapping"); +}