[Problem/Bug]: Mouse Position via mouseProc in C++ over embedded WebView2 not working #5043
Description
What happened?
I have a Win32 window which contains a WebView2 browser instance. I now want to query the hosts mouse position to determine if it is over my window via a call to SetWindowsHookEx(WH_MOUSE, mouseProc, __module_handle, 0)
.
Inside of mouseProc
, I have tried both GetClientRect
and GetWindowRect
to retrieve the Window's position and then checked the result against GetCursorPos
. In the Case of GetClientRect
I transformed the coordinates appropriately.
All of these function deliver the expected results except on my WebView2 Browser window where the mouseProc callback stops working after I move the mouse over the few pixels of invisible border around the window to inside the window.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
131.0.2903.112
SDK Version
1.0.2739.15
Framework
Win32
Operating System
Windows 11
OS Version
22631.4751
Repro steps
- Use Win32 to create a window (size, position and the rest does not matter as long as its visible)
- Initiate a plain WebView2 Browser Instance
- Use
SetWindowsHookEx(WH_MOUSE, mouseProc, __module_handle, 0)
to register themouseProc
callback - Use
GetClientRect
andGetCursorPos
and print them to stdout - Start the application and move the mouse cursor over the window
As soon as the mouse is over the WebView2 window the mouseProc
Callback stops being called. The last recorded positon from GetCursorPos
is the last pixel of the invisible border of the window.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response