b4n left a comment (geany/geany-plugins#1458) > @b4n Good questions, you are just asking the wrong guy ;-). I pretty much > don't know anything when it comes to keyboard events - I just had a look at > the existing implementation which kind of worked, it just made some incorrect > assumptions which I tried to address.
Fair enough, so we're two clueless monkeys figuring out what happens when we hit those funny little squares :smile: :monkey_face: :bone: ⬛ > > can't we simply use hardware keycodes from the keymap? > > Do you mean using `ev->hardware_keycode` and compare it to some hard-coded > values? Is the value OS-independent and can we be sure we get identical > values for all types of keyboards? I meant using `ev->hardware_keycode` and comparing it to the result of [`gdk_keymap_get_entries_for_keyval()`](https://docs.gtk.org/gdk3/method.Keymap.get_entries_for_keyval.html), which gives the hardware keycode for the relevant key. However, after trying this out, reading the linked documentation and thinking for a minute, I realized it's *not* a good idea, because it fails to account for the group modifier, which is relevant (at least in my French layout, the <kbd>AltGr</kbd> key switches group, and that does *not* feel right if the plugin still see it the same as without). So I guess finding the key and checking the shift and no shift variants is the right call, as it keeps the group unmodified -- and that indeed does work for me with a French, a US and a UK layout. > > isn't there a signal on keymap change that could be used instead of > > figuring this again and again for all key presses? > > No clue. At least I tried to limit the re-calculation to only those key > presses containing Ctrl. There actually is, and I [implemented it](https://github.com/b4n/geany-plugins/commit/fa8acdbe536d0f063b2b12de77370fc9005f915d), which was pretty trivial. Feel free to include it here if it looks sensible to you. Note that I get the signal a bunch of times (7) when switching layout (using IBus here), but that should still be cheaper than on every <kbd>Ctrl</kbd>-using key press. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany-plugins/pull/1458#issuecomment-3021052731 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany-plugins/pull/1458/[email protected]>
