aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-01-02 14:31:40 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-01-02 14:31:40 +0000
commit6617557973a227445e5ac89624523e97ed2eb389 (patch)
tree267a1b31bf121bad333946f4a9a27accd8821563 /src
parente89639816cb5ef1c703a6fbffe80549e9c732561 (diff)
downloadqmmp-6617557973a227445e5ac89624523e97ed2eb389.tar.gz
qmmp-6617557973a227445e5ac89624523e97ed2eb389.tar.bz2
qmmp-6617557973a227445e5ac89624523e97ed2eb389.zip
hotkey plugin: fixed special keys support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3996 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/plugins/General/hotkey/hotkeymanager_win.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/plugins/General/hotkey/hotkeymanager_win.cpp b/src/plugins/General/hotkey/hotkeymanager_win.cpp
index 3e074d941..b6b373010 100644
--- a/src/plugins/General/hotkey/hotkeymanager_win.cpp
+++ b/src/plugins/General/hotkey/hotkeymanager_win.cpp
@@ -36,6 +36,26 @@
#include <qmmpui/uihelper.h>
#include "hotkeymanager.h"
+static struct
+{
+ unsigned int key; //virtual key
+ unsigned long code; //scan code
+} keyMap [] = {
+ { VK_LEFT, 0x14b },
+ { VK_UP, 0x148 },
+ { VK_RIGHT, 0x14d },
+ { VK_DOWN, 0x150 },
+ { VK_PRIOR, 0x149 },
+ { VK_NEXT, 0x151 },
+ { VK_END, 0x14F },
+ { VK_HOME, 0x147 },
+ { VK_INSERT, 0x152 },
+ { VK_DELETE, 0x153 },
+ { VK_DIVIDE, 0x135 },
+ { VK_NUMLOCK, 0x145 },
+{ 0, 0 }
+};
+
quint32 Hotkey::defaultKey()
{
return defaultKey(action);
@@ -207,11 +227,20 @@ const QString HotkeyManager::getKeyString(quint32 key, quint32 modifiers)
keyStr.append(strModList[j] + "+");
}
- LONG lScan = MapVirtualKey(key, 0) << 16;
-
if(key == VK_SHIFT || key == VK_CONTROL || key == VK_LWIN || key == VK_RWIN || key == VK_MENU)
return keyStr;
+ LONG lScan = MapVirtualKey(key, 0) << 16;
+
+ for(int i = 0; i < 12; ++i)
+ {
+ if(keyMap[i].key == key)
+ {
+ lScan |= 0x1000000; // set extended bit
+ break;
+ }
+ }
+
int nBufferLen = 64;
std::wstring str;
int nLen;
@@ -235,6 +264,13 @@ QList<long> HotkeyManager::ignModifiersList()
quint32 HotkeyManager::keycodeToKeysym(quint32 keycode)
{
+ //MapVirtualKey does not work with some scan codes
+ //using hardcoded key map instead
+ for(int i = 0; i < 12; ++i)
+ {
+ if(keyMap[i].code == keycode)
+ return keyMap[i].key;
+ }
return MapVirtualKey(keycode, 1);
}
#endif