r=mkaply, a=blizzard
Code from jkobal - fix various focus/owner problems
This commit is contained in:
mkaply%us.ibm.com 2000-12-05 03:50:31 +00:00
Родитель e9180f2e87
Коммит 82168180de
4 изменённых файлов: 33 добавлений и 13 удалений

Просмотреть файл

@ -80,10 +80,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent,
nsIAppShell *aAppShell,
nsWidgetInitData *aInitData, HWND hwndO)
{
/* OS2TODO Removing assertion since mail setup wizard and mail password windows come through
here with a non-HWND_DESKTOP hwndP */
/* NS_ASSERTION( hwndP == HWND_DESKTOP && aParent == nsnull,
"Attempt to create non-top-level frame"); */
hwndP = aParent ? aParent->GetMainWindow() : NULLHANDLE;
#if DEBUG_sobotka
printf("\nIn nsFrameWindow::RealDoCreate:\n");
@ -109,7 +106,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent,
WC_FRAME,
0, 0, // text, style
0, 0, 0, 0, // position
hwndP ? hwndP : HWND_DESKTOP,
hwndP,
HWND_TOP,
0, // ID
&fcd, 0);
@ -254,10 +251,17 @@ nsresult nsFrameWindow::Show( PRBool bState)
{
if( mWnd)
{
nsWindow::Show( bState);
ULONG ulFlags;
if( bState) {
ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE);
ulFlags = SWP_SHOW | SWP_ACTIVATE;
if( ulStyle & WS_MINIMIZED)
ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
}
else
ulFlags = SWP_HIDE | SWP_DEACTIVATE;
WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L, ulFlags);
SetWindowListVisibility( bState);
WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L,
(bState == PR_TRUE) ? SWP_ACTIVATE : SWP_DEACTIVATE);
}
return NS_OK;

Просмотреть файл

@ -39,6 +39,9 @@ class nsFrameWindow : public nsCanvas
nsFrameWindow();
virtual ~nsFrameWindow();
// So Destroy, Show, SetWindowPos, SetTitle, etc. work
HWND GetMainWindow() const { return hwndFrame; }
protected:
HWND hwndFrame;
PFNWP fnwpDefFrame;
@ -56,9 +59,6 @@ class nsFrameWindow : public nsCanvas
// hook so dialog can be created looking like a dialog
virtual ULONG GetFCFlags();
// So Destroy, Show, SetWindowPos, SetTitle, etc. work
HWND GetMainWindow() const { return hwndFrame; }
// So correct sizing behaviour happens
PRBool OnReposition( PSWP pSwp);

Просмотреть файл

@ -1046,7 +1046,23 @@ NS_METHOD nsWindow::Show(PRBool bState)
{
// doesn't seem to require a message queue.
if( mWnd)
WinShowWindow( GetMainWindow(), !!bState);
{
HWND hwnd = GetMainWindow();
if( bState == PR_TRUE)
{
if( WinQueryWindow( hwnd, QW_PARENT) ==
WinQueryObjectWindow(HWND_DESKTOP) )
WinSetParent( hwnd, HWND_DESKTOP, FALSE);
WinShowWindow( hwnd, TRUE);
}
else
{
WinShowWindow( hwnd, FALSE);
if( WinQueryWindow( hwnd, QW_PARENT) ==
WinQueryDesktopWindow(HWND_DESKTOP, NULLHANDLE) )
WinSetParent( hwnd, HWND_OBJECT, FALSE);
}
}
return NS_OK;
}

Просмотреть файл

@ -149,6 +149,7 @@ class nsWindow : public nsBaseWidget,
// Get a HWND or a HPS.
virtual void *GetNativeData( PRUint32 aDataType);
virtual void FreeNativeData( void *aDatum, PRUint32 aDataType);
virtual HWND GetMainWindow() const { return mWnd; }
// nsSwitchToPMThread interface
virtual BOOL CallMethod(MethodInfo *info);
@ -179,7 +180,6 @@ protected:
virtual PRInt32 GetHeight( PRInt32 aHeight) { return aHeight; }
virtual PRInt32 GetClientHeight() { return mBounds.height; }
virtual ULONG GetSWPFlags( ULONG flags) { return flags; }
virtual HWND GetMainWindow() const { return mWnd; }
virtual void SetupForPrint( HWND /*hwnd*/) {}
// Useful functions for subclasses to use, threaded as necessary.