[Libreoffice-commits] core.git: vcl/inc vcl/osx

Douglas Mencken dougmencken at gmail.com
Mon Feb 24 16:00:59 PST 2014


 vcl/inc/osx/salframe.h     |    4 ++++
 vcl/inc/osx/salframeview.h |    4 ++++
 vcl/osx/salframe.cxx       |   39 +++++++++++++++++++++++++++++++++++++++
 vcl/osx/salmenu.cxx        |    4 ++++
 4 files changed, 51 insertions(+)

New commits:
commit 553473945b6789cb757ec69aabba6b87c4854916
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Mon Feb 24 15:00:31 2014 -0500

    vcl/osx/sal: SDK 10.5 compatibility
    
    NSWindowDelegate and NSMenuDelegate protocols, IOPMAssertion*
    are available only in OS X v10.6 and later.
    
    Change-Id: Icda4b8014d9a6dde2284b9f5df493eb470fb79fc
    Reviewed-on: https://gerrit.libreoffice.org/8211
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 4386107..4150dc7 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -95,7 +95,11 @@ public:
     sal_uLong                           mnICOptions;
 
     // To prevent display sleep during presentation
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+    boost::shared_ptr< Timer >      mpActivityTimer;
+#else
     IOPMAssertionID                 mnAssertionID;
+#endif
 
 public:
     /** Constructor
diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h
index fa3222e..d187f94 100644
--- a/vcl/inc/osx/salframeview.h
+++ b/vcl/inc/osx/salframeview.h
@@ -22,7 +22,11 @@
 
 #include "osx/a11ywrapper.h"
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ at interface SalFrameWindow : NSWindow
+#else
 @interface SalFrameWindow : NSWindow<NSWindowDelegate>
+#endif
 {
     AquaSalFrame*       mpFrame;
     id mDraggingDestinationHandler;
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index e49df67..ab5ef79 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -38,6 +38,11 @@
 #include "osx/a11yfactory.h"
 #include "quartz/utils.h"
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+#include "vcl/timer.hxx"
+#include "osx/saltimer.h"
+#endif
+
 #include "salwtype.hxx"
 
 #include "premac.h"
@@ -201,7 +206,12 @@ void AquaSalFrame::initWindowAndView()
     else
         [mpNSWindow setAcceptsMouseMovedEvents: YES];
     [mpNSWindow setHasShadow: YES];
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+    objc_msgSend(mpNSWindow, @selector(setDelegate:), mpNSWindow);
+#else
     [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(mpNSWindow)];
+#endif
 
     if( [mpNSWindow respondsToSelector: @selector(setRestorable:)])
     {
@@ -819,6 +829,27 @@ void AquaSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay )
 
 
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+class PreventSleepTimer : public AutoTimer
+{
+public:
+    PreventSleepTimer()
+    {
+        SetTimeout( 30000 );
+        Start();
+    }
+
+    virtual ~PreventSleepTimer()
+    {
+    }
+
+    virtual void Timeout()
+    {
+        UpdateSystemActivity(OverallAct);
+    }
+};
+#endif
+
 void AquaSalFrame::StartPresentation( sal_Bool bStart )
 {
     if ( !mpNSWindow )
@@ -830,10 +861,14 @@ void AquaSalFrame::StartPresentation( sal_Bool bStart )
     if( bStart )
     {
         GetSalData()->maPresentationFrames.push_back( this );
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+        mpActivityTimer.reset( new PreventSleepTimer() );
+#else /* OS X 10.6 and above */
         IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
                                     kIOPMAssertionLevelOn,
                                     CFSTR("LibreOffice presentation running"),
                                     &mnAssertionID);
+#endif
         [mpNSWindow setLevel: NSPopUpMenuWindowLevel];
         if( mbShown )
             [mpNSWindow makeMainWindow];
@@ -841,7 +876,11 @@ void AquaSalFrame::StartPresentation( sal_Bool bStart )
     else
     {
         GetSalData()->maPresentationFrames.remove( this );
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+        mpActivityTimer.reset();
+#else
         IOPMAssertionRelease(mnAssertionID);
+#endif
         [mpNSWindow setLevel: NSNormalWindowLevel];
     }
 }
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 7912825..b3a1736 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -253,7 +253,11 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) :
     if( ! mbMenuBar )
     {
         mpMenu = [[SalNSMenu alloc] initWithMenu: this];
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+        objc_msgSend(mpMenu, @selector(setDelegate:), mpMenu);
+#else
         [mpMenu setDelegate: (id<NSMenuDelegate>)mpMenu];
+#endif
     }
     else
     {


More information about the Libreoffice-commits mailing list