Attempt to fix dosbox/SDL focus issues.

This commit is contained in:
sqweek 2007-10-08 02:03:02 +08:00
parent 221ac73ebe
commit 379a3f7114
2 changed files with 11 additions and 2 deletions

View File

@ -330,7 +330,10 @@ focus_client(Client *c) {
Dprint("focus_client(%p[%C]) => %s\n", c, c, clientname(c));
if((c == nil || !c->noinput) && screen->focus != c) {
if (screen->focus == c)
return;
if(c == nil || !c->noinput) {
Dprint("\t%s => %s\n", clientname(screen->focus), clientname(c));
if(c)
@ -342,6 +345,8 @@ focus_client(Client *c) {
XSync(display, False);
flushevents(FocusChangeMask, True);
} else if(c && c->noinput) {
setfocus(nil, RevertToParent);
}
}

View File

@ -662,7 +662,11 @@ gettextproperty(Window *w, char *name) {
void
setfocus(Window *w, int mode) {
XSetInputFocus(display, w->w, mode, CurrentTime);
if(w) {
XSetInputFocus(display, w->w, mode, CurrentTime);
} else { /* "relinquish" focus */
XSetInputFocus(display, PointerRoot, mode, CurrentTime);
}
}
/* Mouse */