#906926 fix stay on top for OS X

This commit is contained in:
Martin Zibricky 2011-12-22 15:46:47 +01:00
parent 5bcfbb9433
commit 82728e148e

View File

@ -29,6 +29,7 @@ The :mod:`maindisplay` module provides the functionality to display screens
and play multimedia within OpenLP. and play multimedia within OpenLP.
""" """
import logging import logging
import platform
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
@ -60,6 +61,11 @@ class Display(QtGui.QGraphicsView):
self.controller = controller self.controller = controller
self.screen = {} self.screen = {}
self.plugins = PluginManager.get_instance().plugins self.plugins = PluginManager.get_instance().plugins
# FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with
# OpenGL. Only white blank screen is shown on the 2nd monitor all the
# time. We need to investigate more how to use OpenGL properly on Mac OS
# X.
if platform.system() != 'Darwin':
self.setViewport(QtOpenGL.QGLWidget()) self.setViewport(QtOpenGL.QGLWidget())
def setup(self): def setup(self):
@ -120,9 +126,15 @@ class MainDisplay(Display):
self.audioPlayer = None self.audioPlayer = None
self.firstTime = True self.firstTime = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.WindowStaysOnTopHint | \
QtCore.Qt.X11BypassWindowManagerHint) QtCore.Qt.X11BypassWindowManagerHint
# FIXME: QtCore.Qt.SplashScreen is workaround to make display screen
# stay always on top on Mac OS X. For details see bug 906926.
# It needs more investigation to fix it properly.
if platform.system() == 'Darwin':
windowFlags = windowFlags | QtCore.Qt.SplashScreen
self.setWindowFlags(windowFlags)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
if self.isLive: if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),