From 37f8ed2410ad5cbd46eda00a77f8bf4950bcf544 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sun, 23 Sep 2012 22:01:56 -0400 Subject: acme: mouse movement for Del If the mouse was in the tag of the old window, it was most likely pointing at Del. If bringing up a new window from below and not moving the mouse somewhere else, adjust it so that it ends up pointing at Del in the replacement window's tag too. This makes it easy to Del a sequence of windows in a column, from top to bottom. http://www.youtube.com/watch?v=ET8w6RT6u5M R=r http://codereview.appspot.com/6558047 --- src/cmd/acme/cols.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/cmd/acme/cols.c') diff --git a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c index 424358e7..5e16c21a 100644 --- a/src/cmd/acme/cols.c +++ b/src/cmd/acme/cols.c @@ -157,7 +157,7 @@ void colclose(Column *c, Window *w, int dofree) { Rectangle r; - int i; + int i, didmouse, up; /* w is locked */ if(!c->safe) @@ -171,7 +171,7 @@ colclose(Column *c, Window *w, int dofree) w->tag.col = nil; w->body.col = nil; w->col = nil; - restoremouse(w); + didmouse = restoremouse(w); if(dofree){ windelete(w); winclose(w); @@ -183,17 +183,24 @@ colclose(Column *c, Window *w, int dofree) draw(screen, r, display->white, nil, ZP); return; } + up = 0; if(i == c->nw){ /* extend last window down */ w = c->w[i-1]; r.min.y = w->r.min.y; r.max.y = c->r.max.y; }else{ /* extend next window up */ + up = 1; w = c->w[i]; r.max.y = w->r.max.y; } draw(screen, r, textcols[BACK], nil, ZP); - if(c->safe) + if(c->safe) { + if(!didmouse && up) + w->showdel = TRUE; winresize(w, r, FALSE, TRUE); + if(!didmouse && up) + movetodel(w); + } } void @@ -535,7 +542,7 @@ coldragwin(Column *c, Window *w, int but) r.max.y = c->w[i+1]->r.min.y-Border; winresize(w, r, c->safe, TRUE); c->safe = TRUE; - winmousebut(w); + winmousebut(w); } Text* -- cgit v1.2.3