1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 04:58:06 +00:00

cocoa: move updateBorder method to the protocol

we are calling the method on a NSWindow object that may not respond to
that call, since its a method of MpvVideoWindow. add the method to our
protocol and rename that protocol to reflect the change.
This commit is contained in:
Akemi 2017-01-14 17:10:08 +01:00
parent 202f9b218a
commit fe02e5023c
2 changed files with 6 additions and 5 deletions

View File

@ -18,14 +18,14 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "video/out/cocoa/mpvadapter.h" #import "video/out/cocoa/mpvadapter.h"
@protocol MpvSizing @protocol MpvWindowUpdate
- (void)queueNewVideoSize:(NSSize)newSize; - (void)queueNewVideoSize:(NSSize)newSize;
- (void)updateBorder:(int)border;
@end @end
@interface MpvVideoWindow : NSWindow <NSWindowDelegate, MpvSizing> @interface MpvVideoWindow : NSWindow <NSWindowDelegate, MpvWindowUpdate>
@property(nonatomic, retain) MpvCocoaAdapter *adapter; @property(nonatomic, retain) MpvCocoaAdapter *adapter;
- (BOOL)canBecomeKeyWindow; - (BOOL)canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow; - (BOOL)canBecomeMainWindow;
- (void)mulSize:(float)multiplier; - (void)mulSize:(float)multiplier;
- (void)updateBorder:(int)border;
@end @end

View File

@ -146,7 +146,7 @@ static void queue_new_video_size(struct vo *vo, int w, int h)
{ {
struct vo_cocoa_state *s = vo->cocoa; struct vo_cocoa_state *s = vo->cocoa;
struct mp_vo_opts *opts = vo->opts; struct mp_vo_opts *opts = vo->opts;
id<MpvSizing> win = (id<MpvSizing>) s->window; id<MpvWindowUpdate> win = (id<MpvWindowUpdate>) s->window;
NSRect r = calculate_window_geometry(vo, NSMakeRect(0, 0, w, h)); NSRect r = calculate_window_geometry(vo, NSMakeRect(0, 0, w, h));
[win queueNewVideoSize:NSMakeSize(r.size.width, r.size.height)]; [win queueNewVideoSize:NSMakeSize(r.size.width, r.size.height)];
} }
@ -592,7 +592,8 @@ static int vo_cocoa_window_border(struct vo *vo)
return VO_NOTIMPL; return VO_NOTIMPL;
struct mp_vo_opts *opts = vo->opts; struct mp_vo_opts *opts = vo->opts;
[s->window updateBorder:opts->border]; id<MpvWindowUpdate> win = (id<MpvWindowUpdate>) s->window;
[win updateBorder:opts->border];
if (opts->border) if (opts->border)
cocoa_set_window_title(vo); cocoa_set_window_title(vo);