summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2013-04-17 12:32:55 +0000
committerHerbert Dürr <hdu@apache.org>2013-04-17 12:32:55 +0000
commit2f35d17889b1eafe670262a82b95ee04e165d9df (patch)
tree58fa45fcc2fb3dcbec0a49681fa21aad5c97502e
parent6b722f7d7c1ae5a1b344a24442bd591afba8606b (diff)
avoid problems with C++ initializer lists (N2672) in our Aqua code
when the provided type and the target type of an initializer list don't match the new behaviour described in C++11's N2672 proposal can be triggered. Though that is very useful in general it complicates things for our case so that we're better of to use the little helpers provided by XCode's CF framework.
Notes
Notes: prefer: e8edaed36e50ee33d1d241ce7ebfbeb0911ccf02
-rw-r--r--vcl/aqua/source/app/salinst.cxx2
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm14
-rw-r--r--vcl/aqua/source/gdi/aquaprintview.mm2
-rw-r--r--vcl/aqua/source/gdi/salbmp.cxx4
-rw-r--r--vcl/aqua/source/gdi/salgdiutils.cxx2
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx2
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx2
-rw-r--r--vcl/aqua/source/window/salframe.cxx14
-rw-r--r--vcl/aqua/source/window/salframeview.mm6
-rw-r--r--vcl/aqua/source/window/salnsmenu.mm16
-rw-r--r--vcl/aqua/source/window/salobj.cxx6
11 files changed, 34 insertions, 36 deletions
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 9ba2bb0c0b67..c47479aad8b6 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -1326,7 +1326,7 @@ NSImage* CreateNSImage( const Image& rImage )
NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
CGContextRef rCGContext = reinterpret_cast<CGContextRef>([pContext graphicsPort]);
- const CGRect aDstRect = { {0, 0}, { aSize.Width(), aSize.Height() } };
+ const CGRect aDstRect = CGRectMake( 0, 0, aSize.Width(), aSize.Height());
CGContextDrawImage( rCGContext, aDstRect, xImage );
[pImage unlockFocus];
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index 7c2b268782f6..660388a35387 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -805,7 +805,7 @@ static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
ControlTarget* pCtrlTarget
)
{
- NSRect aCheckRect = { { rCurX + nAttachOffset, 0 }, { 0, 15 } };
+ NSRect aCheckRect = NSMakeRect( rCurX + nAttachOffset, 0, 0, 15);
NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect];
[pBtn setButtonType: NSSwitchButton];
[pBtn setState: bValue ? NSOnState : NSOffState];
@@ -874,7 +874,7 @@ static void addRadio( NSView* pCurParent, long& rCurX, long& rCurY, long nAttach
// setup radio matrix
NSButtonCell* pProto = [[NSButtonCell alloc] init];
- NSRect aRadioRect = { { rCurX + nOff, 0 }, { 280 - rCurX, 5*rChoices.getLength() } };
+ NSRect aRadioRect = NSMakeRect( rCurX + nOff, 0, 280 - rCurX, 5*rChoices.getLength());
[pProto setTitle: @"RadioButtonGroup"];
[pProto setButtonType: NSRadioButton];
NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect
@@ -932,7 +932,7 @@ static void addList( NSView* pCurParent, long& rCurX, long& rCurY, long /*nAttac
aTextRect.origin.x = rCurX /* + nAttachOffset*/;
// don't indent attached lists, looks bad in the existing cases
- NSRect aBtnRect = { { rCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } };
+ NSRect aBtnRect = NSMakeRect( rCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0, 0, 15);
NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO];
// iterate options
@@ -1008,7 +1008,7 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
nOff = aTextRect.size.width + 5;
}
- NSRect aFieldRect = { { rCurX + nOff + nAttachOffset, 0 }, { 100, 25 } };
+ NSRect aFieldRect = NSMakeRect( rCurX + nOff + nAttachOffset, 0, 100, 25);
NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect];
[pFieldView setEditable: YES];
[pFieldView setSelectable: YES];
@@ -1032,9 +1032,9 @@ static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachO
if( rCtrlType.equalsAscii( "Range" ) )
{
// add a stepper control
- NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5,
- aFieldRect.origin.y },
- { 15, aFieldRect.size.height } };
+ NSRect aStepFrame = NSMakeRect(
+ aFieldRect.origin.x + aFieldRect.size.width + 5, aFieldRect.origin.y,
+ 15, aFieldRect.size.height);
NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame];
[pStep setIncrement: 1];
[pStep setValueWraps: NO];
diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm
index 7e94f13a5182..12a351340831 100644
--- a/vcl/aqua/source/gdi/aquaprintview.mm
+++ b/vcl/aqua/source/gdi/aquaprintview.mm
@@ -55,7 +55,7 @@
// #i101108# sanity check
if( nWidth < 1 )
nWidth = 1;
- NSRect aRect = { { page % nWidth, page / nWidth }, aPaperSize };
+ NSRect aRect = { NSMakePoint( page % nWidth, page / nWidth), aPaperSize };
return aRect;
}
diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx
index 82ba6b26563f..7020537fa8ee 100644
--- a/vcl/aqua/source/gdi/salbmp.cxx
+++ b/vcl/aqua/source/gdi/salbmp.cxx
@@ -96,7 +96,7 @@ bool AquaSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits,
CreateContext();
// copy layer content into the bitmap buffer
- const CGPoint aSrcPoint = { -nX, -nY };
+ const CGPoint aSrcPoint = CGPointMake( -nX, -nY);
::CGContextDrawLayerAtPoint( mxGraphicContext, aSrcPoint, xLayer );
return true;
}
@@ -731,7 +731,7 @@ CGImageRef AquaSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, int
else
{
nY = mnHeight - (nY + nNewHeight); // adjust for y-mirrored context
- const CGRect aCropRect = {{nX, nY}, {nNewWidth, nNewHeight}};
+ const CGRect aCropRect = CGRectMake( nX, nY, nNewWidth, nNewHeight);
xCroppedImage = CGImageCreateWithImageInRect( mxCachedImage, aCropRect );
}
diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx
index dd49d6fc0788..3011ffad9548 100644
--- a/vcl/aqua/source/gdi/salgdiutils.cxx
+++ b/vcl/aqua/source/gdi/salgdiutils.cxx
@@ -197,7 +197,7 @@ bool AquaSalGraphics::CheckContext()
if( !mrContext )
{
- const CGSize aLayerSize = {nWidth,nHeight};
+ const CGSize aLayerSize = CGSizeMake( nWidth, nHeight);
NSGraphicsContext* pNSGContext = [NSGraphicsContext graphicsContextWithWindow: mpFrame->getWindow()];
CGContextRef xCGContext = reinterpret_cast<CGContextRef>([pNSGContext graphicsPort]);
mxLayer = CGLayerCreateWithContext( xCGContext, aLayerSize, NULL );
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index cabf4a820b2f..0a652c66167c 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -242,7 +242,7 @@ void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientatio
}
else if( i_nWidth > 0 && i_nHeight > 0 )
{
- NSSize aPaperSize = { TenMuToPt(i_nWidth), TenMuToPt(i_nHeight) };
+ NSSize aPaperSize = NSMakeSize( TenMuToPt(i_nWidth), TenMuToPt(i_nHeight));
[mpPrintInfo setPaperSize: aPaperSize];
}
// this seems counterintuitive
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
index abfb90210648..819154e54c61 100644
--- a/vcl/aqua/source/gdi/salvd.cxx
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -228,7 +228,7 @@ sal_Bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
DBG_ASSERT( xCGContext, "no context" );
- const CGSize aNewSize = { nDX, nDY };
+ const CGSize aNewSize = CGSizeMake( nDX, nDY);
mxLayer = CGLayerCreateWithContext( xCGContext, aNewSize, NULL );
if( mxLayer && mpGraphics )
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index fede755e5894..4056d578f497 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -209,7 +209,7 @@ void AquaSalFrame::initWindowAndView()
[mpWindow setHasShadow: YES];
[mpWindow setDelegate: mpWindow];
- NSRect aRect = { { 0,0 }, { maGeometry.nWidth, maGeometry.nHeight } };
+ const NSRect aRect = NSMakeRect( 0,0, maGeometry.nWidth, maGeometry.nHeight );
mnTrackingRectTag = [mpView addTrackingRect: aRect owner: mpView userData: nil assumeInside: NO];
maSysData.pView = mpView;
@@ -500,7 +500,7 @@ void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight )
nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration;
nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration;
- NSSize aSize = { nWidth, nHeight };
+ const NSSize aSize = NSMakeSize( nWidth, nHeight);
// Size of full window (content+structure) although we only
// have the client size in arguments
@@ -529,7 +529,7 @@ void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight )
if (nWidth>32767) nWidth=32767;
if (nHeight>32767) nHeight=32767;
- NSSize aSize = { nWidth, nHeight };
+ const NSSize aSize = NSMakeSize( nWidth, nHeight);
// Size of full window (content+structure) although we only
// have the client size in arguments
@@ -546,7 +546,7 @@ void AquaSalFrame::SetClientSize( long nWidth, long nHeight )
if( mpWindow )
{
- NSSize aSize = { nWidth, nHeight };
+ const NSSize aSize = NSMakeSize( nWidth, nHeight);
[mpWindow setContentSize: aSize];
UpdateFrameGeometry();
@@ -956,7 +956,7 @@ void AquaSalFrame::SetPointerPos( long nX, long nY )
// FIXME: use Cocoa functions
// FIXME: multiscreen support
- CGPoint aPoint = { nX + maGeometry.nX, nY + maGeometry.nY };
+ const CGPoint aPoint = CGPointMake( nX + maGeometry.nX, nY + maGeometry.nY);
CGDirectDisplayID mainDisplayID = CGMainDisplayID();
CGDisplayMoveCursorToPoint( mainDisplayID, aPoint );
}
@@ -993,7 +993,7 @@ void AquaSalFrame::Flush( const Rectangle& rRect )
// #i113170# may not be the main thread if called from UNO API
SalData::ensureThreadAutoreleasePool();
- NSRect aNSRect = { {rRect.Left(), rRect.Top()}, { rRect.GetWidth(), rRect.GetHeight() } };
+ NSRect aNSRect = NSMakeRect( rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight());
VCLToCocoa( aNSRect, false );
[mpView setNeedsDisplayInRect: aNSRect];
@@ -1755,7 +1755,7 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight
if( nWidth && nHeight )
{
- NSRect aRect = { { nX, nY }, { nWidth, nHeight } };
+ NSRect aRect = NSMakeRect( nX, nY, nWidth, nHeight);
VCLToCocoa( aRect, false );
maClippingRects.push_back( CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height) );
}
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index c07790d5c3e9..cb22309e219f 100644
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -156,8 +156,8 @@ static AquaSalFrame* getMouseContainerFrame()
{
mDraggingDestinationHandler = nil;
mpFrame = pFrame;
- NSRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY },
- { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } };
+ NSRect aRect = NSMakeRect( pFrame->maGeometry.nX, pFrame->maGeometry.nY,
+ pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight);
pFrame->VCLToCocoa( aRect );
NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ];
[pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver
@@ -462,7 +462,7 @@ static AquaSalFrame* getMouseContainerFrame()
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
{
// FIXME: does this leak the returned NSCursor of getCurrentCursor ?
- NSRect aRect = { { 0, 0 }, { mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight } };
+ const NSRect aRect = NSMakeRect( 0, 0, 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 cf3bb4effd24..154e9ea89b1a 100644
--- a/vcl/aqua/source/window/salnsmenu.mm
+++ b/vcl/aqua/source/window/salnsmenu.mm
@@ -137,9 +137,8 @@
NSRect aImgRect = { { 2, 0 }, { 0, 0 } };
for( size_t i = 0; i < rButtons.size(); ++i )
{
- NSRect aFromRect = { { 0, 0 },
- { rButtons[i].maButton.maImage.GetSizePixel().Width(),
- rButtons[i].maButton.maImage.GetSizePixel().Height() } };
+ const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
+ const NSRect aFromRect = NSMakeRect( 0, 0, aPixSize.Width(), aPixSize.Height());
aImgRect.origin.y = floor((aFrame.size.height - aFromRect.size.height)/2);
aImgRect.size = aFromRect.size;
if( rButtons[i].mpNSImage )
@@ -161,9 +160,8 @@
NSPoint aMousePt = [pEvent locationInWindow];
for( size_t i = 0; i < rButtons.size(); ++i )
{
- NSRect aFromRect = { { 0, 0 },
- { rButtons[i].maButton.maImage.GetSizePixel().Width(),
- rButtons[i].maButton.maImage.GetSizePixel().Height() } };
+ const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
+ const NSRect aFromRect = NSMakeRect( 0, 0, 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) &&
@@ -195,9 +193,9 @@
aSize.width = 2;
for( size_t i = 0; i < rButtons.size(); ++i )
{
- NSRect aImgRect = { { aSize.width, floor((aSize.height-rButtons[i].maButton.maImage.GetSizePixel().Height())/2) },
- { rButtons[i].maButton.maImage.GetSizePixel().Width(),
- rButtons[i].maButton.maImage.GetSizePixel().Height() } };
+ const Size aPixSize = rButtons[i].maButton.maImage.GetSizePixel();
+ const int nY = floor( aSize.height - aPixSize.Height() ) / 2;
+ NSRect aImgRect = NSMakeRect( aSize.width, nY, aPixSize.Width(), aPixSize.Height());
if( rButtons[i].mpToolTipString )
[self addToolTipRect: aImgRect owner: rButtons[i].mpToolTipString userData: NULL];
aSize.width += 2 + aImgRect.size.width;
diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx
index 9b9c27a0fc27..d8b053ab09ed 100644
--- a/vcl/aqua/source/window/salobj.cxx
+++ b/vcl/aqua/source/window/salobj.cxx
@@ -168,15 +168,15 @@ void AquaSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
void AquaSalObject::setClippedPosSize()
{
- NSRect aViewRect = { { 0, 0 }, { mnWidth, mnHeight } };
+ NSRect aViewRect = NSMakeRect( 0, 0, mnWidth, mnHeight);
if( maSysData.pView )
{
NSView *pView = maSysData.pView;
[pView setFrame: aViewRect];
}
- NSRect aClipViewRect = { { mnX, mnY }, { mnWidth, mnHeight } };
- NSPoint aClipPt = { 0, 0 };
+ NSRect aClipViewRect = NSMakeRect( mnX, mnY, mnWidth, mnHeight);
+ NSPoint aClipPt = NSMakePoint( 0, 0);
if( mbClip )
{
aClipViewRect.origin.x += mnClipX;