[hackers] [wmii] Fixed bug in destroying areas. Changed vertical managed moves.

From: Kris Maglione <jg_AT_suckless.org>
Date: Fri, 01 Jun 2007 01:09:27 -0000

changeset: 2091:03a3b69ded14
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Apr 17 14:41:22 2007 -0400
summary: Fixed bug in destroying areas. Changed vertical managed moves.

diff -r abd8d21b6f92 -r 03a3b69ded14 cmd/wmii/area.c
--- a/cmd/wmii/area.c Tue Apr 17 14:00:15 2007 -0400
+++ b/cmd/wmii/area.c Tue Apr 17 14:41:22 2007 -0400
@@ -118,7 +118,6 @@ destroy_area(Area *a) {
                 ta = a->next;
 
         assert(a->prev || a->next == nil);
-
         if(a->prev)
                 a->prev->next = a->next;
         if(a->next)
@@ -424,53 +423,58 @@ char *
 char *
 select_area(Area *a, char *arg) {
         static char Ebadvalue[] = "bad value";
- Area *new;
         uint i;
         Frame *p, *f;
+ Area *ap;
         View *v;
 
         v = a->view;
         f = a->sel;
- if(!strncmp(arg, "toggle", 7)) {
+ if(!strcmp(arg, "toggle")) {
                 if(!a->floating)
- new = v->area;
+ a = v->area;
                 else if(v->revert)
- new = v->revert;
- else
- new = v->area->next;
- } else if(!strncmp(arg, "left", 5)) {
+ a = v->revert;
+ else
+ a = v->area->next;
+ }
+ else if(!strcmp(arg, "left")) {
                 if(a->floating)
                         return Ebadvalue;
- new = a->prev;
- } else if(!strncmp(arg, "right", 5)) {
+ for(ap=v->area->next; ap->next; ap=ap->next)
+ if(ap->next == a) break;
+ }
+ else if(!strcmp(arg, "right")) {
                 if(a->floating)
                         return Ebadvalue;
- new = a->next;
- if(new == nil)
- new = v->area->next;
- }
- else if(!strncmp(arg, "up", 3)) {
+ ap = a->next;
+ if(ap == nil)
+ ap = v->area->next;
+ }
+ else if(!strcmp(arg, "up")) {
                 if(!f)
                         return Ebadvalue;
- p = f->aprev;
+ for(p = f->area->frame; p->anext; p = p->anext)
+ if(p->anext == f) break;
                 goto focus_frame;
         }
- else if(!strncmp(arg, "down", 5)) {
+ else if(!strcmp(arg, "down")) {
                 if(!f)
                         return Ebadvalue;
- p = f->anext ? f->anext : a->frame;
+ p = f->anext;
+ if(p == nil)
+ p = a->frame;
                 goto focus_frame;
         }
- else if(!strncmp(arg, "~", 2)) {
- new = v->area;
- }
+ else if(!strcmp(arg, "~"))
+ ap = v->area;
         else {
                 if(sscanf(arg, "%u", &i) != 1 || i == 0)
                         return Ebadvalue;
- for(new=v->area->next; new->next; new=new->next)
+ for(ap=v->area->next; ap; ap=ap->next)
                         if(!--i) break;
         }
- focus_area(new);
+ focus_area(ap);
         return nil;
 
 focus_frame:
diff -r abd8d21b6f92 -r 03a3b69ded14 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Tue Apr 17 14:00:15 2007 -0400
+++ b/cmd/wmii/frame.c Tue Apr 17 14:41:22 2007 -0400
@@ -42,6 +42,8 @@ remove_frame(Frame *f) {
                 f->aprev->anext = f->anext;
         if(f->anext)
                 f->anext->aprev = f->aprev;
+ if(f == a->frame)
+ a->frame = f->anext;
 
         if(a->floating) {
                 if(f->sprev)
@@ -49,6 +51,7 @@ remove_frame(Frame *f) {
                 if(f->snext)
                         f->snext->sprev = f->sprev;
         }
+ f->anext = f->aprev = f->snext = f->sprev = nil;
 }
 
 void
@@ -64,7 +67,6 @@ insert_frame(Frame *pos, Frame *f, Bool
                 f->aprev = pos;
                 f->anext = pos->anext;
         }else {
- f->aprev = nil;
                 f->anext = f->area->frame;
                 f->area->frame = f;
         }
diff -r abd8d21b6f92 -r 03a3b69ded14 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Tue Apr 17 14:00:15 2007 -0400
+++ b/cmd/wmii/mouse.c Tue Apr 17 14:41:22 2007 -0400
@@ -156,18 +156,20 @@ hplace(Framewin *fw, Point pt) {
 hplace(Framewin *fw, Point pt) {
         Area *a;
         View *v;
-
+ int minw;
+
+ minw = Dx(screen->rect)/NCOL;
         v = screen->sel;
 
         for(a = v->area->next; a->next; a = a->next)
                 if(pt.x < a->rect.max.x)
                         break;
 
- if(pt.x - a->rect.min.x < Dx(a->rect)/2)
+ if(abs(pt.x - a->rect.min.x) < minw/2)
                 pt.x = a->rect.min.x;
- else
+ else if(abs(pt.x - a->rect.max.x) < minw/2)
                 pt.x = a->rect.max.x;
-
+
         pt.y = a->rect.min.y;
         frameadjust(fw, pt, OVert, Dy(a->rect));
 }
Received on Fri Jun 01 2007 - 03:09:25 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:56 UTC