[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - vcl/aqua vcl/inc

Herbert Dürr hdu at apache.org
Mon Feb 24 02:08:06 PST 2014


 vcl/aqua/source/app/salinst.cxx               |   22 +---------------------
 vcl/aqua/source/app/saltimer.cxx              |    3 +--
 vcl/aqua/source/app/vclnsapp.mm               |   16 ++++++++++++++++
 vcl/aqua/source/gdi/aquaprintaccessoryview.mm |    8 ++++----
 vcl/aqua/source/gdi/aquaprintview.mm          |    5 ++---
 vcl/aqua/source/window/salframe.cxx           |    6 +++---
 vcl/aqua/source/window/salframeview.mm        |    2 +-
 vcl/aqua/source/window/salnsmenu.mm           |    4 ++--
 vcl/aqua/source/window/salobj.cxx             |    6 +++---
 vcl/inc/aqua/vclnsapp.h                       |    1 +
 10 files changed, 34 insertions(+), 39 deletions(-)

New commits:
commit 0f3712ff654c740f3593b9580f34cdfe21ac3250
Author: Herbert Dürr <hdu at apache.org>
Date:   Mon Feb 24 09:49:19 2014 +0000

    #i119006# delay AOO/Mac initial event until the app has finished lauching
    
    delaying the initial event prevents complaints from OSX>=10.7's "windows restore"
    feature to recur infinitely. Apparently OSX cleans things up for us just before
    we get the applicationDidFinishLaunching() callback. This should solve one of the
    most popular support questions for AOO on Mac for good.

diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index b548d50..5bf7944c 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -213,19 +213,6 @@ sal_Bool ImplSVMainHook( sal_Bool * pbInit )
     bNoSVMain = false;
     initNSApp();
 
-    NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                               location: NSZeroPoint
-                               modifierFlags: 0
-                               timestamp: 0
-                               windowNumber: 0
-                               context: nil
-                               subtype: AquaSalInstance::AppExecuteSVMain
-                               data1: 0
-                               data2: 0 ];
-    if( pEvent )
-    {
-        [NSApp postEvent: pEvent atStart: NO];
-
         rtl::OUString aExeURL, aExe;
         osl_getExecutableFile( &aExeURL.pData );
         osl_getSystemPathFromFileURL( aExeURL.pData, &aExe.pData );
@@ -239,11 +226,6 @@ sal_Bool ImplSVMainHook( sal_Bool * pbInit )
         const char* pArgv[] = { aByteExe.getStr(), NULL };
         NSApplicationMain( 1, pArgv );
 #endif
-    }
-    else
-    {
-        DBG_ERROR( "NSApplication initialization could not be done" );
-    }
 
     return TRUE;   // indicate that ImplSVMainHook is implemented
 }
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm
index eab7664..b34e624 100644
--- a/vcl/aqua/source/app/vclnsapp.mm
+++ b/vcl/aqua/source/app/vclnsapp.mm
@@ -54,6 +54,22 @@
 @end
 
 @implementation VCL_NSApplication
