changeset: 2254:7e260e5ef3f5
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jan 22 21:21:59 2008 -0500
summary: Better revert handling. Still far from perfect.
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/area.c
--- a/cmd/wmii/area.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/area.c Tue Jan 22 21:21:59 2008 -0500
@@ -165,11 +165,12 @@ area_moveto(Area *to, Frame *f) {
}
area_detach(f);
- area_attach(to, f);
/* Temporary kludge. */
- if(!to->floating && to->floating != from->floating)
- column_resizeframe(f, &tr);
+ if(!to->floating && to->floating != from->floating) {
+ column_attachrect(to, f, tr);
+ }else
+ area_attach(to, f);
}
void
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/column.c
--- a/cmd/wmii/column.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/column.c Tue Jan 22 21:21:59 2008 -0500
@@ -70,6 +70,26 @@ column_attach(Area *a, Frame *f) {
column_insert(a, f, a->sel);
column_arrange(a, false);
+}
+
+void
+column_attachrect(Area *a, Frame *f, Rectangle r) {
+ Frame *fp, *pos;
+ int before, after;
+
+ pos = nil;
+ for(fp=a->frame; fp; pos=fp, fp=fp->anext) {
+ if(r.max.y < fp->r.min.y)
+ continue;
+ if(r.min.x > fp->r.max.y)
+ continue;
+ before = fp->r.min.y - r.min.y;
+ after = r.max.y - fp->r.max.y;
+ if(abs(before) <= abs(after))
+ break;
+ }
+ column_insert(a, f, pos);
+ column_resizeframe(f, r);
}
void
@@ -294,7 +314,7 @@ column_resize(Area *a, int w) {
}
static void
-column_resizeframe_h(Frame *f, Rectangle *r) {
+column_resizeframe_h(Frame *f, Rectangle r) {
Area *a;
Frame *fn, *fp;
uint minh;
@@ -306,29 +326,29 @@ column_resizeframe_h(Frame *f, Rectangle
fp = f->aprev;
if(fp)
- r->min.y = max(r->min.y, fp->r.min.y + minh);
- else
- r->min.y = max(r->min.y, a->r.min.y);
+ r.min.y = max(r.min.y, fp->r.min.y + minh);
+ else
+ r.min.y = max(r.min.y, a->r.min.y);
if(fn)
- r->max.y = min(r->max.y, fn->r.max.y - minh);
- else
- r->max.y = min(r->max.y, a->r.max.y);
+ r.max.y = min(r.max.y, fn->r.max.y - minh);
+ else
+ r.max.y = min(r.max.y, a->r.max.y);
if(fp) {
- fp->r.max.y = r->min.y;
+ fp->r.max.y = r.min.y;
frame_resize(fp, fp->r);
}
if(fn) {
- fn->r.min.y = r->max.y;
+ fn->r.min.y = r.max.y;
frame_resize(fn, fn->r);
}
- frame_resize(f, *r);
-}
-
-void
-column_resizeframe(Frame *f, Rectangle *r) {
+ frame_resize(f, r);
+}
+
+void
+column_resizeframe(Frame *f, Rectangle r) {
Area *a, *al, *ar;
View *v;
uint minw;
@@ -344,17 +364,17 @@ column_resizeframe(Frame *f, Rectangle *
al = nil;
if(al)
- r->min.x = max(r->min.x, al->r.min.x + minw);
- else
- r->min.x = max(r->min.x, v->r.min.x);
+ r.min.x = max(r.min.x, al->r.min.x + minw);
+ else
+ r.min.x = max(r.min.x, v->r.min.x);
if(ar)
- r->max.x = min(r->max.x, ar->r.max.x - minw);
- else
- r->max.x = min(r->max.x, v->r.max.x);
-
- a->r.min.x = r->min.x;
- a->r.max.x = r->max.x;
+ r.max.x = min(r.max.x, ar->r.max.x - minw);
+ else
+ r.max.x = min(r.max.x, v->r.max.x);
+
+ a->r.min.x = r.min.x;
+ a->r.max.x = r.max.x;
if(al) {
al->r.max.x = a->r.min.x;
column_arrange(al, false);
@@ -367,6 +387,7 @@ column_resizeframe(Frame *f, Rectangle *
column_resizeframe_h(f, r);
/* view_arrange(v); */
- view_focus(screen, v);
-}
-
+ if(v == screen->sel)
+ view_focus(screen, v);
+}
+
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/fns.h Tue Jan 22 21:21:59 2008 -0500
@@ -66,12 +66,13 @@ char* colmode2str(uint);
char* colmode2str(uint);
void column_arrange(Area*, bool dirty);
void column_attach(Area*, Frame*);
+void column_attachrect(Area*, Frame*, Rectangle);
void column_detach(Frame*);
void column_insert(Area*, Frame*, Frame*);
Area* column_new(View*, Area *, uint);
void column_remove(Frame*);
void column_resize(Area*, int);
-void column_resizeframe(Frame*, Rectangle*);
+void column_resizeframe(Frame*, Rectangle);
void div_draw(Divide*);
void div_set(Divide*, int x);
void div_update_all(void);
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/frame.c Tue Jan 22 21:21:59 2008 -0500
@@ -84,26 +84,35 @@ frame_insert(Frame *f, Frame *pos) {
if(a->floating) {
assert(f->sprev == nil);
- f->snext = a->stack;
- a->stack = f;
- if(f->snext)
- f->snext->sprev = f;
+ frame_restack(f, nil);
}
}
bool
frame_restack(Frame *f, Frame *above) {
+ Client *c;
+ Frame *fp;
Area *a;
+ c = f->client;
a = f->area;
if(!a->floating)
return false;
+
+ if(above == nil && !(c->w.ewmh.type & TypeDock))
+ for(fp=a->stack; fp; fp=fp->snext)
+ if(fp->client->w.ewmh.type & TypeDock)
+ above = fp;
+ else
+ break;
+
+ if(f->sprev || f == a->stack)
if(f->sprev == above)
return false;
if(f->sprev)
f->sprev->snext = f->snext;
- else
+ else if(f->snext)
a->stack = f->snext;
if(f->snext)
f->snext->sprev = f->sprev;
@@ -119,6 +128,10 @@ frame_restack(Frame *f, Frame *above) {
}
if(f->snext)
f->snext->sprev = f;
+
+ for(fp=a->stack; fp; fp=fp->snext)
+ print("[%C]%s\n", fp->client, clientname(fp->client));
+ print("\n");
return true;
}
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/fs.c Tue Jan 22 21:21:59 2008 -0500
@@ -232,23 +232,28 @@ write_buf(Ixp9Req *r, char *buf, uint le
/* This should be moved to libixp */
static void
write_to_buf(Ixp9Req *r, char **buf, uint *len, uint max) {
+ FileId *f;
+ char *p;
uint offset, count;
- char *p;
-
- offset = (r->fid->omode&OAPPEND) ? *len : r->ifcall.offset;
+
+ f = r->fid->aux;
+
+ offset = r->ifcall.offset;
+ if(f->tab.perm & DMAPPEND)
+ offset = *len;
+
if(offset > *len || r->ifcall.count == 0) {
r->ofcall.count = 0;
return;
}
count = r->ifcall.count;
- if(max && (count > max - offset))
+ if(max && (offset + count > max))
count = max - offset;
*len = offset + count;
if(max == 0)
*buf = erealloc(*buf, *len + 1);
-
p = *buf;
memcpy(p+offset, r->ifcall.data, count);
@@ -987,7 +992,9 @@ fs_open(Ixp9Req *r) {
void
fs_create(Ixp9Req *r) {
- FileId *f = r->fid->aux;
+ FileId *f;
+
+ f = r->fid->aux;
switch(f->tab.type) {
default:
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/mouse.c Tue Jan 22 21:21:59 2008 -0500
@@ -490,7 +490,7 @@ mouse_resizecolframe(Frame *f, Align ali
r.min.y = pt.y;
else
r.max.y = pt.y;
- column_resizeframe(f, &r);
+ column_resizeframe(f, r);
/* XXX: Magic number... */
if(align&West)
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/printevent.c
--- a/cmd/wmii/printevent.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/printevent.c Tue Jan 22 21:21:59 2008 -0500
@@ -508,7 +508,7 @@ pevent(void *e, ...) {
ev = e;
fmtprint(&f, "%3ld %-20s ", ev->serial, eventtype(ev->type));
if(ev->send_event)
- fmtprint(&f, "(sendevent) ");
+ fmtstrcpy(&f, "(sendevent) ");
n = 0;
va_start(ap, e);
@@ -526,7 +526,7 @@ pevent(void *e, ...) {
}
va_end(ap);
- fmtprint(&f, "\n");
+ fmtstrcpy(&f, "\n");
s = fmtstrflush(&f);
void dprint(const char*, ...);
diff -r da34a112f02f -r 7e260e5ef3f5 cmd/wmii/view.c
--- a/cmd/wmii/view.c Tue Jan 22 17:55:53 2008 -0500
+++ b/cmd/wmii/view.c Tue Jan 22 21:21:59 2008 -0500
@@ -276,10 +276,17 @@ view_restack(View *v) {
wins.n = 0;
fscrn = view_fullscreen_p(v);
+ /* *sigh */
+ for(f=v->area->stack; f; f=f->snext)
+ if(f->client->w.ewmh.type & TypeDock)
+ vector_lpush(&wins, f->client->framewin->w);
+ else
+ break;
+
if(!fscrn)
vector_lpush(&wins, screen->barwin->w);
- for(f=v->area->stack; f; f=f->snext)
+ for(; f; f=f->snext)
vector_lpush(&wins, f->client->framewin->w);
if(fscrn)
Received on Wed Jan 23 2008 - 03:23:26 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:07 UTC