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

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Wed, 19 May 2010 22:52:34 +0000

Author: stippi
Date: Wed May 19 22:52:34 2010
New Revision: 506
URL: http://mmlr.dyndns.org/changeset/506

Log:
Introduced --fullscreen and -f command line options.

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

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp        Wed May 19 
22:41:36 2010        (r505)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.cpp        Wed May 19 
22:52:34 2010        (r506)
@@ -102,6 +102,11 @@
 {
        BMessage message(B_REFS_RECEIVED);
        for (int i = 1; i < argc; i++) {
+               if (strcmp("-f", argv[i]) == 0
+                       || strcmp("--fullscreen", argv[i]) == 0) {
+                       message.AddBool("fullscreen", true);
+                       continue;
+               }
                const char* url = argv[i];
                BEntry entry(argv[i], true);
                BPath path;
@@ -163,16 +168,15 @@
        fInitialized = true;
 
        int32 pagesCreated = 0;
+       bool fullscreen = false;
        if (fLaunchRefsMessage) {
-               _RefsReceived(fLaunchRefsMessage, &pagesCreated);
+               _RefsReceived(fLaunchRefsMessage, &pagesCreated, &fullscreen);
                delete fLaunchRefsMessage;
-               fLaunchRefsMessage = 0;
-       }
-       if (pagesCreated == 0) {
-               BrowserWindow* window = new BrowserWindow(fLastWindowFrame, 
fSettings,
-                       "");
-               window->Show();
+               fLaunchRefsMessage = NULL;
        }
+       if (pagesCreated == 0)
+               _CreateNewWindow("", fullscreen);
+
        PostMessage(PRELOAD_BROWSING_HISTORY);
 }
 
@@ -284,10 +288,15 @@
 
 
 void
-BrowserApp::_RefsReceived(BMessage* message, int32* _pagesCreated)
+BrowserApp::_RefsReceived(BMessage* message, int32* _pagesCreated,
+       bool* _fullscreen)
 {
        int32 pagesCreated = 0;
 
+       bool fullscreen;
+       if (message->FindBool("fullscreen", &fullscreen) != B_OK)
+               fullscreen = false;
+
        entry_ref ref;
        for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) {
                BEntry entry(&ref, true);
@@ -298,23 +307,25 @@
                        continue;
                BString url;
                url << path.Path();
-               _CreateNewPage(url);
+               _CreateNewPage(url, fullscreen);
                pagesCreated++;
        }
 
        BString url;
        for (int32 i = 0; message->FindString("url", i, &url) == B_OK; i++) {
-               _CreateNewPage(url);
+               _CreateNewPage(url, fullscreen);
                pagesCreated++;
        }
 
        if (_pagesCreated != NULL)
                *_pagesCreated = pagesCreated;
+       if (_fullscreen != NULL)
+               *_fullscreen = fullscreen;
 }
 
 
 void
-BrowserApp::_CreateNewPage(const BString& url)
+BrowserApp::_CreateNewPage(const BString& url, bool fullscreen)
 {
        uint32 workspace = 1 << current_workspace();
 
@@ -334,12 +345,12 @@
                if (loadedInWindowOnCurrentWorkspace)
                        return;
        }
-       _CreateNewWindow(url);
+       _CreateNewWindow(url, fullscreen);
 }
 
 
 void
-BrowserApp::_CreateNewWindow(const BString& url)
+BrowserApp::_CreateNewWindow(const BString& url, bool fullscreen)
 {
        // Offset the window frame unless this is the first window created in 
the
        // session.
@@ -350,6 +361,8 @@
 
        BrowserWindow* window = new BrowserWindow(fLastWindowFrame, fSettings,
                url);
+       if (fullscreen)
+               window->ToggleFullscreen();
        window->Show();
 }
 

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h  Wed May 19 22:41:36 
2010        (r505)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserApp.h  Wed May 19 22:52:34 
2010        (r506)
@@ -54,9 +54,12 @@
 
 private:
                        void                            _RefsReceived(BMessage* 
message,
-                                                                       int32* 
pagesCreated = NULL);
-                       void                            _CreateNewPage(const 
BString& url);
-                       void                            _CreateNewWindow(const 
BString& url);
+                                                                       int32* 
pagesCreated = NULL,
+                                                                       bool* 
fullscreen = NULL);
+                       void                            _CreateNewPage(const 
BString& url,
+                                                                       bool 
fullscreen = false);
+                       void                            _CreateNewWindow(const 
BString& url,
+                                                                       bool 
fullscreen = false);
                        void                            
_CreateNewTab(BrowserWindow* window,
                                                                        const 
BString& url, bool select);
                        void                            _ShowWindow(const 
BMessage* message,

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Wed May 19 
22:41:36 2010        (r505)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Wed May 19 
22:52:34 2010        (r506)
@@ -674,7 +674,7 @@
                        break;
 
                case TOGGLE_FULLSCREEN:
-                       _ToggleFullscreen();
+                       ToggleFullscreen();
                        break;
 
                case TOGGLE_AUTO_HIDE_INTERFACE_IN_FULLSCREEN:
@@ -863,7 +863,7 @@
 void
 BrowserWindow::Zoom(BPoint origin, float width, float height)
 {
-       _ToggleFullscreen();
+       ToggleFullscreen();
 }
 
 
@@ -1028,6 +1028,31 @@
 }
 
 
+void
+BrowserWindow::ToggleFullscreen()
+{
+       if (fIsFullscreen) {
+               MoveTo(fNonFullscreenWindowFrame.LeftTop());
+               ResizeTo(fNonFullscreenWindowFrame.Width(),
+                       fNonFullscreenWindowFrame.Height());
+
+               SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
+               SetLook(B_DOCUMENT_WINDOW_LOOK);
+
+               _ShowInterface(true);
+       } else {
+               fNonFullscreenWindowFrame = Frame();
+               _ResizeToScreen();
+
+               SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE));
+               SetLook(B_TITLED_WINDOW_LOOK);
+       }
+       fIsFullscreen = !fIsFullscreen;
+       fFullscreenItem->SetMarked(fIsFullscreen);
+       fToggleFullscreenButton->SetVisible(fIsFullscreen);
+}
+
+
 // #pragma mark - Notification API
 
 
@@ -1849,31 +1874,6 @@
 
 
 void
-BrowserWindow::_ToggleFullscreen()
-{
-       if (fIsFullscreen) {
-               MoveTo(fNonFullscreenWindowFrame.LeftTop());
-               ResizeTo(fNonFullscreenWindowFrame.Width(),
-                       fNonFullscreenWindowFrame.Height());
-
-               SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
-               SetLook(B_DOCUMENT_WINDOW_LOOK);
-
-               _ShowInterface(true);
-       } else {
-               fNonFullscreenWindowFrame = Frame();
-               _ResizeToScreen();
-
-               SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE));
-               SetLook(B_TITLED_WINDOW_LOOK);
-       }
-       fIsFullscreen = !fIsFullscreen;
-       fFullscreenItem->SetMarked(fIsFullscreen);
-       fToggleFullscreenButton->SetVisible(fIsFullscreen);
-}
-
-
-void
 BrowserWindow::_ResizeToScreen()
 {
        BScreen screen(this);

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h       Wed May 19 
22:41:36 2010        (r505)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.h       Wed May 19 
22:52:34 2010        (r506)
@@ -109,6 +109,8 @@
 
                        BRect                           WindowFrame() const;
 
+                       void                            ToggleFullscreen();
+
 private:
        // WebPage notification API implementations
        virtual void                            NavigationRequested(const 
BString& url,

Other related posts:

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