about summary refs log tree commit diff
path: root/dwm.c
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-18 13:12:55 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-18 13:12:55 +0200
commitd149050886e7d4e6c0f57bf8fc75e77e6a809cff (patch)
tree9d9f87ad80569961b860e44487bb9adc0e24b938 /dwm.c
parentAdded togglefullscreen patch and keybinding [Patch] (diff)
downloaddwm-d149050886e7d4e6c0f57bf8fc75e77e6a809cff.tar.gz
dwm-d149050886e7d4e6c0f57bf8fc75e77e6a809cff.tar.bz2
dwm-d149050886e7d4e6c0f57bf8fc75e77e6a809cff.zip
Modified togglefullscreen patch
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/dwm.c b/dwm.c
index c05ef8c..501661f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1773,29 +1773,10 @@ togglefloating(const Arg *arg)
 void
 togglefullscreen(const Arg *arg)
 {
-  if (!selmon->sel->isfullscreen) {
-		XChangeProperty(dpy, selmon->sel->win, netatom[NetWMState], XA_ATOM, 32,
-			PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
-		selmon->sel->isfullscreen = 1;
-		selmon->sel->oldstate = selmon->sel->isfloating;
-		selmon->sel->oldbw = selmon->sel->bw;
-		selmon->sel->bw = 0;
-		selmon->sel->isfloating = 1;
-		resizeclient(selmon->sel, selmon->sel->mon->mx, selmon->sel->mon->my, selmon->sel->mon->mw, selmon->sel->mon->mh);
-		XRaiseWindow(dpy, selmon->sel->win);
-	} else if (selmon->sel->isfullscreen){
-		XChangeProperty(dpy, selmon->sel->win, netatom[NetWMState], XA_ATOM, 32,
-			PropModeReplace, (unsigned char*)0, 0);
-		selmon->sel->isfullscreen = 0;
-		selmon->sel->isfloating = selmon->sel->oldstate;
-		selmon->sel->bw = selmon->sel->oldbw;
-		selmon->sel->x = selmon->sel->oldx;
-		selmon->sel->y = selmon->sel->oldy;
-		selmon->sel->w = selmon->sel->oldw;
-		selmon->sel->h = selmon->sel->oldh;
-		resizeclient(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h);
-		arrange(selmon->sel->mon);
-	}
+  if (!selmon->sel)
+    return;
+
+  setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
 }
 
 void