mirror of https://github.com/mpv-player/mpv
cocoa: apply the more invasive constraining only with cmd+1/2/3
Regression from bc49957
Fixes #321
This commit is contained in:
parent
131fad8bc9
commit
1dbbd845a4
|
@ -31,6 +31,7 @@
|
||||||
@implementation MpvVideoWindow {
|
@implementation MpvVideoWindow {
|
||||||
NSSize _queued_video_size;
|
NSSize _queued_video_size;
|
||||||
bool _fs_resize_scheduled;
|
bool _fs_resize_scheduled;
|
||||||
|
bool _recenter_window_during_constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize adapter = _adapter;
|
@synthesize adapter = _adapter;
|
||||||
|
@ -117,6 +118,7 @@
|
||||||
CGFloat dx = (f.size.width - ns.width) / 2;
|
CGFloat dx = (f.size.width - ns.width) / 2;
|
||||||
CGFloat dy = (f.size.height - ns.height - [self titleHeight]) / 2;
|
CGFloat dy = (f.size.height - ns.height - [self titleHeight]) / 2;
|
||||||
NSRect nf = NSRectFromCGRect(CGRectInset(NSRectToCGRect(f), dx, dy));
|
NSRect nf = NSRectFromCGRect(CGRectInset(NSRectToCGRect(f), dx, dy));
|
||||||
|
self->_recenter_window_during_constraint = true;
|
||||||
[self setFrame:nf display:NO animate:NO];
|
[self setFrame:nf display:NO animate:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +126,19 @@
|
||||||
{
|
{
|
||||||
NSRect s = [[self screen] visibleFrame];
|
NSRect s = [[self screen] visibleFrame];
|
||||||
if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) {
|
if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) {
|
||||||
nf.size.height = s.size.height;
|
if (self->_recenter_window_during_constraint)
|
||||||
|
nf.size.height = s.size.height;
|
||||||
nf.origin.y = s.origin.y + s.size.height - nf.size.height;
|
nf.origin.y = s.origin.y + s.size.height - nf.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf;
|
return nf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setFrame:(NSRect)frame display:(BOOL)display animate:(BOOL)animate
|
||||||
|
{
|
||||||
|
[super setFrame:frame display:display animate:animate];
|
||||||
|
self->_recenter_window_during_constraint = false;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)queueNewVideoSize:(NSSize)new_size
|
- (void)queueNewVideoSize:(NSSize)new_size
|
||||||
{
|
{
|
||||||
NSSize prev_size = self->_queued_video_size;
|
NSSize prev_size = self->_queued_video_size;
|
||||||
|
|
Loading…
Reference in New Issue