Why I love D: interfacing with XCB

Stanislav Blinov stanislav.blinov at gmail.com
Wed Apr 6 20:53:11 UTC 2022


On Wednesday, 6 April 2022 at 20:20:26 UTC, H. S. Teoh wrote:

> 1) ...
> 2) ...
> 3) You'd think that solves the problem, but no, there's more. 
> Both the modifier map and the keyboard map may change over 
> time, so you also have to process MappingNotify events, and 
> reload the relevant portions of the keyboard map or the 
> modifier map (and potentially refresh your current 
> understanding of modifier bits).  One potential gotcha here is 
> that all subsequent KeyPress events after the MappingNotify 
> will use the new mapping, so you have to make sure you refresh 
> the keymap and modmap *before* processing any subsequent 
> KeyPress events.
>
> 4) ...
> 5) ...
>
> So there you have it, X11 keyboard handling without Xlib in a 
> nutshell. ;-)

6) If you care about key repeat events (which most applications 
that deal with text input should, outside of, perhaps, some 
games) - there are none. You have to look ahead at the next event 
every time you receive a KeyRelease. Which makes an event loop 
that much more "interesting".


More information about the Digitalmars-d mailing list