[PATCH weston] Add a way to update the keymap

Ran Benita ran234 at gmail.com
Thu Oct 10 21:14:59 CEST 2013


On Thu, Oct 10, 2013 at 07:53:12PM +0200, Rui Tiago Cação Matos wrote:
> Hi,
> 
> On 7 October 2013 20:16, Ran Benita <ran234 at gmail.com> wrote:
> > At least retaining the locked modifiers (and therefore the LED state in
> > most cases) would be nice, and not too problematic I think (though some
> > edge cases are expected).
> 
> Ok, the new version keeps both latched and locked modifiers.
> 
> > (Also, the keymap updating in compositor-x11 is currently not optimal, we
> > should really be listening for XKB protocol events rather than the
> > rules property changes. But this is pending an XCB release at least,
> > which I can only hope will happen sometime this decade :)
> 
> Hmm, is there even a way to get the RMLVO from the server with XKB? I
> thought the root window property was the only way to get it. Even
> setxkbmap calls XkbRF_SetNamesProp() and uses the property all over.

Since you asked :)

No, there isn't a formal way besides the property convention.
What I meant is to use the XKB protocol itself to get all the keymap info
from the server, then you don't compile anything on the client. Strictly
speaking this is necessary, since if the client and server are on
different machines, then the RMLVO may mean entirely different things for
both of them. When you use xkb_keymap_new_from_rules(), you are
compiling a keymap with the client's keymap file/xkeyboard-config files,
while if you use the XKB protocol / Xlib you are working off the server's
keymap.

setxkbmap only sets the propery as far I remember. It uses
XkbGetKbdByName to upload the keymap structure that it compiles locally
to the server (yes, GetKbd to set the keymap...). Wayland doesn't have
setxkbmap functionality currently, and when it does it'll be much simpler
since you don't have the entire network-transparency issue.

Xlib on the other hand fetches the keymap (with XkbGetMap request) from
the server and keeps it in sync; this is what we should do as well if we
want to play nice with the X architecture and how it was meant to be
used.

I already have it implemented in a xkbcommon-x11 helper library, but
I'm waiting for an XCB release and some polishing. I've pushed my branch
to the main repo now, you can look e.g. here if you're interested:
https://github.com/xkbcommon/libxkbcommon/blob/xcb-wip/xkbcommon/xkbcommon-x11.h
https://github.com/xkbcommon/libxkbcommon/blob/xcb-wip/test/interactive-x11.c
Anyway it would take a long time until it gets to distributions.

Ran


More information about the wayland-devel mailing list