fixed focus steeling bug done by clients like opera 68ff1338
Anselm R. Garbe · 2007-11-17 19:59 1 file(s) · +12 −3
dwm.c +12 −3
137 137
void expose(XEvent *e);
138 138
void floating(void); /* default floating layout */
139 139
void focus(Client *c);
140 +
void focusin(XEvent *e);
140 141
void focusnext(const char *arg);
141 142
void focusprev(const char *arg);
142 143
Client *getclient(Window w);
206 207
	[ConfigureNotify] = configurenotify,
207 208
	[DestroyNotify] = destroynotify,
208 209
	[EnterNotify] = enternotify,
209 -
	[LeaveNotify] = leavenotify,
210 210
	[Expose] = expose,
211 +
	[FocusIn] = focusin,
211 212
	[KeyPress] = keypress,
213 +
	[LeaveNotify] = leavenotify,
212 214
	[MappingNotify] = mappingnotify,
213 215
	[MapRequest] = maprequest,
214 216
	[PropertyNotify] = propertynotify,
710 712
}
711 713
712 714
void
715 +
focusin(XEvent *e) { /* there are some broken focus acquiring clients */
716 +
	XFocusChangeEvent *ev = &e->xfocus;
717 +
718 +
	if(sel && ev->window != sel->win)
719 +
		XSetInputFocus(dpy, sel->win, RevertToPointerRoot, CurrentTime);
720 +
}
721 +
722 +
void
713 723
focusnext(const char *arg) {
714 724
	Client *c;
715 725
1026 1036
	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
1027 1037
	configure(c); /* propagates border_width, if size doesn't change */
1028 1038
	updatesizehints(c);
1029 -
	XSelectInput(dpy, w,
1030 -
		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
1039 +
	XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
1031 1040
	grabbuttons(c, False);
1032 1041
	updatetitle(c);
1033 1042
	if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))