Adding to the only-kinda-hackish use of XGetDeviceButtonMapping,
in get_map, this total hackjob of a patch "fixes" the problem with
us having no way of knowing the driver's defaults for wheels and
strips.

Thankfully, the defaults aren't changing anytime soon so its
not likely to break. Additionally, once the raw button path is
removed from the driver, the entire 'get_map' function can go
the way of the dodo.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 tools/xsetwacom.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 38002cb..1c0f43f 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1884,22 +1884,34 @@ static void get_map(Display *dpy, XDevice *dev, param_t 
*param, int argc, char**
        else if (get_button(dpy, dev, param, offset))
                return;
        else
-       {
-               int nmap = 256;
-               unsigned char map[nmap];
+       { /* FIXME: Ugly hack because there's no way to get default buttons */
+               if (strcmp(param->prop_name, WACOM_PROP_BUTTON_ACTIONS) == 0)
+               {
+                       int nmap = 256;
+                       unsigned char map[nmap];
 
-               nmap = XGetDeviceButtonMapping(dpy, dev, map, nmap);
+                       nmap = XGetDeviceButtonMapping(dpy, dev, map, nmap);
 
-               if (offset >= nmap)
-               {
-                       fprintf(stderr, "Button number does not exist on 
device.\n");
-                       return;
-               }
+                       if (offset >= nmap)
+                       {
+                               fprintf(stderr, "Button number does not exist 
on device.\n");
+                               return;
+                       }
 
-               print_value(param, "%d", map[offset]);
+                       print_value(param, "%d", map[offset]);
 
-               XSetDeviceButtonMapping(dpy, dev, map, nmap);
-               XFlush(dpy);
+                       XSetDeviceButtonMapping(dpy, dev, map, nmap);
+                       XFlush(dpy);
+               }
+               else
+               {
+                       switch (offset) {
+                               case 0: print_value(param, "4"); break;
+                               case 1: print_value(param, "5"); break;
+                               case 2: print_value(param, "4"); break;
+                               case 3: print_value(param, "5"); break;
+                       }
+               }
        }
 }
 
-- 
1.7.4.1


------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to