diff options
author | David Robillard <d@drobilla.net> | 2015-02-15 02:45:51 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-15 02:45:51 -0500 |
commit | b940da411bff04af2bed713b730546ef4378e457 (patch) | |
tree | 524ac47fbff95f1d2eafd3e0737c4fbfaec219d1 /pugl/pugl_osx.m | |
parent | 70f365258d73ac8cc37025777e13fdf9e016922c (diff) | |
download | pugl-b940da411bff04af2bed713b730546ef4378e457.tar.gz pugl-b940da411bff04af2bed713b730546ef4378e457.tar.bz2 pugl-b940da411bff04af2bed713b730546ef4378e457.zip |
UTF-8 support on OSX.
Diffstat (limited to 'pugl/pugl_osx.m')
-rw-r--r-- | pugl/pugl_osx.m | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index c7dbf5e..85e71a8 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -348,7 +348,8 @@ getModifiers(PuglView* view, NSEvent* ev) const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; const NSString* chars = [event characters]; - const PuglEventKey ev = { + const char* str = [chars UTF8String]; + PuglEventKey ev = { PUGL_KEY_PRESS, puglview, false, @@ -358,9 +359,13 @@ getModifiers(PuglView* view, NSEvent* ev) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(puglview, event), - [chars characterAtIndex:0], - 0 // TODO: Special keys? + [event keyCode], + puglDecodeUTF8((const uint8_t*)str), + 0, // TODO: Special keys? + { 0, 0, 0, 0, 0, 0, 0, 0 }, + false }; + strncpy((char*)ev.utf8, str, 8); puglDispatchEvent(puglview, (PuglEvent*)&ev); } @@ -369,6 +374,7 @@ getModifiers(PuglView* view, NSEvent* ev) const NSPoint wloc = [self eventLocation:event]; const NSPoint rloc = [NSEvent mouseLocation]; const NSString* chars = [event characters]; + const char* str = [chars UTF8String]; const PuglEventKey ev = { PUGL_KEY_RELEASE, puglview, @@ -379,9 +385,13 @@ getModifiers(PuglView* view, NSEvent* ev) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(puglview, event), - [chars characterAtIndex:0], - 0 // TODO: Special keys? + [event keyCode], + puglDecodeUTF8((const uint8_t*)str), + 0, // TODO: Special keys? + { 0, 0, 0, 0, 0, 0, 0, 0 }, + false, }; + strncpy((char*)ev.utf8, str, 8); puglDispatchEvent(puglview, (PuglEvent*)&ev); } @@ -535,3 +545,9 @@ puglGetNativeWindow(PuglView* view) { return (PuglNativeWindow)view->impl->glview; } + +void* +puglGetContext(PuglView* view) +{ + return NULL; +} |