# HG changeset patch # User Olaf Wintermann # Date 1697060163 -7200 # Node ID 770b3548906c23d40cf2e50328972655ecb29435 # Parent f632bc0589ab56c219a35613a39d58752dadf43c use generated App class (WinUI3) diff -r f632bc0589ab -r 770b3548906c ui/winui/App.xaml.cpp --- a/ui/winui/App.xaml.cpp Wed Oct 11 22:59:42 2023 +0200 +++ b/ui/winui/App.xaml.cpp Wed Oct 11 23:36:03 2023 +0200 @@ -6,6 +6,8 @@ #include "App.xaml.h" #include "MainWindow.xaml.h" +#include "toolkit.h" + using namespace winrt; using namespace Windows::Foundation; using namespace Microsoft::UI::Xaml; @@ -43,6 +45,7 @@ /// Details about the launch request and process. void App::OnLaunched(LaunchActivatedEventArgs const&) { - window = make(); - window.Activate(); + ui_app_run_startup(); + //window = make(); + //window.Activate(); } diff -r f632bc0589ab -r 770b3548906c ui/winui/toolkit.cpp --- a/ui/winui/toolkit.cpp Wed Oct 11 22:59:42 2023 +0200 +++ b/ui/winui/toolkit.cpp Wed Oct 11 23:36:03 2023 +0200 @@ -66,6 +66,11 @@ static UiObject* active_window; +void ui_app_run_startup() { + if (startup_func) { + startup_func(NULL, startup_data); + } +} class App : public ApplicationT { public: @@ -165,7 +170,13 @@ void ui_main() { init_apartment(); - Application::Start([](auto&&) {make(); }); + //Application::Start([](auto&&) {make(); }); + + ::winrt::Microsoft::UI::Xaml::Application::Start( + [](auto&&) + { + ::winrt::make<::winrt::winui::implementation::App>(); + }); } class UiWin { diff -r f632bc0589ab -r 770b3548906c ui/winui/toolkit.h --- a/ui/winui/toolkit.h Wed Oct 11 22:59:42 2023 +0200 +++ b/ui/winui/toolkit.h Wed Oct 11 23:36:03 2023 +0200 @@ -32,6 +32,8 @@ typedef void(*ui_eventfunc)(void*, void*); +void ui_app_run_startup(); + extern "C" void destroy_ui_window_wrapper(void* ptr); extern "C" void destroy_ui_widget_wrapper(void* ptr); diff -r f632bc0589ab -r 770b3548906c ui/winui/window.cpp --- a/ui/winui/window.cpp Wed Oct 11 22:59:42 2023 +0200 +++ b/ui/winui/window.cpp Wed Oct 11 23:36:03 2023 +0200 @@ -62,6 +62,7 @@ //Window window = Window(); Window window = make(); + //window.ExtendsContentIntoTitleBar(true); if (title) { wchar_t *wtitle = str2wstr(title, nullptr); window.Title(wtitle);