about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-28 20:29:41 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-28 20:29:41 +0100
commita5cb80b86cdedb8cd1f3a02de47f204bd174f649 (patch)
tree95ae3939b6ab82281ea076c34ffff73c662eacf5
parent7e98db251e383674440d75dc42d98ab6eed79ac7 (diff)
downloaddwm-a5cb80b86cdedb8cd1f3a02de47f204bd174f649.tar.gz
handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
-rw-r--r--client.c9
-rw-r--r--dwm.h2
-rw-r--r--main.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/client.c b/client.c
index e11abfd..badb875 100644
--- a/client.c
+++ b/client.c
@@ -53,6 +53,13 @@ grabbuttons(Client *c, Bool focused) {
 				GrabModeAsync, GrabModeSync, None, None);
 }
 
+static void
+setclientstate(Client *c, long state) {
+	long data[] = {state, None};
+	XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
+			PropModeReplace, (unsigned char *)data, 2);
+}
+
 static int
 xerrordummy(Display *dsply, XErrorEvent *ee) {
 	return 0;
@@ -169,6 +176,7 @@ manage(Window w, XWindowAttributes *wa) {
 	stack = clients = c;
 	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
 	XMapWindow(dpy, c->win);
+	setclientstate(c, NormalState);
 	if(isvisible(c))
 		focus(c);
 	arrange();
@@ -293,6 +301,7 @@ unmanage(Client *c) {
 		focus(nc);
 	}
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+	setclientstate(c, WithdrawnState);
 	free(c->tags);
 	free(c);
 	XSync(dpy, False);
diff --git a/dwm.h b/dwm.h
index e5c623d..1021428 100644
--- a/dwm.h
+++ b/dwm.h
@@ -40,7 +40,7 @@
 #define PROTODELWIN		1
 
 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
-enum { WMProtocols, WMDelete, WMLast };			/* default atoms */
+enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
 enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
 enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
 
diff --git a/main.c b/main.c
index 9cffafe..97fdbaf 100644
--- a/main.c
+++ b/main.c
@@ -92,6 +92,7 @@ setup(void) {
 	/* init atoms */
 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
kartik/mu/commit/subx/019functions.cc?h=hlt&id=c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01'>c442a5ad ^
62c6d163 ^
292ccba1 ^

c442a5ad ^
292ccba1 ^




4a943d4e ^

6f6d458f ^

4a943d4e ^

83c67014 ^
4a943d4e ^






6f6d458f ^
4a943d4e ^



292ccba1 ^


c442a5ad ^
222c31db ^
292ccba1 ^

c442a5ad ^

292ccba1 ^


4a943d4e ^
eb45b315 ^
6f6d458f ^

4a943d4e ^

83c67014 ^
4a943d4e ^


83c67014 ^
c82d149b ^
4a943d4e ^



6f6d458f ^
4a943d4e ^



292ccba1 ^


0f851e48 ^

aa2e2155 ^
4a943d4e ^

6f6d458f ^

36c745f8 ^
4a943d4e ^
83c67014 ^
4a943d4e ^

83c67014 ^
c82d149b ^
4a943d4e ^






292ccba1 ^


c442a5ad ^

292ccba1 ^
c442a5ad ^
292ccba1 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122