Use the user's keyboard layout from the x11 system#210
Use the user's keyboard layout from the x11 system#210TristanCacqueray wants to merge 2 commits into
Conversation
aeed9b9 to
8b421a4
Compare
prokopyl
left a comment
There was a problem hiding this comment.
Hi! And thanks for this PR! 🙂
I have yet to delve into the details of the XKB implementation, but one issue I see is that the xkbcommon-rs crate links directly against the xkbcommon library, which would mean hosts would fail to load a plugin altogether.
It's for this reason we have moved to using x11-dl for instance. I think this should use
xkbcommon-dl instead (which is also what winit uses).
There's also been quite a few changes to the X11 codebase since you first submitted this PR, so if you have the time to rebase and update it, it would be very helpful!
|
Hey, alas I'm not sure how to get the keymap with |
So it looks like |
dcccd6b to
871f2bd
Compare
|
@prokopyl thanks, that makes sense now. So I updated the PR and it seems to work as expected: in the open_window example, using a french layout, pressing the keycode for Do we need a safe fallback in case |
This change uses xkbcommon to decode the key utf8 value based on the user's current layout. The implementation is adapted from the x11rb's xkbcommon-example.
871f2bd to
ec80f1d
Compare
|
I also confirm this works downstream, e.g. through https://codeberg.org/TristanCacqueray/egui-baseview/src/branch/xkbfix |
Sweet, thanks! I have tested it and it works pretty much as expected on my French keyboard. 🙂 I think a fallback is always good to have yes. |
This change fallback to the old behavior when XkbcommonState can't be created.
|
@prokopyl please let me know if this PR needs more change, I'm looking forward getting this integrated. Thanks! |
This change uses xkbcommon to decode the key utf8 value based on the user's current layout. The implementation is adapted from the x11rb's xkbcommon-example.