gnash-dev
[Top][All Lists]
Advanced

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

Re: [Gnash-dev] Trying to make key-events work again (patch)


From: annonygmouse
Subject: Re: [Gnash-dev] Trying to make key-events work again (patch)
Date: Wed, 09 Aug 2006 01:48:08 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; ca-AD; rv:1.7.13) Gecko/20060621 Debian/1.7.13-0.2

Rob Savoye wrote:
annonygmouse wrote:


I mean: where should get_play_state be looked?
    - Inside the "advance_movie"?


  Probably. That's roughly where it used to be.


    - Outside and it disables the delay callback?
   - Any other idea?


  These controls have always been somewhat bogus, and didn't even work
for all movies. So I'd say feel free to make this work the way it
should, and not worry about how it;s currently implemented. (or was
implemented)

Ok. I've implemented it inside "advance_movie" if there's need to move it somewhere else... time will tell.


BTW: What's the difference between "pause" and "stop"?


  With Stop, it restarts from the beginning with Start. Pause then Start
has it continue from where it was paused. (assuming these worked, that
is :-) )

Thanks for clarifying it, I've given a quick look but it gives me an "system_security_allowdomain:unimplemented" message.

Is there anywhere a doc saying wich are the reserved keys/combination of keys that the player does not pass to the movie?

Anyway, I've attached a patch to make "CTRL- q, w, p" and ESC work again. If you think it's sane enough, please apply. I supose the sound should also be stop when pause, this will be version 2 :) (sound does not work ATM for me).

SebastiĆ 
? gtk.cpp
? make_keys_work_again_v1.patch
? gui/NullGui.lo
? gui/gnash
? gui/gtk.lo
? gui/gtk_glue_gtkglext.lo
? gui/gui.lo
? gui/libgnashgui.la
? libamf/.libs
? libamf/amf.lo
? libamf/libgnashamf.la
? libamf/rtmp.lo
? plugin/np_entry.lo
? plugin/npn_gate.lo
? plugin/npp_gate.lo
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.15
diff -u -r1.15 gtk.cpp
--- gui/gtk.cpp 31 Jul 2006 23:26:33 -0000      1.15
+++ gui/gtk.cpp 8 Aug 2006 23:39:29 -0000
@@ -51,6 +51,7 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
 
 
 using namespace std;
@@ -324,6 +325,7 @@
                         gpointer data)
 {
 //    GNASH_REPORT_FUNCTION;
+    dbglogfile << "menuitem_pause_callback: " << endl;
     menu_pause();
 }
 
@@ -456,44 +458,41 @@
     GNASH_REPORT_FUNCTION;
 
     switch (event->keyval) {
-    case XK_Home:
+    case GDK_Home:
 //        info.what = viewer::key_home;
         break;
-
-    case XK_Left:
+    case GDK_Left:
 //        info.what = viewer::key_left;
         break;
-
-    case XK_Up:
+    case GDK_Up:
 //        info.what = viewer::key_up;
         break;
-
-    case XK_Right:
+    case GDK_Right:
 //        info.what = viewer::key_right;
         break;
-
-    case XK_Down:
+    case GDK_Down:
 //        info.what = viewer::key_down;
         break;
-
-    case XK_Page_Up:
+    case GDK_Page_Up:
 //        info.what = viewer::key_page_up;
         break;
-
-    case XK_Page_Down:
+    case GDK_Page_Down:
 //        info.what = viewer::key_page_down;
         break;
-
     default:
         if (event->length <= 0) {
             return true;
         }
-        char key = gdk_unicode_to_keyval(event->keyval);
+        unsigned int key = gdk_unicode_to_keyval(event->keyval);
         if (event->state == GDK_SHIFT_MASK) {
             dbglogfile << "Got Shift-key: " << key << endl;
         }
         if (event->state == GDK_CONTROL_MASK) {
-            switch(key) {
+            switch( (char)key) {
+              case 'q':
+              case 'w':
+                  menuitem_quit_callback(NULL, NULL);
+                  break;
               case 'r':
                   menuitem_restart_callback(NULL, NULL);
                   break;
@@ -505,18 +504,16 @@
                   break;
             }
         }
+       if ( event->hardware_keycode == 9 )
+               menuitem_quit_callback(NULL,NULL); //Only hardware_keycode 
worked to detect Escape key pressed.
         if ((event->state != GDK_CONTROL_MASK) || !(event->state != 
GDK_SHIFT_MASK)) {
-            dbglogfile << "Got key: " << key << endl;
+           dbglogfile << "Got key: '" << (char) key << "' its name is: " << 
gdk_keyval_name(key) << " hwkeycode: " << event->hardware_keycode << endl;
         }
         
         gnash::key::code       c(gnash::key::INVALID);
         
         if (key >= 'a' && key <= 'z') {
             c = (gnash::key::code) ((key - 'a') + gnash::key::A);
-//         } else if (key >= SDLK_F1 && key <= SDLK_F15)       {
-//             c = (gnash::key::code) ((key - SDLK_F1) + gnash::key::F1);
-//         } else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
-//             c = (gnash::key::code) ((key - SDLK_KP0) + gnash::key::KP_0);
         }
         switch (key) {
           case '[':
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.12
diff -u -r1.12 gui.cpp
--- gui/gui.cpp 7 Aug 2006 18:35:23 -0000       1.12
+++ gui/gui.cpp 8 Aug 2006 23:39:29 -0000
@@ -146,6 +146,7 @@
     } else {
       m->set_play_state(gnash::movie_interface::STOP);
     }
+
 }
 
 void
@@ -207,17 +208,16 @@
     Gui *gui = reinterpret_cast<Gui*> (data);
     gnash::movie_interface* m = gnash::get_current_root();
 
-    m->advance(1.0);
-    m->display();
-    
-    gui->renderBuffer();
-    
-    if (!gui->loops()) {
+    if (m->get_play_state() == gnash::movie_interface::PLAY) {
+        m->advance(1.0);
+    }
+       m->display();
+       gui->renderBuffer();
+  
         if (m->get_current_frame() + 1 ==
             m->get_root_movie()->get_movie_definition()->get_frame_count()) {
             exit(0); // TODO: quit in a more gentile fashion.
         }
-    }
 
     return true;
 }

reply via email to

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