diff --git a/src/client.c b/src/client.c index 88be034..9245e24 100644 --- a/src/client.c +++ b/src/client.c @@ -233,7 +233,7 @@ _swap_get(struct client *c, enum position p) } #define _REV_SBORDER() \ - draw_reversed_rect(W->root, &c2->geo); + draw_reversed_rect(W->root, c2, false); void client_swap(struct client *c, enum position p) { @@ -1146,8 +1146,7 @@ client_apply_tgeo(struct tag *t) #define _REV_BORDER() \ do { \ SLIST_FOREACH(gc, &c->tag->clients, tnext) \ - draw_reversed_rect(W->root, &gc->tgeo); \ - /* draw_reversed_cross(W->root, &c->tag->sel->tgeo);*/ \ + draw_reversed_rect(W->root, gc, true); \ } while(/* CONSTCOND */ 0); void client_fac_resize(struct client *c, enum position p, int fac) diff --git a/src/client.h b/src/client.h index 0002be5..8fd18cc 100644 --- a/src/client.h +++ b/src/client.h @@ -92,6 +92,7 @@ client_prev(struct client *c) return cc; } + static inline struct client* client_next_tab(struct client *c) { diff --git a/src/draw.h b/src/draw.h index 5ee4ef8..98f1743 100644 --- a/src/draw.h +++ b/src/draw.h @@ -12,6 +12,7 @@ #include "wmfs.h" #include "config.h" +#include "screen.h" #define TEXTY(t, w) ((t->font.height - t->font.de) + ((w - t->font.height) >> 1)) #define PAD (8) @@ -34,10 +35,11 @@ draw_rect(Drawable d, struct geo g, Color bg) * For client use */ static inline void -draw_reversed_rect(Drawable dr, struct geo *g) +draw_reversed_rect(Drawable dr, struct client *c, bool t) { - struct geo *ug = &W->screen->ugeo; - int i = THEME_DEFAULT->client_border_width; + struct geo *g = (t ? &c->tgeo : &c->geo); + struct geo *ug = &c->screen->ugeo; + int i = c->theme->client_border_width; XDrawRectangle(W->dpy, dr, W->rgc, ug->x + g->x + i, diff --git a/src/layout.c b/src/layout.c index eeddd15..d19132c 100644 --- a/src/layout.c +++ b/src/layout.c @@ -103,15 +103,18 @@ layout_free_set(struct tag *t) } } -#define _REV_BORDER() \ - SLIST_FOREACH(g, &l->geos, next) \ - draw_reversed_rect(W->root, &g->geo); +#define _REV_BORDER() \ + SLIST_FOREACH(g, &l->geos, next) { \ + cd.geo = g->geo; \ + draw_reversed_rect(W->root, &cd, false); \ + } static void _historic_set(struct tag *t, bool prev) { struct keybind *k; struct layout_set *l; struct geo_list *g; + struct client cd = { .screen = t->screen, .theme = THEME_DEFAULT }; bool b = true; XEvent ev; KeySym keysym; diff --git a/src/mouse.c b/src/mouse.c index 99d63f6..33037c0 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -9,10 +9,10 @@ #include "client.h" #include "draw.h" -#define _REV_BORDER() \ - do { \ - SLIST_FOREACH(gc, &c->tag->clients, tnext) \ - draw_reversed_rect(W->root, &gc->tgeo); \ +#define _REV_BORDER() \ + do { \ + SLIST_FOREACH(gc, &c->tag->clients, tnext) \ + draw_reversed_rect(W->root, gc, true); \ } while(/* CONSTCOND */ 0); static void mouse_resize(struct client *c) @@ -88,7 +88,7 @@ mouse_drag_tag(struct client *c, Window w) return NULL; } -#define _REV_SBORDER(c) draw_reversed_rect(W->root, &(c)->geo); +#define _REV_SBORDER(c) draw_reversed_rect(W->root, c, false); void mouse_move(struct client *c, bool type) { diff --git a/src/screen.c b/src/screen.c index 277ec1c..b962a0a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -79,22 +79,7 @@ screen_update_sel(void) { #ifdef HAVE_XINERAMA if(XineramaIsActive(W->dpy)) - { - struct screen *s; - Window w; - int d, x, y; - - XQueryPointer(W->dpy, W->root, &w, &w, &x, &y, &d, &d, (unsigned int *)&d); - - SLIST_FOREACH(s, &W->h.screen, next) - if(INAREA(x, y, s->geo)) - break; - - if(!s) - s = SLIST_FIRST(&W->h.screen); - - return (W->screen = s); - } + return (W->screen = screen_gb_mouse()); #endif /* HAVE_XINERAMA */ return W->screen; diff --git a/src/screen.h b/src/screen.h index 7d86f02..25d9124 100644 --- a/src/screen.h +++ b/src/screen.h @@ -7,6 +7,7 @@ #define SCREEN_H #include "wmfs.h" +#include "util.h" static inline struct screen* screen_gb_id(int id) @@ -20,6 +21,25 @@ screen_gb_id(int id) return SLIST_FIRST(&W->h.screen); } +static inline struct screen* +screen_gb_mouse(void) +{ + struct screen *s; + Window w; + int d, x, y; + + XQueryPointer(W->dpy, W->root, &w, &w, &x, &y, &d, &d, (unsigned int *)&d); + + SLIST_FOREACH(s, &W->h.screen, next) + if(INAREA(x, y, s->geo)) + break; + + if(!s) + s = SLIST_FIRST(&W->h.screen); + + return s; +} + void screen_init(void); struct screen* screen_update_sel(void); void screen_free(void); diff --git a/src/wmfs.c b/src/wmfs.c index b630724..ed5775e 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -190,6 +190,7 @@ wmfs_scan(void) int tag = -1, screen = -1, flags = -1; unsigned long ir, il; long *ret, *tret; + bool getg = false; XWindowAttributes wa; Window usl, usl2, *w = NULL, tm, focus; Atom rt; @@ -263,6 +264,7 @@ wmfs_scan(void) g.w = ret[2]; g.h = ret[3]; + getg = true; XFree(ret); } @@ -287,10 +289,16 @@ wmfs_scan(void) if(tag != -1 && screen != -1) { c->screen = screen_gb_id(screen); - c->flags |= CLIENT_IGNORE_LAYOUT; + + if(getg) + c->flags |= CLIENT_IGNORE_LAYOUT; + client_map(c); tag_client(tag_gb_id(c->screen, tag), c); - client_moveresize(c, &g); + + if(getg) + client_moveresize(c, &g); + client_get_name(c); } }