about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--dwm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/dwm.c b/dwm.c
index ae9e16e..53e5cb2 100644
--- a/dwm.c
+++ b/dwm.c
@@ -137,6 +137,7 @@ void eprint(const char *errstr, ...);
 void expose(XEvent *e);
 void floating(void); /* default floating layout */
 void focus(Client *c);
+void focusin(XEvent *e);
 void focusnext(const char *arg);
 void focusprev(const char *arg);
 Client *getclient(Window w);
@@ -206,9 +207,10 @@ void (*handler[LASTEvent]) (XEvent *) = {
 	[ConfigureNotify] = configurenotify,
 	[DestroyNotify] = destroynotify,
 	[EnterNotify] = enternotify,
-	[LeaveNotify] = leavenotify,
 	[Expose] = expose,
+	[FocusIn] = focusin,
 	[KeyPress] = keypress,
+	[LeaveNotify] = leavenotify,
 	[MappingNotify] = mappingnotify,
 	[MapRequest] = maprequest,
 	[PropertyNotify] = propertynotify,
@@ -710,6 +712,14 @@ focus(Client *c) {
 }
 
 void
+focusin(XEvent *e) { /* there are some broken focus acquiring clients */
+	XFocusChangeEvent *ev = &e->xfocus;
+
+	if(sel && ev->window != sel->win)
+		XSetInputFocus(dpy, sel->win, RevertToPointerRoot, CurrentTime);
+}
+
+void
 focusnext(const char *arg) {
 	Client *c;
 
@@ -1026,8 +1036,7 @@ manage(Window w, XWindowAttributes *wa) {
 	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
 	configure(c); /* propagates border_width, if size doesn't change */
 	updatesizehints(c);
-	XSelectInput(dpy, w,
-		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
+	XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
 	grabbuttons(c, False);
 	updatetitle(c);
 	if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
ut <hut@lavabit.com> 2009-12-25 21:55:04 +0100 committer hut <hut@lavabit.com> 2009-12-25 21:55:04 +0100 updated pydoc pages' href='/akspecs/ranger/commit/doc/ranger.html?h=v1.6.0&id=f07bb12fc5c59430e995a64956b36331ce3629b9'>f07bb12f ^
34a60763 ^
f07bb12f ^
4c13e1f2 ^
34a60763 ^
b3556b21 ^
f07bb12f ^

62cd83ba ^










f07bb12f ^




62cd83ba ^

34a60763 ^

62cd83ba ^





2144cf26 ^
a614f048 ^
f07bb12f ^





62cd83ba ^
f07bb12f ^





62cd83ba ^
f07bb12f ^
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