-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: Support ContactRect in X11 and Windows platform #16498
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
Merged
maxkatz6
merged 14 commits into
AvaloniaUI:master
from
dotnet-campus:t/lindexi/TouchMajor
Oct 6, 2024
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c15f9a1
feat: Support ContactRect in X11 platform
lindexi 5942d37
Provide compat value for ContactRect property
lindexi 6ad31f4
Using touch position to get the screen.
lindexi f62d790
Try get the correct screen
lindexi 95c2ad8
Remove the code of log.
lindexi d050f20
Improve performance avoid the GC stress.
lindexi f772973
Add a second overload in PointerPointProperties to avoid break API ch…
lindexi 29fe3c1
Merge remote-tracking branch 'origin/master' into t/lindexi/TouchMajor
lindexi eed1ecd
Support touch size in WM_Touch
lindexi 0c29c8d
Support get ContactRect in WM_POINTER
lindexi 6817142
Fix the coordinate of touch contact area
lindexi 5eeb7df
Fix the calcuate of WM_Touch contact area
lindexi 4c745d0
Fix the X11 area contact
lindexi 75d6dbf
Fix the touch major and minor default value is not null.
lindexi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,14 @@ public record struct RawPointerPoint | |
/// <inheritdoc cref="PointerPointProperties.YTilt" /> | ||
public float YTilt { get; set; } | ||
|
||
/// <inheritdoc cref="PointerPointProperties.ContactRect" /> | ||
public Rect ContactRect | ||
{ | ||
get => _contactRect ?? new Rect(Position, new Size()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be new Size(1,1) by default I believe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @maxkatz6 Sorry, I do not think so. I think the size should be zero here as the WinUI do. |
||
set => _contactRect = value; | ||
} | ||
|
||
private Rect? _contactRect; | ||
|
||
public RawPointerPoint() | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to extend the API? Can't relevant XI2 properties be converted to existing ones? How other platforms expose the same information? How browsers are handling that?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the same info exposed by UWP?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks
As a touch application, the touch area is an indispensable parameter.
Sorry, I can not find any existing ones can be converted to.
It can be implemented in Windows platform, see https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchscreen-required-hid-top-level-collections
See https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.input.pointerpointproperties.contactrect?view=windows-app-sdk-1.5
And we can get this info from WM_Pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we can get the touch size in wpf by
StylusPointProperties.Width
andStylusPointProperties.Height
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support the windows platform now. And I test my demo, and I find the behavior of Avalonia is same as WinUI and UWP.