From d25d5b921fa8b9b2a9226265180e32d08de84e1d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 4 Jan 2008 14:40:26 +0100 Subject: [PATCH] add sloppy_focus option to allow click-to-focus --- awesomerc.1.txt | 1 + config.c | 2 ++ config.h | 2 ++ event.c | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/awesomerc.1.txt b/awesomerc.1.txt index 118cc9381..f11855a77 100644 --- a/awesomerc.1.txt +++ b/awesomerc.1.txt @@ -251,6 +251,7 @@ screen [MULTI] general { allow_lower_floats=<{true,false}> + sloppy_focus=<{true,false}> border= focus_move_pointer=<{true,false}> font= diff --git a/config.c b/config.c index 57e25e9f9..d0f8b0778 100644 --- a/config.c +++ b/config.c @@ -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() }; diff --git a/config.h b/config.h index 2086c46bd..1a3df0459 100644 --- a/config.h +++ b/config.h @@ -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 */ diff --git a/event.c b/event.c index 0d2da214d..a98262797 100644 --- a/event.c +++ b/event.c @@ -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);