summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-19 15:05:29 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-19 15:05:29 +0100
commit238dd5d2b15b8bdc0f05d5be7f86a1ca03d2920b (patch)
tree8f08ae0a2fe2a6e40aa0a263f6d19ada4291215b /client.c
parentrenamed manage.c to view.c (diff)
downloaddwm-238dd5d2b15b8bdc0f05d5be7f86a1ca03d2920b.tar.gz
dwm-238dd5d2b15b8bdc0f05d5be7f86a1ca03d2920b.zip
renamed view.c into screen.c
Diffstat (limited to 'client.c')
-rw-r--r--client.c73
1 files changed, 60 insertions, 13 deletions
diff --git a/client.c b/client.c
index 45f2d19..eaf4a10 100644
--- a/client.c
+++ b/client.c
@@ -10,6 +10,19 @@
10/* static */ 10/* static */
11 11
12static void 12static void
13attachstack(Client *c) {
14 c->snext = stack;
15 stack = c;
16}
17
18static void
19detachstack(Client *c) {
20 Client **tc;
21 for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
22 *tc = c->snext;
23}
24
25static void
13grabbuttons(Client *c, Bool focused) { 26grabbuttons(Client *c, Bool focused) {
14 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 27 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
15 28
@@ -68,6 +81,24 @@ setclientstate(Client *c, long state) {
68 PropModeReplace, (unsigned char *)data, 2); 81 PropModeReplace, (unsigned char *)data, 2);
69} 82}
70 83
84static void
85togglemax(Client *c) {
86 XEvent ev;
87
88 if(c->isfixed)
89 return;
90 if((c->ismax = !c->ismax)) {
91 c->rx = c->x;
92 c->ry = c->y;
93 c->rw = c->w;
94 c->rh = c->h;
95 resize(c, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
96 }
97 else
98 resize(c, c->rx, c->ry, c->rw, c->rh, True);
99 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
100}
101
71static int 102static int
72xerrordummy(Display *dsply, XErrorEvent *ee) { 103xerrordummy(Display *dsply, XErrorEvent *ee) {
73 return 0; 104 return 0;
@@ -84,12 +115,6 @@ attach(Client *c) {
84} 115}
85 116
86void 117void
87attachstack(Client *c) {
88 c->snext = stack;
89 stack = c;
90}
91
92void
93configure(Client *c) { 118configure(Client *c) {
94 XConfigureEvent ce; 119 XConfigureEvent ce;
95 120
@@ -119,13 +144,6 @@ detach(Client *c) {
119} 144}
120 145
121void 146void
122detachstack(Client *c) {
123 Client **tc;
124 for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
125 *tc = c->snext;
126}
127
128void
129focus(Client *c) { 147focus(Client *c) {
130 if(c && !isvisible(c)) 148 if(c && !isvisible(c))
131 return; 149 return;
@@ -256,6 +274,12 @@ manage(Window w, XWindowAttributes *wa) {
256 arrange(); 274 arrange();
257} 275}
258 276
277Client *
278nexttiled(Client *c) {
279 for(; c && (c->isfloat || !isvisible(c)); c = c->next);
280 return c;
281}
282
259void 283void
260resize(Client *c, int x, int y, int w, int h, Bool sizehints) { 284resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
261 float actual, dx, dy, max, min; 285 float actual, dx, dy, max, min;
@@ -416,3 +440,26 @@ unmanage(Client *c) {
416 XUngrabServer(dpy); 440 XUngrabServer(dpy);
417 arrange(); 441 arrange();
418} 442}
443
444void
445zoom(Arg *arg) {
446 unsigned int n;
447 Client *c;
448
449 if(!sel)
450 return;
451 if(sel->isfloat || (arrange == dofloat)) {
452 togglemax(sel);
453 return;
454 }
455 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
456 n++;
457
458 if((c = sel) == nexttiled(clients))
459 if(!(c = nexttiled(c->next)))
460 return;
461 detach(c);
462 attach(c);
463 focus(c);
464 arrange();
465}