diff --git a/config.h b/config.h index 8112beb11..463fae569 100644 --- a/config.h +++ b/config.h @@ -63,6 +63,8 @@ typedef struct int height; /** Bar position */ int position; + /** Window */ + Window window; } Statusbar; /** Main configuration structure */ diff --git a/draw.c b/draw.c index b9897b300..98ed0e891 100644 --- a/draw.c +++ b/draw.c @@ -2,7 +2,6 @@ #include "layout.h" -extern Window barwin; extern DC dc; /* global draw context */ extern Client *clients, *sel, *stack; /* global client list and stack */ @@ -147,6 +146,6 @@ drawstatus(Display *disp, jdwm_config * jdwmconf) else drawtext(disp, NULL, dc.norm); } - XCopyArea(disp, dc.drawable, barwin, dc.gc, 0, 0, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, 0); + XCopyArea(disp, dc.drawable, jdwmconf->statusbar.window, dc.gc, 0, 0, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, 0); XSync(disp, False); } diff --git a/event.c b/event.c index e086622ff..f0f5056af 100644 --- a/event.c +++ b/event.c @@ -14,7 +14,6 @@ /* extern */ extern int wax, way, wah, waw; /* windowarea geometry */ -extern Window barwin; extern DC dc; /* global draw context */ extern Cursor cursor[CurLast]; extern Client *clients, *sel; /* global client list */ @@ -125,7 +124,7 @@ handle_event_buttonpress(XEvent * e, jdwm_config *jdwmconf) Client *c; XButtonPressedEvent *ev = &e->xbutton; - if(barwin == ev->window) + if(jdwmconf->statusbar.window == ev->window) { x = 0; for(i = 0; i < jdwmconf->ntags; i++) @@ -239,7 +238,7 @@ handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf) DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height; XFreePixmap(e->xany.display, dc.drawable); dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height, DefaultDepth(e->xany.display, DefaultScreen(e->xany.display))); - XResizeWindow(e->xany.display, barwin, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height); + XResizeWindow(e->xany.display, jdwmconf->statusbar.window, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height); updatebarpos(e->xany.display, jdwmconf->statusbar); arrange(e->xany.display, jdwmconf); } @@ -274,7 +273,7 @@ handle_event_expose(XEvent * e, jdwm_config *jdwmconf) { XExposeEvent *ev = &e->xexpose; - if(!ev->count && barwin == ev->window) + if(!ev->count && jdwmconf->statusbar.window == ev->window) drawstatus(e->xany.display, jdwmconf); } diff --git a/jdwm.c b/jdwm.c index a220539a4..f2c709318 100644 --- a/jdwm.c +++ b/jdwm.c @@ -25,7 +25,6 @@ Client *sel = NULL; Client *stack = NULL; Cursor cursor[CurLast]; DC dc; -Window barwin; /* static */ @@ -81,7 +80,7 @@ cleanup(Display *disp, jdwm_config *jdwmconf) XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp)); XFreePixmap(disp, dc.drawable); XFreeGC(disp, dc.gc); - XDestroyWindow(disp, barwin); + XDestroyWindow(disp, jdwmconf->statusbar.window); XFreeCursor(disp, cursor[CurNormal]); XFreeCursor(disp, cursor[CurResize]); XFreeCursor(disp, cursor[CurMove]); @@ -175,13 +174,13 @@ setup(Display *disp, jdwm_config *jdwmconf) wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; - barwin = XCreateWindow(disp, DefaultRootWindow(disp), sx, sy, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, - DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent, - DefaultVisual(disp, DefaultScreen(disp)), - CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - XDefineCursor(disp, barwin, cursor[CurNormal]); + jdwmconf->statusbar.window = XCreateWindow(disp, DefaultRootWindow(disp), sx, sy, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, + DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent, + DefaultVisual(disp, DefaultScreen(disp)), + CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); + XDefineCursor(disp, jdwmconf->statusbar.window, cursor[CurNormal]); updatebarpos(disp, jdwmconf->statusbar); - XMapRaised(disp, barwin); + XMapRaised(disp, jdwmconf->statusbar.window); /* pixmap for everything */ dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp))); dc.gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0); @@ -226,14 +225,14 @@ updatebarpos(Display *disp, Statusbar statusbar) default: wah -= statusbar.height; way += statusbar.height; - XMoveWindow(disp, barwin, sx, sy); + XMoveWindow(disp, statusbar.window, sx, sy); break; case BarBot: wah -= statusbar.height; - XMoveWindow(disp, barwin, sx, sy + wah); + XMoveWindow(disp, statusbar.window, sx, sy + wah); break; case BarOff: - XMoveWindow(disp, barwin, sx, sy - statusbar.height); + XMoveWindow(disp, statusbar.window, sx, sy - statusbar.height); break; } XSync(disp, False); diff --git a/layout.c b/layout.c index 99c40848e..53978b04b 100644 --- a/layout.c +++ b/layout.c @@ -12,7 +12,6 @@ /* extern */ extern int wax, way, wah, waw; /* windowarea geometry */ -extern Window barwin; extern Client *clients, *sel; /* global client list */ extern DC dc; @@ -102,7 +101,7 @@ restack(Display * disp, jdwm_config *jdwmconf) if(!IS_ARRANGE(floating)) { wc.stack_mode = Below; - wc.sibling = barwin; + wc.sibling = jdwmconf->statusbar.window; if(!sel->isfloating) { XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);