aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/TextBlock.cpp6
-rw-r--r--src/ui/controls/TextControlService.hpp6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/ui/controls/TextBlock.cpp b/src/ui/controls/TextBlock.cpp
index 7f7ee38b..9ce99ab6 100644
--- a/src/ui/controls/TextBlock.cpp
+++ b/src/ui/controls/TextBlock.cpp
@@ -30,12 +30,10 @@ render::RenderObject* TextBlock::GetRenderObject() const {
return text_render_object_.get();
}
-std::u16string TextBlock::GetText() const {
- return text_render_object_->GetText();
-}
+std::u16string TextBlock::GetText() const { return service_->GetText(); }
void TextBlock::SetText(std::u16string text) {
- text_render_object_->SetText(std::move(text));
+ service_->SetText(std::move(text));
}
gsl::not_null<render::TextRenderObject*> TextBlock::GetTextRenderObject() {
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();
}