From 8b8b9ada4750823e42d07d73dc4451b7d107ce12 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Mon, 19 Jun 2006 16:05:02 +0200 Subject: [PATCH] implemented select command for /tag/X/ctl --- cmd/wm/area.c | 13 +++++++++++++ cmd/wm/client.c | 32 ++++++++++++-------------------- cmd/wm/fs.c | 8 ++++++++ cmd/wm/wm.h | 2 +- rc/wmiirc | 6 +++--- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/cmd/wm/area.c b/cmd/wm/area.c index d8553361..41e1c5e8 100644 --- a/cmd/wm/area.c +++ b/cmd/wm/area.c @@ -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; diff --git a/cmd/wm/client.c b/cmd/wm/client.c index eaafa875..efee3936 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -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; +} diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c index e19ed2fe..44a2a2ce 100644 --- a/cmd/wm/fs.c +++ b/cmd/wm/fs.c @@ -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) diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 4a8e571a..d07bf833 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -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); diff --git a/rc/wmiirc b/rc/wmiirc index d6d5ef26..b5944195 100644 --- a/rc/wmiirc +++ b/rc/wmiirc @@ -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)