From 762f2f1e9abddec2415d0ed16b10e366d7d8afe7 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 12 Aug 2008 04:54:01 +0200 Subject: [PATCH] [wmfs.c local.h] Remove 2 stupid function && Add clever macro --- local.h | 3 +-- wmfs.c | 33 ++++----------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/local.h b/local.h index 4cc4329..21a5b10 100644 --- a/local.h +++ b/local.h @@ -32,6 +32,7 @@ #define ALT Mod1Mask #define SHIFT ShiftMask #define LEN(x) (sizeof x / sizeof x[0]) +#define ITOA(p,n) sprintf(p,"%i",n) #define Move 0 #define Resize 1 #define MAXTAG 36 @@ -131,10 +132,8 @@ void setborder(Window win, int color); void setsizehints(Client *c); void spawn(char *cmd); void tag(char *cmd); -void tagn(int tag); void tagswitch(char *cmd); void tagtransfert(char *cmd); -void tagtransfertn(int n); void tile(char *cmd); void togglemax(char *cmd); void unhide(Client *c); diff --git a/wmfs.c b/wmfs.c index 6768e0f..0e8c43a 100644 --- a/wmfs.c +++ b/wmfs.c @@ -136,6 +136,7 @@ getevent(void) { XWindowChanges wc; Client *c; int i; + char s[6]; struct timeval tv; if(QLength(dpy) > 0) { XNextEvent(dpy, &event); @@ -247,11 +248,12 @@ getevent(void) { if(event.xbutton.x > taglen[i-1] && event.xbutton.x < taglen[i]) { if(event.xbutton.button == Button1) { + ITOA(s, i); if(event.xbutton.state & ALT) { - tagtransfertn(i); + tagtransfert(s); updateall(); } - tagn(i); + tag(s); updateall(); } } @@ -749,22 +751,6 @@ tag(char *cmd) { return; } -void -tagn(int tag) { - Client *c; - if(tag > conf.ntag || tag < 1 || tag == seltag) - return; - for(c = clients; c; c = c->next) { - if(!ishide(c)) - hide(c); - if(c->tag == tag) - unhide(c); - } - seltag = tag; - sel = NULL; - return; -} - void tagswitch(char *cmd) { Client *c; @@ -799,17 +785,6 @@ tagtransfert(char *cmd) { unhide(sel); } -void -tagtransfertn(int n) { - if(!sel) - return; - sel->tag = n; - if(n != seltag) - hide(sel); - if(n == seltag) - unhide(sel); -} - void tile(char *cmd) { if(sel) {