[Piglit] [PATCH] util: Replace deprecated XKeycodeToKeysym with XGetKeyboardMapping.

Brian Paul brianp at vmware.com
Thu Feb 2 06:26:18 PST 2012


On 01/29/2012 01:02 AM, Vinson Lee wrote:
> Fixes this GCC warning.
> piglit-glx-util.c: In function ‘piglit_glx_event_loop’:
> piglit-glx-util.c:185:4: warning: ‘XKeycodeToKeysym’ is deprecated
> (declared at /usr/include/X11/Xlib.h:1695) [-Wdeprecated-declarations]
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
>   tests/util/piglit-glx-util.c |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
> index 8fb7764..df54c50 100644
> --- a/tests/util/piglit-glx-util.c
> +++ b/tests/util/piglit-glx-util.c
> @@ -182,10 +182,13 @@ piglit_glx_event_loop(Display *dpy, enum piglit_result (*draw)(Display *dpy))
>   		XNextEvent (dpy,&event);
>
>   		if (event.type == KeyPress) {
> -			KeySym sym = XKeycodeToKeysym (dpy,
> -						       event.xkey.keycode, 0);
> +			int keysyms_per_keycode_return;
> +			KeySym *sym = XGetKeyboardMapping (dpy,
> +							   event.xkey.keycode,
> +							   1,
> +							&keysyms_per_keycode_return);
>
> -			if (sym == XK_Escape || sym == XK_q || sym == XK_Q)
> +			if (sym[0] == XK_Escape || sym[0] == XK_q || sym[0] == XK_Q)
>   				break;
>   			else
>   				draw(dpy);

LGTM.

Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the Piglit mailing list