config.h, main.c, key.c, manage.c, client.c: add zoom mode (fullscreen everything); event.c, menu.c: don't leave us out of focus when deleting windows
Iris Lightshard nilix@nilfm.cc
M
client.c
→
client.c
@@ -277,6 +277,9 @@ #endif
void shuffle(int up) { Client **l, *c; + static XWindowAttributes ra; + + XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &ra); if (clients == 0 || clients->next == 0) return;@@ -297,6 +300,14 @@ return;
XMapRaised(dpy, c->parent); top(c); active(c); + if (zoom) { + quickreshape( + c, + -BORDER, + -BORDER, + ra.width + 2 * BORDER, + ra.height + 2 * BORDER); + } } else { c = clients; for (l = &clients; *l; l = &(*l)->next)
M
event.c
→
event.c
@@ -292,18 +292,23 @@
void destroy(Window w) { int i; Client* c; + int v; curtime = CurrentTime; c = getclient(w, 0); if (c == 0) return; + v = c->virt; if (numvirtuals > 1) for (i = 0; i < numvirtuals; i++) if (currents[i] == c) currents[i] = 0; rmclient(c); + if (v == virt) { + shuffle(0); + } /* flush any errors generated by the window's sudden demise */ ignore_badwindow = 1;
M
key.c
→
key.c
@@ -47,6 +47,7 @@ int ocode = XKeysymToKeycode(dpy, SNAPBOTTOMRIGHT_KEY);
int pcode = XKeysymToKeycode(dpy, SNAPTOPRIGHT_KEY); int ccode = XKeysymToKeycode(dpy, SNAPCENTER_KEY); int slcode = XKeysymToKeycode(dpy, LAUNCH_KEY); + int zcode = XKeysymToKeycode(dpy, ZOOM_KEY); int rightcode = XKeysymToKeycode(dpy, NEXTVIRT_KEY); int leftcode = XKeysymToKeycode(dpy, PREVVIRT_KEY); #ifdef DEVEL@@ -225,6 +226,14 @@ GrabModeSync,
GrabModeAsync); XGrabKey( dpy, + zcode, + SHORTCUTMOD, + screens[i].root, + 0, + GrabModeSync, + GrabModeAsync); + XGrabKey( + dpy, tabcode, Mod1Mask | ShiftMask, screens[i].root,@@ -271,6 +280,7 @@ int vcode = XKeysymToKeycode(dpy, MOVE_KEY);
int scode = XKeysymToKeycode(dpy, STICK_KEY); int rcode = XKeysymToKeycode(dpy, RESIZE_KEY); int slcode = XKeysymToKeycode(dpy, LAUNCH_KEY); + int zcode = XKeysymToKeycode(dpy, ZOOM_KEY); int hcode = XKeysymToKeycode(dpy, SNAPLEFT_KEY); int lcode = XKeysymToKeycode(dpy, SNAPRIGHT_KEY); int jcode = XKeysymToKeycode(dpy, SNAPBOTTOM_KEY);@@ -312,6 +322,8 @@ ra.width + 2 * BORDER,
ra.height + 2 * BORDER); else if (e->keycode == scode && (e->state & SHORTCUTMOD) == (MODBITS)) stick(current); + else if (e->keycode == zcode && (e->state & SHORTCUTMOD) == (MODBITS)) + zoom = !zoom; /* half snap */ else if (e->keycode == hcode && (e->state & SHORTCUTMOD) == (MODBITS))
M
manage.c
→
manage.c
@@ -219,6 +219,16 @@ if (current && (current != c))
cmapfocus(current); c->init = 1; + /* If we are in zoom mode, spawn the window maximized */ + if (zoom) { + quickreshape( + c, + -BORDER, + -BORDER, + ra.width + 2 * BORDER, + ra.height + 2 * BORDER); + } + /* If the window is out of bounds of the screen, try to wrangle it */ /* If it's bigger than the screen, try to set it maximized */