mirror of
https://github.com/labwc/labwc.git
synced 2026-03-11 05:33:49 -04:00
src/config/rcxml.c: Merge default mousebinds
This commit is contained in:
parent
ce5e7e153c
commit
7b995788ee
1 changed files with 17 additions and 8 deletions
|
|
@ -545,7 +545,7 @@ load_default_key_bindings(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct mouse_combos {
|
||||||
const char *context, *button, *event, *action, *command;
|
const char *context, *button, *event, *action, *command;
|
||||||
} mouse_combos[] = {
|
} mouse_combos[] = {
|
||||||
{ "Left", "Left", "Drag", "Resize", NULL},
|
{ "Left", "Left", "Drag", "Resize", NULL},
|
||||||
|
|
@ -590,17 +590,26 @@ load_default_mouse_bindings(void)
|
||||||
{
|
{
|
||||||
struct mousebind *m;
|
struct mousebind *m;
|
||||||
struct action *action;
|
struct action *action;
|
||||||
|
struct mouse_combos *current;
|
||||||
for (int i = 0; mouse_combos[i].context; i++) {
|
for (int i = 0; mouse_combos[i].context; i++) {
|
||||||
m = mousebind_create(mouse_combos[i].context);
|
current = &mouse_combos[i];
|
||||||
m->button = mousebind_button_from_str(mouse_combos[i].button,
|
if (i == 0
|
||||||
&m->modifiers);
|
|| strcmp(current->context, mouse_combos[i - 1].context)
|
||||||
m->mouse_event = mousebind_event_from_str(mouse_combos[i].event);
|
|| strcmp(current->button, mouse_combos[i - 1].button)
|
||||||
|
|| strcmp(current->event, mouse_combos[i - 1].event)) {
|
||||||
|
|
||||||
action = action_create(mouse_combos[i].action);
|
/* Create new mousebind */
|
||||||
|
m = mousebind_create(current->context);
|
||||||
|
m->button = mousebind_button_from_str(current->button,
|
||||||
|
&m->modifiers);
|
||||||
|
m->mouse_event = mousebind_event_from_str(current->event);
|
||||||
|
}
|
||||||
|
|
||||||
|
action = action_create(current->action);
|
||||||
wl_list_insert(m->actions.prev, &action->link);
|
wl_list_insert(m->actions.prev, &action->link);
|
||||||
|
|
||||||
if (mouse_combos[i].command) {
|
if (current->command) {
|
||||||
action_arg_add_str(action, NULL, mouse_combos[i].command);
|
action_arg_add_str(action, NULL, current->command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue