add sloppy_focus option to allow click-to-focus

This commit is contained in:
Julien Danjou 2008-01-04 14:40:26 +01:00
parent bcebd5e1ce
commit d25d5b921f
4 changed files with 7 additions and 2 deletions

View file

@ -251,6 +251,7 @@ screen <integer> [MULTI]
general
{
allow_lower_floats=<{true,false}>
sloppy_focus=<{true,false}>
border=<integer>
focus_move_pointer=<{true,false}>
font=<font>

View file

@ -345,6 +345,7 @@ config_parse_screen(cfg_t *cfg, int screen)
virtscreen->opacity_unfocused = cfg_getint(cfg_general, "opacity_unfocused");
virtscreen->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
virtscreen->sloppy_focus = cfg_getbool(cfg_general, "sloppy_focus");
virtscreen->font = XftFontOpenName(globalconf.display,
phys_screen,
cfg_getstr(cfg_general, "font"));
@ -477,6 +478,7 @@ config_parse(const char *confpatharg)
CFG_INT((char *) "opacity_unfocused", 100, CFGF_NONE),
CFG_BOOL((char *) "focus_move_pointer", cfg_false, CFGF_NONE),
CFG_BOOL((char *) "allow_lower_floats", cfg_false, CFGF_NONE),
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
CFG_STR((char *) "font", (char *) "mono-12", CFGF_NONE),
CFG_END()
};

View file

@ -241,6 +241,8 @@ typedef struct
Bool allow_lower_floats;
/** Respect resize hints */
Bool resize_hints;
/** Sloppy focus: focus follow mouse */
Bool sloppy_focus;
/** Normal colors */
XColor colors_normal[ColLast];
/** Selected colors */

View file

@ -232,10 +232,10 @@ handle_event_enternotify(XEvent * e)
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return;
if((c = get_client_bywin(globalconf.clients, ev->window)))
if((c = get_client_bywin(globalconf.clients, ev->window)) && globalconf.screens[c->screen].sloppy_focus)
{
curtags = get_current_tags(c->screen);
focus(c, ev->same_screen, c->screen);
curtags = get_current_tags(c->screen);
if (c->isfloating || curtags[0]->layout->arrange == layout_floating)
window_grabbuttons(get_phys_screen(c->screen), c->win, True, False);
p_delete(&curtags);