diff --git a/api/gutil.C b/api/gutil.C index 32fb5b91bc..6e3c95b044 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -137,7 +137,7 @@ bool get_viewport(int view[4]) { void get_2d_positions(double x, double y, double z, double model[16], double proj[16], int viewport[4], double proj_pos[3] ) { - gluProject(x, y, z,model,proj,viewport,&proj_pos[0],&proj_pos[1],&proj_pos[2]); + gluProject(x, y, z,model,proj,(GLint*)viewport,&proj_pos[0],&proj_pos[1],&proj_pos[2]); } void mode_lines() { diff --git a/api/macglutfix.m b/api/macglutfix.m index bd19c7e48c..418da1b4d7 100644 --- a/api/macglutfix.m +++ b/api/macglutfix.m @@ -33,12 +33,16 @@ void BringAppToFront(void); // and kCGScreenSaverWindowLevel #define RealSaverLevel 2002 +// Delay when switching to screensaver mode to reduce annoying flashes +#define SAVERDELAY 30 + void MacGLUTFix(bool isScreenSaver) { static NSMenu * emptyMenu; NSOpenGLContext * myContext = nil; NSView *myView = nil; NSWindow* myWindow = nil; int newWindowLevel; + static int stabilizationDelay = 0; if (! boinc_is_standalone()) { if (emptyMenu == nil) { @@ -62,7 +66,14 @@ void MacGLUTFix(bool isScreenSaver) { newWindowLevel = isScreenSaver ? RealSaverLevel+20 : NSNormalWindowLevel; if ([ myWindow level ] == newWindowLevel) + { + stabilizationDelay = 0; return; + } + + if (++stabilizationDelay < SAVERDELAY) + return; + [ myWindow setLevel:newWindowLevel ]; } diff --git a/api/x_opengl.C b/api/x_opengl.C index 4c11c2bd45..1df93d38f9 100644 --- a/api/x_opengl.C +++ b/api/x_opengl.C @@ -118,22 +118,22 @@ void mouse_click_move(int x, int y){ static void maybe_render() { int width, height; -#ifdef __APPLE__ - switch (current_graphics_mode) { - case MODE_WINDOW: - MacGLUTFix(false); - break; - case MODE_FULLSCREEN: - case MODE_BLANKSCREEN: - MacGLUTFix(true); - break; - } -#endif if (visible && (current_graphics_mode != MODE_HIDE_GRAPHICS)) { width = glutGet(GLUT_WINDOW_WIDTH); height = glutGet(GLUT_WINDOW_HEIGHT); if (throttled_app_render(width, height, dtime())) { glutSwapBuffers(); +#ifdef __APPLE__ + switch (current_graphics_mode) { + case MODE_WINDOW: + MacGLUTFix(false); + break; + case MODE_FULLSCREEN: + case MODE_BLANKSCREEN: + MacGLUTFix(true); + break; + } +#endif } } } diff --git a/checkin_notes b/checkin_notes index d25cbc11c2..fb029a7ee1 100755 --- a/checkin_notes +++ b/checkin_notes @@ -27629,3 +27629,16 @@ Charlie 24 April 2005 mac/ mac_saver_module.cpp Mac_Saver_ModuleView.m + +Charlie 25 April 2005 + Mac: screensaver tweaks: banners scroll faster & smoother, + reduce annoying flashes when screensaver graphics are starting. + gutil.C - fix compiler warning. + + api/ + macglutfix.m + x_opengl.C + gutil.C + clientgui/ + mac/ + mac_saver_module.cpp diff --git a/clientgui/mac/mac_saver_module.cpp b/clientgui/mac/mac_saver_module.cpp index 06c5d3bc76..d269f2d996 100755 --- a/clientgui/mac/mac_saver_module.cpp +++ b/clientgui/mac/mac_saver_module.cpp @@ -71,6 +71,7 @@ void strip_cr(char *buf); #endif #define BANNER_GAP 30 /* Space between repeats of banner text */ +#define BANNERDELTA 2 /* Number of pixels to move banner each frame */ enum SaverState { SaverState_Idle, @@ -288,7 +289,7 @@ int drawGraphics(GrafPtr aPort) { SetPort(aPort); drawBanner(aPort); SetGWorld(savePort, saveGDH); - newFrequency = 45; + newFrequency = 100; } else newFrequency = 4; @@ -429,6 +430,8 @@ void setBannerText(ConstStringPtr msg, GrafPtr aPort) { TextSize(24); TextFace(bold); bannerWidth = StringWidth(bannerText) + BANNER_GAP; + // Round up bannerWidth to an integral multiple of BANNERDELTA + bannerWidth = ((bannerWidth + BANNERDELTA - 1) / BANNERDELTA) * BANNERDELTA; SetPort(savePort); } @@ -451,10 +454,10 @@ void drawBanner(GrafPtr aPort) { ForeColor(whiteColor); BackColor(blackColor); GetPortBounds(aPort, &wRect); - if ( (bannerPos + bannerWidth) < wRect.left) + if ( (bannerPos + bannerWidth) <= wRect.left) bannerPos = wRect.left; else - bannerPos -= 1; + bannerPos -= BANNERDELTA; x = bannerPos; y = (wRect.bottom - wRect.top) / 3 + wRect.top; diff --git a/mac_build/boinc.pbproj/project.pbxproj b/mac_build/boinc.pbproj/project.pbxproj index e33981e7ce..9aefb28c9e 100755 --- a/mac_build/boinc.pbproj/project.pbxproj +++ b/mac_build/boinc.pbproj/project.pbxproj @@ -2106,9 +2106,9 @@ isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = BOINCSaver.nib; - path = /Volumes/Moon/BOINC_Mac/boinc/clientgui/mac/BOINCSaver.nib; - refType = 0; - sourceTree = ""; + path = ../clientgui/mac/BOINCSaver.nib; + refType = 2; + sourceTree = SOURCE_ROOT; }; DD48091F081A66F100A174AA = { fileRef = DD48091E081A66F100A174AA;