From 5d3269e9076b7d3a1b4586abe04ebb543f456ee9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 8 Oct 2012 16:14:38 +0200 Subject: [PATCH] fixed bug 1014422 ('X11 Over ride being on by default causes gnome-shell to become unusable') Fixes: https://launchpad.net/bugs/1014422 --- openlp/core/ui/advancedtab.py | 21 +++++++++++++-------- openlp/core/ui/maindisplay.py | 9 ++++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index ab8228658..67b5c1b04 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -29,12 +29,12 @@ The :mod:`advancedtab` provides an advanced settings facility. """ from datetime import datetime, timedelta - -from PyQt4 import QtCore, QtGui - import logging import os import sys + +from PyQt4 import QtCore, QtGui + from openlp.core.lib import SettingsTab, translate, build_icon, Receiver from openlp.core.lib.settings import Settings from openlp.core.lib.ui import UiStrings @@ -432,8 +432,7 @@ class AdvancedTab(SettingsTab): translate('OpenLP.AdvancedTab', 'WARNING: New data directory location contains ' 'OpenLP data files. These files WILL be replaced during a copy.')) - self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', - 'X11')) + self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11')) self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager')) # Slide Limits @@ -493,8 +492,14 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(True)).toBool() self.serviceNameCheckBox.setChecked(default_service_enabled) self.serviceNameCheckBoxToggled(default_service_enabled) - self.x11BypassCheckBox.setChecked( - settings.value(u'x11 bypass wm', QtCore.QVariant(True)).toBool()) + # 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')) + self.x11BypassCheckBox.setChecked(settings.value( + u'x11 bypass wm', QtCore.QVariant(x11_bypass_default)).toBool()) self.defaultColor = settings.value(u'default color', QtCore.QVariant(u'#ffffff')).toString() self.defaultFileEdit.setText(settings.value(u'default image', @@ -766,7 +771,7 @@ class AdvancedTab(SettingsTab): self.dataExists = False self.dataDirectoryCopyCheckBox.setChecked(True) self.newDataDirectoryHasFilesLabel.hide() - + def onDataDirectoryCancelButtonClicked(self): """ Cancel the data directory location change diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 306bb7511..a1cc0215d 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -31,6 +31,7 @@ and play multimedia within OpenLP. """ import cgi import logging +import os import sys from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL @@ -135,8 +136,14 @@ class MainDisplay(Display): self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \ 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', - QtCore.QVariant(True)).toBool(): + QtCore.QVariant(x11_bypass_default)).toBool(): windowFlags |= QtCore.Qt.X11BypassWindowManagerHint # TODO: The following combination of windowFlags works correctly # on Mac OS X. For next OpenLP version we should test it on other