aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/TextControlService.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-09-15 16:55:03 +0800
committercrupest <crupest@outlook.com>2020-09-15 16:55:03 +0800
commitc9f3ec5f3a04d658194a4b8bfef9ff897985e2f1 (patch)
treef643761d09fbbf0d3630a82bcdd1b2334e898f02 /src/ui/controls/TextControlService.hpp
parent463995e0aa36bac5a70b661eeb05a9f617958f18 (diff)
downloadcru-c9f3ec5f3a04d658194a4b8bfef9ff897985e2f1.tar.gz
cru-c9f3ec5f3a04d658194a4b8bfef9ff897985e2f1.tar.bz2
cru-c9f3ec5f3a04d658194a4b8bfef9ff897985e2f1.zip
...
Diffstat (limited to 'src/ui/controls/TextControlService.hpp')
-rw-r--r--src/ui/controls/TextControlService.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/controls/TextControlService.hpp b/src/ui/controls/TextControlService.hpp
index c9b4066c..5e423d7d 100644
--- a/src/ui/controls/TextControlService.hpp
+++ b/src/ui/controls/TextControlService.hpp
@@ -357,6 +357,7 @@ class TextControlService : public Object {
if (window == nullptr) return;
input_method_context_ =
GetUiApplication()->GetInputMethodManager()->GetContext(window);
+ input_method_context_->EnableIME();
auto sync = [this](std::nullptr_t) { this->SyncTextRenderObject(); };
input_method_context_->CompositionStartEvent()->AddHandler(
[this](std::nullptr_t) { this->DeleteSelectedText(); });
@@ -373,7 +374,10 @@ class TextControlService : public Object {
void LoseFocusHandler(event::FocusChangeEventArgs& args) {
if (!args.IsWindow()) this->AbortSelection();
- input_method_context_.reset();
+ if (input_method_context_) {
+ input_method_context_->DisableIME();
+ input_method_context_.reset();
+ }
SyncTextRenderObject();
}