Skip to content
Snippets Groups Projects
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
Branches
Tags pre_release_0.09
No related merge requests found
......@@ -392,7 +392,16 @@ void WindowManager::toggleFullscreen()
m_CurrentHeight = m_DesktopHeight;
// (un)set video mode flags
#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
......
......@@ -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?
......@@ -95,6 +95,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
$(STARSPHERE_INSTALL)/bin/orc $(STARSPHERE_SRC)/$(RESOURCESPEC).orc $(RESOURCESPEC).cpp
......@@ -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_*
/***************************************************************************
* 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 @@
#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
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment