Implement the configuration option floating_modifier and document it
This commit is contained in:
24
src/config.c
24
src/config.c
@@ -215,6 +215,30 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "floating_modifier") == 0) {
|
||||
char *walk = value;
|
||||
uint32_t modifiers = 0;
|
||||
|
||||
while (*walk != '\0') {
|
||||
/* Need to check for Mod1-5, Ctrl, Shift, Mode_switch */
|
||||
CHECK_MODIFIER(SHIFT);
|
||||
CHECK_MODIFIER(CONTROL);
|
||||
CHECK_MODIFIER(MODE_SWITCH);
|
||||
CHECK_MODIFIER(MOD1);
|
||||
CHECK_MODIFIER(MOD2);
|
||||
CHECK_MODIFIER(MOD3);
|
||||
CHECK_MODIFIER(MOD4);
|
||||
CHECK_MODIFIER(MOD5);
|
||||
|
||||
/* No modifier found? Then we’re done with this step */
|
||||
break;
|
||||
}
|
||||
|
||||
LOG("Floating modifiers = %d\n", modifiers);
|
||||
config.floating_modifier = modifiers;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* assign window class[/window title] → workspace */
|
||||
if (strcasecmp(key, "assign") == 0) {
|
||||
LOG("assign: \"%s\"\n", value);
|
||||
|
@@ -302,9 +302,11 @@ int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_
|
||||
client = table_get(&by_parent, event->event);
|
||||
border_click = true;
|
||||
}
|
||||
/* See if this was a click with Mod1. If so, we need to move around
|
||||
* the client if it was floating. if not, we just process as usual. */
|
||||
if ((event->state & XCB_MOD_MASK_1) != 0) {
|
||||
/* See if this was a click with the configured modifier. If so, we need
|
||||
* to move around the client if it was floating. if not, we just process
|
||||
* as usual. */
|
||||
if (config.floating_modifier != 0 &&
|
||||
(event->state & config.floating_modifier) != 0) {
|
||||
if (client == NULL) {
|
||||
LOG("Not handling, Mod1 was pressed and no client found\n");
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user