mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1180564: Don't implement NSTextInput any more, just NSTextInputClient. r=masayuki
This commit is contained in:
parent
44938f57d9
commit
9427b573f9
@ -4934,10 +4934,6 @@ pref("dom.presentation.discoverable", false);
|
||||
// Use raw ICU instead of CoreServices API in Unicode collation
|
||||
pref("intl.collation.mac.use_icu", true);
|
||||
|
||||
// Enable NSTextInput protocol for use with IMEs that have not
|
||||
// been updated to use the NSTextInputClient protocol.
|
||||
pref("intl.ime.nstextinput.enable", false);
|
||||
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
// In non-release builds we crash by default on insecure text input (when a
|
||||
// password editor has focus but secure event input isn't enabled). The
|
||||
|
@ -5220,116 +5220,6 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
return shouldMinimize;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
// NSTextInput implementation
|
||||
|
||||
- (void)insertText:(id)insertString
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE_VOID(mGeckoChild);
|
||||
|
||||
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
||||
|
||||
NSAttributedString* attrStr;
|
||||
if ([insertString isKindOfClass:[NSAttributedString class]]) {
|
||||
attrStr = static_cast<NSAttributedString*>(insertString);
|
||||
} else {
|
||||
attrStr =
|
||||
[[[NSAttributedString alloc] initWithString:insertString] autorelease];
|
||||
}
|
||||
|
||||
mTextInputHandler->InsertText(attrStr);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (void)insertNewline:(id)sender
|
||||
{
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return;
|
||||
}
|
||||
|
||||
[self insertText:@"\n"];
|
||||
}
|
||||
|
||||
- (NSInteger)conversationIdentifier
|
||||
{
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mTextInputHandler, reinterpret_cast<NSInteger>(self));
|
||||
return mTextInputHandler->ConversationIdentifier();
|
||||
}
|
||||
|
||||
- (NSRect)firstRectForCharacterRange:(NSRange)theRange
|
||||
{
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return NSMakeRect(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
NSRect rect;
|
||||
NS_ENSURE_TRUE(mTextInputHandler, rect);
|
||||
return mTextInputHandler->FirstRectForCharacterRange(theRange);
|
||||
}
|
||||
|
||||
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
|
||||
{
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mTextInputHandler, nil);
|
||||
return mTextInputHandler->GetAttributedSubstringFromRange(theRange);
|
||||
}
|
||||
|
||||
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
// We're considering not implementing NSTextInput. Start by just
|
||||
// preffing its methods off.
|
||||
if (!Preferences::GetBool("intl.ime.nstextinput.enable", false)) {
|
||||
NSLog(@"Set intl.ime.nstextinput.enable to true in about:config to fix input.");
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE_VOID(mTextInputHandler);
|
||||
|
||||
nsAutoRetainCocoaObject kungFuDeathGrip(self);
|
||||
|
||||
NSAttributedString* attrStr;
|
||||
if ([aString isKindOfClass:[NSAttributedString class]]) {
|
||||
attrStr = static_cast<NSAttributedString*>(aString);
|
||||
} else {
|
||||
attrStr = [[[NSAttributedString alloc] initWithString:aString] autorelease];
|
||||
}
|
||||
|
||||
mTextInputHandler->SetMarkedText(attrStr, selRange);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
// NSTextInputClient implementation
|
||||
|
||||
@ -5569,6 +5459,11 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
- (void)insertNewline:(id)sender
|
||||
{
|
||||
[self insertText:@"\n"];
|
||||
}
|
||||
|
||||
- (void)flagsChanged:(NSEvent*)theEvent
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
Loading…
Reference in New Issue
Block a user