From: Kim Silkebækken (lokaltog) Date: Tue, 26 Jan 2010 11:10:48 +0000 (+0100) Subject: Added focus_follows_mouse config option X-Git-Tag: 3.e~6^2~155 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7f10970fc74b5a428789ad376df6d6055bf43e7c;p=i3%2Fi3 Added focus_follows_mouse config option --- diff --git a/include/config.h b/include/config.h index 3080c5c3..b81c3492 100644 --- a/include/config.h +++ b/include/config.h @@ -77,6 +77,8 @@ struct Config { int container_stack_limit; int container_stack_limit_value; + bool focus_follows_mouse; + const char *default_border; /** The modifier which needs to be pressed in combination with your mouse diff --git a/src/cfgparse.l b/src/cfgparse.l index ac862a2e..ce912549 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -44,6 +44,7 @@ ipc-socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; } ipc_socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; } new_container { return TOKNEWCONTAINER; } new_window { return TOKNEWWINDOW; } +focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; } default { yylval.number = MODE_DEFAULT; return TOKCONTAINERMODE; } stacking { yylval.number = MODE_STACK; return TOKCONTAINERMODE; } tabbed { yylval.number = MODE_TABBED; return TOKCONTAINERMODE; } diff --git a/src/cfgparse.y b/src/cfgparse.y index 030c51af..cc1b2d16 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -197,6 +197,7 @@ void parse_file(const char *f) { %token TOKMODE %token TOKNEWCONTAINER %token TOKNEWWINDOW +%token TOKFOCUSFOLLOWSMOUSE %token TOKCONTAINERMODE %token TOKSTACKLIMIT @@ -213,6 +214,7 @@ line: | floating_modifier | new_container | new_window + | focus_follows_mouse | workspace | assign | ipcsocket @@ -379,6 +381,13 @@ new_window: } ; +focus_follows_mouse: + TOKFOCUSFOLLOWSMOUSE WHITESPACE NUMBER + { + config.focus_follows_mouse = ($3 == 0 ? 0 : 1); + } + ; + workspace: TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen optional_workspace_name { diff --git a/src/handlers.c b/src/handlers.c index c9f95345..a0097bcd 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -236,7 +236,8 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_ return 1; } - set_focus(conn, client, false); + if (config.focus_follows_mouse) + set_focus(conn, client, false); return 1; }