gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11330: Separate registration of nat


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11330: Separate registration of native functions.
Date: Wed, 29 Jul 2009 16:55:35 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11330
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-29 16:55:35 +0200
message:
  Separate registration of native functions.
  
  Key handling must be moved out of the Key class and put somewhere like
  movie_root so that both Key and Keyboard can access it. This will also
  make the class much simpler.
modified:
  libcore/asobj/Globals.cpp
  libcore/asobj/flash/ui/Keyboard_as.cpp
  libcore/asobj/flash/ui/Keyboard_as.h
    ------------------------------------------------------------
    revno: 11327.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-29 15:50:30 +0200
    message:
      Register Key natives separately to avoid them being called twice.
    modified:
      libcore/asobj/Globals.cpp
      libcore/asobj/flash/ui/Keyboard_as.cpp
      libcore/asobj/flash/ui/Keyboard_as.h
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-07-29 14:33:56 +0000
+++ b/libcore/asobj/Globals.cpp 2009-07-29 14:55:35 +0000
@@ -1168,6 +1168,7 @@
     registerSystemNative(global);
     registerStageNative(global);
     registerSharedObjectNative(global);
+    registerKeyboardNative(global);
 
     AsBroadcaster::registerNative(global);
     TextFormat_as::registerNative(global);

=== modified file 'libcore/asobj/flash/ui/Keyboard_as.cpp'
--- a/libcore/asobj/flash/ui/Keyboard_as.cpp    2009-07-28 11:58:27 +0000
+++ b/libcore/asobj/flash/ui/Keyboard_as.cpp    2009-07-29 13:50:30 +0000
@@ -219,13 +219,24 @@
 }
 #endif // def GNASH_USE_GC
 
+void
+registerKeyboardNative(as_object& global)
+{
+    VM& vm = getVM(global);
+    vm.registerNative(key_get_ascii, 800, 0);
+    vm.registerNative(key_get_code, 800, 1);
+    vm.registerNative(key_is_down, 800, 2);
+    vm.registerNative(key_is_toggled, 800, 3);
+}
+
 // extern (used by Global.cpp)
-void Keyboard_as::init(as_object& where, const ObjectURI& uri)
+void
+Keyboard_as::init(as_object& where, const ObjectURI& uri)
 {
 
     // Create built-in key object.
     // NOTE: _global.Key *is* an object, not a constructor
-    as_object*  key_obj = new Keyboard_as;
+    as_object* key_obj = new Keyboard_as;
 
     const int flags = PropFlags::readOnly |
                       PropFlags::dontDelete |
@@ -258,18 +269,10 @@
     VM& vm = getVM(where);
     Global_as* gl = getGlobal(where);
 
-    vm.registerNative(key_get_ascii, 800, 0);
     key_obj->init_member("getAscii", vm.getNative(800, 0), flags);
-
-    vm.registerNative(key_get_code, 800, 1);
     key_obj->init_member("getCode", vm.getNative(800, 1), flags);
-
-    vm.registerNative(key_is_down, 800, 2);
     key_obj->init_member("isDown", vm.getNative(800, 2), flags);
-
-    vm.registerNative(key_is_toggled, 800, 3);
     key_obj->init_member("isToggled", vm.getNative(800, 3), flags);
-
     key_obj->init_member("isAccessible", 
             gl->createFunction(key_is_accessible), flags);
 

=== modified file 'libcore/asobj/flash/ui/Keyboard_as.h'
--- a/libcore/asobj/flash/ui/Keyboard_as.h      2009-07-28 11:58:27 +0000
+++ b/libcore/asobj/flash/ui/Keyboard_as.h      2009-07-29 13:50:30 +0000
@@ -77,6 +77,8 @@
     int _lastKeyEvent;
 };
 
+void registerKeyboardNative(as_object& global);
+
 } // gnash namespace
 
 // GNASH_ASOBJ3_KEYBOARD_H


reply via email to

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