[mutter/wip/tablet-protocol-v2: 47/65] backends: Perform libwacom checks before applying settings



commit 9a298b7596fe2a2ce84131cfa14319a6d30254d0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 22 15:44:14 2016 +0200

    backends: Perform libwacom checks before applying settings
    
    Some settings make no sense on external tablets, and others make
    no sense in display/system-integrated tablets. Perform those checks
    so we don't end up with possibly broken configuration.

 src/backends/meta-input-settings.c |   53 ++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index b31f2bd..af46bd9 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -617,6 +617,19 @@ update_tablet_keep_aspect (MetaInputSettings  *input_settings,
   if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE)
     return;
 
+#ifdef HAVE_LIBWACOM
+  {
+    WacomDevice *wacom_device;
+
+    wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
+                                                                device);
+    /* Keep aspect only makes sense in external tablets */
+    if (wacom_device &&
+        libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)
+      return;
+  }
+#endif
+
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
 
   if (clutter_input_device_get_mapping_mode (device) ==
@@ -680,6 +693,19 @@ update_tablet_mapping (MetaInputSettings  *input_settings,
   if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE)
     return;
 
+#ifdef HAVE_LIBWACOM
+  {
+    WacomDevice *wacom_device;
+
+    wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
+                                                                device);
+    /* Tablet mapping only makes sense on external tablets */
+    if (wacom_device &&
+        (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE))
+      return;
+  }
+#endif
+
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
   mapping = g_settings_get_enum (settings, "mapping");
 
@@ -705,6 +731,20 @@ update_tablet_area (MetaInputSettings  *input_settings,
   if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE)
     return;
 
+#ifdef HAVE_LIBWACOM
+  {
+    WacomDevice *wacom_device;
+
+    wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
+                                                                device);
+    /* Tablet area only makes sense on system/display integrated tablets */
+    if (wacom_device &&
+        (libwacom_get_integration_flags (wacom_device) &
+         (WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
+      return;
+  }
+#endif
+
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
   variant = g_settings_get_value (settings, "area");
 
@@ -730,6 +770,19 @@ update_tablet_left_handed (MetaInputSettings  *input_settings,
   if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE)
     return;
 
+#ifdef HAVE_LIBWACOM
+  {
+    WacomDevice *wacom_device;
+
+    wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
+                                                                device);
+    /* Left handed mode only makes sense on external tablets */
+    if (wacom_device &&
+        (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE))
+      return;
+  }
+#endif
+
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
   enabled = g_settings_get_boolean (settings, "left-handed");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]