Fix bypass of X11 for Gnome Shell

bzr-revno: 2081
This commit is contained in:
Andreas Preikschat 2012-10-10 20:49:31 +01:00 committed by Tim Bentley
commit a5b456a374
2 changed files with 21 additions and 9 deletions

View File

@ -29,12 +29,12 @@
The :mod:`advancedtab` provides an advanced settings facility. The :mod:`advancedtab` provides an advanced settings facility.
""" """
from datetime import datetime, timedelta from datetime import datetime, timedelta
from PyQt4 import QtCore, QtGui
import logging import logging
import os import os
import sys import sys
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, build_icon, Receiver from openlp.core.lib import SettingsTab, translate, build_icon, Receiver
from openlp.core.lib.settings import Settings from openlp.core.lib.settings import Settings
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings
@ -432,8 +432,7 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab', translate('OpenLP.AdvancedTab',
'<strong>WARNING:</strong> New data directory location contains ' '<strong>WARNING:</strong> New data directory location contains '
'OpenLP data files. These files WILL be replaced during a copy.')) 'OpenLP data files. These files WILL be replaced during a copy.'))
self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11'))
'X11'))
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
'Bypass X11 Window Manager')) 'Bypass X11 Window Manager'))
# Slide Limits # Slide Limits
@ -493,8 +492,14 @@ class AdvancedTab(SettingsTab):
QtCore.QVariant(True)).toBool() QtCore.QVariant(True)).toBool()
self.serviceNameCheckBox.setChecked(default_service_enabled) self.serviceNameCheckBox.setChecked(default_service_enabled)
self.serviceNameCheckBoxToggled(default_service_enabled) self.serviceNameCheckBoxToggled(default_service_enabled)
self.x11BypassCheckBox.setChecked( # Fix for bug #1014422.
settings.value(u'x11 bypass wm', QtCore.QVariant(True)).toBool()) x11_bypass_default = True
if sys.platform.startswith(u'linux'):
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
self.x11BypassCheckBox.setChecked(settings.value(
u'x11 bypass wm', QtCore.QVariant(x11_bypass_default)).toBool())
self.defaultColor = settings.value(u'default color', self.defaultColor = settings.value(u'default color',
QtCore.QVariant(u'#ffffff')).toString() QtCore.QVariant(u'#ffffff')).toString()
self.defaultFileEdit.setText(settings.value(u'default image', self.defaultFileEdit.setText(settings.value(u'default image',

View File

@ -31,6 +31,7 @@ and play multimedia within OpenLP.
""" """
import cgi import cgi
import logging import logging
import os
import sys import sys
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
@ -135,8 +136,14 @@ class MainDisplay(Display):
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \ windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
QtCore.Qt.WindowStaysOnTopHint QtCore.Qt.WindowStaysOnTopHint
# Fix for bug #1014422.
x11_bypass_default = True
if sys.platform.startswith(u'linux'):
# Default to False on Gnome.
x11_bypass_default = bool(not
os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
if Settings().value(u'advanced/x11 bypass wm', if Settings().value(u'advanced/x11 bypass wm',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(x11_bypass_default)).toBool():
windowFlags |= QtCore.Qt.X11BypassWindowManagerHint windowFlags |= QtCore.Qt.X11BypassWindowManagerHint
# TODO: The following combination of windowFlags works correctly # TODO: The following combination of windowFlags works correctly
# on Mac OS X. For next OpenLP version we should test it on other # on Mac OS X. For next OpenLP version we should test it on other