Merge "force_focus_wrapping" option into "focus_wrapping force"

Allow enabling forced focus wrapping by specifying "focus_wrapping
force" in i3's configuration. This syntax supersedes the previous
"force_focus_wrapping yes" one, which remains available for backwards
compatibility.
This commit is contained in:
Vladimir Panteleev
2017-09-22 23:41:38 +00:00
parent 28f7e14650
commit 50edf495aa
7 changed files with 64 additions and 42 deletions

View File

@ -227,7 +227,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
if (config.workspace_urgency_timer == 0)
config.workspace_urgency_timer = 0.5;
config.focus_wrapping = true;
config.focus_wrapping = FOCUS_WRAPPING_ON;
parse_configuration(override_configpath, true);

View File

@ -265,11 +265,26 @@ CFGFUN(disable_randr15, const char *value) {
}
CFGFUN(focus_wrapping, const char *value) {
config.focus_wrapping = eval_boolstr(value);
if (strcmp(value, "force") == 0) {
config.focus_wrapping = FOCUS_WRAPPING_FORCE;
} else if (eval_boolstr(value)) {
config.focus_wrapping = FOCUS_WRAPPING_ON;
} else {
config.focus_wrapping = FOCUS_WRAPPING_OFF;
}
}
CFGFUN(force_focus_wrapping, const char *value) {
config.force_focus_wrapping = eval_boolstr(value);
/* Legacy syntax. */
if (eval_boolstr(value)) {
config.focus_wrapping = FOCUS_WRAPPING_FORCE;
} else {
/* For "force_focus_wrapping off", don't enable or disable
* focus wrapping, just ensure it's not forced. */
if (config.focus_wrapping == FOCUS_WRAPPING_FORCE) {
config.focus_wrapping = FOCUS_WRAPPING_ON;
}
}
}
CFGFUN(workspace_back_and_forth, const char *value) {

View File

@ -641,7 +641,7 @@ static bool _tree_next(Con *con, char way, orientation_t orientation, bool wrap)
next = TAILQ_PREV(current, nodes_head, nodes);
if (!next) {
if (!config.force_focus_wrapping) {
if (config.focus_wrapping != FOCUS_WRAPPING_FORCE) {
/* If there is no next/previous container, we check if we can focus one
* when going higher (without wrapping, though). If so, we are done, if
* not, we wrap */
@ -675,7 +675,8 @@ static bool _tree_next(Con *con, char way, orientation_t orientation, bool wrap)
*
*/
void tree_next(char way, orientation_t orientation) {
_tree_next(focused, way, orientation, config.focus_wrapping);
_tree_next(focused, way, orientation,
config.focus_wrapping != FOCUS_WRAPPING_OFF);
}
/*