Permalink
Browse files

Detecting keyboard events when a modifier key is pressed standalone o…

…n OSX
  • Loading branch information...
arielm committed Jul 10, 2012
1 parent ed92147 commit eb35a8e38b39d6d6dc7b7ec3f551f29eeda77b0c
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/cinder/app/CinderView.mm
@@ -195,6 +195,21 @@ - (void)keyUp:(NSEvent*)theEvent
app->privateKeyUp__( cinder::app::KeyEvent (cinder::app::KeyEvent::translateNativeKeyCode( code ), (char)c, mods, code) );
}
+- (void)flagsChanged:(NSEvent *)theEvent
+{
+ int code = [theEvent keyCode];
+ int mods = [self prepKeyEventModifiers:theEvent];
+
+ if ([theEvent modifierFlags] == 0x100)
+ {
+ app->privateKeyUp__( cinder::app::KeyEvent (cinder::app::KeyEvent::translateNativeKeyCode( code ), 0, mods, code) );
+ }
+ else
+ {
+ app->privateKeyDown__( cinder::app::KeyEvent (cinder::app::KeyEvent::translateNativeKeyCode( code ), 0, mods, code) );
+ }
+}
+
- (void)mouseDown:(NSEvent*)theEvent
{
NSPoint curPoint = [theEvent locationInWindow];

0 comments on commit eb35a8e

Please sign in to comment.