← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~springermac/openlp/bug-1395848 into lp:openlp

 

Raoul Snyman has proposed merging lp:~springermac/openlp/bug-1395848 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
Related bugs:
  Bug #1395848 in OpenLP: "OSX Menu Bar"
  https://bugs.launchpad.net/openlp/+bug/1395848

For more details, see:
https://code.launchpad.net/~springermac/openlp/bug-1395848/+merge/259690

Fix bug 1395848 by setting the window level of the main display higher than the menu bar and dock
-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2015-04-02 20:32:20 +0000
+++ openlp/core/ui/maindisplay.py	2015-05-20 21:20:38 +0000
@@ -45,6 +45,13 @@
 from openlp.core.lib.theme import BackgroundType
 from openlp.core.ui import HideMode, AlertLocation
 
+if is_macosx():
+    from ctypes import pythonapi, c_void_p, c_char_p, py_object
+
+    from sip import voidptr
+    from objc import objc_object
+    from AppKit import NSMainMenuWindowLevel
+
 log = logging.getLogger(__name__)
 
 OPAQUE_STYLESHEET = """
@@ -160,11 +167,17 @@
         # regressions on other platforms.
         if is_macosx():
             window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window
-            # For primary screen ensure it stays above the OS X dock
-            # and menu bar
-            if self.screens.current['primary']:
-                self.setWindowState(QtCore.Qt.WindowFullScreen)
         self.setWindowFlags(window_flags)
+        if is_macosx():
+            try:
+                nsview_pointer = self.winId().ascapsule()
+            except:
+                nsview_pointer = voidptr(self.winId()).ascapsule()
+            pythonapi.PyCapsule_SetName.restype = c_void_p
+            pythonapi.PyCapsule_SetName.argtypes = [py_object, c_char_p]
+            pythonapi.PyCapsule_SetName(nsview_pointer, c_char_p(b"objc.__object__"))
+            pyobjc_nsview = objc_object(cobject=nsview_pointer)
+            pyobjc_nsview.window().setLevel_(NSMainMenuWindowLevel + 2)
         self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
         self.set_transparency(False)
         if self.is_live:

=== modified file 'scripts/check_dependencies.py'
--- scripts/check_dependencies.py	2015-04-03 21:43:36 +0000
+++ scripts/check_dependencies.py	2015-05-20 21:20:38 +0000
@@ -40,6 +40,7 @@
     nose = None
 
 IS_WIN = sys.platform.startswith('win')
+IS_MACOSX = sys.platform.startswith('darwin')
 IS_LIN = sys.platform.startswith('lin')
 
 
@@ -66,6 +67,9 @@
     'dbus',
 ]
 
+MACOSX_MODULES = [
+    'objc'
+]
 
 MODULES = [
     'PyQt4',
@@ -88,7 +92,6 @@
     'uno',
 ]
 
-
 OPTIONAL_MODULES = [
     ('mysql.connector', '(MySQL support)', True),
     ('psycopg2', '(PostgreSQL support)', True),
@@ -229,6 +232,10 @@
         print('Checking for Windows specific modules...')
         for m in WIN32_MODULES:
             check_module(m)
+    elif IS_MACOSX:
+        print('Checking for Mac OS X specific modules...')
+        for m in MACOSX_MODULES:
+            check_module(m)
     elif IS_LIN:
         print('Checking for Linux specific modules...')
         for m in LINUX_MODULES:


Follow ups