[dwm] patch for 5.0.1: interior borders only

From: Donald Chai <donald.chai_AT_gmail.com>
Date: Sun, 6 Jul 2008 16:29:09 -0700

This patch makes X draw window borders offscreen, so that you see

        |
        |
        |----
        |
        |

instead of

+------------+
| | |
| | |
| |----|
| | |
| | |
+------------+

I find the outside borders to be a bit jarring when in black-
backgrounded xterms. As a side effect, no superfluous border is drawn
when ismax==True.

Set resizehints=False for best results.

diff -r de2e0c431cf2 dwm.c
--- a/dwm.c Sun Jul 06 03:27:01 2008 -0700
+++ b/dwm.c Sun Jul 06 16:16:46 2008 -0700
@@ -206,7 +206,7 @@ static void zoom(const Arg *arg);
  /* variables */
  static char stext[256];
  static int screen, sx, sy, sw, sh;
-static int by, bh, blw, wx, wy, ww, wh;
+static int bx, by, bw, bh, blw, wx, wy, ww, wh;
  static uint seltags = 0;
  static int (*xerrorxlib)(Display *, XErrorEvent *);
  static uint numlockmask = 0;
@@ -513,10 +513,10 @@ drawbar(void) {
         else
                 x = dc.x;
         dc.w = TEXTW(stext);
- dc.x = ww - dc.w;
+ dc.x = bw - dc.w;
         if(dc.x < x) {
                 dc.x = x;
- dc.w = ww - x;
+ dc.w = bw - x;
         }
         drawtext(stext, dc.norm, False);
         if((dc.w = dc.x - x) > bh) {
@@ -528,7 +528,7 @@ drawbar(void) {
                 else
                         drawtext(NULL, dc.norm, False);
         }
- XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, ww, bh, 0, 0);
+ XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
         XSync(dpy, False);
  }

@@ -1187,7 +1187,7 @@ restack(void) {
         if(!sel)
                 return;
         if(ismax || sel->isfloating || !lt->arrange)
- XRaiseWindow(dpy, sel->win);
+ XRaiseWindow(dpy, sel->win), XRaiseWindow(dpy, barwin);
         if(!ismax && lt->arrange) {
                 wc.stack_mode = Below;
                 wc.sibling = barwin;
@@ -1364,7 +1364,7 @@ setup(void) {
         wa.background_pixmap = ParentRelative;
         wa.event_mask = ButtonPressMask|ExposureMask;

- barwin = XCreateWindow(dpy, root, wx, by, ww, bh, 0,
DefaultDepth(dpy, screen),
+ barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0,
DefaultDepth(dpy, screen),
                         CopyFromParent, DefaultVisual(dpy, screen),
                         CWOverrideRedirect|CWBackPixmap|CWEventMask,
&wa);
         XDefineCursor(dpy, barwin, cursor[CurNormal]);
@@ -1579,6 +1579,15 @@ updategeom(void) {

         /* bar position */
         by = showbar ? (topbar ? wy - bh : wy + wh) : -bh;
+ bx = wx;
+ bw = ww;
+
+ {
+ wy -= borderpx;
+ wx -= borderpx;
+ ww += 2*borderpx;
+ wh += 2*borderpx;
+ }
  }

  void
Received on Mon Jul 07 2008 - 01:28:12 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:53:26 UTC