Merge lp:~robert-ancell/unity-control-center/wacom-panel-3.8 into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 12711
Merged at revision: 12712
Proposed branch: lp:~robert-ancell/unity-control-center/wacom-panel-3.8
Merge into: lp:unity-control-center
Diff against target: 1168 lines (+432/-144)
15 files modified
configure.ac (+2/-1)
debian/control (+1/-1)
panels/wacom/Makefile.am (+15/-19)
panels/wacom/calibrator/Makefile.am (+0/-3)
panels/wacom/cc-wacom-nav-button.c (+7/-2)
panels/wacom/cc-wacom-page.c (+68/-45)
panels/wacom/cc-wacom-panel.c (+10/-8)
panels/wacom/cc-wacom-stylus-page.c (+8/-11)
panels/wacom/gnome-wacom-properties.ui (+3/-3)
panels/wacom/gsd-input-helper.c (+36/-3)
panels/wacom/gsd-input-helper.h (+3/-0)
panels/wacom/gsd-wacom-device.c (+236/-44)
panels/wacom/gsd-wacom-device.h (+26/-3)
panels/wacom/unity-wacom-panel.desktop.in.in (+1/-1)
panels/wacom/wacom.gresource.xml (+16/-0)
To merge this branch: bzr merge lp:~robert-ancell/unity-control-center/wacom-panel-3.8
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+207082@code.launchpad.net

Commit message

