Skip to content

Commit

Permalink
wacom: Allow button mapping if the stylus has one button too
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bentiss authored and hadess committed Mar 16, 2015
1 parent 37247b0 commit 5fcf43a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions panels/wacom/cc-wacom-stylus-page.c
Expand Up @@ -202,12 +202,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);
}
Expand Down

0 comments on commit 5fcf43a

Please sign in to comment.