author | arg@mig29 |
Fri, 01 Dec 2006 15:50:22 +0100 | |
changeset 603 | 213d67302d28 |
parent 581 | 601842ee4484 |
child 628 | a75123ef4b5f |
permissions | -rw-r--r-- |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
517
diff
changeset
|
1 |
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
5 | 2 |
* See LICENSE file for license details. |
3 |
*/ |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
4 |
#include "dwm.h" |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
5 |
#include <stdlib.h> |
5 | 6 |
#include <string.h> |
7 |
#include <X11/Xatom.h> |
|
32 | 8 |
#include <X11/Xutil.h> |
5 | 9 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
10 |
/* static functions */ |
50
148f25ed0ad7
several other additions/fixes, dwm is quite usable already
Anselm R. Garbe <garbeam@wmii.de>
parents:
49
diff
changeset
|
11 |
|
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
12 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
13 |
detachstack(Client *c) { |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
14 |
Client **tc; |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
15 |
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
16 |
*tc = c->snext; |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
17 |
} |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
18 |
|
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
19 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
20 |
grabbuttons(Client *c, Bool focused) { |
372
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
21 |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
22 |
|
452 | 23 |
if(focused) { |
372
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
24 |
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
25 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
26 |
XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
27 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
28 |
XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
29 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
30 |
XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
31 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
32 |
|
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
33 |
XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
34 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
35 |
XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
36 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
37 |
XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
38 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
39 |
XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
40 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
41 |
|
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
42 |
XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
43 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
44 |
XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
45 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
46 |
XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
47 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
48 |
XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
49 |
GrabModeAsync, GrabModeSync, None, None); |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
50 |
} |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
51 |
else |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
52 |
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, |
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
53 |
GrabModeAsync, GrabModeSync, None, None); |
318
1b45d6f14fca
applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents:
315
diff
changeset
|
54 |
} |
1b45d6f14fca
applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents:
315
diff
changeset
|
55 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
56 |
static int |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
57 |
xerrordummy(Display *dsply, XErrorEvent *ee) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
58 |
return 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
59 |
} |
5 | 60 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
61 |
/* extern functions */ |
5 | 62 |
|
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
63 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
64 |
ban(Client *c) { |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
65 |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
342 | 66 |
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
67 |
} |
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
68 |
|
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
69 |
void |
491
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
70 |
configure(Client *c) { |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
71 |
XEvent synev; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
72 |
|
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
73 |
synev.type = ConfigureNotify; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
74 |
synev.xconfigure.display = dpy; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
75 |
synev.xconfigure.event = c->win; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
76 |
synev.xconfigure.window = c->win; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
77 |
synev.xconfigure.x = c->x; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
78 |
synev.xconfigure.y = c->y; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
79 |
synev.xconfigure.width = c->w; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
80 |
synev.xconfigure.height = c->h; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
81 |
synev.xconfigure.border_width = c->border; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
82 |
synev.xconfigure.above = None; |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
83 |
XSendEvent(dpy, c->win, True, NoEventMask, &synev); |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
84 |
} |
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
85 |
|
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
86 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
87 |
focus(Client *c) { |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
88 |
Client *old; |
286 | 89 |
|
464
bd32d89ed9d5
focus() enforces visibility of a client if not NULL
arg@mmvi
parents:
461
diff
changeset
|
90 |
if(!issel || (c && !isvisible(c))) |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
232
diff
changeset
|
91 |
return; |
319
94d2d7658673
after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents:
318
diff
changeset
|
92 |
if(!sel) |
94d2d7658673
after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents:
318
diff
changeset
|
93 |
sel = c; |
94d2d7658673
after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents:
318
diff
changeset
|
94 |
else if(sel != c) { |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
95 |
old = sel; |
319
94d2d7658673
after switching to OpenBSD again, I switched back to a saner color scheme
arg@localhost.10kloc.org
parents:
318
diff
changeset
|
96 |
sel = c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
97 |
if(old) { |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
98 |
grabbuttons(old, False); |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
99 |
drawtitle(old); |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
100 |
} |
318
1b45d6f14fca
applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents:
315
diff
changeset
|
101 |
} |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
102 |
if(c) { |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
103 |
detachstack(c); |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
104 |
c->snext = stack; |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
105 |
stack = c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
106 |
grabbuttons(c, True); |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
107 |
drawtitle(c); |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
108 |
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
109 |
} |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
110 |
else |
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
111 |
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
112 |
} |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
113 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
114 |
Client * |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
115 |
getclient(Window w) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
116 |
Client *c; |
123 | 117 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
118 |
for(c = clients; c; c = c->next) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
119 |
if(c->win == w) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
120 |
return c; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
121 |
return NULL; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
122 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
123 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
124 |
Client * |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
125 |
getctitle(Window w) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
126 |
Client *c; |
123 | 127 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
128 |
for(c = clients; c; c = c->next) |
342 | 129 |
if(c->twin == w) |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
130 |
return c; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
131 |
return NULL; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
132 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
133 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
134 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
135 |
gravitate(Client *c, Bool invert) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
136 |
int dx = 0, dy = 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
137 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
138 |
switch(c->grav) { |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
124
diff
changeset
|
139 |
default: |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
124
diff
changeset
|
140 |
break; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
141 |
case StaticGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
142 |
case NorthWestGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
143 |
case NorthGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
144 |
case NorthEastGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
145 |
dy = c->border; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
146 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
147 |
case EastGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
148 |
case CenterGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
149 |
case WestGravity: |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
150 |
dy = -(c->h / 2) + c->border; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
151 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
152 |
case SouthEastGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
153 |
case SouthGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
154 |
case SouthWestGravity: |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
155 |
dy = -(c->h); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
156 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
157 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
158 |
switch (c->grav) { |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
124
diff
changeset
|
159 |
default: |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
124
diff
changeset
|
160 |
break; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
161 |
case StaticGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
162 |
case NorthWestGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
163 |
case WestGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
164 |
case SouthWestGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
165 |
dx = c->border; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
166 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
167 |
case NorthGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
168 |
case CenterGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
169 |
case SouthGravity: |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
170 |
dx = -(c->w / 2) + c->border; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
171 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
172 |
case NorthEastGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
173 |
case EastGravity: |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
174 |
case SouthEastGravity: |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
175 |
dx = -(c->w + c->border); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
176 |
break; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
177 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
178 |
if(invert) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
179 |
dx = -dx; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
180 |
dy = -dy; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
181 |
} |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
182 |
c->x += dx; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
183 |
c->y += dy; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
184 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
185 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
186 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
187 |
killclient(Arg *arg) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
188 |
if(!sel) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
189 |
return; |
157
93012e947eae
renamed WM_PROTOCOL_DELWIN into PROTODELWIN
arg@10ksloc.org
parents:
151
diff
changeset
|
190 |
if(sel->proto & PROTODELWIN) |
77 | 191 |
sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
192 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
193 |
XKillClient(dpy, sel->win); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
194 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
195 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
196 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
197 |
manage(Window w, XWindowAttributes *wa) { |
431
a230e4432bb7
moved transient_for tag inheritance to settags
Anselm R. Garbe <arg@10kloc.org>
parents:
430
diff
changeset
|
198 |
Client *c; |
123 | 199 |
Window trans; |
5 | 200 |
XSetWindowAttributes twa; |
201 |
||
202 |
c = emallocz(sizeof(Client)); |
|
178
e848966a1ac6
removed TLast tag enum, now tags is simple defined as char *[] array, the rest is calculated correctly, rules take an int array for the tags
arg@10ksloc.org
parents:
173
diff
changeset
|
203 |
c->tags = emallocz(ntags * sizeof(Bool)); |
5 | 204 |
c->win = w; |
546 | 205 |
c->border = 0; |
544 | 206 |
c->x = c->tx = wa->x; |
207 |
c->y = c->ty = wa->y; |
|
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
208 |
c->w = c->tw = wa->width; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
209 |
c->h = wa->height; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
210 |
c->th = bh; |
454
ffb462fb7903
small change to comments, renamed two set* functions in client.c into update*
Anselm R. Garbe <arg@10kloc.org>
parents:
452
diff
changeset
|
211 |
updatesize(c); |
502 | 212 |
if(c->x + c->w + 2 * BORDERPX > sw) |
213 |
c->x = sw - c->w - 2 * BORDERPX; |
|
517
2b4bd49fc155
applied ality's hardcode-0 patches
Anselm R. Garbe <arg@10kloc.org>
parents:
502
diff
changeset
|
214 |
if(c->x < sx) |
2b4bd49fc155
applied ality's hardcode-0 patches
Anselm R. Garbe <arg@10kloc.org>
parents:
502
diff
changeset
|
215 |
c->x = sx; |
502 | 216 |
if(c->y + c->h + 2 * BORDERPX > sh) |
517
2b4bd49fc155
applied ality's hardcode-0 patches
Anselm R. Garbe <arg@10kloc.org>
parents:
502
diff
changeset
|
217 |
c->y = sh - c->h - 2 * BORDERPX; |
163 | 218 |
if(c->h != sh && c->y < bh) |
314
8bafc3ac9f58
made a new client position strategy similiar to that one proposed by Sander, but which takes top bar into account
Anselm R.Garbe <arg@10ksloc.org>
parents:
313
diff
changeset
|
219 |
c->y = bh; |
75 | 220 |
c->proto = getproto(c->win); |
26
e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents:
23
diff
changeset
|
221 |
XSelectInput(dpy, c->win, |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
124
diff
changeset
|
222 |
StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
53 | 223 |
XGetTransientForHint(dpy, c->win, &trans); |
5 | 224 |
twa.override_redirect = 1; |
225 |
twa.background_pixmap = ParentRelative; |
|
161
f381e34158d9
implemented focus on enterwindow on titlebars
arg@10ksloc.org
parents:
159
diff
changeset
|
226 |
twa.event_mask = ExposureMask | EnterWindowMask; |
342 | 227 |
c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
20 | 228 |
0, DefaultDepth(dpy, screen), CopyFromParent, |
5 | 229 |
DefaultVisual(dpy, screen), |
230 |
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
|
372
a9b4077ec058
applied sanders focus_ patches
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
231 |
grabbuttons(c, False); |
500
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
232 |
updatetitle(c); |
431
a230e4432bb7
moved transient_for tag inheritance to settags
Anselm R. Garbe <arg@10kloc.org>
parents:
430
diff
changeset
|
233 |
settags(c, getclient(trans)); |
80
8125f908c80c
several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
234 |
if(!c->isfloat) |
549 | 235 |
c->isfloat = trans || c->isfixed; |
500
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
236 |
resizetitle(c); |
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
237 |
if(clients) |
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
238 |
clients->prev = c; |
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
239 |
c->next = clients; |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
240 |
c->snext = stack; |
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
241 |
stack = clients = c; |
408 | 242 |
ban(c); |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
243 |
XMapWindow(dpy, c->win); |
342 | 244 |
XMapWindow(dpy, c->twin); |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
254
diff
changeset
|
245 |
if(isvisible(c)) |
51 | 246 |
focus(c); |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
247 |
arrange(); |
94 | 248 |
} |
249 |
||
250 |
void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
251 |
resize(Client *c, Bool sizehints, Corner sticky) { |
123 | 252 |
int bottom = c->y + c->h; |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
253 |
int right = c->x + c->w; |
163 | 254 |
XWindowChanges wc; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
255 |
|
129
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
256 |
if(sizehints) { |
52
d18f6dd0cf23
fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents:
51
diff
changeset
|
257 |
if(c->incw) |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
258 |
c->w -= (c->w - c->basew) % c->incw; |
52
d18f6dd0cf23
fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents:
51
diff
changeset
|
259 |
if(c->inch) |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
260 |
c->h -= (c->h - c->baseh) % c->inch; |
129
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
261 |
if(c->minw && c->w < c->minw) |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
262 |
c->w = c->minw; |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
263 |
if(c->minh && c->h < c->minh) |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
264 |
c->h = c->minh; |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
265 |
if(c->maxw && c->w > c->maxw) |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
266 |
c->w = c->maxw; |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
267 |
if(c->maxh && c->h > c->maxh) |
c478383db7c9
applied sanders no_sizehints for tiled mode patch (thx!)
arg@10ksloc.org
parents:
128
diff
changeset
|
268 |
c->h = c->maxh; |
52
d18f6dd0cf23
fixed several things, nearly feature complete
Anselm R. Garbe <garbeam@wmii.de>
parents:
51
diff
changeset
|
269 |
} |
105 | 270 |
if(sticky == TopRight || sticky == BotRight) |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
271 |
c->x = right - c->w; |
105 | 272 |
if(sticky == BotLeft || sticky == BotRight) |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
273 |
c->y = bottom - c->h; |
465 | 274 |
/* offscreen appearance fixes */ |
517
2b4bd49fc155
applied ality's hardcode-0 patches
Anselm R. Garbe <arg@10kloc.org>
parents:
502
diff
changeset
|
275 |
if(c->x + c->w < sx) |
2b4bd49fc155
applied ality's hardcode-0 patches
Anselm R. Garbe <arg@10kloc.org>
parents:
502
diff
changeset
|
276 |
c->x = sx; |
465 | 277 |
if(c->y + c->h < bh) |
278 |
c->y = bh; |
|
279 |
if(c->x > sw) |
|
280 |
c->x = sw - c->w; |
|
281 |
if(c->y > sh) |
|
282 |
c->y = sh - c->h; |
|
75 | 283 |
resizetitle(c); |
163 | 284 |
wc.x = c->x; |
285 |
wc.y = c->y; |
|
286 |
wc.width = c->w; |
|
287 |
wc.height = c->h; |
|
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
163
diff
changeset
|
288 |
if(c->w == sw && c->h == sh) |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
163
diff
changeset
|
289 |
wc.border_width = 0; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
163
diff
changeset
|
290 |
else |
502 | 291 |
wc.border_width = BORDERPX; |
452 | 292 |
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); |
491
12395ef46d97
added configure(), but this doesn't really fix those frking broken SDL apps
arg@mmvi
parents:
479
diff
changeset
|
293 |
configure(c); |
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
77
diff
changeset
|
294 |
XSync(dpy, False); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
295 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
296 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
297 |
void |
500
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
298 |
resizetitle(Client *c) { |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
299 |
c->tw = textw(c->name); |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
300 |
if(c->tw > c->w) |
502 | 301 |
c->tw = c->w + 2 * BORDERPX; |
302 |
c->tx = c->x + c->w - c->tw + 2 * BORDERPX; |
|
500
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
303 |
c->ty = c->y; |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
304 |
if(isvisible(c)) |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
305 |
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
306 |
else |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
307 |
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
308 |
} |
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
309 |
|
d5ad819f2a66
fixing the settags issue, preparing 1.7.1
Anselm R. Garbe <arg@10kloc.org>
parents:
491
diff
changeset
|
310 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
311 |
updatesize(Client *c) { |
123 | 312 |
long msize; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
313 |
XSizeHints size; |
123 | 314 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
315 |
if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
316 |
size.flags = PSize; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
317 |
c->flags = size.flags; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
318 |
if(c->flags & PBaseSize) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
319 |
c->basew = size.base_width; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
320 |
c->baseh = size.base_height; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
321 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
322 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
323 |
c->basew = c->baseh = 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
324 |
if(c->flags & PResizeInc) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
325 |
c->incw = size.width_inc; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
326 |
c->inch = size.height_inc; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
327 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
328 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
329 |
c->incw = c->inch = 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
330 |
if(c->flags & PMaxSize) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
331 |
c->maxw = size.max_width; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
332 |
c->maxh = size.max_height; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
333 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
334 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
335 |
c->maxw = c->maxh = 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
336 |
if(c->flags & PMinSize) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
337 |
c->minw = size.min_width; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
338 |
c->minh = size.min_height; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
339 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
340 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
341 |
c->minw = c->minh = 0; |
550 | 342 |
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh && |
343 |
c->maxw == c->minw && c->maxh == c->minh); |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
344 |
if(c->flags & PWinGravity) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
345 |
c->grav = size.win_gravity; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
346 |
else |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
347 |
c->grav = NorthWestGravity; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
348 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
349 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
350 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
351 |
updatetitle(Client *c) { |
123 | 352 |
char **list = NULL; |
377 | 353 |
int n; |
123 | 354 |
XTextProperty name; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
355 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
356 |
name.nitems = 0; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
357 |
c->name[0] = 0; |
77 | 358 |
XGetTextProperty(dpy, c->win, &name, netatom[NetWMName]); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
359 |
if(!name.nitems) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
360 |
XGetWMName(dpy, c->win, &name); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
361 |
if(!name.nitems) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
362 |
return; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
363 |
if(name.encoding == XA_STRING) |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
550
diff
changeset
|
364 |
strncpy(c->name, (char *)name.value, sizeof c->name); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
365 |
else { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
366 |
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
367 |
&& n > 0 && *list) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
368 |
{ |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
550
diff
changeset
|
369 |
strncpy(c->name, *list, sizeof c->name); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
370 |
XFreeStringList(list); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
371 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
372 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
373 |
XFree(name.value); |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
374 |
} |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
375 |
|
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
376 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
377 |
unmanage(Client *c) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
448
diff
changeset
|
378 |
Client *nc; |
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
448
diff
changeset
|
379 |
|
472 | 380 |
/* The server grab construct avoids race conditions. */ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
381 |
XGrabServer(dpy); |
75 | 382 |
XSetErrorHandler(xerrordummy); |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
383 |
detach(c); |
448 | 384 |
detachstack(c); |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
385 |
if(sel == c) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
448
diff
changeset
|
386 |
for(nc = stack; nc && !isvisible(nc); nc = nc->snext); |
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
448
diff
changeset
|
387 |
focus(nc); |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
381
diff
changeset
|
388 |
} |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
389 |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
342 | 390 |
XDestroyWindow(dpy, c->twin); |
178
e848966a1ac6
removed TLast tag enum, now tags is simple defined as char *[] array, the rest is calculated correctly, rules take an int array for the tags
arg@10ksloc.org
parents:
173
diff
changeset
|
391 |
free(c->tags); |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
392 |
free(c); |
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
77
diff
changeset
|
393 |
XSync(dpy, False); |
74 | 394 |
XSetErrorHandler(xerror); |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
395 |
XUngrabServer(dpy); |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
396 |
arrange(); |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
397 |
} |