implemented select command for /tag/X/ctl

This commit is contained in:
Anselm R. Garbe 2006-06-19 16:05:02 +02:00
parent 3078597d0a
commit 8b8b9ada47
5 changed files with 37 additions and 24 deletions

View File

@ -82,6 +82,7 @@ select_area(Area *a, char *arg)
Area *new;
unsigned int i;
View *v = a->view;
Frame *f = a->sel, *p;
v->revert = a;
@ -105,6 +106,18 @@ select_area(Area *a, char *arg)
return;
new = a->next ? a->next : a;
}
else if(!strncmp(arg, "up", 3)) {
for(p=a->frame; p->anext && p->anext != f; p=p->anext);
focus_client(p->client, True);
flush_masked_events(EnterWindowMask);
return;
}
else if(!strncmp(arg, "down", 5)) {
p = f->anext ? f->anext : a->frame;
focus_client(p->client, True);
flush_masked_events(EnterWindowMask);
return;
}
else {
if(sscanf(arg, "%d", &i) != 1)
return;

View File

@ -603,26 +603,6 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall)
configure_client(c);
}
void
select_client(Client *c, char *arg)
{
unsigned int i;
Frame *f = c->sel, *r;
Area *a = f->area;
if(!strncmp(arg, "prev", 5))
for(r=a->frame; r->anext && r->anext != f; r=r->anext);
else if(!strncmp(arg, "next", 5))
r = f->anext ? f->anext : a->frame;
else {
if(sscanf(arg, "%d", &i) != 1)
return;
for(r=a->frame; i && r->anext; r=r->anext, i--);
}
focus_client(r->client, True);
flush_masked_events(EnterWindowMask);
}
void
newcol_client(Client *c, char *arg)
{
@ -897,3 +877,15 @@ apply_rules(Client *c)
if(!strlen(c->tags))
apply_tags(c, "nil");
}
char *
message_client(Client *c, char *message)
{
static char Ebadcmd[] = "bad command";
if(!strncmp(message, "kill", 5)) {
kill_client(c);
return nil;
}
return Ebadcmd;
}

View File

@ -670,6 +670,14 @@ fs_write(Req *r) {
draw_clients();
r->ofcall.count = r->ifcall.count - i;
return respond(r, nil);
case FsFCctl:
data_to_cstring(r);
if(r->ifcall.count == 0)
return respond(r, nil);
if((errstr = message_client(f->client, (char *)r->ifcall.data)))
return respond(r, errstr);
r->ofcall.count = r->ifcall.count;
return respond(r, nil);
case FsFTctl:
data_to_cstring(r);
if(r->ifcall.count == 0)

View File

@ -240,7 +240,6 @@ void manage_client(Client *c);
void focus_client(Client *c, Bool restack);
void focus(Client *c, Bool restack);
void resize_client(Client *c, XRectangle *r, Bool ignore_xcall);
void select_client(Client *c, char *arg);
Client *selected_client();
void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
char *send_client(Frame *f, char *arg);
@ -257,6 +256,7 @@ void draw_clients();
void update_client_grab(Client *c, Bool is_sel);
void apply_rules(Client *c);
void apply_tags(Client *c, const char *tags);
char *message_client(Client *c, char *message);
/* column.c */
void arrange_column(Area *a, Bool dirty);

View File

@ -139,11 +139,11 @@ do
$MODKEY-$RIGHT)
xwrite /tag/sel/ctl select next;;
$MODKEY-$DOWN)
xwrite /client/sel/ctl select next;;
xwrite /tag/sel/ctl select down;;
$MODKEY-$UP)
xwrite /client/sel/ctl select prev;;
xwrite /tag/sel/ctl select up;;
$MODKEY-space)
xwrite /client/sel/ctl select toggle;;
xwrite /tag/sel/ctl select 0;;
$MODKEY-d)
xwrite /tag/sel/sel/mode default;;
$MODKEY-s)