changeset: 2413:d34350863073
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Dec 09 20:44:57 2008 -0500
files: cmd/wmii/dat.h cmd/wmii/div.c
description:
Fix some quirks with column dividers on differently sized/placed screens.
diff -r 00c414212163 -r d34350863073 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Tue Dec 09 19:39:13 2008 -0500
+++ b/cmd/wmii/dat.h Tue Dec 09 20:44:57 2008 -0500
@@ -196,6 +196,7 @@
Area* left;
Area* right;
bool mapped;
+ int side;
int x;
};
diff -r 00c414212163 -r d34350863073 cmd/wmii/div.c
--- a/cmd/wmii/div.c Tue Dec 09 19:39:13 2008 -0500
+++ b/cmd/wmii/div.c Tue Dec 09 20:44:57 2008 -0500
@@ -10,30 +10,32 @@
static Handlers handlers;
static Divide*
-getdiv(Divide **dp) {
+getdiv(Divide ***dp) {
WinAttr wa;
Divide *d;
- if(*dp)
- return *dp;
+ if(**dp) {
+ d = **dp;
+ d->side = 0;
+ }else {
+ d = emallocz(sizeof *d);
- d = emallocz(sizeof *d);
-
- wa.override_redirect = true;
- wa.cursor = cursor[CurDHArrow];
- wa.event_mask =
- ExposureMask
- | EnterWindowMask
- | ButtonPressMask
- | ButtonReleaseMask;
- d->w = createwindow(&scr.root, Rect(0, 0, 1, 1), scr.depth, InputOutput, &wa,
- CWOverrideRedirect
- | CWEventMask
- | CWCursor);
- d->w->aux = d;
- sethandler(d->w, &handlers);
-
- *dp = d;
+ wa.override_redirect = true;
+ wa.cursor = cursor[CurDHArrow];
+ wa.event_mask =
+ ExposureMask
+ | EnterWindowMask
+ | ButtonPressMask
+ | ButtonReleaseMask;
+ d->w = createwindow(&scr.root, Rect(0, 0, 1, 1), scr.depth, InputOutput, &wa,
+ CWOverrideRedirect
+ | CWEventMask
+ | CWCursor);
+ d->w->aux = d;
+ sethandler(d->w, &handlers);
+ **dp = d;
+ }
+ *dp = &d->next;
return d;
}
@@ -64,7 +66,7 @@
}
static void
-drawimg(Image *img, ulong cbg, ulong cborder) {
+drawimg(Image *img, ulong cbg, ulong cborder, int side) {
Point pt[6];
pt[0] = Pt(0, 0);
@@ -76,12 +78,22 @@
pt[4] = Pt(pt[3].x, Dx(img->r)/2 - 1);
pt[5] = Pt(Dx(img->r) - 1, 0);
+ if (side & 1)
+ pt[0].x = pt[1].x = pt[2].x + 1;
+ if (side & 2)
+ pt[5].x = pt[4].x = pt[3].x - 1;
+
fillpoly(img, pt, nelem(pt), cbg);
drawpoly(img, pt, nelem(pt), CapNotLast, 1, cborder);
}
static void
drawdiv(Divide *d) {
+
+ fill(divmask, divmask->r, 0);
+ drawimg(divmask, 1, 1, d->side);
+ drawimg(divimg, divcolor.bg, divcolor.border, d->side);
+
copyimage(d->w, divimg->r, divimg, ZP);
setshapemask(d->w, divmask, ZP);
}
@@ -108,10 +120,6 @@
divmask = allocimage(w, h, 1);
divcolor = def.normcolor;
- fill(divmask, divmask->r, 0);
- drawimg(divmask, 1, 1);
- drawimg(divimg, divcolor.bg, divcolor.border);
-
for(d = divs; d && d->w->mapped; d = d->next)
drawdiv(d);
}
@@ -129,19 +137,23 @@
dp = &divs;
ap = nil;
foreach_column(v, s, a) {
- d = getdiv(dp);
- dp = &d->next;
+ if (ap && ap->screen != s)
+ ap = nil;
+
+ d = getdiv(&dp);
d->left = ap;
d->right = a;
div_set(d, a->r.min.x);
ap = a;
+ if (!ap)
+ d->side |= 1;
if(!a->next) {
- d = getdiv(dp);
- dp = &d->next;
+ d = getdiv(&dp);
d->left = a;
d->right = nil;
div_set(d, a->r.max.x);
+ d->side |= 2;
}
}
for(d = *dp; d; d = d->next)
Received on Wed Dec 10 2008 - 01:44:59 UTC
This archive was generated by hypermail 2.2.0 : Wed Dec 10 2008 - 01:48:03 UTC