Skip to content

Commit

Permalink
Centre window on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusTomlinson committed Jun 17, 2024
1 parent d0fc470 commit 2b95ff7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: icloud-for-linux
version: '0.18'
version: '0.19'
summary: iCloud for Linux
description: iCloud for Linux

Expand Down
16 changes: 10 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); };
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion subprojects/choc
Submodule choc updated 1 files
+1 −1 gui/choc_WebView.h

0 comments on commit 2b95ff7

Please sign in to comment.