From 2b8b17402ed59815019b309051b277ba4de82f3b Mon Sep 17 00:00:00 2001 From: Akemi Date: Thu, 15 Dec 2016 23:06:04 +0100 Subject: cocoa: cosmetic fixes --- video/out/cocoa/events_view.m | 23 ++++++++++++++--------- video/out/cocoa/video_view.m | 3 ++- video/out/cocoa/window.m | 6 ++++-- video/out/cocoa_common.m | 15 ++++++++++----- 4 files changed, 30 insertions(+), 17 deletions(-) (limited to 'video') diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m index 53d1da86ff..d377597006 100644 --- a/video/out/cocoa/events_view.m +++ b/video/out/cocoa/events_view.m @@ -39,7 +39,8 @@ @synthesize tracker = _tracker; @synthesize hasMouseDown = _mouse_down; -- (id)initWithFrame:(NSRect)frame { +- (id)initWithFrame:(NSRect)frame +{ self = [super initWithFrame:frame]; if (self) { [self registerForDraggedTypes:@[NSFilenamesPboardType, @@ -96,21 +97,25 @@ { return [self.adapter mouseEnabled]; } -- (BOOL)acceptsFirstResponder { +- (BOOL)acceptsFirstResponder +{ return [self.adapter keyboardEnabled] || [self.adapter mouseEnabled]; } -- (BOOL)becomeFirstResponder { +- (BOOL)becomeFirstResponder +{ return [self.adapter keyboardEnabled] || [self.adapter mouseEnabled]; } - (BOOL)resignFirstResponder { return YES; } -- (void)keyDown:(NSEvent *)event { +- (void)keyDown:(NSEvent *)event +{ [self.adapter putKeyEvent:event]; } -- (void)keyUp:(NSEvent *)event { +- (void)keyUp:(NSEvent *)event +{ [self.adapter putKeyEvent:event]; } @@ -298,10 +303,11 @@ NSPasteboard *pboard = [sender draggingPasteboard]; NSArray *types = [pboard types]; if ([types containsObject:NSFilenamesPboardType] || - [types containsObject:NSURLPboardType]) + [types containsObject:NSURLPboardType]) { return NSDragOperationCopy; - else + } else { return NSDragOperationNone; + } } - (BOOL)performDragOperation:(id )sender @@ -314,8 +320,7 @@ for (NSURL* url in pbitems) { if (url.fileURL) { [ar addObject:[url path]]; - } - else { + } else { [ar addObject:[url absoluteString]]; } } diff --git a/video/out/cocoa/video_view.m b/video/out/cocoa/video_view.m index 786c6ef4da..cb09dc8b9f 100644 --- a/video/out/cocoa/video_view.m +++ b/video/out/cocoa/video_view.m @@ -22,7 +22,8 @@ @implementation MpvVideoView @synthesize adapter = _adapter; -- (id)initWithFrame:(NSRect)frame { +- (id)initWithFrame:(NSRect)frame +{ self = [super initWithFrame:frame]; if (self) { [self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m index 6d63263cb4..68e5222a03 100644 --- a/video/out/cocoa/window.m +++ b/video/out/cocoa/window.m @@ -309,7 +309,8 @@ _unfs_content_frame = [self frameRect:_unfs_content_frame forCenteredContentSize:newSize]; } -- (void)tryDequeueSize { +- (void)tryDequeueSize +{ if (_queued_video_size.width <= 0.0 || _queued_video_size.height <= 0.0) return; @@ -330,7 +331,8 @@ } } -- (void)windowDidBecomeMain:(NSNotification *)notification { +- (void)windowDidBecomeMain:(NSNotification *)notification +{ [self tryDequeueSize]; } @end diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index c1a65ef2ee..164663c332 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -803,20 +803,24 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg) @implementation MpvCocoaAdapter @synthesize vout = _video_output; -- (void)performAsyncResize:(NSSize)size { +- (void)performAsyncResize:(NSSize)size +{ struct vo_cocoa_state *s = self.vout->cocoa; vo_cocoa_resize_redraw(self.vout, size.width, size.height); } -- (BOOL)keyboardEnabled { +- (BOOL)keyboardEnabled +{ return !!mp_input_vo_keyboard_enabled(self.vout->input_ctx); } -- (BOOL)mouseEnabled { +- (BOOL)mouseEnabled +{ return !!mp_input_mouse_enabled(self.vout->input_ctx); } -- (void)setNeedsResize { +- (void)setNeedsResize +{ resize_event(self.vout); } @@ -830,7 +834,8 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg) [self.vout->cocoa->window setMovableByWindowBackground:movable]; } -- (void)signalMouseMovement:(NSPoint)point { +- (void)signalMouseMovement:(NSPoint)point +{ mp_input_set_mouse_pos(self.vout->input_ctx, point.x, point.y); [self recalcMovableByWindowBackground:point]; } -- cgit v1.2.3