aboutsummaryrefslogtreecommitdiff
path: root/src/osx/gui/InputMethod.mm
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-10-21 22:26:40 +0800
committercrupest <crupest@outlook.com>2021-10-21 22:26:40 +0800
commit0164c6ff9a736f35e50e24361ee63b19556b8885 (patch)
tree208694c0cc495b2778346edc2ef37096e205ca84 /src/osx/gui/InputMethod.mm
parente998a88b5ad6cc260836b3374e882e2ef67d5d35 (diff)
downloadcru-0164c6ff9a736f35e50e24361ee63b19556b8885.tar.gz
cru-0164c6ff9a736f35e50e24361ee63b19556b8885.tar.bz2
cru-0164c6ff9a736f35e50e24361ee63b19556b8885.zip
...
Diffstat (limited to 'src/osx/gui/InputMethod.mm')
-rw-r--r--src/osx/gui/InputMethod.mm15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/osx/gui/InputMethod.mm b/src/osx/gui/InputMethod.mm
index ec8d194c..56ac2c56 100644
--- a/src/osx/gui/InputMethod.mm
+++ b/src/osx/gui/InputMethod.mm
@@ -28,19 +28,14 @@ void OsxInputMethodContextPrivate::RaiseCompositionEvent() { composition_event_.
void OsxInputMethodContextPrivate::RaiseTextEvent(StringView text) { text_event_.Raise(text); }
void OsxInputMethodContextPrivate::PerformSel(SEL sel) {
- [window_->p_->GetNSWindow() performSelector:sel];
+ // [window_->p_->GetNSWindow() performSelector:sel];
}
-void OsxInputMethodContextPrivate::Activate() {
- auto input_context = [[window_->p_->GetNSWindow() contentView] inputContext];
- Ensures(input_context);
- [input_context activate];
-}
+void OsxInputMethodContextPrivate::Activate() { is_enabled_ = true; }
void OsxInputMethodContextPrivate::Deactivate() {
- auto input_context = [[window_->p_->GetNSWindow() contentView] inputContext];
- Ensures(input_context);
- [input_context deactivate];
+ input_method_context_->CompleteComposition();
+ is_enabled_ = false;
}
}
@@ -90,4 +85,6 @@ IEvent<std::nullptr_t>* OsxInputMethodContext::CompositionEvent() {
}
IEvent<StringView>* OsxInputMethodContext::TextEvent() { return &p_->text_event_; }
+
+bool OsxInputMethodContext::IsEnabled() { return p_->is_enabled_; }
}