Commit 9faec1c2 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added Charlie Fenton's fixes for SDL problems on Mac OS (fullscreen, z-level vs. BOINCSaver)

parent 00a5bc44
...@@ -392,7 +392,16 @@ void WindowManager::toggleFullscreen() ...@@ -392,7 +392,16 @@ void WindowManager::toggleFullscreen()
m_CurrentHeight = m_DesktopHeight; m_CurrentHeight = m_DesktopHeight;
// (un)set video mode flags // (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; m_VideoModeFlags &= ~SDL_RESIZABLE;
// hide cursor // hide cursor
......
...@@ -29,7 +29,7 @@ CXX ?= g++ ...@@ -29,7 +29,7 @@ CXX ?= g++
LIBS = -lframework -loglft -L$(STARSPHERE_INSTALL)/lib LIBS = -lframework -loglft -L$(STARSPHERE_INSTALL)/lib
LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs) LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs)
LIBS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-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) LIBS += $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --static-libs)
LDFLAGS = -static-libgcc LDFLAGS = -static-libgcc
...@@ -41,7 +41,7 @@ CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --cflags) ...@@ -41,7 +41,7 @@ CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/xml2-config --cflags)
CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC -I/usr/include CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC -I/usr/include
DEPS = Makefile 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 RESOURCESPEC = resources
# TODO: GraphicsEngineFactory obviously depends on the actual implementations (here starsphere)! need to change the structure! what about plugins? # 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 ...@@ -94,6 +94,9 @@ snr_list.o: $(DEPS) $(STARSPHERE_SRC)/snr_list.C
pulsar_list.o: $(DEPS) $(STARSPHERE_SRC)/pulsar_list.C pulsar_list.o: $(DEPS) $(STARSPHERE_SRC)/pulsar_list.C
$(CXX) -g $(CPPFLAGS) -c $(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 # resource compiler
$(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc $(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc
...@@ -109,7 +112,7 @@ callgrind: ...@@ -109,7 +112,7 @@ callgrind:
valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere
install: install:
cp starsphere_* $(STARSPHERE_INSTALL)/bin cp -R starsphere_* $(STARSPHERE_INSTALL)/bin
clean: clean:
rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere_* rm -Rf $(RESOURCESPEC).cpp $(OBJS) starsphere_*
/***************************************************************************
* 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 ];
}
...@@ -28,6 +28,16 @@ ...@@ -28,6 +28,16 @@
#include "AbstractGraphicsEngine.h" #include "AbstractGraphicsEngine.h"
#include "GraphicsEngineFactory.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) int main(int argc, char **argv)
{ {
...@@ -92,8 +102,11 @@ int main(int argc, char **argv) ...@@ -92,8 +102,11 @@ int main(int argc, char **argv)
string param(argv[1]); string param(argv[1]);
if(param == "--fullscreen") { if(param == "--fullscreen") {
// switch to fullscreen (on windoze: after init!) // switch to fullscreen (on windoze: after init!)
window.setScreensaverMode(true); // Must do this first on Apple
window.toggleFullscreen(); window.toggleFullscreen();
window.setScreensaverMode(true); #ifdef __APPLE__
SetMacSSLevel();
#endif
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment