Added focus_follows_mouse config option

This commit is contained in:
Kim Silkebækken (lokaltog) 2010-01-26 12:10:48 +01:00 committed by Michael Stapelberg
parent 7c7756d75f
commit 7f10970fc7
4 changed files with 14 additions and 1 deletions

View File

@ -77,6 +77,8 @@ struct Config {
int container_stack_limit; int container_stack_limit;
int container_stack_limit_value; int container_stack_limit_value;
bool focus_follows_mouse;
const char *default_border; const char *default_border;
/** The modifier which needs to be pressed in combination with your mouse /** The modifier which needs to be pressed in combination with your mouse

View File

@ -44,6 +44,7 @@ ipc-socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
ipc_socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; } ipc_socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
new_container { return TOKNEWCONTAINER; } new_container { return TOKNEWCONTAINER; }
new_window { return TOKNEWWINDOW; } new_window { return TOKNEWWINDOW; }
focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; }
default { yylval.number = MODE_DEFAULT; return TOKCONTAINERMODE; } default { yylval.number = MODE_DEFAULT; return TOKCONTAINERMODE; }
stacking { yylval.number = MODE_STACK; return TOKCONTAINERMODE; } stacking { yylval.number = MODE_STACK; return TOKCONTAINERMODE; }
tabbed { yylval.number = MODE_TABBED; return TOKCONTAINERMODE; } tabbed { yylval.number = MODE_TABBED; return TOKCONTAINERMODE; }

View File

@ -197,6 +197,7 @@ void parse_file(const char *f) {
%token TOKMODE %token TOKMODE
%token TOKNEWCONTAINER %token TOKNEWCONTAINER
%token TOKNEWWINDOW %token TOKNEWWINDOW
%token TOKFOCUSFOLLOWSMOUSE
%token TOKCONTAINERMODE %token TOKCONTAINERMODE
%token TOKSTACKLIMIT %token TOKSTACKLIMIT
@ -213,6 +214,7 @@ line:
| floating_modifier | floating_modifier
| new_container | new_container
| new_window | new_window
| focus_follows_mouse
| workspace | workspace
| assign | assign
| ipcsocket | ipcsocket
@ -379,6 +381,13 @@ new_window:
} }
; ;
focus_follows_mouse:
TOKFOCUSFOLLOWSMOUSE WHITESPACE NUMBER
{
config.focus_follows_mouse = ($<number>3 == 0 ? 0 : 1);
}
;
workspace: workspace:
TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen optional_workspace_name TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen optional_workspace_name
{ {

View File

@ -236,7 +236,8 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_
return 1; return 1;
} }
set_focus(conn, client, false); if (config.focus_follows_mouse)
set_focus(conn, client, false);
return 1; return 1;
} }