[*.c] Can don't have titlebar (if ttbar height = 0)
This commit is contained in:
2
config.c
2
config.c
@@ -100,7 +100,7 @@ init_conf(void) {
|
|||||||
CFG_BOOL("raisefocus", cfg_false, CFGF_NONE),
|
CFG_BOOL("raisefocus", cfg_false, CFGF_NONE),
|
||||||
CFG_BOOL("raiseswitch", cfg_true, CFGF_NONE),
|
CFG_BOOL("raiseswitch", cfg_true, CFGF_NONE),
|
||||||
CFG_INT("border_height", 1, CFGF_NONE),
|
CFG_INT("border_height", 1, CFGF_NONE),
|
||||||
CFG_INT("titlebar_height", 12, CFGF_NONE),
|
CFG_INT("titlebar_height", 0, CFGF_NONE),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
158
wmfs.c
158
wmfs.c
@@ -156,9 +156,12 @@ configurerequest(XEvent event) {
|
|||||||
c->free = True;
|
c->free = True;
|
||||||
c->hint = True;
|
c->hint = True;
|
||||||
c->max = False;
|
c->max = False;
|
||||||
XMoveWindow(dpy, c->tbar, wc.x, wc.y - conf.ttbarheight);
|
|
||||||
XResizeWindow(dpy, c->tbar, wc.width, conf.ttbarheight);
|
if(conf.ttbarheight) {
|
||||||
XMoveWindow(dpy, c->button, wc.x + wc.width - 10, BUTY(wc.y));
|
XMoveWindow(dpy, c->tbar, wc.x, wc.y - conf.ttbarheight);
|
||||||
|
XResizeWindow(dpy, c->tbar, wc.width, conf.ttbarheight);
|
||||||
|
XMoveWindow(dpy, c->button, wc.x + wc.width - 10, BUTY(wc.y));
|
||||||
|
}
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
c->y = wc.y;
|
c->y = wc.y;
|
||||||
c->x = wc.x;
|
c->x = wc.x;
|
||||||
@@ -202,7 +205,8 @@ focus(Client *c) {
|
|||||||
if(sel && sel != c) {
|
if(sel && sel != c) {
|
||||||
grabbuttons(sel, False);
|
grabbuttons(sel, False);
|
||||||
setborder(sel->win, conf.colors.bordernormal);
|
setborder(sel->win, conf.colors.bordernormal);
|
||||||
setborder(sel->tbar, conf.colors.bordernormal);
|
if(conf.ttbarheight)
|
||||||
|
setborder(sel->tbar, conf.colors.bordernormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
@@ -213,7 +217,8 @@ focus(Client *c) {
|
|||||||
|
|
||||||
if(c) {
|
if(c) {
|
||||||
setborder(c->win, conf.colors.borderfocus);
|
setborder(c->win, conf.colors.borderfocus);
|
||||||
setborder(sel->tbar, conf.colors.borderfocus);
|
if(conf.ttbarheight)
|
||||||
|
setborder(sel->tbar, conf.colors.borderfocus);
|
||||||
if(conf.raisefocus)
|
if(conf.raisefocus)
|
||||||
raiseclient(c);
|
raiseclient(c);
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
@@ -239,7 +244,8 @@ freelayout(void) {
|
|||||||
Client*
|
Client*
|
||||||
getbutton(Window w) {
|
getbutton(Window w) {
|
||||||
Client *c;
|
Client *c;
|
||||||
for(c = clients; c && c->button != w; c = c->next);
|
if(conf.ttbarheight)
|
||||||
|
for(c = clients; c && c->button != w; c = c->next);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +276,8 @@ getlayoutsym(int l) {
|
|||||||
Client*
|
Client*
|
||||||
gettbar(Window w) {
|
gettbar(Window w) {
|
||||||
Client *c;
|
Client *c;
|
||||||
for(c = clients; c && c->tbar != w; c = c->next);
|
if(conf.ttbarheight)
|
||||||
|
for(c = clients; c && c->tbar != w; c = c->next);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +382,10 @@ void
|
|||||||
grabbuttons(Client *c, Bool focused) {
|
grabbuttons(Client *c, Bool focused) {
|
||||||
int i;
|
int i;
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->tbar);
|
if(conf.ttbarheight) {
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->button);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->tbar);
|
||||||
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->button);
|
||||||
|
}
|
||||||
|
|
||||||
if(focused) {
|
if(focused) {
|
||||||
/* Window */
|
/* Window */
|
||||||
@@ -386,20 +395,24 @@ grabbuttons(Client *c, Bool focused) {
|
|||||||
XGrabButton(dpy, Button2, ALT|LockMask, c->win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button2, ALT|LockMask, c->win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, Button3, ALT, c->win, 0, ButtonMask,GrabModeAsync,GrabModeSync, None, None);
|
XGrabButton(dpy, Button3, ALT, c->win, 0, ButtonMask,GrabModeAsync,GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, Button3, ALT|LockMask, c->win, False, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button3, ALT|LockMask, c->win, False, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
/* Titlebar */
|
if(conf.ttbarheight) {
|
||||||
XGrabButton(dpy, Button1, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
/* Titlebar */
|
||||||
XGrabButton(dpy, Button2, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button1, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, Button3, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button2, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
/* Titlebar Button */
|
XGrabButton(dpy, Button3, AnyModifier, c->tbar, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, Button1, AnyModifier, c->button, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
/* Titlebar Button */
|
||||||
XGrabButton(dpy, Button3, AnyModifier, c->button, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button1, AnyModifier, c->button, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
XGrabButton(dpy, Button3, AnyModifier, c->button, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
}
|
||||||
/* Bar Button */
|
/* Bar Button */
|
||||||
for(i=0; i< conf.nbutton; ++i)
|
for(i=0; i< conf.nbutton; ++i)
|
||||||
XGrabButton(dpy, Button1, AnyModifier, conf.barbutton[i].win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button1, AnyModifier, conf.barbutton[i].win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
} else {
|
} else {
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->win, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, AnyButton, AnyModifier, c->win, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->tbar, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
if(conf.ttbarheight) {
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->button, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, AnyButton, AnyModifier, c->tbar, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
XGrabButton(dpy, AnyButton, AnyModifier, c->button, 0, ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
}
|
||||||
for(i=0; i< conf.nbutton; ++i)
|
for(i=0; i< conf.nbutton; ++i)
|
||||||
XGrabButton(dpy, Button1, AnyModifier, conf.barbutton[i].win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, Button1, AnyModifier, conf.barbutton[i].win, 0, ButtonMask,GrabModeAsync, GrabModeSync, None, None);
|
||||||
}
|
}
|
||||||
@@ -427,8 +440,11 @@ hide(Client *c) {
|
|||||||
/* unmapclient(c); */
|
/* unmapclient(c); */
|
||||||
/* Just hide for now... */
|
/* Just hide for now... */
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y+mh*2);
|
XMoveWindow(dpy, c->win, c->x, c->y+mh*2);
|
||||||
XMoveWindow(dpy, c->tbar, c->x, c->y+mh*2);
|
|
||||||
XMoveWindow(dpy, c->button, c->x, c->y+mh*2);
|
if(conf.ttbarheight) {
|
||||||
|
XMoveWindow(dpy, c->tbar, c->x, c->y+mh*2);
|
||||||
|
XMoveWindow(dpy, c->button, c->x, c->y+mh*2);
|
||||||
|
}
|
||||||
|
|
||||||
XChangeProperty(dpy, c->win, XInternAtom(dpy, "WM_STATE", False),
|
XChangeProperty(dpy, c->win, XInternAtom(dpy, "WM_STATE", False),
|
||||||
XInternAtom(dpy, "WM_STATE", False), 32,
|
XInternAtom(dpy, "WM_STATE", False), 32,
|
||||||
@@ -649,8 +665,10 @@ mapclient(Client *c) {
|
|||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
XMapWindow(dpy, c->tbar);
|
if(conf.ttbarheight) {
|
||||||
XMapWindow(dpy, c->button);
|
XMapWindow(dpy, c->tbar);
|
||||||
|
XMapWindow(dpy, c->button);
|
||||||
|
}
|
||||||
XMapSubwindows(dpy, c->win);
|
XMapSubwindows(dpy, c->win);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -681,30 +699,32 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
|
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
|
||||||
for(t = clients; t && t->win != trans; t = t->next);
|
for(t = clients; t && t->win != trans; t = t->next);
|
||||||
|
|
||||||
c->tbar = XCreateSimpleWindow(dpy, root,
|
if(conf.ttbarheight) {
|
||||||
c->x,
|
c->tbar = XCreateSimpleWindow(dpy, root,
|
||||||
c->y - conf.ttbarheight,
|
c->x,
|
||||||
c->w,
|
c->y - conf.ttbarheight,
|
||||||
conf.ttbarheight,
|
c->w,
|
||||||
conf.borderheight,
|
conf.ttbarheight,
|
||||||
conf.colors.bordernormal,
|
conf.borderheight,
|
||||||
conf.colors.bar);
|
conf.colors.bordernormal,
|
||||||
XSelectInput(dpy, c->tbar, ExposureMask | EnterWindowMask);
|
conf.colors.bar);
|
||||||
setborder(c->tbar, conf.colors.bordernormal);
|
XSelectInput(dpy, c->tbar, ExposureMask | EnterWindowMask);
|
||||||
|
setborder(c->tbar, conf.colors.bordernormal);
|
||||||
|
|
||||||
c->button = XCreateSimpleWindow(dpy, root,
|
c->button = XCreateSimpleWindow(dpy, root,
|
||||||
c->x + c->w - 10,
|
c->x + c->w - 10,
|
||||||
BUTY(c->y),
|
BUTY(c->y),
|
||||||
5,
|
5,
|
||||||
BUTH,
|
BUTH,
|
||||||
1,
|
1,
|
||||||
conf.colors.bordernormal,
|
conf.colors.bordernormal,
|
||||||
conf.colors.borderfocus);
|
conf.colors.borderfocus);
|
||||||
|
}
|
||||||
|
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, False);
|
||||||
setsizehints(c);
|
setsizehints(c);
|
||||||
attach(c);
|
attach(c);
|
||||||
moveresize( c, c->x, c->y, c->w, c->h, 1);
|
moveresize(c, c->x, c->y, c->w, c->h, 1);
|
||||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||||
mapclient(c);
|
mapclient(c);
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
@@ -826,13 +846,15 @@ moveresize(Client *c, int x, int y, int w, int h, bool r) {
|
|||||||
if((y-conf.ttbarheight) <= barheight)
|
if((y-conf.ttbarheight) <= barheight)
|
||||||
y = barheight+conf.ttbarheight;
|
y = barheight+conf.ttbarheight;
|
||||||
|
|
||||||
XMoveResizeWindow(dpy, c->win, x, y, w ,h);
|
XMoveResizeWindow(dpy, c->win, x, y, w ,h);
|
||||||
XMoveResizeWindow(dpy, c->tbar, x, y - conf.ttbarheight, w, conf.ttbarheight);
|
if(conf.ttbarheight) {
|
||||||
XMoveResizeWindow(dpy, c->button,
|
XMoveResizeWindow(dpy, c->tbar, x, y - conf.ttbarheight, w, conf.ttbarheight);
|
||||||
(x + w - 10),
|
XMoveResizeWindow(dpy, c->button,
|
||||||
BUTY(y),
|
(x + w - 10),
|
||||||
5,
|
BUTY(y),
|
||||||
BUTH);
|
5,
|
||||||
|
BUTH);
|
||||||
|
}
|
||||||
updateall();
|
updateall();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
@@ -844,8 +866,11 @@ void
|
|||||||
raiseclient(Client *c) {
|
raiseclient(Client *c) {
|
||||||
if(c) {
|
if(c) {
|
||||||
XRaiseWindow(dpy,c->win);
|
XRaiseWindow(dpy,c->win);
|
||||||
XRaiseWindow(dpy,c->tbar);
|
|
||||||
XRaiseWindow(dpy,c->button);
|
if(conf.ttbarheight) {
|
||||||
|
XRaiseWindow(dpy,c->tbar);
|
||||||
|
XRaiseWindow(dpy,c->button);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1037,7 +1062,7 @@ tile(void) {
|
|||||||
}
|
}
|
||||||
/* other clients */
|
/* other clients */
|
||||||
else {
|
else {
|
||||||
moveresize(c, (mwf+conf.borderheight), y, (mw-mwf-bord), h, 0);
|
moveresize(c, (mwf+conf.borderheight), y, (mw-mwf-bord-conf.borderheight), h, 0);
|
||||||
if(i < i + 1)
|
if(i < i + 1)
|
||||||
y += h + bord + conf.ttbarheight;
|
y += h + bord + conf.ttbarheight;
|
||||||
}
|
}
|
||||||
@@ -1113,8 +1138,10 @@ unhide(Client *c) {
|
|||||||
|
|
||||||
/* mapclient(c); */
|
/* mapclient(c); */
|
||||||
XMoveWindow(dpy,c->win,c->x,c->y);
|
XMoveWindow(dpy,c->win,c->x,c->y);
|
||||||
XMoveWindow(dpy,c->tbar,c->x, (c->y - conf.ttbarheight));
|
if(conf.ttbarheight) {
|
||||||
XMoveWindow(dpy,c->button, (c->x + c->w -10), (c->y - 9));
|
XMoveWindow(dpy,c->tbar,c->x, (c->y - conf.ttbarheight));
|
||||||
|
XMoveWindow(dpy,c->button, (c->x + c->w -10), (c->y - 9));
|
||||||
|
}
|
||||||
XChangeProperty(dpy, c->win, XInternAtom(dpy, "WM_STATE", False),
|
XChangeProperty(dpy, c->win, XInternAtom(dpy, "WM_STATE", False),
|
||||||
XInternAtom(dpy, "WM_STATE", False), 32,
|
XInternAtom(dpy, "WM_STATE", False), 32,
|
||||||
PropModeReplace, (unsigned char *) data, 2);
|
PropModeReplace, (unsigned char *) data, 2);
|
||||||
@@ -1130,11 +1157,12 @@ unmanage(Client *c) {
|
|||||||
sel = (sel == c) ? c->next : NULL;
|
sel = (sel == c) ? c->next : NULL;
|
||||||
for(i = 0; i < conf.ntag; ++i)
|
for(i = 0; i < conf.ntag; ++i)
|
||||||
selbytag[i] = (selbytag[i] == c) ? c->next : NULL;
|
selbytag[i] = (selbytag[i] == c) ? c->next : NULL;
|
||||||
|
if(conf.ttbarheight) {
|
||||||
XUnmapWindow(dpy, c->tbar);
|
XUnmapWindow(dpy, c->tbar);
|
||||||
XDestroyWindow(dpy, c->tbar);
|
XDestroyWindow(dpy, c->tbar);
|
||||||
XUnmapWindow(dpy, c->button);
|
XUnmapWindow(dpy, c->button);
|
||||||
XDestroyWindow(dpy, c->button);
|
XDestroyWindow(dpy, c->button);
|
||||||
|
}
|
||||||
|
|
||||||
detach(c);
|
detach(c);
|
||||||
free(c);
|
free(c);
|
||||||
@@ -1263,8 +1291,10 @@ unmapclient(Client *c) {
|
|||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
XUnmapWindow(dpy, c->win);
|
XUnmapWindow(dpy, c->win);
|
||||||
XUnmapWindow(dpy, c->tbar);
|
if(conf.ttbarheight) {
|
||||||
XUnmapWindow(dpy, c->button);
|
XUnmapWindow(dpy, c->tbar);
|
||||||
|
XUnmapWindow(dpy, c->button);
|
||||||
|
}
|
||||||
XUnmapSubwindows(dpy, c->win);
|
XUnmapSubwindows(dpy, c->win);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1274,9 +1304,11 @@ updatetitle(Client *c) {
|
|||||||
XFetchName(dpy, c->win, &(c->title));
|
XFetchName(dpy, c->win, &(c->title));
|
||||||
if(!c->title)
|
if(!c->title)
|
||||||
c->title = strdup("WMFS");
|
c->title = strdup("WMFS");
|
||||||
XClearWindow(dpy, c->tbar);
|
if(conf.ttbarheight) {
|
||||||
XSetForeground(dpy, gc, conf.colors.text);
|
XClearWindow(dpy, c->tbar);
|
||||||
XDrawString(dpy, c->tbar, gc, 5, fonth-1, c->title, strlen(c->title));
|
XSetForeground(dpy, gc, conf.colors.text);
|
||||||
|
XDrawString(dpy, c->tbar, gc, 5, fonth-1, c->title, strlen(c->title));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user