On Wed, Mar 30, 2011 at 9:20 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote: > On Wed, Mar 30, 2011 at 01:54:47PM -0700, Jason Gerecke wrote: >> 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. > > This seems to solve the wrong problem. How about we decide that xsetwacom > controls the physical buttons on the device? That way, anyone wanting to > configure logical mapping can use the X tools and xsetwacom is > driver-specific and stays (documented so!) driver-specific. which of course > also means we need to check that the Button xorg.conf option does the right > thing. > That would make a number of things easier, but also comes with its own drawbacks. I think we should probably figure out where hassle, correctness, and compatibility collide first.
>> --- >> 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); > > I didn't pick this up in 155a4b9 but I don't think the > XSetDeviceButtonMapping actually does anything here. Not sure why it's > there, looks like a copy paste error (4d2c3d19dce4). > I remember being confused when I saw it, but didn't want to touch it. I figured it was some arcane intricacy of X. > >> + 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