Backport Wacom panel from GNOME Control Center 3.8

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, updating looks fine on principle to me, I'm unsure if the settings daemon code needs to be kept in sync though. I've no wacom hardware to test there, but let's try to get that in, it's easy enough to revert the changeset if it turns out to be an issue

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I have a Wacom device which I tested it with. We already have g-s-d 3.8 so it should match.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2014-02-17 23:33:18 +0000
+++ configure.ac 2014-02-19 03:07:54 +0000
@@ -112,7 +112,7 @@
112LIBNOTIFY_REQUIRED_VERSION=0.7.3112LIBNOTIFY_REQUIRED_VERSION=0.7.3
113GNOME_DESKTOP_REQUIRED_VERSION=3.5.91113GNOME_DESKTOP_REQUIRED_VERSION=3.5.91
114SCHEMAS_REQUIRED_VERSION=3.7.2.2114SCHEMAS_REQUIRED_VERSION=3.7.2.2
115LIBWACOM_REQUIRED_VERSION=0.6115LIBWACOM_REQUIRED_VERSION=0.7
116CLUTTER_REQUIRED_VERSION=1.11.3116CLUTTER_REQUIRED_VERSION=1.11.3
117GOA_REQUIRED_VERSION=3.5.90117GOA_REQUIRED_VERSION=3.5.90
118118
@@ -246,6 +246,7 @@
246 gnome-settings-daemon >= $GSD_REQUIRED_VERSION246 gnome-settings-daemon >= $GSD_REQUIRED_VERSION
247 xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION247 xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION
248 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)248 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
249 AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel])
249 have_wacom=yes250 have_wacom=yes
250 fi251 fi
251 ;;252 ;;
252253
=== modified file 'debian/control'
--- debian/control 2014-02-17 17:40:21 +0000
+++ debian/control 2014-02-19 03:07:54 +0000
@@ -42,7 +42,7 @@
42 libupower-glib-dev (>= 0.9.1),42 libupower-glib-dev (>= 0.9.1),
43 libsystemd-login-dev,43 libsystemd-login-dev,
44 libtimezonemap1-dev,44 libtimezonemap1-dev,
45 libwacom-dev (>= 0.6),45 libwacom-dev (>= 0.7),
46 libx11-dev,46 libx11-dev,
47 libxft-dev (>= 2.1.2),47 libxft-dev (>= 2.1.2),
48 libxkbfile-dev,48 libxkbfile-dev,
4949
=== modified file 'panels/wacom/Makefile.am'
--- panels/wacom/Makefile.am 2013-11-29 06:28:37 +0000
+++ panels/wacom/Makefile.am 2014-02-19 03:07:54 +0000
@@ -8,15 +8,18 @@
8 $(WACOM_PANEL_CFLAGS) \8 $(WACOM_PANEL_CFLAGS) \
9 -I$(srcdir)/calibrator \9 -I$(srcdir)/calibrator \
10 -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \10 -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
11 -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
12 -DGNOMECC_UI_DIR="\"$(uidir)\"" \
13 $(NULL)11 $(NULL)
1412
15
16ccpanelsdir = $(PANELS_DIR)13ccpanelsdir = $(PANELS_DIR)
17ccpanels_LTLIBRARIES = libwacom-properties.la14ccpanels_LTLIBRARIES = libwacom-properties.la
1815
16
17BUILT_SOURCES = \
18 cc-wacom-resources.c \
19 cc-wacom-resources.h
20
19libwacom_properties_la_SOURCES = \21libwacom_properties_la_SOURCES = \
22 $(BUILT_SOURCES) \
20 wacom-module.c \23 wacom-module.c \
21 cc-wacom-panel.c \24 cc-wacom-panel.c \
22 cc-wacom-panel.h \25 cc-wacom-panel.h \
@@ -40,6 +43,7 @@
40noinst_PROGRAMS = test-wacom43noinst_PROGRAMS = test-wacom
4144
42test_wacom_SOURCES = \45test_wacom_SOURCES = \
46 $(BUILT_SOURCES) \
43 test-wacom.c \47 test-wacom.c \
44 cc-wacom-page.c \48 cc-wacom-page.c \
45 cc-wacom-page.h \49 cc-wacom-page.h \
@@ -58,22 +62,14 @@
58test_wacom_CPPFLAGS = $(INCLUDES)62test_wacom_CPPFLAGS = $(INCLUDES)
59test_wacom_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS) $(builddir)/calibrator/libwacom-calibrator.la63test_wacom_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS) $(builddir)/calibrator/libwacom-calibrator.la
6064
65resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wacom.gresource.xml)
66cc-wacom-resources.c: wacom.gresource.xml $(resource_files)
67 $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_wacom $<
68cc-wacom-resources.h: wacom.gresource.xml $(resource_files)
69 $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_wacom $<
70
61@INTLTOOL_DESKTOP_RULE@71@INTLTOOL_DESKTOP_RULE@
6272
63pixmapdir = $(pkgdatadir)/ui
64pixmap_DATA = \
65 wacom-tablet.svg \
66 wacom-stylus.svg \
67 wacom-stylus-airbrush.svg \
68 wacom-stylus-inking.svg \
69 wacom-stylus-art-pen.svg \
70 wacom-stylus-classic.svg \
71 wacom-tablet-cintiq.svg \
72 wacom-tablet-pc.svg
73
74uidir = $(pkgdatadir)/ui
75ui_DATA = gnome-wacom-properties.ui wacom-stylus-page.ui button-mapping.ui
76
77desktopdir = $(datadir)/applications73desktopdir = $(datadir)/applications
78desktop_in_files = unity-wacom-panel.desktop.in74desktop_in_files = unity-wacom-panel.desktop.in
79desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)75desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@@ -87,7 +83,7 @@
87 FILES="$(COMMONFILES)" DIR="$(COMMONDIR)" $(top_srcdir)/update-from-gsd.sh && changed=true ; \83 FILES="$(COMMONFILES)" DIR="$(COMMONDIR)" $(top_srcdir)/update-from-gsd.sh && changed=true ; \
88 git commit -m "wacom: Update from gnome-settings-daemon" $(WACOMFILES) $(COMMONFILES)84 git commit -m "wacom: Update from gnome-settings-daemon" $(WACOMFILES) $(COMMONFILES)
8985
90CLEANFILES = $(Desktop_in_files) $(desktop_DATA)86CLEANFILES = $(Desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
91EXTRA_DIST = $(ui_DATA) $(pixmap_DATA)87EXTRA_DIST = $(resource_files) wacom.gresource.xml
9288
93-include $(top_srcdir)/git.mk89-include $(top_srcdir)/git.mk
9490
=== modified file 'panels/wacom/calibrator/Makefile.am'
--- panels/wacom/calibrator/Makefile.am 2013-11-29 06:28:37 +0000
+++ panels/wacom/calibrator/Makefile.am 2014-02-19 03:07:54 +0000
@@ -5,9 +5,6 @@
5 $(PANEL_CFLAGS) \5 $(PANEL_CFLAGS) \
6 $(WACOM_PANEL_CFLAGS) \6 $(WACOM_PANEL_CFLAGS) \
7 -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \7 -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
8 -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
9 -DGNOMECC_UI_DIR="\"$(uidir)\"" \
10 -DPIXMAP_DIR=\""$(datadir)/unity-control-center/pixmaps"\" \
11 $(NULL)8 $(NULL)
129
1310
1411
=== modified file 'panels/wacom/cc-wacom-nav-button.c'
--- panels/wacom/cc-wacom-nav-button.c 2012-02-27 16:51:36 +0000
+++ panels/wacom/cc-wacom-nav-button.c 2014-02-19 03:07:54 +0000
@@ -211,6 +211,9 @@
211 CcWacomNavButtonPrivate *priv;211 CcWacomNavButtonPrivate *priv;
212 GtkStyleContext *context;212 GtkStyleContext *context;
213 GtkWidget *image, *box;213 GtkWidget *image, *box;
214 gboolean rtl;
215
216 rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
214217
215 priv = self->priv = WACOM_NAV_BUTTON_PRIVATE (self);218 priv = self->priv = WACOM_NAV_BUTTON_PRIVATE (self);
216219
@@ -228,7 +231,8 @@
228231
229 /* Prev button */232 /* Prev button */
230 priv->prev = gtk_button_new ();233 priv->prev = gtk_button_new ();
231 image = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);234 image = gtk_image_new_from_icon_name (rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic",
235 GTK_ICON_SIZE_MENU);
232 gtk_container_add (GTK_CONTAINER (priv->prev), image);236 gtk_container_add (GTK_CONTAINER (priv->prev), image);
233 g_signal_connect (G_OBJECT (priv->prev), "clicked",237 g_signal_connect (G_OBJECT (priv->prev), "clicked",
234 G_CALLBACK (prev_clicked), self);238 G_CALLBACK (prev_clicked), self);
@@ -236,7 +240,8 @@
236240
237 /* Next button */241 /* Next button */
238 priv->next = gtk_button_new ();242 priv->next = gtk_button_new ();
239 image = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU);243 image = gtk_image_new_from_icon_name (rtl ? "go-next-rtl-symbolic" : "go-next-symbolic",
244 GTK_ICON_SIZE_MENU);
240 gtk_container_add (GTK_CONTAINER (priv->next), image);245 gtk_container_add (GTK_CONTAINER (priv->next), image);
241 g_signal_connect (G_OBJECT (priv->next), "clicked",246 g_signal_connect (G_OBJECT (priv->next), "clicked",
242 G_CALLBACK (next_clicked), self);247 G_CALLBACK (next_clicked), self);
243248
=== modified file 'panels/wacom/cc-wacom-page.c'
--- panels/wacom/cc-wacom-page.c 2014-02-18 03:09:04 +0000
+++ panels/wacom/cc-wacom-page.c 2014-02-19 03:07:54 +0000
@@ -117,7 +117,8 @@
117} action_table[] = {117} action_table[] = {
118 { GSD_WACOM_ACTION_TYPE_NONE, NC_("Wacom action-type", "None") },118 { GSD_WACOM_ACTION_TYPE_NONE, NC_("Wacom action-type", "None") },
119 { GSD_WACOM_ACTION_TYPE_CUSTOM, NC_("Wacom action-type", "Send Keystroke") },119 { GSD_WACOM_ACTION_TYPE_CUSTOM, NC_("Wacom action-type", "Send Keystroke") },
120 { GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR, NC_("Wacom action-type", "Switch Monitor") }120 { GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR, NC_("Wacom action-type", "Switch Monitor") },
121 { GSD_WACOM_ACTION_TYPE_HELP, NC_("Wacom action-type", "Show On-Screen Help") }
121};122};
122123
123#define WACOM_C(x) g_dpgettext2(NULL, "Wacom action-type", x)124#define WACOM_C(x) g_dpgettext2(NULL, "Wacom action-type", x)
@@ -185,11 +186,11 @@
185 cal[2] = axis.x_max;186 cal[2] = axis.x_max;
186 cal[3] = axis.y_max;187 cal[3] = axis.y_max;
187188
188 set_calibration(cal, 4, page->priv->wacom_settings);189 set_calibration(cal, 4, priv->wacom_settings);
189 }190 }
190191
191 calib_area_free (area);192 calib_area_free (area);
192 page->priv->area = NULL;193 priv->area = NULL;
193 gtk_widget_set_sensitive (WID ("button-calibrate"), TRUE);194 gtk_widget_set_sensitive (WID ("button-calibrate"), TRUE);
194}195}
195196
@@ -218,14 +219,14 @@
218 else219 else
219 device_id = -1;220 device_id = -1;
220221
221 page->priv->area = calib_area_new (NULL,222 priv->area = calib_area_new (NULL,
222 monitor,223 monitor,
223 device_id,224 device_id,
224 finish_calibration,225 finish_calibration,
225 page,226 page,
226 &old_axis,227 &old_axis,
227 THRESHOLD_MISCLICK,228 THRESHOLD_MISCLICK,
228 THRESHOLD_DOUBLECLICK);229 THRESHOLD_DOUBLECLICK);
229230
230 return FALSE;231 return FALSE;
231}232}
@@ -276,6 +277,17 @@
276 gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);277 gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
277}278}
278279
280/* This avoids us crashing when a newer version of
281 * gnome-control-center has been used, and we load up an
282 * old one, as the action type if unknown to the old g-c-c */
283static gboolean
284action_type_is_valid (GsdWacomActionType type)
285{
286 if (type >= G_N_ELEMENTS(action_table))
287 return FALSE;
288 return TRUE;
289}
290
279static char *291static char *
280get_elevator_shortcut_string (GSettings *settings,292get_elevator_shortcut_string (GSettings *settings,
281 GtkDirectionType dir)293 GtkDirectionType dir)
@@ -356,7 +368,8 @@
356 return;368 return;
357 }369 }
358370
359 if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR)371 if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
372 button->type == WACOM_TABLET_BUTTON_TYPE_RING)
360 str = get_elevator_shortcut_string (button->settings, dir);373 str = get_elevator_shortcut_string (button->settings, dir);
361 else374 else
362 str = g_settings_get_string (button->settings, CUSTOM_ACTION_KEY);375 str = g_settings_get_string (button->settings, CUSTOM_ACTION_KEY);
@@ -499,7 +512,8 @@
499512
500 str = gtk_accelerator_name (keyval, mask);513 str = gtk_accelerator_name (keyval, mask);
501514
502 if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) {515 if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
516 button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
503 char *strs[3];517 char *strs[3];
504 char **strv;518 char **strv;
505519
@@ -556,7 +570,8 @@
556 return;570 return;
557571
558 /* Unset the key */572 /* Unset the key */
559 if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) {573 if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
574 button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
560 char *strs[3];575 char *strs[3];
561 char **strv;576 char **strv;
562577
@@ -596,15 +611,20 @@
596 char *dir_name;611 char *dir_name;
597612
598 if (dir == GTK_DIR_UP || dir == GTK_DIR_DOWN) {613 if (dir == GTK_DIR_UP || dir == GTK_DIR_DOWN) {
599 dir_name = g_strdup_printf ("%s (%s)",614 if (button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
600 button->name,615 dir_name = g_strdup_printf ("%s (%s)",
601 dir == GTK_DIR_UP ? _("Up") : _("Down"));616 button->name,
617 dir == GTK_DIR_UP ? "↺" : "↻");
618 } else {
619 dir_name = g_strdup_printf ("%s (%s)",
620 button->name,
621 dir == GTK_DIR_UP ? C_("Wacom tablet button", "Up") : C_("Wacom tablet button", "Down"));
622 }
602 } else {623 } else {
603 dir_name = NULL;624 dir_name = NULL;
604 }625 }
605626
606 /* Sanity check */627 if (action_type_is_valid (type) == FALSE)
607 if (type >= G_N_ELEMENTS(action_table))
608 type = GSD_WACOM_ACTION_TYPE_NONE;628 type = GSD_WACOM_ACTION_TYPE_NONE;
609629
610 gtk_list_store_append (model, &new_row);630 gtk_list_store_append (model, &new_row);
@@ -644,7 +664,8 @@
644 return;664 return;
645 }665 }
646666
647 if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) {667 if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
668 button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
648 g_object_set (cell,669 g_object_set (cell,
649 "visible", TRUE,670 "visible", TRUE,
650 "editable", FALSE,671 "editable", FALSE,
@@ -660,8 +681,7 @@
660 }681 }
661682
662 type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY);683 type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY);
663 /* Sanity check */684 if (action_type_is_valid (type) == FALSE)
664 if (type >= G_N_ELEMENTS(action_table))
665 type = GSD_WACOM_ACTION_TYPE_NONE;685 type = GSD_WACOM_ACTION_TYPE_NONE;
666686
667 g_object_set (cell,687 g_object_set (cell,
@@ -746,6 +766,11 @@
746 gsd_wacom_device_is_screen_tablet (priv->stylus))766 gsd_wacom_device_is_screen_tablet (priv->stylus))
747 continue;767 continue;
748768
769 /* Do not list on-screen help if libwacom do no provide a layout */
770 if (action_table[i].action_type == GSD_WACOM_ACTION_TYPE_HELP &&
771 gsd_wacom_device_get_layout_path (priv->stylus) == NULL)
772 continue;
773
749 gtk_list_store_append (priv->action_store, &iter);774 gtk_list_store_append (priv->action_store, &iter);
750 gtk_list_store_set (priv->action_store, &iter,775 gtk_list_store_set (priv->action_store, &iter,
751 ACTION_NAME_COLUMN, WACOM_C(action_table[i].action_name),776 ACTION_NAME_COLUMN, WACOM_C(action_table[i].action_name),
@@ -793,7 +818,7 @@
793 gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (model));818 gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (model));
794819
795 /* Fill it up! */820 /* Fill it up! */
796 list = gsd_wacom_device_get_buttons (page->priv->pad);821 list = gsd_wacom_device_get_buttons (priv->pad);
797 for (l = list; l != NULL; l = l->next) {822 for (l = list; l != NULL; l = l->next) {
798 GsdWacomTabletButton *button = l->data;823 GsdWacomTabletButton *button = l->data;
799 GsdWacomActionType type = GSD_WACOM_ACTION_TYPE_NONE;824 GsdWacomActionType type = GSD_WACOM_ACTION_TYPE_NONE;
@@ -801,7 +826,8 @@
801 if (button->settings)826 if (button->settings)
802 type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY);827 type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY);
803828
804 if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) {829 if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
830 button->type == WACOM_TABLET_BUTTON_TYPE_RING) {
805 add_button_to_store (model, button, GTK_DIR_UP, GSD_WACOM_ACTION_TYPE_CUSTOM);831 add_button_to_store (model, button, GTK_DIR_UP, GSD_WACOM_ACTION_TYPE_CUSTOM);
806 add_button_to_store (model, button, GTK_DIR_DOWN, GSD_WACOM_ACTION_TYPE_CUSTOM);832 add_button_to_store (model, button, GTK_DIR_DOWN, GSD_WACOM_ACTION_TYPE_CUSTOM);
807 } else {833 } else {
@@ -821,8 +847,8 @@
821847
822 priv = page->priv;848 priv = page->priv;
823 gtk_widget_destroy (MWID ("button-mapping-dialog"));849 gtk_widget_destroy (MWID ("button-mapping-dialog"));
824 g_object_unref (page->priv->mapping_builder);850 g_object_unref (priv->mapping_builder);
825 page->priv->mapping_builder = NULL;851 priv->mapping_builder = NULL;
826}852}
827853
828static void854static void
@@ -838,9 +864,9 @@
838864
839 g_assert (priv->mapping_builder == NULL);865 g_assert (priv->mapping_builder == NULL);
840 priv->mapping_builder = gtk_builder_new ();866 priv->mapping_builder = gtk_builder_new ();
841 gtk_builder_add_from_file (priv->mapping_builder,867 gtk_builder_add_from_resource (priv->mapping_builder,
842 GNOMECC_UI_DIR "/button-mapping.ui",868 "/org/gnome/control-center/wacom/button-mapping.ui",
843 &error);869 &error);
844870
845 if (error != NULL) {871 if (error != NULL) {
846 g_warning ("Error loading UI file: %s", error->message);872 g_warning ("Error loading UI file: %s", error->message);
@@ -1098,10 +1124,10 @@
10981124
1099 priv->builder = gtk_builder_new ();1125 priv->builder = gtk_builder_new ();
11001126
1101 gtk_builder_add_objects_from_file (priv->builder,1127 gtk_builder_add_objects_from_resource (priv->builder,
1102 GNOMECC_UI_DIR "/gnome-wacom-properties.ui",1128 "/org/gnome/control-center/wacom/gnome-wacom-properties.ui",
1103 objects,1129 objects,
1104 &error);1130 &error);
1105 if (error != NULL) {1131 if (error != NULL) {
1106 g_warning ("Error loading UI file: %s", error->message);1132 g_warning ("Error loading UI file: %s", error->message);
1107 g_object_unref (priv->builder);1133 g_object_unref (priv->builder);
@@ -1147,16 +1173,13 @@
1147 const char *icon_name)1173 const char *icon_name)
1148{1174{
1149 CcWacomPagePrivate *priv;1175 CcWacomPagePrivate *priv;
1150 char *filename, *path;1176 char *resource;
11511177
1152 priv = page->priv;1178 priv = page->priv;
11531179
1154 filename = g_strdup_printf ("%s.svg", icon_name);1180 resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name);
1155 path = g_build_filename (GNOMECC_UI_DIR, filename, NULL);1181 gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource);
1156 g_free (filename);1182 g_free (resource);
1157
1158 gtk_image_set_from_file (GTK_IMAGE (WID (widget_name)), path);
1159 g_free (path);
1160}1183}
11611184
1162typedef struct {1185typedef struct {
@@ -1262,21 +1285,21 @@
12621285
1263 switch (layout) {1286 switch (layout) {
1264 case LAYOUT_NORMAL:1287 case LAYOUT_NORMAL:
1265 remove_left_handed (page->priv);1288 remove_left_handed (priv);
1266 remove_display_link (page->priv);1289 remove_display_link (priv);
1267 break;1290 break;
1268 case LAYOUT_REVERSIBLE:1291 case LAYOUT_REVERSIBLE:
1269 remove_display_link (page->priv);1292 remove_display_link (priv);
1270 break;1293 break;
1271 case LAYOUT_SCREEN:1294 case LAYOUT_SCREEN:
1272 remove_left_handed (page->priv);1295 remove_left_handed (priv);
12731296
1274 gtk_widget_destroy (WID ("combo-tabletmode"));1297 gtk_widget_destroy (WID ("combo-tabletmode"));
1275 gtk_widget_destroy (WID ("label-trackingmode"));1298 gtk_widget_destroy (WID ("label-trackingmode"));
1276 gtk_widget_destroy (WID ("display-mapping-button"));1299 gtk_widget_destroy (WID ("display-mapping-button"));
12771300
1278 gtk_widget_show (WID ("button-calibrate"));1301 gtk_widget_show (WID ("button-calibrate"));
1279 if (gsd_wacom_device_get_display_monitor (page->priv->stylus) >= 0)1302 if (gsd_wacom_device_get_display_monitor (priv->stylus) >= 0)
1280 has_monitor = TRUE;1303 has_monitor = TRUE;
1281 gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor);1304 gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor);
1282 gtk_widget_show (WID ("display-link"));1305 gtk_widget_show (WID ("display-link"));
12831306
=== modified file 'panels/wacom/cc-wacom-panel.c'
--- panels/wacom/cc-wacom-panel.c 2013-11-28 04:32:11 +0000
+++ panels/wacom/cc-wacom-panel.c 2014-02-19 03:07:54 +0000
@@ -27,6 +27,7 @@
2727
28#include "cc-wacom-panel.h"28#include "cc-wacom-panel.h"
29#include "cc-wacom-page.h"29#include "cc-wacom-page.h"
30#include "cc-wacom-resources.h"
30#include "gsd-wacom-device.h"31#include "gsd-wacom-device.h"
3132
32#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)33#define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x)
@@ -337,13 +338,14 @@
337 };338 };
338339
339 priv = self->priv = WACOM_PANEL_PRIVATE (self);340 priv = self->priv = WACOM_PANEL_PRIVATE (self);
341 g_resources_register (cc_wacom_get_resource ());
340342
341 priv->builder = gtk_builder_new ();343 priv->builder = gtk_builder_new ();
342344
343 gtk_builder_add_objects_from_file (priv->builder,345 gtk_builder_add_objects_from_resource (priv->builder,
344 GNOMECC_UI_DIR "/gnome-wacom-properties.ui",346 "/org/gnome/control-center/wacom/gnome-wacom-properties.ui",
345 objects,347 objects,
346 &error);348 &error);
347 if (error != NULL)349 if (error != NULL)
348 {350 {
349 g_warning ("Error loading UI file: %s", error->message);351 g_warning ("Error loading UI file: %s", error->message);
@@ -360,10 +362,10 @@
360 gtk_widget_set_vexpand (GTK_WIDGET (notebook), TRUE);362 gtk_widget_set_vexpand (GTK_WIDGET (notebook), TRUE);
361 gtk_container_set_border_width (GTK_CONTAINER (notebook), 0);363 gtk_container_set_border_width (GTK_CONTAINER (notebook), 0);
362 g_object_set (G_OBJECT (notebook),364 g_object_set (G_OBJECT (notebook),
363 "margin-top", 0,365 "margin-top", 6,
364 "margin-right", 24,366 "margin-right", 30,
365 "margin-left", 24,367 "margin-left", 30,
366 "margin-bottom", 24,368 "margin-bottom", 30,
367 NULL);369 NULL);
368370
369 gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (notebook));371 gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (notebook));
370372
=== modified file 'panels/wacom/cc-wacom-stylus-page.c'
--- panels/wacom/cc-wacom-stylus-page.c 2012-02-27 16:51:36 +0000
+++ panels/wacom/cc-wacom-stylus-page.c 2014-02-19 03:07:54 +0000
@@ -297,10 +297,10 @@
297297
298 priv->builder = gtk_builder_new ();298 priv->builder = gtk_builder_new ();
299299
300 gtk_builder_add_objects_from_file (priv->builder,300 gtk_builder_add_objects_from_resource (priv->builder,
301 GNOMECC_UI_DIR "/wacom-stylus-page.ui",301 "/org/gnome/control-center/wacom/wacom-stylus-page.ui",
302 objects,302 objects,
303 &error);303 &error);
304 if (error != NULL) {304 if (error != NULL) {
305 g_warning ("Error loading UI file: %s", error->message);305 g_warning ("Error loading UI file: %s", error->message);
306 g_object_unref (priv->builder);306 g_object_unref (priv->builder);
@@ -339,16 +339,13 @@
339 const char *icon_name)339 const char *icon_name)
340{340{
341 CcWacomStylusPagePrivate *priv;341 CcWacomStylusPagePrivate *priv;
342 char *filename, *path;342 char *resource;
343343
344 priv = page->priv;344 priv = page->priv;
345345
346 filename = g_strdup_printf ("%s.svg", icon_name);346 resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name);
347 path = g_build_filename (GNOMECC_UI_DIR, filename, NULL);347 gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource);
348 g_free (filename);348 g_free (resource);
349
350 gtk_image_set_from_file (GTK_IMAGE (WID (widget_name)), path);
351 g_free (path);
352}349}
353350
354/* Different types of layout for the stylus config */351/* Different types of layout for the stylus config */
355352
=== modified file 'panels/wacom/gnome-wacom-properties.ui'
--- panels/wacom/gnome-wacom-properties.ui 2012-05-18 16:39:31 +0000
+++ panels/wacom/gnome-wacom-properties.ui 2014-02-19 03:07:54 +0000
@@ -207,7 +207,7 @@
207 <property name="spacing">10</property>207 <property name="spacing">10</property>
208 <child>208 <child>
209 <object class="GtkButton" id="display-mapping-button">209 <object class="GtkButton" id="display-mapping-button">
210 <property name="label" translatable="yes">Map to Monitor...</property>210 <property name="label" translatable="yes">Map to Monitor…</property>
211 <property name="visible">True</property>211 <property name="visible">True</property>
212 <property name="can_focus">True</property>212 <property name="can_focus">True</property>
213 <property name="receives_default">True</property>213 <property name="receives_default">True</property>
@@ -223,7 +223,7 @@
223 </child>223 </child>
224 <child>224 <child>
225 <object class="GtkButton" id="map-buttons-button">225 <object class="GtkButton" id="map-buttons-button">
226 <property name="label" translatable="yes">Map Buttons...</property>226 <property name="label" translatable="yes">Map Buttons…</property>
227 <property name="visible">True</property>227 <property name="visible">True</property>
228 <property name="can_focus">True</property>228 <property name="can_focus">True</property>
229 <property name="receives_default">True</property>229 <property name="receives_default">True</property>
@@ -239,7 +239,7 @@
239 </child>239 </child>
240 <child>240 <child>
241 <object class="GtkButton" id="button-calibrate">241 <object class="GtkButton" id="button-calibrate">
242 <property name="label" translatable="yes">Calibrate...</property>242 <property name="label" translatable="yes">Calibrate…</property>
243 <property name="can_focus">True</property>243 <property name="can_focus">True</property>
244 <property name="receives_default">True</property>244 <property name="receives_default">True</property>
245 <property name="valign">center</property>245 <property name="valign">center</property>
246246
=== modified file 'panels/wacom/gsd-input-helper.c'
--- panels/wacom/gsd-input-helper.c 2012-08-21 15:59:36 +0000
+++ panels/wacom/gsd-input-helper.c 2014-02-19 03:07:54 +0000
@@ -20,6 +20,8 @@
2020
21#include "config.h"21#include "config.h"
2222
23#include <string.h>
24
23#include <gdk/gdk.h>25#include <gdk/gdk.h>
24#include <gdk/gdkx.h>26#include <gdk/gdkx.h>
2527
@@ -189,11 +191,36 @@
189}191}
190192
191gboolean193gboolean
194device_info_is_tablet (XDeviceInfo *device_info)
195{
196 /* Note that this doesn't match Wacom tablets */
197 return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TABLET, False));
198}
199
200gboolean
192device_info_is_mouse (XDeviceInfo *device_info)201device_info_is_mouse (XDeviceInfo *device_info)
193{202{
194 return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False));203 return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False));
195}204}
196205
206gboolean
207device_info_is_trackball (XDeviceInfo *device_info)
208{
209 gboolean retval;
210
211 retval = (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TRACKBALL, False));
212 if (retval == FALSE &&
213 device_info->name != NULL) {
214 char *lowercase;
215
216 lowercase = g_ascii_strdown (device_info->name, -1);
217 retval = strstr (lowercase, "trackball") != NULL;
218 g_free (lowercase);
219 }
220
221 return retval;
222}
223
197static gboolean224static gboolean
198device_type_is_present (InfoIdentifyFunc info_func,225device_type_is_present (InfoIdentifyFunc info_func,
199 DeviceIdentifyFunc device_func)226 DeviceIdentifyFunc device_func)
@@ -263,6 +290,13 @@
263 NULL);290 NULL);
264}291}
265292
293gboolean
294trackball_is_present (void)
295{
296 return device_type_is_present (device_info_is_trackball,
297 NULL);
298}
299
266char *300char *
267xdevice_get_device_node (int deviceid)301xdevice_get_device_node (int deviceid)
268{302{
@@ -480,7 +514,7 @@
480 argv[2] = (char *) custom_command_to_string (command);514 argv[2] = (char *) custom_command_to_string (command);
481 argv[3] = "-i";515 argv[3] = "-i";
482 argv[4] = g_strdup_printf ("%d", id);516 argv[4] = g_strdup_printf ("%d", id);
483 argv[5] = g_strdup_printf ("%s", gdk_device_get_name (device));517 argv[5] = (char*) gdk_device_get_name (device);
484 argv[6] = NULL;518 argv[6] = NULL;
485519
486 rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,520 rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
@@ -491,9 +525,8 @@
491525
492 g_free (argv[0]);526 g_free (argv[0]);
493 g_free (argv[4]);527 g_free (argv[4]);
494 g_free (argv[5]);
495528
496 return (exit_status == 0);529 return (exit_status == 1);
497}530}
498531
499GList *532GList *
500533
=== modified file 'panels/wacom/gsd-input-helper.h'
--- panels/wacom/gsd-input-helper.h 2012-08-21 15:59:36 +0000
+++ panels/wacom/gsd-input-helper.h 2014-02-19 03:07:54 +0000
@@ -61,11 +61,14 @@
6161
62gboolean device_info_is_touchpad (XDeviceInfo *device_info);62gboolean device_info_is_touchpad (XDeviceInfo *device_info);
63gboolean device_info_is_touchscreen (XDeviceInfo *device_info);63gboolean device_info_is_touchscreen (XDeviceInfo *device_info);
64gboolean device_info_is_tablet (XDeviceInfo *device_info);
64gboolean device_info_is_mouse (XDeviceInfo *device_info);65gboolean device_info_is_mouse (XDeviceInfo *device_info);
66gboolean device_info_is_trackball (XDeviceInfo *device_info);
6567
66gboolean touchpad_is_present (void);68gboolean touchpad_is_present (void);
67gboolean touchscreen_is_present (void);69gboolean touchscreen_is_present (void);
68gboolean mouse_is_present (void);70gboolean mouse_is_present (void);
71gboolean trackball_is_present (void);
6972
70gboolean device_set_property (XDevice *xdevice,73gboolean device_set_property (XDevice *xdevice,
71 const char *device_name,74 const char *device_name,
7275
=== modified file 'panels/wacom/gsd-wacom-device.c'
--- panels/wacom/gsd-wacom-device.c 2014-02-18 04:27:04 +0000
+++ panels/wacom/gsd-wacom-device.c 2014-02-19 03:07:54 +0000
@@ -255,8 +255,10 @@
255 const char *id,255 const char *id,
256 const char *settings_path,256 const char *settings_path,
257 GsdWacomTabletButtonType type,257 GsdWacomTabletButtonType type,
258 GsdWacomTabletButtonPos pos,
258 int group_id,259 int group_id,
259 int idx)260 int idx,
261 int status_led)
260{262{
261 GsdWacomTabletButton *ret;263 GsdWacomTabletButton *ret;
262264
@@ -273,6 +275,8 @@
273 ret->group_id = group_id;275 ret->group_id = group_id;
274 ret->idx = idx;276 ret->idx = idx;
275 ret->type = type;277 ret->type = type;
278 ret->pos = pos;
279 ret->status_led = status_led;
276280
277 return ret;281 return ret;
278}282}
@@ -328,9 +332,11 @@
328 char *path;332 char *path;
329 char *machine_id;333 char *machine_id;
330 const char *icon_name;334 const char *icon_name;
335 char *layout_path;
331 char *tool_name;336 char *tool_name;
332 gboolean reversible;337 gboolean reversible;
333 gboolean is_screen_tablet;338 gboolean is_screen_tablet;
339 gboolean is_isd; /* integrated system device */
334 gboolean is_fallback;340 gboolean is_fallback;
335 GList *styli;341 GList *styli;
336 GsdWacomStylus *last_stylus;342 GsdWacomStylus *last_stylus;
@@ -775,12 +781,10 @@
775 if (rr_output == NULL) {781 if (rr_output == NULL) {
776 if (gsd_wacom_device_is_screen_tablet (device)) {782 if (gsd_wacom_device_is_screen_tablet (device)) {
777 rr_output = find_output_by_heuristic (rr_screen, device);783 rr_output = find_output_by_heuristic (rr_screen, device);
778 if (rr_output == NULL) {784 if (rr_output == NULL)
779 g_warning ("No fuzzy match based on heuristics was found.");785 g_warning ("No fuzzy match based on heuristics was found.");
780 } else {786 else
781 g_warning ("Automatically mapping tablet to heuristically-found display.");787 g_warning ("Automatically mapping tablet to heuristically-found display.");
782 set_display_by_output (device, rr_output);
783 }
784 }788 }
785 }789 }
786790
@@ -956,21 +960,78 @@
956}960}
957961
958int962int
959gsd_wacom_device_set_next_mode (GsdWacomDevice *device,963gsd_wacom_device_get_num_modes (GsdWacomDevice *device,
960 int group_id)964 int group_id)
961{965{
966 int num_modes;
967
968 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);
969 num_modes = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->num_modes, GINT_TO_POINTER(group_id)));
970
971 return num_modes;
972}
973
974int
975gsd_wacom_device_get_current_mode (GsdWacomDevice *device,
976 int group_id)
977{
962 int current_idx;978 int current_idx;
963 int num_modes;
964979
965 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);980 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);
966 current_idx = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER(group_id)));981 current_idx = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER(group_id)));
967 /* That means that the mode doesn't exist, see gsd_wacom_device_add_modes() */982 /* That means that the mode doesn't exist, see gsd_wacom_device_add_modes() */
968 g_return_val_if_fail (current_idx != 0, -1);983 g_return_val_if_fail (current_idx != 0, -1);
969984
970 current_idx++;985 return current_idx;
971986}
987
988int
989gsd_wacom_device_set_next_mode (GsdWacomDevice *device,
990 GsdWacomTabletButton *button)
991{
992 GList *l;
993 int current_idx;
994 int num_modes;
995 int num_switches;
996 int group_id;
997
998 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);
999
1000 group_id = button->group_id;
1001 current_idx = 0;
1002 num_switches = 0;
972 num_modes = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->num_modes, GINT_TO_POINTER(group_id)));1003 num_modes = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->num_modes, GINT_TO_POINTER(group_id)));
9731004
1005 /*
1006 * Check if we have multiple mode-switch buttons for that
1007 * group, and if so, compute the current index based on
1008 * the position in the list...
1009 */
1010 for (l = device->priv->buttons; l != NULL; l = l->next) {
1011 GsdWacomTabletButton *b = l->data;
1012 if (b->type != WACOM_TABLET_BUTTON_TYPE_HARDCODED)
1013 continue;
1014 if (button->group_id == b->group_id)
1015 num_switches++;
1016 if (g_strcmp0 (button->id, b->id) == 0)
1017 current_idx = num_switches;
1018 }
1019
1020 /* We should at least have found the current mode-switch button...
1021 * If not, then it means that the given button is not a valid
1022 * mode-switch.
1023 */
1024 g_return_val_if_fail (num_switches != 0, -1);
1025
1026 /* Only one mode-switch? cycle through the modes */
1027 if (num_switches == 1) {
1028 current_idx = gsd_wacom_device_get_current_mode (device, group_id);
1029 /* gsd_wacom_device_get_current_mode() returns -1 when the mode doesn't exist */
1030 g_return_val_if_fail (current_idx > 0, -1);
1031
1032 current_idx++;
1033 }
1034
974 if (current_idx > num_modes)1035 if (current_idx > num_modes)
975 current_idx = 1;1036 current_idx = 1;
9761037
@@ -1001,30 +1062,69 @@
1001{1062{
1002 GList *l;1063 GList *l;
1003 guint num_modes;1064 guint num_modes;
1065 guint group;
1004 guint i;1066 guint i;
1005 char *name, *id;1067 char *name, *id;
10061068
1007 l = NULL;1069 l = NULL;
10081070
1009 if ((direction & WACOM_BUTTON_POSITION_LEFT) && libwacom_has_ring (wacom_device)) {1071 if ((direction & WACOM_BUTTON_POSITION_LEFT) && libwacom_has_ring (wacom_device)) {
1010 /* There is a ring so there must be at least one mode */1072 num_modes = libwacom_get_ring_num_modes (wacom_device);
1011 num_modes = MAX (1, libwacom_get_ring_num_modes (wacom_device));1073 group = flags_to_group (WACOM_BUTTON_RING_MODESWITCH);
1012 for (i = 1; i <= num_modes; i++) {1074 if (num_modes == 0) {
1013 name = g_strdup_printf (_("Left Ring Mode #%d"), i);1075 /* If no mode is available, we use "left-ring-mode-1" for backward compat */
1014 id = g_strdup_printf ("left-ring-mode-%d", i);1076 l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Ring"),
1015 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING_MODESWITCH), i - 1));1077 "left-ring-mode-1",
1016 g_free (name);1078 settings_path,
1017 g_free (id);1079 WACOM_TABLET_BUTTON_TYPE_RING,
1080 WACOM_TABLET_BUTTON_POS_LEFT,
1081 group,
1082 0,
1083 GSD_WACOM_NO_LED));
1084 } else {
1085 for (i = 1; i <= num_modes; i++) {
1086 name = g_strdup_printf (_("Left Ring Mode #%d"), i);
1087 id = g_strdup_printf ("left-ring-mode-%d", i);
1088 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1089 id,
1090 settings_path,
1091 WACOM_TABLET_BUTTON_TYPE_RING,
1092 WACOM_TABLET_BUTTON_POS_LEFT,
1093 group,
1094 i - 1,
1095 GSD_WACOM_NO_LED));
1096 g_free (name);
1097 g_free (id);
1098 }
1018 }1099 }
1019 } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && libwacom_has_ring2 (wacom_device)) {1100 } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && libwacom_has_ring2 (wacom_device)) {
1020 /* There is a ring so there must be at least one mode */1101 num_modes = libwacom_get_ring2_num_modes (wacom_device);
1021 num_modes = MAX (1, libwacom_get_ring2_num_modes (wacom_device));1102 group = flags_to_group (WACOM_BUTTON_RING2_MODESWITCH);
1022 for (i = 1; i <= num_modes; i++) {1103 if (num_modes == 0) {
1023 name = g_strdup_printf (_("Right Ring Mode #%d"), i);1104 /* If no mode is available, we use "right-ring-mode-1" for backward compat */
1024 id = g_strdup_printf ("right-ring-mode-%d", i);1105 l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Ring"),
1025 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_RING2_MODESWITCH), i - 1));1106 "right-ring-mode-1",
1026 g_free (name);1107 settings_path,
1027 g_free (id);1108 WACOM_TABLET_BUTTON_TYPE_RING,
1109 WACOM_TABLET_BUTTON_POS_RIGHT,
1110 group,
1111 0,
1112 GSD_WACOM_NO_LED));
1113 } else {
1114 for (i = 1; i <= num_modes; i++) {
1115 name = g_strdup_printf (_("Right Ring Mode #%d"), i);
1116 id = g_strdup_printf ("right-ring-mode-%d", i);
1117 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1118 id,
1119 settings_path,
1120 WACOM_TABLET_BUTTON_TYPE_RING,
1121 WACOM_TABLET_BUTTON_POS_RIGHT,
1122 group,
1123 i - 1,
1124 GSD_WACOM_NO_LED));
1125 g_free (name);
1126 g_free (id);
1127 }
1028 }1128 }
1029 }1129 }
10301130
@@ -1039,6 +1139,7 @@
1039 GList *l;1139 GList *l;
1040 guint num_modes;1140 guint num_modes;
1041 guint num_strips;1141 guint num_strips;
1142 guint group;
1042 guint i;1143 guint i;
1043 char *name, *id;1144 char *name, *id;
10441145
@@ -1048,24 +1149,62 @@
1048 g_warning ("Unhandled number of touchstrips: %d", num_strips);1149 g_warning ("Unhandled number of touchstrips: %d", num_strips);
10491150
1050 if ((direction & WACOM_BUTTON_POSITION_LEFT) && num_strips >= 1) {1151 if ((direction & WACOM_BUTTON_POSITION_LEFT) && num_strips >= 1) {
1051 /* There is a strip so there must be at least one mode */1152 num_modes = libwacom_get_strips_num_modes (wacom_device);
1052 num_modes = MAX (1, libwacom_get_strips_num_modes (wacom_device));1153 group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH);
1053 for (i = 1; i <= num_modes; i++) {1154 if (num_modes == 0) {
1054 name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i);1155 /* If no mode is available, we use "left-strip-mode-1" for backward compat */
1055 id = g_strdup_printf ("left-strip-mode-%d", i);1156 l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Touchstrip"),
1056 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH), i - 1));1157 "left-strip-mode-1",
1057 g_free (name);1158 settings_path,
1058 g_free (id);1159 WACOM_TABLET_BUTTON_TYPE_STRIP,
1160 WACOM_TABLET_BUTTON_POS_LEFT,
1161 group,
1162 0,
1163 GSD_WACOM_NO_LED));
1164 } else {
1165 for (i = 1; i <= num_modes; i++) {
1166 name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i);
1167 id = g_strdup_printf ("left-strip-mode-%d", i);
1168 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1169 id,
1170 settings_path,
1171 WACOM_TABLET_BUTTON_TYPE_STRIP,
1172 WACOM_TABLET_BUTTON_POS_LEFT,
1173 group,
1174 i - 1,
1175 GSD_WACOM_NO_LED));
1176 g_free (name);
1177 g_free (id);
1178 }
1059 }1179 }
1060 } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && num_strips >= 2) {1180 } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && num_strips >= 2) {
1061 /* There is a strip so there must be at least one mode */1181 num_modes = libwacom_get_strips_num_modes (wacom_device);
1062 num_modes = MAX (1, libwacom_get_strips_num_modes (wacom_device));1182 group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH);
1063 for (i = 1; i <= num_modes; i++) {1183 if (num_modes == 0) {
1064 name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i);1184 /* If no mode is available, we use "right-strip-mode-1" for backward compat */
1065 id = g_strdup_printf ("right-strip-mode-%d", i);1185 l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Touchstrip"),
1066 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_ELEVATOR, flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH), i - 1));1186 "right-strip-mode-1",
1067 g_free (name);1187 settings_path,
1068 g_free (id);1188 WACOM_TABLET_BUTTON_TYPE_STRIP,
1189 WACOM_TABLET_BUTTON_POS_RIGHT,
1190 group,
1191 0,
1192 GSD_WACOM_NO_LED));
1193 } else {
1194 for (i = 1; i <= num_modes; i++) {
1195 name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i);
1196 id = g_strdup_printf ("right-strip-mode-%d", i);
1197 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1198 id,
1199 settings_path,
1200 WACOM_TABLET_BUTTON_TYPE_STRIP,
1201 WACOM_TABLET_BUTTON_POS_RIGHT,
1202 group,
1203 i - 1,
1204 GSD_WACOM_NO_LED));
1205 g_free (name);
1206 g_free (id);
1207 }
1069 }1208 }
1070 }1209 }
10711210
@@ -1093,6 +1232,23 @@
1093 return g_strdup_printf (_("Mode Switch #%d"), button_num);1232 return g_strdup_printf (_("Mode Switch #%d"), button_num);
1094}1233}
10951234
1235static GsdWacomTabletButtonType
1236gsd_wacom_device_button_pos (WacomButtonFlags flags)
1237{
1238 if (flags & WACOM_BUTTON_POSITION_LEFT)
1239 return WACOM_TABLET_BUTTON_POS_LEFT;
1240 else if (flags & WACOM_BUTTON_POSITION_RIGHT)
1241 return WACOM_TABLET_BUTTON_POS_RIGHT;
1242 else if (flags & WACOM_BUTTON_POSITION_TOP)
1243 return WACOM_TABLET_BUTTON_POS_TOP;
1244 else if (flags & WACOM_BUTTON_POSITION_BOTTOM)
1245 return WACOM_TABLET_BUTTON_POS_BOTTOM;
1246
1247 g_warning ("Unhandled button position");
1248
1249 return WACOM_TABLET_BUTTON_POS_UNDEF;
1250}
1251
1096static GList *1252static GList *
1097gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device,1253gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device,
1098 const char *settings_path,1254 const char *settings_path,
@@ -1119,7 +1275,14 @@
11191275
1120 name = g_strdup_printf (button_str, button_num++);1276 name = g_strdup_printf (button_str, button_num++);
1121 id = g_strdup_printf ("%s%c", button_str_id, i);1277 id = g_strdup_printf ("%s%c", button_str_id, i);
1122 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_NORMAL, flags_to_group (flags), -1));1278 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1279 id,
1280 settings_path,
1281 WACOM_TABLET_BUTTON_TYPE_NORMAL,
1282 gsd_wacom_device_button_pos (flags),
1283 flags_to_group (flags),
1284 -1,
1285 GSD_WACOM_NO_LED));
1123 g_free (name);1286 g_free (name);
1124 g_free (id);1287 g_free (id);
1125 }1288 }
@@ -1128,6 +1291,7 @@
1128 for (i = 'A'; i < 'A' + num_buttons; i++) {1291 for (i = 'A'; i < 'A' + num_buttons; i++) {
1129 WacomButtonFlags flags;1292 WacomButtonFlags flags;
1130 char *name, *id;1293 char *name, *id;
1294 int status_led;
11311295
1132 flags = libwacom_get_button_flag (wacom_device, i);1296 flags = libwacom_get_button_flag (wacom_device, i);
1133 if (!(flags & direction))1297 if (!(flags & direction))
@@ -1138,7 +1302,15 @@
11381302
1139 name = gsd_wacom_device_modeswitch_name (flags, button_num++);1303 name = gsd_wacom_device_modeswitch_name (flags, button_num++);
1140 id = g_strdup_printf ("%s%c", button_str_id, i);1304 id = g_strdup_printf ("%s%c", button_str_id, i);
1141 l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_HARDCODED, flags_to_group (flags), -1));1305 status_led = libwacom_get_button_led_group (wacom_device, i);
1306 l = g_list_append (l, gsd_wacom_tablet_button_new (name,
1307 id,
1308 settings_path,
1309 WACOM_TABLET_BUTTON_TYPE_HARDCODED,
1310 gsd_wacom_device_button_pos (flags),
1311 flags_to_group (flags),
1312 -1,
1313 status_led));
1142 g_free (name);1314 g_free (name);
1143 g_free (id);1315 g_free (id);
1144 }1316 }
@@ -1239,11 +1411,13 @@
1239 settings_path);1411 settings_path);
12401412
1241 device->priv->name = g_strdup (libwacom_get_name (wacom_device));1413 device->priv->name = g_strdup (libwacom_get_name (wacom_device));
1414 device->priv->layout_path = g_strdup (libwacom_get_layout_filename (wacom_device));
1242 device->priv->reversible = libwacom_is_reversible (wacom_device);1415 device->priv->reversible = libwacom_is_reversible (wacom_device);
1243 integration_flags = libwacom_get_integration_flags (wacom_device);1416 integration_flags = libwacom_get_integration_flags (wacom_device);
1244 device->priv->is_screen_tablet = (integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY);1417 device->priv->is_screen_tablet = (integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY);
1418 device->priv->is_isd = (integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM);
1245 if (device->priv->is_screen_tablet) {1419 if (device->priv->is_screen_tablet) {
1246 if (libwacom_get_class (wacom_device) == WCLASS_CINTIQ)1420 if (!device->priv->is_isd)
1247 device->priv->icon_name = "wacom-tablet-cintiq";1421 device->priv->icon_name = "wacom-tablet-cintiq";
1248 else1422 else
1249 device->priv->icon_name = "wacom-tablet-pc";1423 device->priv->icon_name = "wacom-tablet-pc";
@@ -1487,6 +1661,8 @@
1487 p->num_modes = NULL;1661 p->num_modes = NULL;
1488 }1662 }
14891663
1664 g_clear_pointer (&p->layout_path, g_free);
1665
1490 gdk_window_remove_filter (NULL,1666 gdk_window_remove_filter (NULL,
1491 (GdkFilterFunc) filter_events,1667 (GdkFilterFunc) filter_events,
1492 device);1668 device);
@@ -1536,6 +1712,14 @@
1536}1712}
15371713
1538const char *1714const char *
1715gsd_wacom_device_get_layout_path (GsdWacomDevice *device)
1716{
1717 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL);
1718
1719 return device->priv->layout_path;
1720}
1721
1722const char *
1539gsd_wacom_device_get_path (GsdWacomDevice *device)1723gsd_wacom_device_get_path (GsdWacomDevice *device)
1540{1724{
1541 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL);1725 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL);
@@ -1576,6 +1760,14 @@
1576}1760}
15771761
1578gboolean1762gboolean
1763gsd_wacom_device_is_isd (GsdWacomDevice *device)
1764{
1765 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), FALSE);
1766
1767 return device->priv->is_isd;
1768}
1769
1770gboolean
1579gsd_wacom_device_is_fallback (GsdWacomDevice *device)1771gsd_wacom_device_is_fallback (GsdWacomDevice *device)
1580{1772{
1581 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), FALSE);1773 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), FALSE);
15821774
=== modified file 'panels/wacom/gsd-wacom-device.h'
--- panels/wacom/gsd-wacom-device.h 2012-10-19 13:41:43 +0000
+++ panels/wacom/gsd-wacom-device.h 2014-02-19 03:07:54 +0000
@@ -93,19 +93,36 @@
93/* Tablet Buttons */93/* Tablet Buttons */
94typedef enum {94typedef enum {
95 WACOM_TABLET_BUTTON_TYPE_NORMAL,95 WACOM_TABLET_BUTTON_TYPE_NORMAL,
96 WACOM_TABLET_BUTTON_TYPE_ELEVATOR,96 WACOM_TABLET_BUTTON_TYPE_STRIP,
97 WACOM_TABLET_BUTTON_TYPE_RING,
97 WACOM_TABLET_BUTTON_TYPE_HARDCODED98 WACOM_TABLET_BUTTON_TYPE_HARDCODED
98} GsdWacomTabletButtonType;99} GsdWacomTabletButtonType;
99100
101/*
102 * Positions of the buttons on the tablet in default right-handed mode
103 * (ie with no rotation applied).
104 */
105typedef enum {
106 WACOM_TABLET_BUTTON_POS_UNDEF = 0,
107 WACOM_TABLET_BUTTON_POS_LEFT,
108 WACOM_TABLET_BUTTON_POS_RIGHT,
109 WACOM_TABLET_BUTTON_POS_TOP,
110 WACOM_TABLET_BUTTON_POS_BOTTOM
111} GsdWacomTabletButtonPos;
112
100#define MAX_GROUP_ID 4113#define MAX_GROUP_ID 4
101114
115#define GSD_WACOM_NO_LED -1
116
102typedef struct117typedef struct
103{118{
104 char *name;119 char *name;
105 char *id;120 char *id;
106 GSettings *settings;121 GSettings *settings;
107 GsdWacomTabletButtonType type;122 GsdWacomTabletButtonType type;
123 GsdWacomTabletButtonPos pos;
108 int group_id, idx;124 int group_id, idx;
125 int status_led;
109} GsdWacomTabletButton;126} GsdWacomTabletButton;
110127
111void gsd_wacom_tablet_button_free (GsdWacomTabletButton *button);128void gsd_wacom_tablet_button_free (GsdWacomTabletButton *button);
@@ -137,11 +154,13 @@
137GsdWacomDevice * gsd_wacom_device_new (GdkDevice *device);154GsdWacomDevice * gsd_wacom_device_new (GdkDevice *device);
138GList * gsd_wacom_device_list_styli (GsdWacomDevice *device);155GList * gsd_wacom_device_list_styli (GsdWacomDevice *device);
139const char * gsd_wacom_device_get_name (GsdWacomDevice *device);156const char * gsd_wacom_device_get_name (GsdWacomDevice *device);
157const char * gsd_wacom_device_get_layout_path (GsdWacomDevice *device);
140const char * gsd_wacom_device_get_path (GsdWacomDevice *device);158const char * gsd_wacom_device_get_path (GsdWacomDevice *device);
141const char * gsd_wacom_device_get_icon_name (GsdWacomDevice *device);159const char * gsd_wacom_device_get_icon_name (GsdWacomDevice *device);
142const char * gsd_wacom_device_get_tool_name (GsdWacomDevice *device);160const char * gsd_wacom_device_get_tool_name (GsdWacomDevice *device);
143gboolean gsd_wacom_device_reversible (GsdWacomDevice *device);161gboolean gsd_wacom_device_reversible (GsdWacomDevice *device);
144gboolean gsd_wacom_device_is_screen_tablet (GsdWacomDevice *device);162gboolean gsd_wacom_device_is_screen_tablet (GsdWacomDevice *device);
163gboolean gsd_wacom_device_is_isd (GsdWacomDevice *device);
145gboolean gsd_wacom_device_is_fallback (GsdWacomDevice *device);164gboolean gsd_wacom_device_is_fallback (GsdWacomDevice *device);
146gint gsd_wacom_device_get_num_strips (GsdWacomDevice *device);165gint gsd_wacom_device_get_num_strips (GsdWacomDevice *device);
147gint gsd_wacom_device_get_num_rings (GsdWacomDevice *device);166gint gsd_wacom_device_get_num_rings (GsdWacomDevice *device);
@@ -158,8 +177,12 @@
158GsdWacomTabletButton *gsd_wacom_device_get_button (GsdWacomDevice *device,177GsdWacomTabletButton *gsd_wacom_device_get_button (GsdWacomDevice *device,
159 int button,178 int button,
160 GtkDirectionType *dir);179 GtkDirectionType *dir);
161int gsd_wacom_device_set_next_mode (GsdWacomDevice *device,180int gsd_wacom_device_get_num_modes (GsdWacomDevice *device,
162 int group_id);181 int group_id);
182int gsd_wacom_device_get_current_mode (GsdWacomDevice *device,
183 int group_id);
184int gsd_wacom_device_set_next_mode (GsdWacomDevice *device,
185 GsdWacomTabletButton *button);
163GsdWacomRotation gsd_wacom_device_rotation_name_to_type (const char *rotation);186GsdWacomRotation gsd_wacom_device_rotation_name_to_type (const char *rotation);
164const char * gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type);187const char * gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type);
165188
166189
=== modified file 'panels/wacom/unity-wacom-panel.desktop.in.in'
--- panels/wacom/unity-wacom-panel.desktop.in.in 2013-12-02 04:30:50 +0000
+++ panels/wacom/unity-wacom-panel.desktop.in.in 2014-02-19 03:07:54 +0000
@@ -1,6 +1,6 @@
1[Desktop Entry]1[Desktop Entry]
2_Name=Wacom Tablet2_Name=Wacom Tablet
3_Comment=Set your Wacom tablet preferences3_Comment=Set button mappings and adjust stylus sensitivity for graphics tablets
4Exec=unity-control-center wacom4Exec=unity-control-center wacom
5Icon=input-tablet5Icon=input-tablet
6Terminal=false6Terminal=false
77
=== added file 'panels/wacom/wacom.gresource.xml'
--- panels/wacom/wacom.gresource.xml 1970-01-01 00:00:00 +0000
+++ panels/wacom/wacom.gresource.xml 2014-02-19 03:07:54 +0000
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<gresources>
3 <gresource prefix="/org/gnome/control-center/wacom">
4 <file preprocess="xml-stripblanks">gnome-wacom-properties.ui</file>
5 <file preprocess="xml-stripblanks">wacom-stylus-page.ui</file>
6 <file preprocess="xml-stripblanks">button-mapping.ui</file>
7 <file>wacom-tablet.svg</file>
8 <file>wacom-stylus.svg</file>
9 <file>wacom-stylus-airbrush.svg</file>
10 <file>wacom-stylus-inking.svg</file>
11 <file>wacom-stylus-art-pen.svg</file>
12 <file>wacom-stylus-classic.svg</file>
13 <file>wacom-tablet-cintiq.svg</file>
14 <file>wacom-tablet-pc.svg</file>
15 </gresource>
16</gresources>

Subscribers

People subscribed via source and target branches