diff --git a/src/hotkeywrapper.cc b/src/hotkeywrapper.cc index f9da8328..0bc9927d 100644 --- a/src/hotkeywrapper.cc +++ b/src/hotkeywrapper.cc @@ -1,8 +1,3 @@ -#ifdef __WIN32 // Q_OS_WIN32 isn't available at this point - #define _WIN32_WINNT 0x0430 - #include -#endif - #include "hotkeywrapper.hh" #include "gddebug.hh" @@ -12,6 +7,7 @@ #ifdef Q_OS_WIN #include "mainwindow.hh" + #include #endif ////////////////////////////////////////////////////////////////////////// @@ -332,13 +328,13 @@ bool HotkeyWrapper::winEvent( MSG * message, qintptr * result ) return false; } +/// Ref: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes quint32 HotkeyWrapper::nativeKey( int key ) { - if ( key >= Qt::Key_0 && key <= Qt::Key_9 ) - return VK_NUMPAD0 + ( key - Qt::Key_0 ); - - if ( key >= Qt::Key_A && key <= Qt::Key_Z ) + // Qt's 0-9 & A-Z overlaps with Windows's VK + if ( key >= Qt::Key_0 && key <= Qt::Key_9 || key >= Qt::Key_A && key <= Qt::Key_Z ) { return key; + } switch ( key ) { case Qt::Key_Space: @@ -485,6 +481,8 @@ quint32 HotkeyWrapper::nativeKey( int key ) return 0x39; case Qt::Key_Underscore: return VK_OEM_MINUS; + case Qt::Key_Meta: + return VK_LWIN; default:; }