[hackers] [wmii] Attempt to fix dosbox/SDL focus issues.

From: sqweek <sqweek_AT_gmail.com>
Date: Sun Oct 07 20:12:35 2007

changeset: 2220:fbc6916e4bdc
tag: tip
user: sqweek <sqweek_AT_gmail.com>
date: Mon Oct 08 02:03:02 2007 +0800
summary: Attempt to fix dosbox/SDL focus issues.

diff -r e41aec8e114a -r fbc6916e4bdc cmd/wmii/client.c
--- a/cmd/wmii/client.c Thu Oct 04 06:30:43 2007 +0200
+++ b/cmd/wmii/client.c Mon Oct 08 02:03:02 2007 +0800
@@ -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);
         }
 }
 
diff -r e41aec8e114a -r fbc6916e4bdc cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Thu Oct 04 06:30:43 2007 +0200
+++ b/cmd/wmii/x11.c Mon Oct 08 02:03:02 2007 +0800
@@ -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 */
Received on Sun Oct 07 2007 - 20:12:35 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:58:29 UTC