mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 18:31:08 +00:00
Bug 554982 - Add support for borderless glass and remove the borders from the main window. r=roc,dao a=blocking2.0
This commit is contained in:
parent
12efeec9f5
commit
bcd5f25ef2
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@media all and (-moz-windows-compositor) {
|
@media all and (-moz-windows-compositor) {
|
||||||
#main-window:not(:-moz-lwtheme) {
|
#main-window:not(:-moz-lwtheme) {
|
||||||
-moz-appearance: -moz-win-glass;
|
-moz-appearance: -moz-win-borderless-glass;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,8 @@ class nsIWidget;
|
|||||||
enum nsTransparencyMode {
|
enum nsTransparencyMode {
|
||||||
eTransparencyOpaque = 0, // Fully opaque
|
eTransparencyOpaque = 0, // Fully opaque
|
||||||
eTransparencyTransparent, // Parts of the window may be transparent
|
eTransparencyTransparent, // Parts of the window may be transparent
|
||||||
eTransparencyGlass // Transparent parts of the window have Vista AeroGlass effect applied
|
eTransparencyGlass, // Transparent parts of the window have Vista AeroGlass effect applied
|
||||||
|
eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,6 +236,7 @@
|
|||||||
#define NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR 224
|
#define NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR 224
|
||||||
|
|
||||||
// Vista glass
|
// Vista glass
|
||||||
|
#define NS_THEME_WIN_BORDERLESS_GLASS 229
|
||||||
#define NS_THEME_WIN_GLASS 230
|
#define NS_THEME_WIN_GLASS 230
|
||||||
|
|
||||||
// Windows themed window frame elements
|
// Windows themed window frame elements
|
||||||
|
@ -3287,6 +3287,9 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
|||||||
if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
|
if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
|
||||||
return eTransparencyGlass;
|
return eTransparencyGlass;
|
||||||
|
|
||||||
|
if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_BORDERLESS_GLASS)
|
||||||
|
return eTransparencyBorderlessGlass;
|
||||||
|
|
||||||
// We need an uninitialized window to be treated as opaque because
|
// We need an uninitialized window to be treated as opaque because
|
||||||
// doing otherwise breaks window display effects on some platforms,
|
// doing otherwise breaks window display effects on some platforms,
|
||||||
// specifically Vista. (bug 450322)
|
// specifically Vista. (bug 450322)
|
||||||
|
@ -593,6 +593,7 @@ CSS_KEY(-moz-win-browsertabbar-toolbox, _moz_win_browsertabbar_toolbox)
|
|||||||
CSS_KEY(-moz-win-mediatext, _moz_win_mediatext)
|
CSS_KEY(-moz-win-mediatext, _moz_win_mediatext)
|
||||||
CSS_KEY(-moz-win-communicationstext, _moz_win_communicationstext)
|
CSS_KEY(-moz-win-communicationstext, _moz_win_communicationstext)
|
||||||
CSS_KEY(-moz-win-glass, _moz_win_glass)
|
CSS_KEY(-moz-win-glass, _moz_win_glass)
|
||||||
|
CSS_KEY(-moz-win-borderless-glass, _moz_win_borderless_glass)
|
||||||
CSS_KEY(-moz-window-titlebar, _moz_window_titlebar)
|
CSS_KEY(-moz-window-titlebar, _moz_window_titlebar)
|
||||||
CSS_KEY(-moz-window-titlebar-maximized, _moz_window_titlebar_maximized)
|
CSS_KEY(-moz-window-titlebar-maximized, _moz_window_titlebar_maximized)
|
||||||
CSS_KEY(-moz-window-frame-left, _moz_window_frame_left)
|
CSS_KEY(-moz-window-frame-left, _moz_window_frame_left)
|
||||||
|
@ -499,6 +499,7 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
|||||||
eCSSKeyword__moz_win_communications_toolbox, NS_THEME_WIN_COMMUNICATIONS_TOOLBOX,
|
eCSSKeyword__moz_win_communications_toolbox, NS_THEME_WIN_COMMUNICATIONS_TOOLBOX,
|
||||||
eCSSKeyword__moz_win_browsertabbar_toolbox, NS_THEME_WIN_BROWSER_TAB_BAR_TOOLBOX,
|
eCSSKeyword__moz_win_browsertabbar_toolbox, NS_THEME_WIN_BROWSER_TAB_BAR_TOOLBOX,
|
||||||
eCSSKeyword__moz_win_glass, NS_THEME_WIN_GLASS,
|
eCSSKeyword__moz_win_glass, NS_THEME_WIN_GLASS,
|
||||||
|
eCSSKeyword__moz_win_borderless_glass, NS_THEME_WIN_BORDERLESS_GLASS,
|
||||||
eCSSKeyword__moz_mac_unified_toolbar, NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR,
|
eCSSKeyword__moz_mac_unified_toolbar, NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR,
|
||||||
eCSSKeyword__moz_window_titlebar, NS_THEME_WINDOW_TITLEBAR,
|
eCSSKeyword__moz_window_titlebar, NS_THEME_WINDOW_TITLEBAR,
|
||||||
eCSSKeyword__moz_window_titlebar_maximized, NS_THEME_WINDOW_TITLEBAR_MAXIMIZED,
|
eCSSKeyword__moz_window_titlebar_maximized, NS_THEME_WINDOW_TITLEBAR_MAXIMIZED,
|
||||||
|
@ -839,7 +839,7 @@ DWORD nsWindow::WindowStyle()
|
|||||||
|
|
||||||
case eWindowType_popup:
|
case eWindowType_popup:
|
||||||
style = WS_POPUP;
|
style = WS_POPUP;
|
||||||
if (mTransparencyMode != eTransparencyGlass) {
|
if (!HasGlass()) {
|
||||||
style |= WS_OVERLAPPED;
|
style |= WS_OVERLAPPED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1275,7 +1275,7 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState)
|
|||||||
void nsWindow::ClearThemeRegion()
|
void nsWindow::ClearThemeRegion()
|
||||||
{
|
{
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
if (nsUXThemeData::sIsVistaOrLater && mTransparencyMode != eTransparencyGlass &&
|
if (nsUXThemeData::sIsVistaOrLater && !HasGlass() &&
|
||||||
mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) {
|
mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) {
|
||||||
SetWindowRgn(mWnd, NULL, false);
|
SetWindowRgn(mWnd, NULL, false);
|
||||||
}
|
}
|
||||||
@ -1290,7 +1290,7 @@ void nsWindow::SetThemeRegion()
|
|||||||
// so default constants are used for part and state. At some point we might need part and
|
// so default constants are used for part and state. At some point we might need part and
|
||||||
// state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that
|
// state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that
|
||||||
// change shape based on state haven't come up.
|
// change shape based on state haven't come up.
|
||||||
if (nsUXThemeData::sIsVistaOrLater && mTransparencyMode != eTransparencyGlass &&
|
if (nsUXThemeData::sIsVistaOrLater && !HasGlass() &&
|
||||||
mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) {
|
mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) {
|
||||||
HRGN hRgn = nsnull;
|
HRGN hRgn = nsnull;
|
||||||
RECT rect = {0,0,mBounds.width,mBounds.height};
|
RECT rect = {0,0,mBounds.width,mBounds.height};
|
||||||
@ -2447,7 +2447,7 @@ namespace {
|
|||||||
void nsWindow::UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion,
|
void nsWindow::UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion,
|
||||||
const nsIntRegion &aPossiblyTransparentRegion) {
|
const nsIntRegion &aPossiblyTransparentRegion) {
|
||||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
if (mTransparencyMode != eTransparencyGlass)
|
if (!HasGlass())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
||||||
@ -2508,19 +2508,31 @@ void nsWindow::UpdateGlass()
|
|||||||
{
|
{
|
||||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE);
|
||||||
|
MARGINS margins = mGlassMargins;
|
||||||
|
|
||||||
// DWMNCRP_USEWINDOWSTYLE - The non-client rendering area is
|
// DWMNCRP_USEWINDOWSTYLE - The non-client rendering area is
|
||||||
// rendered based on the window style.
|
// rendered based on the window style.
|
||||||
// DWMNCRP_ENABLED - The non-client area rendering is
|
// DWMNCRP_ENABLED - The non-client area rendering is
|
||||||
// enabled; the window style is ignored.
|
// enabled; the window style is ignored.
|
||||||
DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
|
DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
|
||||||
if (mTransparencyMode == eTransparencyGlass) {
|
switch (mTransparencyMode) {
|
||||||
|
case eTransparencyBorderlessGlass:
|
||||||
|
{
|
||||||
|
const PRInt32 kGlassMarginAdjustment = 2;
|
||||||
|
margins.cxLeftWidth += kGlassMarginAdjustment;
|
||||||
|
margins.cyTopHeight += kGlassMarginAdjustment;
|
||||||
|
margins.cxRightWidth += kGlassMarginAdjustment;
|
||||||
|
margins.cyBottomHeight += kGlassMarginAdjustment;
|
||||||
|
}
|
||||||
|
// Fall through
|
||||||
|
case eTransparencyGlass:
|
||||||
policy = DWMNCRP_ENABLED;
|
policy = DWMNCRP_ENABLED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extends the window frame behind the client area
|
// Extends the window frame behind the client area
|
||||||
if(nsUXThemeData::CheckForCompositor()) {
|
if(nsUXThemeData::CheckForCompositor()) {
|
||||||
nsUXThemeData::dwmExtendFrameIntoClientAreaPtr(hWnd, &mGlassMargins);
|
nsUXThemeData::dwmExtendFrameIntoClientAreaPtr(hWnd, &margins);
|
||||||
nsUXThemeData::dwmSetWindowAttributePtr(hWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof policy);
|
nsUXThemeData::dwmSetWindowAttributePtr(hWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof policy);
|
||||||
}
|
}
|
||||||
#endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
@ -7619,7 +7631,7 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
|
|||||||
::SetWindowLongPtrW(hWnd, GWL_EXSTYLE, exStyle);
|
::SetWindowLongPtrW(hWnd, GWL_EXSTYLE, exStyle);
|
||||||
|
|
||||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
if (mTransparencyMode == eTransparencyGlass)
|
if (HasGlass())
|
||||||
memset(&mGlassMargins, 0, sizeof mGlassMargins);
|
memset(&mGlassMargins, 0, sizeof mGlassMargins);
|
||||||
#endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
mTransparencyMode = aMode;
|
mTransparencyMode = aMode;
|
||||||
|
@ -309,6 +309,10 @@ protected:
|
|||||||
#if !defined(WINCE)
|
#if !defined(WINCE)
|
||||||
static void InitTrackPointHack();
|
static void InitTrackPointHack();
|
||||||
#endif
|
#endif
|
||||||
|
PRBool HasGlass() const {
|
||||||
|
return mTransparencyMode == eTransparencyGlass ||
|
||||||
|
mTransparencyMode == eTransparencyBorderlessGlass;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event processing helpers
|
* Event processing helpers
|
||||||
|
@ -541,20 +541,24 @@ DDRAW_FAILED:
|
|||||||
BasicLayerManager::BUFFER_NONE;
|
BasicLayerManager::BUFFER_NONE;
|
||||||
if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) {
|
if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) {
|
||||||
# if defined(MOZ_XUL) && !defined(WINCE)
|
# if defined(MOZ_XUL) && !defined(WINCE)
|
||||||
if (eTransparencyGlass == mTransparencyMode && nsUXThemeData::sHaveCompositor) {
|
switch (mTransparencyMode) {
|
||||||
doubleBuffering = BasicLayerManager::BUFFER_BUFFERED;
|
case eTransparencyGlass:
|
||||||
} else if (eTransparencyTransparent == mTransparencyMode) {
|
case eTransparencyBorderlessGlass:
|
||||||
// If we're rendering with translucency, we're going to be
|
default:
|
||||||
// rendering the whole window; make sure we clear it first
|
// If we're not doing translucency, then double buffer
|
||||||
thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR);
|
doubleBuffering = BasicLayerManager::BUFFER_BUFFERED;
|
||||||
thebesContext->Paint();
|
break;
|
||||||
thebesContext->SetOperator(gfxContext::OPERATOR_OVER);
|
case eTransparencyTransparent:
|
||||||
} else
|
// If we're rendering with translucency, we're going to be
|
||||||
#endif
|
// rendering the whole window; make sure we clear it first
|
||||||
{
|
thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||||
// If we're not doing translucency, then double buffer
|
thebesContext->Paint();
|
||||||
doubleBuffering = BasicLayerManager::BUFFER_BUFFERED;
|
thebesContext->SetOperator(gfxContext::OPERATOR_OVER);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
doubleBuffering = BasicLayerManager::BUFFER_BUFFERED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user