From f13f0db33a18040e660b6ed76ad43d1870f096a2 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 2 Jun 2013 17:39:05 +0200 Subject: osx: create macosx_events to deal with keyDown events On OSX with Cocoa enabled keyDown events are now handled with addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to events even when there is no VO initialized but the GUI is focused. --- osdep/macosx_application_objc.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'osdep/macosx_application_objc.h') diff --git a/osdep/macosx_application_objc.h b/osdep/macosx_application_objc.h index b569d60f25..7c87ce6fa5 100644 --- a/osdep/macosx_application_objc.h +++ b/osdep/macosx_application_objc.h @@ -19,16 +19,30 @@ #import #include "osdep/macosx_application.h" -@interface Application : NSObject +struct cocoa_input_queue; + +@interface InputQueue : NSObject +- (void)push:(int)keycode; +- (int) pop; +@end + +@interface EventsResponder : NSResponder +- (NSEvent *)handleKeyDown:(NSEvent *)event; +@end + +@interface Application : NSApplication - (void)initialize_menu; - (void)registerSelector:(SEL)selector forKey:(MPMenuKey)key; - (void)stopPlayback; @property(nonatomic, assign) struct input_ctx *inputContext; @property(nonatomic, assign) struct mp_fifo *keyFIFO; +@property(nonatomic, retain) InputQueue *iqueue; +@property(nonatomic, retain) EventsResponder *eventsResponder; @property(nonatomic, retain) NSMutableDictionary *menuItems; @property(nonatomic, retain) NSArray *files; @property(nonatomic, retain) NSMutableArray *argumentsList; @property(nonatomic, assign) BOOL willStopOnOpenEvent; @end +Application *mpv_shared_app(void); -- cgit v1.2.3