diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index 25118cae79..b7985f54af 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -1032,7 +1032,10 @@ wxInt32 CDlgEventLog::FormatTime(wxInt32 item, wxString& strBuffer) const { #ifdef __WXMAC__ // Work around a wxCocoa bug(?) in wxDateTime::Format() char buf[80]; - struct tm * timeinfo = localtime((time_t*)&message->timestamp); + // When building as a 64-bit app, we must convert + // 4-byte int message->timestamp to 8-byte time_t + time_t timeStamp = message->timestamp; + struct tm * timeinfo = localtime(&timeStamp); strftime(buf, sizeof(buf), "%c", timeinfo); strBuffer = buf; #else diff --git a/clientgui/mac/BOINCGUIApp.mm b/clientgui/mac/BOINCGUIApp.mm index f2d35f7fe5..0d9b9eeb47 100644 --- a/clientgui/mac/BOINCGUIApp.mm +++ b/clientgui/mac/BOINCGUIApp.mm @@ -137,17 +137,25 @@ void CBOINCGUIApp::ShowApplication(bool bShow) { } +// NSTitledWindowMask is deprecated in OS 10.12 and is replaced by +// NSWindowStyleMaskTitled, which is not defined before OS 10.12 +#ifndef NSWindowStyleMaskTitled +#define NSWindowStyleMaskTitled NSTitledWindowMask +#endif + // Returns true if at least a 5 X 5 pixel area of the // window's title bar is entirely on the displays -// Note: Arguments are Quickdraw-style coordinates, -// but CGDisplayBounds() sets top left corner as (0, 0) +// Note: Arguments are wxWidgets / Quickdraw-style coordinates +// (y=0 at top) but NSScreen coordinates have y=0 at bottom Boolean IsWindowOnScreen(int iLeft, int iTop, int iWidth, int iHeight) { - CGRect intersectedRect; - CGRect titleRect = CGRectMake(iLeft, iTop, iWidth, 22); + NSRect testFrameRect = NSMakeRect(100, 100, 200, 200); + NSRect testContentRect = [NSWindow contentRectForFrameRect:testFrameRect + styleMask:NSWindowStyleMaskTitled]; + CGFloat titleBarHeight = testFrameRect.size.height - testContentRect.size.height; // Make sure at least a 5X5 piece of title bar is visible - titleRect = CGRectInset(titleRect, 5, 5); + NSRect titleRect = NSMakeRect(iLeft, iTop, iWidth, titleBarHeight); + titleRect = NSInsetRect(titleRect, 5, 5); - NSArray *allScreens = [NSScreen screens]; unsigned int i; // The geometries of windows and display arangements are such @@ -158,12 +166,11 @@ Boolean IsWindowOnScreen(int iLeft, int iTop, int iWidth, int iHeight) { for (i=0; i