Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: Mouse Position via mouseProc in C++ over embedded WebView2 not working #5043

Open
ilumary opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@ilumary
Copy link

ilumary commented Jan 15, 2025

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

  1. Use Win32 to create a window (size, position and the rest does not matter as long as its visible)
  2. Initiate a plain WebView2 Browser Instance
  3. Use SetWindowsHookEx(WH_MOUSE, mouseProc, __module_handle, 0) to register the mouseProc callback
  4. Use GetClientRect and GetCursorPos and print them to stdout
  5. 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 recorder 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

@ilumary ilumary added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant