commit 1d61ace2642af29705843e17f5e038509ee8eace
parent 2cd180543cac1b1201ef2201213b63bb45e29746
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 9 May 2006 00:16:12 +0200
finished open issues reported by Sander
Diffstat:
3 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/cmd/wm/area.c b/cmd/wm/area.c
@@ -112,19 +112,15 @@ select_area(Area *a, char *arg)
else
i = 1;
} else if(!strncmp(arg, "prev", 5)) {
- if(i > 0) {
- if(i == 1)
- i = v->area.size - 1;
- else
- i--;
- }
+ if(i <= 1)
+ return;
+ else
+ i--;
} else if(!strncmp(arg, "next", 5)) {
- if(i > 0) {
- if(i + 1 < v->area.size)
- i++;
- else
- i = 1;
- }
+ if(i + 1 < v->area.size)
+ i++;
+ else
+ return;
}
else {
const char *errstr;
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -567,17 +567,17 @@ swap_client(Client *c, char *arg)
return;
if(!strncmp(arg, "prev", 5) && i) {
- if(i == 1)
- o = v->area.data[v->area.size - 1];
+ if(i <= 1)
+ return;
else
o = v->area.data[i - 1];
goto Swaparea;
}
else if(!strncmp(arg, "next", 5) && i) {
- if(i < v->area.size - 1)
+ if(i + 1 < v->area.size)
o = v->area.data[i + 1];
else
- o = v->area.data[1];
+ return;
Swaparea:
if(o == a)
return;
@@ -594,7 +594,7 @@ Swaparea:
if(j)
i = j - 1;
else
- i = a->frame.size - 1;
+ return;
a->frame.data[j] = a->frame.data[i];
a->frame.data[i] = f1;
}
@@ -602,7 +602,7 @@ Swaparea:
if(j + 1 < a->frame.size)
i = j + 1;
else
- i = 0;
+ return;
a->frame.data[j] = a->frame.data[i];
a->frame.data[i] = f1;
}
diff --git a/cmd/wm/column.c b/cmd/wm/column.c
@@ -362,31 +362,39 @@ drop_move(Frame *f, XRectangle *new, XPoint *pt)
for(i = 1; (i < v->area.size) &&
!blitz_ispointinrect(pt->x, pt->y, &v->area.data[i]->rect); i++);
- if((tgt = ((i < v->area.size) ? v->area.data[i] : nil))) {
- if(src != tgt) {
- int x = new->x + (new->width / 2);
- Bool new;
- if(x < 0) {
- tgt = new_left_column(v);
- new = True;
- }
- else if(x > rect.width) {
- tgt = new_right_column(v);
- new = True;
- }
- if(new)
- send_to_area(tgt, src, f->client);
- else {
- if(!(ft = frame_of_point(pt)) || (f == ft))
- return;
- send_to_area(tgt, src, f->client);
- goto InsertAtPointer;
- }
+ if(i < v->area.size) {
+ int x = new->x + (new->width / 2);
+ if(x < 0) {
+ tgt = new_left_column(v);
+ send_to_area(tgt, src, f->client);
+ }
+ else if(x > rect.width) {
+ tgt = new_right_column(v);
+ send_to_area(tgt, src, f->client);
+ }
+ else if(src != (tgt = v->area.data[i])) {
+ Client *c = f->client;
+ Bool before;
+ if(!(ft = frame_of_point(pt)) || (f == ft))
+ return;
+ fidx = idx_of_frame(ft);
+ before = pt->y < (ft->rect.y + ft->rect.height / 2);
+ send_to_area(tgt, src, c);
+
+ f = c->frame.data[c->sel];
+ cext_vdetach(vector_of_frames(&tgt->frame), f);
+
+ if(before)
+ insert_before_idx(&tgt->frame, f, fidx);
+ else
+ insert_after_idx(&tgt->frame, f, fidx);
+
+ tgt->sel = idx_of_frame(f);
+ arrange_column(tgt, False);
}
else {
if(!(ft = frame_of_point(pt)) || (f == ft))
return;
-InsertAtPointer:
cext_vdetach(vector_of_frames(&tgt->frame), f);
fidx = idx_of_frame(ft);