File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -527,13 +527,16 @@ void Mouse::SetWindow(HWND window)
527527
528528#include < Windows.Devices.Input.h>
529529
530+ // This symbol is defined for Win32 desktop applications, but not for UWP
531+ constexpr float USER_DEFAULT_SCREEN_DPI = 96 .f;
532+
530533class Mouse ::Impl
531534{
532535public:
533536 explicit Impl (Mouse* owner) noexcept (false ) :
534537 mState{},
535538 mOwner (owner),
536- mDPI (96 .f ),
539+ mDPI (USER_DEFAULT_SCREEN_DPI ),
537540 mMode (MODE_ABSOLUTE),
538541 mAutoReset (true ),
539542 mLastX (0 ),
@@ -906,8 +909,8 @@ class Mouse::Impl
906909
907910 const float dpi = s_mouse->mDPI ;
908911
909- s_mouse->mState .x = static_cast <int >(pos.X * dpi / 96 . f + 0 .5f );
910- s_mouse->mState .y = static_cast <int >(pos.Y * dpi / 96 . f + 0 .5f );
912+ s_mouse->mState .x = static_cast <int >(pos.X * dpi / USER_DEFAULT_SCREEN_DPI + 0 .5f );
913+ s_mouse->mState .y = static_cast <int >(pos.Y * dpi / USER_DEFAULT_SCREEN_DPI + 0 .5f );
911914 }
912915
913916 return S_OK;
@@ -970,8 +973,8 @@ class Mouse::Impl
970973
971974 float dpi = s_mouse->mDPI ;
972975
973- s_mouse->mState .x = static_cast <int >(pos.X * dpi / 96 . f + 0 .5f );
974- s_mouse->mState .y = static_cast <int >(pos.Y * dpi / 96 . f + 0 .5f );
976+ s_mouse->mState .x = static_cast <int >(pos.X * dpi / USER_DEFAULT_SCREEN_DPI + 0 .5f );
977+ s_mouse->mState .y = static_cast <int >(pos.Y * dpi / USER_DEFAULT_SCREEN_DPI + 0 .5f );
975978 }
976979 }
977980
You can’t perform that action at this time.
0 commit comments