[gnome-settings-daemon] wacom: touchstrip and touchring without a modeswitch
- From: Olivier Fourdan <ofourdan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: touchstrip and touchring without a modeswitch
- Date: Fri, 19 Oct 2012 13:51:24 +0000 (UTC)
commit 62563d4066d31245b89da1f59d511cede9d97f02
Author: Olivier Fourdan <ofourdan redhat com>
Date: Tue Oct 16 18:24:38 2012 +0200
wacom: touchstrip and touchring without a modeswitch
is something that can be found on older tablets
(e.g. Cintiq 12WX).
gnome-settings-daemon/gnome-control-center would add the
touchring/touchstrip once the corresponding modeswitch is
added, so without a modeswitch no touchring/touchstrip is
added even if the device features one.
This patch fixes the issue by adding the touchring/touchstrip
based on presence of such controls regardless of the presence
of a corresponding modeswitch.
https://bugzilla.gnome.org/show_bug.cgi?id=686022
plugins/wacom/gsd-wacom-device.c | 127 ++++++++++++++++++++++++++++---------
1 files changed, 96 insertions(+), 31 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 2f52d2a..1a78530 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -1001,6 +1001,7 @@ gsd_wacom_device_add_ring_modes (WacomDevice *wacom_device,
{
GList *l;
guint num_modes;
+ guint group;
guint i;
char *name, *id;
@@ -1008,21 +1009,53 @@ gsd_wacom_device_add_ring_modes (WacomDevice *wacom_device,
if ((direction & WACOM_BUTTON_POSITION_LEFT) && libwacom_has_ring (wacom_device)) {
num_modes = libwacom_get_ring_num_modes (wacom_device);
- for (i = 1; i <= num_modes; i++) {
- name = g_strdup_printf (_("Left Ring Mode #%d"), i);
- id = g_strdup_printf ("left-ring-mode-%d", i);
- 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));
- g_free (name);
- g_free (id);
+ group = flags_to_group (WACOM_BUTTON_RING_MODESWITCH);
+ if (num_modes == 0) {
+ /* If no mode is available, we use "left-ring-mode-1" for backward compat */
+ l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Ring"),
+ "left-ring-mode-1",
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ 0));
+ } else {
+ for (i = 1; i <= num_modes; i++) {
+ name = g_strdup_printf (_("Left Ring Mode #%d"), i);
+ id = g_strdup_printf ("left-ring-mode-%d", i);
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name,
+ id,
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ i - 1));
+ g_free (name);
+ g_free (id);
+ }
}
} else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && libwacom_has_ring2 (wacom_device)) {
num_modes = libwacom_get_ring2_num_modes (wacom_device);
- for (i = 1; i <= num_modes; i++) {
- name = g_strdup_printf (_("Right Ring Mode #%d"), i);
- id = g_strdup_printf ("right-ring-mode-%d", i);
- 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));
- g_free (name);
- g_free (id);
+ group = flags_to_group (WACOM_BUTTON_RING2_MODESWITCH);
+ if (num_modes == 0) {
+ /* If no mode is available, we use "right-ring-mode-1" for backward compat */
+ l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Ring"),
+ "right-ring-mode-1",
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ 0));
+ } else {
+ for (i = 1; i <= num_modes; i++) {
+ name = g_strdup_printf (_("Right Ring Mode #%d"), i);
+ id = g_strdup_printf ("right-ring-mode-%d", i);
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name,
+ id,
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ i - 1));
+ g_free (name);
+ g_free (id);
+ }
}
}
@@ -1037,6 +1070,7 @@ gsd_wacom_device_add_strip_modes (WacomDevice *wacom_device,
GList *l;
guint num_modes;
guint num_strips;
+ guint group;
guint i;
char *name, *id;
@@ -1047,21 +1081,53 @@ gsd_wacom_device_add_strip_modes (WacomDevice *wacom_device,
if ((direction & WACOM_BUTTON_POSITION_LEFT) && num_strips >= 1) {
num_modes = libwacom_get_strips_num_modes (wacom_device);
- for (i = 1; i <= num_modes; i++) {
- name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i);
- id = g_strdup_printf ("left-strip-mode-%d", i);
- 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));
- g_free (name);
- g_free (id);
+ group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH);
+ if (num_modes == 0) {
+ /* If no mode is available, we use "left-strip-mode-1" for backward compat */
+ l = g_list_append (l, gsd_wacom_tablet_button_new (_("Left Touchstrip"),
+ "left-strip-mode-1",
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ 0));
+ } else {
+ for (i = 1; i <= num_modes; i++) {
+ name = g_strdup_printf (_("Left Touchstrip Mode #%d"), i);
+ id = g_strdup_printf ("left-strip-mode-%d", i);
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name,
+ id,
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ i - 1));
+ g_free (name);
+ g_free (id);
+ }
}
} else if ((direction & WACOM_BUTTON_POSITION_RIGHT) && num_strips >= 2) {
num_modes = libwacom_get_strips_num_modes (wacom_device);
- for (i = 1; i <= num_modes; i++) {
- name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i);
- id = g_strdup_printf ("right-strip-mode-%d", i);
- 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));
- g_free (name);
- g_free (id);
+ group = flags_to_group (WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH);
+ if (num_modes == 0) {
+ /* If no mode is available, we use "right-strip-mode-1" for backward compat */
+ l = g_list_append (l, gsd_wacom_tablet_button_new (_("Right Touchstrip"),
+ "right-strip-mode-1",
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ 0));
+ } else {
+ for (i = 1; i <= num_modes; i++) {
+ name = g_strdup_printf (_("Right Touchstrip Mode #%d"), i);
+ id = g_strdup_printf ("right-strip-mode-%d", i);
+ l = g_list_append (l, gsd_wacom_tablet_button_new (name,
+ id,
+ settings_path,
+ WACOM_TABLET_BUTTON_TYPE_ELEVATOR,
+ group,
+ i - 1));
+ g_free (name);
+ g_free (id);
+ }
}
}
@@ -1137,15 +1203,14 @@ gsd_wacom_device_add_buttons_dir (WacomDevice *wacom_device,
l = g_list_append (l, gsd_wacom_tablet_button_new (name, id, settings_path, WACOM_TABLET_BUTTON_TYPE_HARDCODED, flags_to_group (flags), -1));
g_free (name);
g_free (id);
-
- if (flags & WACOM_BUTTON_RINGS_MODESWITCH)
- l = g_list_concat (l, gsd_wacom_device_add_ring_modes (wacom_device, settings_path, direction));
- else if (flags & WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH)
- l = g_list_concat (l, gsd_wacom_device_add_strip_modes (wacom_device, settings_path, direction));
- else
- g_warning ("Unhandled modeswitches");
}
+ /* Handle touch{strips,rings} */
+ if (libwacom_has_ring2 (wacom_device) || libwacom_has_ring (wacom_device))
+ l = g_list_concat (l, gsd_wacom_device_add_ring_modes (wacom_device, settings_path, direction));
+ if (libwacom_get_num_strips (wacom_device) > 0)
+ l = g_list_concat (l, gsd_wacom_device_add_strip_modes (wacom_device, settings_path, direction));
+
return l;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]