JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
removed maximize, there will be monocle soon
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index b1a192d..259327d 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -119,6 +119,8 @@ typedef struct {
 typedef struct {
        int id;
        Window barwin;
+//TODO: Window root;
+//TODO: int screen;
        int sx, sy, sw, sh, wax, way, wah, waw;
        DC dc;
        Bool *seltags;
@@ -172,7 +174,6 @@ void leavenotify(XEvent *e);
 void manage(Window w, XWindowAttributes *wa);
 void mappingnotify(XEvent *e);
 void maprequest(XEvent *e);
-void maximize(const char *arg);
 void movemouse(Client *c);
 Client *nexttiled(Client *c, Monitor *m);
 void propertynotify(XEvent *e);
@@ -295,7 +296,7 @@ applyrules(Client *c) {
        if(ch.res_name)
                XFree(ch.res_name);
        if(!matched_tag)
-               memcpy(c->tags, monitors[monitorat(-1, -1)].seltags, sizeof seltags);
+               memcpy(c->tags, monitors[monitorat(-1, -1)].seltags, sizeof initags);
        if (!matched_monitor)
                c->monitor = monitorat(-1, -1);
 }
@@ -1054,7 +1055,7 @@ manage(Window w, XWindowAttributes *wa) {
        XWindowChanges wc;
 
        c = emallocz(sizeof(Client));
-       c->tags = emallocz(sizeof seltags);
+       c->tags = emallocz(sizeof initags);
        c->win = w;
 
        applyrules(c);
@@ -1098,7 +1099,7 @@ manage(Window w, XWindowAttributes *wa) {
        if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
                for(t = clients; t && t->win != trans; t = t->next);
        if(t)
-               memcpy(c->tags, t->tags, sizeof seltags);
+               memcpy(c->tags, t->tags, sizeof initags);
        if(!c->isfloating)
                c->isfloating = (rettrans == Success) || c->isfixed;
        attach(c);
@@ -1133,15 +1134,6 @@ maprequest(XEvent *e) {
 }
 
 void
-maximize(const char *arg) {
-/*
-       if(!sel || (!sel->isfloating && layout->arrange != floating))
-               return;
-       resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
-*/
-}
-
-void
 movemouse(Client *c) {
        int x1, y1, ocx, ocy, di, nx, ny;
        unsigned int dui;
@@ -1179,7 +1171,7 @@ movemouse(Client *c) {
                        else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
                                ny = m->way + m->wah - c->h - 2 * c->border;
                        resize(c, nx, ny, c->w, c->h, False);
-                       memcpy(c->tags, monitors[monitorat(nx, ny)].seltags, sizeof seltags);
+                       memcpy(c->tags, monitors[monitorat(nx, ny)].seltags, sizeof initags);
                        break;
                }
        }
@@ -1589,11 +1581,11 @@ setup(void) {
                }
 
                monitors[i].id = i;
-               monitors[i].seltags = emallocz(LENGTH(tags)*sizeof(char*));
-               monitors[i].prevtags = emallocz(LENGTH(tags)*sizeof(char*));
+               monitors[i].seltags = emallocz(sizeof initags);
+               monitors[i].prevtags = emallocz(sizeof initags);
 
-               memcpy(monitors[i].seltags, seltags, sizeof seltags);
-               memcpy(monitors[i].prevtags, seltags, sizeof seltags);
+               memcpy(monitors[i].seltags, initags, sizeof initags);
+               memcpy(monitors[i].prevtags, initags, sizeof initags);
 
                /* init appearance */
                monitors[i].dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
@@ -1948,7 +1940,7 @@ view(const char *arg) {
 
        Monitor *m = &monitors[monitorat(-1, -1)];
 
-       memcpy(m->prevtags, seltags, sizeof seltags);
+       memcpy(m->prevtags, m->seltags, sizeof initags);
        for(i = 0; i < LENGTH(tags); i++)
                m->seltags[i] = (NULL == arg);
        m->seltags[idxoftag(arg)] = True;
@@ -1961,9 +1953,9 @@ viewprevtag(const char *arg) {
 
        Monitor *m = &monitors[monitorat(-1, -1)];
 
-       memcpy(tmp, m->seltags, sizeof seltags);
-       memcpy(m->seltags, m->prevtags, sizeof seltags);
-       memcpy(m->prevtags, tmp, sizeof seltags);
+       memcpy(tmp, m->seltags, sizeof initags);
+       memcpy(m->seltags, m->prevtags, sizeof initags);
+       memcpy(m->prevtags, tmp, sizeof initags);
        arrange();
 }
 
@@ -2009,7 +2001,7 @@ movetomonitor(const char *arg) {
        if (sel) {
                sel->monitor = arg ? atoi(arg) : (sel->monitor+1) % mcount;
 
-               memcpy(sel->tags, monitors[sel->monitor].seltags, sizeof seltags);
+               memcpy(sel->tags, monitors[sel->monitor].seltags, sizeof initags);
                resize(sel, monitors[sel->monitor].wax, monitors[sel->monitor].way, sel->w, sel->h, True);
                arrange();
        }