add initstatusbar() to init statusbar!
This commit is contained in:
parent
6e7eb17404
commit
48f17aa9f1
13
awesome.c
13
awesome.c
|
@ -156,18 +156,7 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
||||||
/* bar */
|
/* bar */
|
||||||
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
||||||
wa.override_redirect = 1;
|
initstatusbar(disp, DefaultScreen(disp), drawcontext, &awesomeconf->statusbar);
|
||||||
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)));
|
|
||||||
drawcontext->gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
|
drawcontext->gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
|
||||||
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
if(!drawcontext->font.set)
|
if(!drawcontext->font.set)
|
||||||
|
|
23
statusbar.c
23
statusbar.c
|
@ -88,6 +88,29 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
|
||||||
XSync(disp, False);
|
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
|
void
|
||||||
updatebarpos(Display *disp, Statusbar statusbar)
|
updatebarpos(Display *disp, Statusbar statusbar)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
void initstatusbar(Display *, int, DC *, Statusbar *);
|
||||||
void drawstatusbar(Display *, DC *, awesome_config *);
|
void drawstatusbar(Display *, DC *, awesome_config *);
|
||||||
void updatebarpos(Display *, Statusbar);
|
void updatebarpos(Display *, Statusbar);
|
||||||
void uicb_togglebar(Display *, DC *, awesome_config *, const char *);
|
void uicb_togglebar(Display *, DC *, awesome_config *, const char *);
|
||||||
|
|
Loading…
Reference in New Issue