mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: windows global hotkey Win/Meta and 1-9 doesn't work
This commit is contained in:
parent
beef6dd138
commit
5cc43a3dc8
|
@ -1,8 +1,3 @@
|
|||
#ifdef __WIN32 // Q_OS_WIN32 isn't available at this point
|
||||
#define _WIN32_WINNT 0x0430
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "hotkeywrapper.hh"
|
||||
#include "gddebug.hh"
|
||||
|
||||
|
@ -12,6 +7,7 @@
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "mainwindow.hh"
|
||||
#include <windows.h>
|
||||
#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:;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue