2 index 8bf998e..e2cda07 100644
5 @@ -81,6 +81,7 @@ typedef XftGlyphFontSpec GlyphFontSpec;
7 int tw, th; /* tty width and height */
8 int w, h; /* window width and height */
9 + int hborderpx, vborderpx;
10 int ch; /* char height */
11 int cw; /* char width */
12 int mode; /* window state/mode flags */
13 @@ -331,7 +332,7 @@ ttysend(const Arg *arg)
17 - int x = e->xbutton.x - borderpx;
18 + int x = e->xbutton.x - win.hborderpx;
19 LIMIT(x, 0, win.tw - 1);
22 @@ -339,7 +340,7 @@ evcol(XEvent *e)
26 - int y = e->xbutton.y - borderpx;
27 + int y = e->xbutton.y - win.vborderpx;
28 LIMIT(y, 0, win.th - 1);
31 @@ -723,6 +724,9 @@ cresize(int width, int height)
35 + win.hborderpx = (win.w - col * win.cw) / 2;
36 + win.vborderpx = (win.h - row * win.ch) / 2;
40 ttyresize(win.tw, win.th);
41 @@ -840,8 +844,8 @@ xhints(void)
42 sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
43 sizeh->height = win.h;
45 - sizeh->height_inc = win.ch;
46 - sizeh->width_inc = win.cw;
47 + sizeh->height_inc = 1;
48 + sizeh->width_inc = 1;
49 sizeh->base_height = 2 * borderpx;
50 sizeh->base_width = 2 * borderpx;
51 sizeh->min_height = win.ch + 2 * borderpx;
52 @@ -1123,8 +1127,8 @@ xinit(int cols, int rows)
55 /* adjust fixed window geometry */
56 - win.w = 2 * borderpx + cols * win.cw;
57 - win.h = 2 * borderpx + rows * win.ch;
58 + win.w = 2 * win.hborderpx + 2 * borderpx + cols * win.cw;
59 + win.h = 2 * win.vborderpx + 2 * borderpx + rows * win.ch;
60 if (xw.gm & XNegative)
61 xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
62 if (xw.gm & YNegative)
63 @@ -1213,7 +1217,7 @@ xinit(int cols, int rows)
65 xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
67 - float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
68 + float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp;
69 ushort mode, prevmode = USHRT_MAX;
70 Font *font = &dc.font;
71 int frcflags = FRC_NORMAL;
72 @@ -1346,7 +1350,7 @@ void
73 xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
75 int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
76 - int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
77 + int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
78 width = charlen * win.cw;
79 Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
80 XRenderColor colfg, colbg;
81 @@ -1436,17 +1440,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
83 /* Intelligent cleaning up of the borders. */
85 - xclear(0, (y == 0)? 0 : winy, borderpx,
86 + xclear(0, (y == 0)? 0 : winy, win.vborderpx,
88 - ((winy + win.ch >= borderpx + win.th)? win.h : 0));
89 + ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0));
91 - if (winx + width >= borderpx + win.tw) {
92 + if (winx + width >= win.hborderpx + win.tw) {
93 xclear(winx + width, (y == 0)? 0 : winy, win.w,
94 - ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
95 + ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch)));
98 - xclear(winx, 0, winx + width, borderpx);
99 - if (winy + win.ch >= borderpx + win.th)
100 + xclear(winx, 0, winx + width, win.vborderpx);
101 + if (winy + win.ch >= win.vborderpx + win.th)
102 xclear(winx, winy + win.ch, winx + width, win.h);
104 /* Clean up the region we want to draw to. */
105 @@ -1540,35 +1544,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
106 case 3: /* Blinking Underline */
107 case 4: /* Steady Underline */
108 XftDrawRect(xw.draw, &drawcol,
109 - borderpx + cx * win.cw,
110 - borderpx + (cy + 1) * win.ch - \
111 + win.hborderpx + cx * win.cw,
112 + win.vborderpx + (cy + 1) * win.ch - \
114 win.cw, cursorthickness);
116 case 5: /* Blinking bar */
117 case 6: /* Steady bar */
118 XftDrawRect(xw.draw, &drawcol,
119 - borderpx + cx * win.cw,
120 - borderpx + cy * win.ch,
121 + win.hborderpx + cx * win.cw,
122 + win.vborderpx + cy * win.ch,
123 cursorthickness, win.ch);
127 XftDrawRect(xw.draw, &drawcol,
128 - borderpx + cx * win.cw,
129 - borderpx + cy * win.ch,
130 + win.hborderpx + cx * win.cw,
131 + win.vborderpx + cy * win.ch,
133 XftDrawRect(xw.draw, &drawcol,
134 - borderpx + cx * win.cw,
135 - borderpx + cy * win.ch,
136 + win.hborderpx + cx * win.cw,
137 + win.vborderpx + cy * win.ch,
139 XftDrawRect(xw.draw, &drawcol,
140 - borderpx + (cx + 1) * win.cw - 1,
141 - borderpx + cy * win.ch,
142 + win.hborderpx + (cx + 1) * win.cw - 1,
143 + win.vborderpx + cy * win.ch,
145 XftDrawRect(xw.draw, &drawcol,
146 - borderpx + cx * win.cw,
147 - borderpx + (cy + 1) * win.ch - 1,
148 + win.hborderpx + cx * win.cw,
149 + win.vborderpx + (cy + 1) * win.ch - 1,