From 6cb0b036d0c35fa5a9b5a6c3a47a61bc69c2a669 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 17 Nov 2021 09:49:05 +0500 Subject: [PATCH] Rename function "updatebars" to "createbars" --- src/dwm.c | 60 +++++++++++++++++++++++----------------------- src/dwm/handlers.c | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/dwm.c b/src/dwm.c index 2a609a5..3986c60 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -208,6 +208,7 @@ static void checkotherwm(void); static void cleanup(void); static void cleanupmon(Monitor *mon); static void configure(Client *c); +static void createbars(void); static Monitor *createmon(void); static void detach(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 updatebarpos(Monitor *m); static void updatebar(Monitor *m); -static void updatebars(void); static void updateclientlist(void); static int updategeom(void); static void updatenumlockmask(void); @@ -666,6 +666,34 @@ configure(Client *c) 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 * createmon(void) { @@ -1744,7 +1772,7 @@ setup(void) /* init system tray */ updatesystray(); /* init bars */ - updatebars(); + createbars(); updatestatus(); /* supporting window for NetWMCheck */ @@ -2044,34 +2072,6 @@ updatebar(Monitor *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 updatebarpos(Monitor *m) { diff --git a/src/dwm/handlers.c b/src/dwm/handlers.c index f11a055..fbff6c2 100644 --- a/src/dwm/handlers.c +++ b/src/dwm/handlers.c @@ -194,7 +194,7 @@ on_configure_notify(XEvent *e) sh = ev->height; if (updategeom() || dirty) { drw_resize(drw, sw, bh); - updatebars(); + createbars(); for (m = mons; m; m = m->next) { resizebarwin(m); }