mirror of https://github.com/mpv-player/mpv
osx: code cleanups and cosmetic fixes
silence build warnings, clean up code style and remove unused code.
This commit is contained in:
parent
e0a2d15216
commit
344b75f52d
|
@ -45,7 +45,7 @@ typedef NSUInteger NSEventModifierFlags;
|
|||
|
||||
static const NSEventModifierFlags NSEventModifierFlagShift = NSShiftKeyMask;
|
||||
static const NSEventModifierFlags NSEventModifierFlagControl = NSControlKeyMask;
|
||||
static const NSEventModifierFlags NSEventModifierFlagCommand = NSCommandKeyMask;
|
||||
static const NSEventModifierFlags NSEventModifierFlagCommand = NSCommandKeyMask;
|
||||
static const NSEventModifierFlags NSEventModifierFlagOption = NSAlternateKeyMask;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ static int mk_flags(NSEvent *event)
|
|||
return ([event data1] & 0x0000FFFF);
|
||||
}
|
||||
|
||||
static int mk_down(NSEvent *event)
|
||||
static int mk_down(NSEvent *event)
|
||||
{
|
||||
return (((mk_flags(event) & 0xFF00) >> 8)) == 0xA;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
|
|||
[_input_lock unlock];
|
||||
}
|
||||
|
||||
- (void)setInputContext:(struct input_ctx *)ctx;
|
||||
- (void)setInputContext:(struct input_ctx *)ctx
|
||||
{
|
||||
[_input_lock lock];
|
||||
_inputContext = ctx;
|
||||
|
@ -346,7 +346,6 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
|
|||
|
||||
- (void)startAppleRemote
|
||||
{
|
||||
|
||||
#if HAVE_APPLE_REMOTE
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self->_remote = [[HIDRemote alloc] init];
|
||||
|
@ -356,8 +355,8 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
|
|||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
- (void)stopAppleRemote
|
||||
{
|
||||
#if HAVE_APPLE_REMOTE
|
||||
|
@ -367,10 +366,12 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
|
|||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)restartMediaKeys
|
||||
{
|
||||
CGEventTapEnable(self->_mk_tap_port, true);
|
||||
}
|
||||
|
||||
- (void)startMediaKeys
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
@ -390,6 +391,7 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
|
|||
[[NSRunLoop mainRunLoop] addPort:port forMode:NSRunLoopCommonModes];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)stopMediaKeys
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "events_view.h"
|
||||
|
||||
@interface MpvEventsView()
|
||||
@property(nonatomic, assign) BOOL clearing;
|
||||
@property(nonatomic, assign) BOOL hasMouseDown;
|
||||
@property(nonatomic, retain) NSTrackingArea *tracker;
|
||||
- (int)mpvButtonNumber:(NSEvent*)event;
|
||||
|
@ -32,7 +31,6 @@
|
|||
@end
|
||||
|
||||
@implementation MpvEventsView
|
||||
@synthesize clearing = _clearing;
|
||||
@synthesize adapter = _adapter;
|
||||
@synthesize tracker = _tracker;
|
||||
@synthesize hasMouseDown = _mouse_down;
|
||||
|
@ -110,6 +108,7 @@
|
|||
{
|
||||
return [self.adapter mouseEnabled];
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return [self.adapter keyboardEnabled] || [self.adapter mouseEnabled];
|
||||
|
@ -145,14 +144,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)setFrameSize:(NSSize)size
|
||||
{
|
||||
[super setFrameSize:size];
|
||||
|
||||
if (self.clearing)
|
||||
return;
|
||||
}
|
||||
|
||||
- (NSPoint)convertPointToPixels:(NSPoint)point
|
||||
{
|
||||
point = [self convertPoint:point fromView:nil];
|
||||
|
@ -195,6 +186,7 @@
|
|||
[super mouseDown:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseUp:(NSEvent *)event
|
||||
{
|
||||
if ([self.adapter mouseEnabled]) {
|
||||
|
@ -203,6 +195,7 @@
|
|||
[super mouseUp:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)rightMouseDown:(NSEvent *)event
|
||||
{
|
||||
if ([self.adapter mouseEnabled]) {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
@synthesize currentScreen = _current_screen;
|
||||
@synthesize unfScreen = _unf_Screen;
|
||||
- (id)initWithContentRect:(NSRect)content_rect
|
||||
styleMask:(NSUInteger)style_mask
|
||||
styleMask:(NSWindowStyleMask)style_mask
|
||||
backing:(NSBackingStoreType)buffering_type
|
||||
defer:(BOOL)flag
|
||||
screen:(NSScreen *)screen
|
||||
|
@ -255,6 +255,7 @@
|
|||
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
{
|
||||
cocoa_put_key(MP_KEY_CLOSE_WIN);
|
||||
|
|
|
@ -129,7 +129,6 @@ static void run_on_main_thread(struct vo *vo, void(^block)(void))
|
|||
static void queue_new_video_size(struct vo *vo, int w, int h)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
struct mp_vo_opts *opts = vo->opts;
|
||||
id<MpvWindowUpdate> win = (id<MpvWindowUpdate>) s->window;
|
||||
NSRect r = NSMakeRect(0, 0, w, h);
|
||||
r = [s->current_screen convertRectFromBacking:r];
|
||||
|
@ -955,7 +954,6 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
|
|||
|
||||
- (void)performAsyncResize:(NSSize)size
|
||||
{
|
||||
struct vo_cocoa_state *s = self.vout->cocoa;
|
||||
vo_cocoa_resize_redraw(self.vout, size.width, size.height);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue