зеркало из https://github.com/mozilla/gecko-dev.git
Vista popup panel corner transparency fix. (r=vlad, sr=roc)
This commit is contained in:
Родитель
7fbe6ae71f
Коммит
c82dc257a9
|
@ -41,7 +41,7 @@
|
|||
/*
|
||||
* The following constants are used to determine how a widget is drawn using
|
||||
* Windows' Theme API. For more information on theme parts and states see
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/topics/partsandstates.asp
|
||||
* http://msdn.microsoft.com/en-us/library/bb773210(VS.85).aspx
|
||||
*/
|
||||
#define THEME_COLOR 204
|
||||
#define THEME_FONT 210
|
||||
|
|
|
@ -71,6 +71,7 @@ nsUXThemeData::CloseThemeDataPtr nsUXThemeData::closeTheme = NULL;
|
|||
nsUXThemeData::DrawThemeBackgroundPtr nsUXThemeData::drawThemeBG = NULL;
|
||||
nsUXThemeData::DrawThemeEdgePtr nsUXThemeData::drawThemeEdge = NULL;
|
||||
nsUXThemeData::GetThemeContentRectPtr nsUXThemeData::getThemeContentRect = NULL;
|
||||
nsUXThemeData::GetThemeBackgroundRegionPtr nsUXThemeData::getThemeBackgroundRegion = NULL;
|
||||
nsUXThemeData::GetThemePartSizePtr nsUXThemeData::getThemePartSize = NULL;
|
||||
nsUXThemeData::GetThemeSysFontPtr nsUXThemeData::getThemeSysFont = NULL;
|
||||
nsUXThemeData::GetThemeColorPtr nsUXThemeData::getThemeColor = NULL;
|
||||
|
@ -103,6 +104,7 @@ nsUXThemeData::Initialize()
|
|||
drawThemeBG = (DrawThemeBackgroundPtr)GetProcAddress(sThemeDLL, "DrawThemeBackground");
|
||||
drawThemeEdge = (DrawThemeEdgePtr)GetProcAddress(sThemeDLL, "DrawThemeEdge");
|
||||
getThemeContentRect = (GetThemeContentRectPtr)GetProcAddress(sThemeDLL, "GetThemeBackgroundContentRect");
|
||||
getThemeBackgroundRegion = (GetThemeBackgroundRegionPtr)GetProcAddress(sThemeDLL, "GetThemeBackgroundRegion");
|
||||
getThemePartSize = (GetThemePartSizePtr)GetProcAddress(sThemeDLL, "GetThemePartSize");
|
||||
getThemeSysFont = (GetThemeSysFontPtr)GetProcAddress(sThemeDLL, "GetThemeSysFont");
|
||||
getThemeColor = (GetThemeColorPtr)GetProcAddress(sThemeDLL, "GetThemeColor");
|
||||
|
|
|
@ -119,6 +119,9 @@ public:
|
|||
typedef HRESULT (WINAPI*GetThemeContentRectPtr)(HANDLE hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, const RECT* pRect,
|
||||
RECT* pContentRect);
|
||||
typedef HRESULT (WINAPI*GetThemeBackgroundRegionPtr)(HANDLE hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, const RECT* pRect,
|
||||
HRGN *pRegion);
|
||||
typedef HRESULT (WINAPI*GetThemePartSizePtr)(HANDLE hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, RECT* prc, int ts,
|
||||
SIZE* psz);
|
||||
|
@ -139,6 +142,7 @@ public:
|
|||
static DrawThemeBackgroundPtr drawThemeBG;
|
||||
static DrawThemeEdgePtr drawThemeEdge;
|
||||
static GetThemeContentRectPtr getThemeContentRect;
|
||||
static GetThemeBackgroundRegionPtr getThemeBackgroundRegion;
|
||||
static GetThemePartSizePtr getThemePartSize;
|
||||
static GetThemeSysFontPtr getThemeSysFont;
|
||||
static GetThemeColorPtr getThemeColor;
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#else
|
||||
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
#include "nsKeyboardLayout.h"
|
||||
#include "nsNativeDragTarget.h"
|
||||
|
||||
|
@ -763,6 +764,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
|||
mOldIMC = NULL;
|
||||
mIMEEnabled = nsIWidget::IME_STATUS_ENABLED;
|
||||
mIsPluginWindow = PR_FALSE;
|
||||
mPopupType = ePopupTypeAny;
|
||||
|
||||
mLeadByte = '\0';
|
||||
mBlurEventSuppressionLevel = 0;
|
||||
|
@ -1326,6 +1328,7 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
|
|||
if (nsnull != aInitData) {
|
||||
SetWindowType(aInitData->mWindowType);
|
||||
SetBorderStyle(aInitData->mBorderStyle);
|
||||
mPopupType = aInitData->mPopupHint;
|
||||
}
|
||||
|
||||
mContentType = aInitData ? aInitData->mContentType : eContentTypeInherit;
|
||||
|
@ -1991,6 +1994,38 @@ NS_METHOD nsWindow::ConstrainPosition(PRBool aAllowSlop,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// XP and Vista visual styles sometimes require window clipping regions to be applied for proper
|
||||
// transparency. These routines are called on size and move operations.
|
||||
|
||||
void nsWindow::ClearThemeRegion()
|
||||
{
|
||||
#ifndef WINCE
|
||||
SetWindowRgn(mWnd, NULL, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsWindow::SetThemeRegion()
|
||||
{
|
||||
#ifndef WINCE
|
||||
// Popup types that have a visual styles region applied (bug 376408). This can be expanded
|
||||
// for other window types as needed. The regions are applied generically to the base window
|
||||
// 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
|
||||
// change shape based on state haven't come up.
|
||||
if (nsUXThemeData::sIsVistaOrLater && mTransparencyMode != eTransparencyGlass &&
|
||||
mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) {
|
||||
HRGN hRgn = nsnull;
|
||||
RECT rect = {0,0,mBounds.width,mBounds.height};
|
||||
|
||||
nsUXThemeData::getThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), GetDC(mWnd), TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
|
||||
if (hRgn) {
|
||||
if (!SetWindowRgn(mWnd, hRgn, false)) // do not delete or alter hRgn if accepted.
|
||||
DeleteObject(hRgn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Move this component
|
||||
|
@ -2048,8 +2083,10 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY)
|
|||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
|
||||
}
|
||||
else {
|
||||
ClearThemeRegion();
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
|
||||
SetThemeRegion();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -2094,7 +2131,9 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
|||
mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
|
||||
}
|
||||
else {
|
||||
ClearThemeRegion();
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
|
||||
SetThemeRegion();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2140,12 +2179,15 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeig
|
|||
flags |= SWP_NOREDRAW;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NULL != deferrer) {
|
||||
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
|
||||
mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
|
||||
}
|
||||
else {
|
||||
ClearThemeRegion();
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
|
||||
SetThemeRegion();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -443,6 +443,10 @@ protected:
|
|||
msg.lParam = lParam;
|
||||
return msg;
|
||||
}
|
||||
|
||||
// XP and Vista theming support for windows with rounded edges.
|
||||
void ClearThemeRegion();
|
||||
void SetThemeRegion();
|
||||
private:
|
||||
|
||||
|
||||
|
@ -529,6 +533,8 @@ protected:
|
|||
|
||||
HKL mLastKeyboardLayout;
|
||||
|
||||
nsPopupType mPopupType;
|
||||
|
||||
// Drag & Drop
|
||||
nsNativeDragTarget * mNativeDragTarget;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче