Invert logic for the last commit
This makes it more clear that the option is meant to be a special case (it *disables* part of the focus handling). Also, when initializing the config data structure with zeros, it will get initialized with the right value. Furthermore, the config file parser now also accepts various values which represent "true", not only numbers.
This commit is contained in:
parent
7f10970fc7
commit
88b9700cdb
|
@ -77,7 +77,11 @@ struct Config {
|
||||||
int container_stack_limit;
|
int container_stack_limit;
|
||||||
int container_stack_limit_value;
|
int container_stack_limit_value;
|
||||||
|
|
||||||
bool focus_follows_mouse;
|
/** By default, focus follows mouse. If the user explicitly wants to
|
||||||
|
* turn this off (and instead rely only on the keyboard for changing
|
||||||
|
* focus), we allow him to do this with this relatively special option.
|
||||||
|
* It is not planned to add any different focus models. */
|
||||||
|
bool disable_focus_follows_mouse;
|
||||||
|
|
||||||
const char *default_border;
|
const char *default_border;
|
||||||
|
|
||||||
|
|
|
@ -381,10 +381,27 @@ new_window:
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
focus_follows_mouse:
|
bool:
|
||||||
TOKFOCUSFOLLOWSMOUSE WHITESPACE NUMBER
|
NUMBER
|
||||||
{
|
{
|
||||||
config.focus_follows_mouse = ($<number>3 == 0 ? 0 : 1);
|
$<number>$ = ($<number>1 == 1);
|
||||||
|
}
|
||||||
|
| WORD
|
||||||
|
{
|
||||||
|
DLOG("checking word \"%s\"\n", $<string>1);
|
||||||
|
$<number>$ = (strcasecmp($<string>1, "yes") == 0 ||
|
||||||
|
strcasecmp($<string>1, "true") == 0 ||
|
||||||
|
strcasecmp($<string>1, "on") == 0 ||
|
||||||
|
strcasecmp($<string>1, "enable") == 0 ||
|
||||||
|
strcasecmp($<string>1, "active") == 0);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
focus_follows_mouse:
|
||||||
|
TOKFOCUSFOLLOWSMOUSE WHITESPACE bool
|
||||||
|
{
|
||||||
|
DLOG("focus follows mouse = %d\n", $<number>3);
|
||||||
|
config.disable_focus_follows_mouse = !($<number>3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.focus_follows_mouse)
|
if (!config.disable_focus_follows_mouse)
|
||||||
set_focus(conn, client, false);
|
set_focus(conn, client, false);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue