fixed PrintScrn handling; it was being changed to keypad multiply.
This commit is contained in:
parent
a0c2cd10dd
commit
a4db7f0005
|
@ -596,6 +596,31 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// special handling of VK_SNAPSHOT
|
||||||
|
if ((virtualKey & 0xff) == VK_SNAPSHOT) {
|
||||||
|
// ignore key repeats on print screen
|
||||||
|
if (action != kRepeat) {
|
||||||
|
// get event flags
|
||||||
|
DWORD flags = 0;
|
||||||
|
if (isExtendedKey(virtualKey)) {
|
||||||
|
flags |= KEYEVENTF_EXTENDEDKEY;
|
||||||
|
}
|
||||||
|
if (action != kPress) {
|
||||||
|
flags |= KEYEVENTF_KEYUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// active window or fullscreen?
|
||||||
|
BYTE scan = 0;
|
||||||
|
if ((mask & KeyModifierAlt) == 0) {
|
||||||
|
scan = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send event
|
||||||
|
keybd_event(static_cast<BYTE>(virtualKey & 0xff), scan, flags, 0);
|
||||||
|
}
|
||||||
|
return m_mask;
|
||||||
|
}
|
||||||
|
|
||||||
// get output mask. default output mask carries over the current
|
// get output mask. default output mask carries over the current
|
||||||
// toggle modifier states and includes desired shift, control, alt,
|
// toggle modifier states and includes desired shift, control, alt,
|
||||||
// and meta states.
|
// and meta states.
|
||||||
|
@ -992,7 +1017,7 @@ CMSWindowsSecondaryScreen::toggleKey(UINT virtualKey, KeyModifierMask mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
CMSWindowsSecondaryScreen::virtualKeyToScanCode(UINT& virtualKey)
|
CMSWindowsSecondaryScreen::virtualKeyToScanCode(UINT& virtualKey) const
|
||||||
{
|
{
|
||||||
// try mapping given virtual key
|
// try mapping given virtual key
|
||||||
UINT code = MapVirtualKey(virtualKey & 0xff, 0);
|
UINT code = MapVirtualKey(virtualKey & 0xff, 0);
|
||||||
|
@ -1044,7 +1069,7 @@ CMSWindowsSecondaryScreen::virtualKeyToScanCode(UINT& virtualKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CMSWindowsSecondaryScreen::isExtendedKey(UINT virtualKey)
|
CMSWindowsSecondaryScreen::isExtendedKey(UINT virtualKey) const
|
||||||
{
|
{
|
||||||
// see if we've already encoded the extended flag
|
// see if we've already encoded the extended flag
|
||||||
if ((virtualKey & 0x100) != 0) {
|
if ((virtualKey & 0x100) != 0) {
|
||||||
|
@ -1079,5 +1104,5 @@ CMSWindowsSecondaryScreen::sendKeyEvent(UINT virtualKey, bool press)
|
||||||
const UINT code = virtualKeyToScanCode(virtualKey);
|
const UINT code = virtualKeyToScanCode(virtualKey);
|
||||||
keybd_event(static_cast<BYTE>(virtualKey & 0xff),
|
keybd_event(static_cast<BYTE>(virtualKey & 0xff),
|
||||||
static_cast<BYTE>(code), flags, 0);
|
static_cast<BYTE>(code), flags, 0);
|
||||||
log((CLOG_DEBUG2 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
|
log((CLOG_DEBUG1 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,8 +97,8 @@ private:
|
||||||
|
|
||||||
void releaseKeys();
|
void releaseKeys();
|
||||||
void toggleKey(UINT virtualKey, KeyModifierMask mask);
|
void toggleKey(UINT virtualKey, KeyModifierMask mask);
|
||||||
UINT virtualKeyToScanCode(UINT& virtualKey);
|
UINT virtualKeyToScanCode(UINT& virtualKey) const;
|
||||||
bool isExtendedKey(UINT virtualKey);
|
bool isExtendedKey(UINT virtualKey) const;
|
||||||
void sendKeyEvent(UINT virtualKey, bool press);
|
void sendKeyEvent(UINT virtualKey, bool press);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -929,6 +929,15 @@ CMSWindowsPrimaryScreen::mapKey(
|
||||||
vkCode2 = vkCode;
|
vkCode2 = vkCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the original vkCode is VK_SNAPSHOT then use it. oddly enough,
|
||||||
|
// some keyboards use the same scan code for keypad multiply and
|
||||||
|
// print screen. the difference is that the latter has the extended
|
||||||
|
// key flag set. but MapVirtualKey() doesn't seem capable of using
|
||||||
|
// that flag.
|
||||||
|
else if (vkCode == VK_SNAPSHOT) {
|
||||||
|
vkCode2 = vkCode;
|
||||||
|
}
|
||||||
|
|
||||||
// if MapVirtualKey failed then use original virtual key
|
// if MapVirtualKey failed then use original virtual key
|
||||||
else if (vkCode2 == 0) {
|
else if (vkCode2 == 0) {
|
||||||
vkCode2 = vkCode;
|
vkCode2 = vkCode;
|
||||||
|
|
Loading…
Reference in New Issue