]> git.armaanb.net Git - dwm.git/blobdiff - dwm.c
Initial commit
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index b0b3466881b84872a6b261cc1ed42afed08ac3bd..2202d3b90be4c9ec6eadc722152eb7af1e172972 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -40,6 +40,7 @@
 #include <X11/extensions/Xinerama.h>
 #endif /* XINERAMA */
 #include <X11/Xft/Xft.h>
+#include <X11/XF86keysym.h>
 
 #include "drw.h"
 #include "util.h"
@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
 static void arrange(Monitor *m);
 static void arrangemon(Monitor *m);
 static void attach(Client *c);
+static void attachbottom(Client *c);
 static void attachstack(Client *c);
 static void buttonpress(XEvent *e);
 static void checkotherwm(void);
@@ -407,6 +409,15 @@ attach(Client *c)
        c->mon->clients = c;
 }
 
+void
+attachbottom(Client *c)
+{
+       Client **tc;
+       c->next = NULL;
+       for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
+       *tc = c;
+}
+
 void
 attachstack(Client *c)
 {
@@ -522,7 +533,7 @@ clientmessage(XEvent *e)
                if (cme->data.l[1] == netatom[NetWMFullscreen]
                || cme->data.l[2] == netatom[NetWMFullscreen])
                        setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD    */
-                               || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
+                               || cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */));
        } else if (cme->message_type == netatom[NetActiveWindow]) {
                if (c != selmon->sel && !c->isurgent)
                        seturgent(c, 1);
@@ -552,7 +563,6 @@ void
 configurenotify(XEvent *e)
 {
        Monitor *m;
-       Client *c;
        XConfigureEvent *ev = &e->xconfigure;
        int dirty;
 
@@ -565,9 +575,6 @@ configurenotify(XEvent *e)
                        drw_resize(drw, sw, bh);
                        updatebars();
                        for (m = mons; m; m = m->next) {
-                               for (c = m->clients; c; c = c->next)
-                                       if (c->isfullscreen)
-                                               resizeclient(c, m->mx, m->my, m->mw, m->mh);
                                XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
                        }
                        focus(NULL);
@@ -835,7 +842,7 @@ focusstack(const Arg *arg)
 {
        Client *c = NULL, *i;
 
-       if (!selmon->sel || selmon->sel->isfullscreen)
+       if (!selmon->sel)
                return;
        if (arg->i > 0) {
                for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
@@ -1063,7 +1070,7 @@ manage(Window w, XWindowAttributes *wa)
                c->isfloating = c->oldstate = trans != None || c->isfixed;
        if (c->isfloating)
                XRaiseWindow(dpy, c->win);
-       attach(c);
+       attachbottom(c);
        attachstack(c);
        XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
                (unsigned char *) &(c->win), 1);
@@ -1144,8 +1151,6 @@ movemouse(const Arg *arg)
 
        if (!(c = selmon->sel))
                return;
-       if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
-               return;
        restack(selmon);
        ocx = c->x;
        ocy = c->y;
@@ -1299,8 +1304,6 @@ resizemouse(const Arg *arg)
 
        if (!(c = selmon->sel))
                return;
-       if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
-               return;
        restack(selmon);
        ocx = c->x;
        ocy = c->y;
@@ -1418,7 +1421,7 @@ sendmon(Client *c, Monitor *m)
        detachstack(c);
        c->mon = m;
        c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
-       attach(c);
+       attachbottom(c);
        attachstack(c);
        focus(NULL);
        arrange(NULL);
@@ -1477,24 +1480,10 @@ setfullscreen(Client *c, int fullscreen)
                XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
                        PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
                c->isfullscreen = 1;
-               c->oldstate = c->isfloating;
-               c->oldbw = c->bw;
-               c->bw = 0;
-               c->isfloating = 1;
-               resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
-               XRaiseWindow(dpy, c->win);
        } else if (!fullscreen && c->isfullscreen){
                XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
                        PropModeReplace, (unsigned char*)0, 0);
                c->isfullscreen = 0;
-               c->isfloating = c->oldstate;
-               c->bw = c->oldbw;
-               c->x = c->oldx;
-               c->y = c->oldy;
-               c->w = c->oldw;
-               c->h = c->oldh;
-               resizeclient(c, c->x, c->y, c->w, c->h);
-               arrange(c->mon);
        }
 }
 
@@ -1619,7 +1608,7 @@ showhide(Client *c)
        if (ISVISIBLE(c)) {
                /* show clients top down */
                XMoveWindow(dpy, c->win, c->x, c->y);
-               if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
+               if (!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
                        resize(c, c->x, c->y, c->w, c->h, 0);
                showhide(c->snext);
        } else {
@@ -1713,8 +1702,6 @@ togglefloating(const Arg *arg)
 {
        if (!selmon->sel)
                return;
-       if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
-               return;
        selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
        if (selmon->sel->isfloating)
                resize(selmon->sel, selmon->sel->x, selmon->sel->y,
@@ -1782,6 +1769,7 @@ unmanage(Client *c, int destroyed)
                XUngrabServer(dpy);
        }
        free(c);
+
        focus(NULL);
        updateclientlist();
        arrange(m);
@@ -1900,7 +1888,7 @@ updategeom(void)
                                        m->clients = c->next;
                                        detachstack(c);
                                        c->mon = mons;
-                                       attach(c);
+                                       attachbottom(c);
                                        attachstack(c);
                                }
                                if (m == selmon)