aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/WindowsWindow.c3
-rw-r--r--src/newt/native/X11Window.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 4bf2545ab..e1250811c 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -606,7 +607,7 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, BO
DBG_PRINT("*** WindowsWindow: requestFocus.S parent %p, window %p, isCurrent %d, reparented %d\n",
(void*) pHwnd, (void*)hwnd, current==hwnd, (int) reparented);
if(reparented || current!=hwnd) {
- if( JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) {
+ if( reparented || JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) {
UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if(reparented) {
flags |= SWP_FRAMECHANGED;
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index 350a0a704..8a07067b7 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -399,11 +400,12 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, Display *dpy,
Window focus_return;
int revert_to_return;
- XGetWindowAttributes(dpy, w, &xwa);
XGetInputFocus(dpy, &focus_return, &revert_to_return);
if(reparented || focus_return!=w) {
- // Avoid 'BadMatch' errors from XSetInputFocus, ie if window is not viewable
- if( JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) {
+ if( reparented || JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) {
+ XRaiseWindow(dpy, w);
+ // Avoid 'BadMatch' errors from XSetInputFocus, ie if window is not viewable
+ XGetWindowAttributes(dpy, w, &xwa);
if(xwa.map_state == IsViewable) {
XSetInputFocus(dpy, w, RevertToParent, CurrentTime);
}