move barwin to Statusbar

This commit is contained in:
Julien Danjou 2007-09-07 17:29:36 +02:00
parent 80c119a873
commit 20a599c07e
5 changed files with 17 additions and 19 deletions

View File

@ -63,6 +63,8 @@ typedef struct
int height; int height;
/** Bar position */ /** Bar position */
int position; int position;
/** Window */
Window window;
} Statusbar; } Statusbar;
/** Main configuration structure */ /** Main configuration structure */

3
draw.c
View File

@ -2,7 +2,6 @@
#include "layout.h" #include "layout.h"
extern Window barwin;
extern DC dc; /* global draw context */ extern DC dc; /* global draw context */
extern Client *clients, *sel, *stack; /* global client list and stack */ extern Client *clients, *sel, *stack; /* global client list and stack */
@ -147,6 +146,6 @@ drawstatus(Display *disp, jdwm_config * jdwmconf)
else else
drawtext(disp, NULL, dc.norm); 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); XSync(disp, False);
} }

View File

@ -14,7 +14,6 @@
/* extern */ /* extern */
extern int wax, way, wah, waw; /* windowarea geometry */ extern int wax, way, wah, waw; /* windowarea geometry */
extern Window barwin;
extern DC dc; /* global draw context */ extern DC dc; /* global draw context */
extern Cursor cursor[CurLast]; extern Cursor cursor[CurLast];
extern Client *clients, *sel; /* global client list */ extern Client *clients, *sel; /* global client list */
@ -125,7 +124,7 @@ handle_event_buttonpress(XEvent * e, jdwm_config *jdwmconf)
Client *c; Client *c;
XButtonPressedEvent *ev = &e->xbutton; XButtonPressedEvent *ev = &e->xbutton;
if(barwin == ev->window) if(jdwmconf->statusbar.window == ev->window)
{ {
x = 0; x = 0;
for(i = 0; i < jdwmconf->ntags; i++) 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; DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height;
XFreePixmap(e->xany.display, dc.drawable); 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))); 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); updatebarpos(e->xany.display, jdwmconf->statusbar);
arrange(e->xany.display, jdwmconf); arrange(e->xany.display, jdwmconf);
} }
@ -274,7 +273,7 @@ handle_event_expose(XEvent * e, jdwm_config *jdwmconf)
{ {
XExposeEvent *ev = &e->xexpose; XExposeEvent *ev = &e->xexpose;
if(!ev->count && barwin == ev->window) if(!ev->count && jdwmconf->statusbar.window == ev->window)
drawstatus(e->xany.display, jdwmconf); drawstatus(e->xany.display, jdwmconf);
} }

21
jdwm.c
View File

@ -25,7 +25,6 @@ Client *sel = NULL;
Client *stack = NULL; Client *stack = NULL;
Cursor cursor[CurLast]; Cursor cursor[CurLast];
DC dc; DC dc;
Window barwin;
/* static */ /* static */
@ -81,7 +80,7 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp)); XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
XFreePixmap(disp, dc.drawable); XFreePixmap(disp, dc.drawable);
XFreeGC(disp, dc.gc); XFreeGC(disp, dc.gc);
XDestroyWindow(disp, barwin); XDestroyWindow(disp, jdwmconf->statusbar.window);
XFreeCursor(disp, cursor[CurNormal]); XFreeCursor(disp, cursor[CurNormal]);
XFreeCursor(disp, cursor[CurResize]); XFreeCursor(disp, cursor[CurResize]);
XFreeCursor(disp, cursor[CurMove]); XFreeCursor(disp, cursor[CurMove]);
@ -175,13 +174,13 @@ setup(Display *disp, jdwm_config *jdwmconf)
wa.override_redirect = 1; wa.override_redirect = 1;
wa.background_pixmap = ParentRelative; wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask; wa.event_mask = ButtonPressMask | ExposureMask;
barwin = XCreateWindow(disp, DefaultRootWindow(disp), sx, sy, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, jdwmconf->statusbar.window = XCreateWindow(disp, DefaultRootWindow(disp), sx, sy, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0,
DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent, DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent,
DefaultVisual(disp, DefaultScreen(disp)), DefaultVisual(disp, DefaultScreen(disp)),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, barwin, cursor[CurNormal]); XDefineCursor(disp, jdwmconf->statusbar.window, cursor[CurNormal]);
updatebarpos(disp, jdwmconf->statusbar); updatebarpos(disp, jdwmconf->statusbar);
XMapRaised(disp, barwin); XMapRaised(disp, jdwmconf->statusbar.window);
/* pixmap for everything */ /* pixmap for everything */
dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp))); 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); dc.gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
@ -226,14 +225,14 @@ updatebarpos(Display *disp, Statusbar statusbar)
default: default:
wah -= statusbar.height; wah -= statusbar.height;
way += statusbar.height; way += statusbar.height;
XMoveWindow(disp, barwin, sx, sy); XMoveWindow(disp, statusbar.window, sx, sy);
break; break;
case BarBot: case BarBot:
wah -= statusbar.height; wah -= statusbar.height;
XMoveWindow(disp, barwin, sx, sy + wah); XMoveWindow(disp, statusbar.window, sx, sy + wah);
break; break;
case BarOff: case BarOff:
XMoveWindow(disp, barwin, sx, sy - statusbar.height); XMoveWindow(disp, statusbar.window, sx, sy - statusbar.height);
break; break;
} }
XSync(disp, False); XSync(disp, False);

View File

@ -12,7 +12,6 @@
/* extern */ /* extern */
extern int wax, way, wah, waw; /* windowarea geometry */ extern int wax, way, wah, waw; /* windowarea geometry */
extern Window barwin;
extern Client *clients, *sel; /* global client list */ extern Client *clients, *sel; /* global client list */
extern DC dc; extern DC dc;
@ -102,7 +101,7 @@ restack(Display * disp, jdwm_config *jdwmconf)
if(!IS_ARRANGE(floating)) if(!IS_ARRANGE(floating))
{ {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = barwin; wc.sibling = jdwmconf->statusbar.window;
if(!sel->isfloating) if(!sel->isfloating)
{ {
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc); XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);