[gnome-control-center] wacom: Support the WSTYLUS_3D stylus type



commit f57a19256482aff44684b17ce4f07972afec1aad
Author: Jason Gerecke <killertofu gmail com>
Date:   Tue Oct 10 07:56:17 2017 -0700

    wacom: Support the WSTYLUS_3D stylus type
    
    Wacom's new "Pro Pen 3D" stylus is declared as a new stylus type within
    libwacom: WSTYLUS_3D. Now that the Wacom panel supports arbitrary three-
    button styli, we can add specific support for this new stylus type to
    suppress the warning message that is generated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790028

 meson.build                         |    6 +++++-
 panels/wacom/cc-wacom-stylus-page.c |    7 +++++++
 panels/wacom/cc-wacom-tool.c        |    6 ++++++
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/meson.build b/meson.build
index 260d984..9e48d16 100644
--- a/meson.build
+++ b/meson.build
@@ -205,11 +205,15 @@ if host_is_linux_not_s390
   # Wacom
   assert(clutter_gtk_dep.found(), 'clutter-gtk library is required for wacom support, but is not available.')
 
+  libwacom_dep = dependency('libwacom', version: '>= 0.7')
+
   wacom_deps = [
     clutter_gtk_dep,
+    libwacom_dep,
     dependency('clutter-1.0', version: '>= 1.11.3'),
-    dependency('libwacom', version: '>= 0.7')
   ]
+  config_h.set('HAVE_WACOM_3D_STYLUS', libwacom_dep.version().version_compare('>= 0.27'),
+               description: 'Define to 1 if libwacom provides definition for 3D styli')
 else
   message('Bluetooth and Wacom panels will not be built (no USB support on this platform)')
 endif
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index 8adc7bc..56aeeef 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -345,6 +345,7 @@ enum {
        LAYOUT_INKING,                      /* tip */
        LAYOUT_AIRBRUSH,                    /* eraser, 1 button, tip */
        LAYOUT_GENERIC_2_BUTTONS_NO_ERASER, /* 2 buttons, tip, no eraser */
+       LAYOUT_3DPEN,                       /* 3 buttons, tip, no eraser */
        LAYOUT_OTHER
 };
 
@@ -412,6 +413,10 @@ update_stylus_ui (CcWacomStylusPage *page,
                remove_buttons (page->priv, 2);
                remove_eraser (page->priv);
                break;
+       case LAYOUT_3DPEN:
+               remove_buttons (page->priv, 3);
+               remove_eraser (page->priv);
+               break;
        case LAYOUT_OTHER:
                /* We already warn about it in cc_wacom_stylus_page_new () */
                break;
@@ -453,6 +458,8 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
                layout = LAYOUT_AIRBRUSH;
        else if (num_buttons == 2 && !has_eraser)
                layout = LAYOUT_GENERIC_2_BUTTONS_NO_ERASER;
+       else if (num_buttons == 3 && !has_eraser)
+               layout = LAYOUT_3DPEN;
        else {
                layout = LAYOUT_OTHER;
                remove_buttons (priv, num_buttons);
diff --git a/panels/wacom/cc-wacom-tool.c b/panels/wacom/cc-wacom-tool.c
index 7c74e93..fa1169f 100644
--- a/panels/wacom/cc-wacom-tool.c
+++ b/panels/wacom/cc-wacom-tool.c
@@ -18,6 +18,8 @@
  *
  */
 
+#include "config.h"
+
 #include "cc-wacom-tool.h"
 
 enum {
@@ -252,6 +254,10 @@ get_icon_name_from_type (const WacomStylus *wstylus)
                return "wacom-stylus-art-pen";
        case WSTYLUS_CLASSIC:
                return "wacom-stylus-classic";
+#ifdef HAVE_WACOM_3D_STYLUS
+       case WSTYLUS_3D:
+               return "wacom-stylus-3btn-no-eraser";
+#endif
        default:
                if (!libwacom_stylus_has_eraser (wstylus)) {
                        if (libwacom_stylus_get_num_buttons (wstylus) >= 3)


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