Wed, 11 Oct 2023 23:36:03 +0200
use generated App class (WinUI3)
ui/winui/App.xaml.cpp | file | annotate | diff | comparison | revisions | |
ui/winui/toolkit.cpp | file | annotate | diff | comparison | revisions | |
ui/winui/toolkit.h | file | annotate | diff | comparison | revisions | |
ui/winui/window.cpp | file | annotate | diff | comparison | revisions |
--- 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 @@ /// <param name="e">Details about the launch request and process.</param> void App::OnLaunched(LaunchActivatedEventArgs const&) { - window = make<MainWindow>(); - window.Activate(); + ui_app_run_startup(); + //window = make<MainWindow>(); + //window.Activate(); }
--- 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<App, IXamlMetadataProvider> { public: @@ -165,7 +170,13 @@ void ui_main() { init_apartment(); - Application::Start([](auto&&) {make<App>(); }); + //Application::Start([](auto&&) {make<App>(); }); + + ::winrt::Microsoft::UI::Xaml::Application::Start( + [](auto&&) + { + ::winrt::make<::winrt::winui::implementation::App>(); + }); } class UiWin {
--- 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);
--- 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<winui::implementation::MainWindow>(); + //window.ExtendsContentIntoTitleBar(true); if (title) { wchar_t *wtitle = str2wstr(title, nullptr); window.Title(wtitle);