[gnome-settings-daemon] wacom: Handle arbitrary number of buttons



commit f0e527b0e816e55a43d386f297fc0ac54dfe96f3
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 3 15:10:19 2012 +0000

    wacom: Handle arbitrary number of buttons
    
    Rather than the hardcoded number we used to use.

 plugins/wacom/gsd-wacom-manager.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 99b3d12..63722d4 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -252,12 +252,13 @@ set_device_buttonmap (GsdWacomDevice *device,
 	XDevice *xdev;
 	gsize nmap;
 	const gint *intmap;
-	unsigned char map[WACOM_MAX_BUTTONS] = {};
+	unsigned char *map;
 	int i, j, rc;
 
 	xdev = open_device (device);
 
 	intmap = g_variant_get_fixed_array (value, &nmap, sizeof (gint32));
+	map = g_new0 (unsigned char, nmap);
 	for (i = 0; i < nmap && i < sizeof (map); i++)
 		map[i] = intmap[i];
         g_variant_unref (value);
@@ -276,6 +277,8 @@ set_device_buttonmap (GsdWacomDevice *device,
 	if (gdk_error_trap_pop () || rc != Success)
 		g_warning ("Error in setting button mapping for \"%s\"", gsd_wacom_device_get_tool_name (device));
 
+	g_free (map);
+
 	XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdev);
 }
 



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