diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index 644d5b22a..8adc7bca7 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -160,7 +160,8 @@ button_changed_cb (GtkComboBox *combo, gpointer user_data)
GtkTreeIter iter;
GtkListStore *liststore;
gint mapping_b2,
- mapping_b3;
+ mapping_b3,
+ mapping_b4;
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (WID ("combo-bottombutton")), &iter))
return;
@@ -181,8 +182,20 @@ button_changed_cb (GtkComboBox *combo, gpointer user_data)
mapping_b3 = 0;
}
+ if (cc_wacom_tool_get_num_buttons (priv->stylus) > 2) {
+ if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (WID ("combo-thirdbutton")), &iter))
+ return;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter,
+ BUTTONNUMBER_COLUMN, &mapping_b4,
+ -1);
+ } else {
+ mapping_b4 = 0;
+ }
+
g_settings_set_enum (priv->stylus_settings, "button-action", mapping_b2);
g_settings_set_enum (priv->stylus_settings, "secondary-button-action", mapping_b3);
+ g_settings_set_enum (priv->stylus_settings, "tertiary-button-action", mapping_b4);
}
static void
@@ -299,6 +312,11 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *self)
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (button_changed_cb), self);
+ combo = GTK_COMBO_BOX (WID ("combo-thirdbutton"));
+ combobox_text_cellrenderer (combo, BUTTONNAME_COLUMN);
+ g_signal_connect (G_OBJECT (combo), "changed",
+ G_CALLBACK (button_changed_cb), self);
+
priv->nav = cc_wacom_nav_button_new ();
gtk_widget_set_halign (priv->nav, GTK_ALIGN_END);
gtk_widget_set_margin_start (priv->nav, 10);
@@ -333,6 +351,10 @@ enum {
static void
remove_buttons (CcWacomStylusPagePrivate *priv, int n)
{
+ if (n < 3) {
+ gtk_widget_destroy (WID ("combo-thirdbutton"));
+ gtk_widget_destroy (WID ("label-third-button"));
+ }
if (n < 2) {
gtk_widget_destroy (WID ("combo-topbutton"));
gtk_widget_destroy (WID ("label-top-button"));
@@ -445,6 +467,9 @@ cc_wacom_stylus_page_new (CcWacomTool *stylus)
update_stylus_ui (page, layout);
+ if (num_buttons >= 3)
+ set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-thirdbutton")),
+ priv->stylus_settings, "tertiary-button-action");
if (num_buttons >= 2)
set_button_mapping_from_gsettings (GTK_COMBO_BOX (WID ("combo-topbutton")),
priv->stylus_settings, "secondary-button-action");
diff --git a/panels/wacom/cc-wacom-tool.c b/panels/wacom/cc-wacom-tool.c
index 21050875d..7c74e93e5 100644
--- a/panels/wacom/cc-wacom-tool.c
+++ b/panels/wacom/cc-wacom-tool.c
@@ -253,9 +253,18 @@ get_icon_name_from_type (const WacomStylus *wstylus)
case WSTYLUS_CLASSIC:
return "wacom-stylus-classic";
default:
- if (!libwacom_stylus_has_eraser (wstylus))
- return "wacom-stylus-no-eraser";
- return "wacom-stylus";
+ if (!libwacom_stylus_has_eraser (wstylus)) {
+ if (libwacom_stylus_get_num_buttons (wstylus) >= 3)
+ return "wacom-stylus-3btn-no-eraser";
+ else
+ return "wacom-stylus-no-eraser";
+ }
+ else {
+ if (libwacom_stylus_get_num_buttons (wstylus) >= 3)
+ return "wacom-stylus-3btn";
+ else
+ return "wacom-stylus";
+ }
}
}
diff --git a/panels/wacom/meson.build b/panels/wacom/meson.build
index dbd9748d4..d323a818a 100644
--- a/panels/wacom/meson.build
+++ b/panels/wacom/meson.build
@@ -45,6 +45,8 @@ common_sources = files(
resource_data = files(
'button-mapping.ui',
'gnome-wacom-properties.ui',
+ 'wacom-stylus-3btn.svg',
+ 'wacom-stylus-3btn-no-eraser.svg',
'wacom-stylus-airbrush.svg',
'wacom-stylus-art-pen.svg',
'wacom-stylus-classic.svg',
diff --git a/panels/wacom/wacom-stylus-3btn-no-eraser.svg b/panels/wacom/wacom-stylus-3btn-no-eraser.svg
new file mode 100644
index 000000000..60642d7bb
--- /dev/null
+++ b/panels/wacom/wacom-stylus-3btn-no-eraser.svg
@@ -0,0 +1,132 @@
+
+
+
+
diff --git a/panels/wacom/wacom-stylus-3btn.svg b/panels/wacom/wacom-stylus-3btn.svg
new file mode 100644
index 000000000..2f3db9aa4
--- /dev/null
+++ b/panels/wacom/wacom-stylus-3btn.svg
@@ -0,0 +1,138 @@
+
+
+
+
diff --git a/panels/wacom/wacom-stylus-page.ui b/panels/wacom/wacom-stylus-page.ui
index 6e3cbfb02..b6f152d7f 100644
--- a/panels/wacom/wacom-stylus-page.ui
+++ b/panels/wacom/wacom-stylus-page.ui
@@ -290,6 +290,35 @@
2
+
+
+
+ 0
+ 3
+
+
+
+
+
+ 1
+ 3
+
+
0
- 3
+ 4
@@ -360,7 +389,7 @@
1
- 3
+ 4
diff --git a/panels/wacom/wacom.gresource.xml b/panels/wacom/wacom.gresource.xml
index 7683b4d38..a18ffb1ed 100644
--- a/panels/wacom/wacom.gresource.xml
+++ b/panels/wacom/wacom.gresource.xml
@@ -6,6 +6,8 @@
button-mapping.ui
wacom-tablet.svg
wacom-stylus.svg
+ wacom-stylus-3btn-no-eraser.svg
+ wacom-stylus-3btn.svg
wacom-stylus-no-eraser.svg
wacom-stylus-airbrush.svg
wacom-stylus-inking.svg