1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-06 23:20:15 +00:00
mpv/video/out/cocoa/video_view.m
Akemi 076116a0e5 cocoa: set background of the title bar from black to white
due to the see-through nature of the title bar and our standard black
window background, the title bar appears dark grey opposed to the
expected light grey.

we change the window background to white but at the same time set the
background of the enclosed view to black. that way the title bar has a
white background and the background of our video stays black in all
cases. this prevents white flashing in some cases when the video is
resized with too heavy render settings.
2017-03-09 18:02:36 +01:00

53 lines
1.3 KiB
Objective-C

/*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include "osdep/macosx_compat.h"
#include "video/out/cocoa_common.h"
#include "video_view.h"
@implementation MpvVideoView
@synthesize adapter = _adapter;
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
}
return self;
}
- (void)setFrameSize:(NSSize)size
{
[super setFrameSize:size];
[self.adapter setNeedsResize];
}
- (NSRect)frameInPixels
{
return [self convertRectToBacking:[self frame]];
}
- (void)drawRect:(NSRect)rect
{
[[NSColor blackColor] setFill];
NSRectFill(rect);
[self.adapter performAsyncResize:[self frameInPixels].size];
}
@end