[gnome-settings-daemon] wacom: Remove the "index" parameter to _get_button()



commit 8f3d87e638ff3e77e04d8cb17ce49974119a3e5f
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 27 18:39:24 2012 +0000

    wacom: Remove the "index" parameter to _get_button()
    
    GsdWacomDevice already knows the current index, and the
    caller has no way of knowing it. This also returns the correct
    button depending on the mode.

 plugins/wacom/gsd-wacom-device.c  |    7 ++++++-
 plugins/wacom/gsd-wacom-device.h  |    1 -
 plugins/wacom/gsd-wacom-manager.c |    3 +--
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index f10f04c..93c549f 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -1591,9 +1591,10 @@ find_button_with_index (GsdWacomDevice *device,
 GsdWacomTabletButton *
 gsd_wacom_device_get_button (GsdWacomDevice   *device,
 			     int               button,
-			     int               index,
 			     GtkDirectionType *dir)
 {
+	int index;
+
 	if (button <= 26) {
 		char *id;
 		GsdWacomTabletButton *ret;
@@ -1633,15 +1634,19 @@ gsd_wacom_device_get_button (GsdWacomDevice   *device,
 	switch (button) {
 	case 90:
 	case 91:
+		index = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER (1)));
 		return find_button_with_index (device, "left-ring", index);
 	case 92:
 	case 93:
+		index = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER (2)));
 		return find_button_with_index (device, "right-ring", index);
 	case 94:
 	case 95:
+		index = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER (3)));
 		return find_button_with_index (device, "left-strip", index);
 	case 96:
 	case 97:
+		index = GPOINTER_TO_INT (g_hash_table_lookup (device->priv->modes, GINT_TO_POINTER (4)));
 		return find_button_with_index (device, "right-strip", index);
 	default:
 		return NULL;
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index f7b239f..0352d01 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -148,7 +148,6 @@ const char     * gsd_wacom_device_type_to_string    (GsdWacomDeviceType type);
 GList          * gsd_wacom_device_get_buttons       (GsdWacomDevice *device);
 GsdWacomTabletButton *gsd_wacom_device_get_button   (GsdWacomDevice   *device,
 						     int               button,
-						     int               index,
 						     GtkDirectionType *dir);
 int gsd_wacom_device_set_next_mode                  (GsdWacomDevice *device,
 						     int             group_id);
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 5291790..817befd 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -805,8 +805,7 @@ filter_button_events (XEvent          *xevent,
 
 	button = xev->detail;
 
-	/* FIXME, we'll also need to pass the current mode(s) */
-	wbutton = gsd_wacom_device_get_button (device, button, 0, &dir);
+	wbutton = gsd_wacom_device_get_button (device, button, &dir);
 	if (wbutton == NULL) {
 		g_warning ("Could not find matching button for '%d' on '%s'",
 			   button, gsd_wacom_device_get_name (device));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]