add focus configuration

This commit is contained in:
Jérémy Anger 2012-04-14 11:43:51 +02:00
parent 1c179484b3
commit f9624a9f2e
3 changed files with 20 additions and 1 deletions

View File

@ -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")))

View File

@ -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);
}
}

View File

@ -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;