Merge lp:~robert-ancell/unity-control-center/wacom-panel-3.8 into lp:unity-control-center
- wacom-panel-3.8
- Merge into trunk
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 |
Related bugs: |
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
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:12711
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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
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
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2014-02-17 23:33:18 +0000 |
3 | +++ configure.ac 2014-02-19 03:07:54 +0000 |
4 | @@ -112,7 +112,7 @@ |
5 | LIBNOTIFY_REQUIRED_VERSION=0.7.3 |
6 | GNOME_DESKTOP_REQUIRED_VERSION=3.5.91 |
7 | SCHEMAS_REQUIRED_VERSION=3.7.2.2 |
8 | -LIBWACOM_REQUIRED_VERSION=0.6 |
9 | +LIBWACOM_REQUIRED_VERSION=0.7 |
10 | CLUTTER_REQUIRED_VERSION=1.11.3 |
11 | GOA_REQUIRED_VERSION=3.5.90 |
12 | |
13 | @@ -246,6 +246,7 @@ |
14 | gnome-settings-daemon >= $GSD_REQUIRED_VERSION |
15 | xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION |
16 | gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) |
17 | + AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel]) |
18 | have_wacom=yes |
19 | fi |
20 | ;; |
21 | |
22 | === modified file 'debian/control' |
23 | --- debian/control 2014-02-17 17:40:21 +0000 |
24 | +++ debian/control 2014-02-19 03:07:54 +0000 |
25 | @@ -42,7 +42,7 @@ |
26 | libupower-glib-dev (>= 0.9.1), |
27 | libsystemd-login-dev, |
28 | libtimezonemap1-dev, |
29 | - libwacom-dev (>= 0.6), |
30 | + libwacom-dev (>= 0.7), |
31 | libx11-dev, |
32 | libxft-dev (>= 2.1.2), |
33 | libxkbfile-dev, |
34 | |
35 | === modified file 'panels/wacom/Makefile.am' |
36 | --- panels/wacom/Makefile.am 2013-11-29 06:28:37 +0000 |
37 | +++ panels/wacom/Makefile.am 2014-02-19 03:07:54 +0000 |
38 | @@ -8,15 +8,18 @@ |
39 | $(WACOM_PANEL_CFLAGS) \ |
40 | -I$(srcdir)/calibrator \ |
41 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
42 | - -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ |
43 | - -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
44 | $(NULL) |
45 | |
46 | - |
47 | ccpanelsdir = $(PANELS_DIR) |
48 | ccpanels_LTLIBRARIES = libwacom-properties.la |
49 | |
50 | + |
51 | +BUILT_SOURCES = \ |
52 | + cc-wacom-resources.c \ |
53 | + cc-wacom-resources.h |
54 | + |
55 | libwacom_properties_la_SOURCES = \ |
56 | + $(BUILT_SOURCES) \ |
57 | wacom-module.c \ |
58 | cc-wacom-panel.c \ |
59 | cc-wacom-panel.h \ |
60 | @@ -40,6 +43,7 @@ |
61 | noinst_PROGRAMS = test-wacom |
62 | |
63 | test_wacom_SOURCES = \ |
64 | + $(BUILT_SOURCES) \ |
65 | test-wacom.c \ |
66 | cc-wacom-page.c \ |
67 | cc-wacom-page.h \ |
68 | @@ -58,22 +62,14 @@ |
69 | test_wacom_CPPFLAGS = $(INCLUDES) |
70 | test_wacom_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS) $(builddir)/calibrator/libwacom-calibrator.la |
71 | |
72 | +resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wacom.gresource.xml) |
73 | +cc-wacom-resources.c: wacom.gresource.xml $(resource_files) |
74 | + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_wacom $< |
75 | +cc-wacom-resources.h: wacom.gresource.xml $(resource_files) |
76 | + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_wacom $< |
77 | + |
78 | @INTLTOOL_DESKTOP_RULE@ |
79 | |
80 | -pixmapdir = $(pkgdatadir)/ui |
81 | -pixmap_DATA = \ |
82 | - wacom-tablet.svg \ |
83 | - wacom-stylus.svg \ |
84 | - wacom-stylus-airbrush.svg \ |
85 | - wacom-stylus-inking.svg \ |
86 | - wacom-stylus-art-pen.svg \ |
87 | - wacom-stylus-classic.svg \ |
88 | - wacom-tablet-cintiq.svg \ |
89 | - wacom-tablet-pc.svg |
90 | - |
91 | -uidir = $(pkgdatadir)/ui |
92 | -ui_DATA = gnome-wacom-properties.ui wacom-stylus-page.ui button-mapping.ui |
93 | - |
94 | desktopdir = $(datadir)/applications |
95 | desktop_in_files = unity-wacom-panel.desktop.in |
96 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
97 | @@ -87,7 +83,7 @@ |
98 | FILES="$(COMMONFILES)" DIR="$(COMMONDIR)" $(top_srcdir)/update-from-gsd.sh && changed=true ; \ |
99 | git commit -m "wacom: Update from gnome-settings-daemon" $(WACOMFILES) $(COMMONFILES) |
100 | |
101 | -CLEANFILES = $(Desktop_in_files) $(desktop_DATA) |
102 | -EXTRA_DIST = $(ui_DATA) $(pixmap_DATA) |
103 | +CLEANFILES = $(Desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES) |
104 | +EXTRA_DIST = $(resource_files) wacom.gresource.xml |
105 | |
106 | -include $(top_srcdir)/git.mk |
107 | |
108 | === modified file 'panels/wacom/calibrator/Makefile.am' |
109 | --- panels/wacom/calibrator/Makefile.am 2013-11-29 06:28:37 +0000 |
110 | +++ panels/wacom/calibrator/Makefile.am 2014-02-19 03:07:54 +0000 |
111 | @@ -5,9 +5,6 @@ |
112 | $(PANEL_CFLAGS) \ |
113 | $(WACOM_PANEL_CFLAGS) \ |
114 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
115 | - -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ |
116 | - -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
117 | - -DPIXMAP_DIR=\""$(datadir)/unity-control-center/pixmaps"\" \ |
118 | $(NULL) |
119 | |
120 | |
121 | |
122 | === modified file 'panels/wacom/cc-wacom-nav-button.c' |
123 | --- panels/wacom/cc-wacom-nav-button.c 2012-02-27 16:51:36 +0000 |
124 | +++ panels/wacom/cc-wacom-nav-button.c 2014-02-19 03:07:54 +0000 |
125 | @@ -211,6 +211,9 @@ |
126 | CcWacomNavButtonPrivate *priv; |
127 | GtkStyleContext *context; |
128 | GtkWidget *image, *box; |
129 | + gboolean rtl; |
130 | + |
131 | + rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL); |
132 | |
133 | priv = self->priv = WACOM_NAV_BUTTON_PRIVATE (self); |
134 | |
135 | @@ -228,7 +231,8 @@ |
136 | |
137 | /* Prev button */ |
138 | priv->prev = gtk_button_new (); |
139 | - image = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU); |
140 | + image = gtk_image_new_from_icon_name (rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic", |
141 | + GTK_ICON_SIZE_MENU); |
142 | gtk_container_add (GTK_CONTAINER (priv->prev), image); |
143 | g_signal_connect (G_OBJECT (priv->prev), "clicked", |
144 | G_CALLBACK (prev_clicked), self); |
145 | @@ -236,7 +240,8 @@ |
146 | |
147 | /* Next button */ |
148 | priv->next = gtk_button_new (); |
149 | - image = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU); |
150 | + image = gtk_image_new_from_icon_name (rtl ? "go-next-rtl-symbolic" : "go-next-symbolic", |
151 | + GTK_ICON_SIZE_MENU); |
152 | gtk_container_add (GTK_CONTAINER (priv->next), image); |
153 | g_signal_connect (G_OBJECT (priv->next), "clicked", |
154 | G_CALLBACK (next_clicked), self); |
155 | |
156 | === modified file 'panels/wacom/cc-wacom-page.c' |
157 | --- panels/wacom/cc-wacom-page.c 2014-02-18 03:09:04 +0000 |
158 | +++ panels/wacom/cc-wacom-page.c 2014-02-19 03:07:54 +0000 |
159 | @@ -117,7 +117,8 @@ |
160 | } action_table[] = { |
161 | { GSD_WACOM_ACTION_TYPE_NONE, NC_("Wacom action-type", "None") }, |
162 | { GSD_WACOM_ACTION_TYPE_CUSTOM, NC_("Wacom action-type", "Send Keystroke") }, |
163 | - { GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR, NC_("Wacom action-type", "Switch Monitor") } |
164 | + { GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR, NC_("Wacom action-type", "Switch Monitor") }, |
165 | + { GSD_WACOM_ACTION_TYPE_HELP, NC_("Wacom action-type", "Show On-Screen Help") } |
166 | }; |
167 | |
168 | #define WACOM_C(x) g_dpgettext2(NULL, "Wacom action-type", x) |
169 | @@ -185,11 +186,11 @@ |
170 | cal[2] = axis.x_max; |
171 | cal[3] = axis.y_max; |
172 | |
173 | - set_calibration(cal, 4, page->priv->wacom_settings); |
174 | + set_calibration(cal, 4, priv->wacom_settings); |
175 | } |
176 | |
177 | calib_area_free (area); |
178 | - page->priv->area = NULL; |
179 | + priv->area = NULL; |
180 | gtk_widget_set_sensitive (WID ("button-calibrate"), TRUE); |
181 | } |
182 | |
183 | @@ -218,14 +219,14 @@ |
184 | else |
185 | device_id = -1; |
186 | |
187 | - page->priv->area = calib_area_new (NULL, |
188 | - monitor, |
189 | - device_id, |
190 | - finish_calibration, |
191 | - page, |
192 | - &old_axis, |
193 | - THRESHOLD_MISCLICK, |
194 | - THRESHOLD_DOUBLECLICK); |
195 | + priv->area = calib_area_new (NULL, |
196 | + monitor, |
197 | + device_id, |
198 | + finish_calibration, |
199 | + page, |
200 | + &old_axis, |
201 | + THRESHOLD_MISCLICK, |
202 | + THRESHOLD_DOUBLECLICK); |
203 | |
204 | return FALSE; |
205 | } |
206 | @@ -276,6 +277,17 @@ |
207 | gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); |
208 | } |
209 | |
210 | +/* This avoids us crashing when a newer version of |
211 | + * gnome-control-center has been used, and we load up an |
212 | + * old one, as the action type if unknown to the old g-c-c */ |
213 | +static gboolean |
214 | +action_type_is_valid (GsdWacomActionType type) |
215 | +{ |
216 | + if (type >= G_N_ELEMENTS(action_table)) |
217 | + return FALSE; |
218 | + return TRUE; |
219 | +} |
220 | + |
221 | static char * |
222 | get_elevator_shortcut_string (GSettings *settings, |
223 | GtkDirectionType dir) |
224 | @@ -356,7 +368,8 @@ |
225 | return; |
226 | } |
227 | |
228 | - if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) |
229 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || |
230 | + button->type == WACOM_TABLET_BUTTON_TYPE_RING) |
231 | str = get_elevator_shortcut_string (button->settings, dir); |
232 | else |
233 | str = g_settings_get_string (button->settings, CUSTOM_ACTION_KEY); |
234 | @@ -499,7 +512,8 @@ |
235 | |
236 | str = gtk_accelerator_name (keyval, mask); |
237 | |
238 | - if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) { |
239 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || |
240 | + button->type == WACOM_TABLET_BUTTON_TYPE_RING) { |
241 | char *strs[3]; |
242 | char **strv; |
243 | |
244 | @@ -556,7 +570,8 @@ |
245 | return; |
246 | |
247 | /* Unset the key */ |
248 | - if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) { |
249 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || |
250 | + button->type == WACOM_TABLET_BUTTON_TYPE_RING) { |
251 | char *strs[3]; |
252 | char **strv; |
253 | |
254 | @@ -596,15 +611,20 @@ |
255 | char *dir_name; |
256 | |
257 | if (dir == GTK_DIR_UP || dir == GTK_DIR_DOWN) { |
258 | - dir_name = g_strdup_printf ("%s (%s)", |
259 | - button->name, |
260 | - dir == GTK_DIR_UP ? _("Up") : _("Down")); |
261 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_RING) { |
262 | + dir_name = g_strdup_printf ("%s (%s)", |
263 | + button->name, |
264 | + dir == GTK_DIR_UP ? "↺" : "↻"); |
265 | + } else { |
266 | + dir_name = g_strdup_printf ("%s (%s)", |
267 | + button->name, |
268 | + dir == GTK_DIR_UP ? C_("Wacom tablet button", "Up") : C_("Wacom tablet button", "Down")); |
269 | + } |
270 | } else { |
271 | dir_name = NULL; |
272 | } |
273 | |
274 | - /* Sanity check */ |
275 | - if (type >= G_N_ELEMENTS(action_table)) |
276 | + if (action_type_is_valid (type) == FALSE) |
277 | type = GSD_WACOM_ACTION_TYPE_NONE; |
278 | |
279 | gtk_list_store_append (model, &new_row); |
280 | @@ -644,7 +664,8 @@ |
281 | return; |
282 | } |
283 | |
284 | - if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) { |
285 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || |
286 | + button->type == WACOM_TABLET_BUTTON_TYPE_RING) { |
287 | g_object_set (cell, |
288 | "visible", TRUE, |
289 | "editable", FALSE, |
290 | @@ -660,8 +681,7 @@ |
291 | } |
292 | |
293 | type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY); |
294 | - /* Sanity check */ |
295 | - if (type >= G_N_ELEMENTS(action_table)) |
296 | + if (action_type_is_valid (type) == FALSE) |
297 | type = GSD_WACOM_ACTION_TYPE_NONE; |
298 | |
299 | g_object_set (cell, |
300 | @@ -746,6 +766,11 @@ |
301 | gsd_wacom_device_is_screen_tablet (priv->stylus)) |
302 | continue; |
303 | |
304 | + /* Do not list on-screen help if libwacom do no provide a layout */ |
305 | + if (action_table[i].action_type == GSD_WACOM_ACTION_TYPE_HELP && |
306 | + gsd_wacom_device_get_layout_path (priv->stylus) == NULL) |
307 | + continue; |
308 | + |
309 | gtk_list_store_append (priv->action_store, &iter); |
310 | gtk_list_store_set (priv->action_store, &iter, |
311 | ACTION_NAME_COLUMN, WACOM_C(action_table[i].action_name), |
312 | @@ -793,7 +818,7 @@ |
313 | gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (model)); |
314 | |
315 | /* Fill it up! */ |
316 | - list = gsd_wacom_device_get_buttons (page->priv->pad); |
317 | + list = gsd_wacom_device_get_buttons (priv->pad); |
318 | for (l = list; l != NULL; l = l->next) { |
319 | GsdWacomTabletButton *button = l->data; |
320 | GsdWacomActionType type = GSD_WACOM_ACTION_TYPE_NONE; |
321 | @@ -801,7 +826,8 @@ |
322 | if (button->settings) |
323 | type = g_settings_get_enum (button->settings, ACTION_TYPE_KEY); |
324 | |
325 | - if (button->type == WACOM_TABLET_BUTTON_TYPE_ELEVATOR) { |
326 | + if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || |
327 | + button->type == WACOM_TABLET_BUTTON_TYPE_RING) { |
328 | add_button_to_store (model, button, GTK_DIR_UP, GSD_WACOM_ACTION_TYPE_CUSTOM); |
329 | add_button_to_store (model, button, GTK_DIR_DOWN, GSD_WACOM_ACTION_TYPE_CUSTOM); |
330 | } else { |
331 | @@ -821,8 +847,8 @@ |
332 | |
333 | priv = page->priv; |
334 | gtk_widget_destroy (MWID ("button-mapping-dialog")); |
335 | - g_object_unref (page->priv->mapping_builder); |
336 | - page->priv->mapping_builder = NULL; |
337 | + g_object_unref (priv->mapping_builder); |
338 | + priv->mapping_builder = NULL; |
339 | } |
340 | |
341 | static void |
342 | @@ -838,9 +864,9 @@ |
343 | |
344 | g_assert (priv->mapping_builder == NULL); |
345 | priv->mapping_builder = gtk_builder_new (); |
346 | - gtk_builder_add_from_file (priv->mapping_builder, |
347 | - GNOMECC_UI_DIR "/button-mapping.ui", |
348 | - &error); |
349 | + gtk_builder_add_from_resource (priv->mapping_builder, |
350 | + "/org/gnome/control-center/wacom/button-mapping.ui", |
351 | + &error); |
352 | |
353 | if (error != NULL) { |
354 | g_warning ("Error loading UI file: %s", error->message); |
355 | @@ -1098,10 +1124,10 @@ |
356 | |
357 | priv->builder = gtk_builder_new (); |
358 | |
359 | - gtk_builder_add_objects_from_file (priv->builder, |
360 | - GNOMECC_UI_DIR "/gnome-wacom-properties.ui", |
361 | - objects, |
362 | - &error); |
363 | + gtk_builder_add_objects_from_resource (priv->builder, |
364 | + "/org/gnome/control-center/wacom/gnome-wacom-properties.ui", |
365 | + objects, |
366 | + &error); |
367 | if (error != NULL) { |
368 | g_warning ("Error loading UI file: %s", error->message); |
369 | g_object_unref (priv->builder); |
370 | @@ -1147,16 +1173,13 @@ |
371 | const char *icon_name) |
372 | { |
373 | CcWacomPagePrivate *priv; |
374 | - char *filename, *path; |
375 | + char *resource; |
376 | |
377 | priv = page->priv; |
378 | |
379 | - filename = g_strdup_printf ("%s.svg", icon_name); |
380 | - path = g_build_filename (GNOMECC_UI_DIR, filename, NULL); |
381 | - g_free (filename); |
382 | - |
383 | - gtk_image_set_from_file (GTK_IMAGE (WID (widget_name)), path); |
384 | - g_free (path); |
385 | + resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name); |
386 | + gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource); |
387 | + g_free (resource); |
388 | } |
389 | |
390 | typedef struct { |
391 | @@ -1262,21 +1285,21 @@ |
392 | |
393 | switch (layout) { |
394 | case LAYOUT_NORMAL: |
395 | - remove_left_handed (page->priv); |
396 | - remove_display_link (page->priv); |
397 | + remove_left_handed (priv); |
398 | + remove_display_link (priv); |
399 | break; |
400 | case LAYOUT_REVERSIBLE: |
401 | - remove_display_link (page->priv); |
402 | + remove_display_link (priv); |
403 | break; |
404 | case LAYOUT_SCREEN: |
405 | - remove_left_handed (page->priv); |
406 | + remove_left_handed (priv); |
407 | |
408 | gtk_widget_destroy (WID ("combo-tabletmode")); |
409 | gtk_widget_destroy (WID ("label-trackingmode")); |
410 | gtk_widget_destroy (WID ("display-mapping-button")); |
411 | |
412 | gtk_widget_show (WID ("button-calibrate")); |
413 | - if (gsd_wacom_device_get_display_monitor (page->priv->stylus) >= 0) |
414 | + if (gsd_wacom_device_get_display_monitor (priv->stylus) >= 0) |
415 | has_monitor = TRUE; |
416 | gtk_widget_set_sensitive (WID ("button-calibrate"), has_monitor); |
417 | gtk_widget_show (WID ("display-link")); |
418 | |
419 | === modified file 'panels/wacom/cc-wacom-panel.c' |
420 | --- panels/wacom/cc-wacom-panel.c 2013-11-28 04:32:11 +0000 |
421 | +++ panels/wacom/cc-wacom-panel.c 2014-02-19 03:07:54 +0000 |
422 | @@ -27,6 +27,7 @@ |
423 | |
424 | #include "cc-wacom-panel.h" |
425 | #include "cc-wacom-page.h" |
426 | +#include "cc-wacom-resources.h" |
427 | #include "gsd-wacom-device.h" |
428 | |
429 | #define WID(x) (GtkWidget *) gtk_builder_get_object (priv->builder, x) |
430 | @@ -337,13 +338,14 @@ |
431 | }; |
432 | |
433 | priv = self->priv = WACOM_PANEL_PRIVATE (self); |
434 | + g_resources_register (cc_wacom_get_resource ()); |
435 | |
436 | priv->builder = gtk_builder_new (); |
437 | |
438 | - gtk_builder_add_objects_from_file (priv->builder, |
439 | - GNOMECC_UI_DIR "/gnome-wacom-properties.ui", |
440 | - objects, |
441 | - &error); |
442 | + gtk_builder_add_objects_from_resource (priv->builder, |
443 | + "/org/gnome/control-center/wacom/gnome-wacom-properties.ui", |
444 | + objects, |
445 | + &error); |
446 | if (error != NULL) |
447 | { |
448 | g_warning ("Error loading UI file: %s", error->message); |
449 | @@ -360,10 +362,10 @@ |
450 | gtk_widget_set_vexpand (GTK_WIDGET (notebook), TRUE); |
451 | gtk_container_set_border_width (GTK_CONTAINER (notebook), 0); |
452 | g_object_set (G_OBJECT (notebook), |
453 | - "margin-top", 0, |
454 | - "margin-right", 24, |
455 | - "margin-left", 24, |
456 | - "margin-bottom", 24, |
457 | + "margin-top", 6, |
458 | + "margin-right", 30, |
459 | + "margin-left", 30, |
460 | + "margin-bottom", 30, |
461 | NULL); |
462 | |
463 | gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (notebook)); |
464 | |
465 | === modified file 'panels/wacom/cc-wacom-stylus-page.c' |
466 | --- panels/wacom/cc-wacom-stylus-page.c 2012-02-27 16:51:36 +0000 |
467 | +++ panels/wacom/cc-wacom-stylus-page.c 2014-02-19 03:07:54 +0000 |
468 | @@ -297,10 +297,10 @@ |
469 | |
470 | priv->builder = gtk_builder_new (); |
471 | |
472 | - gtk_builder_add_objects_from_file (priv->builder, |
473 | - GNOMECC_UI_DIR "/wacom-stylus-page.ui", |
474 | - objects, |
475 | - &error); |
476 | + gtk_builder_add_objects_from_resource (priv->builder, |
477 | + "/org/gnome/control-center/wacom/wacom-stylus-page.ui", |
478 | + objects, |
479 | + &error); |
480 | if (error != NULL) { |
481 | g_warning ("Error loading UI file: %s", error->message); |
482 | g_object_unref (priv->builder); |
483 | @@ -339,16 +339,13 @@ |
484 | const char *icon_name) |
485 | { |
486 | CcWacomStylusPagePrivate *priv; |
487 | - char *filename, *path; |
488 | + char *resource; |
489 | |
490 | priv = page->priv; |
491 | |
492 | - filename = g_strdup_printf ("%s.svg", icon_name); |
493 | - path = g_build_filename (GNOMECC_UI_DIR, filename, NULL); |
494 | - g_free (filename); |
495 | - |
496 | - gtk_image_set_from_file (GTK_IMAGE (WID (widget_name)), path); |
497 | - g_free (path); |
498 | + resource = g_strdup_printf ("/org/gnome/control-center/wacom/%s.svg", icon_name); |
499 | + gtk_image_set_from_resource (GTK_IMAGE (WID (widget_name)), resource); |
500 | + g_free (resource); |
501 | } |
502 | |
503 | /* Different types of layout for the stylus config */ |
504 | |
505 | === modified file 'panels/wacom/gnome-wacom-properties.ui' |
506 | --- panels/wacom/gnome-wacom-properties.ui 2012-05-18 16:39:31 +0000 |
507 | +++ panels/wacom/gnome-wacom-properties.ui 2014-02-19 03:07:54 +0000 |
508 | @@ -207,7 +207,7 @@ |
509 | <property name="spacing">10</property> |
510 | <child> |
511 | <object class="GtkButton" id="display-mapping-button"> |
512 | - <property name="label" translatable="yes">Map to Monitor...</property> |
513 | + <property name="label" translatable="yes">Map to Monitor…</property> |
514 | <property name="visible">True</property> |
515 | <property name="can_focus">True</property> |
516 | <property name="receives_default">True</property> |
517 | @@ -223,7 +223,7 @@ |
518 | </child> |
519 | <child> |
520 | <object class="GtkButton" id="map-buttons-button"> |
521 | - <property name="label" translatable="yes">Map Buttons...</property> |
522 | + <property name="label" translatable="yes">Map Buttons…</property> |
523 | <property name="visible">True</property> |
524 | <property name="can_focus">True</property> |
525 | <property name="receives_default">True</property> |
526 | @@ -239,7 +239,7 @@ |
527 | </child> |
528 | <child> |
529 | <object class="GtkButton" id="button-calibrate"> |
530 | - <property name="label" translatable="yes">Calibrate...</property> |
531 | + <property name="label" translatable="yes">Calibrate…</property> |
532 | <property name="can_focus">True</property> |
533 | <property name="receives_default">True</property> |
534 | <property name="valign">center</property> |
535 | |
536 | === modified file 'panels/wacom/gsd-input-helper.c' |
537 | --- panels/wacom/gsd-input-helper.c 2012-08-21 15:59:36 +0000 |
538 | +++ panels/wacom/gsd-input-helper.c 2014-02-19 03:07:54 +0000 |
539 | @@ -20,6 +20,8 @@ |
540 | |
541 | #include "config.h" |
542 | |
543 | +#include <string.h> |
544 | + |
545 | #include <gdk/gdk.h> |
546 | #include <gdk/gdkx.h> |
547 | |
548 | @@ -189,11 +191,36 @@ |
549 | } |
550 | |
551 | gboolean |
552 | +device_info_is_tablet (XDeviceInfo *device_info) |
553 | +{ |
554 | + /* Note that this doesn't match Wacom tablets */ |
555 | + return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TABLET, False)); |
556 | +} |
557 | + |
558 | +gboolean |
559 | device_info_is_mouse (XDeviceInfo *device_info) |
560 | { |
561 | return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False)); |
562 | } |
563 | |
564 | +gboolean |
565 | +device_info_is_trackball (XDeviceInfo *device_info) |
566 | +{ |
567 | + gboolean retval; |
568 | + |
569 | + retval = (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TRACKBALL, False)); |
570 | + if (retval == FALSE && |
571 | + device_info->name != NULL) { |
572 | + char *lowercase; |
573 | + |
574 | + lowercase = g_ascii_strdown (device_info->name, -1); |
575 | + retval = strstr (lowercase, "trackball") != NULL; |
576 | + g_free (lowercase); |
577 | + } |
578 | + |
579 | + return retval; |
580 | +} |
581 | + |
582 | static gboolean |
583 | device_type_is_present (InfoIdentifyFunc info_func, |
584 | DeviceIdentifyFunc device_func) |
585 | @@ -263,6 +290,13 @@ |
586 | NULL); |
587 | } |
588 | |
589 | +gboolean |
590 | +trackball_is_present (void) |
591 | +{ |
592 | + return device_type_is_present (device_info_is_trackball, |
593 | + NULL); |
594 | +} |
595 | + |
596 | char * |
597 | xdevice_get_device_node (int deviceid) |
598 | { |
599 | @@ -480,7 +514,7 @@ |
600 | argv[2] = (char *) custom_command_to_string (command); |
601 | argv[3] = "-i"; |
602 | argv[4] = g_strdup_printf ("%d", id); |
603 | - argv[5] = g_strdup_printf ("%s", gdk_device_get_name (device)); |
604 | + argv[5] = (char*) gdk_device_get_name (device); |
605 | argv[6] = NULL; |
606 | |
607 | rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH, |
608 | @@ -491,9 +525,8 @@ |
609 | |
610 | g_free (argv[0]); |
611 | g_free (argv[4]); |
612 | - g_free (argv[5]); |
613 | |
614 | - return (exit_status == 0); |
615 | + return (exit_status == 1); |
616 | } |
617 | |
618 | GList * |
619 | |
620 | === modified file 'panels/wacom/gsd-input-helper.h' |
621 | --- panels/wacom/gsd-input-helper.h 2012-08-21 15:59:36 +0000 |
622 | +++ panels/wacom/gsd-input-helper.h 2014-02-19 03:07:54 +0000 |
623 | @@ -61,11 +61,14 @@ |
624 | |
625 | gboolean device_info_is_touchpad (XDeviceInfo *device_info); |
626 | gboolean device_info_is_touchscreen (XDeviceInfo *device_info); |
627 | +gboolean device_info_is_tablet (XDeviceInfo *device_info); |
628 | gboolean device_info_is_mouse (XDeviceInfo *device_info); |
629 | +gboolean device_info_is_trackball (XDeviceInfo *device_info); |
630 | |
631 | gboolean touchpad_is_present (void); |
632 | gboolean touchscreen_is_present (void); |
633 | gboolean mouse_is_present (void); |
634 | +gboolean trackball_is_present (void); |
635 | |
636 | gboolean device_set_property (XDevice *xdevice, |
637 | const char *device_name, |
638 | |
639 | === modified file 'panels/wacom/gsd-wacom-device.c' |
640 | --- panels/wacom/gsd-wacom-device.c 2014-02-18 04:27:04 +0000 |
641 | +++ panels/wacom/gsd-wacom-device.c 2014-02-19 03:07:54 +0000 |
642 | @@ -255,8 +255,10 @@ |
643 | const char *id, |
644 | const char *settings_path, |
645 | GsdWacomTabletButtonType type, |
646 | + GsdWacomTabletButtonPos pos, |
647 | int group_id, |
648 | - int idx) |
649 | + int idx, |
650 | + int status_led) |
651 | { |
652 | GsdWacomTabletButton *ret; |
653 | |
654 | @@ -273,6 +275,8 @@ |
655 | ret->group_id = group_id; |
656 | ret->idx = idx; |
657 | ret->type = type; |
658 | + ret->pos = pos; |
659 | + ret->status_led = status_led; |
660 | |
661 | return ret; |
662 | } |
663 | @@ -328,9 +332,11 @@ |
664 | char *path; |
665 | char *machine_id; |
666 | const char *icon_name; |
667 | + char *layout_path; |
668 | char *tool_name; |
669 | gboolean reversible; |
670 | gboolean is_screen_tablet; |
671 | + gboolean is_isd; /* integrated system device */ |
672 | gboolean is_fallback; |
673 | GList *styli; |
674 | GsdWacomStylus *last_stylus; |
675 | @@ -775,12 +781,10 @@ |
676 | if (rr_output == NULL) { |
677 | if (gsd_wacom_device_is_screen_tablet (device)) { |
678 | rr_output = find_output_by_heuristic (rr_screen, device); |
679 | - if (rr_output == NULL) { |
680 | + if (rr_output == NULL) |
681 | g_warning ("No fuzzy match based on heuristics was found."); |
682 | - } else { |
683 | + else |
684 | g_warning ("Automatically mapping tablet to heuristically-found display."); |
685 | - set_display_by_output (device, rr_output); |
686 | - } |
687 | } |
688 | } |
689 | |
690 | @@ -956,21 +960,78 @@ |
691 | } |
692 | |
693 | int |
694 | -gsd_wacom_device_set_next_mode (GsdWacomDevice *device, |
695 | +gsd_wacom_device_get_num_modes (GsdWacomDevice *device, |
696 | int group_id) |
697 | { |
698 | + int num_modes; |
699 | + |
700 | + g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1); |
701 | + num_modes = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->num_modes, GINT_TO_POINTER(group_id))); |
702 | + |
703 | + return num_modes; |
704 | +} |
705 | + |
706 | +int |
707 | +gsd_wacom_device_get_current_mode (GsdWacomDevice *device, |
708 | + int group_id) |
709 | +{ |
710 | int current_idx; |
711 | - int num_modes; |
712 | |
713 | g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1); |
714 | current_idx = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER(group_id))); |
715 | /* That means that the mode doesn't exist, see gsd_wacom_device_add_modes() */ |
716 | g_return_val_if_fail (current_idx != 0, -1); |
717 | |
718 | - current_idx++; |
719 | - |
720 | + return current_idx; |
721 | +} |
722 | + |
723 | +int |
724 | +gsd_wacom_device_set_next_mode (GsdWacomDevice *device, |
725 | + GsdWacomTabletButton *button) |
726 | +{ |
727 | + GList *l; |
728 | + int current_idx; |
729 | + int num_modes; |
730 | + int num_switches; |
731 | + int group_id; |
732 | + |
733 | + g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1); |
734 | + |
735 | + group_id = button->group_id; |
736 | + current_idx = 0; |
737 | + num_switches = 0; |
738 | num_modes = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->num_modes, GINT_TO_POINTER(group_id))); |
739 | |
740 | + /* |
741 | + * Check if we have multiple mode-switch buttons for that |
742 | + * group, and if so, compute the current index based on |
743 | + * the position in the list... |
744 | + */ |
745 | + for (l = device->priv->buttons; l != NULL; l = l->next) { |
746 | + GsdWacomTabletButton *b = l->data; |
747 | + if (b->type != WACOM_TABLET_BUTTON_TYPE_HARDCODED) |
748 | + continue; |
749 | + if (button->group_id == b->group_id) |
750 | + num_switches++; |
751 | + if (g_strcmp0 (button->id, b->id) == 0) |
752 | + current_idx = num_switches; |
753 | + } |
754 | + |
755 | + /* We should at least have found the current mode-switch button... |
756 | + * If not, then it means that the given button is not a valid |
757 | + * mode-switch. |
758 | + */ |
759 | + g_return_val_if_fail (num_switches != 0, -1); |
760 | + |
761 | + /* Only one mode-switch? cycle through the modes */ |
762 | + if (num_switches == 1) { |
763 | + current_idx = gsd_wacom_device_get_current_mode (device, group_id); |
764 | + /* gsd_wacom_device_get_current_mode() returns -1 when the mode doesn't exist */ |
765 | + g_return_val_if_fail (current_idx > 0, -1); |
766 | + |
767 | + current_idx++; |
768 | + } |
769 | + |
770 | if (current_idx > num_modes) |
771 | current_idx = 1; |
772 | |
773 | @@ -1001,30 +1062,69 @@ |
774 | { |
775 | GList *l; |
776 | guint num_modes; |
777 | + guint group; |
778 | guint i; |
779 | char *name, *id; |
780 | |
781 | l = NULL; |
782 | |
783 | if ((direction & WACOM_BUTTON_POSITION_LEFT) && libwacom_has_ring (wacom_device)) { |
784 | - /* There is a ring so there must be at least one mode */ |
785 | - num_modes = MAX (1, libwacom_get_ring_num_modes (wacom_device)); |
786 | - for (i = 1; i <= num_modes; i++) { |
787 | - name = g_strdup_printf (_("Left Ring Mode #%d"), i); |
788 | - id = g_strdup_printf ("left-ring-mode-%d", i); |
789 | - 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)); |
790 | - g_free (name); |
791 | - g_free (id); |
792 | + num_modes = libwacom_get_ring_num_modes (wacom_device); |
793 | + group = flags_to_group (WACOM_BUTTON_RING_MODESWITCH); |
794 | + if (num_modes == 0) { |
795 | + /* If no mode is available, we use "left-ring-mode-1" for backward compat */ |
796 | + l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Ring"), |
797 | + "left-ring-mode-1", |
798 | + settings_path, |
799 | + WACOM_TABLET_BUTTON_TYPE_RING, |
800 | + WACOM_TABLET_BUTTON_POS_LEFT, |
801 | + group, |
802 | + 0, |
803 | + GSD_WACOM_NO_LED)); |
804 | + } else { |
805 | + for (i = 1; i <= num_modes; i++) { |
806 | + name = g_strdup_printf (_("Left Ring Mode #%d"), i); |
807 | + id = g_strdup_printf ("left-ring-mode-%d", i); |
808 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
809 | + id, |
810 | + settings_path, |
811 | + WACOM_TABLET_BUTTON_TYPE_RING, |
812 | + WACOM_TABLET_BUTTON_POS_LEFT, |
813 | + group, |
814 | + i - 1, |
815 | + GSD_WACOM_NO_LED)); |
816 | + g_free (name); |
817 | + g_free (id); |
818 | + } |
819 | } |
820 | } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && libwacom_has_ring2 (wacom_device)) { |
821 | - /* There is a ring so there must be at least one mode */ |
822 | - num_modes = MAX (1, libwacom_get_ring2_num_modes (wacom_device)); |
823 | - for (i = 1; i <= num_modes; i++) { |
824 | - name = g_strdup_printf (_("Right Ring Mode #%d"), i); |
825 | - id = g_strdup_printf ("right-ring-mode-%d", i); |
826 | - 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)); |
827 | - g_free (name); |
828 | - g_free (id); |
829 | + num_modes = libwacom_get_ring2_num_modes (wacom_device); |
830 | + group = flags_to_group (WACOM_BUTTON_RING2_MODESWITCH); |
831 | + if (num_modes == 0) { |
832 | + /* If no mode is available, we use "right-ring-mode-1" for backward compat */ |
833 | + l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Ring"), |
834 | + "right-ring-mode-1", |
835 | + settings_path, |
836 | + WACOM_TABLET_BUTTON_TYPE_RING, |
837 | + WACOM_TABLET_BUTTON_POS_RIGHT, |
838 | + group, |
839 | + 0, |
840 | + GSD_WACOM_NO_LED)); |
841 | + } else { |
842 | + for (i = 1; i <= num_modes; i++) { |
843 | + name = g_strdup_printf (_("Right Ring Mode #%d"), i); |
844 | + id = g_strdup_printf ("right-ring-mode-%d", i); |
845 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
846 | + id, |
847 | + settings_path, |
848 | + WACOM_TABLET_BUTTON_TYPE_RING, |
849 | + WACOM_TABLET_BUTTON_POS_RIGHT, |
850 | + group, |
851 | + i - 1, |
852 | + GSD_WACOM_NO_LED)); |
853 | + g_free (name); |
854 | + g_free (id); |
855 | + } |
856 | } |
857 | } |
858 | |
859 | @@ -1039,6 +1139,7 @@ |
860 | GList *l; |
861 | guint num_modes; |
862 | guint num_strips; |
863 | + guint group; |
864 | guint i; |
865 | char *name, *id; |
866 | |
867 | @@ -1048,24 +1149,62 @@ |
868 | g_warning ("Unhandled number of touchstrips: %d", num_strips); |
869 | |
870 | if ((direction & WACOM_BUTTON_POSITION_LEFT) && num_strips >= 1) { |
871 | - /* There is a strip so there must be at least one mode */ |
872 | - num_modes = MAX (1, libwacom_get_strips_num_modes (wacom_device)); |
873 | - for (i = 1; i <= num_modes; i++) { |
874 | - name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i); |
875 | - id = g_strdup_printf ("left-strip-mode-%d", i); |
876 | - 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)); |
877 | - g_free (name); |
878 | - g_free (id); |
879 | + num_modes = libwacom_get_strips_num_modes (wacom_device); |
880 | + group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH); |
881 | + if (num_modes == 0) { |
882 | + /* If no mode is available, we use "left-strip-mode-1" for backward compat */ |
883 | + l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Touchstrip"), |
884 | + "left-strip-mode-1", |
885 | + settings_path, |
886 | + WACOM_TABLET_BUTTON_TYPE_STRIP, |
887 | + WACOM_TABLET_BUTTON_POS_LEFT, |
888 | + group, |
889 | + 0, |
890 | + GSD_WACOM_NO_LED)); |
891 | + } else { |
892 | + for (i = 1; i <= num_modes; i++) { |
893 | + name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i); |
894 | + id = g_strdup_printf ("left-strip-mode-%d", i); |
895 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
896 | + id, |
897 | + settings_path, |
898 | + WACOM_TABLET_BUTTON_TYPE_STRIP, |
899 | + WACOM_TABLET_BUTTON_POS_LEFT, |
900 | + group, |
901 | + i - 1, |
902 | + GSD_WACOM_NO_LED)); |
903 | + g_free (name); |
904 | + g_free (id); |
905 | + } |
906 | } |
907 | } else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && num_strips >= 2) { |
908 | - /* There is a strip so there must be at least one mode */ |
909 | - num_modes = MAX (1, libwacom_get_strips_num_modes (wacom_device)); |
910 | - for (i = 1; i <= num_modes; i++) { |
911 | - name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i); |
912 | - id = g_strdup_printf ("right-strip-mode-%d", i); |
913 | - 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)); |
914 | - g_free (name); |
915 | - g_free (id); |
916 | + num_modes = libwacom_get_strips_num_modes (wacom_device); |
917 | + group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH); |
918 | + if (num_modes == 0) { |
919 | + /* If no mode is available, we use "right-strip-mode-1" for backward compat */ |
920 | + l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Touchstrip"), |
921 | + "right-strip-mode-1", |
922 | + settings_path, |
923 | + WACOM_TABLET_BUTTON_TYPE_STRIP, |
924 | + WACOM_TABLET_BUTTON_POS_RIGHT, |
925 | + group, |
926 | + 0, |
927 | + GSD_WACOM_NO_LED)); |
928 | + } else { |
929 | + for (i = 1; i <= num_modes; i++) { |
930 | + name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i); |
931 | + id = g_strdup_printf ("right-strip-mode-%d", i); |
932 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
933 | + id, |
934 | + settings_path, |
935 | + WACOM_TABLET_BUTTON_TYPE_STRIP, |
936 | + WACOM_TABLET_BUTTON_POS_RIGHT, |
937 | + group, |
938 | + i - 1, |
939 | + GSD_WACOM_NO_LED)); |
940 | + g_free (name); |
941 | + g_free (id); |
942 | + } |
943 | } |
944 | } |
945 | |
946 | @@ -1093,6 +1232,23 @@ |
947 | return g_strdup_printf (_("Mode Switch #%d"), button_num); |
948 | } |
949 | |
950 | +static GsdWacomTabletButtonType |
951 | +gsd_wacom_device_button_pos (WacomButtonFlags flags) |
952 | +{ |
953 | + if (flags & WACOM_BUTTON_POSITION_LEFT) |
954 | + return WACOM_TABLET_BUTTON_POS_LEFT; |
955 | + else if (flags & WACOM_BUTTON_POSITION_RIGHT) |
956 | + return WACOM_TABLET_BUTTON_POS_RIGHT; |
957 | + else if (flags & WACOM_BUTTON_POSITION_TOP) |
958 | + return WACOM_TABLET_BUTTON_POS_TOP; |
959 | + else if (flags & WACOM_BUTTON_POSITION_BOTTOM) |
960 | + return WACOM_TABLET_BUTTON_POS_BOTTOM; |
961 | + |
962 | + g_warning ("Unhandled button position"); |
963 | + |
964 | + return WACOM_TABLET_BUTTON_POS_UNDEF; |
965 | +} |
966 | + |
967 | static GList * |
968 | gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device, |
969 | const char *settings_path, |
970 | @@ -1119,7 +1275,14 @@ |
971 | |
972 | name = g_strdup_printf (button_str, button_num++); |
973 | id = g_strdup_printf ("%s%c", button_str_id, i); |
974 | - l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_NORMAL, flags_to_group (flags), -1)); |
975 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
976 | + id, |
977 | + settings_path, |
978 | + WACOM_TABLET_BUTTON_TYPE_NORMAL, |
979 | + gsd_wacom_device_button_pos (flags), |
980 | + flags_to_group (flags), |
981 | + -1, |
982 | + GSD_WACOM_NO_LED)); |
983 | g_free (name); |
984 | g_free (id); |
985 | } |
986 | @@ -1128,6 +1291,7 @@ |
987 | for (i = 'A'; i < 'A' + num_buttons; i++) { |
988 | WacomButtonFlags flags; |
989 | char *name, *id; |
990 | + int status_led; |
991 | |
992 | flags = libwacom_get_button_flag (wacom_device, i); |
993 | if (!(flags & direction)) |
994 | @@ -1138,7 +1302,15 @@ |
995 | |
996 | name = gsd_wacom_device_modeswitch_name (flags, button_num++); |
997 | id = g_strdup_printf ("%s%c", button_str_id, i); |
998 | - l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_HARDCODED, flags_to_group (flags), -1)); |
999 | + status_led = libwacom_get_button_led_group (wacom_device, i); |
1000 | + l = g_list_append (l, gsd_wacom_tablet_button_new (name, |
1001 | + id, |
1002 | + settings_path, |
1003 | + WACOM_TABLET_BUTTON_TYPE_HARDCODED, |
1004 | + gsd_wacom_device_button_pos (flags), |
1005 | + flags_to_group (flags), |
1006 | + -1, |
1007 | + status_led)); |
1008 | g_free (name); |
1009 | g_free (id); |
1010 | } |
1011 | @@ -1239,11 +1411,13 @@ |
1012 | settings_path); |
1013 | |
1014 | device->priv->name = g_strdup (libwacom_get_name (wacom_device)); |
1015 | + device->priv->layout_path = g_strdup (libwacom_get_layout_filename (wacom_device)); |
1016 | device->priv->reversible = libwacom_is_reversible (wacom_device); |
1017 | integration_flags = libwacom_get_integration_flags (wacom_device); |
1018 | device->priv->is_screen_tablet = (integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY); |
1019 | + device->priv->is_isd = (integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM); |
1020 | if (device->priv->is_screen_tablet) { |
1021 | - if (libwacom_get_class (wacom_device) == WCLASS_CINTIQ) |
1022 | + if (!device->priv->is_isd) |
1023 | device->priv->icon_name = "wacom-tablet-cintiq"; |
1024 | else |
1025 | device->priv->icon_name = "wacom-tablet-pc"; |
1026 | @@ -1487,6 +1661,8 @@ |
1027 | p->num_modes = NULL; |
1028 | } |
1029 | |
1030 | + g_clear_pointer (&p->layout_path, g_free); |
1031 | + |
1032 | gdk_window_remove_filter (NULL, |
1033 | (GdkFilterFunc) filter_events, |
1034 | device); |
1035 | @@ -1536,6 +1712,14 @@ |
1036 | } |
1037 | |
1038 | const char * |
1039 | +gsd_wacom_device_get_layout_path (GsdWacomDevice *device) |
1040 | +{ |
1041 | + g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL); |
1042 | + |
1043 | + return device->priv->layout_path; |
1044 | +} |
1045 | + |
1046 | +const char * |
1047 | gsd_wacom_device_get_path (GsdWacomDevice *device) |
1048 | { |
1049 | g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL); |
1050 | @@ -1576,6 +1760,14 @@ |
1051 | } |
1052 | |
1053 | gboolean |
1054 | +gsd_wacom_device_is_isd (GsdWacomDevice *device) |
1055 | +{ |
1056 | + g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), FALSE); |
1057 | + |
1058 | + return device->priv->is_isd; |
1059 | +} |
1060 | + |
1061 | +gboolean |
1062 | gsd_wacom_device_is_fallback (GsdWacomDevice *device) |
1063 | { |
1064 | g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), FALSE); |
1065 | |
1066 | === modified file 'panels/wacom/gsd-wacom-device.h' |
1067 | --- panels/wacom/gsd-wacom-device.h 2012-10-19 13:41:43 +0000 |
1068 | +++ panels/wacom/gsd-wacom-device.h 2014-02-19 03:07:54 +0000 |
1069 | @@ -93,19 +93,36 @@ |
1070 | /* Tablet Buttons */ |
1071 | typedef enum { |
1072 | WACOM_TABLET_BUTTON_TYPE_NORMAL, |
1073 | - WACOM_TABLET_BUTTON_TYPE_ELEVATOR, |
1074 | + WACOM_TABLET_BUTTON_TYPE_STRIP, |
1075 | + WACOM_TABLET_BUTTON_TYPE_RING, |
1076 | WACOM_TABLET_BUTTON_TYPE_HARDCODED |
1077 | } GsdWacomTabletButtonType; |
1078 | |
1079 | +/* |
1080 | + * Positions of the buttons on the tablet in default right-handed mode |
1081 | + * (ie with no rotation applied). |
1082 | + */ |
1083 | +typedef enum { |
1084 | + WACOM_TABLET_BUTTON_POS_UNDEF = 0, |
1085 | + WACOM_TABLET_BUTTON_POS_LEFT, |
1086 | + WACOM_TABLET_BUTTON_POS_RIGHT, |
1087 | + WACOM_TABLET_BUTTON_POS_TOP, |
1088 | + WACOM_TABLET_BUTTON_POS_BOTTOM |
1089 | +} GsdWacomTabletButtonPos; |
1090 | + |
1091 | #define MAX_GROUP_ID 4 |
1092 | |
1093 | +#define GSD_WACOM_NO_LED -1 |
1094 | + |
1095 | typedef struct |
1096 | { |
1097 | char *name; |
1098 | char *id; |
1099 | GSettings *settings; |
1100 | GsdWacomTabletButtonType type; |
1101 | + GsdWacomTabletButtonPos pos; |
1102 | int group_id, idx; |
1103 | + int status_led; |
1104 | } GsdWacomTabletButton; |
1105 | |
1106 | void gsd_wacom_tablet_button_free (GsdWacomTabletButton *button); |
1107 | @@ -137,11 +154,13 @@ |
1108 | GsdWacomDevice * gsd_wacom_device_new (GdkDevice *device); |
1109 | GList * gsd_wacom_device_list_styli (GsdWacomDevice *device); |
1110 | const char * gsd_wacom_device_get_name (GsdWacomDevice *device); |
1111 | +const char * gsd_wacom_device_get_layout_path (GsdWacomDevice *device); |
1112 | const char * gsd_wacom_device_get_path (GsdWacomDevice *device); |
1113 | const char * gsd_wacom_device_get_icon_name (GsdWacomDevice *device); |
1114 | const char * gsd_wacom_device_get_tool_name (GsdWacomDevice *device); |
1115 | gboolean gsd_wacom_device_reversible (GsdWacomDevice *device); |
1116 | gboolean gsd_wacom_device_is_screen_tablet (GsdWacomDevice *device); |
1117 | +gboolean gsd_wacom_device_is_isd (GsdWacomDevice *device); |
1118 | gboolean gsd_wacom_device_is_fallback (GsdWacomDevice *device); |
1119 | gint gsd_wacom_device_get_num_strips (GsdWacomDevice *device); |
1120 | gint gsd_wacom_device_get_num_rings (GsdWacomDevice *device); |
1121 | @@ -158,8 +177,12 @@ |
1122 | GsdWacomTabletButton *gsd_wacom_device_get_button (GsdWacomDevice *device, |
1123 | int button, |
1124 | GtkDirectionType *dir); |
1125 | -int gsd_wacom_device_set_next_mode (GsdWacomDevice *device, |
1126 | - int group_id); |
1127 | +int gsd_wacom_device_get_num_modes (GsdWacomDevice *device, |
1128 | + int group_id); |
1129 | +int gsd_wacom_device_get_current_mode (GsdWacomDevice *device, |
1130 | + int group_id); |
1131 | +int gsd_wacom_device_set_next_mode (GsdWacomDevice *device, |
1132 | + GsdWacomTabletButton *button); |
1133 | GsdWacomRotation gsd_wacom_device_rotation_name_to_type (const char *rotation); |
1134 | const char * gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type); |
1135 | |
1136 | |
1137 | === modified file 'panels/wacom/unity-wacom-panel.desktop.in.in' |
1138 | --- panels/wacom/unity-wacom-panel.desktop.in.in 2013-12-02 04:30:50 +0000 |
1139 | +++ panels/wacom/unity-wacom-panel.desktop.in.in 2014-02-19 03:07:54 +0000 |
1140 | @@ -1,6 +1,6 @@ |
1141 | [Desktop Entry] |
1142 | _Name=Wacom Tablet |
1143 | -_Comment=Set your Wacom tablet preferences |
1144 | +_Comment=Set button mappings and adjust stylus sensitivity for graphics tablets |
1145 | Exec=unity-control-center wacom |
1146 | Icon=input-tablet |
1147 | Terminal=false |
1148 | |
1149 | === added file 'panels/wacom/wacom.gresource.xml' |
1150 | --- panels/wacom/wacom.gresource.xml 1970-01-01 00:00:00 +0000 |
1151 | +++ panels/wacom/wacom.gresource.xml 2014-02-19 03:07:54 +0000 |
1152 | @@ -0,0 +1,16 @@ |
1153 | +<?xml version="1.0" encoding="UTF-8"?> |
1154 | +<gresources> |
1155 | + <gresource prefix="/org/gnome/control-center/wacom"> |
1156 | + <file preprocess="xml-stripblanks">gnome-wacom-properties.ui</file> |
1157 | + <file preprocess="xml-stripblanks">wacom-stylus-page.ui</file> |
1158 | + <file preprocess="xml-stripblanks">button-mapping.ui</file> |
1159 | + <file>wacom-tablet.svg</file> |
1160 | + <file>wacom-stylus.svg</file> |
1161 | + <file>wacom-stylus-airbrush.svg</file> |
1162 | + <file>wacom-stylus-inking.svg</file> |
1163 | + <file>wacom-stylus-art-pen.svg</file> |
1164 | + <file>wacom-stylus-classic.svg</file> |
1165 | + <file>wacom-tablet-cintiq.svg</file> |
1166 | + <file>wacom-tablet-pc.svg</file> |
1167 | + </gresource> |
1168 | +</gresources> |
FAILED: Continuous integration, rev:12711 jenkins. qa.ubuntu. com/job/ unity-control- center- ci/22/ jenkins. qa.ubuntu. com/job/ unity-control- center- trusty- amd64-ci/ 22/console jenkins. qa.ubuntu. com/job/ unity-control- center- trusty- armhf-ci/ 22 jenkins. qa.ubuntu. com/job/ unity-control- center- trusty- i386-ci/ 23/console
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- control- center- ci/22/rebuild
http://