Apply size of configure event with _fac_resize

This commit is contained in:
Martin Duquesnoy 2011-10-25 22:55:31 +02:00
parent cd058a4753
commit 31e9b4256a
5 changed files with 45 additions and 23 deletions

View File

@ -212,7 +212,7 @@ _swap_get(struct client *c, enum position p)
}
#define _REV_SBORDER() \
draw_reversed_rect(W->root, W->rgc, &c2->geo);
draw_reversed_rect(W->root, &c2->geo);
void
client_swap(struct client *c, enum position p)
{
@ -729,7 +729,7 @@ _fac_arrange_row(struct client *c, enum position p, int fac)
_fac_apply(cc, p, fac);
}
static void
void
_fac_resize(struct client *c, enum position p, int fac)
{
struct client *cc, *gc = client_next_with_pos(c, p);
@ -774,12 +774,26 @@ _fac_resize(struct client *c, enum position p, int fac)
return;
}
}
#define _REV_BORDER() \
SLIST_FOREACH(gc, &c->tag->clients, tnext) \
draw_reversed_rect(W->root, W->rgc, &gc->tgeo);
void
client_apply_tgeo(struct tag *t)
{
struct client *c;
SLIST_FOREACH(c, &t->clients, tnext)
{
client_moveresize(c, &c->tgeo);
c->flags &= ~CLIENT_FAC_APPLIED;
}
}
#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); \
} while(/* CONSTCOND */ 0);
void
client_fac_resize(struct client *c, enum position p, int fac)
{
@ -864,13 +878,7 @@ client_fac_resize(struct client *c, enum position p, int fac)
}
/* Aborted with escape, Set back original geos */
else
{
SLIST_FOREACH(gc, &c->tag->clients, tnext)
{
gc->tgeo = gc->geo;
gc->flags &= ~CLIENT_DID_WINSIZE;
}
}
client_apply_tgeo(c->tag);
XUngrabServer(W->dpy);
XUngrabKeyboard(W->dpy, CurrentTime);

View File

@ -28,6 +28,8 @@ void client_fac_resize(struct client *c, enum position p, int fac);
void client_fac_adjust(struct client *c);
void client_remove(struct client *c);
void client_free(void);
void _fac_resize(struct client *c, enum position p, int fac);
void client_apply_tgeo(struct tag *t);
/* Generated */
void uicb_client_resize_Right(Uicb);

View File

@ -34,18 +34,31 @@ draw_rect(Drawable d, struct geo g, Color bg)
* For client use
*/
static inline void
draw_reversed_rect(Drawable dr, GC gc, struct geo *g)
draw_reversed_rect(Drawable dr, struct geo *g)
{
struct geo *ug = &W->screen->ugeo;
int i = THEME_DEFAULT->client_border_width;
XDrawRectangle(W->dpy, dr, gc,
XDrawRectangle(W->dpy, dr, W->rgc,
ug->x + g->x + i,
ug->y + g->y + i,
g->w - (i << 1),
g->h - (i << 1));
}
static inline void
draw_reversed_cross(Drawable dr, struct geo *g)
{
int x = g->x + W->screen->ugeo.x;
int y = g->y + W->screen->ugeo.y;
XDrawLine(W->dpy, dr, W->rgc,
x, y, x + g->w, y + g->h);
XDrawLine(W->dpy, dr, W->rgc,
x + g->w, y, x, y + g->h);
}
static inline unsigned short
draw_textw(struct theme *t, const char *str)
{

View File

@ -73,18 +73,17 @@ event_configureevent(XEvent *e)
if((c = client_gb_win(ev->window)))
{
if(ev->value_mask & CWX)
/* if(ev->value_mask & CWX)
c->geo.x = ev->x;
if(ev->value_mask & CWY)
c->geo.y = ev->y;
c->geo.y = ev->y; */
if(ev->value_mask & CWWidth)
c->geo.w = ev->width;
_fac_resize(c, Right, (ev->width - c->geo.w));
if(ev->value_mask & CWHeight)
c->geo.h = ev->height;
_fac_resize(c, Bottom, (ev->height - c->geo.h));
client_configure(c);
XMoveResizeWindow(EVDPY(e), c->win, c->geo.x, c->geo.y, c->geo.w, c->geo.h);
client_apply_tgeo(c->tag);
}
else
{

View File

@ -105,7 +105,7 @@ layout_free_set(struct tag *t)
#define _REV_BORDER() \
SLIST_FOREACH(g, &l->geos, next) \
draw_reversed_rect(W->root, W->rgc, &g->geo);
draw_reversed_rect(W->root, &g->geo);
static void
_historic_set(struct tag *t, bool prev)
{