commit 477f54c7954df5956355759f544d0df9fd331318
parent 1a660ed815b68728ccef8e69c7339caef24beb5a
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Wed, 19 Apr 2006 16:53:40 +0200
fixed wmiimenu to only print the selected item if no text has been entered, otherwise the entered text is printed (this fixes several bugs due tag selection), also implemented mouse-driven column creation (though the discussed structural scaling change is not yet finished as discussed with Sander)
Diffstat:
4 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -563,16 +563,8 @@ send_client_to(Client *c, char *arg)
if(i > 1)
to = v->area.data[i - 1];
else if(a->frame.size > 1) {
- Area *p, *n;
- unsigned int j;
- if(!(p = to = create_area(v)))
+ if(!(to = new_left_column(v)))
return;
- for(j = 1; j < v->area.size; j++) {
- n = v->area.data[j];
- v->area.data[j] = p;
- p = n;
- }
- arrange_view(v, True);
}
else
return;
@@ -581,9 +573,8 @@ send_client_to(Client *c, char *arg)
if(i < v->area.size - 1)
to = v->area.data[i + 1];
else if(a->frame.size > 1) {
- if(!(to = create_area(v)))
+ if(!(to = new_right_column(v)))
return;
- arrange_view(v, True);
}
else
return;
diff --git a/cmd/wm/column.c b/cmd/wm/column.c
@@ -306,6 +306,11 @@ drop_moving(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))) {
+ int x = new->x + (2 * new->width / 3);
+ if(x < 0)
+ tgt = new_left_column(v);
+ else if(x > rect.width)
+ tgt = new_right_column(v);
if(tgt != src)
send_to_area(tgt, src, f->client);
else {
@@ -332,3 +337,28 @@ resize_column(Client *c, XRectangle *r, XPoint *pt)
else
drop_resize(f, r);
}
+
+Area *
+new_left_column(View *v) {
+ Area *a, *p, *n;
+ unsigned int i;
+ if(!(a = p = create_area(v)))
+ return nil;
+ for(i = 1; i < v->area.size; i++) {
+ n = v->area.data[i];
+ v->area.data[i] = p;
+ p = n;
+ }
+ arrange_view(v, True);
+ return a;
+}
+
+Area *
+new_right_column(View *v)
+{
+ Area *a;
+ if(!(a = create_area(v)))
+ return nil;
+ arrange_view(v, True);
+ return a;
+}
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -237,6 +237,8 @@ void arrange_column(Area *a, Bool dirty);
void resize_column(Client *c, XRectangle *r, XPoint *pt);
int column_mode_of_str(char *arg);
char *str_of_column_mode(int mode);
+Area *new_left_column(View *v);
+Area *new_right_column(View *v);
/* event.c */
void init_x_event_handler();
diff --git a/cmd/wmiimenu.c b/cmd/wmiimenu.c
@@ -239,10 +239,10 @@ handle_kpress(XKeyEvent * e)
sel++;
break;
case XK_Return:
- if(sel >= 0)
- fprintf(stdout, "%s", item.data[sel]);
- else if(text)
+ if(text)
fprintf(stdout, "%s", text);
+ else if(sel >= 0)
+ fprintf(stdout, "%s", item.data[sel]);
fflush(stdout);
done = True;
break;