This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Win32, Keyboard] Store keyboard message session #31047
Merged
dkwingsmt
merged 4 commits into
flutter-team-archive:main
from
dkwingsmt:win-key-session
Jan 26, 2022
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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.
Could you use the Windows type here (i.e. SHORT), and for the others that are derived from Windows struct values?
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.
At some point we have to convert the Win32 types to fixed-width types. My idea here is that, the members of
Win32Messagepreserve the original value, since they are to be redispatched, while the members ofPendingEventshould be fixed-width values, since they are processed values and will be send toOnKeyof the platform-independentFlutterWindowsView.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 agree that the change here (or many of the numerical types) is debatable.
WPARAMis technically uint64 nowadays in a 64-bit system, but the API dated back to the 32-bit era, and practically the virtual code never exceeds 16 bit.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.
Sure, and I'm sure that practically it makes no difference, but from a correctness standpoint it would be better to use the system defined types instead of making the (yes, perfectly valid) assumptions about the sizes of the types.
I'm OK with making the assumptions, though, if you think that the documentation value of showing the type sizes is important enough to trump the correctness.
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.
It might be sufficient to have a compile-time
static_assertthatsizeof(SHORT) == sizeof(uint16_t).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've replaced the types of
keyandactionto win32 types since they directly come from win32 values. Others are extracted fromlparamand have explicitly defined width, so I'm keeping their types.