SUGGESTED FIX
src/windows/native/sun/windows/awt_PopupMenu.cpp
src/windows/native/sun/windows/awt_Window.cpp
src/windows/native/sun/windows/awt_Window.h
------- awt_PopupMenu.cpp -------
*** /tmp/sccs.UjaaMN Tue Feb 21 18:22:25 2006
--- awt_PopupMenu.cpp Tue Feb 21 16:42:10 2006
***************
*** 113,123 ****
pt.y -= rctInsets.top;
flags = TPM_LEFTALIGN | TPM_RIGHTBUTTON;
} else {
- ((AwtWindow*)awtOrigin)->SetFocusableWindow(TRUE); // for AwtWindow's focus hook
::SetForegroundWindow(awtOrigin->GetHWnd());
flags = TPM_NONOTIFY | TPM_RIGHTALIGN | TPM_RIGHTBUTTON | TPM_BOTTOMALIGN;
}
--- 113,122 ----
------- awt_Window.cpp -------
*** /tmp/sccs.staOTN Tue Feb 21 18:22:26 2006
--- awt_Window.cpp Tue Feb 21 18:11:27 2006
***************
*** 118,127 ****
--- 118,128 ----
// what's the best initial value?
m_screenNum = -1;
ms_instanceCounter++;
m_grabbed = FALSE;
+ m_isFocusableWindow = TRUE;
if (AwtWindow::ms_instanceCounter == 1) {
AwtWindow::ms_hCBTFilter =
::SetWindowsHookEx(WH_CBT, (HOOKPROC)AwtWindow::CBTFilter,
0, AwtToolkit::MainThread());
***************
*** 1740,1759 ****
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;
}
--- 1741,1761 ----
PDATA pData;
JNI_CHECK_PEER_GOTO(self, ret);
window = (AwtWindow *)pData;
+ window->m_isFocusableWindow = isFocusableWindow;
+
if (IS_WIN2000) {
! if (!window->m_isFocusableWindow) {
! LONG isPopup = window->GetStyle() & WS_POPUP;
! window->SetStyleEx(window->GetStyleEx() | (isPopup ? 0 : WS_EX_APPWINDOW) | AWT_WS_EX_NOACTIVATE);
} else {
window->SetStyleEx(window->GetStyleEx() & ~WS_EX_APPWINDOW & ~AWT_WS_EX_NOACTIVATE);
}
! }
ret:
env->DeleteGlobalRef(self);
delete sfws;
}
------- awt_Window.h -------
*** /tmp/sccs.JEaq1N Tue Feb 21 18:22:27 2006
--- awt_Window.h Tue Feb 21 18:11:34 2006
***************
*** 92,104 ****
void SendComponentEvent(jint eventId);
void SendWindowEvent(jint id, HWND opposite = NULL,
jint oldState = 0, jint newState = 0);
BOOL IsFocusableWindow();
- INLINE void SetFocusableWindow(BOOL isFocusableWindow) {
- m_isFocusableWindow = isFocusableWindow;
- }
/* some helper methods about blocking windows by modal dialogs */
INLINE static HWND GetModalBlocker(HWND window) {
return reinterpret_cast<HWND>(::GetProp(window, ModalBlockerProp));
}
--- 92,101 ----
|
EVALUATION
This regression is caused by the fix for 5091224 (Non-focusable windows steal focus from desktop windows). In that fix an extended style WS_EX_APPWINDOW is added to every AWT toplevel window, and that leads to all the windows to appear on the taskbar.
If WS_EX_APPWINDOW style is simply removed, then all the non-focusable frames will disappear from the taskbar because of another style WS_EX_NOACTIVATE. So we need to track what toplevel is (Frame, Dialog, Window) and set WS_EX_APPWINDOW only for those that must be displayed on the taskbar: frames, ownerless dialogs, probably something else (need to be checked).
|