mirror of
https://github.com/labwc/labwc.git
synced 2025-11-06 13:29:58 -05:00
parse and respect modifiers for mouse bindings
This commit is contained in:
parent
c34a2fc976
commit
8eab1e8132
4 changed files with 31 additions and 10 deletions
|
|
@ -9,9 +9,22 @@
|
|||
#include "config/rcxml.h"
|
||||
|
||||
uint32_t
|
||||
mousebind_button_from_str(const char *str)
|
||||
mousebind_button_from_str(const char *str, uint32_t *modifiers)
|
||||
{
|
||||
assert(str);
|
||||
|
||||
if (modifiers) {
|
||||
*modifiers = 0;
|
||||
while (strlen(str) >= 2 && str[1] == '-') {
|
||||
char modname[2] = {str[0], 0};
|
||||
uint32_t parsed_modifier = parse_modifier(modname);
|
||||
if (!parsed_modifier)
|
||||
goto invalid;
|
||||
*modifiers |= parsed_modifier;
|
||||
str += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcasecmp(str, "Left")) {
|
||||
return BTN_LEFT;
|
||||
} else if (!strcasecmp(str, "Right")) {
|
||||
|
|
@ -19,6 +32,7 @@ mousebind_button_from_str(const char *str)
|
|||
} else if (!strcasecmp(str, "Middle")) {
|
||||
return BTN_MIDDLE;
|
||||
}
|
||||
invalid:
|
||||
wlr_log(WLR_ERROR, "unknown button (%s)", str);
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue