src/config/rcxml.c: Add support for <devault /> mousebinds

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
This commit is contained in:
Consolatis 2022-08-29 23:43:13 +02:00 committed by Johan Malm
parent 3afd666cc4
commit ea6007d34c
2 changed files with 13 additions and 0 deletions

View 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="">*

View 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) {