mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
src/config/rcxml.c: Replace earlier mousebinds by later ones
This commit is contained in:
parent
99237cc232
commit
3afd666cc4
1 changed files with 34 additions and 0 deletions
|
|
@ -588,6 +588,7 @@ static struct mouse_combos {
|
||||||
static void
|
static void
|
||||||
load_default_mouse_bindings(void)
|
load_default_mouse_bindings(void)
|
||||||
{
|
{
|
||||||
|
uint32_t count = 0;
|
||||||
struct mousebind *m;
|
struct mousebind *m;
|
||||||
struct action *action;
|
struct action *action;
|
||||||
struct mouse_combos *current;
|
struct mouse_combos *current;
|
||||||
|
|
@ -603,6 +604,7 @@ load_default_mouse_bindings(void)
|
||||||
m->button = mousebind_button_from_str(current->button,
|
m->button = mousebind_button_from_str(current->button,
|
||||||
&m->modifiers);
|
&m->modifiers);
|
||||||
m->mouse_event = mousebind_event_from_str(current->event);
|
m->mouse_event = mousebind_event_from_str(current->event);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
action = action_create(current->action);
|
action = action_create(current->action);
|
||||||
|
|
@ -612,6 +614,34 @@ load_default_mouse_bindings(void)
|
||||||
action_arg_add_str(action, NULL, current->command);
|
action_arg_add_str(action, NULL, current->command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_DEBUG, "Loaded %u merged mousebinds", count);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
merge_mouse_bindings(void)
|
||||||
|
{
|
||||||
|
uint32_t replaced = 0;
|
||||||
|
struct mousebind *current, *tmp, *existing;
|
||||||
|
wl_list_for_each_safe(existing, tmp, &rc.mousebinds, link) {
|
||||||
|
wl_list_for_each_reverse(current, &rc.mousebinds, link) {
|
||||||
|
if (existing == current) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (existing->context == current->context
|
||||||
|
&& existing->button == current->button
|
||||||
|
&& existing->mouse_event == current->mouse_event) {
|
||||||
|
|
||||||
|
wl_list_remove(&existing->link);
|
||||||
|
action_list_free(&existing->actions);
|
||||||
|
free(existing);
|
||||||
|
replaced++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (replaced) {
|
||||||
|
wlr_log(WLR_DEBUG, "Replaced %u mousebinds", replaced);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -621,11 +651,15 @@ post_processing(void)
|
||||||
wlr_log(WLR_INFO, "load default key bindings");
|
wlr_log(WLR_INFO, "load default key bindings");
|
||||||
load_default_key_bindings();
|
load_default_key_bindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wl_list_length(&rc.mousebinds)) {
|
if (!wl_list_length(&rc.mousebinds)) {
|
||||||
wlr_log(WLR_INFO, "load default mouse bindings");
|
wlr_log(WLR_INFO, "load default mouse bindings");
|
||||||
load_default_mouse_bindings();
|
load_default_mouse_bindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace all earlier mousebindings by later ones */
|
||||||
|
merge_mouse_bindings();
|
||||||
|
|
||||||
if (!rc.font_name_activewindow) {
|
if (!rc.font_name_activewindow) {
|
||||||
rc.font_name_activewindow = strdup("sans");
|
rc.font_name_activewindow = strdup("sans");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue