b=478149; Fix up win32/WinCE window style handling; r=dougt

This commit is contained in:
Vladimir Vukicevic 2009-02-12 18:26:02 -08:00
Родитель 523aadaeff
Коммит b07e26d363
1 изменённых файлов: 43 добавлений и 18 удалений

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

@ -1660,20 +1660,25 @@ NS_METHOD nsWindow::Show(PRBool bState)
if (bState) { if (bState) {
if (!wasVisible && mWindowType == eWindowType_toplevel) { if (!wasVisible && mWindowType == eWindowType_toplevel) {
switch (mSizeMode) { switch (mSizeMode) {
case nsSizeMode_Maximized :
#ifdef WINCE #ifdef WINCE
case nsSizeMode_Maximized :
#ifdef WINCE_WINDOWS_MOBILE
::SetForegroundWindow(mWnd); ::SetForegroundWindow(mWnd);
#endif #endif
::ShowWindow(mWnd, SW_SHOWMAXIMIZED); ::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
break; break;
#ifndef WINCE // use default for nsSizeMode_Minimized on Windows CE
#else
case nsSizeMode_Maximized :
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
break;
case nsSizeMode_Minimized : case nsSizeMode_Minimized :
::ShowWindow(mWnd, SW_SHOWMINIMIZED); ::ShowWindow(mWnd, SW_SHOWMINIMIZED);
break; break;
#endif #endif
default: default:
if (CanTakeFocus()) { if (CanTakeFocus()) {
#ifdef WINCE #ifdef WINCE_WINDOWS_MOBILE
::SetForegroundWindow(mWnd); ::SetForegroundWindow(mWnd);
#endif #endif
::ShowWindow(mWnd, SW_SHOWNORMAL); ::ShowWindow(mWnd, SW_SHOWNORMAL);
@ -1788,7 +1793,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
if (aMode == mSizeMode) if (aMode == mSizeMode)
return NS_OK; return NS_OK;
#ifdef WINCE #ifdef WINCE_WINDOWS_MOBILE
// on windows mobile, dialogs and top level windows are full screen // on windows mobile, dialogs and top level windows are full screen
// This is partly due to the lack of a GetWindowPlacement. // This is partly due to the lack of a GetWindowPlacement.
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel) { if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel) {
@ -5678,15 +5683,36 @@ DWORD nsWindow::WindowStyle()
{ {
DWORD style; DWORD style;
#ifdef WINCE /* On Windows Mobile, we want very simple window styles; this is
* just optimizing for full-screen apps that don't want any
* titlebar/etc. UI. We should probably allow apps some
* finer-grained control over these types at some point, but for now
* this will work fine. If we're on Windows CE, we probably have a
* full window manager, so we make dialog/toplevel windows be real
* windows. In addition, we do the post-processing on the style
* (e.g. disabling the thick resize window if we don't have resize
* handles specified in the style).
*/
/* Note: On Windows CE (and presumably Mobile), WS_OVERLAPPED provides
* space for a menu bar in the window, which we don't want; it shouldn't
* be used. */
#if defined(WINCE)
switch (mWindowType) { switch (mWindowType) {
case eWindowType_child: case eWindowType_child:
style = WS_CHILD; style = WS_CHILD;
break; break;
case eWindowType_dialog: case eWindowType_dialog:
case eWindowType_popup:
style = WS_BORDER | WS_POPUP; style = WS_BORDER | WS_POPUP;
#ifndef WINCE_WINDOWS_MOBILE
style |= WS_SYSMENU;
if (mBorderStyle != eBorderStyle_default)
style |= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
#endif
break;
case eWindowType_popup:
style = WS_POPUP;
break; break;
default: default:
@ -5696,9 +5722,11 @@ DWORD nsWindow::WindowStyle()
case eWindowType_toplevel: case eWindowType_toplevel:
case eWindowType_invisible: case eWindowType_invisible:
style = WS_BORDER; style = WS_BORDER;
#ifndef WINCE_WINDOWS_MOBILE
style |= WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
#endif
break; break;
} }
#else #else
switch (mWindowType) { switch (mWindowType) {
case eWindowType_child: case eWindowType_child:
@ -5706,25 +5734,20 @@ DWORD nsWindow::WindowStyle()
break; break;
case eWindowType_dialog: case eWindowType_dialog:
if (mBorderStyle == eBorderStyle_default) { style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_3DLOOK | DS_MODALFRAME;
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | if (mBorderStyle != eBorderStyle_default)
DS_3DLOOK | DS_MODALFRAME; style |= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
} else {
style = WS_OVERLAPPED | WS_BORDER | WS_DLGFRAME | WS_SYSMENU |
DS_3DLOOK | DS_MODALFRAME |
WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
}
break; break;
case eWindowType_popup: case eWindowType_popup:
style = WS_POPUP;
if (mTransparencyMode == eTransparencyGlass) { if (mTransparencyMode == eTransparencyGlass) {
/* Glass seems to need WS_CAPTION or WS_THICKFRAME to work. /* Glass seems to need WS_CAPTION or WS_THICKFRAME to work.
WS_THICKFRAME has issues with autohiding popups but looks better */ WS_THICKFRAME has issues with autohiding popups but looks better */
style = WS_POPUP | WS_THICKFRAME; style |= WS_THICKFRAME;
} else { } else {
style = WS_OVERLAPPED | WS_POPUP; style |= WS_OVERLAPPED;
} }
break;
default: default:
NS_ASSERTION(0, "unknown border style"); NS_ASSERTION(0, "unknown border style");
@ -5736,7 +5759,9 @@ DWORD nsWindow::WindowStyle()
WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
break; break;
} }
#endif
#ifndef WINCE_WINDOWS_MOBILE
if (mBorderStyle != eBorderStyle_default && mBorderStyle != eBorderStyle_all) { if (mBorderStyle != eBorderStyle_default && mBorderStyle != eBorderStyle_all) {
if (mBorderStyle == eBorderStyle_none || !(mBorderStyle & eBorderStyle_border)) if (mBorderStyle == eBorderStyle_none || !(mBorderStyle & eBorderStyle_border))
style &= ~WS_BORDER; style &= ~WS_BORDER;