gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-609-g393ff1c
Date: Mon, 01 Aug 2011 07:08:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  393ff1cc65e0beffee5ff4de898502ae969ac719 (commit)
       via  fb133600b097c7461faf2576c712e8503f5aee74 (commit)
       via  8e4cacdf6fe87c842b6188e96285681067dbdfc2 (commit)
      from  e92c48843ade11c4593fb03650b7a1883ae70735 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=393ff1cc65e0beffee5ff4de898502ae969ac719


commit 393ff1cc65e0beffee5ff4de898502ae969ac719
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Aug 1 08:54:02 2011 +0200

    Add note about regression.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 5246fce..a0315ec 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -633,6 +633,11 @@ movie_root::keyEvent(key::code k, bool down)
     }
     
     if (down) {
+
+        // NB: Button handling is not correct, as only one button should
+        // respond to any key. A test is in misc-ming.all/KeyEventOrder.c.
+        // However, the previous attempt to fix caused real-life failures:
+        // see bug #33889.
         ButtonListeners copy = _buttonListeners;
         for (ButtonListeners::const_iterator it = copy.begin(), e = copy.end();
                 it != e; ++it) {

http://git.savannah.gnu.org/cgit//commit/?id=fb133600b097c7461faf2576c712e8503f5aee74


commit fb133600b097c7461faf2576c712e8503f5aee74
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Aug 1 08:44:13 2011 +0200

    Use a typedef.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 5cd1ae6..5246fce 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -633,9 +633,9 @@ movie_root::keyEvent(key::code k, bool down)
     }
     
     if (down) {
-        std::list<Button*> copy = _buttonListeners;
-        for (std::list<Button*>::const_iterator it = copy.begin(),
-                e = copy.end(); it != e; ++it) {
+        ButtonListeners copy = _buttonListeners;
+        for (ButtonListeners::const_iterator it = copy.begin(), e = copy.end();
+                it != e; ++it) {
             if ((*it)->unloaded()) continue;
             (*it)->keyPress(k);
         }
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index bf2a095..08e5290 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -392,12 +392,6 @@ public:
     }
 
     /// Push a new DisplayObject listener for key events
-    //
-    /// Each button can register several events for its actions. Only one
-    /// event can be registered for each key. The key code is unique to
-    /// Buttons: it is neither ascii nor the key-specific code.
-    //
-    /// @param c    The SWF key code for the button event.
     void registerButton(Button* listener);
 
     /// Remove a DisplayObject listener for key events
@@ -954,7 +948,8 @@ private:
 
     void handleActionLimitHit(const std::string& ref);
 
-    std::list<Button*> _buttonListeners;
+    typedef std::list<Button*> ButtonListeners;
+    ButtonListeners _buttonListeners;
 
     GC _gc;
 

http://git.savannah.gnu.org/cgit//commit/?id=8e4cacdf6fe87c842b6188e96285681067dbdfc2


commit 8e4cacdf6fe87c842b6188e96285681067dbdfc2
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Aug 1 08:40:42 2011 +0200

    Restore old Button behaviour.
    
    This reverts the changes made by an earlier commit
    3db73486d8b99425a707e6ab04acf37942303eb8, which fixed a test but caused
    regressions in live SWFs.

diff --git a/libcore/Button.cpp b/libcore/Button.cpp
index f850969..fec8767 100644
--- a/libcore/Button.cpp
+++ b/libcore/Button.cpp
@@ -224,25 +224,6 @@ private:
     DisplayObject* _tp;
 };
 
-class ButtonKeyRegisterer : public std::unary_function<int, void>
-{
-public:
-    ButtonKeyRegisterer(movie_root& mr, Button* this_ptr)
-        :
-        _mr(mr),
-        _tp(this_ptr)
-    {}
-
-    void operator()(int code) const
-    {
-        _mr.registerButtonKey(code, _tp);
-    }
-
-private:
-    movie_root& _mr;
-    Button* _tp;
-};
-
 }
 
 namespace {
@@ -853,8 +834,7 @@ Button::construct(as_object* initObj)
 
     // Register key events.
     if (_def->hasKeyPressHandler()) {
-        ButtonKeyRegisterer r(stage(), this);
-        _def->visitKeyCodes(r);
+        stage().registerButton(this);
     }
 
 }
