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

Fix bugs in WebView2 cursor updating #7555

Merged
merged 3 commits into from
Aug 5, 2022
Merged

Conversation

krschau
Copy link
Contributor

@krschau krschau commented Aug 1, 2022

This change updates three areas:

  • There was a bug where if a user clicked in the webview, the cursor would no longer update. For example, when moved over a button, we expect the cursor to change from an arrow to a hand. This was because on pointer up, we release pointer capture. Doing so would change m_isPointerOver to false, and we would no longer apply cursor updates in UpdateCoreWindowCursor. By moving that logic to HandlePointerExited, we get the expected behavior.
  • This change also removes m_requestedCursor. Instead of caching the cursor, we get it from the core controller in UpdateCoreWindowCursor. In addition to not needing to cache it, this also means we won't set the cursor to null the first time the pointer enters the webview.
  • Lastly, we used to cache which button was pressed on PointerPressed, and expected that to be the button released on PointerReleased. By getting the PointerUpdateKind at the time of press or release, we don't have to cache the button, and we don't have an instance where one button is released but we send a message with a different button to the core webview. If multiple buttons are pressed or released, we only get the first PointerPressed or last PointerReleased message, so we don't have to worry about releasing pointer capture while another button still has capture.

https://task.ms/40563051
https://task.ms/40563093

How Has This Been Tested?

Verified manually. Added CursorClickUpdateTest in addition to CursorUpdateTest.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Aug 1, 2022
@krschau
Copy link
Contributor Author

krschau commented Aug 1, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@krschau krschau merged commit ac718ad into main Aug 5, 2022
@krschau krschau deleted the user/krschau/wv2-pointer branch August 5, 2022 14:30
@ghost
Copy link

ghost commented Aug 15, 2022

🎉Microsoft.UI.Xaml v2.8.1 has been released which incorporates this pull request.:tada:

Handy links:

@ranjeshj ranjeshj added team-Rendering Issue for the Rendering team and removed needs-triage Issue needs to be triaged by the area owners labels Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-WebView team-Rendering Issue for the Rendering team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants