From e36f239917c998ff7271103a8a22ff0dbce2f781 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 15 Jun 2011 17:00:44 +0000 Subject: [PATCH] Changed the key handling code to use EventQueue::getTime() rather then the theEvent timestamp. --- src/osgViewer/GraphicsWindowCocoa.mm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/osgViewer/GraphicsWindowCocoa.mm b/src/osgViewer/GraphicsWindowCocoa.mm index b653ac381..b0c07f0a9 100644 --- a/src/osgViewer/GraphicsWindowCocoa.mm +++ b/src/osgViewer/GraphicsWindowCocoa.mm @@ -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); } }