← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/bug-908362 into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/bug-908362 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #908362 in OpenLP: "In Fedora main display disappears when switching apps"
  https://bugs.launchpad.net/openlp/+bug/908362

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/bug-908362/+merge/87850

Given that attempting to detect whether we should be bypassing the X11 display manager appears to be an inexact science, it's probably best to add a setting and let the user choose which works best for them.
-- 
https://code.launchpad.net/~j-corwin/openlp/bug-908362/+merge/87850
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/bug-908362 into lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2011-12-27 10:33:55 +0000
+++ openlp/core/ui/advancedtab.py	2012-01-07 12:16:26 +0000
@@ -29,7 +29,7 @@
 """
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import SettingsTab, translate, build_icon
+from openlp.core.lib import SettingsTab, translate, build_icon,  Receiver
 from openlp.core.lib.ui import UiStrings
 from openlp.core.utils import get_images_filter
 
@@ -42,6 +42,7 @@
         """
         Initialise the settings tab
         """
+        self.display_changed = False
         advancedTranslated = translate('OpenLP.AdvancedTab', 'Advanced')
         self.default_image = u':/graphics/openlp-splash-screen.png'
         self.default_color = u'#ffffff'
@@ -122,6 +123,14 @@
         self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
         self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
         self.rightLayout.addWidget(self.hideMouseGroupBox)
+        self.x11GroupBox = QtGui.QGroupBox(self.leftColumn)
+        self.x11GroupBox.setObjectName(u'x11GroupBox')
+        self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox)
+        self.x11Layout.setObjectName(u'x11Layout')
+        self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox)
+        self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
+        self.x11Layout.addWidget(self.x11BypassCheckBox)
+        self.rightLayout.addWidget(self.x11GroupBox)
         self.rightLayout.addStretch()
 
         QtCore.QObject.connect(self.defaultColorButton,
@@ -130,6 +139,8 @@
             QtCore.SIGNAL(u'pressed()'), self.onDefaultBrowseButtonPressed)
         QtCore.QObject.connect(self.defaultRevertButton,
             QtCore.SIGNAL(u'pressed()'), self.onDefaultRevertButtonPressed)
+        QtCore.QObject.connect(self.x11BypassCheckBox,
+            QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
 
     def retranslateUi(self):
         """
@@ -167,6 +178,10 @@
             'Browse for an image file to display.'))
         self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab',
             'Revert to the default OpenLP logo.'))
+        self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab',
+            'X11'))
+        self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
+            'Bypass X11 Window Manager'))
 
     def load(self):
         """
@@ -198,6 +213,8 @@
             QtCore.QVariant(True)).toBool())
         self.hideMouseCheckBox.setChecked(
             settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
+        self.x11BypassCheckBox.setChecked(
+            settings.value(u'x11 bypass wm', QtCore.QVariant(True)).toBool())
         self.default_color = settings.value(u'default color',
             QtCore.QVariant(u'#ffffff')).toString()
         self.defaultFileEdit.setText(settings.value(u'default image',
@@ -227,9 +244,14 @@
             QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
         settings.setValue(u'hide mouse',
             QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
+        settings.setValue(u'x11 bypass wm',
+            QtCore.QVariant(self.x11BypassCheckBox.isChecked()))
         settings.setValue(u'default color', self.default_color)
         settings.setValue(u'default image', self.defaultFileEdit.text())
         settings.endGroup()
+        if self.display_changed:
+            Receiver.send_message(u'config_screen_changed')
+            self.display_changed = False
 
     def onDefaultColorButtonPressed(self):
         new_color = QtGui.QColorDialog.getColor(
@@ -252,3 +274,12 @@
     def onDefaultRevertButtonPressed(self):
         self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png')
         self.defaultFileEdit.setFocus()
+
+    def onX11BypassCheckBoxToggled(self, checked):
+        """
+        Toggle X11 bypass flag on maindisplay depending on check box state.
+
+        ``checked``
+            The state of the check box (boolean).
+        """
+        self.display_changed = True

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2012-01-06 18:44:12 +0000
+++ openlp/core/ui/maindisplay.py	2012-01-07 12:16:26 +0000
@@ -134,7 +134,8 @@
         self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
         windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
                 QtCore.Qt.WindowStaysOnTopHint
-        if os.environ.get(u'XDG_CURRENT_DESKTOP') == u'Unity':
+        if QtCore.QSettings().value(u'advanced/x11 bypass wm',
+            QtCore.QVariant(True)).toBool():
             windowFlags = windowFlags | 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.

=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py	2012-01-07 12:16:26 +0000
@@ -40,6 +40,7 @@
         """
         self.controllers = controllers
         SettingsTab.__init__(self, parent, title, visible_title, icon_path)
+        self.activated = False
 
     def setupUi(self):
         """
@@ -110,8 +111,12 @@
 
     def save(self):
         """
-        Save the settings.
+        Save the settings. If the tab hasn't been made visible to the user
+        then there is nothing to do, so exit. This removes the need to
+        start presentation applications unnecessarily.
         """
+        if not self.activated:
+            return
         changed = False
         for key in self.controllers:
             controller = self.controllers[key]
@@ -140,6 +145,7 @@
         """
         Tab has just been made visible to the user
         """
+        self.activated = True
         for key in self.controllers:
             controller = self.controllers[key]
             checkbox = self.PresenterCheckboxes[controller.name]


Follow ups