fix keyboard input on OS X < 10.6

Since commit e4dc93f5, LibreOffice just beeps on any key press:
it's impossible to add symbols by using keyboard. This patch
fixes that.

conditionally reverts e4dc93f5d8

Change-ID: Id30e30775c0d0224954b8a1f05fd0d8d5f39cd4e
Reviewed-on: https://gerrit.libreoffice.org/9793
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Douglas Mencken
2014-06-15 22:40:36 -04:00
committed by Caolán McNamara
parent ca4f1929ce
commit a2ee38ef7a
2 changed files with 34 additions and 2 deletions

View File

@@ -63,11 +63,15 @@
-(void)unregisterDraggingDestinationHandler:(id)theHandler; -(void)unregisterDraggingDestinationHandler:(id)theHandler;
@end @end
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
@interface SalFrameView : AquaA11yWrapper <NSTextInput>
#else
@interface SalFrameView : AquaA11yWrapper <NSTextInputClient> @interface SalFrameView : AquaA11yWrapper <NSTextInputClient>
#endif
{ {
AquaSalFrame* mpFrame; AquaSalFrame* mpFrame;
// for NSTextInputClient // for NSTextInput/NSTextInputClient
NSEvent* mpLastEvent; NSEvent* mpLastEvent;
BOOL mbNeedSpecialKeyHandle; BOOL mbNeedSpecialKeyHandle;
BOOL mbInKeyInput; BOOL mbInKeyInput;
@@ -117,7 +121,11 @@
/* /*
text action methods text action methods
*/ */
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
-(void)insertText:(id)aString;
#else
-(void)insertText:(id)aString replacementRange:(NSRange)replacementRange; -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange;
#endif
-(void)insertTab: (id)aSender; -(void)insertTab: (id)aSender;
-(void)insertBacktab: (id)aSender; -(void)insertBacktab: (id)aSender;
-(void)moveLeft: (id)aSender; -(void)moveLeft: (id)aSender;

View File

@@ -1026,9 +1026,15 @@ private:
} }
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
-(void)insertText:(id)aString
#else
-(void)insertText:(id)aString replacementRange:(NSRange)replacementRange -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange
#endif
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
(void) replacementRange; // FIXME: surely it must be used (void) replacementRange; // FIXME: surely it must be used
#endif
YIELD_GUARD; YIELD_GUARD;
@@ -1547,7 +1553,7 @@ private:
} }
// NSTextInputClient protocol // NSTextInput/NSTextInputClient protocol
- (NSArray *)validAttributesForMarkedText - (NSArray *)validAttributesForMarkedText
{ {
return [NSArray arrayWithObjects:NSUnderlineStyleAttributeName, nil]; return [NSArray arrayWithObjects:NSUnderlineStyleAttributeName, nil];
@@ -1598,9 +1604,15 @@ private:
return mSelectedRange; return mSelectedRange;
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange
#else
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange replacementRange:(NSRange)replacementRange - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange replacementRange:(NSRange)replacementRange
#endif
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
(void) replacementRange; // FIXME - use it! (void) replacementRange; // FIXME - use it!
#endif
if( ![aString isKindOfClass:[NSAttributedString class]] ) if( ![aString isKindOfClass:[NSAttributedString class]] )
aString = [[[NSAttributedString alloc] initWithString:aString] autorelease]; aString = [[[NSAttributedString alloc] initWithString:aString] autorelease];
@@ -1668,10 +1680,16 @@ private:
mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0); mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0);
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange
#else
- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
#endif
{ {
(void) aRange; (void) aRange;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
(void) actualRange; (void) actualRange;
#endif
// FIXME - Implement // FIXME - Implement
return nil; return nil;
@@ -1715,11 +1733,17 @@ private:
mpLastEvent = nil; mpLastEvent = nil;
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
- (NSRect)firstRectForCharacterRange:(NSRange)aRange
#else
- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
#endif
{ {
// FIXME - These should probably be used? // FIXME - These should probably be used?
(void) aRange; (void) aRange;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
(void) actualRange; (void) actualRange;
#endif
SalExtTextInputPosEvent aPosEvent; SalExtTextInputPosEvent aPosEvent;
mpFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void *)&aPosEvent ); mpFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void *)&aPosEvent );