closing windows works better. still not good enough...
This commit is contained in:
parent
f36b3df20f
commit
e104fc4a76
30
tabbed.c
30
tabbed.c
@ -123,7 +123,7 @@ static Window root, win;
|
|||||||
static Bool running = True;
|
static Bool running = True;
|
||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
static unsigned bh, wx, wy, ww, wh;
|
static unsigned bh, wx, wy, ww, wh;
|
||||||
static Client *clients, *sel;
|
static Client *clients = NULL, *sel = NULL;
|
||||||
static Listener *listeners;
|
static Listener *listeners;
|
||||||
static Bool badwindow = False;
|
static Bool badwindow = False;
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
@ -199,6 +199,12 @@ drawbar() {
|
|||||||
int n, width;
|
int n, width;
|
||||||
Client *c, *fc;
|
Client *c, *fc;
|
||||||
|
|
||||||
|
if(!clients) {
|
||||||
|
dc.x = 0;
|
||||||
|
dc.w = ww;
|
||||||
|
drawtext("Tabbed", dc.norm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
width = ww;
|
width = ww;
|
||||||
for(c = clients; c; c = c->next)
|
for(c = clients; c; c = c->next)
|
||||||
c->tabx = -1;
|
c->tabx = -1;
|
||||||
@ -283,8 +289,12 @@ expose(XEvent *e) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
focus(Client *c) {
|
focus(Client *c) {
|
||||||
if(!c || !clients)
|
if(!c)
|
||||||
|
c = clients;
|
||||||
|
if(!c) {
|
||||||
|
sel = NULL;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
XRaiseWindow(dpy, c->win);
|
XRaiseWindow(dpy, c->win);
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
XSelectInput(dpy, c->win, PropertyChangeMask|StructureNotifyMask);
|
XSelectInput(dpy, c->win, PropertyChangeMask|StructureNotifyMask);
|
||||||
@ -318,6 +328,8 @@ getfirsttab() {
|
|||||||
unsigned int n, seli;
|
unsigned int n, seli;
|
||||||
Client *c, *fc;
|
Client *c, *fc;
|
||||||
|
|
||||||
|
if(!sel)
|
||||||
|
return NULL;
|
||||||
c = fc = clients;
|
c = fc = clients;
|
||||||
for(n = 0; c; c = c->next, n++);
|
for(n = 0; c; c = c->next, n++);
|
||||||
if(n * tabwidth > ww) {
|
if(n * tabwidth > ww) {
|
||||||
@ -580,6 +592,7 @@ run(void) {
|
|||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
xfd = ConnectionNumber(dpy);
|
xfd = ConnectionNumber(dpy);
|
||||||
buf[LENGTH(buf) - 1] = '\0'; /* 0-terminator is never touched */
|
buf[LENGTH(buf) - 1] = '\0'; /* 0-terminator is never touched */
|
||||||
|
drawbar();
|
||||||
while(running) {
|
while(running) {
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
maxfd = xfd;
|
maxfd = xfd;
|
||||||
@ -701,12 +714,15 @@ void
|
|||||||
unmanage(Client *c) {
|
unmanage(Client *c) {
|
||||||
Client *pc;
|
Client *pc;
|
||||||
|
|
||||||
for(pc = clients; pc && pc->next && pc->next != c; pc = pc->next);
|
focus(NULL);
|
||||||
if(pc)
|
if(!clients)
|
||||||
|
return;
|
||||||
|
else if(c == clients)
|
||||||
|
clients = c->next;
|
||||||
|
else {
|
||||||
|
for(pc = clients; pc && pc->next && pc->next != c; pc = pc->next);
|
||||||
pc->next = c->next;
|
pc->next = c->next;
|
||||||
else
|
}
|
||||||
pc = clients = c->next;
|
|
||||||
focus(pc);
|
|
||||||
free(c);
|
free(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user