c738b2e454
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.
42 lines
952 B
C
42 lines
952 B
C
/*
|
|
* vim:ts=8:expandtab
|
|
*
|
|
* i3 - an improved dynamic tiling window manager
|
|
*
|
|
* © 2009 Michael Stapelberg and contributors
|
|
*
|
|
* See file LICENSE for license information.
|
|
*
|
|
*/
|
|
#include <xcb/xcb.h>
|
|
#include <xcb/xcb_property.h>
|
|
#include <xcb/xcb_event.h>
|
|
#include <xcb/xcb_keysyms.h>
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
#include "queue.h"
|
|
#include "data.h"
|
|
|
|
#ifndef _I3_H
|
|
#define _I3_H
|
|
|
|
#define NUM_ATOMS 21
|
|
|
|
extern xcb_connection_t *global_conn;
|
|
extern xcb_key_symbols_t *keysyms;
|
|
extern char **start_argv;
|
|
extern Display *xkbdpy;
|
|
extern int xkb_current_group;
|
|
extern TAILQ_HEAD(bindings_head, Binding) *bindings;
|
|
extern TAILQ_HEAD(autostarts_head, Autostart) autostarts;
|
|
extern TAILQ_HEAD(assignments_head, Assignment) assignments;
|
|
extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins;
|
|
extern xcb_event_handlers_t evenths;
|
|
extern uint8_t root_depth;
|
|
extern bool xkb_supported;
|
|
extern xcb_atom_t atoms[NUM_ATOMS];
|
|
extern xcb_window_t root;
|
|
|
|
#endif
|