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

Code review for Mouse CoreWindow implementation #296

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

DJm00n
Copy link
Contributor

@DJm00n DJm00n commented Jan 8, 2025

Use USER_DEFAULT_SCREEN_DPI define instead of 96 value.

Use USER_DEFAULT_SCREEN_DPI define instead of 96 value.
@walbourn
Copy link
Member

walbourn commented Jan 15, 2025

The symbol USER_DEFAULT_SCREEN_DPI is indeed 96 which is how it is defined. The problem is that for UWP, this constant is NOT defined and that's the "CoreWindow" implementation that is using the value.

See winuser.h:

#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

WINUSERAPI
BOOL
WINAPI
GetGUIThreadInfo(
    _In_ DWORD idThread,
    _Inout_ PGUITHREADINFO pgui);

WINUSERAPI
BOOL
WINAPI
BlockInput(
    BOOL fBlockIt);

#if(_WIN32_WINNT >= 0x0600)

#define USER_DEFAULT_SCREEN_DPI 96

@walbourn
Copy link
Member

walbourn commented Jan 15, 2025

One solution here is I think that I Just define USER_DEFAULT_SCREEN_DPI for the CoreWindow implementation since that define is never set for that context.

I agree that 'magic number' approach is less clear so that is a good improvement. For all the UWP examples, they just use '96'.

@walbourn walbourn self-assigned this Jan 15, 2025
@walbourn walbourn self-requested a review January 15, 2025 17:55
@walbourn walbourn added maintenance input Related to GamePad, Keyboard, and Mouse labels Jan 15, 2025
@walbourn walbourn changed the title Update Mouse.cpp Code review for Mouse.cpp Jan 15, 2025
@walbourn walbourn changed the title Code review for Mouse.cpp Code review for Mouse CoreWindow implementation Jan 15, 2025
@walbourn
Copy link
Member

walbourn commented Jan 15, 2025

Note that VCPKG checks fail as that pipeline requires a GHA variable which is limited due to security for PRs coming from external contributors. The code builds fine for that case.

@walbourn walbourn merged commit 6646c76 into microsoft:main Jan 15, 2025
63 of 71 checks passed
@DJm00n DJm00n deleted the patch-1 branch January 17, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
input Related to GamePad, Keyboard, and Mouse maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants