fixed focus steeling bug done by clients like opera

This commit is contained in:
Anselm R. Garbe 2007-11-17 19:59:13 +01:00
parent 4380db468a
commit 68ff133857
1 changed files with 12 additions and 3 deletions

15
dwm.c
View File

@ -137,6 +137,7 @@ void eprint(const char *errstr, ...);
void expose(XEvent *e); void expose(XEvent *e);
void floating(void); /* default floating layout */ void floating(void); /* default floating layout */
void focus(Client *c); void focus(Client *c);
void focusin(XEvent *e);
void focusnext(const char *arg); void focusnext(const char *arg);
void focusprev(const char *arg); void focusprev(const char *arg);
Client *getclient(Window w); Client *getclient(Window w);
@ -206,9 +207,10 @@ void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureNotify] = configurenotify, [ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify, [DestroyNotify] = destroynotify,
[EnterNotify] = enternotify, [EnterNotify] = enternotify,
[LeaveNotify] = leavenotify,
[Expose] = expose, [Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress, [KeyPress] = keypress,
[LeaveNotify] = leavenotify,
[MappingNotify] = mappingnotify, [MappingNotify] = mappingnotify,
[MapRequest] = maprequest, [MapRequest] = maprequest,
[PropertyNotify] = propertynotify, [PropertyNotify] = propertynotify,
@ -709,6 +711,14 @@ focus(Client *c) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
} }
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 void
focusnext(const char *arg) { focusnext(const char *arg) {
Client *c; Client *c;
@ -1026,8 +1036,7 @@ manage(Window w, XWindowAttributes *wa) {
XSetWindowBorder(dpy, w, dc.norm[ColBorder]); XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
configure(c); /* propagates border_width, if size doesn't change */ configure(c); /* propagates border_width, if size doesn't change */
updatesizehints(c); updatesizehints(c);
XSelectInput(dpy, w, XSelectInput(dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
grabbuttons(c, False); grabbuttons(c, False);
updatetitle(c); updatetitle(c);
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))