Rename function "updatebars" to "createbars"

This commit is contained in:
Alex Kotov 2021-11-17 09:49:05 +05:00
parent 557cf656b6
commit 6cb0b036d0
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 31 additions and 31 deletions

View file

@ -208,6 +208,7 @@ static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
static void cleanupmon(Monitor *mon); static void cleanupmon(Monitor *mon);
static void configure(Client *c); static void configure(Client *c);
static void createbars(void);
static Monitor *createmon(void); static Monitor *createmon(void);
static void detach(Client *c); static void detach(Client *c);
static void detachstack(Client *c); static void detachstack(Client *c);
@ -264,7 +265,6 @@ static void unfocus(Client *c, int setfocus);
static void unmanage(Client *c, int destroyed); static void unmanage(Client *c, int destroyed);
static void updatebarpos(Monitor *m); static void updatebarpos(Monitor *m);
static void updatebar(Monitor *m); static void updatebar(Monitor *m);
static void updatebars(void);
static void updateclientlist(void); static void updateclientlist(void);
static int updategeom(void); static int updategeom(void);
static void updatenumlockmask(void); static void updatenumlockmask(void);
@ -666,6 +666,34 @@ configure(Client *c)
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
} }
void
createbars(void)
{
unsigned int w;
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
.background_pixmap = ParentRelative,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"polytreewm", "polytreewm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
w = m->ww;
if (showsystray && m == systraytomon(m))
w -= getsystraywidth();
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
if (showsystray && m == systraytomon(m))
XMapRaised(dpy, systray->win);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
}
}
Monitor * Monitor *
createmon(void) createmon(void)
{ {
@ -1744,7 +1772,7 @@ setup(void)
/* init system tray */ /* init system tray */
updatesystray(); updatesystray();
/* init bars */ /* init bars */
updatebars(); createbars();
updatestatus(); updatestatus();
/* supporting window for NetWMCheck */ /* supporting window for NetWMCheck */
@ -2044,34 +2072,6 @@ updatebar(Monitor *m)
arrange(m); arrange(m);
} }
void
updatebars(void)
{
unsigned int w;
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
.background_pixmap = ParentRelative,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"polytreewm", "polytreewm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
w = m->ww;
if (showsystray && m == systraytomon(m))
w -= getsystraywidth();
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
if (showsystray && m == systraytomon(m))
XMapRaised(dpy, systray->win);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
}
}
void void
updatebarpos(Monitor *m) updatebarpos(Monitor *m)
{ {

View file

@ -194,7 +194,7 @@ on_configure_notify(XEvent *e)
sh = ev->height; sh = ev->height;
if (updategeom() || dirty) { if (updategeom() || dirty) {
drw_resize(drw, sw, bh); drw_resize(drw, sw, bh);
updatebars(); createbars();
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
resizebarwin(m); resizebarwin(m);
} }