]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/config/rcxml.c: Add support for <devault /> mousebinds
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 29 Aug 2022 21:43:13 +0000 (23:43 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 30 Aug 2022 15:39:09 +0000 (16:39 +0100)
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 <mouse><mousebind> entries
exist, the same default mousebinds will be loaded even if the <devault />
element is not provided.

Example usage (with a slight spelling error):

  <mouse>
    <default />
    <context name="Root">
      <mousebind button="Right" action="Press">
        <action name="ShowMenu" menu="desktop-menu" />
      </mousebind>
    </context>
  </mouse>

Co-Authored-By: @johanmalm
Fixes #416

docs/labwc-config.5.scd
src/config/rcxml.c

index 845da4a97fefe8c9a764f4cc1089a69af1878011..920455b913f57a48dc663349843b86c47bee88a9 100644 (file)
@@ -219,6 +219,13 @@ The rest of this man page describes configuration options.
        - DoubleClick: Two presses within the doubleClickTime.
        - Drag: Pressing the button within the context, then moving the cursor
 
+*<mouse><default />*
+       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
+       <mouse><mousebind> entries exist, the same default mousebinds will be
+       loaded even if the <default /> element is not provided.
+
 ## LIBINPUT
 
 *<libinput><device category="">*
index 3b04cd554a573cab83df7adf900061e31618bd64..c0a92991ef0ac1c8b7b1f591914393d384c2422b 100644 (file)
@@ -42,6 +42,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)
@@ -335,6 +336,11 @@ entry(xmlNode *node, char *nodename, char *content)
                load_default_key_bindings();
                return;
        }
+       if (!strcmp(nodename, "devault.mouse")
+                       || !strcmp(nodename, "default.mouse")) {
+               load_default_mouse_bindings();
+               return;
+       }
 
        /* handle the rest */
        if (!content) {