summaryrefslogtreecommitdiff
path: root/vcl/osx
diff options
context:
space:
mode:
authorDouglas Mencken <dougmencken@gmail.com>2014-02-24 15:00:31 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-02-25 00:00:31 +0000
commit553473945b6789cb757ec69aabba6b87c4854916 (patch)
treeda8898d582ad6f5a1bc4f86060631e1c3c33db98 /vcl/osx
parent8978f494e8ef0cb3faebd200f982e3b6db267118 (diff)
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@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'vcl/osx')
-rw-r--r--vcl/osx/salframe.cxx39
-rw-r--r--vcl/osx/salmenu.cxx4
2 files changed, 43 insertions, 0 deletions
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index e49df676fbf0..ab5ef79fb67e 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 7912825bddaf..b3a1736bd3ee 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
{