Mac V6 GFX: add setMacPList() call

svn path=/trunk/boinc/; revision=13696
This commit is contained in:
Charlie Fenton 2007-09-28 02:06:30 +00:00
parent 992fdc08a2
commit e680c9a9a1
4 changed files with 41 additions and 11 deletions

View File

@ -154,8 +154,8 @@ void boinc_graphics_loop(int argc, char** argv) {
#endif
boinc_glut_init();
make_window();
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
#ifdef __APPLE__
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
// Apparently glut changed our working directory in OS 10.3.9
chdir(dir);
#endif

View File

@ -32,7 +32,11 @@
*/
#include <Carbon/Carbon.h>
#include <sys/param.h> // for MAXPATHLEN
#include <sys/stat.h>
#include "boinc_api.h"
#include "common_defs.h"
#define RESIDICON -16455
@ -49,7 +53,7 @@ char MacPListData[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
fprintf(stderr,"MacOS Error %d occured in %s line %d\n",e,__FILE__,__LINE__);\
return(e); } }
// Adds ther specified resource to the file given as an argument.
// Adds the specified resource to the file given as an argument.
int setMacRsrcForFile(char *filename, char *rsrcData, long rsrcSize,
OSType rsrcType, int rsrcID, StringPtr rsrcName) {
OSErr oserr; /* stores an OS error code */
@ -81,8 +85,9 @@ int setMacRsrcForFile(char *filename, char *rsrcData, long rsrcSize,
oserr = ResError();
}
}
if (oserr == noErr)
break;
// We may not have permissions to set resources in debug runs
if ((oserr == noErr) || (oserr == wrPermErr) || (oserr == permErr))
break;
sleep (1);
};
@ -131,10 +136,17 @@ static char * PersistentFGets(char *buf, size_t buflen, FILE *f) {
void getPathToThisApp(char* pathBuf, size_t bufSize) {
FILE *f;
char buf[64], *c;
char buf[MAXPATHLEN], *c;
pid_t myPID = getpid();
int i;
struct stat stat_buf;
strcpy(pathBuf, GRAPHICS_APP_FILENAME);
if (!stat(pathBuf, &stat_buf)) {
// stat() returns zero on success
return;
}
*pathBuf = 0; // in case of failure
// Before launching this project application, the BOINC client set the
@ -142,7 +154,7 @@ void getPathToThisApp(char* pathBuf, size_t bufSize) {
// (or the soft-link to it.) So all we need for the path to this
// application is the file name. We use the -c option so ps strips off
// any command-line arguments for us.
sprintf(buf, "ps -cp %d -o command=", myPID);
sprintf(buf, "ps -wcp %d -o command=", myPID);
f = popen(buf, "r");
if (!f)
return;
@ -164,11 +176,11 @@ void getPathToThisApp(char* pathBuf, size_t bufSize) {
// Adds plst resource 0 to the file given as an argument. This
// identifies the applciation to the OS as an NSUIElement, so
// identifies the application to the OS as an NSUIElement, so
// that the application does not show in the Dock and it has no
// menu bar.
int setMacPList() {
char path[1024], resolvedPath[1024];;
char path[1024], resolvedPath[1024];
StringPtr rsrcName = (StringPtr)"\pApplication PList";
getPathToThisApp(path, sizeof(path));

View File

@ -8901,3 +8901,8 @@ Charlie 27 Sep 2007
api/
graphics2_unix.C
mac_icon.C
mac_build/
boinc.xcodeproj/
project.pbxproj

View File

@ -3631,6 +3631,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -3701,6 +3702,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -3765,7 +3767,7 @@
LIBRARY_STYLE = STATIC;
MACOSX_DEPLOYMENT_TARGET = "";
OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "";
OTHER_CFLAGS = "-D_DEBUG";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
@ -4336,7 +4338,10 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
INSTALL_PATH = "$(HOME)/bin";
OTHER_CFLAGS = "$(inherited)";
OTHER_CFLAGS = (
"-D_DEBUG",
"$(inherited)",
);
PREBINDING = NO;
PRODUCT_NAME = switcher;
ZERO_LINK = NO;
@ -5165,6 +5170,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -5234,6 +5240,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -5297,7 +5304,7 @@
LIBRARY_STYLE = STATIC;
MACOSX_DEPLOYMENT_TARGET = "";
OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "";
OTHER_CFLAGS = "-D_DEBUG";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
@ -6249,6 +6256,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -6283,6 +6291,7 @@
OTHER_CFLAGS = (
"-DMAC_OS_X_VERSION_MAX_ALLOWED=1040",
"-D_THREAD_SAFE",
"-D_DEBUG",
"-include",
../clientgui/mac/config.h,
);
@ -6447,6 +6456,10 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
INSTALL_PATH = "$(HOME)/bin";
OTHER_CFLAGS = (
"-D_DEBUG",
"$(inherited)",
);
PREBINDING = NO;
PRODUCT_NAME = switcher;
ZERO_LINK = NO;