changeset: 2674:716aaca4dff2
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Sat May 29 18:03:14 2010 -0400
files: cmd/wmii/area.c cmd/wmii/bar.c cmd/wmii/client.c cmd/wmii/column.c cmd/wmii/div.c cmd/wmii/ewmh.c cmd/wmii/float.c cmd/wmii/frame.c cmd/wmii/fs.c cmd/wmii/layout.c cmd/wmii/message.c cmd/wmii/mouse.c cmd/wmii/rule.c cmd/wmii/view.c
description:
Collapse/uncollapse floating clients on grab box click.
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/area.c
--- a/cmd/wmii/area.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/area.c Sat May 29 18:03:14 2010 -0400
@@ -94,7 +94,7 @@
if(width == 0) {
if(numcols >= 0) {
width = view_newcolwidth(v, scrn, index);
- if (width == 0)
+ if(width == 0)
width = Dx(v->r[scrn]) / (numcols + 1);
}
else
@@ -213,7 +213,7 @@
return;
from = f->area;
- if (from == to)
+ if(from == to)
return;
area_detach(f);
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/bar.c Sat May 29 18:03:14 2010 -0400
@@ -98,7 +98,7 @@
strlcat(b->buf, b->col.colstr, sizeof(b->buf));
strlcat(b->buf, " ", sizeof(b->buf));
strlcat(b->buf, b->text, sizeof(b->buf));
-
+
SET(i);
for(sp=screens; (s = *sp); sp++) {
i = bp - s->bar;
@@ -265,7 +265,7 @@
bup_event(Window *w, void *aux, XButtonPressedEvent *e) {
WMScreen *s;
Bar *b;
-
+
s = aux;
b = findbar(s, Pt(e->x, e->y));
if(b)
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/client.c
--- a/cmd/wmii/client.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/client.c Sat May 29 18:03:14 2010 -0400
@@ -175,7 +175,7 @@
}
- /*
+ /*
* It's actually possible for a window to be destroyed
* before we get a chance to reparent it. Check for that
* now, because otherwise we'll wind up mapping a
@@ -277,7 +277,7 @@
r = client_grav(c, ZR);
- hide = false;
+ hide = false;
if(!c->sel || c->sel->view != selview)
hide = true;
@@ -887,7 +887,7 @@
static bool
enter_event(Window *w, void *aux, XCrossingEvent *e) {
Client *c;
-
+
c = aux;
if(e->detail != NotifyInferior) {
if(e->detail != NotifyVirtual)
@@ -942,7 +942,7 @@
static bool
unmap_event(Window *w, void *aux, XUnmapEvent *e) {
Client *c;
-
+
c = aux;
if(e->send_event || c->w.unmapped < 0)
client_destroy(c);
@@ -954,7 +954,7 @@
Client *c;
USED(e);
-
+
c = aux;
if(c == selclient())
client_focus(c);
@@ -1033,7 +1033,7 @@
static int
strpcmp(const void *ap, const void *bp) {
char **a, **b;
-
+
a = (char**)ap;
b = (char**)bp;
return strcmp(*a, *b);
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/column.c
--- a/cmd/wmii/column.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/column.c Sat May 29 18:03:14 2010 -0400
@@ -67,7 +67,7 @@
}
if(old)
str++;
-
+
}
free(orig);
return true;
@@ -233,7 +233,7 @@
*fp = stack_find(a, f, dir, stack);
if(*fp)
return true;
- if (!a->floating)
+ if(!a->floating)
*ap = area_find(a->view, r, dir, wrap);
if(!*ap)
return false;
@@ -496,7 +496,7 @@
ia = foo(*(Frame**)a);
ib = foo(*(Frame**)b);
- /*
+ /*
* I'd like to favor the selected client, but
* it causes windows to jump as focus changes.
*/
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/div.c
--- a/cmd/wmii/div.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/div.c Sat May 29 18:03:14 2010 -0400
@@ -140,7 +140,7 @@
dp = &divs;
ap = nil;
foreach_column(v, s, a) {
- if (ap && ap->screen != s)
+ if(ap && ap->screen != s)
ap = nil;
d = getdiv(&dp);
@@ -168,7 +168,7 @@
Divide *d;
USED(e);
-
+
d = aux;
mouse_resizecol(d);
return false;
@@ -177,9 +177,9 @@
static bool
expose_event(Window *w, void *aux, XExposeEvent *e) {
Divide *d;
-
+
USED(e);
-
+
d = aux;
drawdiv(d);
return false;
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/ewmh.c Sat May 29 18:03:14 2010 -0400
@@ -507,7 +507,7 @@
if(c->fullscreen >= 0)
changeprop_long(&c->w, Net("WM_FULLSCREEN_MONITORS"), "CARDINAL",
(long[]) { c->fullscreen, c->fullscreen,
- c->fullscreen, c->fullscreen },
+ c->fullscreen, c->fullscreen },
4);
else
delproperty(&c->w, Net("WM_FULLSCREEN_MONITORS"));
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/float.c
--- a/cmd/wmii/float.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/float.c Sat May 29 18:03:14 2010 -0400
@@ -70,8 +70,6 @@
switch(a->mode) {
case Coldefault:
- for(f=a->frame; f; f=f->anext)
- f->collapsed = false;
break;
case Colstack:
for(f=a->frame; f; f=f->anext)
@@ -201,15 +199,15 @@
*/
s = -1;
ff = client_groupframe(c, f->view);
- if (f->screen >= 0)
+ if(f->screen >= 0)
s = f->screen;
- else if (ff)
+ else if(ff)
s = ownerscreen(ff->r);
- else if (selclient())
+ else if(selclient())
s = ownerscreen(selclient()->sel->r);
else {
sel = view_findarea(a->view, a->view->selscreen, a->view->selcol, false);
- if (sel)
+ if(sel)
s = sel->screen;
}
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/frame.c Sat May 29 18:03:14 2010 -0400
@@ -216,7 +216,7 @@
f->client, f->client->name,
ignoreenter == e->serial ? " (ignored)" : "");
if(e->detail != NotifyInferior)
- if(e->serial != ignoreenter && (f->area->floating || !f->collapsed))
+ if(e->serial != ignoreenter && !f->collapsed)
focus(f->client, false);
}
mouse_checkresize(f, Pt(e->x, e->y), false);
@@ -241,7 +241,7 @@
static bool
motion_event(Window *w, void *aux, XMotionEvent *e) {
Client *c;
-
+
c = aux;
mouse_checkresize(c->sel, Pt(e->x, e->y), false);
return false;
@@ -269,9 +269,8 @@
c = f->client;
h = *c->w.hints;
- r = frame_rect2client(c, f->r, f->area->floating);
- d.x = Dx(f->r) - Dx(r);
- d.y = Dy(f->r) - Dy(r);
+ r = frame_client2rect(c, ZR, f->area->floating);
+ d = subpt(r.max, r.min);
if(!f->area->floating && def.incmode == IIgnore)
h.inc = Pt(1, 1);
@@ -605,7 +604,9 @@
/* XXX */
f->colr.max.y = f->colr.min.y + Dy(ff->colr);
ff->colr.max.y = ff->colr.min.y + labelh(def.font);
- }else if(f->area->mode == Coldefault) {
+ }
+ else if(f->area->mode == Coldefault) {
+ /* XXX */
for(; f->collapsed && f->anext; f=f->anext)
;
for(; f->collapsed && f->aprev; f=f->aprev)
@@ -620,6 +621,9 @@
if(old_a != v->oldsel && f != old_f)
v->oldsel = nil;
+ if(f->area->floating)
+ f->collapsed = false;
+
if(v != selview || a != v->sel || resizing)
return;
@@ -649,7 +653,7 @@
if(inset < 0)
inset = Dy(screen->brect);
- /*
+ /*
* FIXME: This will cause problems for windows with
* D(r) < 2 * inset
*/
@@ -657,7 +661,7 @@
SET(best);
sbest = nil;
for(sp=screens; (s = *sp); sp++) {
- if (!screen->showing)
+ if(!screen->showing)
continue;
isect = rect_intersection(r, insetrect(s->r, inset));
if(Dx(isect) >= 0 && Dy(isect) >= 0)
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/fs.c Sat May 29 18:03:14 2010 -0400
@@ -212,7 +212,7 @@
s->muid = user;
}
-/*
+/*
* All lookups and directory organization should be performed through
* lookup_file, mostly through the dirtab[] tree.
*/
@@ -399,7 +399,7 @@
int size;
char *buf;
IxpFileId *f;
-
+
f = r->fid->aux;
if(!ixp_srv_verifyfile(f, lookup_file)) {
@@ -578,7 +578,7 @@
void
fs_open(Ixp9Req *r) {
IxpFileId *f;
-
+
f = r->fid->aux;
if(!ixp_srv_verifyfile(f, lookup_file)) {
@@ -608,7 +608,7 @@
void
fs_create(Ixp9Req *r) {
IxpFileId *f;
-
+
f = r->fid->aux;
switch(f->tab.type) {
@@ -639,7 +639,7 @@
fs_remove(Ixp9Req *r) {
IxpFileId *f;
WMScreen *s;
-
+
f = r->fid->aux;
if(!ixp_srv_verifyfile(f, lookup_file)) {
respond(r, Enofile);
@@ -663,7 +663,7 @@
void
fs_clunk(Ixp9Req *r) {
IxpFileId *f;
-
+
f = r->fid->aux;
if(!ixp_srv_verifyfile(f, lookup_file)) {
respond(r, nil);
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/layout.c
--- a/cmd/wmii/layout.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/layout.c Sat May 29 18:03:14 2010 -0400
@@ -48,7 +48,7 @@
r = rectaddpt(r, f->pt);
scrn = f->screen;
- if (scrn == -1)
+ if(scrn == -1)
scrn = max(ownerscreen(f->f->r), 0);
/* Keep onscreen */
@@ -72,7 +72,7 @@
Framewin *fw;
fw = emallocz(sizeof *fw);
- wa.override_redirect = true;
+ wa.override_redirect = true;
wa.event_mask = ExposureMask;
fw->w = createwindow(&scr.root, Rect(0, 0, 1, 1),
scr.depth, InputOutput,
@@ -88,7 +88,7 @@
raisewin(fw->w);
- return fw;
+ return fw;
}
static void
@@ -103,20 +103,20 @@
Framewin *f;
Image *buf;
CTuple *c;
-
+
USED(e);
f = aux;
c = &def.focuscolor;
buf = disp.ibuf;
-
+
r = rectsubpt(w->r, w->r.min);
fill(buf, r, c->bg);
border(buf, r, 1, c->border);
border(buf, f->grabbox, 1, c->border);
border(buf, insetrect(f->grabbox, -f->grabbox.min.x), 1, c->border);
- copyimage(w, r, buf, ZP);
+ copyimage(w, r, buf, ZP);
return false;
}
@@ -202,7 +202,7 @@
Area *a;
View *v;
int minw;
-
+
v = selview;
a = find_area(pt);
@@ -223,7 +223,7 @@
pt.y = a->r.min.y;
frameadjust(fw, pt, OVert, Dy(a->r));
- reshapewin(fw->w, framerect(fw));
+ reshapewin(fw->w, framerect(fw));
}
static Point
@@ -449,6 +449,7 @@
case ButtonRelease:
if(!moved)
goto done;
+
if(button != 1)
continue;
SET(collapsed);
@@ -586,7 +587,8 @@
warppointer(grabboxcenter(f));
}
map_frame(f->client);
- focus(f->client, false);
+ if(!f->collapsed)
+ focus(f->client, false);
ret = TDone;
if(!grabpointer(c->framewin, nil, cursor[CurMove], MouseMask))
@@ -596,7 +598,10 @@
origin = f->r;
frect = f->r;
- pt = querypointer(&scr.root);
+ if(!readmotion(&pt)) {
+ focus(f->client, false);
+ goto done;
+ }
/* pt1 = grabboxcenter(f); */
pt1 = pt;
goto case_motion;
@@ -622,6 +627,10 @@
case ButtonRelease:
if(button != 1)
continue;
+ if(!moved) {
+ f->collapsed = !f->collapsed;
+ client_resize(f->client, f->floatr);
+ }
goto done;
case ButtonPress:
if(button != 3)
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/message.c
--- a/cmd/wmii/message.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/message.c Sat May 29 18:03:14 2010 -0400
@@ -550,7 +550,7 @@
if(s == nil)
return nil;
- /*
+ /*
* area ::= ~
* | <column number>
* | sel
@@ -578,7 +578,7 @@
* | ~
* | <column> <frame number>
* | <column>
- * amount ::=
+ * amount ::=
* | <number>
* | <number>px
*
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/mouse.c Sat May 29 18:03:14 2010 -0400
@@ -77,7 +77,7 @@
gethsep(Rectangle r) {
Window *w;
WinAttr wa;
-
+
wa.background_pixel = def.normcolor.border.pixel;
w = createwindow(&scr.root, r, scr.depth, InputOutput, &wa, CWBackPixel);
mapwin(w);
@@ -152,7 +152,7 @@
snap_rect(const Rectangle *rects, int num, Rectangle *r, Align *mask, int snap) {
Align ret;
Point d;
-
+
d.x = snap+1;
d.y = snap+1;
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/rule.c
--- a/cmd/wmii/rule.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/rule.c Sat May 29 18:03:14 2010 -0400
@@ -41,7 +41,7 @@
char *r, *v;
const char *p;
char c;
-
+
SET(r);
SET(v);
diff -r 41b5c6cce5db -r 716aaca4dff2 cmd/wmii/view.c
--- a/cmd/wmii/view.c Sat May 29 14:10:31 2010 -0400
+++ b/cmd/wmii/view.c Sat May 29 18:03:14 2010 -0400
@@ -86,7 +86,6 @@
for(i=0; i < nscreens; i++)
view_init(v, i);
-
area_focus(v->firstarea);
v->next = *vp;
@@ -332,7 +331,7 @@
void
view_focus(WMScreen *s, View *v) {
-
+
USED(s);
_view_select(v);
@@ -360,7 +359,7 @@
Client *c;
Frame *ff;
Area *a, *oldsel;
-
+
c = f->client;
oldsel = v->oldsel;
@@ -450,7 +449,7 @@
Frame *f;
Area *a;
int s;
-
+
if(v != selview)
return;
Received on Sat May 29 2010 - 22:03:33 UTC
This archive was generated by hypermail 2.2.0 : Sat May 29 2010 - 22:12:03 UTC