Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remember window size and location on the mac.

  • Loading branch information...
commit 22882109415d9b3e733b0a4b2d88e72e0a931768 1 parent c9f03c9
@gruehle gruehle authored
Showing with 30 additions and 12 deletions.
  1. +30 −12 appshell/cefclient_mac.mm
View
42 appshell/cefclient_mac.mm
@@ -353,23 +353,41 @@ - (void)createApp:(id)object {
settings.web_security_disabled = true;
- window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
+ [[mainWnd windowController] setShouldCascadeWindows: NO];
+
+ // Set the initial default size of the window.
+ NSRect defSize = [mainWnd contentRectForFrameRect:[mainWnd frame]];
+ defSize.size.width = kWindowWidth;
+ defSize.size.height = kWindowHeight
+#ifdef SHOW_TOOLBAR_UI
+ + URLBAR_HEIGHT
+#endif
+ ;
+
+ [mainWnd setFrame:[mainWnd frameRectForContentRect:defSize] display:NO];
+
+ // Set the "autosave" name for the window. If there is a previously stored
+ // size for the window, it will be loaded here.
+ [mainWnd setFrameAutosaveName:APP_NAME @"MainWindow"];
+
+ // Get the actual content size of the window since setFrameAutosaveName could
+ // result in the window size changing.
+ NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]];
+
+ window_info.SetAsChild(contentView, 0, 0,
+ r.size.width,
+ r.size.height
+#ifdef SHOW_TOOLBAR_UI
+ + URLBAR_HEIGHT
+#endif
+ );
+
CefBrowserHost::CreateBrowser(window_info, g_handler.get(),
[[startupUrl absoluteString] UTF8String], settings);
// Show the window.
+ [mainWnd display];
[mainWnd makeKeyAndOrderFront: nil];
-
- // Size the window.
- NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]];
- r.size.width = kWindowWidth;
- r.size.height = kWindowHeight
-#ifdef SHOW_TOOLBAR_UI
- + URLBAR_HEIGHT
-#endif
- ;
-
- [mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES];
}
// Sent by the default notification center immediately before the application
Please sign in to comment.
Something went wrong with that request. Please try again.