From cae7d9e86a54721f516d746adb9a94ca92a32b3e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 27 Jan 2014 17:46:36 +0000 Subject: Apply some OSX fixes from Ben Loftis. --- pugl/pugl_osx.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index d091a11..285d299 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -99,6 +99,7 @@ puglDisplay(PuglView* view) - (void) mouseDragged:(NSEvent*)event; - (void) mouseDown:(NSEvent*)event; - (void) mouseUp:(NSEvent*)event; +- (void) rightMouseDragged:(NSEvent*)event; - (void) rightMouseDown:(NSEvent*)event; - (void) rightMouseUp:(NSEvent*)event; - (void) keyDown:(NSEvent*)event; @@ -233,6 +234,15 @@ getModifiers(PuglView* view, NSEvent* ev) } } +- (void) rightMouseDragged:(NSEvent*)event +{ + if (puglview->motionFunc) { + NSPoint loc = [event locationInWindow]; + puglview->mods = getModifiers(puglview, event); + puglview->motionFunc(puglview, loc.x, puglview->height - loc.y); + } +} + - (void) mouseDown:(NSEvent*)event { if (puglview->mouseFunc) { @@ -303,7 +313,7 @@ getModifiers(PuglView* view, NSEvent* ev) - (void) flagsChanged:(NSEvent*)event { if (puglview->specialFunc) { - const unsigned mods = getModifiers(puglview, [event modifierFlags]); + const unsigned mods = getModifiers(puglview, event); if ((mods & PUGL_MOD_SHIFT) != (puglview->mods & PUGL_MOD_SHIFT)) { puglview->specialFunc(puglview, mods & PUGL_MOD_SHIFT, PUGL_KEY_SHIFT); } else if ((mods & PUGL_MOD_CTRL) != (puglview->mods & PUGL_MOD_CTRL)) { @@ -365,6 +375,10 @@ puglCreate(PuglNativeWindow parent, [window makeKeyAndOrderFront:window]; + if (!visible) { + [window setIsVisible:NO]; + } + return view; } -- cgit v1.2.3