Anyway to update `xkb_keymap` after `wl_display_run` ?

Sichem Zhou sichem.zh at gmail.com
Sat Aug 31 02:01:21 UTC 2019


Hi,

I hope to make a follow up to this thread. I made a change and submitted to
MR but it seemed to gain little interest so I am trying my luck here.

My problem is that I need to change `xkb_keymap` in the Weston run time,
though it is certainly do able though weston_seat_update_keymap, but I
found it is cleaner to do it through the exposed API
`weston_compositor_set_xkb_rule_names`. So I modified it a little bit to
call `weston_seat_update_keymap` internally. My test indicates it seemed to
work well so I hope it's a valid change to be merged. Or if there is any
problems I hope to have some feedbacks.

Thanks,
Sichem


Le lun. 26 août 2019 20 h 41, Sichem Zhou <sichem.zh at gmail.com> a écrit :

>
>
> Le lun. 26 août 2019 12 h 06, Daniel Stone <daniel at fooishbar.org> a
> écrit :
>
>> Hi Sichem,
>>
>> On Mon, 26 Aug 2019 at 16:31, Sichem Zhou <sichem.zh at gmail.com> wrote:
>> > Le lun. 26 août 2019 07 h 30, Daniel Stone <daniel at fooishbar.org> a
>> écrit :
>> >> On Mon, 26 Aug 2019 at 02:38, Sichem Zhou <sichem.zh at gmail.com> wrote:
>> >> > I found that currently there is no way to change `xkb_keymap` after
>> Weston is running.
>> >> >
>> >> > By different backends, xkb_info in wayland works differently, for
>> example, the wayland and x11 backend, weston_keyboard is initialized with
>> whatever the xkb_rules initialized in current environment and they do not
>> use global xkb_info. While in DRM backend, all weston_keyboards seem to use
>> the global keymap.  It can be changed by setting up
>> `weston_compositor_set_xkb_rules` before `weston_compositor_wake`. After
>> that, there is nothing I can do. It is used to be possible to call
>> `weston_seat_update_keymap`, but It is now an internal API. Even by that I
>> think it would be a nasty way to change keymap.
>> >> >
>> >> > I am wondering why in weston_compositor_set_xkb_rules, there is only
>> updates for rules itself rather than updating `compositor->xkb_info`. If
>> possible, I think it should be a quick fix, I can submit a MR for it.
>> >>
>> >> Sure. But why do you say that `weston_seat_update_keymap` is a 'nasty'
>> >> way to change it?
>> >
>> > Sorry for the language, yesterday when I was quite confused when I was
>> reading the keyboard handling in weston. If I am getting this right, In the
>> beginning keyboard is using global xkb_info,  but once we called
>> `weston_seat_update_keymap`. Keyboards will create their own xkb_info.
>> Leaves the global xkb_info useless. I guess that is why
>> `weston_seat_update_keymap` was never called directly from a compositor.
>>
>> No problem. And yes, you're right - at the moment you'd be the only
>> person changing the keymap at runtime. `weston_seat_update_keymap` is
>> definitely something we could re-export, as that's the correct way to
>> do it.
>>
>
> Thanks for your reply, I just submitted a new MR for this, I found that
> the `compositor->xkb_info` is kind of redundant since most of backend is
> not using it and
> weston_compositor_building_global_keymap is creating new keymap anyway, so
> keyboards are not sharing global xkb_info. We should actually get rid of
> this field and have every keyboard take control of its xkb_info.
>
> Cheers,
>> Daniel
>>
> Regards,
> Sichem
>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190830/44decc0c/attachment.html>


More information about the wayland-devel mailing list