From 9e381ff68a4833b998445bbee844e85cf094b6c7 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Thu, 20 Feb 2014 13:56:46 +1100 Subject: When window is offscreen, use the main screen for screen max Y to prevent the window disappearing. --- cocoa/PlatCocoa.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 304798cbb..28c0f8107 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1121,6 +1121,8 @@ bool Window::HasFocus() static int ScreenMax(NSWindow* win) { NSScreen* screen = [win screen]; + if (!screen) + screen = [NSScreen mainScreen]; NSRect frame = [screen frame]; return frame.origin.y + frame.size.height; } -- cgit v1.2.3