From 2b95ff71782048ecd1f848c8a5225a98d7350de6 Mon Sep 17 00:00:00 2001 From: Marcus Tomlinson Date: Mon, 17 Jun 2024 08:57:06 +0100 Subject: [PATCH] Centre window on launch --- snap/snapcraft.yaml | 2 +- src/main.cpp | 16 ++++++++++------ subprojects/choc | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index fb2a254..b5cdc59 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: icloud-for-linux -version: '0.18' +version: '0.19' summary: iCloud for Linux description: iCloud for Linux diff --git a/src/main.cpp b/src/main.cpp index 22f72ed..f6f89b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,9 @@ int main(int, char **argv) { choc::ui::DesktopWindow appWin(choc::ui::Bounds{0, 0, 0, 0}); + appWin.setVisible(false); appWin.centreWithSize(1000, 600); + appWin.setVisible(true); appWin.setWindowTitle( "iCloud " + std::string(argv[2]) ); appWin.windowClosed = []() { choc::messageloop::stop(); }; @@ -18,17 +20,19 @@ int main(int, char **argv) webView.onNewWindow( [&](const std::string& url) { - choc::ui::DesktopWindow appWin(choc::ui::Bounds{0, 0, 0, 0}); - appWin.centreWithSize(1000, 600); - appWin.setWindowTitle( "iCloud " + std::string(argv[2]) + " ⧉" ); + choc::ui::DesktopWindow appWin2(choc::ui::Bounds{0, 0, 0, 0}); + appWin2.setVisible(false); + appWin2.centreWithSize(1000, 600); + appWin2.setVisible(true); + appWin2.setWindowTitle( "iCloud " + std::string(argv[2]) + " ⧉" ); choc::ui::WebView webView; webView.navigate(url); - appWin.setContent(webView.getViewHandle()); - appWin.toFront(); + appWin2.setContent(webView.getViewHandle()); + appWin2.toFront(); - return appWin.getWindowHandle(); + return appWin2.getWindowHandle(); }); choc::messageloop::run(); diff --git a/subprojects/choc b/subprojects/choc index 2152d5a..a32d465 160000 --- a/subprojects/choc +++ b/subprojects/choc @@ -1 +1 @@ -Subproject commit 2152d5a80ab2af8cf8afc59a195f94a319a93cf7 +Subproject commit a32d465e74de37d12e81977218de9fc5d0f4ed39