+
+-(void)applicationDidFinishLaunching:(NSNotification*)aNotification
+{
+    NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
+                               location: NSZeroPoint
+                               modifierFlags: 0
+                               timestamp: 0
+                               windowNumber: 0
+                               context: nil
+                               subtype: AquaSalInstance::AppExecuteSVMain
+                               data1: 0
+                               data2: 0 ];
+    if( pEvent )
+        [NSApp postEvent: pEvent atStart: NO];
+}
+
 -(void)sendEvent:(NSEvent*)pEvent
 {
     NSEventType eType = [pEvent type];
diff --git a/vcl/inc/aqua/vclnsapp.h b/vcl/inc/aqua/vclnsapp.h
index 2d57449..ea493db 100644
--- a/vcl/inc/aqua/vclnsapp.h
+++ b/vcl/inc/aqua/vclnsapp.h
@@ -40,6 +40,7 @@ class AquaSalFrame;
 @interface VCL_NSApplication : NSApplication
 {
 }
+-(void)applicationDidFinishLaunching:(NSNotification*)aNotification;
 -(void)sendEvent:(NSEvent*)pEvent;
 -(void)sendSuperEvent:(NSEvent*)pEvent;
 -(NSMenu*)applicationDockMenu:(NSApplication *)sender;
commit a8c471a7003fdac7d5e1c97e903f669da6bcf0c7
Author: Herbert Dürr <hdu at apache.org>
Date:   Mon Feb 24 09:08:02 2014 +0000

    #i123840# prefer NSZero* constants over open coded altetnatives

diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 699dc9f..b548d50 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -213,9 +213,8 @@ sal_Bool ImplSVMainHook( sal_Bool * pbInit )
     bNoSVMain = false;
     initNSApp();
 
-    NSPoint aPt = { 0, 0 };
     NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                               location: aPt
+                               location: NSZeroPoint
                                modifierFlags: 0
                                timestamp: 0
                                windowNumber: 0
@@ -495,9 +494,8 @@ void AquaSalInstance::wakeupYield()
     if( mbWaitingYield )
     {
         SalData::ensureThreadAutoreleasePool();
-        NSPoint aPt = { 0, 0 };
         NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                                   location: aPt
+                                   location: NSZeroPoint
                                    modifierFlags: 0
                                    timestamp: 0
                                    windowNumber: 0
diff --git a/vcl/aqua/source/app/saltimer.cxx b/vcl/aqua/source/app/saltimer.cxx
index e3273f8..3e39006 100644
--- a/vcl/aqua/source/app/saltimer.cxx
+++ b/vcl/aqua/source/app/saltimer.cxx
@@ -71,9 +71,8 @@ void ImplSalStartTimer( sal_uLong nMS )
     {
         SalData::ensureThreadAutoreleasePool();
         // post an event so we can get into the main thread
-        NSPoint aPt = { 0, 0 };
         NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                                   location: aPt
+                                   location: NSZeroPoint
                                    modifierFlags: 0
                                    timestamp: [NSDate timeIntervalSinceReferenceDate]
                                    windowNumber: 0
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index eadf660..c5b46fd 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -643,7 +643,7 @@ static void adjustViewAndChildren( NSView* pNSView, NSSize& rMaxSize,
     
     NSArray* pSubViews = [pNSView subviews];
     unsigned int nViews = [pSubViews count];
-    NSRect aUnion = { { 0, 0 }, { 0, 0 } };
+    NSRect aUnion = NSZeroRect;
 
     // get the combined frame of all subviews
     for( unsigned int n = 0; n < nViews; n++ )
@@ -712,7 +712,7 @@ static void adjustTabViews( NSTabView* pTabView, NSSize aTabSize )
 static NSControl* createLabel( const rtl::OUString& i_rText )
 {
     NSString* pText = CreateNSString( i_rText );
-    NSRect aTextRect = { { 0, 0 }, {20, 15} };
+    NSRect aTextRect = { NSZeroPoint, {20, 15} };
     NSTextField* pTextView = [[NSTextField alloc] initWithFrame: aTextRect];
     [pTextView setFont: [NSFont controlContentFontOfSize: 0]];
     [pTextView setEditable: NO];
@@ -1093,9 +1093,9 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
     NSView* pCurParent = 0;
     long nCurY = 0;
     long nCurX = 0;
-    NSRect aViewFrame = { { 0, 0 }, {600, 400 } };
+    NSRect aViewFrame = { NSZeroPoint, {600, 400 } };
     NSRect aTabViewFrame = { { 190, 0 }, {410, 400 } };
-    NSSize aMaxTabSize = { 0, 0 };
+    NSSize aMaxTabSize = NSZeroSize;
     NSView* pAccessoryView = [[NSView alloc] initWithFrame: aViewFrame];
     NSTabView* pTabView = [[NSTabView alloc] initWithFrame: aTabViewFrame];
     [pAccessoryView addSubview: [pTabView autorelease]];
diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm
index 12a3513..f64561d 100644
--- a/vcl/aqua/source/gdi/aquaprintview.mm
+++ b/vcl/aqua/source/gdi/aquaprintview.mm
@@ -32,7 +32,7 @@
 @implementation AquaPrintView
 -(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
 {
-    NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
+    NSRect aRect = { NSZeroPoint, [pInfoPrinter->getPrintInfo() paperSize] };
     if( (self = [super initWithFrame: aRect]) != nil )
     {
         mpController = pController;
@@ -62,8 +62,7 @@
 -(NSPoint)locationOfPrintRect: (NSRect)aRect
 {
     (void)aRect;
-    NSPoint aPoint = { 0, 0 };
-    return aPoint;
+    return NSZeroPoint;
 }
 
 -(void)drawRect: (NSRect)rect
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 1f76a3d..2f6c477 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -209,7 +209,7 @@ void AquaSalFrame::initWindowAndView()
     [mpNSWindow setHasShadow: YES];
     [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(mpNSWindow)];
 
-    const NSRect aRect = NSMakeRect( 0,0, maGeometry.nWidth, maGeometry.nHeight );
+    const NSRect aRect = { NSZeroPoint, NSMakeSize( maGeometry.nWidth, maGeometry.nHeight )};
     mnTrackingRectTag = [mpNSView addTrackingRect: aRect owner: mpNSView userData: nil assumeInside: NO];
 
     maSysData.mpNSView = mpNSView;
@@ -745,7 +745,7 @@ void AquaSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay )
         // which is always on index 0 according to documentation
         bool bHideMenu = (nDisplay == 0);
 
-        NSRect aNewContentRect = { { 0, 0 }, { 0, 0 } };
+        NSRect aNewContentRect = NSZeroRect;
         // get correct screen
         NSScreen* pScreen = nil;
         NSArray* pScreens = [NSScreen screens];
@@ -1648,7 +1648,7 @@ void AquaSalFrame::UpdateFrameGeometry()
     // release old track rect
     [mpNSView removeTrackingRect: mnTrackingRectTag];
     // install the new track rect
-    NSRect aTrackRect = { { 0, 0 }, aContentRect.size };
+    NSRect aTrackRect = { NSZeroPoint, aContentRect.size };
     mnTrackingRectTag = [mpNSView addTrackingRect: aTrackRect owner: mpNSView userData: nil assumeInside: NO];
 
     // convert to vcl convention
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index d2e0ec7..e21727a 100644
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -461,7 +461,7 @@ static AquaSalFrame* getMouseContainerFrame()
     if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
     {
         // FIXME: does this leak the returned NSCursor of getCurrentCursor ?
-        const NSRect aRect = NSMakeRect( 0, 0, mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight);
+        const NSRect aRect = { NSZeroPoint, NSMakeSize( mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight) };
         [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()];
     }
 }
diff --git a/vcl/aqua/source/window/salnsmenu.mm b/vcl/aqua/source/window/salnsmenu.mm
index 154e9ea..22fe89d 100644
--- a/vcl/aqua/source/window/salnsmenu.mm
+++ b/vcl/aqua/source/window/salnsmenu.mm
@@ -138,7 +138,7 @@
         for( size_t i = 0; i < rButtons.size(); ++i )
         {
             const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
-            const NSRect aFromRect = NSMakeRect( 0, 0, aPixSize.Width(), aPixSize.Height());
+            const NSRect aFromRect = { NSZeroPoint, NSMakeSize( aPixSize.Width(), aPixSize.Height()) };
             aImgRect.origin.y = floor((aFrame.size.height - aFromRect.size.height)/2);
             aImgRect.size = aFromRect.size;
             if( rButtons[i].mpNSImage )
@@ -161,7 +161,7 @@
         for( size_t i = 0; i < rButtons.size(); ++i )
         {
             const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
-            const NSRect aFromRect = NSMakeRect( 0, 0, aPixSize.Width(), aPixSize.Height());
+            const NSRect aFromRect = { NSZeroPoint, NSMakeSize( aPixSize.Width(), aPixSize.Height()) };
             aImgRect.origin.y = (aFrame.size.height - aFromRect.size.height)/2;
             aImgRect.size = aFromRect.size;
             if( aMousePt.x >= aImgRect.origin.x && aMousePt.x <= (aImgRect.origin.x+aImgRect.size.width) &&
diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx
index b7deba9..5118171 100644
--- a/vcl/aqua/source/window/salobj.cxx
+++ b/vcl/aqua/source/window/salobj.cxx
@@ -47,7 +47,7 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame ) :
     maSysData.nSize = sizeof( maSysData );
     maSysData.mpNSView = NULL;
 
-    NSRect aInitFrame = { { 0, 0 }, { 20, 20 } };
+    NSRect aInitFrame = { NSZeroPoint, { 20, 20 } };
     mpClipView = [[NSClipView alloc] initWithFrame: aInitFrame ];
     if( mpClipView )
     {
@@ -168,7 +168,7 @@ void AquaSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
 
 void AquaSalObject::setClippedPosSize()
 {
-    NSRect aViewRect = NSMakeRect( 0, 0, mnWidth, mnHeight);
+    NSRect aViewRect = { NSZeroPoint, NSMakeSize( mnWidth, mnHeight) };
     if( maSysData.mpNSView )
     {
         NSView* pNSView = maSysData.mpNSView;
@@ -176,7 +176,7 @@ void AquaSalObject::setClippedPosSize()
     }
 
     NSRect aClipViewRect = NSMakeRect( mnX, mnY, mnWidth, mnHeight);
-    NSPoint aClipPt = NSMakePoint( 0, 0);
+    NSPoint aClipPt = NSZeroPoint;
     if( mbClip )
     {
         aClipViewRect.origin.x += mnClipX;


More information about the Libreoffice-commits mailing list