[gnome-control-center/gnome-3-8] wacom: Allow button mapping if the stylus has one button too



commit 2b11c9059f6980e7015cdd69a29d84024d0a9e3c
Author: Benjamin Tissoires <benjamin tissoires redhat com>
Date:   Sun Mar 15 20:55:07 2015 -0400

    wacom: Allow button mapping if the stylus has one button too
    
    The airbrush tool has only one button, and the button mapping combo box
    does not work.
    We should not bail out if the widget has been removed, that means that
    the stylus does not support the second button.
    
    Check upfront the number of buttons to know if the top button parameter
    is available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746263

 panels/wacom/cc-wacom-stylus-page.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index b063d52..dfebadc 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -203,12 +203,16 @@ button_changed_cb (GtkComboBox *combo, gpointer user_data)
                            BUTTONNUMBER_COLUMN, &mapping_b2,
                            -1);
 
-       if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (WID ("combo-topbutton")), &iter))
-               return;
+       if (gsd_wacom_stylus_get_num_buttons (priv->stylus) > 1) {
+               if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (WID ("combo-topbutton")), &iter))
+                       return;
 
-       gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter,
-                           BUTTONNUMBER_COLUMN, &mapping_b3,
-                           -1);
+               gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter,
+                                   BUTTONNUMBER_COLUMN, &mapping_b3,
+                                   -1);
+       } else {
+               mapping_b3 = 0;
+       }
 
        map_button (priv->stylus_settings, mapping_b2, mapping_b3);
 }


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