Work on reload/tag arranging
This commit is contained in:
parent
d8a33d9894
commit
a23dd7987b
14
src/client.h
14
src/client.h
@ -118,4 +118,18 @@ client_unmap(struct client *c)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
clients_arrange_map(void)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
SLIST_FOREACH(c, &W->h.client, next)
|
||||
{
|
||||
if(c->tag == c->screen->seltag && !(c->flags & CLIENT_TABBED))
|
||||
client_map(c);
|
||||
else
|
||||
client_unmap(c);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CLIENT_H */
|
||||
|
||||
20
src/ewmh.c
20
src/ewmh.c
@ -5,6 +5,7 @@
|
||||
|
||||
#include "ewmh.h"
|
||||
#include "util.h"
|
||||
#include "screen.h"
|
||||
|
||||
void
|
||||
ewmh_init(void)
|
||||
@ -103,21 +104,22 @@ void
|
||||
ewmh_update_wmfs_props(void)
|
||||
{
|
||||
struct screen *s;
|
||||
int n = 0;
|
||||
unsigned char *cts = NULL;
|
||||
int i, ns = 0;
|
||||
long *cts = NULL;
|
||||
|
||||
SLIST_FOREACH(s, &W->h.screen, next)
|
||||
++n;
|
||||
++ns;
|
||||
|
||||
cts = xcalloc(n, sizeof(char));
|
||||
cts = xcalloc(ns, sizeof(long));
|
||||
|
||||
n = 0;
|
||||
|
||||
SLIST_FOREACH(s, &W->h.screen, next)
|
||||
cts[n++] = s->seltag->id;
|
||||
for(i = 0; i < ns; ++i)
|
||||
{
|
||||
s = screen_gb_id(i);
|
||||
cts[i] = s->seltag->id;
|
||||
}
|
||||
|
||||
XChangeProperty(W->dpy, W->root, W->net_atom[wmfs_current_tag], XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char*)cts, n);
|
||||
PropModeReplace, (unsigned char*)cts, ns);
|
||||
|
||||
if(W->client)
|
||||
XChangeProperty(W->dpy, W->root, W->net_atom[wmfs_focus], XA_WINDOW, 32,
|
||||
|
||||
17
src/tag.c
17
src/tag.c
@ -46,23 +46,10 @@ tag_screen(struct screen *s, struct tag *t)
|
||||
t->prev = s->seltag;
|
||||
s->seltag = t;
|
||||
|
||||
/* Unmap previous tag's frame */
|
||||
if(t->prev != t)
|
||||
SLIST_FOREACH(c, &t->prev->clients, tnext)
|
||||
client_unmap(c);
|
||||
|
||||
/*
|
||||
* Map selected tag's frame, only if there is
|
||||
* clients in t
|
||||
*/
|
||||
if(!SLIST_EMPTY(&t->clients))
|
||||
{
|
||||
SLIST_FOREACH(c, &t->clients, tnext)
|
||||
if(!(c->flags & CLIENT_TABBED))
|
||||
client_map(c);
|
||||
clients_arrange_map();
|
||||
|
||||
if(!SLIST_EMPTY(&t->clients) && !(W->flags & WMFS_SCAN))
|
||||
client_focus( client_tab_next(t->sel));
|
||||
}
|
||||
|
||||
infobar_elem_screen_update(s, ElemTag);
|
||||
|
||||
|
||||
@ -197,6 +197,8 @@ wmfs_scan(void)
|
||||
|
||||
SLIST_INIT(&W->h.client);
|
||||
|
||||
W->flags |= WMFS_SCAN;
|
||||
|
||||
/* Get previous selected tag to apply it at the end */
|
||||
if(XGetWindowProperty(W->dpy, W->root, W->net_atom[wmfs_current_tag], 0, 32,
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il,
|
||||
@ -307,15 +309,17 @@ wmfs_scan(void)
|
||||
/* Set back selected tag */
|
||||
if(pstag)
|
||||
{
|
||||
for(i = 0; i < (int)nscreen; ++i)
|
||||
for(i = 0; i < nscreen; ++i)
|
||||
{
|
||||
s = screen_gb_id(i);
|
||||
tag_screen(screen_gb_id(i), tag_gb_id(s, tret[i]));
|
||||
tag_screen(s, tag_gb_id(s, tret[i]));
|
||||
}
|
||||
|
||||
XFree(tret);
|
||||
}
|
||||
|
||||
W->flags &= ~WMFS_SCAN;
|
||||
|
||||
XFree(w);
|
||||
XSync(W->dpy, false);
|
||||
}
|
||||
|
||||
@ -250,6 +250,8 @@ struct wmfs
|
||||
int xscreen, xdepth;
|
||||
int xmaxw, xmaxh;
|
||||
Flags numlockmask;
|
||||
#define WMFS_SCAN 0x01
|
||||
Flags flags;
|
||||
GC gc, rgc;
|
||||
Atom *net_atom;
|
||||
char **argv;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user