refactoring: store modifiers alongside translated keycodes

This is a no-op refactoring in terms of functionality.

related to #2346
This commit is contained in:
Michael Stapelberg
2016-08-02 20:10:26 +02:00
parent 0239c4b6da
commit 3bd5e6e5c8
2 changed files with 83 additions and 29 deletions

View File

@ -243,6 +243,17 @@ struct regex {
pcre_extra *extra;
};
/**
* Stores a resolved keycode (from a keysym), including the modifier mask. Will
* be passed to xcb_grab_key().
*
*/
struct Binding_Keycode {
xcb_keycode_t keycode;
i3_event_state_mask_t modifiers;
TAILQ_ENTRY(Binding_Keycode) keycodes;
};
/******************************************************************************
* Major types
*****************************************************************************/
@ -281,8 +292,6 @@ struct Binding {
* title bar (default). */
bool whole_window;
uint32_t number_keycodes;
/** Keycode to bind */
uint32_t keycode;
@ -296,12 +305,10 @@ struct Binding {
* if the keyboard mapping changes (using Xmodmap for example) */
char *symbol;
/** Only in use if symbol != NULL. Gets set to the value to which the
* symbol got translated when binding. Useful for unbinding and
* checking which binding was used when a key press event comes in.
*
* This is an array of number_keycodes size. */
xcb_keycode_t *translated_to;
/** Only in use if symbol != NULL. Contains keycodes which generate the
* specified symbol. Useful for unbinding and checking which binding was
* used when a key press event comes in. */
TAILQ_HEAD(keycodes_head, Binding_Keycode) keycodes_head;
/** Command, like in command mode */
char *command;