Changed the key handling code to use EventQueue::getTime() rather then the theEvent timestamp.
This commit is contained in:
@@ -153,7 +153,7 @@ static unsigned int remapCocoaKey(unsigned int key, unsigned int modifiers)
|
||||
if (modifiers & NSFunctionKeyMask)
|
||||
pressedOnKeypad = false;
|
||||
|
||||
//std::cout << std::hex << "remap " << key << " keypad: " << pressedOnKeypad << " modifiers: " << modifiers << std::endl;
|
||||
std::cout << std::hex << "remap " << key << " keypad: " << pressedOnKeypad << " modifiers: " << modifiers << std::endl;
|
||||
|
||||
return s_CocoaKeyboardMap.remapKey(key, pressedOnKeypad);
|
||||
}
|
||||
@@ -379,21 +379,21 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
||||
|
||||
if ((flags & masks[i]) && !(_cachedModifierFlags & masks[i]))
|
||||
{
|
||||
_win->getEventQueue()->keyPress(keys[i], [theEvent timestamp], keys[i]);
|
||||
_win->getEventQueue()->keyPress(keys[i], _win->getEventQueue()->getTime(), keys[i]);
|
||||
|
||||
// we don't get a key up for the caps lock so emulate it.
|
||||
if (i == 4)
|
||||
_win->getEventQueue()->keyRelease(keys[i], [theEvent timestamp], keys[i]);
|
||||
_win->getEventQueue()->keyRelease(keys[i], _win->getEventQueue()->getTime(), keys[i]);
|
||||
}
|
||||
|
||||
if (!(flags & masks[i]) && (_cachedModifierFlags & masks[i]))
|
||||
{
|
||||
if (i == 4) {
|
||||
// emulate a key down for caps-lock.
|
||||
_win->getEventQueue()->keyPress(keys[i], [theEvent timestamp], keys[i]);
|
||||
_win->getEventQueue()->keyPress(keys[i], _win->getEventQueue()->getTime(), keys[i]);
|
||||
}
|
||||
|
||||
_win->getEventQueue()->keyRelease(keys[i], [theEvent timestamp], keys[i]);
|
||||
_win->getEventQueue()->keyRelease(keys[i], _win->getEventQueue()->getTime(), keys[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -701,8 +701,8 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
||||
if ((chars) && ([chars length] > 0)) {
|
||||
unsigned int unmodified_keyCode = remapCocoaKey([unmodified_chars characterAtIndex:0], [theEvent modifierFlags] );
|
||||
unsigned int keyCode = remapCocoaKey([chars characterAtIndex:0], [theEvent modifierFlags] );
|
||||
//std::cout << std::hex << "key dn: " <<[chars characterAtIndex:0] << "=" << keyCode << " unmodified: " << unmodified_keyCode << std::endl;
|
||||
_win->getEventQueue()->keyPress( keyCode, [theEvent timestamp], unmodified_keyCode);
|
||||
//std::cout << std::hex << "key dn: " <<[chars characterAtIndex:0] << "=" << keyCode << " unmodified: " << unmodified_keyCode << std::endl;
|
||||
_win->getEventQueue()->keyPress( keyCode, _win->getEventQueue()->getTime(), unmodified_keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,9 +721,9 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
||||
if ((chars) && ([chars length] > 0)) {
|
||||
unsigned int unmodified_keyCode = remapCocoaKey([unmodified_chars characterAtIndex:0], [theEvent modifierFlags] );
|
||||
unsigned int keyCode = remapCocoaKey([chars characterAtIndex:0], [theEvent modifierFlags] );
|
||||
//std::cout << std::hex << "key up: " <<[chars characterAtIndex:0] << "=" << keyCode << " unmodified: " << unmodified_keyCode << std::endl;
|
||||
//std::cout << std::hex << "key up: " <<[chars characterAtIndex:0] << "=" << keyCode << " unmodified: " << unmodified_keyCode << std::endl;
|
||||
|
||||
_win->getEventQueue()->keyRelease( keyCode, [theEvent timestamp], unmodified_keyCode);
|
||||
_win->getEventQueue()->keyRelease( keyCode, _win->getEventQueue()->getTime(), unmodified_keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user