add focus configuration
This commit is contained in:
parent
1c179484b3
commit
f9624a9f2e
11
src/config.c
11
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")))
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user