diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-18 00:46:27 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-18 00:46:27 +0800 |
| commit | 6b4edc9be8ec556147c195cf2047d92b9439efd7 (patch) | |
| tree | a1d7b7d1e821b4e1911fd00761f77a24ee483f4a /src/ui/controls/TextHostControlService.cpp | |
| parent | f7c4d19df66c602d74795e98ce2ee4390d06fbb4 (diff) | |
| download | cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.gz cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.bz2 cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.zip | |
Bring back ControlHost and refactor tree management of control.
Diffstat (limited to 'src/ui/controls/TextHostControlService.cpp')
| -rw-r--r-- | src/ui/controls/TextHostControlService.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp index f51199c9..5908852a 100644 --- a/src/ui/controls/TextHostControlService.cpp +++ b/src/ui/controls/TextHostControlService.cpp @@ -13,7 +13,7 @@ #include "cru/ui/Base.h" #include "cru/ui/DebugFlags.h" #include "cru/ui/components/Menu.h" -#include "cru/ui/controls/Window.h" +#include "cru/ui/controls/ControlHost.h" #include "cru/ui/helper/ShortcutHub.h" #include "cru/ui/render/ScrollRenderObject.h" #include "cru/ui/render/TextRenderObject.h" @@ -293,9 +293,9 @@ void TextHostControlService::DeleteText(TextRange range, platform::gui::IInputMethodContext* TextHostControlService ::GetInputMethodContext() { - Window* window = this->control_->GetWindow(); - if (!window) return nullptr; - platform::gui::INativeWindow* native_window = window->GetNativeWindow(); + auto host = this->control_->GetControlHost(); + if (!host) return nullptr; + platform::gui::INativeWindow* native_window = host->GetNativeWindow(); if (!native_window) return nullptr; return native_window->GetInputMethodContext(); } @@ -588,11 +588,10 @@ void TextHostControlService::GainFocusHandler( this->ReplaceSelectedText(text); }); - auto window = control_->GetWindow(); - if (window) - input_method_context_event_guard_ += - window->AfterLayoutEvent()->AddHandler( - [this](auto) { this->UpdateInputMethodPosition(); }); + auto host = control_->GetControlHost(); + if (host) + input_method_context_event_guard_ += host->AfterLayoutEvent()->AddHandler( + [this](auto) { this->UpdateInputMethodPosition(); }); SetCaretVisible(true); } } |
