JDK-5091224 : Non-focusable windows steal focus from desktop windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-08-24
  • Updated: 2006-02-07
  • Resolved: 2006-02-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Name: dm97671			Date: 08/24/2004


It has been noticed that while non-focusable Windows in Java might not
steal focus from Java Windows of the same application, they usually do
steal focus from Windows of other applications on the desktop. We should
investigate if it is possible to implement non-focusable windows that
are non-focusable for the desktop.

Example of this behavior is the one that is provied by Win32 API flags
WS_EX_NOACTIVATE.
======================================================================

Comments
EVALUATION The suggested fix is for Win2K ang greater. New CR for Win9x has been filed - 6371856.
2006-01-12

SUGGESTED FIX ------- awt_Window.cpp ------- *** /tmp/sccs.3oaqnG Thu Dec 29 15:31:03 2005 --- awt_Window.cpp Thu Dec 29 15:19:46 2005 *************** *** 1722,1733 **** AwtWindow *window = NULL; PDATA pData; JNI_CHECK_PEER_GOTO(self, ret); window = (AwtWindow *)pData; ! window->SetFocusableWindow(isFocusableWindow); ! ret: env->DeleteGlobalRef(self); delete sfws; } --- 1722,1742 ---- AwtWindow *window = NULL; PDATA pData; JNI_CHECK_PEER_GOTO(self, ret); window = (AwtWindow *)pData; ! ! if (IS_WIN2000) { ! if (!isFocusableWindow) { ! window->SetStyleEx(window->GetStyleEx() | WS_EX_APPWINDOW | AWT_WS_EX_NOACTIVATE); ! } else { ! window->SetStyleEx(window->GetStyleEx() & ~WS_EX_APPWINDOW & ~AWT_WS_EX_NOACTIVATE); ! } ! } ! ! window->SetFocusableWindow(isFocusableWindow); ! ret: env->DeleteGlobalRef(self); delete sfws; } ------- awt_Window.h ------- *** /tmp/sccs.IAaqvG Thu Dec 29 15:31:03 2005 --- awt_Window.h Thu Dec 29 15:18:49 2005 *************** *** 18,27 **** --- 18,30 ---- #ifndef WH_MOUSE_LL #define WH_MOUSE_LL 14 #endif + // WS_EX_NOACTIVATE is not defined in the headers we build with + #define AWT_WS_EX_NOACTIVATE 0x08000000L + class AwtFrame; /************************************************************************ * AwtWindow class */
2005-12-29

EVALUATION WS_EX_NOACTIVATE window style can be used here.
2005-12-27