diff --git a/speedwm.c b/speedwm.c index 4433ba4..2c56add 100644 --- a/speedwm.c +++ b/speedwm.c @@ -1201,8 +1201,8 @@ buttonpress(XEvent *e) } #endif - } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !layoutposition && !selmon->isreset) // right layout - click = ClkLtSymbol; // right layout + } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !layoutposition && !selmon->isreset) /* right layout */ + click = ClkLtSymbol; /* right layout */ #if USESYSTRAY else if (ev->x > selmon->ww - statusw + lrpad - 2 - getsystraywidth() && !hidestatus) { x = selmon->ww - statusw + lrpad - 2 * sp - getsystraywidth() - 2; @@ -1231,7 +1231,7 @@ buttonpress(XEvent *e) } } else { if (!layoutposition && !hidelayout) { - x += TEXTW(m->ltsymbol); // Left layout does not need this + x += TEXTW(m->ltsymbol); /* Left layout does not need this */ } /* Don't click if title is hidden @@ -1739,10 +1739,10 @@ getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *s else stotal += ssize / sfacts; - *mf = mfacts; // total factor of master area - *sf = sfacts; // total factor of stack area - *mr = msize - mtotal; // the remainder (rest) of pixels after an even master split - *sr = ssize - stotal; // the remainder (rest) of pixels after an even stack split + *mf = mfacts; /* total factor of master area */ + *sf = sfacts; /* total factor of stack area */ + *mr = msize - mtotal; /* the remainder (rest) of pixels after an even master split */ + *sr = ssize - stotal; /* the remainder (rest) of pixels after an even stack split */ } void @@ -2045,9 +2045,9 @@ dragmfact(const Arg *arg) return; unsigned int n; - int py, px; // pointer coordinates - int ax, ay, aw, ah; // area position, width and height - int center = 0, horizontal = 0, mirror = 0, fixed = 0; // layout configuration + int py, px; /* pointer coordinates */ + int ax, ay, aw, ah; /* area position, width and height */ + int center = 0, horizontal = 0, mirror = 0, fixed = 0; /* layout configuration */ double fact; Monitor *m; XEvent ev; @@ -2083,8 +2083,8 @@ dragmfact(const Arg *arg) #endif /* do not allow mfact to be modified under certain conditions */ - if (!m->lt[m->sellt]->arrange // floating layout - || (!fixed && m->mastercount && n <= m->mastercount) // no master + if (!m->lt[m->sellt]->arrange /* floating layout */ + || (!fixed && m->mastercount && n <= m->mastercount) /* no master */ #if LAYOUT_MONOCLE || m->lt[m->sellt]->arrange == &monocle #endif @@ -2112,7 +2112,7 @@ dragmfact(const Arg *arg) if (horizontal) { px = ax + aw / 2; py = ay + ah / 2 + (ah - 2*ih) * (m->mfact / 2.0) + ih / 2; - } else { // vertical split + } else { /* vertical split */ px = ax + aw / 2 + (aw - 2*iv) * m->mfact / 2.0 + iv / 2; py = ay + ah / 2; } @@ -2122,7 +2122,7 @@ dragmfact(const Arg *arg) py = ay + (ah - ih) * (1.0 - m->mfact) + ih / 2; else py = ay + ((ah - ih) * m->mfact) + ih / 2; - } else { // vertical split + } else { /* vertical split */ if (mirror) px = ax + (aw - iv) * (1.0 - m->mfact) + iv / 2; else @@ -2263,8 +2263,6 @@ resizebarwin(m); /* color with the bar color if !colorlayout */ if (colorlayout) { drw_setscheme(drw, scheme[SchemeLayout]); - //} else { - // drw_setscheme(drw, scheme[SchemeBar]); } x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -2551,7 +2549,7 @@ focusmon(const Arg *arg) { Monitor *m; - selmon->allowwarp = 1; // Allow warp + selmon->allowwarp = 1; /* allow warp */ if (!mons->next) return; @@ -2859,11 +2857,9 @@ hidewin(Client *c) { Window w = c->win; static XWindowAttributes ra, ca; - // more or less taken directly from blackbox's hide() function XGrabServer(dpy); XGetWindowAttributes(dpy, root, &ra); XGetWindowAttributes(dpy, w, &ca); - // prevent UnmapNotify events XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask); XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask); XUnmapWindow(dpy, w); @@ -2994,7 +2990,7 @@ getsignal(void) } } - // No fake signal was sent, so proceed with update + /* No fake signal was sent, so proceed with update */ return 0; } @@ -3023,14 +3019,14 @@ getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); if (smartgaps && n == 1) { - oe = smartgapsize; // outer gaps disabled when only one client + oe = smartgapsize; /* outer gaps disabled when only one client */ } - *oh = m->gapsizeoh*oe; // outer horizontal gap - *ov = m->gapsizeov*oe; // outer vertical gap - *ih = m->gapsizeih*ie; // inner horizontal gap - *iv = m->gapsizeiv*ie; // inner vertical gap - *nc = n; // number of clients + *oh = m->gapsizeoh*oe; /* outer horizontal gap */ + *ov = m->gapsizeov*oe; /* outer vertical gap */ + *ih = m->gapsizeih*ie; /* inner horizontal gap */ + *iv = m->gapsizeiv*ie; /* inner vertical gap */ + *nc = n; /* number of clients */ } void @@ -3359,7 +3355,6 @@ manage(Window w, XWindowAttributes *wa) XChangeProperty(dpy, root, netatom[NetClientListStacking], XA_WINDOW, 32, PropModePrepend, (unsigned char *) &(c->win), 1); XMoveResizeWindow(dpy, c->win, c->x + 2 * tw, c->y, c->w, c->h); /* some windows require this */ - //setclientstate(c, NormalState); if (!HIDDEN(c)) setclientstate(c, NormalState); if (c->mon == selmon) @@ -3371,9 +3366,9 @@ manage(Window w, XWindowAttributes *wa) swallow(term, c); arrange(c->mon); if (focusspawn && !warpcursor) { - focus(c); // Auto focus next spawned window + focus(c); /* Auto focus next spawned window */ } else { - focus(NULL); // No need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway + focus(NULL); /* No need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway */ } } @@ -4145,7 +4140,7 @@ placemouse(const Arg *arg) ocx = wa.x; ocy = wa.y; - if (arg->i == 2) // warp cursor to client center + if (arg->i == 2) /* warp cursor to client center */ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, WIDTH(c) / 2, HEIGHT(c) / 2); if (!getrootptr(&x, &y)) @@ -4176,10 +4171,10 @@ placemouse(const Arg *arg) if ((m = recttomon(ev.xmotion.x, ev.xmotion.y, 1, 1)) && m != selmon) selmon = m; - if (arg->i == 1) { // tiled position is relative to the client window center point + if (arg->i == 1) { /* tiled position is relative to the client window center point */ px = nx + wa.width / 2; py = ny + wa.height / 2; - } else { // tiled position is relative to the mouse cursor + } else { /* tiled position is relative to the mouse cursor */ px = ev.xmotion.x; py = ev.xmotion.y; } @@ -4189,12 +4184,12 @@ placemouse(const Arg *arg) if (!r || r == c) break; - attachmode = 0; // below + attachmode = 0; /* below */ if (((float)(r->y + r->h - py) / r->h) > ((float)(r->x + r->w - px) / r->w)) { if (abs(r->y - py) < r->h / 2) - attachmode = 1; // above + attachmode = 1; /* above */ } else if (abs(r->x - px) < r->w / 2) - attachmode = 1; // above + attachmode = 1; /* above */ if ((r && r != prevr) || (attachmode != prevattachmode)) { detachstack(c); @@ -4337,7 +4332,6 @@ quit(const Arg *arg) Monitor *m; Client *c; - // fix: reloading dwm keeps all the hidden clients hidden for (m = mons; m; m = m->next) { if (m) { for (c = m->stack; c; c = c->next) @@ -4563,7 +4557,7 @@ run(void) DEBUG("Got event from fd %d\n", event_fd); if (event_fd == dpy_fd) { - // -1 means EPOLLHUP + /* -1 means EPOLLHUP */ if (handlexevent(events + i) == -1) return; } else if (event_fd == ipc_get_sock_fd()) { @@ -4745,7 +4739,6 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1); - //attach(c); switch(attachdirection){ case 1: attachabove(c); @@ -4938,7 +4931,7 @@ setcfact(const Arg *arg) return; if (!arg->f) f = 1.0; - else if (arg->f > 4.0) // set fact absolutely + else if (arg->f > 4.0) /* set fact absolutely */ f = arg->f - 4.0; else f = arg->f + c->cfact; @@ -5014,9 +5007,11 @@ setup(void) die("no fonts could be loaded."); lrpad = drw->fonts->h; bh = altbar ? 0 : drw->fonts->h + barheight; - // barpadding + + /* barpadding */ sp = barpaddingh; vp = (barposition == 1) ? barpaddingv : - barpaddingv; + updategeom(); int i = 0; @@ -5140,7 +5135,7 @@ setupepoll(void) dpy_fd = ConnectionNumber(dpy); struct epoll_event dpy_event; - // Initialize struct to 0 + /* Initialize struct to 0 */ memset(&dpy_event, 0, sizeof(dpy_event)); DEBUG("Display socket is fd %d\n", dpy_fd); @@ -5200,7 +5195,7 @@ showtagpreview(unsigned int i) void reloadcolors(const Arg *arg) { - // reload colors + /* reload colors */ load_xresources(); setup(); } @@ -5657,7 +5652,6 @@ updatebars(void) w -= getsystraywidth(); #endif m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth, - //m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen), InputOutput, visual, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); @@ -5985,7 +5979,7 @@ updaterules(Client *c) XFree(ch.res_name); c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; - // end apply rules + /* end apply rules */ if (c->isfloating) resize(c, c->x, c->y, c->w, c->h, 0); @@ -6398,7 +6392,7 @@ updatesystray(void) XMapSubwindows(dpy, systray->win); /* redraw background */ XSetForeground(dpy, drw->gc, scheme[SchemeSystray][ColBg].pixel); - //XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); // vanilla + /* XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); vanilla */ XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh); XSync(dpy, False); } @@ -6709,7 +6703,7 @@ inplacerotate(const Arg *arg) unsigned int selidx = 0, i = 0; Client *c = NULL, *stail = NULL, *mhead = NULL, *mtail = NULL, *shead = NULL; - // Determine positionings for insertclient + /* determine positionings for insertclient */ for (c = selmon->clients; c; c = c->next) { if (ISVISIBLE(c) && !(c->isfloating)) { if (selmon->sel == c) { selidx = i; } @@ -6721,16 +6715,17 @@ inplacerotate(const Arg *arg) } } - // All clients rotate + /* all clients rotate */ if (arg->i == 2) insertclient(selmon->clients, stail, 0); if (arg->i == -2) insertclient(stail, selmon->clients, 1); - // Stack xor master rotate + + /* stack xor master rotate */ if (arg->i == -1 && selidx >= selmon->mastercount) insertclient(stail, shead, 1); if (arg->i == 1 && selidx >= selmon->mastercount) insertclient(shead, stail, 0); if (arg->i == -1 && selidx < selmon->mastercount) insertclient(mtail, mhead, 1); if (arg->i == 1 && selidx < selmon->mastercount) insertclient(mhead, mtail, 0); - // Restore focus position + /* restore focus position */ i = 0; for (c = selmon->clients; c; c = c->next) { if (!ISVISIBLE(c) || (c->isfloating)) continue;