зеркало из https://github.com/mozilla/pjs.git
Bug 575044 - Fix busted windows styles and disable chromemargins for fullscreen mode. r=robarnold.
This commit is contained in:
Родитель
9cd8abf2df
Коммит
077114d844
|
@ -378,6 +378,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
||||||
mWindowType = eWindowType_child;
|
mWindowType = eWindowType_child;
|
||||||
mBorderStyle = eBorderStyle_default;
|
mBorderStyle = eBorderStyle_default;
|
||||||
mPopupType = ePopupTypeAny;
|
mPopupType = ePopupTypeAny;
|
||||||
|
mOldSizeMode = nsSizeMode_Normal;
|
||||||
mLastPoint.x = 0;
|
mLastPoint.x = 0;
|
||||||
mLastPoint.y = 0;
|
mLastPoint.y = 0;
|
||||||
mLastSize.width = 0;
|
mLastSize.width = 0;
|
||||||
|
@ -1139,10 +1140,6 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
||||||
break;
|
break;
|
||||||
// use default for nsSizeMode_Minimized on Windows CE
|
// use default for nsSizeMode_Minimized on Windows CE
|
||||||
#else
|
#else
|
||||||
case nsSizeMode_Fullscreen:
|
|
||||||
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
||||||
break;
|
break;
|
||||||
|
@ -1560,7 +1557,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
|
||||||
|
|
||||||
switch (aMode) {
|
switch (aMode) {
|
||||||
case nsSizeMode_Fullscreen :
|
case nsSizeMode_Fullscreen :
|
||||||
mode = SW_MAXIMIZE;
|
mode = SW_RESTORE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
|
@ -2373,6 +2370,9 @@ NS_IMETHODIMP nsWindow::HideWindowChrome(PRBool aShouldHide)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mHideChrome == aShouldHide)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
DWORD_PTR style, exStyle;
|
DWORD_PTR style, exStyle;
|
||||||
mHideChrome = aShouldHide;
|
mHideChrome = aShouldHide;
|
||||||
if (aShouldHide) {
|
if (aShouldHide) {
|
||||||
|
@ -2508,6 +2508,19 @@ nsWindow::MakeFullScreen(PRBool aFullScreen)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
if (aFullScreen) {
|
||||||
|
if (mSizeMode != nsSizeMode_Fullscreen)
|
||||||
|
mOldSizeMode = mSizeMode;
|
||||||
|
SetSizeMode(nsSizeMode_Fullscreen);
|
||||||
|
} else {
|
||||||
|
SetSizeMode(mOldSizeMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateNonClientMargins();
|
||||||
|
|
||||||
|
// Will call hide chrome, reposition window. Note this will
|
||||||
|
// also cache dimensions for restoration, so it should only
|
||||||
|
// be called once per fullscreen request.
|
||||||
return nsBaseWidget::MakeFullScreen(aFullScreen);
|
return nsBaseWidget::MakeFullScreen(aFullScreen);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -4915,8 +4928,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||||
#else
|
#else
|
||||||
*aRetValue = 0;
|
*aRetValue = 0;
|
||||||
#endif
|
#endif
|
||||||
if (mSizeMode == nsSizeMode_Fullscreen)
|
|
||||||
MakeFullScreen(TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef WINCE_WINDOWS_MOBILE
|
#ifdef WINCE_WINDOWS_MOBILE
|
||||||
|
@ -5727,7 +5738,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS *wp, PRBool& result)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handle window size mode changes
|
// Handle window size mode changes
|
||||||
if (wp->flags & SWP_FRAMECHANGED) {
|
if (wp->flags & SWP_FRAMECHANGED && mSizeMode != nsSizeMode_Fullscreen) {
|
||||||
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
||||||
|
|
||||||
WINDOWPLACEMENT pl;
|
WINDOWPLACEMENT pl;
|
||||||
|
@ -5883,7 +5894,9 @@ void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
|
||||||
{
|
{
|
||||||
// Update non-client margins if the frame size is changing, and let the
|
// Update non-client margins if the frame size is changing, and let the
|
||||||
// browser know we are changing size modes, so alternative css can kick in.
|
// browser know we are changing size modes, so alternative css can kick in.
|
||||||
if (info->flags & SWP_FRAMECHANGED) {
|
// If we're going into fullscreen mode, ignore this, since it'll reset
|
||||||
|
// margins to normal mode.
|
||||||
|
if (info->flags & SWP_FRAMECHANGED && mSizeMode != nsSizeMode_Fullscreen) {
|
||||||
WINDOWPLACEMENT pl;
|
WINDOWPLACEMENT pl;
|
||||||
pl.length = sizeof(pl);
|
pl.length = sizeof(pl);
|
||||||
::GetWindowPlacement(mWnd, &pl);
|
::GetWindowPlacement(mWnd, &pl);
|
||||||
|
@ -7413,43 +7426,43 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
|
||||||
if (aMode == mTransparencyMode)
|
if (aMode == mTransparencyMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// stop on dialogs and popups!
|
||||||
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
||||||
nsWindow* topWindow = GetNSWindowPtr(hWnd);
|
nsWindow* parent = GetNSWindowPtr(hWnd);
|
||||||
|
|
||||||
if (!topWindow)
|
if (!parent)
|
||||||
{
|
{
|
||||||
NS_WARNING("Trying to use transparent chrome in an embedded context");
|
NS_WARNING("Trying to use transparent chrome in an embedded context");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG_PTR style = 0, exStyle = 0;
|
if (parent != this) {
|
||||||
switch(aMode) {
|
NS_WARNING("Setting SetWindowTranslucencyInner on a parent this is not us!");
|
||||||
case eTransparencyTransparent:
|
|
||||||
exStyle |= WS_EX_LAYERED;
|
|
||||||
case eTransparencyOpaque:
|
|
||||||
case eTransparencyGlass:
|
|
||||||
topWindow->mTransparencyMode = aMode;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide chrome supports caching old styles, so this can be
|
|
||||||
// flipped back and forth
|
|
||||||
//topWindow->HideWindowChrome(aMode == eTransparencyTransparent);
|
|
||||||
|
|
||||||
style |= topWindow->WindowStyle();
|
|
||||||
exStyle |= topWindow->WindowExStyle();
|
|
||||||
|
|
||||||
if (aMode == eTransparencyTransparent) {
|
if (aMode == eTransparencyTransparent) {
|
||||||
style &= ~(WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
// If we're switching to the use of a transparent window, hide the chrome
|
||||||
exStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
|
// on our parent.
|
||||||
|
HideWindowChrome(PR_TRUE);
|
||||||
|
} else if (mHideChrome && mTransparencyMode == eTransparencyTransparent) {
|
||||||
|
// if we're switching out of transparent, re-enable our parent's chrome.
|
||||||
|
HideWindowChrome(PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topWindow->mIsVisible)
|
LONG_PTR style = ::GetWindowLongPtrW(hWnd, GWL_STYLE),
|
||||||
style |= WS_VISIBLE;
|
exStyle = ::GetWindowLongPtr(hWnd, GWL_EXSTYLE);
|
||||||
if (topWindow->mSizeMode == nsSizeMode_Maximized)
|
|
||||||
style |= WS_MAXIMIZE;
|
if (parent->mIsVisible)
|
||||||
else if (topWindow->mSizeMode == nsSizeMode_Minimized)
|
style |= WS_VISIBLE;
|
||||||
style |= WS_MINIMIZE;
|
if (parent->mSizeMode == nsSizeMode_Maximized)
|
||||||
|
style |= WS_MAXIMIZE;
|
||||||
|
else if (parent->mSizeMode == nsSizeMode_Minimized)
|
||||||
|
style |= WS_MINIMIZE;
|
||||||
|
|
||||||
|
if (aMode == eTransparencyTransparent)
|
||||||
|
exStyle |= WS_EX_LAYERED;
|
||||||
|
else
|
||||||
|
exStyle &= ~WS_EX_LAYERED;
|
||||||
|
|
||||||
VERIFY_WINDOW_STYLE(style);
|
VERIFY_WINDOW_STYLE(style);
|
||||||
::SetWindowLongPtrW(hWnd, GWL_STYLE, style);
|
::SetWindowLongPtrW(hWnd, GWL_STYLE, style);
|
||||||
|
|
|
@ -456,6 +456,7 @@ protected:
|
||||||
nsPopupType mPopupType;
|
nsPopupType mPopupType;
|
||||||
PRPackedBool mDisplayPanFeedback;
|
PRPackedBool mDisplayPanFeedback;
|
||||||
PRPackedBool mHideChrome;
|
PRPackedBool mHideChrome;
|
||||||
|
nsSizeMode mOldSizeMode;
|
||||||
WindowHook mWindowHook;
|
WindowHook mWindowHook;
|
||||||
static PRUint32 sInstanceCount;
|
static PRUint32 sInstanceCount;
|
||||||
static TriStateBool sCanQuit;
|
static TriStateBool sCanQuit;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче