зеркало из https://github.com/mozilla/gecko-dev.git
r=mkaply, a=blizzard Code from jkobal - fix various focus/owner problems
This commit is contained in:
Родитель
e9180f2e87
Коммит
82168180de
|
@ -80,10 +80,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent,
|
||||||
nsIAppShell *aAppShell,
|
nsIAppShell *aAppShell,
|
||||||
nsWidgetInitData *aInitData, HWND hwndO)
|
nsWidgetInitData *aInitData, HWND hwndO)
|
||||||
{
|
{
|
||||||
/* OS2TODO Removing assertion since mail setup wizard and mail password windows come through
|
hwndP = aParent ? aParent->GetMainWindow() : NULLHANDLE;
|
||||||
here with a non-HWND_DESKTOP hwndP */
|
|
||||||
/* NS_ASSERTION( hwndP == HWND_DESKTOP && aParent == nsnull,
|
|
||||||
"Attempt to create non-top-level frame"); */
|
|
||||||
|
|
||||||
#if DEBUG_sobotka
|
#if DEBUG_sobotka
|
||||||
printf("\nIn nsFrameWindow::RealDoCreate:\n");
|
printf("\nIn nsFrameWindow::RealDoCreate:\n");
|
||||||
|
@ -109,7 +106,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent,
|
||||||
WC_FRAME,
|
WC_FRAME,
|
||||||
0, 0, // text, style
|
0, 0, // text, style
|
||||||
0, 0, 0, 0, // position
|
0, 0, 0, 0, // position
|
||||||
hwndP ? hwndP : HWND_DESKTOP,
|
hwndP,
|
||||||
HWND_TOP,
|
HWND_TOP,
|
||||||
0, // ID
|
0, // ID
|
||||||
&fcd, 0);
|
&fcd, 0);
|
||||||
|
@ -254,10 +251,17 @@ nsresult nsFrameWindow::Show( PRBool bState)
|
||||||
{
|
{
|
||||||
if( mWnd)
|
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);
|
SetWindowListVisibility( bState);
|
||||||
WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L,
|
|
||||||
(bState == PR_TRUE) ? SWP_ACTIVATE : SWP_DEACTIVATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -39,6 +39,9 @@ class nsFrameWindow : public nsCanvas
|
||||||
nsFrameWindow();
|
nsFrameWindow();
|
||||||
virtual ~nsFrameWindow();
|
virtual ~nsFrameWindow();
|
||||||
|
|
||||||
|
// So Destroy, Show, SetWindowPos, SetTitle, etc. work
|
||||||
|
HWND GetMainWindow() const { return hwndFrame; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HWND hwndFrame;
|
HWND hwndFrame;
|
||||||
PFNWP fnwpDefFrame;
|
PFNWP fnwpDefFrame;
|
||||||
|
@ -56,9 +59,6 @@ class nsFrameWindow : public nsCanvas
|
||||||
// hook so dialog can be created looking like a dialog
|
// hook so dialog can be created looking like a dialog
|
||||||
virtual ULONG GetFCFlags();
|
virtual ULONG GetFCFlags();
|
||||||
|
|
||||||
// So Destroy, Show, SetWindowPos, SetTitle, etc. work
|
|
||||||
HWND GetMainWindow() const { return hwndFrame; }
|
|
||||||
|
|
||||||
// So correct sizing behaviour happens
|
// So correct sizing behaviour happens
|
||||||
PRBool OnReposition( PSWP pSwp);
|
PRBool OnReposition( PSWP pSwp);
|
||||||
|
|
||||||
|
|
|
@ -1046,7 +1046,23 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
||||||
{
|
{
|
||||||
// doesn't seem to require a message queue.
|
// doesn't seem to require a message queue.
|
||||||
if( mWnd)
|
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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ class nsWindow : public nsBaseWidget,
|
||||||
// Get a HWND or a HPS.
|
// Get a HWND or a HPS.
|
||||||
virtual void *GetNativeData( PRUint32 aDataType);
|
virtual void *GetNativeData( PRUint32 aDataType);
|
||||||
virtual void FreeNativeData( void *aDatum, PRUint32 aDataType);
|
virtual void FreeNativeData( void *aDatum, PRUint32 aDataType);
|
||||||
|
virtual HWND GetMainWindow() const { return mWnd; }
|
||||||
|
|
||||||
// nsSwitchToPMThread interface
|
// nsSwitchToPMThread interface
|
||||||
virtual BOOL CallMethod(MethodInfo *info);
|
virtual BOOL CallMethod(MethodInfo *info);
|
||||||
|
@ -179,7 +180,6 @@ protected:
|
||||||
virtual PRInt32 GetHeight( PRInt32 aHeight) { return aHeight; }
|
virtual PRInt32 GetHeight( PRInt32 aHeight) { return aHeight; }
|
||||||
virtual PRInt32 GetClientHeight() { return mBounds.height; }
|
virtual PRInt32 GetClientHeight() { return mBounds.height; }
|
||||||
virtual ULONG GetSWPFlags( ULONG flags) { return flags; }
|
virtual ULONG GetSWPFlags( ULONG flags) { return flags; }
|
||||||
virtual HWND GetMainWindow() const { return mWnd; }
|
|
||||||
virtual void SetupForPrint( HWND /*hwnd*/) {}
|
virtual void SetupForPrint( HWND /*hwnd*/) {}
|
||||||
|
|
||||||
// Useful functions for subclasses to use, threaded as necessary.
|
// Useful functions for subclasses to use, threaded as necessary.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче