add initstatusbar() to init statusbar!

This commit is contained in:
Julien Danjou 2007-09-15 22:25:49 +02:00
parent 6e7eb17404
commit 48f17aa9f1
3 changed files with 25 additions and 12 deletions

View File

@ -156,18 +156,7 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
compileregs(awesomeconf->rules, awesomeconf->nrules);
/* bar */
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
awesomeconf->statusbar.window = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, DisplayWidth(disp, DefaultScreen(disp)), awesomeconf->statusbar.height, 0,
DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent,
DefaultVisual(disp, DefaultScreen(disp)),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, awesomeconf->statusbar.window, drawcontext->cursor[CurNormal]);
updatebarpos(disp, awesomeconf->statusbar);
XMapRaised(disp, awesomeconf->statusbar.window);
/* pixmap for everything */
awesomeconf->statusbar.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), awesomeconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp)));
initstatusbar(disp, DefaultScreen(disp), drawcontext, &awesomeconf->statusbar);
drawcontext->gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
if(!drawcontext->font.set)

View File

@ -88,6 +88,29 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
XSync(disp, False);
}
void
initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar)
{
XSetWindowAttributes wa;
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
wa.cursor = drawcontext->cursor[CurNormal];
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
statusbar->window = XCreateWindow(disp, RootWindow(disp, screen), 0, 0, DisplayWidth(disp, screen),
statusbar->height, 0, DefaultDepth(disp, screen), CopyFromParent,
DefaultVisual(disp, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, statusbar->window, drawcontext->cursor[CurNormal]);
updatebarpos(disp, *statusbar);
XMapRaised(disp, statusbar->window);
statusbar->drawable = XCreatePixmap(disp,
RootWindow(disp, screen),
DisplayWidth(disp, screen),
statusbar->height,
DefaultDepth(disp, screen));
}
void
updatebarpos(Display *disp, Statusbar statusbar)

View File

@ -24,6 +24,7 @@
#include "config.h"
void initstatusbar(Display *, int, DC *, Statusbar *);
void drawstatusbar(Display *, DC *, awesome_config *);
void updatebarpos(Display *, Statusbar);
void uicb_togglebar(Display *, DC *, awesome_config *, const char *);