From 4f976ce5f5ca31a3c6092891ff6b78ccfc415a19 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Wed, 29 Oct 2008 10:26:13 +0000 Subject: CWS-TOOLING: integrate CWS appleremote01 --- vcl/aqua/inc/saldata.hxx | 4 ++- vcl/aqua/inc/vclnsapp.h | 5 ++-- vcl/aqua/source/app/saldata.cxx | 6 ++++- vcl/aqua/source/app/salinst.cxx | 21 ++++++++++++++-- vcl/aqua/source/app/vclnsapp.mm | 45 ++++++++++++++++++++++++++++++++-- vcl/aqua/source/window/salframeview.mm | 7 ++---- vcl/inc/vcl/cmdevt.hxx | 7 +++++- vcl/prj/build.lst | 2 +- vcl/util/makefile.mk | 7 ++++-- 9 files changed, 87 insertions(+), 17 deletions(-) diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index 209c7525e21f..108ed857350a 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: saldata.hxx,v $ - * $Revision: 1.23 $ + * $Revision: 1.22.64.2 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,7 @@ #include #include +#include "apple_remote/RemoteMainController.h" class AquaSalInstance; class SalObject; @@ -103,6 +104,7 @@ struct SalData bool mbIsScrollbarDoubleMax; // TODO: support DoubleMin and DoubleBoth too SInt32 mnSystemVersion; // Store System Version + MainController* mpMainController; // Apple Remote bool mbIsTestTool; SalData(); diff --git a/vcl/aqua/inc/vclnsapp.h b/vcl/aqua/inc/vclnsapp.h index ac9258c044ba..de6c00617d2d 100755 --- a/vcl/aqua/inc/vclnsapp.h +++ b/vcl/aqua/inc/vclnsapp.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: vclnsapp.h,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.68.1 $ * * This file is part of OpenOffice.org. * @@ -61,7 +61,8 @@ -(void)removeFallbackMenuItem: (NSMenuItem*)pOldItem; -(void)getSystemVersionMajor:(unsigned *)major minor:(unsigned *)minor bugFix:(unsigned *)bugFix; -(void)addDockMenuItem: (NSMenuItem*)pNewItem; +-(void)applicationWillBecomeActive:(NSNotification *)aNotification; +-(void)applicationWillResignActive:(NSNotification *)aNotification; @end - #endif 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 #include +#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 diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index e0a538b16cee..77e7222bdec1 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salframeview.mm,v $ - * $Revision: 1.13 $ + * $Revision: 1.12.22.2 $ * * This file is part of OpenOffice.org. * @@ -456,10 +456,7 @@ private: NSPoint aPt = [NSEvent mouseLocation]; NSRect aFrameRect = [pDispatchFrame->getWindow() frame]; - if( aPt.x < aFrameRect.origin.x || - aPt.y < aFrameRect.origin.y || - aPt.x >= aFrameRect.origin.x + aFrameRect.size.width || - aPt.y >= aFrameRect.origin.y + aFrameRect.size.height ) + if ( ! NSPointInRect( aPt, aFrameRect ) ) { // no, it is not // now we need to find the one it may be in diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx index 8cb0a5e3ab17..fde8fe83b6f2 100644 --- a/vcl/inc/vcl/cmdevt.hxx +++ b/vcl/inc/vcl/cmdevt.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: cmdevt.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.68.1 $ * * This file is part of OpenOffice.org. * @@ -339,6 +339,11 @@ class VCL_DLLPUBLIC CommandDialogData #define MEDIA_COMMAND_VOLUME_DOWN ((sal_Int16)15)// Lower the volume. #define MEDIA_COMMAND_VOLUME_MUTE ((sal_Int16)16)// Mute the volume. #define MEDIA_COMMAND_VOLUME_UP ((sal_Int16)17)// Raise the volume. +#define MEDIA_COMMAND_MENU ((sal_Int16)18)// Button Menu pressed. +#define MEDIA_COMMAND_MENU_HOLD ((sal_Int16)19)// Button Menu (long) pressed. +#define MEDIA_COMMAND_PLAY_HOLD ((sal_Int16)20)// Button Play (long) pressed. +#define MEDIA_COMMAND_NEXTTRACK_HOLD ((sal_Int16)21)// Button Right holding pressed. +#define MEDIA_COMMAND_PREVIOUSTRACK_HOLD ((sal_Int16)22)// Button Left holding pressed. // ------------------------------ diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index fb2059d2d580..eeda7e620d9d 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : BOOST:boost psprint rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc NULL +vc vcl : apple_remote BOOST:boost psprint rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index c16e01b3914e..de86f48dddf4 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.112.22.2 $ +# $Revision: 1.111.36.3 $ # # This file is part of OpenOffice.org. # @@ -184,7 +184,10 @@ SHL1STDLIBS+=\ SHL1USE_EXPORTS=name .IF "$(GUIBASE)"=="aqua" -SHL1STDLIBS+=$(BASEBMPLIB) +SHL1STDLIBS+= \ + $(BASEBMPLIB) \ + -lAppleRemote$(DLLPOSTFIX) + SHL1STDLIBS+= \ -framework QTKit LIB1FILES+= \ -- cgit v1.2.3