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)

This commit is contained in:
Anselm R. Garbe 2006-04-19 16:53:40 +02:00
parent 1a660ed815
commit 477f54c795
4 changed files with 37 additions and 14 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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();

View File

@ -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;