Work on reload..

This commit is contained in:
Martin Duquesnoy 2011-11-01 15:16:41 +01:00
parent aef863b066
commit c7e05fced8
7 changed files with 57 additions and 37 deletions

View File

@ -583,21 +583,30 @@ client_new(Window w, XWindowAttributes *wa, bool scan)
}
void
client_update_props(struct client *c)
client_update_props(struct client *c, Flags f)
{
if(f & CPROP_LOC)
{
long g[4] = { c->geo.x, c->geo.y, c->geo.w, c->geo.h };
XChangeProperty(W->dpy, c->win, ATOM("_WMFS_TAG"), XA_CARDINAL, 32,
PropModeReplace, (unsigned char*)&(c->tag->id), 1);
XChangeProperty(W->dpy, c->win, ATOM("_WMFS_SCREEN"), XA_CARDINAL, 32,
PropModeReplace, (unsigned char*)&(c->screen->id), 1);
}
if(f & CPROP_FLAG)
XChangeProperty(W->dpy, c->win, ATOM("_WMFS_FLAGS"), XA_CARDINAL, 32,
PropModeReplace, (unsigned char*)&(c->flags), 1);
if(f & CPROP_GEO)
{
long g[4] = { (long)c->geo.x, (long)c->geo.y, (long)c->geo.w, (long)c->geo.h };
XChangeProperty(W->dpy, c->win, ATOM("_WMFS_GEO"), XA_CARDINAL, 32,
PropModeReplace, (unsigned char*)g, 4);
putchar(' ');
DGEO(c->geo);
}
}
static void
@ -695,7 +704,7 @@ client_moveresize(struct client *c, struct geo *g)
c->flags &= ~CLIENT_DID_WINSIZE;
client_frame_update(c, CCOL(c));
client_update_props(c);
client_update_props(c, CPROP_GEO);
client_configure(c);
}

View File

@ -30,7 +30,12 @@ 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);
void client_update_props(struct client *c);
#define CPROP_LOC 0x01
#define CPROP_FLAG 0x02
#define CPROP_GEO 0x04
void client_update_props(struct client *c, Flags f);
inline void client_fac_hint(struct client *c);
/* Generated */

View File

@ -404,7 +404,7 @@ layout_split_integrate(struct client *c, struct client *sc)
* |_____|----'| -> |_____|__v__|
* ^^^ void
*/
static inline void
inline void
layout_fix_hole(struct client *c)
{
struct client *cr = client_next_with_pos(c, Right);

View File

@ -33,6 +33,7 @@ void layout_save_set(struct tag *t);
void layout_free_set(struct tag *t);
void layout_split_integrate(struct client *c, struct client *sc);
void layout_split_arrange_closed(struct client *ghost);
inline void layout_fix_hole(struct client *c);
void uicb_layout_vmirror(Uicb cmd);
void uicb_layout_hmirror(Uicb cmd);
void uicb_layout_rotate_left(Uicb cmd);

View File

@ -106,7 +106,7 @@ tag_client(struct tag *t, struct client *c)
ewmh_set_wm_state(c->win, IconicState);
}
client_update_props(c);
client_update_props(c, CPROP_LOC);
/*
* Insert in new tag list before

View File

@ -181,16 +181,17 @@ wmfs_grab_keys(void)
static void
wmfs_scan(void)
{
XWindowAttributes wa;
Window usl, usl2, *w = NULL;
Atom rt;
struct geo g;
struct tag *t;
struct client *c;
struct screen *s;
int i, n, rf, tag = -1, screen = -1, flags = -1;
int i, n, rf;
int tag = -1, screen = -1, flags = -1;
unsigned long ir, il;
long *ret;
XWindowAttributes wa;
Window usl, usl2, *w = NULL;
Atom rt;
SLIST_INIT(&W->h.client);
@ -201,19 +202,6 @@ wmfs_scan(void)
if(!wa.override_redirect && wa.map_state == IsViewable)
{
if(XGetWindowProperty(W->dpy, w[i], ATOM("_WMFS_GEO"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il,
(unsigned char**)&ret)
== Success && ret)
{
g.x = ret[0];
g.y = ret[1];
g.w = ret[2];
g.h = ret[3];
XFree(ret);
}
if(XGetWindowProperty(W->dpy, w[i], ATOM("_WMFS_TAG"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il,
(unsigned char**)&ret)
@ -241,23 +229,36 @@ wmfs_scan(void)
XFree(ret);
}
if(XGetWindowProperty(W->dpy, w[i], ATOM("_WMFS_GEO"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il,
(unsigned char**)&ret)
== Success && ret)
{
g.x = ret[0];
g.y = ret[1];
g.w = ret[2];
g.h = ret[3];
DGEO(g);
XFree(ret);
}
c = client_new(w[i], &wa, true);
c->tgeo = g;
if(flags != -1)
c->flags = flags;
if(tag != -1 && screen != -1)
{
c->screen = screen_gb_id(screen);
TAILQ_FOREACH(t, &c->screen->tags, next)
if(t->id == tag)
{
c->flags |= CLIENT_IGNORE_LAYOUT;
tag_client(t, c);
client_moveresize(c, &g);
client_get_name(c);
client_focus(c);
/*client_focus(c);*/
break;
}
}
@ -265,7 +266,10 @@ wmfs_scan(void)
}
/*SLIST_FOREACH(c, &W->h.client, next)
client_moveresize(c, &c->tgeo);*/
client_moveresize(c, &c->tgeo);
SLIST_FOREACH(c, &W->h.client, next)
layout_fix_hole(c);*/
XFree(w);
}
@ -336,6 +340,7 @@ wmfs_quit(void)
while(!SLIST_EMPTY(&W->h.client))
{
c = SLIST_FIRST(&W->h.client);
client_update_props(c, CPROP_LOC | CPROP_FLAG | CPROP_GEO);
client_remove(c);
}