Bug 294688 clicking on applet or flash after context menu opens, does not close context menu r=ere+roc, sr=roc, a=beltzner

This commit is contained in:
Masayuki Nakano 2008-11-27 14:42:18 +09:00
parent 832a876d56
commit f631be1bc9
2 changed files with 29 additions and 7 deletions

View File

@ -669,6 +669,7 @@ nsWindow::nsWindow() : nsBaseWidget()
mPainting = 0; mPainting = 0;
mOldIMC = NULL; mOldIMC = NULL;
mIMEEnabled = nsIWidget::IME_STATUS_ENABLED; mIMEEnabled = nsIWidget::IME_STATUS_ENABLED;
mIsPluginWindow = PR_FALSE;
mLeadByte = '\0'; mLeadByte = '\0';
mBlurEventSuppressionLevel = 0; mBlurEventSuppressionLevel = 0;
@ -2753,9 +2754,10 @@ NS_IMETHODIMP nsWindow::Update()
void* nsWindow::GetNativeData(PRUint32 aDataType) void* nsWindow::GetNativeData(PRUint32 aDataType)
{ {
switch (aDataType) { switch (aDataType) {
case NS_NATIVE_PLUGIN_PORT:
mIsPluginWindow = 1;
case NS_NATIVE_WIDGET: case NS_NATIVE_WIDGET:
case NS_NATIVE_WINDOW: case NS_NATIVE_WINDOW:
case NS_NATIVE_PLUGIN_PORT:
return (void*)mWnd; return (void*)mWnd;
case NS_NATIVE_GRAPHIC: case NS_NATIVE_GRAPHIC:
// XXX: This is sleezy!! Remember to Release the DC after using it! // XXX: This is sleezy!! Remember to Release the DC after using it!
@ -7715,11 +7717,24 @@ LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM l
LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam)
{ {
if (gProcessHook) { if (gProcessHook) {
MOUSEHOOKSTRUCT* ms = (MOUSEHOOKSTRUCT*)lParam; switch (wParam) {
if (wParam == WM_LBUTTONDOWN) { case WM_LBUTTONDOWN:
nsIWidget* mozWin = (nsIWidget*)GetNSWindowPtr(ms->hwnd); case WM_RBUTTONDOWN:
if (mozWin == NULL) { case WM_MBUTTONDOWN:
ScheduleHookTimer(ms->hwnd, (UINT)wParam); case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
{
MOUSEHOOKSTRUCT* ms = (MOUSEHOOKSTRUCT*)lParam;
nsIWidget* mozWin = (nsIWidget*)GetNSWindowPtr(ms->hwnd);
if (mozWin) {
// If this window is windowed plugin window, the mouse events are not
// sent to us.
if (static_cast<nsWindow*>(mozWin)->mIsPluginWindow)
ScheduleHookTimer(ms->hwnd, (UINT)wParam);
} else {
ScheduleHookTimer(ms->hwnd, (UINT)wParam);
}
break;
} }
} }
} }
@ -7859,6 +7874,11 @@ VOID CALLBACK nsWindow::HookTimerForPopups(HWND hwnd, UINT uMsg, UINT idEvent, D
} }
#endif // WinCE #endif // WinCE
static PRBool IsDifferentThreadWindow(HWND aWnd)
{
return ::GetCurrentThreadId() != ::GetWindowThreadProcessId(aWnd, NULL);
}
// //
// DealWithPopups // DealWithPopups
// //
@ -7871,7 +7891,8 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL
if (gRollupListener && gRollupWidget && ::IsWindowVisible(inWnd)) { if (gRollupListener && gRollupWidget && ::IsWindowVisible(inWnd)) {
if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN || if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN ||
inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE ||
(inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam))
#ifndef WINCE #ifndef WINCE
|| ||
inMsg == WM_NCRBUTTONDOWN || inMsg == WM_NCRBUTTONDOWN ||

View File

@ -458,6 +458,7 @@ protected:
PRPackedBool mIsInMouseCapture; PRPackedBool mIsInMouseCapture;
PRPackedBool mIsInMouseWheelProcessing; PRPackedBool mIsInMouseWheelProcessing;
PRPackedBool mUnicodeWidget; PRPackedBool mUnicodeWidget;
PRPackedBool mIsPluginWindow;
PRPackedBool mPainting; PRPackedBool mPainting;
char mLeadByte; char mLeadByte;