mirror of https://github.com/BOINC/boinc.git
Manager: Fixes to allow building 64-bit application on Macintosh.
This commit is contained in:
parent
a8c2efe93d
commit
ed9737215b
|
@ -223,7 +223,6 @@ public:
|
|||
//
|
||||
bool WasFileModifiedBeforeSystemBoot(char * filePath);
|
||||
void HideThisApp(void);
|
||||
CGFloat GetMenuBarHeight(void);
|
||||
|
||||
#if !wxCHECK_VERSION(3,0,1)
|
||||
// This should be fixed after wxCocoa 3.0.0:
|
||||
|
|
|
@ -136,9 +136,39 @@ void CBOINCGUIApp::ShowApplication(bool bShow) {
|
|||
}
|
||||
}
|
||||
|
||||
CGFloat CBOINCGUIApp::GetMenuBarHeight() {
|
||||
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
|
||||
return menuBarHeight;
|
||||
|
||||
// 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)
|
||||
Boolean IsWindowOnScreen(int iLeft, int iTop, int iWidth, int iHeight) {
|
||||
CGRect intersectedRect;
|
||||
CGRect titleRect = CGRectMake(iLeft, iTop, iWidth, 22);
|
||||
// Make sure at least a 5X5 piece of title bar is visible
|
||||
titleRect = CGRectInset(titleRect, 5, 5);
|
||||
|
||||
|
||||
NSArray *allScreens = [NSScreen screens];
|
||||
unsigned int i;
|
||||
// The geometries of windows and display arangements are such
|
||||
// that even if the title bar spans multiple windows, a 5X5
|
||||
// section is on-screen only if at least one 5X5 section is
|
||||
// entirely on one or more displays, so this test is sufficient.
|
||||
unsigned int numDisplays = [ allScreens count ];
|
||||
for (i=0; i<numDisplays; i++) {
|
||||
NSScreen *aScreen = (NSScreen *)[ allScreens objectAtIndex:i ];
|
||||
NSRect visibleRect = [aScreen visibleFrame]; // Usable area of screen
|
||||
// Convert to QuickDraw coordinates (Y=0 at top of screen)
|
||||
NSRect fullScreenRect = [aScreen frame];
|
||||
visibleRect.origin.y = fullScreenRect.size.height - visibleRect.origin.y - visibleRect.size.height;
|
||||
|
||||
intersectedRect = CGRectIntersection(visibleRect, titleRect);
|
||||
if (! CGRectIsNull(intersectedRect)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -141,11 +141,6 @@ int CTaskBarIcon::SetDockBadge(wxBitmap* bmp) {
|
|||
NSImage *badge = bmp->GetNSImage();
|
||||
|
||||
[buf lockFocus];
|
||||
[appIcon drawAtPoint:NSMakePoint(0, 0)
|
||||
fromRect:NSZeroRect
|
||||
operation:NSCompositeSourceOver
|
||||
fraction:1.0f
|
||||
];
|
||||
[badge drawAtPoint:NSMakePoint(0, 0)
|
||||
fromRect:NSZeroRect
|
||||
operation:NSCompositeSourceOver
|
||||
|
|
|
@ -83,44 +83,3 @@ Boolean Mac_Authorize()
|
|||
|
||||
return sIsAuthorized;
|
||||
}
|
||||
|
||||
|
||||
#define MAX_DISPLAYS 32
|
||||
|
||||
// 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)
|
||||
Boolean IsWindowOnScreen(int iLeft, int iTop, int iWidth, int iHeight) {
|
||||
CGDirectDisplayID displays[MAX_DISPLAYS];
|
||||
CGDisplayCount numDisplays;
|
||||
CGDisplayCount i;
|
||||
CGRect displayRect, intersectedRect;
|
||||
CGFloat mBarHeight = wxGetApp().GetMenuBarHeight();
|
||||
|
||||
CGRect titleRect = CGRectMake(iLeft, iTop, iWidth, 22);
|
||||
// Make sure at least a 5X5 piece of title bar is visible
|
||||
titleRect = CGRectInset(titleRect, 5, 5);
|
||||
|
||||
CGGetActiveDisplayList (MAX_DISPLAYS, displays, &numDisplays);
|
||||
|
||||
// The geometries of windows and display arangements are such
|
||||
// that even if the title bar spans multiple windows, a 5X5
|
||||
// section is on-screen only if at least one 5X5 section is
|
||||
// entirely on one or more displays, so this test is sufficient.
|
||||
for (i = 0; i < numDisplays; i++)
|
||||
{
|
||||
displayRect = CGDisplayBounds(displays[i]);
|
||||
if (i == 0) { // CGDisplayBounds returns main display first
|
||||
displayRect.origin.y += mBarHeight;
|
||||
displayRect.size.height -= mBarHeight;
|
||||
}
|
||||
|
||||
intersectedRect = CGRectIntersection(displayRect, titleRect);
|
||||
if (! CGRectIsNull(intersectedRect)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue