diff options
-rw-r--r-- | mpvcore/input/input.c | 3 | ||||
-rw-r--r-- | osdep/macosx_application.m | 43 | ||||
-rw-r--r-- | osdep/macosx_application_objc.h | 8 | ||||
-rw-r--r-- | osdep/macosx_events.h | 1 | ||||
-rw-r--r-- | osdep/macosx_events.m | 16 |
5 files changed, 3 insertions, 68 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index ed3136a5d4..2685083ecc 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -1744,9 +1744,6 @@ static void read_events(struct input_ctx *ictx, int time) static void read_all_events(struct input_ctx *ictx, int time) { getch2_poll(); -#ifdef CONFIG_COCOA - cocoa_check_events(); -#endif read_events(ictx, time); } diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index d04b2ccdea..e561d54c13 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -47,47 +47,6 @@ static pthread_t playback_thread_id; - (void)setAppleMenu:(NSMenu *)aMenu; @end -@implementation InputQueue { - NSMutableArray *_fifo; -} - -- (id)init -{ - if (self = [super init]) { - self->_fifo = [[NSMutableArray alloc] init]; - } - - return self; -} - -- (void)push:(int)keycode -{ - @synchronized (_fifo) { - [_fifo addObject:[NSNumber numberWithInt:keycode]]; - } -} - -- (int)pop -{ - int r = -1; - - @synchronized (_fifo) { - if ([_fifo count] > 0) { - r = [[_fifo objectAtIndex:0] intValue]; - [_fifo removeObjectAtIndex:0]; - } - } - - return r; -} - -- (void)dealloc -{ - [self->_fifo release]; - [super dealloc]; -} -@end - Application *mpv_shared_app(void) { return (Application *)[Application sharedApplication]; @@ -114,7 +73,6 @@ static NSString *escape_loadfile_name(NSString *input) @synthesize willStopOnOpenEvent = _will_stop_on_open_event; @synthesize inputContext = _input_context; -@synthesize iqueue = _iqueue; @synthesize eventsResponder = _events_responder; @synthesize menuItems = _menu_items; @@ -132,7 +90,6 @@ static NSString *escape_loadfile_name(NSString *input) self.menuItems = [[[NSMutableDictionary alloc] init] autorelease]; self.files = nil; self.argumentsList = [[[NSMutableArray alloc] init] autorelease]; - self.iqueue = [[[InputQueue alloc] init] autorelease]; self.eventsResponder = [[[EventsResponder alloc] init] autorelease]; self.willStopOnOpenEvent = NO; diff --git a/osdep/macosx_application_objc.h b/osdep/macosx_application_objc.h index 5bd05f8d8f..1af64dbcab 100644 --- a/osdep/macosx_application_objc.h +++ b/osdep/macosx_application_objc.h @@ -20,13 +20,6 @@ #include "osdep/macosx_application.h" #import "ar/HIDRemote.h" -struct cocoa_input_queue; - -@interface InputQueue : NSObject -- (void)push:(int)keycode; -- (int) pop; -@end - @interface EventsResponder : NSObject <HIDRemoteDelegate> - (BOOL)handleMediaKey:(NSEvent *)event; - (NSEvent *)handleKeyDown:(NSEvent *)event; @@ -45,7 +38,6 @@ struct cocoa_input_queue; - (void)stopPlayback; @property(nonatomic, assign) struct input_ctx *inputContext; -@property(nonatomic, retain) InputQueue *iqueue; @property(nonatomic, retain) EventsResponder *eventsResponder; @property(nonatomic, retain) NSMutableDictionary *menuItems; @property(nonatomic, retain) NSArray *files; diff --git a/osdep/macosx_events.h b/osdep/macosx_events.h index 409a210fb8..dcb96d2d43 100644 --- a/osdep/macosx_events.h +++ b/osdep/macosx_events.h @@ -23,7 +23,6 @@ void cocoa_put_key(int keycode); void cocoa_put_key_with_modifiers(int keycode, int modifiers); -void cocoa_check_events(void); void cocoa_init_apple_remote(void); void cocoa_uninit_apple_remote(void); diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index fe5376bd9c..dfa43a0437 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -150,26 +150,16 @@ static CGEventRef tap_event_callback(CGEventTapProxy proxy, CGEventType type, } void cocoa_init_media_keys(void) { - Application *app = mpv_shared_app(); - [app.eventsResponder startMediaKeys]; + [mpv_shared_app().eventsResponder startMediaKeys]; } void cocoa_uninit_media_keys(void) { - Application *app = mpv_shared_app(); - [app.eventsResponder stopMediaKeys]; -} - -void cocoa_check_events(void) -{ - Application *app = mpv_shared_app(); - int key; - while ((key = [app.iqueue pop]) >= 0) - mp_input_put_key(app.inputContext, key); + [mpv_shared_app().eventsResponder stopMediaKeys]; } void cocoa_put_key(int keycode) { - [mpv_shared_app().iqueue push:keycode]; + mp_input_put_key(mpv_shared_app().inputContext, keycode); } void cocoa_put_key_with_modifiers(int keycode, int modifiers) |