[boinc] 01/06: New upstream version 7.8.6+dfsg
Gianfranco Costamagna
locutusofborg at moszumanska.debian.org
Mon Jan 15 15:50:44 UTC 2018
This is an automated email from the git hooks/post-receive script.
locutusofborg pushed a commit to branch master
in repository boinc.
commit 263db86363270ff13442da102187c14a888184a8
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date: Mon Jan 15 16:41:28 2018 +0100
New upstream version 7.8.6+dfsg
---
client/hostinfo_unix.cpp | 21 +++++++-----
clientscr/Mac_Saver_ModuleView.h | 2 ++
clientscr/Mac_Saver_ModuleView.m | 71 +++++++++++++++++++++++++++++++++++++---
clientscr/screensaver.cpp | 3 ++
configure.ac | 2 +-
version.log | 2 +-
6 files changed, 86 insertions(+), 15 deletions(-)
diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp
index 1c91863..7d1616c 100644
--- a/client/hostinfo_unix.cpp
+++ b/client/hostinfo_unix.cpp
@@ -1472,6 +1472,18 @@ int HOST_INFO::get_memory_info() {
#elif defined(_SC_USEABLE_MEMORY)
// UnixWare
m_nbytes = (double)sysconf(_SC_PAGESIZE) * (double)sysconf(_SC_USEABLE_MEMORY);
+#elif defined(__APPLE__)
+ // On Mac OS X, sysctl with selectors CTL_HW, HW_PHYSMEM returns only a
+ // 4-byte value, even if passed an 8-byte buffer, and limits the returned
+ // value to 2GB when the actual RAM size is > 2GB.
+ // But HW_MEMSIZE returns a uint64_t value.
+ //
+ // _SC_PHYS_PAGES is defined as of Apple SDK 10.11 but sysconf(_SC_PHYS_PAGES)
+ // fails in older OS X versions, so we must test __APPLE__ before _SC_PHYS_PAGES
+ uint64_t mem_size;
+ size_t len = sizeof(mem_size);
+ sysctlbyname("hw.memsize", &mem_size, &len, NULL, 0);
+ m_nbytes = mem_size;
#elif defined(_SC_PHYS_PAGES)
m_nbytes = (double)sysconf(_SC_PAGESIZE) * (double)sysconf(_SC_PHYS_PAGES);
if (m_nbytes < 0) {
@@ -1480,15 +1492,6 @@ int HOST_INFO::get_memory_info() {
sysconf(_SC_PAGESIZE), sysconf(_SC_PHYS_PAGES)
);
}
-#elif defined(__APPLE__)
- // On Mac OS X, sysctl with selectors CTL_HW, HW_PHYSMEM returns only a
- // 4-byte value, even if passed an 8-byte buffer, and limits the returned
- // value to 2GB when the actual RAM size is > 2GB.
- // But HW_MEMSIZE returns a uint64_t value.
- uint64_t mem_size;
- size_t len = sizeof(mem_size);
- sysctlbyname("hw.memsize", &mem_size, &len, NULL, 0);
- m_nbytes = mem_size;
#elif defined(_HPUX_SOURCE)
struct pst_static pst;
pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0);
diff --git a/clientscr/Mac_Saver_ModuleView.h b/clientscr/Mac_Saver_ModuleView.h
index 0bf2292..9f66020 100644
--- a/clientscr/Mac_Saver_ModuleView.h
+++ b/clientscr/Mac_Saver_ModuleView.h
@@ -42,6 +42,8 @@
- (IBAction)closeSheetSave:(id) sender;
- (IBAction)closeSheetCancel:(id) sender;
+- (bool) setUpToUseCGWindowList;
+
@end
@interface SharedGraphicsController : NSObject <NSMachPortDelegate>
diff --git a/clientscr/Mac_Saver_ModuleView.m b/clientscr/Mac_Saver_ModuleView.m
index 565776a..652fe03 100644
--- a/clientscr/Mac_Saver_ModuleView.m
+++ b/clientscr/Mac_Saver_ModuleView.m
@@ -94,7 +94,10 @@ bool isErased;
static SharedGraphicsController *mySharedGraphicsController;
static bool runningSharedGraphics;
+static bool useCGWindowList;
static pid_t childPid;
+static int gfxAppWindowNum;
+static NSView *imageView;
static char gfxAppPath[MAXPATHLEN];
static int taskSlot;
static NSRunningApplication *childApp;
@@ -122,6 +125,14 @@ void launchedGfxApp(char * appPath, pid_t thePID, int slot) {
childPid = thePID;
taskSlot = slot;
gfxAppStartTime = getDTime();
+ if (thePID == 0) {
+ useCGWindowList = false;
+ gfxAppStartTime = 0.0;
+ if (imageView) {
+ [imageView removeFromSuperview]; // Releases imageView
+ imageView = nil;
+ }
+ }
}
@implementation BOINC_Saver_ModuleView
@@ -352,7 +363,15 @@ void launchedGfxApp(char * appPath, pid_t thePID, int slot) {
// On OS 10.13 or later, use MachO comunication and IOSurfaceBuffer to
// display the graphics output of our child graphics apps in our window.
- if (runningSharedGraphics) {
+ // Graphics apps linked with our current libraries have support for
+ // MachO comunication and IOSurfaceBuffer.
+ //
+ // For graphics apps linked with older libraries, use the API
+ // CGWindowListCreateImage to copy the graphic app window's image,
+ // but this is far slower because it does not take advantage of GPU
+ // acceleration, so it uses more CPU and animation may not appear smooth.
+ //
+ if (runningSharedGraphics || useCGWindowList ) {
// Since ScreensaverEngine.app is running in the foreground, our child
// graphics app may not get enough CPU cycles for good animation.
// Calling [ NSApp activateIgnoringOtherApps:YES ] frequently from the
@@ -375,7 +394,24 @@ void launchedGfxApp(char * appPath, pid_t thePID, int slot) {
// So frequently activating the child app here seems to be best.
//
if (childApp) {
- [ childApp activateWithOptions:NSApplicationActivateIgnoringOtherApps ];\
+ if (![ childApp activateWithOptions:NSApplicationActivateIgnoringOtherApps ]) {
+ launchedGfxApp("", 0, -1); // Graphics app is no longer running
+ }
+ if (useCGWindowList) {
+ CGImageRef windowImage = CGWindowListCreateImage(CGRectNull,
+ kCGWindowListOptionIncludingWindow,
+ gfxAppWindowNum,
+ kCGWindowImageBoundsIgnoreFraming);
+ if (windowImage) {
+ // Create a bitmap rep from the image...
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:windowImage];
+ // Create an NSImage and add the bitmap rep to it...
+ NSImage *image = [[NSImage alloc] init];
+ [image addRepresentation:bitmapRep];
+ [image drawInRect:[self frame]];
+ CGImageRelease(windowImage);
+ }
+ }
}
isErased = false;
return;
@@ -390,7 +426,10 @@ void launchedGfxApp(char * appPath, pid_t thePID, int slot) {
// assume graphics app is not compatible with OS 10.13+ and kill it.
if (gfxAppStartTime) {
if ((getDTime() - gfxAppStartTime)> MAXWAITFORCONNECTION) {
- incompatibleGfxApp(gfxAppPath, childPid, taskSlot);
+ gfxAppStartTime = 0.0;
+ if ([self setUpToUseCGWindowList] == false) {
+ incompatibleGfxApp(gfxAppPath, childPid, taskSlot);
+ }
}
}
// As of OS 10.13, app windows can no longer appear on top of screensaver
@@ -591,7 +630,7 @@ void launchedGfxApp(char * appPath, pid_t thePID, int slot) {
}
// Check for a new graphics app sending us data
- if (UseSharedOffscreenBuffer()) {
+ if (UseSharedOffscreenBuffer() && gfxAppStartTime) {
[mySharedGraphicsController testConnection];
}
}
@@ -735,6 +774,30 @@ Bad:
[ NSApp endSheet:mConfigureSheet ];
}
+// Find the gtaphics app's window number (window ID)
+- (bool) setUpToUseCGWindowList
+{
+ NSArray *windowList = (__bridge NSArray*)CGWindowListCopyWindowInfo(
+ kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements,
+ kCGNullWindowID);
+ for (int i=[windowList count]-1; i>=0; i--) {
+ NSDictionary *dict = (NSDictionary*)(windowList[i]);
+ NSString * pidString = dict[(id)kCGWindowOwnerPID];
+ if ((pid_t)[pidString intValue] == childPid) {
+ NSString * windowNumString = dict[(id)kCGWindowNumber];
+ gfxAppWindowNum = (int)[windowNumString intValue];
+ useCGWindowList = true;
+ childApp = [NSRunningApplication runningApplicationWithProcessIdentifier:childPid];
+ if (imageView == nil) {
+ imageView = [[NSView alloc] initWithFrame:[self frame]];
+ [self addSubview:imageView];
+ }
+ return true; // Success
+ }
+ }
+ return false; // Not found
+}
+
@end
// On OS 10.13 or later, use MachO comunication and IOSurfaceBuffer to
diff --git a/clientscr/screensaver.cpp b/clientscr/screensaver.cpp
index 0e4b5c7..409ce96 100644
--- a/clientscr/screensaver.cpp
+++ b/clientscr/screensaver.cpp
@@ -850,6 +850,9 @@ DataMgmtProcType CScreensaver::DataManagementProc() {
graphics_app_result_ptr = NULL;
m_bDefault_gfx_running = false;
m_bScience_gfx_running = false;
+#ifdef __APPLE__
+ launchedGfxApp("", 0, -1);
+#endif
continue;
}
}
diff --git a/configure.ac b/configure.ac
index 9ddb749..855eff9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ dnl not sure exactly what the minimum version is (but 2.13 wont work)
AC_PREREQ(2.58)
dnl Set the BOINC version here. You can also use the set-version script.
-AC_INIT(BOINC, 7.8.4)
+AC_INIT(BOINC, 7.8.6)
AC_CONFIG_MACRO_DIR([m4])
LIBBOINC_VERSION=`echo ${PACKAGE_VERSION} | sed 's/\./:/g'`
AC_SUBST([LIBBOINC_VERSION])
diff --git a/version.log b/version.log
index 79e3242..efe4dc6 100644
--- a/version.log
+++ b/version.log
@@ -1 +1 @@
-7.8.4
+7.8.6
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-boinc/boinc.git
More information about the pkg-boinc-commits
mailing list