fixed: modifier keys are repeated on windows server.

This commit is contained in:
Nick Bolton 2014-03-31 15:54:57 +00:00
parent 6649887ca6
commit 68557afff2
2 changed files with 37 additions and 0 deletions

View File

@ -1136,6 +1136,11 @@ CMSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
} }
} }
// stop sending modifier keys over and over again
if (isModifierRepeat(oldState, state, wParam)) {
return true;
}
// ignore message if posted prior to last mark change // ignore message if posted prior to last mark change
if (!ignore()) { if (!ignore()) {
// check for ctrl+alt+del. we do not want to pass that to the // check for ctrl+alt+del. we do not want to pass that to the
@ -1816,3 +1821,31 @@ CMSWindowsScreen::getDropTarget() const
{ {
return m_desktopPath; return m_desktopPath;
} }
bool
CMSWindowsScreen::isModifierRepeat(KeyModifierMask oldState, KeyModifierMask state, WPARAM wParam) const
{
bool result = false;
if (oldState == state && state != 0) {
UINT virtKey = (wParam & 0xffu);
if ((state & KeyModifierShift) != 0
&& (virtKey == VK_LSHIFT || virtKey == VK_RSHIFT)) {
result = true;
}
if ((state & KeyModifierControl) != 0
&& (virtKey == VK_LCONTROL || virtKey == VK_RCONTROL)) {
result = true;
}
if ((state & KeyModifierAlt) != 0
&& (virtKey == VK_LMENU || virtKey == VK_RMENU)) {
result = true;
}
if ((state & KeyModifierSuper) != 0
&& (virtKey == VK_LWIN || virtKey == VK_RWIN)) {
result = true;
}
}
return result;
}

View File

@ -212,6 +212,10 @@ private: // HACK
// save last position of mouse to compute next delta movement // save last position of mouse to compute next delta movement
void saveMousePosition(SInt32 x, SInt32 y); void saveMousePosition(SInt32 x, SInt32 y);
// check if it is a modifier key repeating message
bool isModifierRepeat(KeyModifierMask oldState,
KeyModifierMask state, WPARAM wParam) const;
private: private:
struct CHotKeyItem { struct CHotKeyItem {
public: public: