From 7f10970fc74b5a428789ad376df6d6055bf43e7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Silkeb=C3=A6kken=20=28lokaltog=29?= Date: Tue, 26 Jan 2010 12:10:48 +0100 Subject: [PATCH] Added focus_follows_mouse config option --- include/config.h | 2 ++ src/cfgparse.l | 1 + src/cfgparse.y | 9 +++++++++ src/handlers.c | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) 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; } -- 2.39.5