Kaydet (Commit) a6c88e4b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

SAL_WNODEPRECATED_DECLARATIONS_PUSH/POP around new macOS 10.12 deprecations

...for now

Change-Id: I64a0a8f6a006d75b6f82d7aae570aef414984a78
üst af239f5a
......@@ -85,6 +85,8 @@
- (void) postTheEvent: (short int)buttonIdentifier modifierFlags:(int)modifierFlags
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
[NSApp postEvent:
[NSEvent otherEventWithType:NSApplicationDefined
location:NSZeroPoint
......@@ -96,6 +98,7 @@
data1: buttonIdentifier
data2: 0]
atStart: NO];
SAL_WNODEPRECATED_DECLARATIONS_POP
}
......
......@@ -371,7 +371,12 @@ void SAL_CALL DropTarget::initialize(const Sequence< Any >& aArguments)
id wnd = [mView window];
NSWindow* parentWnd = [wnd parentWindow];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSResizableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSTitleWindowMask' is deprecated: first deprecated in macOS 10.12
unsigned int topWndStyle = (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask);
SAL_WNODEPRECATED_DECLARATIONS_POP
unsigned int wndStyles = [wnd styleMask] & topWndStyle;
if (parentWnd == nil && (wndStyles == topWndStyle))
......
......@@ -272,6 +272,11 @@ using namespace ::com::sun::star::uno;
sal_Int32 alignment;
property.Value >>= alignment;
NSNumber *textAlignment = nil;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSCenterTextAlignment' is deprecated: first deprecated in macOS 10.12
// 'NSJustifiedTextAlignment' is deprecated: first deprecated in macOS 10.12
// 'NSLeftTextAlignment' is deprecated: first deprecated in macOS 10.12
// 'NSRightTextAlignment' is deprecated: first deprecated in macOS 10.12
switch(alignment) {
case css::style::ParagraphAdjust_RIGHT : textAlignment = [NSNumber numberWithInteger:NSRightTextAlignment] ; break;
case css::style::ParagraphAdjust_CENTER: textAlignment = [NSNumber numberWithInteger:NSCenterTextAlignment] ; break;
......@@ -279,6 +284,7 @@ using namespace ::com::sun::star::uno;
case css::style::ParagraphAdjust_LEFT :
default : textAlignment = [NSNumber numberWithInteger:NSLeftTextAlignment] ; break;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
NSDictionary *paragraphStyle = [NSDictionary dictionaryWithObjectsAndKeys:textAlignment, @"AXTextAlignment", textAlignment, @"AXVisualTextAlignment", nil];
[string addAttribute:@"AXParagraphStyle" value:paragraphStyle range:range];
}
......
......@@ -151,6 +151,12 @@ void AquaSalFrame::initWindowAndView()
maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8);
// calculate style mask
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSBorderlessWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSMiniaturizableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSResizableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSTitledWindowMask' is deprecated: first deprecated in macOS 10.12
if( (mnStyle & SalFrameStyleFlags::FLOAT) ||
(mnStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) )
mnStyleMask = NSBorderlessWindowMask;
......@@ -184,6 +190,7 @@ void AquaSalFrame::initWindowAndView()
if( mnStyleMask != 0 )
mnStyleMask |= NSTitledWindowMask;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
// #i91990# support GUI-less (daemon) execution
@try
......@@ -1213,7 +1220,10 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
getAppleScrollBarVariant(aStyleSettings);
// set scrollbar size
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSRegularControlSize' is deprecated: first deprecated in macOS 10.12
aStyleSettings.SetScrollBarSize( static_cast<long int>([NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]) );
SAL_WNODEPRECATED_DECLARATIONS_POP
// images in menus false for MacOSX
aStyleSettings.SetPreferredUseImagesInMenus( false );
aStyleSettings.SetHideDisabledMenuItems( true );
......@@ -1364,6 +1374,17 @@ SalPointerState AquaSalFrame::GetPointerState()
if( pCur )
{
bMouseEvent = true;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSLeftMouseDown' is deprecated: first deprecated in macOS 10.12
// 'NSLeftMouseDragged' is deprecated: first deprecated in macOS 10.12
// 'NSLeftMouseUp' is deprecated: first deprecated in macOS 10.12
// 'NSMouseMoved' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseDown' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseDragged' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseUp' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseDown' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseDragged' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseUp' is deprecated: first deprecated in macOS 10.12
switch( [pCur type] )
{
case NSLeftMouseDown: state.mnState |= MOUSE_LEFT; break;
......@@ -1381,10 +1402,16 @@ SalPointerState AquaSalFrame::GetPointerState()
bMouseEvent = false;
break;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
}
if( bMouseEvent )
{
unsigned int nMask = (unsigned int)[pCur modifierFlags];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
if( (nMask & NSShiftKeyMask) != 0 )
state.mnState |= KEY_SHIFT;
if( (nMask & NSControlKeyMask) != 0 )
......@@ -1393,6 +1420,7 @@ SalPointerState AquaSalFrame::GetPointerState()
state.mnState |= KEY_MOD2;
if( (nMask & NSCommandKeyMask) != 0 )
state.mnState |= KEY_MOD1;
SAL_WNODEPRECATED_DECLARATIONS_POP
}
else
......
......@@ -38,6 +38,11 @@
static sal_uInt16 ImplGetModifierMask( unsigned int nMask )
{
sal_uInt16 nRet = 0;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
if( (nMask & NSShiftKeyMask) != 0 )
nRet |= KEY_SHIFT;
if( (nMask & NSControlKeyMask) != 0 )
......@@ -46,6 +51,7 @@ static sal_uInt16 ImplGetModifierMask( unsigned int nMask )
nRet |= KEY_MOD2;
if( (nMask & NSCommandKeyMask) != 0 )
nRet |= KEY_MOD1;
SAL_WNODEPRECATED_DECLARATIONS_POP
return nRet;
}
......@@ -152,8 +158,14 @@ static const struct ExceptionalKey
const unsigned int nModifierMask;
} aExceptionalKeys[] =
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
{ KEY_D, NSControlKeyMask | NSShiftKeyMask | NSAlternateKeyMask },
{ KEY_D, NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask }
SAL_WNODEPRECATED_DECLARATIONS_POP
};
static AquaSalFrame* getMouseContainerFrame()
......@@ -827,7 +839,10 @@ private:
{
dX += [pEvent deltaX];
dY += [pEvent deltaY];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12
NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask
SAL_WNODEPRECATED_DECLARATIONS_POP
untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ];
if( !pNextEvent )
break;
......@@ -887,7 +902,10 @@ private:
{
dX += [pEvent deltaX];
dY += [pEvent deltaY];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12
NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask
SAL_WNODEPRECATED_DECLARATIONS_POP
untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ];
if( !pNextEvent )
break;
......@@ -973,8 +991,12 @@ private:
interpretKeyEvents (why?). Try to dispatch them here first,
if not successful continue normally
*/
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
if( (mpFrame->mnLastModifierFlags & (NSAlternateKeyMask | NSCommandKeyMask))
== (NSAlternateKeyMask | NSCommandKeyMask) )
SAL_WNODEPRECATED_DECLARATIONS_POP
{
if( [self sendSingleCharacter: mpLastEvent] )
return YES;
......@@ -1044,6 +1066,12 @@ private:
// #i99567#
// find out the unmodified key code
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSKeyDown' is deprecated: first deprecated in macOS 10.12
// 'NSKeyUp' is deprecated: first deprecated in macOS 10.12
// sanity check
if( mpLastEvent && ( [mpLastEvent type] == NSKeyDown || [mpLastEvent type] == NSKeyUp ) )
{
......@@ -1067,6 +1095,7 @@ private:
{
nLastModifiers = 0;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
[self sendKeyInputAndReleaseToFrame: nKeyCode character: aCharCode modifiers: nLastModifiers];
}
else
......@@ -1119,7 +1148,10 @@ private:
-(void)moveLeftAndModifySelection: (id)aSender
{
(void)aSender;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
[self sendKeyInputAndReleaseToFrame: KEY_LEFT character: 0 modifiers: NSShiftKeyMask];
SAL_WNODEPRECATED_DECLARATIONS_POP
}
-(void)moveBackwardAndModifySelection: (id)aSender
......@@ -1137,7 +1169,10 @@ private:
-(void)moveRightAndModifySelection: (id)aSender
{
(void)aSender;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
[self sendKeyInputAndReleaseToFrame: KEY_RIGHT character: 0 modifiers: NSShiftKeyMask];
SAL_WNODEPRECATED_DECLARATIONS_POP
}
-(void)moveForwardAndModifySelection: (id)aSender
......
......@@ -373,6 +373,8 @@ void AquaSalInstance::wakeupYield()
if( mbWaitingYield )
{
SalData::ensureThreadAutoreleasePool();
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
location: NSZeroPoint
modifierFlags: 0
......@@ -382,6 +384,7 @@ void AquaSalInstance::wakeupYield()
subtype: AquaSalInstance::YieldWakeupEvent
data1: 0
data2: 0 ];
SAL_WNODEPRECATED_DECLARATIONS_POP
if( pEvent )
[NSApp postEvent: pEvent atStart: NO];
}
......@@ -620,7 +623,10 @@ SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents
{
sal_uLong nCount = ReleaseYieldMutex();
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: nil
SAL_WNODEPRECATED_DECLARATIONS_POP
inMode: NSDefaultRunLoopMode dequeue: YES];
if( pEvent )
{
......@@ -638,7 +644,10 @@ SalYieldResult AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents
sal_uLong nCount = ReleaseYieldMutex();
NSDate* pDt = AquaSalTimer::pRunningTimer ? [AquaSalTimer::pRunningTimer fireDate] : [NSDate distantFuture];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAnyEventMask' is deprecated: first deprecated in macOS 10.12
pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDt
SAL_WNODEPRECATED_DECLARATIONS_POP
inMode: NSDefaultRunLoopMode dequeue: YES];
if( pEvent )
[NSApp sendEvent: pEvent];
......@@ -740,6 +749,23 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
return false;
unsigned/*NSUInteger*/ nEventMask = 0;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSFlagsChangedMask' is deprecated: first deprecated in macOS 10.12
// 'NSKeyDownMask' is deprecated: first deprecated in macOS 10.12
// 'NSKeyUpMask' is deprecated: first deprecated in macOS 10.12
// 'NSLeftMouseDownMask' is deprecated: first deprecated in macOS 10.12
// 'NSLeftMouseDraggedMask' is deprecated: first deprecated in macOS 10.12
// 'NSLeftMouseUpMask' is deprecated: first deprecated in macOS 10.12
// 'NSMouseEnteredMask' is deprecated: first deprecated in macOS 10.12
// 'NSMouseExitedMask' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseDownMask' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseDraggedMask' is deprecated: first deprecated in macOS 10.12
// 'NSOtherMouseUpMask' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseDownMask' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseDraggedMask' is deprecated: first deprecated in macOS 10.12
// 'NSRightMouseUpMask' is deprecated: first deprecated in macOS 10.12
// 'NSScrollWheelMask' is deprecated: first deprecated in macOS 10.12
// 'NSTabletPoint' is deprecated: first deprecated in macOS 10.12
if( nType & VclInputFlags::MOUSE)
nEventMask |=
NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask |
......@@ -752,6 +778,7 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
nEventMask |= NSKeyDownMask | NSKeyUpMask | NSFlagsChangedMask;
if( nType & VclInputFlags::OTHER)
nEventMask |= NSTabletPoint;
SAL_WNODEPRECATED_DECLARATIONS_POP
// TODO: VclInputFlags::PAINT / more VclInputFlags::OTHER
if( !bool(nType) )
return false;
......
......@@ -157,7 +157,10 @@ static void initAppMenu()
[pString release];
if( pNewItem )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
[pNewItem setKeyEquivalentModifierMask: NSCommandKeyMask];
SAL_WNODEPRECATED_DECLARATIONS_POP
[pNewItem setTarget: pMainMenuSelector];
[pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 3];
}
......@@ -724,6 +727,11 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem,
// should always use the command key
int nItemModifier = 0;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
if (nModifier & KEY_SHIFT)
{
nItemModifier |= NSShiftKeyMask; // actually useful only for function keys
......@@ -739,6 +747,7 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem,
if(nModifier & KEY_MOD3)
nItemModifier |= NSControlKeyMask;
SAL_WNODEPRECATED_DECLARATIONS_POP
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(pSalMenuItem);
NSString* pString = CreateNSString( OUString( &nCommandKey, 1 ) );
......
......@@ -99,6 +99,12 @@
// must still end up in the view. This is necessary to handle common edit actions in docked
// windows (e.g. in toolbar fields).
NSEvent* pEvent = [NSApp currentEvent];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSKeyDown' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
if( pEvent && [pEvent type] == NSKeyDown )
{
unsigned int nModMask = ([pEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask));
......@@ -114,6 +120,7 @@
return;
}
}
SAL_WNODEPRECATED_DECLARATIONS_POP
const AquaSalFrame* pFrame = mpMenuItem->mpParentMenu ? mpMenuItem->mpParentMenu->getFrame() : nullptr;
if( pFrame && AquaSalFrame::isAlive( pFrame ) && ! pFrame->GetWindow()->IsInModalMode() )
......@@ -173,7 +180,10 @@
aImgRect.origin.y = floor((aFrame.size.height - aFromRect.size.height)/2);
aImgRect.size = aFromRect.size;
if( rButtons[i].mpNSImage )
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSCompositeSourceOver' is deprecated: first deprecated in macOS 10.12
[rButtons[i].mpNSImage drawInRect: aImgRect fromRect: aFromRect operation: NSCompositeSourceOver fraction: 1.0];
SAL_WNODEPRECATED_DECLARATIONS_POP
aImgRect.origin.x += aFromRect.size.width + 2;
}
}
......
......@@ -68,6 +68,8 @@ void ImplSalStartTimer( sal_uLong nMS )
{
SalData::ensureThreadAutoreleasePool();
// post an event so we can get into the main thread
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
location: NSZeroPoint
modifierFlags: 0
......@@ -77,6 +79,7 @@ void ImplSalStartTimer( sal_uLong nMS )
subtype: AquaSalInstance::AppStartTimerEvent
data1: (int)nMS
data2: 0 ];
SAL_WNODEPRECATED_DECLARATIONS_POP
if( pEvent )
[NSApp postEvent: pEvent atStart: YES];
}
......
......@@ -61,6 +61,8 @@
{
(void)pNotification;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
location: NSZeroPoint
modifierFlags: 0
......@@ -70,6 +72,7 @@
subtype: AquaSalInstance::AppExecuteSVMain
data1: 0
data2: 0 ];
SAL_WNODEPRECATED_DECLARATIONS_POP
if( pEvent )
[NSApp postEvent: pEvent atStart: NO];
}
......@@ -77,6 +80,15 @@
-(void)sendEvent:(NSEvent*)pEvent
{
NSEventType eType = [pEvent type];
SAL_WNODEPRECATED_DECLARATIONS_PUSH
// 'NSAlternateKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
// 'NSClosableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
// 'NSKeyDown' is deprecated: first deprecated in macOS 10.12
// 'NSMiniaturizableWindowMask' is deprecated: first deprecated in macOS 10.12
// 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
if( eType == NSApplicationDefined )
{
AquaSalInstance::handleAppDefinedEvent( pEvent );
......@@ -224,6 +236,7 @@
}
}
}
SAL_WNODEPRECATED_DECLARATIONS_POP
[super sendEvent: pEvent];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment