mirror of
https://github.com/swaywm/sway.git
synced 2026-05-03 06:46:26 -04:00
Store bindings in a sorted list and lookup via binary search
To reduce allocation, the list_t of keys has been replaced with a direct array of uint32_t.
This commit is contained in:
parent
8f32069740
commit
110d698807
3 changed files with 79 additions and 108 deletions
|
|
@ -26,12 +26,14 @@ struct sway_variable {
|
|||
* A key binding and an associated command.
|
||||
*/
|
||||
struct sway_binding {
|
||||
int order;
|
||||
bool release;
|
||||
bool locked;
|
||||
bool bindcode;
|
||||
list_t *keys; // sorted in ascending order
|
||||
// key part
|
||||
uint32_t *keys; // sorted in ascending order
|
||||
size_t length;
|
||||
uint32_t modifiers;
|
||||
bool release;
|
||||
// value part
|
||||
int order;
|
||||
bool locked;
|
||||
char *command;
|
||||
};
|
||||
|
||||
|
|
@ -467,14 +469,8 @@ int workspace_output_cmp_workspace(const void *a, const void *b);
|
|||
|
||||
int sway_binding_cmp(const void *a, const void *b);
|
||||
|
||||
int sway_binding_cmp_qsort(const void *a, const void *b);
|
||||
|
||||
int sway_binding_cmp_keys(const void *a, const void *b);
|
||||
|
||||
void free_sway_binding(struct sway_binding *sb);
|
||||
|
||||
struct sway_binding *sway_binding_dup(struct sway_binding *sb);
|
||||
|
||||
void load_swaybars();
|
||||
|
||||
void invoke_swaybar(struct bar_config *bar);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue