diff options
Diffstat (limited to 'vcl/aqua/source/app')
-rw-r--r-- | vcl/aqua/source/app/saldata.cxx | 6 | ||||
-rw-r--r-- | vcl/aqua/source/app/salinst.cxx | 21 | ||||
-rwxr-xr-x | vcl/aqua/source/app/vclnsapp.mm | 45 |
3 files changed, 67 insertions, 5 deletions
diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index c8339fdc3082..b5092126790b 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: saldata.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.13.64.3 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ #include "saldata.hxx" #include "salnsmenu.h" #include "salinst.h" +#import "apple_remote/RemoteMainController.h" oslThreadKey SalData::s_aAutoReleaseKey = 0; @@ -59,6 +60,7 @@ SalData::SalData() maCursors( POINTER_COUNT, INVALID_CURSOR_PTR ), mbIsScrollbarDoubleMax( false ), mnSystemVersion( VER_TIGER ), + mpMainController( NULL ), mbIsTestTool( false ) { if( s_aAutoReleaseKey == 0 ) @@ -91,6 +93,8 @@ SalData::~SalData() osl_destroyThreadKey( s_aAutoReleaseKey ); s_aAutoReleaseKey = NULL; } + if ( mpMainController ) + [mpMainController release]; } void SalData::ensureThreadAutoreleasePool() diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 2ab60067bd6f..2d6648063088 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salinst.cxx,v $ - * $Revision: 1.54.28.1 $ + * $Revision: 1.53.22.2 $ * * This file is part of OpenOffice.org. * @@ -56,9 +56,12 @@ #include "vclnsapp.h" #include "premac.h" +#include <Foundation/Foundation.h> #include <ApplicationServices/ApplicationServices.h> +#import "apple_remote/RemoteMainController.h" #include "postmac.h" + using namespace std; extern BOOL ImplSVMain(); @@ -67,7 +70,6 @@ static BOOL* gpbInit = 0; static NSMenu* pDockMenu = nil; static bool bNoSVMain = true; static bool bLeftMain = false; - // ----------------------------------------------------------------------- class AquaDelayedSettingsChanged : public Timer @@ -175,6 +177,21 @@ static void initNSApp() // get System Version and store the value in GetSalData()->mnSystemVersion [NSApp getSystemVersionMajor: (unsigned int *)major minor:(unsigned int *)minor bugFix:(unsigned int *)bugFix ]; +// ----------------------------------------------------------------------------------------------------------------- + // Initialize Apple Remote + GetSalData()->mpMainController = [[MainController alloc] init]; + + [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp + selector: @selector(applicationWillBecomeActive:) + name: @"AppleRemoteWillBecomeActive" + object: nil ]; + + [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp + selector: @selector(applicationWillResignActive:) + name: @"AppleRemoteWillResignActive" + object: nil ]; +// ----------------------------------------------------------------------------------------------------------------- + if( AquaSalInstance::isOnCommandLine( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "-enableautomation" ) ) ) ) { [NSApp activateIgnoringOtherApps: YES]; diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index a8516b2a9da6..4e7678e17a8d 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: vclnsapp.mm,v $ - * $Revision: 1.9 $ + * $Revision: 1.8.46.3 $ * * This file is part of OpenOffice.org. * @@ -39,9 +39,14 @@ #include "vcl/window.hxx" #include "vcl/svapp.hxx" - +#include "vcl/cmdevt.hxx" #include "rtl/ustrbuf.hxx" +#include "premac.h" +#import "Carbon/Carbon.h" +#import "apple_remote/RemoteControl.h" +#include "postmac.h" + @implementation CocoaThreadEnabler -(void)enableCocoaThreads:(id)param @@ -340,5 +345,41 @@ [pDock insertItem: pNewItem atIndex: [pDock numberOfItems]]; } +// for Apple Remote implementation + +#pragma mark - +#pragma mark NSApplication Delegates +- (void)applicationWillBecomeActive:(NSNotification *)aNotification { + if (GetSalData()->mpMainController->remoteControl) { + + // [remoteControl startListening: self]; + // does crash because the right thing to do is + // [GetSalData()->mpMainController->remoteControl startListening: self]; + // but the instance variable 'remoteControl' is declared protected + // workaround : declare remoteControl instance variable as public in RemoteMainController.m + + [GetSalData()->mpMainController->remoteControl startListening: self]; +#ifdef DEBUG + NSLog(@"Apple Remote will become active - Using remote controls"); +#endif + } +} + +- (void)applicationWillResignActive:(NSNotification *)aNotification { + if (GetSalData()->mpMainController->remoteControl) { + + // [remoteControl stopListening: self]; + // does crash because the right thing to do is + // [GetSalData()->mpMainController->remoteControl stopListening: self]; + // but the instance variable 'remoteControl' is declared protected + // workaround : declare remoteControl instance variable as public in RemoteMainController.m + + [GetSalData()->mpMainController->remoteControl stopListening: self]; +#ifdef DEBUG + NSLog(@"Apple Remote will resign active - Releasing remote controls"); +#endif + } +} + @end |