On Wed, Apr 30, 2014 at 06:57:24PM -0700, Jason Gerecke wrote:
> We're already using the Xkb functions anyway, so we may as well use
> XkbKeycodeToKeysym and silence the XKeycodeToKeysym deprecation warning.
> 
> Signed-off-by: Jason Gerecke <killert...@gmail.com>
> ---
>  tools/xsetwacom.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
> index 508326e..5289259 100644
> --- a/tools/xsetwacom.c
> +++ b/tools/xsetwacom.c
> @@ -1087,7 +1087,7 @@ static int keysym_to_keycode(Display *dpy, KeySym sym)
>               int i;
>  
>               for (i = 0; i < XkbKeyGroupWidth(xkb, kc, state.group); i++)
> -                     if (XKeycodeToKeysym(dpy, kc, i) == sym)
> +                     if (XkbKeycodeToKeysym(dpy, kc, i, 0) == sym)

This doesn't look right. group width gives you the number of shift levels,
which is the last arg to XkbKeycodeToKeysym. So they need to be swapped. And
instead of group 0 you should use state.group here, which would give you the
one of the current group. This way, if you have en,de and you're currently
on de, setting a keysym of "z" will give you the keycode for the key between
t and u, which is more obvious than using the one from the first group.

Cheers,
   Peter


>                               goto out;
>       }
>  
> @@ -1904,7 +1904,7 @@ static int get_actions(Display *dpy, XDevice *dev,
>                               if (last_type != current_type)
>                                       strcat(buff, "key ");
>                               is_press = !!(action & AC_KEYBTNPRESS);
> -                             detail = XKeycodeToKeysym(dpy, detail, 0);
> +                             detail = XkbKeycodeToKeysym(dpy, detail, 0, 0);
>                               break;
>                       case AC_BUTTON:
>                               if (last_type != current_type)
> -- 
> 1.9.2
> 
> 
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> 

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to