From: Johan Malm Date: Fri, 22 Apr 2022 16:52:01 +0000 (+0100) Subject: config: support X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=3d337857b7b0edb76083b4e6a7e15abfb288182a;p=proto%2Flabwc.git config: support This loads default mousebinds and provides a way to keep config files simpler whilst allowing user specific binds. Note that if no rc.xml is found, or if no entries exist, the same default mousebinds will be loaded even if the element is not provided. Example usage: --- diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index a58546cc..f3a8aa5e 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -160,6 +160,13 @@ Configuration must be wrapped in a root-node. - DoubleClick: Two presses within the doubleClickTime. - Drag: Pressing the button within the context, then moving the cursor +** + Load default mousebinds. This is an addition to the openbox + specification and provides a way to keep config files simpler whilst + allowing user specific binds. Note that if no rc.xml is found, or if no + entries exist, the same default mousebinds will be + loaded even if the element is not provided. + # LIBINPUT ** diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 894ca5fa..176980a2 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -41,6 +41,7 @@ enum font_place { }; static void load_default_key_bindings(void); +static void load_default_mouse_bindings(void); static void fill_keybind(char *nodename, char *content) @@ -333,6 +334,9 @@ entry(xmlNode *node, char *nodename, char *content) if (!strcmp(nodename, "default.keyboard")) { load_default_key_bindings(); return; + } else if (!strcmp(nodename, "default.mouse")) { + load_default_mouse_bindings(); + return; } /* handle the rest */ diff --git a/src/cursor.c b/src/cursor.c index 7d3669f3..663ecb80 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -619,7 +619,7 @@ handle_press_mousebinding(struct view *view, struct server *server, bool activated_any = false; bool activated_any_frame = false; - wl_list_for_each_reverse(mousebind, &rc.mousebinds, link) { + wl_list_for_each(mousebind, &rc.mousebinds, link) { if (ssd_part_contains(mousebind->context, view_area) && mousebind->button == button && modifiers == mousebind->modifiers) { @@ -655,6 +655,7 @@ handle_press_mousebinding(struct view *view, struct server *server, activated_any = true; activated_any_frame |= mousebind->context == LAB_SSD_FRAME; actions_run(view, server, &mousebind->actions, resize_edges); + break; } } return activated_any && activated_any_frame;