mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
Fix for 118368, support for drop shadows under menus and tooltips on WinXP, r=bryner, sr=blake
This commit is contained in:
parent
a9a8f30db3
commit
c386006aac
@ -218,10 +218,19 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext,
|
||||
widgetData.mBorderStyle = eBorderStyle_default;
|
||||
widgetData.clipSiblings = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
aContent->GetParent(*getter_AddRefs(parentContent));
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
if (parentContent)
|
||||
parentContent->GetTag(*getter_AddRefs(tag));
|
||||
widgetData.mDropShadow = !(tag && tag == nsXULAtoms::menulist);
|
||||
|
||||
// XXX make sure we are hidden (shouldn't this be done automatically?)
|
||||
viewManager->SetViewVisibility(ourView, nsViewVisibility_kHide);
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#ifdef DEBUG
|
||||
printf("XP Popups: This is a nag to indicate that an inconsistent hack is being done on the Mac for popups.\n");
|
||||
#endif
|
||||
static NS_DEFINE_IID(kCPopupCID, NS_POPUP_CID);
|
||||
ourView->CreateWidget(kCPopupCID, &widgetData, nsnull);
|
||||
#else
|
||||
|
@ -206,14 +206,16 @@ enum nsCursor { ///(normal cursor, usually rendered as an arrow)
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE),
|
||||
: clipChildren(PR_FALSE),
|
||||
clipSiblings(PR_FALSE),
|
||||
mDropShadow(PR_FALSE),
|
||||
mWindowType(eWindowType_child),
|
||||
mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
PRPackedBool clipChildren, clipSiblings, mDropShadow;
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
};
|
||||
|
@ -166,6 +166,7 @@ OleRegisterMgr::~OleRegisterMgr()
|
||||
// nsWindow Class static variable defintions
|
||||
////////////////////////////////////////////////////
|
||||
BOOL nsWindow::sIsRegistered = FALSE;
|
||||
BOOL nsWindow::sIsPopupClassRegistered = FALSE;
|
||||
UINT nsWindow::uMSH_MOUSEWHEEL = 0;
|
||||
UINT nsWindow::uWM_MSIME_RECONVERT = 0; // reconvert messge for MSIME
|
||||
UINT nsWindow::uWM_MSIME_MOUSE = 0; // mouse messge for MSIME
|
||||
@ -1258,7 +1259,8 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
|
||||
NULL);
|
||||
} else {
|
||||
mWnd = ::CreateWindowEx(extendedStyle,
|
||||
WindowClass(),
|
||||
aInitData && aInitData->mDropShadow ?
|
||||
WindowPopupClass() : WindowClass(),
|
||||
"",
|
||||
style,
|
||||
aRect.x,
|
||||
@ -3937,10 +3939,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
// return the window class name and initialize the class if needed
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#define CS_XP_DROPSHADOW 0x00020000
|
||||
|
||||
LPCTSTR nsWindow::WindowClass()
|
||||
{
|
||||
const LPCTSTR className = "MozillaWindowClass";
|
||||
|
||||
|
||||
if (!nsWindow::sIsRegistered) {
|
||||
WNDCLASS wc;
|
||||
|
||||
@ -3967,10 +3972,42 @@ LPCTSTR nsWindow::WindowClass()
|
||||
nsToolkit::gAIMMApp->FilterClientWindows((ATOM*)&nsWindow::sIsRegistered,1);
|
||||
#endif // MOZ_AIMM
|
||||
}
|
||||
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
LPCTSTR nsWindow::WindowPopupClass()
|
||||
{
|
||||
const LPCTSTR className = "MozillaDropShadowWindowClass";
|
||||
|
||||
if (!nsWindow::sIsPopupClassRegistered) {
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_DBLCLKS | CS_XP_DROPSHADOW;
|
||||
#ifdef MOZ_AIMM
|
||||
wc.lpfnWndProc = nsWindow::DefaultWindowProc;
|
||||
#else
|
||||
wc.lpfnWndProc = ::DefWindowProc;
|
||||
#endif
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = nsToolkit::mDllInstance;
|
||||
wc.hIcon = ::LoadIcon(::GetModuleHandle(NULL), IDI_APPLICATION);
|
||||
wc.hCursor = NULL;
|
||||
wc.hbrBackground = mBrush;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = className;
|
||||
|
||||
nsWindow::sIsPopupClassRegistered = ::RegisterClass(&wc);
|
||||
if (!nsWindow::sIsPopupClassRegistered) {
|
||||
// For older versions of Win32 (i.e., not XP), the registration will
|
||||
// fail, so we have to re-register without the CS_XP_DROPSHADOW flag.
|
||||
wc.style = CS_DBLCLKS;
|
||||
nsWindow::sIsPopupClassRegistered = ::RegisterClass(&wc);
|
||||
}
|
||||
}
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -347,6 +347,7 @@ protected:
|
||||
// when the window is created or resized.
|
||||
virtual PRInt32 GetHeight(PRInt32 aProposedHeight);
|
||||
virtual LPCTSTR WindowClass();
|
||||
virtual LPCTSTR WindowPopupClass();
|
||||
virtual DWORD WindowStyle();
|
||||
virtual DWORD WindowExStyle();
|
||||
|
||||
@ -477,6 +478,7 @@ protected:
|
||||
};
|
||||
|
||||
static BOOL sIsRegistered;
|
||||
static BOOL sIsPopupClassRegistered;
|
||||
|
||||
HDWP mDeferredPositioner;
|
||||
static UINT uMSH_MOUSEWHEEL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user