From 7c83b3d24dc376c9b3566f3d774c7ac4c7f1cb5a Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 16 Jan 2012 22:17:00 +0100
Subject: NEWTWindow Focus: Skip requestFocus() if already owning focus;
 setFullscreen() requests focus 'later'.

We shall rely on the focus state, hence we can skip 'requestFocus()'
if we already own the focus. This allows a fast-path especially when called
from native code (mouse click).

Request focus 'later' on setFullscreen() allowing native WM to complete event handling,
this is required especially on X11 to guarantee a focused fullscreen window.
---
 src/newt/native/X11Window.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/newt/native/X11Window.c')

diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index 0a7e1cf77..8cc9952d6 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -263,7 +263,7 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, Display *dpy,
         // Avoid 'BadMatch' errors from XSetInputFocus, ie if window is not viewable
         XGetWindowAttributes(dpy, w, &xwa);
         if(xwa.map_state == IsViewable) {
-            DBG_PRINT( "X11: XSetInputFocus dpy %p,win %pd\n", dpy, (void*)w);
+            DBG_PRINT( "X11: XSetInputFocus dpy %p,win %p\n", dpy, (void*)w);
             XSetInputFocus(dpy, w, RevertToParent, CurrentTime);
         }
     }
-- 
cgit v1.2.3