diff options
author | FRAU KOUJIRO <frau@doushio.com> | 2014-04-15 17:09:47 -0700 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-08-06 09:31:58 +0200 |
commit | 78a2d99de130cc8e6adc18c5d7a987c5c8b2d2b3 (patch) | |
tree | 6a79a170ddfb76c649c45d24a743614cac1c33ba /osdep/macosx_events.m | |
parent | 78a266d599d08b2792efaeb6e9391cdff56c1281 (diff) | |
download | mpv-78a2d99de130cc8e6adc18c5d7a987c5c8b2d2b3.tar.bz2 mpv-78a2d99de130cc8e6adc18c5d7a987c5c8b2d2b3.tar.xz |
cocoa: sync inputContext inside EventsResponder
Diffstat (limited to 'osdep/macosx_events.m')
-rw-r--r-- | osdep/macosx_events.m | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 7a525f7dd5..c8da555fa1 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -36,6 +36,8 @@ @interface EventsResponder () { + struct input_ctx *_inputContext; + NSCondition *_input_ready; CFMachPortRef _mk_tap_port; HIDRemote *_remote; } @@ -188,9 +190,6 @@ void cocoa_put_key_with_modifiers(int keycode, int modifiers) @implementation EventsResponder -@synthesize inputContext = _input_context; -@synthesize input_ready = _input_ready; - + (EventsResponder *)sharedInstance { static EventsResponder *responder = nil; @@ -220,6 +219,27 @@ void cocoa_put_key_with_modifiers(int keycode, int modifiers) return self; } +- (void)waitForInputContext +{ + [_input_ready lock]; + while (!self.inputContext) + [_input_ready wait]; + [_input_ready unlock]; +} + +- (void)setInputContext:(struct input_ctx *)ctx; +{ + [_input_ready lock]; + _inputContext = ctx; + [_input_ready signal]; + [_input_ready unlock]; +} + +- (struct input_ctx *)inputContext +{ + return _inputContext; +} + - (BOOL)useAltGr { if (self.inputContext) |