gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11650: Make loads in _level0 notify


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11650: Make loads in _level0 notify hosting with a Stage.resize event. Have Player proxy that to a new gui::resizeWindow implemented for GTK.
Date: Tue, 24 Nov 2009 22:01:56 +0100
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11650
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2009-11-24 22:01:56 +0100
message:
  Make loads in _level0 notify hosting with a Stage.resize event. Have Player 
proxy that to a new gui::resizeWindow implemented for GTK.
modified:
  gui/Player.cpp
  gui/gtk.cpp
  gui/gtksup.h
  gui/gui.cpp
  gui/gui.h
  libcore/movie_root.cpp
=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp    2009-11-16 12:57:54 +0000
+++ b/gui/Player.cpp    2009-11-24 21:01:56 +0000
@@ -564,6 +564,23 @@
         return "";
     }
 
+    if (event == "Stage.resize")
+    {
+        if ( _gui.isPlugin() ) {
+            log_debug("Player doing nothing on Stage.resize as we're a 
plugin");
+            return "";
+        }
+
+        // arg contains WIDTHxHEIGHT
+        log_debug("Player got Stage.resize(%s) message", arg);
+        int width, height;
+        sscanf(arg.c_str(), "%dx%d", &width, &height);
+        _gui.resizeWindow(width, height);
+
+        return "";
+    }
+
+
     if (event == "System.capabilities.screenResolutionX")
     {
         std::ostringstream ss;

=== modified file 'gui/gtk.cpp'
--- a/gui/gtk.cpp       2009-11-16 12:57:54 +0000
+++ b/gui/gtk.cpp       2009-11-24 21:01:56 +0000
@@ -748,6 +748,22 @@
     return true;
 }
 
+void
+GtkGui::resizeWindow(int width, int height)
+{
+    log_debug("GtkGui: Window resize request received");
+
+    if (!_xid) {
+    
+        // This sets the *minimum* size for the drawing area and thus will
+        // also resize the window if needed. 
+        // Advantage: The window is sized correctly, no matter what other
+        // widgets are visible
+        // Disadvantage: The window will never be shrinked, which is bad.   
+        gtk_widget_set_size_request(_canvas, width, height);
+    }
+}
+
 bool
 GtkGui::createWindow(const char *title, int width, int height,
                      int xPosition, int yPosition)

=== modified file 'gui/gtksup.h'
--- a/gui/gtksup.h      2009-11-16 12:57:54 +0000
+++ b/gui/gtksup.h      2009-11-24 21:01:56 +0000
@@ -63,6 +63,7 @@
     virtual bool createWindow(int width, int height);
     virtual bool createWindow(const char *title, int width, int height,
                               int xPosition = 0, int yPosition = 0);
+    virtual void resizeWindow(int width, int height);
 
     virtual bool run();
 

=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp       2009-10-21 07:10:41 +0000
+++ b/gui/gui.cpp       2009-11-24 21:01:56 +0000
@@ -181,6 +181,12 @@
 }
 
 void
+Gui::resizeWindow(int /*width*/, int /*height*/)
+{
+    log_unimpl(_("Window resize not yet supported in this GUI"));
+}
+
+void
 Gui::unsetFullscreen()
 {
     log_unimpl(_("Fullscreen not yet supported in this GUI"));

=== modified file 'gui/gui.h'
--- a/gui/gui.h 2009-11-16 12:57:54 +0000
+++ b/gui/gui.h 2009-11-24 21:01:56 +0000
@@ -121,6 +121,8 @@
     virtual bool createWindow(const char* title, int width, int height,
                        int xPosition = 0, int yPosition = 0) = 0;
 
+    virtual void resizeWindow(int width, int height);
+
     /// Start main rendering loop.
     virtual bool run() = 0;
 

=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2009-11-19 07:43:34 +0000
+++ b/libcore/movie_root.cpp    2009-11-24 21:01:56 +0000
@@ -318,6 +318,20 @@
                        //       (like, unregistering all childs etc...)
                        //       Tested, but not automated, is that other
                        //       levels should be maintained alive.
+            // Sat Nov 14 10:31:19 CET 2009
+            // ^^^ not confirmed in this date, I think other levels 
+            //     are dropped too! (strk)
+
+            m_viewport_width = static_cast<int>(movie->widthPixels());
+            m_viewport_height = static_cast<int>(movie->heightPixels());
+
+            // notify  stage replacement
+            if ( _interfaceHandler )
+            {
+                std::stringstream ss;
+                ss << m_viewport_width << "x" << m_viewport_height;
+                _interfaceHandler->call("Stage.resize", ss.str());
+            }
                }
 
                it->second->destroy();


reply via email to

[Prev in Thread] Current Thread [Next in Thread]