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
This commit is contained in:
parent
8ce7319b08
commit
55d6921b45
8 changed files with 49 additions and 2 deletions
11
client.c
11
client.c
|
@ -277,6 +277,9 @@ void dump_clients(void) {
|
|||
|
||||
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 @@ void shuffle(int up) {
|
|||
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)
|
||||
|
|
1
config.h
1
config.h
|
@ -60,6 +60,7 @@
|
|||
#define RESIZE_KEY XK_r
|
||||
#define DESTROY_KEY XK_d
|
||||
#define STICK_KEY XK_s
|
||||
#define ZOOM_KEY XK_z
|
||||
|
||||
#define STICKYTOFRONT_KEY XK_t
|
||||
#define STICKYTOBACK_KEY XK_b
|
||||
|
|
1
dat.h
1
dat.h
|
@ -157,6 +157,7 @@ extern int solidsweep;
|
|||
extern int numvirtuals;
|
||||
extern int scrolling;
|
||||
extern int ffm; /* focus follows mouse */
|
||||
extern int zoom;
|
||||
|
||||
extern Atom exit_rio;
|
||||
extern Atom restart_rio;
|
||||
|
|
5
event.c
5
event.c
|
@ -292,18 +292,23 @@ void newwindow(XCreateWindowEvent* e) {
|
|||
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;
|
||||
|
|
12
key.c
12
key.c
|
@ -47,6 +47,7 @@ void keysetup(void) {
|
|||
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
|
||||
|
@ -223,6 +224,14 @@ void keysetup(void) {
|
|||
0,
|
||||
GrabModeSync,
|
||||
GrabModeAsync);
|
||||
XGrabKey(
|
||||
dpy,
|
||||
zcode,
|
||||
SHORTCUTMOD,
|
||||
screens[i].root,
|
||||
0,
|
||||
GrabModeSync,
|
||||
GrabModeAsync);
|
||||
XGrabKey(
|
||||
dpy,
|
||||
tabcode,
|
||||
|
@ -271,6 +280,7 @@ void keypress(XKeyEvent* e) {
|
|||
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 @@ void keypress(XKeyEvent* e) {
|
|||
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))
|
||||
|
|
1
main.c
1
main.c
|
@ -43,6 +43,7 @@ int solidsweep = 0;
|
|||
int numvirtuals = 0;
|
||||
int ffm = 0;
|
||||
int kbLaunch = 0;
|
||||
int zoom = 0;
|
||||
|
||||
Atom exit_rio;
|
||||
Atom restart_rio;
|
||||
|
|
10
manage.c
10
manage.c
|
@ -219,6 +219,16 @@ int manage(Client* c, int mapped) {
|
|||
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 */
|
||||
|
|
10
menu.c
10
menu.c
|
@ -165,7 +165,7 @@ void button(XButtonEvent* e) {
|
|||
case Delete:
|
||||
shift = 0;
|
||||
c = selectwin(1, &shift, s);
|
||||
delete (c, shift);
|
||||
delete(c, shift);
|
||||
break;
|
||||
case Hide:
|
||||
hide(selectwin(1, 0, s));
|
||||
|
@ -260,10 +260,16 @@ void move(Client* c, int but) {
|
|||
}
|
||||
|
||||
void delete (Client* c, int shift) {
|
||||
int v;
|
||||
if (c == 0)
|
||||
return;
|
||||
if ((c->proto & Pdelete) && !shift)
|
||||
v = c->virt;
|
||||
if ((c->proto & Pdelete) && !shift) {
|
||||
sendcmessage(c->window, wm_protocols, wm_delete, 0, 0);
|
||||
if (v == virt) {
|
||||
shuffle(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
XKillClient(dpy, c->window); /* let event clean up */
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue