mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1031362 Part3: Rollup popups by WM_POINTERDOWN. r=jimm, smaug
MozReview-Commit-ID: FiefSHcMBIn
This commit is contained in:
parent
2c0f3cacb5
commit
764b557d1e
@ -120,3 +120,11 @@ WinPointerEvents::ShouldEnableInkCollector()
|
||||
// pen.
|
||||
return !IsWin8OrLater();
|
||||
}
|
||||
|
||||
bool
|
||||
WinPointerEvents::ShouldRollupOnPointerEvent(WPARAM aWParam)
|
||||
{
|
||||
// Only roll up popups when we handling WM_POINTER* to fire Gecko
|
||||
// WidgetMouseEvent and suppress Windows WM_*BUTTONDOWN.
|
||||
return ShouldFireCompatibilityMouseEventsForPen(aWParam);
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
bool GetPointerInfo(uint32_t aPointerId, POINTER_INFO *aPointerInfo);
|
||||
bool GetPointerPenInfo(uint32_t aPointerId, POINTER_PEN_INFO *aPenInfo);
|
||||
bool ShouldEnableInkCollector();
|
||||
bool ShouldRollupOnPointerEvent(WPARAM aWParam);
|
||||
private:
|
||||
// Function prototypes
|
||||
typedef BOOL (WINAPI* GetPointerTypePtr)(uint32_t aPointerId,
|
||||
|
@ -7663,7 +7663,30 @@ nsWindow::DealWithPopups(HWND aWnd, UINT aMessage,
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
case WM_POINTERDOWN:
|
||||
{
|
||||
WinPointerEvents pointerEvents;
|
||||
if (!pointerEvents.ShouldRollupOnPointerEvent(aWParam)) {
|
||||
return false;
|
||||
}
|
||||
if (!GetPopupsToRollup(rollupListener, &popupsToRollup)) {
|
||||
return false;
|
||||
}
|
||||
// Can't use EventIsInsideWindow to check whether the event is inside
|
||||
// the popup window. It's because EventIsInsideWindow gets message
|
||||
// coordinates by GetMessagePos, which returns physical screen
|
||||
// coordinates at WM_POINTERDOWN.
|
||||
POINT pt;
|
||||
pt.x = GET_X_LPARAM(aLParam);
|
||||
pt.y = GET_Y_LPARAM(aLParam);
|
||||
RECT r;
|
||||
::GetWindowRect(popupWindow->mWnd, &r);
|
||||
if (::PtInRect(&r, pt) != 0) {
|
||||
// Don't roll up if the event is inside the popup window.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHWHEEL:
|
||||
// We need to check if the popup thinks that it should cause closing
|
||||
@ -7805,7 +7828,7 @@ nsWindow::DealWithPopups(HWND aWnd, UINT aMessage,
|
||||
// Only need to deal with the last rollup for left mouse down events.
|
||||
NS_ASSERTION(!mLastRollup, "mLastRollup is null");
|
||||
|
||||
if (nativeMessage == WM_LBUTTONDOWN) {
|
||||
if (nativeMessage == WM_LBUTTONDOWN || nativeMessage == WM_POINTERDOWN) {
|
||||
POINT pt;
|
||||
pt.x = GET_X_LPARAM(aLParam);
|
||||
pt.y = GET_Y_LPARAM(aLParam);
|
||||
|
Loading…
Reference in New Issue
Block a user