mirror of
https://github.com/mpv-player/mpv
synced 2024-12-30 19:22:11 +00:00
cocoa: constraint the window position a little more
The intention of this is to not make the window go outside the screen when changing dimensions from 2x to .5x.
This commit is contained in:
parent
607892b741
commit
bc49957458
@ -15,6 +15,8 @@
|
||||
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libavutil/common.h>
|
||||
|
||||
#include "mpvcore/input/keycodes.h"
|
||||
|
||||
#include "osdep/macosx_application.h"
|
||||
@ -121,8 +123,11 @@
|
||||
- (NSRect)constrainFrameRect:(NSRect)nf toScreen:(NSScreen *)screen
|
||||
{
|
||||
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;
|
||||
nf.origin.y = s.origin.y + s.size.height - nf.size.height;
|
||||
}
|
||||
|
||||
return nf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user