From c5125e9034a5b05700ed41aee30f43476cb2c7f2 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 29 Oct 2020 00:16:48 +0800 Subject: ... --- include/cru/ui/WindowHost.hpp | 8 ++++---- src/ui/RoutedEventDispatch.hpp | 4 ++-- src/ui/Window.cpp | 1 + src/ui/WindowHost.cpp | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/cru/ui/WindowHost.hpp b/include/cru/ui/WindowHost.hpp index 8efb505d..c3221dcf 100644 --- a/include/cru/ui/WindowHost.hpp +++ b/include/cru/ui/WindowHost.hpp @@ -120,10 +120,10 @@ class WindowHost : public Object { bool no_enter); private: - Control* root_control_; - render::RenderObject* root_render_object_; + Control* root_control_ = nullptr; + render::RenderObject* root_render_object_ = nullptr; - platform::native::INativeWindow* native_window_; + platform::native::INativeWindow* native_window_ = nullptr; bool need_layout_ = false; platform::native::TimerAutoCanceler relayout_timer_canceler_; @@ -136,7 +136,7 @@ class WindowHost : public Object { Control* focus_control_; - Control* mouse_captured_control_; + Control* mouse_captured_control_ = nullptr; bool layout_prefer_to_fill_window_ = true; }; diff --git a/src/ui/RoutedEventDispatch.hpp b/src/ui/RoutedEventDispatch.hpp index b6e0999b..de94a598 100644 --- a/src/ui/RoutedEventDispatch.hpp +++ b/src/ui/RoutedEventDispatch.hpp @@ -4,7 +4,7 @@ #include "cru/common/Logger.hpp" #include "cru/ui/DebugFlags.hpp" -#include +#include namespace cru::ui { // Dispatch the event. @@ -36,7 +36,7 @@ void DispatchEvent(const std::u16string_view& event_name, return; } - std::list receive_list; + std::vector receive_list; auto parent = original_sender; while (parent != last_receiver) { diff --git a/src/ui/Window.cpp b/src/ui/Window.cpp index 6d507858..051e67ef 100644 --- a/src/ui/Window.cpp +++ b/src/ui/Window.cpp @@ -9,6 +9,7 @@ namespace cru::ui { Window* Window::CreateOverlapped() { return new Window(); } Window::Window() : render_object_(new render::StackLayoutRenderObject()) { + render_object_->SetAttachedControl(this); window_host_ = std::make_unique(this); } diff --git a/src/ui/WindowHost.cpp b/src/ui/WindowHost.cpp index 1dba4404..12eb746a 100644 --- a/src/ui/WindowHost.cpp +++ b/src/ui/WindowHost.cpp @@ -99,7 +99,8 @@ inline void BindNativeEvent( } } // namespace -WindowHost::WindowHost(Control* root_control) : root_control_(root_control) { +WindowHost::WindowHost(Control* root_control) + : root_control_(root_control), focus_control_(root_control) { const auto ui_application = IUiApplication::GetInstance(); auto native_window = ui_application->CreateWindow(nullptr); native_window_ = native_window; -- cgit v1.2.3