diff --git a/src/config.c b/src/config.c index 506b92f..dc5f4cf 100644 --- a/src/config.c +++ b/src/config.c @@ -235,9 +235,20 @@ config_client(void) sec = fetch_section_first(NULL, "client"); W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str); + + /* Get theme */ tmp = fetch_opt_first(sec, "default", "theme").str; W->ctheme = name_to_theme(tmp); + /* Get focus configuration */ + tmp = fetch_opt_first(sec, "enter", "focus").str; + if(!strcmp(tmp, "enter")) + W->cfocus = CFOCUS_ENTER; + else if(!strcmp(tmp, "click")) + W->cfocus = CFOCUS_CLICK; + else + W->cfocus = 0; + /* [mouse] */ /* for client frame AND titlebar */ if((mb = fetch_section(sec, "mouse"))) diff --git a/src/event.c b/src/event.c index fe165e9..7b9dc26 100644 --- a/src/event.c +++ b/src/event.c @@ -27,6 +27,7 @@ event_buttonpress(XEvent *e) XButtonEvent *ev = &e->xbutton; struct mousebind *m; struct barwin *b; + struct client *c; screen_update_sel(); status_flush_surface(); @@ -44,6 +45,9 @@ event_buttonpress(XEvent *e) break; } + if((c = client_gb_win(ev->window)) && c != W->client + && ev->button == 1 && W->cfocus & CFOCUS_CLICK) + client_focus(c); } static void @@ -67,7 +71,8 @@ event_enternotify(XEvent *e) c->flags ^= CLIENT_IGNORE_ENTER; else if(c->tag->flags & TAG_IGNORE_ENTER) c->tag->flags ^= TAG_IGNORE_ENTER; - else if(c != W->client && !(c->flags & CLIENT_TABBED)) + else if(c != W->client && !(c->flags & CLIENT_TABBED) + && W->cfocus & CFOCUS_ENTER) client_focus(c); } } diff --git a/src/wmfs.h b/src/wmfs.h index 34511fb..a9257a1 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -349,6 +349,9 @@ struct wmfs char *confpath; struct barwin *last_clicked_barwin; struct theme *ctheme; +#define CFOCUS_ENTER 0x01 +#define CFOCUS_CLICK 0x02 + Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/ /* Log file */ FILE *log;