keybindings: Split the resolved keybinding out from MetaKeyCombo
MetaKeyCombo is about the *unresolved* keybinding, which can either be a "keysym" (<Ctrl>F) or a "keycode" (<Ctrl>0x21). When we resolved the keysym to a keycode, we stuffed it back in the same MetaKeyCombo, which confused about what the "keycode" field was for. Thus, we often stomped on the user's explicit choice if they chose a keycode binding value. To solve this, create a separate structure, the "devirtualized key combo" or MetaKeyDevirtCombo, which contains a resolved keycode from the keysym, and a devirtualized modifier mask. The MetaKeyCombo is now always a "source" value, and the MetaKeyDevirtCombo is now always what the user chose. This also lets us significantly clean up the overlay and ISO key binding paths.
This commit is contained in:
@ -42,16 +42,10 @@ struct _MetaKeyHandler
|
||||
GDestroyNotify user_data_free_func;
|
||||
};
|
||||
|
||||
struct _MetaKeyBinding
|
||||
{
|
||||
const char *name;
|
||||
KeySym keysym;
|
||||
KeyCode keycode;
|
||||
unsigned int mask;
|
||||
MetaVirtualModifier modifiers;
|
||||
gint flags;
|
||||
MetaKeyHandler *handler;
|
||||
};
|
||||
typedef struct _MetaKeyDevirtCombo {
|
||||
xkb_keycode_t keycode;
|
||||
xkb_mod_mask_t mask;
|
||||
} MetaKeyDevirtCombo;
|
||||
|
||||
/**
|
||||
* MetaKeyCombo:
|
||||
@ -67,6 +61,15 @@ struct _MetaKeyCombo
|
||||
MetaVirtualModifier modifiers;
|
||||
};
|
||||
|
||||
struct _MetaKeyBinding
|
||||
{
|
||||
const char *name;
|
||||
MetaKeyCombo combo;
|
||||
MetaKeyDevirtCombo devirt_combo;
|
||||
gint flags;
|
||||
MetaKeyHandler *handler;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
@ -97,8 +100,9 @@ typedef struct
|
||||
xkb_mod_mask_t super_mask;
|
||||
xkb_mod_mask_t meta_mask;
|
||||
MetaKeyCombo overlay_key_combo;
|
||||
MetaKeyDevirtCombo overlay_key_devirt_combo;
|
||||
gboolean overlay_key_only_pressed;
|
||||
MetaKeyCombo *iso_next_group_combos;
|
||||
MetaKeyDevirtCombo *iso_next_group_combos;
|
||||
int n_iso_next_group_combos;
|
||||
|
||||
xkb_level_index_t keymap_num_levels;
|
||||
|
Reference in New Issue
Block a user