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.
This commit is contained in:
Stefano Pigozzi
2013-06-02 17:39:05 +02:00
parent 63e2a21c64
commit f13f0db33a
10 changed files with 273 additions and 208 deletions

View File

@@ -19,16 +19,30 @@
#import <Cocoa/Cocoa.h>
#include "osdep/macosx_application.h"
@interface Application : NSObject<NSApplicationDelegate>
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);