Fix draw_reversed_rect for multiscreen swap

This commit is contained in:
Martin Duquesnoy 2012-01-16 18:55:08 +01:00
parent c59b69869a
commit beebb65c29
8 changed files with 50 additions and 32 deletions

View File

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

View File

@ -92,6 +92,7 @@ client_prev(struct client *c)
return cc;
}
static inline struct client*
client_next_tab(struct client *c)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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