Bug 1945257 - [6/7] Remove MOZ_WM_* mouse messages, phase 3 of 3 r=masayuki,win-reviewers,gstoll
Remove all of MOZ_WM_MOUSE{V,H}WHEEL and MOZ_WM_{V,H}SCROLL. Document
their removal and reserve their former values.
Concomitantly, rename and redocument several private member functions of
MouseScrollHandler, and remove a now-almost-certainly-superfluous check
for unintended recursion.
No functional changes, unless I'm wrong about the recursion check.
Differential Revision: https://phabricator.services.mozilla.com/D236596
This commit is contained in:
@@ -12,14 +12,19 @@
|
||||
|
||||
// accessibility priming
|
||||
#define MOZ_WM_STARTA11Y (WM_APP + 0x0302)
|
||||
// Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and
|
||||
// WM_HSCROLL
|
||||
#define MOZ_WM_MOUSEVWHEEL (WM_APP + 0x0310)
|
||||
#define MOZ_WM_MOUSEHWHEEL (WM_APP + 0x0311)
|
||||
#define MOZ_WM_VSCROLL (WM_APP + 0x0312)
|
||||
#define MOZ_WM_HSCROLL (WM_APP + 0x0313)
|
||||
#define MOZ_WM_MOUSEWHEEL_FIRST MOZ_WM_MOUSEVWHEEL
|
||||
#define MOZ_WM_MOUSEWHEEL_LAST MOZ_WM_HSCROLL
|
||||
|
||||
// From Firefox 5 (2011) to Firefox 137 (2025), these were internal messages for
|
||||
// WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL, and WM_HSCROLL, used to work
|
||||
// around issues with out-of-process NPAPI plugins.
|
||||
//
|
||||
// (There may yet be old third-party apps that unwisely send these messages
|
||||
// directly to our windows to cause scrolling; we should probably avoid reusing
|
||||
// them for a while, so as not to have to worry about that.)
|
||||
#define MOZ_WM_MOUSE_RESERVED_UNUSED_0 (WM_APP + 0x0310)
|
||||
#define MOZ_WM_MOUSE_RESERVED_UNUSED_1 (WM_APP + 0x0311)
|
||||
#define MOZ_WM_MOUSE_RESERVED_UNUSED_2 (WM_APP + 0x0312)
|
||||
#define MOZ_WM_MOUSE_RESERVED_UNUSED_3 (WM_APP + 0x0313)
|
||||
|
||||
// If TSFTextStore needs to notify TSF/TIP of layout change later, this
|
||||
// message is posted.
|
||||
#define MOZ_WM_NOTIY_TSF_OF_LAYOUT_CHANGE (WM_APP + 0x0315)
|
||||
|
||||
@@ -195,20 +195,9 @@ void MouseScrollHandler::MaybeLogKeyState() {
|
||||
}
|
||||
}
|
||||
|
||||
bool MouseScrollHandler::ProcessMessageDirectly(UINT msg, WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
MSGResult& aResult) {
|
||||
// This should never be entered recursively. Assert if that somehow
|
||||
// happens. (In release, bail out rather than crashing due to a stack
|
||||
// overflow, to give the user time to diagnose and report.)
|
||||
static bool isRecursing = false;
|
||||
MOZ_ASSERT(!isRecursing, "recursive event handler detected");
|
||||
if (isRecursing) {
|
||||
return false;
|
||||
}
|
||||
AutoRestore<bool> _restore{isRecursing};
|
||||
isRecursing = true;
|
||||
|
||||
bool MouseScrollHandler::ProcessMouseMessage(UINT msg, WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
MSGResult& aResult) {
|
||||
// Select the appropriate message handler.
|
||||
using HandlerT =
|
||||
bool (MouseScrollHandler::*)(nsWindow*, UINT, WPARAM, LPARAM);
|
||||
@@ -224,7 +213,7 @@ bool MouseScrollHandler::ProcessMessageDirectly(UINT msg, WPARAM wParam,
|
||||
}
|
||||
return &MouseScrollHandler::HandleScrollMessageAsItself;
|
||||
default:
|
||||
MOZ_ASSERT(false, "wrong message type in ProcessMessageDirectly");
|
||||
MOZ_ASSERT(false, "wrong message type in ProcessMouseMessage");
|
||||
return nullptr;
|
||||
}
|
||||
}();
|
||||
@@ -275,8 +264,7 @@ bool MouseScrollHandler::ProcessMessage(nsWindow* aWidget, UINT msg,
|
||||
case WM_MOUSEHWHEEL:
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
return GetInstance()->ProcessMessageDirectly(msg, wParam, lParam,
|
||||
aResult);
|
||||
return GetInstance()->ProcessMouseMessage(msg, wParam, lParam, aResult);
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
|
||||
@@ -64,7 +64,7 @@ class MouseScrollHandler {
|
||||
* Note that some devices need some hack for the modifier key state.
|
||||
* This method does it automatically.
|
||||
*
|
||||
* @param aMessage Handling message.
|
||||
* @param aMessage Message being handled.
|
||||
*/
|
||||
static ModifierKeyState GetModifierKeyState(UINT aMessage);
|
||||
|
||||
@@ -77,64 +77,64 @@ class MouseScrollHandler {
|
||||
static POINTS GetCurrentMessagePos();
|
||||
|
||||
/**
|
||||
* ProcessMessageDirectly() processes WM_MOUSEWHEEL, WM_MOUSEHWHEEL,
|
||||
* WM_VSCROLL, and WM_HSCROLL without posting a MOZ_WM_* message.
|
||||
* ProcessMouseMessage() processes mousewheel and scroll messages, dispatching
|
||||
* to other handlers as needed while dealing with common tasks.
|
||||
*
|
||||
* @param aMessage WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL or WM_HSCROLL.
|
||||
* @param aWParam The wParam value of the message.
|
||||
* @param aLParam The lParam value of the message.
|
||||
*/
|
||||
bool ProcessMessageDirectly(UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
MSGResult& aResult);
|
||||
bool ProcessMouseMessage(UINT msg, WPARAM wParam, LPARAM lParam,
|
||||
MSGResult& aResult);
|
||||
|
||||
/**
|
||||
* HandleMouseWheelMessage() processes MOZ_WM_MOUSEVWHEEL and
|
||||
* MOZ_WM_MOUSEHWHEEL which are posted when one of our windows received
|
||||
* WM_MOUSEWHEEL or WM_MOUSEHWHEEL for avoiding deadlock with OOPP.
|
||||
* HandleMouseWheelMessage() processes WM_MOUSEWHEEL or WM_MOUSEHWHEEL.
|
||||
*
|
||||
* @param aWidget A window which receives the wheel message.
|
||||
* @param aMessage MOZ_WM_MOUSEWHEEL or MOZ_WM_MOUSEHWHEEL.
|
||||
* @param aWParam The wParam value of the original message.
|
||||
* @param aLParam The lParam value of the original message.
|
||||
* @param aWidget The window which should process the wheel message.
|
||||
* @param aMessage WM_MOUSEWHEEL or WM_MOUSEHWHEEL.
|
||||
* @param aWParam The wParam value of the message.
|
||||
* @param aLParam The lParam value of the message.
|
||||
* @return TRUE if the message is processed. Otherwise, FALSE.
|
||||
*/
|
||||
bool HandleMouseWheelMessage(nsWindow* aWidget, UINT aMessage, WPARAM aWParam,
|
||||
LPARAM aLParam);
|
||||
|
||||
/**
|
||||
* HandleScrollMessageAsMouseWheelMessage() processes the MOZ_WM_VSCROLL and
|
||||
* MOZ_WM_HSCROLL which are posted when one of mouse windows received
|
||||
* WM_VSCROLL or WM_HSCROLL and user wants them to emulate mouse wheel
|
||||
* message's behavior.
|
||||
* HandleScrollMessageAsMouseWheelMessage() processes WM_VSCROLL or WM_HSCROLL
|
||||
* when the user wants them to emulate a mouse-wheel message's behavior
|
||||
* (_i.e._, when `mousewheel.emulate_at_wm_scroll` is true).
|
||||
*
|
||||
* @param aWidget A window which receives the scroll message.
|
||||
* @param aMessage MOZ_WM_VSCROLL or MOZ_WM_HSCROLL.
|
||||
* @param aWParam The wParam value of the original message.
|
||||
* @param aLParam The lParam value of the original message.
|
||||
* @param aWidget The window which should process the scroll message.
|
||||
* @param aMessage WM_VSCROLL or WM_HSCROLL.
|
||||
* @param aWParam The wParam value of the message.
|
||||
* @param aLParam The lParam value of the message.
|
||||
* @return TRUE if the message is processed. Otherwise, FALSE.
|
||||
*/
|
||||
bool HandleScrollMessageAsMouseWheelMessage(nsWindow* aWidget, UINT aMessage,
|
||||
WPARAM aWParam, LPARAM aLParam);
|
||||
|
||||
/**
|
||||
* HandleScrollMessageAsScrollMessage() processes the MOZ_WM_VSCROLL and
|
||||
* MOZ_WM_HSCROLL which are posted when one of mouse windows received
|
||||
* WM_VSCROLL or WM_HSCROLL and user does _not_ want them to emulate mouse
|
||||
* wheel message's behavior.
|
||||
* HandleScrollMessageAsItself() processes the WM_VSCROLL and WM_HSCROLL when
|
||||
* the user does _not_ want them to emulate a mouse-wheel message's behavior
|
||||
* (_i.e._, when `mousewheel.emulate_at_wm_scroll` is false).
|
||||
*
|
||||
* @param aWidget The window which should process the scroll message.
|
||||
* @param aMessage WM_VSCROLL or WM_HSCROLL.
|
||||
* @param aWParam The wParam value of the message.
|
||||
* @param aLParam The lParam value of the message.
|
||||
* @return TRUE if the message is processed. Otherwise, FALSE.
|
||||
*/
|
||||
bool HandleScrollMessageAsItself(nsWindow* aWidget, UINT aMessage,
|
||||
WPARAM aWParam, LPARAM aLParam);
|
||||
|
||||
/**
|
||||
* ComputeMessagePos() computes the cursor position when the message was
|
||||
* added to the queue.
|
||||
* ComputeMessagePos() abstracts over ::GetMessagePos(), which is known to
|
||||
* yield bad data under some mouse drivers (particularly Logitech's SetPoint).
|
||||
*
|
||||
* @param aMessage Current message.
|
||||
* @param aWParam Current message's wParam.
|
||||
* @param aLParam Current message's lParam.
|
||||
* @return Mouse cursor position when the message is added to
|
||||
* the queue or current cursor position if the result of
|
||||
* ::GetMessagePos() is broken.
|
||||
* @return Mouse cursor position.
|
||||
*/
|
||||
POINT ComputeMessagePos(UINT aMessage, WPARAM aWParam, LPARAM aLParam);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user