diff --git a/src/framework/WindowManager.cpp b/src/framework/WindowManager.cpp index 3e9bce04323d643dbf74b2c946f7af55a6db0b83..e8df3038eaab375bc567d2ec770406f012f8c8f9 100644 --- a/src/framework/WindowManager.cpp +++ b/src/framework/WindowManager.cpp @@ -392,7 +392,16 @@ void WindowManager::toggleFullscreen() m_CurrentHeight = m_DesktopHeight; // (un)set video mode flags - m_VideoModeFlags |= SDL_FULLSCREEN; +#ifdef __APPLE__ + if (m_ScreensaverMode) { + m_CurrentWidth = m_DesktopWidth; + m_CurrentHeight = m_DesktopHeight; + m_VideoModeFlags |= SDL_NOFRAME; + } else +#endif + { + m_VideoModeFlags |= SDL_FULLSCREEN; + } m_VideoModeFlags &= ~SDL_RESIZABLE; // hide cursor diff --git a/src/starsphere/Makefile.macos b/src/starsphere/Makefile.macos index 0113ff6c3feaa43633880b4f7b10a9c9ea406f0a..064e27dfdd4e4dd7e301e75e31f83217cbf2af38 100644 --- a/src/starsphere/Makefile.macos +++ b/src/starsphere/Makefile.macos @@ -29,7 +29,7 @@ CXX ?= g++ LIBS = -lframework -loglft -L$(STARSPHERE_INSTALL)/lib LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs) LIBS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --libs) -LIBS += -lboinc_api -lboinc -L/usr/lib +LIBS += -lboinc_api -lboinc -L$(STARSPHERE_INSTALL)/lib LIBS += $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --static-libs) LDFLAGS = -static-libgcc @@ -41,7 +41,7 @@ CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --cflags) CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC -I/usr/include DEPS = Makefile -OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o +OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o SetMacSSLevel.o $(RESOURCESPEC).o RESOURCESPEC = resources # TODO: GraphicsEngineFactory obviously depends on the actual implementations (here starsphere)! need to change the structure! what about plugins? @@ -94,6 +94,9 @@ snr_list.o: $(DEPS) $(STARSPHERE_SRC)/snr_list.C pulsar_list.o: $(DEPS) $(STARSPHERE_SRC)/pulsar_list.C $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/pulsar_list.C + +SetMacSSLevel.o: $(DEPS) $(STARSPHERE_SRC)/SetMacSSLevel.m + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/SetMacSSLevel.m # resource compiler $(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc @@ -109,7 +112,7 @@ callgrind: valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere install: - cp starsphere_* $(STARSPHERE_INSTALL)/bin + cp -R starsphere_* $(STARSPHERE_INSTALL)/bin clean: - rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere_* + rm -Rf $(RESOURCESPEC).cpp $(OBJS) starsphere_* diff --git a/src/starsphere/SetMacSSLevel.m b/src/starsphere/SetMacSSLevel.m new file mode 100644 index 0000000000000000000000000000000000000000..828c192f6c6f401bd27853d409ccdf724c6c3b40 --- /dev/null +++ b/src/starsphere/SetMacSSLevel.m @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2008 by Charlie Fenton for Oliver Bock * + * contact: oliver.bock[AT]aei.mpg.de * + * * + * This file is part of Einstein@Home. * + * * + * Einstein@Home is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published * + * by the Free Software Foundation, version 2 of the License. * + * * + * Einstein@Home is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with Einstein@Home. If not, see <http://www.gnu.org/licenses/>. * + * * + ***************************************************************************/ + + +#include <Cocoa/Cocoa.h> + +void SetMacSSLevel(); + +// The standard ScreenSaverView class actually sets the window +// level to 2002, not the 1000 defined by NSScreenSaverWindowLevel +// and kCGScreenSaverWindowLevel +#define RealSaverLevel 2002 +// Glut sets the window level to 100 when it sets full screen mode +#define GlutFullScreenWindowLevel 100 + +void SetMacSSLevel() { + static NSMenu * emptyMenu; + NSOpenGLContext * myContext = nil; + NSView *myView = nil; + NSWindow* myWindow = nil; + + // In screensaver mode, set our window's level just above + // our BOINC screensaver's window level so it can appear + // over it. This doesn't interfere with the screensaver + // password dialog because the dialog appears only after + // our screensaver is closed. + myContext = [ NSOpenGLContext currentContext ]; + if (myContext) + myView = [ myContext view ]; + if (myView) + myWindow = [ myView window ]; + if (myWindow == nil) + return; + + [ myWindow setLevel:RealSaverLevel+20 ]; +} diff --git a/src/starsphere/main.cpp b/src/starsphere/main.cpp index d05f39da873512e30483373d45a74b622f42d758..df13f6e8384d830a2b4e348ea55840939208d8a6 100644 --- a/src/starsphere/main.cpp +++ b/src/starsphere/main.cpp @@ -28,6 +28,16 @@ #include "AbstractGraphicsEngine.h" #include "GraphicsEngineFactory.h" +#ifdef __APPLE__ +#ifdef __cplusplus +extern "C" { +#endif + void SetMacSSLevel(); +#ifdef __cplusplus +} // extern "C" +#endif +#endif + int main(int argc, char **argv) { @@ -92,8 +102,11 @@ int main(int argc, char **argv) string param(argv[1]); if(param == "--fullscreen") { // switch to fullscreen (on windoze: after init!) + window.setScreensaverMode(true); // Must do this first on Apple window.toggleFullscreen(); - window.setScreensaverMode(true); +#ifdef __APPLE__ + SetMacSSLevel(); +#endif } }