diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-10-21 14:25:05 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-10-27 11:11:14 +0200 |
commit | 6678b8123c9952c80a637d3a7f4e27511122009e (patch) | |
tree | 6bb1cd15a9ed85d12e1b0b8973a5b82e7bfdd3c3 /vcl | |
parent | 7d27e4b0257a8a927d3b59edcd549ff9103cbaa9 (diff) |
Use non-deprecated names for event types and flag bits
The deprecations were introduced in SDK 10.12 and we
require at least SDK 10.13 so this should not be
controversial in any way. (And seriously, I doubt LO
can be built with such an old SDK anyway.)
Change-Id: I5e2b18b61fa66a6b06f2c751fc9d6ea87b6cbe47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123990
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/osx/salframeview.mm | 55 |
1 files changed, 13 insertions, 42 deletions
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index cbe7befabf82..a9bed1fc5b4f 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -41,20 +41,14 @@ 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 ) + if( (nMask & NSEventModifierFlagShift) != 0 ) nRet |= KEY_SHIFT; - if( (nMask & NSControlKeyMask) != 0 ) + if( (nMask & NSEventModifierFlagControl) != 0 ) nRet |= KEY_MOD3; - if( (nMask & NSAlternateKeyMask) != 0 ) + if( (nMask & NSEventModifierFlagOption) != 0 ) nRet |= KEY_MOD2; - if( (nMask & NSCommandKeyMask) != 0 ) + if( (nMask & NSEventModifierFlagCommand) != 0 ) nRet |= KEY_MOD1; -SAL_WNODEPRECATED_DECLARATIONS_POP return nRet; } @@ -818,10 +812,7 @@ static AquaSalFrame* getMouseContainerFrame() { 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 + NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSEventMaskScrollWheel untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ]; if( !pNextEvent ) break; @@ -880,10 +871,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP { 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 + NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSEventMaskScrollWheel untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ]; if( !pNextEvent ) break; @@ -970,12 +958,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP 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( (mpFrame->mnLastModifierFlags & (NSEventModifierFlagOption | NSEventModifierFlagCommand)) + == (NSEventModifierFlagOption | NSEventModifierFlagCommand) ) { if( [self sendSingleCharacter: mpLastEvent] ) return YES; @@ -1028,14 +1012,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP // #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 ) ) + if( mpLastEvent && ( [mpLastEvent type] == NSEventTypeKeyDown || [mpLastEvent type] == NSEventTypeKeyUp ) ) { // get unmodified string NSString* pUnmodifiedString = [mpLastEvent charactersIgnoringModifiers]; @@ -1052,12 +1030,11 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH // applications and vcl's edit fields ignore key events with ALT // however we're at a place where we know text should be inserted // so it seems we need to strip the Alt modifier here - if( (nLastModifiers & (NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) - == NSAlternateKeyMask ) + if( (nLastModifiers & (NSEventModifierFlagControl | NSEventModifierFlagOption | NSEventModifierFlagCommand)) + == NSEventModifierFlagOption ) { nLastModifiers = 0; } -SAL_WNODEPRECATED_DECLARATIONS_POP [self sendKeyInputAndReleaseToFrame: nKeyCode character: aCharCode modifiers: nLastModifiers]; } else @@ -1110,10 +1087,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP -(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 + [self sendKeyInputAndReleaseToFrame: KEY_LEFT character: 0 modifiers: NSEventModifierFlagShift]; } -(void)moveBackwardAndModifySelection: (id)aSender @@ -1131,10 +1105,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP -(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 + [self sendKeyInputAndReleaseToFrame: KEY_RIGHT character: 0 modifiers: NSEventModifierFlagShift]; } -(void)moveForwardAndModifySelection: (id)aSender |