@@ -906,7 +886,7 @@ Button::unloadChildren()
 void
 Button::destroy()
 {
-    stage().removeButtonKey(this);
+    stage().removeButton(this);
 
     for (DisplayObjects::iterator i = _stateCharacters.begin(),
             e=_stateCharacters.end(); i != e; ++i) {
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 9cce28b..5cd1ae6 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -541,7 +541,7 @@ movie_root::reset()
     _movieLoader.clear();
 
     // Remove button key events.
-    _buttonKeys.clear();
+    _buttonListeners.clear();
 
     // Cleanup the stack.
     _vm.getStack().clear();
@@ -633,16 +633,11 @@ movie_root::keyEvent(key::code k, bool down)
     }
     
     if (down) {
-        ButtonKeys::const_iterator it =
-            _buttonKeys.find(key::codeMap[k][key::SWF]);
-
-        // TODO: this searches through all ButtonActions for the correct
-        // one, even though we could easily know which one it's going to be
-        // because we search through them all to register the key codes.
-        if (it != _buttonKeys.end()) {
-            if (!it->second.first->unloaded()) {
-                it->second.first->keyPress(k);
-            }
+        std::list<Button*> copy = _buttonListeners;
+        for (std::list<Button*>::const_iterator it = copy.begin(),
+                e = copy.end(); it != e; ++it) {
+            if ((*it)->unloaded()) continue;
+            (*it)->keyPress(k);
         }
 
         // If we're focused on an editable text field, finally the text
@@ -1923,29 +1918,20 @@ movie_root::callExternalCallback(const std::string 
&name,
 }
 
 void
-movie_root::removeButtonKey(Button* listener)
+movie_root::removeButton(Button* listener)
 {
-    // Remove the button and the key associated with it from the map.
-    for (ButtonKeys::iterator i = _buttonKeys.begin(), e = _buttonKeys.end();
-            i != e;) {
-        if (i->second.first == listener) {
-            _buttonKeys.erase(i++);
-        }
-        else ++i;
-    }
-
+    _buttonListeners.remove_if(
+            std::bind2nd(std::equal_to<Button*>(), listener));
 }
 
 void
-movie_root::registerButtonKey(int code, Button* listener)
+movie_root::registerButton(Button* listener)
 {
-    const size_t frame = _rootMovie->get_current_frame();
-    ButtonKeys::const_iterator it = _buttonKeys.find(code);
-
-    if (it != _buttonKeys.end() && it->second.second < frame) {
+    if (std::find(_buttonListeners.begin(), _buttonListeners.end(), listener)
+            != _buttonListeners.end()) {
         return;
     }
-    _buttonKeys[code] = std::make_pair(listener, frame);
+    _buttonListeners.push_front(listener);
 }
 
 void
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 1b66766..bf2a095 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -398,10 +398,10 @@ public:
     /// Buttons: it is neither ascii nor the key-specific code.
     //
     /// @param c    The SWF key code for the button event.
-    void registerButtonKey(int c, Button* listener);
+    void registerButton(Button* listener);
 
     /// Remove a DisplayObject listener for key events
-    void removeButtonKey(Button* listener);
+    void removeButton(Button* listener);
 
     /// Get the DisplayObject having focus
     //
@@ -954,13 +954,7 @@ private:
 
     void handleActionLimitHit(const std::string& ref);
 
-    /// A map of SWF key code to Buttons.
-    //
-    /// The Buttons are removed on destruction, so there is no need to
-    /// mark them reachable.
-    typedef std::pair<Button*, size_t> ButtonFrame;
-    typedef std::map<int, ButtonFrame> ButtonKeys;
-    ButtonKeys _buttonKeys;
+    std::list<Button*> _buttonListeners;
 
     GC _gc;
 
diff --git a/testsuite/misc-ming.all/KeyEventOrder.c 
b/testsuite/misc-ming.all/KeyEventOrder.c
index 607d952..5e8cef1 100644
--- a/testsuite/misc-ming.all/KeyEventOrder.c
+++ b/testsuite/misc-ming.all/KeyEventOrder.c
@@ -195,7 +195,7 @@ main(int argc, char** argv)
 
   SWFMovie_nextFrame(mo);
 
-  check_equals(mo, "_root.order",
+  xcheck_equals(mo, "_root.order",
           "'mc2,mc1,o1,o2,button1,mc2,mc1,o1,o2,button3,'");
   
   SWFMovie_nextFrame(mo);

-----------------------------------------------------------------------

Summary of changes:
 libcore/Button.cpp                      |   24 +---------------
 libcore/movie_root.cpp                  |   45 ++++++++++++------------------
 libcore/movie_root.h                    |   19 +++----------
 testsuite/misc-ming.all/KeyEventOrder.c |    2 +-
 4 files changed, 25 insertions(+), 65 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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