Cleanup: replace NSTextInput with NSTextInputClient

This revision replaces the deprecated protocol NSTextInput with
NSTextInputClient in Cocoa Text View. No functional changes.

For more information of the methods, please see:
https://developer.apple.com/documentation/appkit/nstextinputclient

Differential Revision: https://developer.blender.org/D11407
This commit is contained in:
Yuki Hashimoto 2021-07-05 12:58:33 +02:00 committed by Brecht Van Lommel
parent c1ba68dd04
commit 2c6c1b6cc0
1 changed files with 8 additions and 10 deletions

View File

@ -25,7 +25,7 @@
* Objective-C does not have multiple inheritance. */
// We need to subclass it in order to give Cocoa the feeling key events are trapped
@interface COCOA_VIEW_CLASS : COCOA_VIEW_BASE_CLASS <NSTextInput>
@interface COCOA_VIEW_CLASS : COCOA_VIEW_BASE_CLASS <NSTextInputClient>
{
GHOST_SystemCocoa *systemCocoa;
GHOST_WindowCocoa *associatedWindow;
@ -202,12 +202,14 @@
}
}
- (void)insertText:(id)chars
- (void)insertText:(id)chars replacementRange:(NSRange)replacementRange
{
[self composing_free];
}
- (void)setMarkedText:(id)chars selectedRange:(NSRange)range
- (void)setMarkedText:(id)chars
selectedRange:(NSRange)range
replacementRange:(NSRange)replacementRange
{
[self composing_free];
if ([chars length] == 0)
@ -241,12 +243,8 @@
return composing;
}
- (NSInteger)conversationIdentifier
{
return (NSInteger)self;
}
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range
- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)range
actualRange:(NSRangePointer)actualRange
{
return [[[NSAttributedString alloc] init] autorelease];
}
@ -267,7 +265,7 @@
return NSMakeRange(0, length);
}
- (NSRect)firstRectForCharacterRange:(NSRange)range
- (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(NSRangePointer)actualRange
{
return NSZeroRect;
}