diff options
author | Sven Gothel <[email protected]> | 2011-10-23 21:31:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-23 21:31:09 +0200 |
commit | b772c8416eada24696eaad638568ac8c24df60bc (patch) | |
tree | c01d6e3e1812e3b7fc2e23e69a1b0079fe0ea918 /src/newt/native/X11Window.c | |
parent | 2a00f1008e2be44e02e7b96f3b1cb6af210597f2 (diff) |
Partially revert cba9a070f9649bec42627631d393963d548e320c: Skip focusAction() and native focus request on X11/Windows. On both platforms it's not required (proper focus traversion) and AWT would deadlock on Windows
Diffstat (limited to 'src/newt/native/X11Window.c')
-rw-r--r-- | src/newt/native/X11Window.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 28806b652..f14138a0a 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -534,17 +534,17 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, Display *dpy, XGetInputFocus(dpy, &focus_return, &revert_to_return); DBG_PRINT( "X11: requestFocus dpy %p,win %p, force %d, hasFocus %d\n", dpy, (void*)w, force, focus_return==w); - // even if we already own the focus, we need the 'focusAction()' call - // and the other probably redundant X11 calls don't harm. - if( JNI_TRUE==force || JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) { - DBG_PRINT( "X11: XRaiseWindow dpy %p, win %p\n", dpy, (void*)w); - XRaiseWindow(dpy, w); - NewtWindows_setCWAbove(dpy, w); - // 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); - XSetInputFocus(dpy, w, RevertToParent, CurrentTime); + if( JNI_TRUE==force || focus_return!=w) { + if( JNI_TRUE==force || JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) { + DBG_PRINT( "X11: XRaiseWindow dpy %p, win %p\n", dpy, (void*)w); + XRaiseWindow(dpy, w); + NewtWindows_setCWAbove(dpy, w); + // 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); + XSetInputFocus(dpy, w, RevertToParent, CurrentTime); + } } } DBG_PRINT( "X11: requestFocus dpy %p,win %p, force %d - FIN\n", dpy, (void*)w, force); |