[PATCH] window: Use constant keycode offset of 8

Tiago Vignatti tiago.vignatti at linux.intel.com
Thu Feb 16 06:00:05 PST 2012


On 02/16/2012 02:48 PM, Daniel Stone wrote:
> The X11 compositor currently posts its key presses as keycode - 8; this
> is due to X11 having a historical minimum keycode of 8, whereas evdev is
> numbered starting from 1.  So while the KEY_* constants begin with
> KEY_ESC at 1, the corresponding keycode in both X11 and the XKB keymaps
> is 9.
>
> window, on the other hand, was relying on xkb->min_key_code being 8 to
> translate its keycodes back to useful values in the XKB 'evdev' keycode
> map.  min_key_code may not always be 8, for restricted subsets of the
> keycode map.
>
> Perhaps not the best solution, but at least consistent.
>
> Signed-off-by: Daniel Stone<daniel at fooishbar.org>

To have a loose hardcoded number there is extremely difficult for 
whoever is reading that snip of code. In this case I found very useful 
to stamp a commentary, exactly as the (good) one you provided in the 
commit message. Could you do it? :)

Reviewed-by: Tiago Vignatti <tiago.vignatti at intel.com>

     Tiago


More information about the wayland-devel mailing list