Move user32 ctypes bindings to winBindings#18883
Merged
Merged
Conversation
4bfcc43 to
143ea8d
Compare
… the public API since it's an undocumented paart of the Windows ABI
…p GetWindowFromPoint as it's only needed on Windows < Vista
…ogicalToPhysicalPointForPerMonitorDPI to winBindings.user32, and remove fallbacks to LogicalToPhysicalPoint/PhysicalToLogicalPoint or None, since the per monitor DPI versions are available on all versions of Windows that we support.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates ctypes bindings for Windows API functions exported by user32.dll into the centralized winBindings.user32 module as part of NVDA's 64-bit migration effort.
- Moves all direct
windll.user32andctypes.windll.user32calls to use the centralizedwinBindings.user32module - Deprecates old import paths with proper deprecation warnings to maintain backward compatibility
- Updates function calls throughout the codebase to use the new centralized bindings
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| user_docs/en/changes.md | Updates change log with API removals and deprecations |
| source/windowUtils.py | Replaces direct user32 calls with centralized bindings |
| source/winUser.py | Major refactoring to use winBindings.user32 and add deprecation support |
| source/winBindings/user32.py | Significant expansion with new function bindings and structures |
| Multiple other source files | Updates to use new centralized user32 bindings |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
michaelDCurran
requested changes
Sep 10, 2025
michaelDCurran
approved these changes
Sep 10, 2025
SaschaCowley
added a commit
that referenced
this pull request
Sep 15, 2025
Follow-up to #18883 Fixes #18913 ### Summary of the issue: Some gestures that control the mouse are broken. These include left/right mouse button lock/unlock, and navigator object default action. ### Description of user facing changes: They work again. ### Description of developer facing changes: None. ### Description of development approach: Updated `mouseHandler.executeMouseEvent` to send `0` instead of `None` as the value of `dwExtraInfo`. This is necessary as `dwExtraInfo` is correctly declared as `ULONG_PTR` since #18883, so ctypes will not accept `None`. ### Testing strategy: Ran from source and tested clicking and locking/unlocking the left and right mouse buttons, as well as activating the navigator object. ### Known issues with pull request: None
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Link to issue number:
None
Summary of the issue:
As part of NVDA's 64-bit migration, we are consolidating all ctypes bindings for the Windows API in a central location. Functions exported by
user32.dllhave largely not yet been migrated.Description of user facing changes:
None.
Description of developer facing changes:
Several deprecations and API removals.
As some ctypes bindings or struct definitions have been changed, existing code that calls these functions or uses these structs may fail at runtime.
Description of development approach:
Used grep to search for
windll.user32insource/. For all functions called viawindll.user32, created or moved the ctypes definition towinBindings.user32.As part of this, moved definitions that were needed along with the functions by which they were needed.
Testing strategy:
System and unit tests.
Smoke tested by running NVDA from source (x86 and x86_64) while performing other work.
Known issues with pull request:
Some constants are still scattered.
Code Review Checklist: