[haiku-webkit-commits] r397 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Wed, 07 Apr 2010 10:55:29 +0000

Author: stippi
Date: Wed Apr  7 10:55:29 2010
New Revision: 397
URL: http://mmlr.dyndns.org/changeset/397

Log:
* Revised the application startup to check how many windows have been created at
  all. Open a blank page if no pages have been created from the arguments passed
  to the application.
* If no pages have been created yet, don't offset the last known window frame.
  This fixes windows shifting over the screen from session to session.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp
   webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp        Wed Apr  7 
00:00:24 2010        (r396)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp        Wed Apr  7 
10:55:29 2010        (r397)
@@ -162,11 +162,13 @@
 
        fInitialized = true;
 
+       int32 pagesCreated = 0;
        if (fLaunchRefsMessage) {
-               RefsReceived(fLaunchRefsMessage);
+               _RefsReceived(fLaunchRefsMessage, &pagesCreated);
                delete fLaunchRefsMessage;
                fLaunchRefsMessage = 0;
-       } else {
+       }
+       if (pagesCreated == 0) {
                BrowserWindow* window = new BrowserWindow(fLastWindowFrame, 
fSettings);
                window->Show();
        }
@@ -236,22 +238,7 @@
                return;
        }
 
-       entry_ref ref;
-       for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) {
-               BEntry entry(&ref, true);
-               if (!entry.Exists())
-                       continue;
-               BPath path;
-               if (entry.GetPath(&path) != B_OK)
-                       continue;
-               BString url;
-               url << path.Path();
-               _CreateNewPage(url);
-       }
-
-       BString url;
-       for (int32 i = 0; message->FindString("url", i, &url) == B_OK; i++)
-               _CreateNewPage(url);
+       _RefsReceived(message);
 }
 
 
@@ -296,6 +283,36 @@
 
 
 void
+BrowserApp::_RefsReceived(BMessage* message, int32* _pagesCreated)
+{
+       int32 pagesCreated = 0;
+
+       entry_ref ref;
+       for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) {
+               BEntry entry(&ref, true);
+               if (!entry.Exists())
+                       continue;
+               BPath path;
+               if (entry.GetPath(&path) != B_OK)
+                       continue;
+               BString url;
+               url << path.Path();
+               _CreateNewPage(url);
+               pagesCreated++;
+       }
+
+       BString url;
+       for (int32 i = 0; message->FindString("url", i, &url) == B_OK; i++) {
+               _CreateNewPage(url);
+               pagesCreated++;
+       }
+
+       if (_pagesCreated != NULL)
+               *_pagesCreated = pagesCreated;
+}
+
+
+void
 BrowserApp::_CreateNewPage(const BString& url)
 {
        uint32 workspace = 1 << current_workspace();
@@ -323,7 +340,10 @@
 void
 BrowserApp::_CreateNewWindow(const BString& url)
 {
-       fLastWindowFrame.OffsetBy(20, 20);
+       // Offset the window frame unless this is the first window created in 
the
+       // session.
+       if (fWindowCount > 0)
+               fLastWindowFrame.OffsetBy(20, 20);
        if (!BScreen().Frame().Contains(fLastWindowFrame))
                fLastWindowFrame.OffsetTo(50, 50);
 

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h  Wed Apr  7 00:00:24 
2010        (r396)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h  Wed Apr  7 10:55:29 
2010        (r397)
@@ -53,6 +53,8 @@
        virtual bool                            QuitRequested();
 
 private:
+                       void                            _RefsReceived(BMessage* 
message,
+                                                                       int32* 
pagesCreated = NULL);
                        void                            _CreateNewPage(const 
BString& url);
                        void                            _CreateNewWindow(const 
BString& url);
                        void                            
_CreateNewTab(BrowserWindow* window,

Other related posts:

  • » [haiku-webkit-commits] r397 - webkit/trunk/WebKit/haiku/WebPositive - webkit