Don’t use SYNC key bindings for Mode_switch but re-grab keys

Before this commit, i3 used key bindings in SYNC mode for bindings
like Mode_switch + <a> and replayed the key if the current state
did not include Mode_switch. This had some problems:

1) The WM needed to acknowledge much more key presses than you
   actually had bindings for, thus making the system a bit laggy
   sometimes.
2) Users of layouts who constantly type in the third level (like
   russian layouts) did not get their cyrillic symbols correctly
   (they were not replayed right), neither did the keybindings
   work in both modes.

So, the current implementation uses the following approach: XKB
provides an event which contains the current state (including
the current level). i3 signs up for this event and upon receival,
it re-maps the bindings using Mode_switch (enables them when the
level goes to the third level and disables them as soon as the
level goes back to normal). This fixes both problems.
This commit is contained in:
Michael Stapelberg
2010-03-14 22:35:51 +01:00
parent 2df1fb8ac8
commit c738b2e454
6 changed files with 166 additions and 92 deletions

View File

@ -13,14 +13,6 @@
#include <xcb/randr.h>
/**
* Due to bindings like Mode_switch + <a>, we need to bind some keys in
* XCB_GRAB_MODE_SYNC. Therefore, we just replay all key presses.
*
*/
int handle_key_release(void *ignored, xcb_connection_t *conn,
xcb_key_release_event_t *event);
/**
* There was a key press. We compare this key code with our bindings table and
* pass the bound action to parse_command().