gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ./ChangeLog backend/Makefile.am libbase/M...


From: Rob Savoye
Subject: [Gnash-commit] gnash ./ChangeLog backend/Makefile.am libbase/M...
Date: Thu, 30 Mar 2006 01:52:00 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     Rob Savoye <address@hidden>     06/03/30 01:52:00

Modified files:
        .              : ChangeLog 
        backend        : Makefile.am 
        libbase        : Makefile.am container.h log.cpp 
        libgeometry    : Makefile.am 
        plugin         : Makefile.am player.cpp plugin.cpp plugin.h 
        plugin/klash   : Makefile.am 
        plugin/mozilla-sdk: Makefile.am 
        server         : Object.h 
        utilities      : Makefile.am 

Log message:
        * plugin/Makefile.am: Include the backend directory in the include
        paths.
        * plugin/player.cpp: Nuke the SDL support and start replacing it
        with GTK2. This file is currently unused as the standalone player
        is used instead.
        * plugin/plugin.cpp: Support GTK2 and GTKGLExt if they exist for
        the plugin. Fork the plugin instead of using a thread. Enable
        XEmbed.
        * plugin/plugin.h: XSync after setting the context.
        * plugin/klash/Makefile.am: Move klash_part.moc to _SOURCES.
        * plugin/mozilla-sdk/Makefile.am: We don't need the FIREFOX_DEFS
        now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.191&tr2=1.192&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/Makefile.am.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/Makefile.am.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/container.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/log.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libgeometry/Makefile.am.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/Makefile.am.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/player.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/plugin.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/plugin.h.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/klash/Makefile.am.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/plugin/mozilla-sdk/Makefile.am.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Object.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/Makefile.am.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.191 gnash/ChangeLog:1.192
--- gnash/ChangeLog:1.191       Wed Mar 29 05:42:41 2006
+++ gnash/ChangeLog     Thu Mar 30 01:51:59 2006
@@ -1,3 +1,24 @@
+2006-03-29  Rob Savoye  <address@hidden>
+
+       * plugin/Makefile.am: Include the backend directory in the include
+       paths.
+       * plugin/player.cpp: Nuke the SDL support and start replacing it
+       with GTK2. This file is currently unused as the standalone player
+       is used instead.
+       * plugin/plugin.cpp: Support GTK2 and GTKGLExt if they exist for
+       the plugin. Fork the plugin instead of using a thread. Enable
+       XEmbed.
+       * plugin/plugin.h: XSync after setting the context.
+       * plugin/klash/Makefile.am: Move klash_part.moc to _SOURCES.
+       * plugin/mozilla-sdk/Makefile.am: We don't need the FIREFOX_DEFS
+       now.
+
+2006-03-29  Rob Savoye  <address@hidden>
+
+       * configure.ac: Add --enable-lotsa-warnings, to turn on many more
+       warning messages. By default only -Wall is used when using
+       GCC. Based on a pacth by Petter Reinholdtsen <address@hidden>
+
 2006-03-28  Rob Savoye  <address@hidden>
 
        * README: Add text from web site about the mailing lists, and
Index: gnash/backend/Makefile.am
diff -u gnash/backend/Makefile.am:1.17 gnash/backend/Makefile.am:1.18
--- gnash/backend/Makefile.am:1.17      Wed Mar 29 05:42:41 2006
+++ gnash/backend/Makefile.am   Thu Mar 30 01:52:00 2006
@@ -25,7 +25,7 @@
 MP3_LIBS = $(MAD_LIBS)
 endif
 
-AM_CPPFLAGS = -Wall
+AM_CPPFLAGS = # -Wall
 
 AM_LDFLAGS =  \
        $(JPEG_LIBS)            \
Index: gnash/libbase/Makefile.am
diff -u gnash/libbase/Makefile.am:1.18 gnash/libbase/Makefile.am:1.19
--- gnash/libbase/Makefile.am:1.18      Wed Mar 29 05:42:41 2006
+++ gnash/libbase/Makefile.am   Thu Mar 30 01:52:00 2006
@@ -41,7 +41,7 @@
 AUTOMAKE_OPTIONS = 
 
 AM_CXXFLAGS = $(SDL_CFLAGS) $(SDL_MIXER_CFLAGS) $(INCLUDES)
-AM_CPPFLAGS = -Wall
+AM_CPPFLAGS = #-Wall
 
 # noinst_LTLIBRARIES = libbase.la
 lib_LTLIBRARIES = libgnashbase.la
Index: gnash/libbase/container.h
diff -u gnash/libbase/container.h:1.11 gnash/libbase/container.h:1.12
--- gnash/libbase/container.h:1.11      Thu Mar  9 19:29:06 2006
+++ gnash/libbase/container.h   Thu Mar 30 01:52:00 2006
@@ -85,7 +85,7 @@
 public:
        size_t  operator()(const T& data) const
        {
-               unsigned char*  p = (unsigned char*) &data;
+               const unsigned char*    p = (const unsigned char*) &data;
                int     size = sizeof(T);
 
                return sdbm_hash(p, size);
@@ -251,7 +251,7 @@
        /// \brief
        /// If you need a const tu_stringi, don't create a new object;
        /// these things have the same internal representation.
-       const tu_stringi&       to_tu_stringi() const { return *(tu_stringi*) 
this; }
+       const tu_stringi&       to_tu_stringi() const { return *(const 
tu_stringi*) this; }
 
        /// \brief
        /// operator= returns void; if you want to know why, ask Charles Bloom 
:)
Index: gnash/libbase/log.cpp
diff -u gnash/libbase/log.cpp:1.3 gnash/libbase/log.cpp:1.4
--- gnash/libbase/log.cpp:1.3   Wed Mar 29 05:42:41 2006
+++ gnash/libbase/log.cpp       Thu Mar 30 01:52:00 2006
@@ -423,7 +423,7 @@
 LogFile& 
 LogFile::operator << (const char *str)
 {
-    char *c = (char *)str;
+    string c(str);
     
     _logentry = timestamp();
     _logentry += ": ";
@@ -437,7 +437,7 @@
     // for logging, we have to strip the CR off the end otr we get
     // blanks lines as the previous implementation required a CR, and
     // now we don't.
-    int len = strlen(c);
+    int len = c.length();
     if (c[len] == '\n') {
        c[len] = 0;
     }
Index: gnash/libgeometry/Makefile.am
diff -u gnash/libgeometry/Makefile.am:1.12 gnash/libgeometry/Makefile.am:1.13
--- gnash/libgeometry/Makefile.am:1.12  Wed Mar 29 05:42:41 2006
+++ gnash/libgeometry/Makefile.am       Thu Mar 30 01:52:00 2006
@@ -40,7 +40,7 @@
 AUTOMAKE_OPTIONS = 
 
 AM_CXXFLAGS =  $(CFLAGS) $(SDL_CFLAGS) $(INCLUDES)
-AM_CPPFLAGS = -Wall
+AM_CPPFLAGS = #-Wall
 # AM_LDFLAGS  = $(OPENGL_LIBNS) $(SDL_LIBS)
 
 # noinst_LTLIBRARIES = libgeometry.la
Index: gnash/plugin/Makefile.am
diff -u gnash/plugin/Makefile.am:1.16 gnash/plugin/Makefile.am:1.17
--- gnash/plugin/Makefile.am:1.16       Fri Mar 10 15:15:13 2006
+++ gnash/plugin/Makefile.am    Thu Mar 30 01:52:00 2006
@@ -59,6 +59,7 @@
 INCLUDES = -I.. \
         -I$(srcdir)            \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/backend \
         -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/server \
        -I$(srcdir)/mozilla-sdk \
@@ -82,7 +83,7 @@
 # XP_UNIX      This needs to get defined for npapi.h on unix platforms.
 # PLUGIN_TRACE Enable this define to get debug prints whenever the plugin
 #              api gets control.
-AM_CPPFLAGS = -Wall -DPLUGIN_TRACE -DXP_UNIX -DMOZ_X11
+AM_CPPFLAGS = -DPLUGIN_TRACE -DXP_UNIX -DMOZ_X11 -DPREFIX="${prefix}"
 AM_LDFLAGS  = $(X_LIBS) -lX11 -lXi -lXmu \
        $(SDL_LIBS)     \
        $(SDL_MIXER_LIBS)\
@@ -105,9 +106,9 @@
 
 plugin_LTLIBRARIES = libgnashplugin.la
 
-noinst_HEADERS = plugin.h player.h
+noinst_HEADERS = plugin.h player.h 
 
-libgnashplugin_la_SOURCES  = plugin.cpp player.cpp
+libgnashplugin_la_SOURCES  = plugin.cpp player.cpp 
 libgnashplugin_la_LIBADD   = $(AM_LDFLAGS) \
        mozilla-sdk/libmozsdk.la\
        ../backend/libgnashbackend.la\
Index: gnash/plugin/klash/Makefile.am
diff -u gnash/plugin/klash/Makefile.am:1.3 gnash/plugin/klash/Makefile.am:1.4
--- gnash/plugin/klash/Makefile.am:1.3  Thu Mar  9 19:29:06 2006
+++ gnash/plugin/klash/Makefile.am      Thu Mar 30 01:52:00 2006
@@ -44,8 +44,8 @@
 
 kde_module_LTLIBRARIES= libklashpart.la
 
-libklashpart_la_SOURCES = klash_part.cpp
-nodist_libklashpart_la_SOURCES= klash_part.moc
+libklashpart_la_SOURCES = klash_part.cpp klash_part.moc
+#nodist_libklashpart_la_SOURCES= klash_part.moc
 libklashpart_la_LDFLAGS = -avoid-version $(all_libraries) $(KDE_RPATH)
 libklashpart_la_DEPENDANCIES = klash_part.moc
 
Index: gnash/plugin/mozilla-sdk/Makefile.am
diff -u gnash/plugin/mozilla-sdk/Makefile.am:1.7 
gnash/plugin/mozilla-sdk/Makefile.am:1.8
--- gnash/plugin/mozilla-sdk/Makefile.am:1.7    Sun Mar  5 01:57:08 2006
+++ gnash/plugin/mozilla-sdk/Makefile.am        Thu Mar 30 01:52:00 2006
@@ -24,7 +24,7 @@
        -I$(srcdir)/include
 
 AM_CXXFLAGS = $(CFLAGS) $(INCLUDES)
-AM_CPPFLAGS = -Wall  -DPLUGIN_TRACE -DXP_UNIX $(FIREFOX_DEFS)
+AM_CPPFLAGS = -DPLUGIN_TRACE -DXP_UNIX # $(FIREFOX_DEFS)
 # AM_LDFLAGS  = $(FIREFOX_LIBS)
 
 # noinst_LTLIBRARIES = libmozsdk.la
Index: gnash/plugin/player.cpp
diff -u gnash/plugin/player.cpp:1.10 gnash/plugin/player.cpp:1.11
--- gnash/plugin/player.cpp:1.10        Sat Mar 18 23:39:34 2006
+++ gnash/plugin/player.cpp     Thu Mar 30 01:52:00 2006
@@ -46,9 +46,6 @@
 // don't care about.
 #define NO_NSPR_10_SUPPORT
 
-//#include <SDL.h>
-//#include <SDL_thread.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -58,13 +55,13 @@
 #include "log.h"
 #include "gnash.h"
 #include "plugin.h"
-#include "ogl.h"
 #include "utility.h"
 #include "container.h"
 #include "tu_file.h"
 #include "tu_types.h"
 #include "xmlsocket.h"
 #include "Movie.h"
+#include "ogl.h"
 
 // Mozilla SDK headers
 #include "prinit.h"
@@ -73,6 +70,17 @@
 #include "prcvar.h"
 #include "prthread.h"
 
+#include <GL/gl.h>
+#ifdef HAVE_GTK2
+# include <gtk/gtk.h>
+#endif
+#ifdef USE_GTKGLEXT
+# include <gdk/gdkx.h>
+# include <gdk/gdkgl.h>
+# include <gtk/gtkgl.h>
+#endif
+#include "gtksup.h"
+
 // Define is you just want a hard coded OpenGL graphic
 //#define TEST_GRAPHIC
 
@@ -101,6 +109,12 @@
 using namespace std;
 using namespace gnash;
 
+#ifdef HAVE_GTKGLEXT
+static void realize (GtkWidget *widget, gpointer data);
+static gboolean configure_event (GtkWidget *widget, GdkEventConfigure *event, 
gpointer data);
+static gboolean expose_event (GtkWidget *widget, GdkEventExpose *event, 
gpointer data);
+static void examine_gl_config_attrib(GdkGLConfig *glconfig);
+#endif
 
 #define OVERSIZE       1.0f
 
@@ -116,7 +130,6 @@
 //static bool  s_event_thread = false;
 static bool    s_start_waiting = false;
 
-//SDL_mutex *Pmutex;
 static void interupt_handler (int);
 
 static void
@@ -136,7 +149,6 @@
     return new tu_file(url, "rb");
 }
 
-
 static void
 fs_callback(gnash::movie_interface* movie, const char* command, const char* 
args)
 // For handling notification callbacks from ActionScript.
@@ -151,16 +163,145 @@
 int
 main_loop(nsPluginInstance *inst)
 {
+
+    // add xt event handler#
+    long event_mask = 
ExposureMask|KeyPress|KeyRelease|ButtonPress|ButtonRelease;
+//    Widget xtwidget;    
+//     xtwidget =  XtWindowToWidget(gxDisplay, inst->getWindow());
+//     XtAddEventHandler(xtwidget, event_mask, FALSE,
+//                   (XtEventHandler) xt_event_handler, inst);
+
+#ifdef USE_GTKGLEXT
+    int argc = 0;
+    char *argv[5];
+    memset(argv, 0, sizeof(char *)*5);
+    argv[0] = new char(20);
+    strcpy(argv[0], "./gnash");
+    argv[1] = new char(20);
+    strcpy(argv[1], "-v");
+    gtk_gl_init(&argc, (char***)argv);
+
+    int major, minor;
+    gdk_gl_query_version (&major, &minor);
+    dbglogfile << "OpenGL extension version - " << major
+              << "." << minor << endl;
+    static const int double_attrib_list[] = {
+       GDK_GL_MODE_DOUBLE,
+       GDK_GL_MODE_DEPTH,
+       GDK_GL_MODE_RGB
+    };
+    static const int single_attrib_list[] = {
+       GDK_GL_MODE_DOUBLE,
+       GDK_GL_MODE_DEPTH,
+       GDK_GL_MODE_RGB
+    };
+
+    GdkGLConfig *gl_config;
+    gl_config = gdk_gl_config_new(double_attrib_list);
+//     if (gl_config == NULL) {
+//     dbglogfile << "Cannot find the double-buffered visual." << endl;
+//     dbglogfile << "Trying single-buffered visual." << endl;
+//     // Try single-buffered visual
+//     gl_config = gdk_gl_config_new(single_attrib_list);
+//     if (gl_config == NULL) {
+//         dbglogfile
+//             << "ERROR: No appropriate OpenGL-capable visual found."
+//             << endl;
+//         exit (1);
+//         } else {
+//         dbglogfile << "Got single buffered visual" << endl;
+//     }
+//     } else {
+//     dbglogfile << "Got double buffered visual" << endl;
+//     }
+
+//     examine_gl_config_attrib (gl_config);
+#endif
+    
+#ifdef HAVE_GTK2
+//  GtkWidget *gtkwidget = gtk_plug_new(inst->getWindow());
+    GtkWidget *gtkwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title (GTK_WINDOW(gtkwidget), "Gnash Player");
+    // This is the right button menu
+    GtkMenu   *popup_menu = GTK_MENU(gtk_menu_new());
+
+    GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
+    gtk_container_add (GTK_CONTAINER (gtkwidget), vbox);
+    gtk_widget_show (vbox); 
+
+#ifdef GTKGLEXT
+    GtkWidget *drawarea = gtk_drawing_area_new();
+    static GdkGLContext *const share_list = NULL;
+    static const gboolean direct = TRUE;
+    static const int render_type = GDK_GL_RGBA_TYPE;
+    gtk_widget_set_gl_capability(drawarea, gl_config, share_list,
+                                direct, render_type);
+     gtk_box_pack_start(GTK_BOX(vbox), drawarea, TRUE, TRUE, 0);
+     gtk_container_add(GTK_CONTAINER(gtkwidget), drawarea);
+#endif
+     
+    gtk_widget_add_events(gtkwidget, GDK_BUTTON_PRESS_MASK);
+//    gtk_widget_add_events(gtkwidget, GDK_BUTTON_RELEASE_MASK);
+    g_signal_connect_swapped(G_OBJECT(gtkwidget),
+                            "button_press_event",
+                            G_CALLBACK(popup_handler),
+                            GTK_OBJECT(popup_menu));
+    
+//     gtk_signal_connect(GTK_OBJECT(gtkwidget), "delete_event",
+//                    GTK_SIGNAL_FUNC(destroy_callback), inst);    
+
+//     g_signal_connect_after (G_OBJECT (drawarea), "realize",
+//                         G_CALLBACK (realize), NULL);
+    
+    gtk_widget_realize(gtkwidget);
+    GtkMenuItem *menuitem_play =
+       GTK_MENU_ITEM(gtk_menu_item_new_with_label("Play Movie"));
+    gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_play));
+    gtk_widget_show(GTK_WIDGET(menuitem_play));    
+    GtkMenuItem *menuitem_pause =
+       GTK_MENU_ITEM(gtk_menu_item_new_with_label("Pause Movie"));
+    gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_pause));
+    gtk_widget_show(GTK_WIDGET(menuitem_pause));
+    GtkMenuItem *menuitem_stop =
+       GTK_MENU_ITEM(gtk_menu_item_new_with_label("Stop Movie"));
+    gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_stop));
+    gtk_widget_show(GTK_WIDGET(menuitem_stop));
+    GtkMenuItem *menuitem_step_forward =
+       GTK_MENU_ITEM(gtk_menu_item_new_with_label("Step Forward Frame"));
+    gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_step_forward));
+    gtk_widget_show(GTK_WIDGET(menuitem_step_forward));
+    GtkMenuItem *menuitem_step_backward =
+       GTK_MENU_ITEM(gtk_menu_item_new_with_label("Step Backward Frame"));
+    gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_step_backward));
+    gtk_widget_show(GTK_WIDGET(menuitem_step_backward));
+    
+    g_signal_connect(GTK_OBJECT(menuitem_play), "activate",
+                    G_CALLBACK(menuitem_play_callback), inst);
+    g_signal_connect(GTK_OBJECT(menuitem_pause), "activate",
+                    G_CALLBACK(menuitem_pause_callback), inst);
+    g_signal_connect(GTK_OBJECT(menuitem_stop), "activate",
+                    G_CALLBACK(menuitem_stop_callback), inst);
+    g_signal_connect(GTK_OBJECT(menuitem_step_forward), "activate",
+                    G_CALLBACK(menuitem_step_forward_callback), inst);
+    g_signal_connect(GTK_OBJECT(menuitem_step_backward), "activate",
+                    G_CALLBACK(menuitem_step_backward_callback), inst);
+#endif
+    
+//    gtk_widget_set_size_request(gtkwidget, inst->getWidth(),
+//                             inst->getHeight());    
+//    gtk_widget_show(gtkwidget);      // gtk_widget_show_all(window)
+// FIXME: We need a logo!   
+//     logo = gdk_pixbuf_new_from_inline(-1, gtk_logo, FALSE, NULL);
+//     image = gtk_image_new_from_pixbuf(logo);
+    
     assert(tu_types_validate());
     float      exit_timeout = 0;
     bool       do_sound = false;
-    int                delay = 31;
+    int                delay = 100;    // was 31
     int                retries = 0;
     float      tex_lod_bias;
     struct sigaction  act;
 
-//    Pmutex = SDL_CreateMutex();
-    
     const char *infile = inst->getFilename();
     
     log_msg("%s: Playing %s\n", __PRETTY_FUNCTION__, infile);
@@ -184,8 +325,9 @@
     gnash::set_verbose_action(true);
     gnash::set_verbose_parse(true);
 #endif
-// Uncomment this if you don't want debug logs stored to disk
-//    dbglogfile.setWriteDisk(false);
+// Uncomment this if you want debug logs stored to disk.
+// This is now the default
+//    dbglogfile.setWriteDisk(true);
     
     gnash::register_file_opener_callback(file_opener);
     gnash::register_fscommand_callback(fs_callback);
@@ -227,6 +369,12 @@
           inst->getHeight());
     log_msg("Calculated width is %d, height is %d\n",
            int(movie_width * s_scale), int(movie_height * s_scale));
+
+    if ((width != inst->getWidth()) && (height != inst->getHeight())) {
+       dbglogfile << "WARNING: Movie size doesn't equal window size" << endl;
+    }
+
+    ogl::open();
     
     // Load the actual movie.
     inst->lockDisplay();
@@ -262,9 +410,8 @@
 //    int      last_logged_fps = last_ticks;
 
     // Trap ^C so we can kill all the threads
-    act.sa_handler = interupt_handler;
-//    act.sa_flags = SA_NOCLDSTOP;
-    sigaction (SIGSEGV, &act, NULL);
+//    act.sa_handler = interupt_handler;
+//    sigaction (SIGINT, &act, NULL);
 
     for (;;) {
        Uint32  ticks;
@@ -286,7 +433,6 @@
        inst->lockDisplay();
        m->set_display_viewport(0, 0, width, height);
        inst->resizeWindow(width,height);
-       inst->freeDisplay();
 
 // //  GLfloat ratio = (GLfloat)width / (GLfloat)height;
 // //  glViewport(0, 0, (GLint)width, (GLint)height);
@@ -294,19 +440,19 @@
 
        m->set_background_alpha(s_background ? 1.0f : 0.05f);
        m->notify_mouse_state(mouse_x, mouse_y, mouse_buttons);    
-        m->advance(delta_t * speed_scale);
-//     if (do_render) {
-//       glDisable(GL_DEPTH_TEST);     // Disable depth testing.
-//       glDrawBuffer(GL_BACK);
-//     }
-       
+       glDisable(GL_DEPTH_TEST);       // Disable depth testing.
+       glDrawBuffer(GL_BACK);
+       inst->freeDisplay();
         
+        m->advance(delta_t * speed_scale);
 #ifdef TEST_GRAPHIC
        dbglogfile << "We made it!!!" << endl;
        inst->drawTestScene();
 #else
        dbglogfile << "Display rendered graphic!!!" << endl;
        inst->lockDisplay();
+//     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+//     glLoadIdentity();
        m->display();
        inst->swapBuffers();
        inst->freeDisplay();
@@ -323,10 +469,11 @@
        }
 #endif
 #else
-       if (retries++ > 5) {
+       if (retries++ > 5vi ~/.en) {
            break;   
        }
 #endif
+       // nsPluginInstance::shut() has been called for this instance.
        NPBool die = inst->getShutdown();
        if (die) {
            dbglogfile << "Shutting down as requested..." << endl;
@@ -450,6 +597,174 @@
     exit(-1);
 }
 
+#ifdef HAVE_GTKGLEXT
+static void
+realize (GtkWidget *widget, gpointer   data)
+{
+    GNASH_REPORT_FUNCTION;
+    GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
+    GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
+    
+    GLUquadricObj *qobj;
+    static GLfloat light_diffuse[] = {1.0, 0.0, 0.0, 1.0};
+    static GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0};
+    
+    // OpenGL BEGIN
+    if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) {
+       return;
+    }
+    
+    qobj = gluNewQuadric ();
+    gluQuadricDrawStyle (qobj, GLU_FILL);
+    glNewList (1, GL_COMPILE);
+    gluSphere (qobj, 1.0, 20, 20);
+    glEndList ();
+    
+    glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse);
+    glLightfv (GL_LIGHT0, GL_POSITION, light_position);
+    glEnable (GL_LIGHTING);
+    glEnable (GL_LIGHT0);
+    glEnable (GL_DEPTH_TEST);
+    
+    glClearColor (1.0, 1.0, 1.0, 1.0);
+    glClearDepth (1.0);
+    
+    glViewport (0, 0,
+               widget->allocation.width, widget->allocation.height);
+    
+    glMatrixMode (GL_PROJECTION);
+    glLoadIdentity ();
+    gluPerspective (40.0, 1.0, 1.0, 10.0);
+    
+    glMatrixMode (GL_MODELVIEW);
+    glLoadIdentity ();
+    gluLookAt (0.0, 0.0, 3.0,
+              0.0, 0.0, 0.0,
+              0.0, 1.0, 0.0);
+    glTranslatef (0.0, 0.0, -3.0);
+    gdk_gl_drawable_gl_end (gldrawable);
+    // OpenGL END
+}
+
+static gboolean
+configure_event (GtkWidget         *widget,
+                 GdkEventConfigure *event,
+                 gpointer           data)
+{
+    GNASH_REPORT_FUNCTION;
+
+    GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
+    GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
+    
+    // OpenGL BEGIN
+    if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) {
+       return FALSE;
+    }
+    glViewport (0, 0,
+               widget->allocation.width, widget->allocation.height);
+    
+    gdk_gl_drawable_gl_end (gldrawable);
+    // OpenGL END
+    
+    return TRUE;
+}
+
+static gboolean
+expose_event (GtkWidget      *widget,
+              GdkEventExpose *event,
+              gpointer        data)
+{
+    GNASH_REPORT_FUNCTION;
+
+    GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
+    GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
+    
+    // OpenGL BEGIN
+    if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
+       return FALSE;
+    
+    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    
+    glCallList (1);
+    
+    if (gdk_gl_drawable_is_double_buffered (gldrawable)) {
+       gdk_gl_drawable_swap_buffers (gldrawable);
+    } else {
+       glFlush ();
+    }
+    
+    gdk_gl_drawable_gl_end (gldrawable);
+    // OpenGL END
+    
+    return TRUE;
+}
+
+static void
+print_gl_config_attrib (GdkGLConfig *glconfig,
+                        const gchar *attrib_str,
+                        int          attrib,
+                        gboolean     is_boolean)
+{
+  int value;
+
+  g_print ("%s = ", attrib_str);
+  if (gdk_gl_config_get_attrib (glconfig, attrib, &value))
+    {
+      if (is_boolean)
+        g_print ("%s\n", value == TRUE ? "TRUE" : "FALSE");
+      else
+        g_print ("%d\n", value);
+    }
+  else
+    g_print ("*** Cannot get %s attribute value\n", attrib_str);
+}
+
+static void
+examine_gl_config_attrib (GdkGLConfig *glconfig)
+{
+    g_print ("\nOpenGL visual configurations :\n\n");
+    
+    g_print ("gdk_gl_config_is_rgba (glconfig) = %s\n",
+           gdk_gl_config_is_rgba (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_is_double_buffered (glconfig) = %s\n",
+            gdk_gl_config_is_double_buffered (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_is_stereo (glconfig) = %s\n",
+            gdk_gl_config_is_stereo (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_has_alpha (glconfig) = %s\n",
+            gdk_gl_config_has_alpha (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_has_depth_buffer (glconfig) = %s\n",
+            gdk_gl_config_has_depth_buffer (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_has_stencil_buffer (glconfig) = %s\n",
+            gdk_gl_config_has_stencil_buffer (glconfig) ? "TRUE" : "FALSE");
+    g_print ("gdk_gl_config_has_accum_buffer (glconfig) = %s\n",
+            gdk_gl_config_has_accum_buffer (glconfig) ? "TRUE" : "FALSE");
+    
+    g_print ("\n");
+    
+    print_gl_config_attrib (glconfig, "GDK_GL_USE_GL", GDK_GL_USE_GL, TRUE);
+    print_gl_config_attrib (glconfig, "GDK_GL_USE_GL", GDK_GL_USE_GL, TRUE);
+    print_gl_config_attrib (glconfig, "GDK_GL_BUFFER_SIZE",      
GDK_GL_BUFFER_SIZE,      FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_LEVEL",            GDK_GL_LEVEL, 
           FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_RGBA",             GDK_GL_RGBA,  
           TRUE);
+    print_gl_config_attrib (glconfig, "GDK_GL_DOUBLEBUFFER",     
GDK_GL_DOUBLEBUFFER,     TRUE);
+    print_gl_config_attrib (glconfig, "GDK_GL_STEREO",           
GDK_GL_STEREO,           TRUE);
+    print_gl_config_attrib (glconfig, "GDK_GL_AUX_BUFFERS",      
GDK_GL_AUX_BUFFERS,      FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_RED_SIZE",         
GDK_GL_RED_SIZE,         FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_GREEN_SIZE",       
GDK_GL_GREEN_SIZE,       FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_BLUE_SIZE",        
GDK_GL_BLUE_SIZE,        FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_BLUE_SIZE",        
GDK_GL_BLUE_SIZE,        FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_ALPHA_SIZE",       
GDK_GL_ALPHA_SIZE,       FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_DEPTH_SIZE",       
GDK_GL_DEPTH_SIZE,       FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_STENCIL_SIZE",     
GDK_GL_STENCIL_SIZE,     FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_RED_SIZE",   
GDK_GL_ACCUM_RED_SIZE,   FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_GREEN_SIZE", 
GDK_GL_ACCUM_GREEN_SIZE, FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_BLUE_SIZE",  
GDK_GL_ACCUM_BLUE_SIZE,  FALSE);
+    print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_ALPHA_SIZE", 
GDK_GL_ACCUM_ALPHA_SIZE, FALSE);
+    
+    g_print ("\n");
+}
+#endif
+
 // Local Variables:
 // mode: C++
 // indent-tabs-mode: t
Index: gnash/plugin/plugin.cpp
diff -u gnash/plugin/plugin.cpp:1.20 gnash/plugin/plugin.cpp:1.21
--- gnash/plugin/plugin.cpp:1.20        Wed Mar 22 04:52:42 2006
+++ gnash/plugin/plugin.cpp     Thu Mar 30 01:52:00 2006
@@ -52,13 +52,14 @@
 #include <GL/gl.h>
 #include <GL/glu.h>
 //#include <X11/extensions/xf86vmode.h>
-#ifdef HAVE_GTK_GTKGL_H
-#include <gtk/gtkgl.h>
-#endif
-#ifdef USE_GTK_PLUG
+#ifdef HAVE_GTK2
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #endif
+#ifdef USE_GTKGLEXT
+#include <gtk/gtkgl.h>
+#include <gdk/gdkx.h>
+#endif
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -105,7 +106,7 @@
 //SDL_mutex   *nsPluginInstance::_playerMutex = NULL;
 //PRLock      *nsPluginInstance::_prlock = NULL;
 
-#ifdef USE_GTK_PLUG
+#ifdef USE_GTK2
 GtkWidget   *gtkplug = NULL;
 GtkMenu     *popup_menu = NULL;
 GtkMenuItem *menuitem_play = NULL;
@@ -117,11 +118,15 @@
 // static bool  s_verbose = false;
 // static int   doneYet = 0;
 static bool  waitforgdb = false;
+int start_proc(string procname, string filespec, Window win);
 
 const int INBUFSIZE = 1024;
 // static void xt_event_handler(Widget xtwidget, nsPluginInstance *plugin,
 //              XEvent *xevent, Boolean *b);
 
+
+#define USE_FORK 1
+
 #if 0
 static int attributeList_noFSAA[] = { GLX_RGBA, GLX_DOUBLEBUFFER, 
GLX_STENCIL_SIZE, 1, None };
 #else
@@ -137,91 +142,6 @@
                                // want to make sure it all works.
 #endif // HAVE_LIBXML
 
-#ifdef USE_GTK_PLUG
-// destroy a GtkWidget. This is only used if using an external window
-// was used to render the movie in.
-gboolean
-destroy_callback(GtkWidget * widget, GdkEvent * event,
-              nsPluginInstance * instance)
-{
-    gtk_widget_destroy(widget);
-}
-
-gboolean
-fixme_callback(GtkWidget * widget, GdkEvent * event,
-              nsPluginInstance * instance)
-{
-    GNASH_REPORT_FUNCTION;
-
-    dbglogfile << "Got a Callback! " << event->type << endl;
-    
-    switch (event->type) {
-      case GDK_DESTROY:
-         dbglogfile << "Got a DESTROY event" << endl;
-         break;
-      case GDK_EXPOSE:
-//       dbglogfile << "Got an EXPOSE event" << endl;
-           break;
-      case GDK_KEY_PRESS:
-         dbglogfile << "Got a KEY PRESS event" << endl;
-         break;
-      case GDK_KEY_RELEASE:
-         dbglogfile << "Got a KEY RELEASE event" << endl;          
-         break;
-      case GDK_MAP:
-//       dbglogfile << "Got a MAP event" << endl;
-         break;
-      case GDK_FOCUS_CHANGE:
-//       dbglogfile << "Got a FOCUS CHANGE event" << endl;
-         break;
-      case GDK_BUTTON_PRESS:
-         dbglogfile << "Got a BUTTON PRESS event" << endl;
-         break;
-      case GDK_ENTER_NOTIFY:
-//       dbglogfile << "Got a ENTER event" << endl;
-         break;
-      case GDK_LEAVE_NOTIFY:
-//       dbglogfile << "Got a LEAVE event" << endl;
-         break;
-      case GDK_NOTHING:
-      case GDK_DELETE:
-      case GDK_MOTION_NOTIFY:
-      case GDK_2BUTTON_PRESS:
-      case GDK_3BUTTON_PRESS:
-      case GDK_BUTTON_RELEASE:
-      case GDK_CONFIGURE:
-      case GDK_UNMAP:
-      case GDK_PROPERTY_NOTIFY:
-      case GDK_SELECTION_CLEAR:
-      case GDK_SELECTION_NOTIFY:
-      case GDK_SELECTION_REQUEST:        
-      case GDK_PROXIMITY_IN:
-      case GDK_PROXIMITY_OUT:
-      case GDK_DRAG_ENTER:
-      case GDK_DRAG_LEAVE:
-      case GDK_DRAG_MOTION:
-      case GDK_DRAG_STATUS:
-      case GDK_DROP_START:
-      case GDK_DROP_FINISHED:
-      case GDK_CLIENT_EVENT:
-      case GDK_VISIBILITY_NOTIFY:
-      case GDK_NO_EXPOSE:
-      case GDK_SCROLL:
-      case GDK_WINDOW_STATE:
-      case GDK_SETTING:
-      case GDK_OWNER_CHANGE:
-      case GDK_GRAB_BROKEN:
-         break;
-    }
-    
-    
-//     gtk_widget_hide(GTK_WIDGET(instance->gtkwidget));
-//     instance->Quit();
-    return TRUE;
-}
-
-#endif
-
 void
 PR_CALLBACK Destructor(void *data)
 {
@@ -259,7 +179,7 @@
     GNASH_REPORT_FUNCTION;
 
     NPError err = NPERR_NO_ERROR;
-    PRBool supportsXEmbed = PR_FALSE;
+    PRBool supportsXEmbed = PR_TRUE;
     NPNToolkitType toolkit;
 
     // This mutex is to lock the display before doing any OpenGL or
@@ -270,7 +190,6 @@
     } else {
        dbglogfile << "ERROR: Couldn't allocate new GL Mutex!" << endl;
     }
-    
 
     // This mutex is only used with the condition variable.
     playerMutex = PR_NewLock();
@@ -288,7 +207,7 @@
     } else {
        dbglogfile << "ERROR: Couldn't allocate new Condition Variable!" << 
endl;
     }
-
+    
     // Open a connection to the X11 server so we can lock the Display
     // when swapping GLX contexts.
     gxDisplay = XOpenDisplay(NULL);
@@ -298,7 +217,7 @@
        dbglogfile << "ERROR: Couldn't open a connection to the X11 server!" << 
endl;
     }
     
-    dbglogfile.setVerbosity(1);
+    dbglogfile.setVerbosity(2);
 
     // Make sure that the browser supports functionality we need
     err = CallNPN_GetValueProc(NPNFuncs.getvalue, NULL,
@@ -408,10 +327,12 @@
           *((char **)aValue) = tmp;
           break;
       case NPPVpluginNeedsXEmbed:
-#ifdef USE_GTK_PLUG
-//       *((PRBool *)aValue) = PR_TRUE;
-         break;
+#ifdef HAVE_GTK2
+         *((PRBool *)aValue) = PR_TRUE;
+#else
+         *((PRBool *)aValue) = PR_FALSE;
 #endif
+         break;
       case NPPVpluginTimerInterval:
       case NPPVpluginKeepLibraryInMemory:
       default:
@@ -468,8 +389,7 @@
                                                    _glxContext(NULL),
                                                    _shutdown(FALSE),
                                                    _glInitialized(FALSE),
-                                                   _thread(NULL),
-                                                   _newwin(FALSE)
+                                                   _thread(NULL)
 {
     GNASH_REPORT_FUNCTION;
 }
@@ -524,7 +444,7 @@
 
     if (_thread) {
        dbglogfile << "Waiting for the thread to terminate..." << endl;
-       PRStatus rv = PR_SetThreadPrivate(_thread_key, (void *)"stop");
+//     PRStatus rv = PR_SetThreadPrivate(_thread_key, (void *)"stop");
        _shutdown = TRUE;
 //     PR_Interrupt(_thread);
 //     if (PR_PENDING_INTERRUPT_ERROR == PR_GetError()) {
@@ -563,7 +483,10 @@
 //     if (_glInitialized) {
 //     log_msg("%s Already initialized...", __FUNCTION__);
 //     return TRUE;
-//     }    
+//     }
+//    GdkNativeWindow window;
+//    this->window = GdkNativeWindow(ptrdiff_t(window.window));
+
     
     if (aWindow->x == mX && aWindow->y == mY
        && aWindow->width == mWidth
@@ -598,7 +521,7 @@
                 dbglogfile << "ERROR: Cannot open 9X15 font!" << endl;
            }
         }
-       
+#if 1
        XVisualInfo *vi = glXChooseVisual(gxDisplay, DefaultScreen(gxDisplay),
                                          attributeList_FSAA);
        if (vi == NULL) {
@@ -607,7 +530,16 @@
        } else {
            vi->visual = mVisual;
        }
-       
+#else
+       XWindowAttributes a;
+       XVisualInfo vi_in;
+       int out_count;
+       XGetWindowAttributes(gxDisplay, _window, &a);
+       vi_in.visualid = XVisualIDFromVisual(a.visual);
+       XVisualInfo *vi = XGetVisualInfo(gxDisplay,
+                                        VisualScreenMask|VisualIDMask,
+                                        &vi_in, &out_count);
+#endif
        _glxContext = glXCreateContext(gxDisplay, vi, 0, GL_TRUE);
        if (_glxContext) {
            dbglogfile << __FUNCTION__ << ": Got new glxContext "
@@ -620,7 +552,8 @@
        }
 
         // add xt event handler#
-        long event_mask = 
ExposureMask|KeyPress|KeyRelease|ButtonPress|ButtonRelease;        Widget 
xtwidget;
+//         long event_mask = 
ExposureMask|KeyPress|KeyRelease|ButtonPress|ButtonRelease
+//         Widget xtwidget;
        
 //         xtwidget =  XtWindowToWidget((Display *) gxdisplay,
 //                                      (Window) aWindow->window);
@@ -628,49 +561,6 @@
 //                           (XtEventHandler) xt_event_handler, this);
     }
 
-
-#ifdef USE_GTK_PLUG_XXXXXXX
-    gtkplug = gtk_plug_new(_window);
-//     if (_newwin) {
-//     _gtkwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-//     } else {
-//     _gtkwidget = gtk_window_new(GTK_WINDOW_POPUP);
-//     }
-    gtk_window_set_title(GTK_WINDOW(gtkplug), "Gnash player");
-    
-    gtk_widget_add_events(gtkplug, GDK_BUTTON_PRESS_MASK);
-    gtk_widget_add_events(gtkplug, GDK_BUTTON_RELEASE_MASK);
-    g_signal_connect(GTK_OBJECT(gtkplug), "button_press_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-    
-    gtk_signal_connect(GTK_OBJECT(gtkplug), "delete_event",
-                      GTK_SIGNAL_FUNC(destroy_callback), this);
-    
-    g_signal_connect(GTK_OBJECT(gtkplug), "expose_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-    
-    g_signal_connect(GTK_OBJECT(gtkplug), "key_press_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-    
-    g_signal_connect(GTK_OBJECT(gtkplug), "focus_in_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-    
-    g_signal_connect(GTK_OBJECT(gtkplug), "focus_out_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-    
-    g_signal_connect(GTK_OBJECT(gtkplug), "map_event",
-                    GTK_SIGNAL_FUNC(fixme_callback), this);
-
-//    gtk_widget_realize(gtkplug);
-//     popup_menu = GTK_MENU(gtk_menu_new());
-//     menuitem_play =
-//     GTK_MENU_ITEM(gtk_menu_item_new_with_label("Play"));
-//     gtk_menu_append(popup_menu, GTK_WIDGET(menuitem_play));
-//     gtk_widget_show(GTK_WIDGET(menuitem_play));
-    
-    gtk_widget_show(gtkplug);
-//    gtk_widget_set_usize(_gtkwidget,mWidth, mHeight);    
-#endif
     resizeWindow(mWidth,mHeight);
 
     unsetGL();
@@ -680,6 +570,17 @@
     return NPERR_NO_ERROR;
 }
 
+// void NPN_Version(int * plugin_major,
+//                  int * plugin_minor,
+//                  int * mozilla_major,
+//                  int * mozilla_minor)
+// {
+//     *plugin_major = NP_VERSION_MAJOR;
+//     *plugin_minor = NP_VERSION_MINOR;
+//     *mozilla_major = mozillaFuncs.version >> 8;
+//     *mozilla_minor = mozillaFuncs.version & 0xff;
+// }
+
 const char *
 nsPluginInstance::getVersion()
 {
@@ -790,7 +691,7 @@
        } else {
            _options[name] = value;
        }
-       if (opts[end] == '&') {
+       if ((opts.size() > end) && (opts[end] == '&')) {
                end++;
        }
        opts.erase(start, end);
@@ -855,11 +756,6 @@
     log_msg("%s: Starting player Thread for this = %p",
           __PRETTY_FUNCTION__, (void *)this);
 
-
-//     PRStatus rv;
-//     rv = PR_NewThreadPrivateIndex(&_thread_key, Destructor);
-//     rv = PR_SetThreadPrivate(_thread_key, (void *)"run");
-
     // PR_USER_THREAD -        PR_Cleanup blocks until the last thread of
     //                 type PR_USER_THREAD terminates.
     // PR_SYSTEM_THREAD - NSPR ignores threads of type
@@ -870,13 +766,21 @@
     // within the process.
     // PR_GLOBAL_THREAD - A global thread, scheduled by the host OS.
     // PR_GLOBAL_BOUND_THREAD -        A global bound (kernel) thread,
-    // scheduled by the host OS 
+    // scheduled by the host OS
+#ifndef USE_FORK
     _thread = PR_CreateThread(PR_USER_THREAD, playerThread, this,
                              PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                              PR_JOINABLE_THREAD, 0);
-    
-//     PR_Lock(playerMutex);
-//     PR_NotifyCondVar(playerCond);
+#else
+#ifdef HAVE_GTK2
+    Window window = GdkNativeWindow(ptrdiff_t(_window));
+#else
+    Window window = _window;
+#endif
+    string procname = "/usr/local/bin/gnash";
+    start_proc(procname, swf_file, window);
+    sleep(1);
+#endif
 
     sprintf(tmp, "Started thread for Flash movie %s", swf_file.c_str());
     WriteStatus(tmp);
@@ -974,9 +878,9 @@
     if (gxDisplay && _glxContext) {
        // Grab control of the display
 //     lockDisplay();
-       lockGL();
-       lockX();
-       setGL();
+//     lockGL();
+       lockX();
+//     setGL();
        
        dbglogfile << __FUNCTION__ << ": Destroying GLX Context "
                   << (void *)_glxContext << endl;
@@ -985,9 +889,9 @@
 
 //     freeDisplay();
        // Release control of the display
-       unsetGL();
-       freeX();
-       freeGL();
+//     unsetGL();
+       freeX();
+//     freeGL();
     }
     _glInitialized = FALSE;
 }
@@ -1090,102 +994,65 @@
 //    SDL_mutexP(mutant);
 }
 
-#if 0
-/// \brief Handle X events
-///
-/// This C function handles events from X, like keyboard events, or
-/// Expose events that we're interested in.
-static void
-xt_event_handler(Widget xtwidget, nsPluginInstance *plugin,
-                XEvent *xevent, Boolean *b)
+// Run the memory tests between two processes
+int
+start_proc(string procname, string filespec, Window win)
 {
     GNASH_REPORT_FUNCTION;
-
-    int        keycode;
-    KeySym     keysym;
-#if 0
-    SDL_Event  sdl_event;
-    SDL_keysym sdl_keysym;
-
-    //    handleKeyPress((SDL_keysym)keysym);
-    log_msg("Peep Event returned %d", SDL_PeepEvents(&sdl_event, 1, 
SDL_PEEKEVENT, 
SDL_USEREVENT|SDL_ACTIVEEVENT|SDL_KEYDOWN|SDL_KEYUP|SDL_MOUSEBUTTONUP|SDL_MOUSEBUTTONDOWN));
-  
-    if (SDL_PollEvent(&sdl_event)) {
-        switch(sdl_event.type) {
-          case SDL_ACTIVEEVENT:
-          case SDL_VIDEORESIZE:
-          case SDL_KEYDOWN:
-              /* handle key presses */
-              handleKeyPress( &sdl_event.key.keysym );
-              break;
-          default:
-              break;
-      
-        }
+    
+    struct stat procstats;
+    char *cmd_line[5];
+    pid_t childpid;
+    int ret = 0;
+    
+    // See if the file actually exists, otherwise we can't spawn it
+    if (stat(procname.c_str(), &procstats) == -1) {
+        cerr << "Invalid filename \"" << procname << "\"" <<endl;
+        perror(procname.c_str());
+        return -1;
+    }
+    
+    // setup a command line. By default, argv[0] is the name of the process
+    memset(cmd_line, 0, sizeof(char *)*5);
+    cmd_line[0] = new char(procname.size()+1);
+    strcpy(cmd_line[0], procname.c_str());
+    cmd_line[1] = new char(50);
+    sprintf(cmd_line[1], "-x %d", (int)win);
+    cmd_line[2] = new char(50);
+    sprintf(cmd_line[2], "-v");
+    cmd_line[3] = new char(filespec.size()+1);
+    sprintf(cmd_line[3], "%s", filespec.c_str());
+    // This option tells the child process to wait for GDB to connect.
+    if (waitforgdb) {
+        cmd_line[4] = new char(4);
+        strcpy(cmd_line[4], "-s");
     }
-#endif
-  
-    switch (xevent->type) {
-      case Expose:
-          // get rid of all other exposure events
-          if (plugin) {
-//           if (_glInitialized) {
-//               plugin->setGL();
-// #ifdef TEST_GRAPHIC
-//               plugin->drawTestScene();
-//               plugin->swapBuffers();
-//               plugin->freeX();
-// #else
-//               gnash::movie_interface *m = gnash::get_current_root();
-//               if (m != NULL) {
-//                   m->display();
-//               }
-// #endif
-//               log_msg("Drawing GL Scene for expose event!");
-//           } else {
-                 log_msg("GL Surface not initialized yet, ignoring expose 
event!");
-//           }
-          }
-          break;
-      case ButtonPress:
-//     fe.type = FeButtonPress;
-          log_msg("Button Press");
-          break;
-      case ButtonRelease:
-          //     fe.type = FeButtonRelease;
-          log_msg("Button Release");
-          break;
-      case KeyPress:
-          keycode = xevent->xkey.keycode;
-               plugin->lockX();
-          keysym = XLookupKeysym((XKeyEvent*)xevent, 0);
-          log_msg ("%s(%d): Keysym is %s", __PRETTY_FUNCTION__, __LINE__,
-                  XKeysymToString(keysym));
-               plugin->freeX();
-
-          switch (keysym) {
-            case XK_Up:
-                log_msg("Key Up");
-                break;
-            case XK_Down:
-                log_msg("Key Down");
-                break;
-            case XK_Left:
-                log_msg("Key Left");
-                break;
-            case XK_Right:
-                log_msg("Key Right");
-                break;
-            case XK_Return:
-                log_msg("Key Return");
-                break;
-      
-            default:
-                break;
-          }
+    // fork ourselves silly
+    childpid = fork();
+    
+    // childpid is a positive integer, if we are the parent, and fork() worked
+    if (childpid > 0) {
+        cerr << "Forked sucessfully, child process PID is " << childpid << 
endl;
+        return childpid;
+    }
+    
+    // childpid is -1, if the fork failed, so print out an error message
+    if (childpid == -1) {
+        perror(procname.c_str());
+        return -1;
+    }
+    
+    // If we are the child, exec the new process, then go away
+    if (childpid == 0) {
+        // Start the desired executable
+        cout << "Starting " << procname << " with -x " << win << " "
+            << filespec << endl;
+        ret = execv(procname.c_str(), cmd_line);
+        perror(procname.c_str());
+        exit(0);
     }
+    return 0;
 }
-#endif
 
 // Local Variables:
 // mode: C++
Index: gnash/plugin/plugin.h
diff -u gnash/plugin/plugin.h:1.9 gnash/plugin/plugin.h:1.10
--- gnash/plugin/plugin.h:1.9   Sat Mar 18 23:39:34 2006
+++ gnash/plugin/plugin.h       Thu Mar 30 01:52:00 2006
@@ -48,15 +48,12 @@
 #include <X11/Intrinsic.h>
 #include <X11/cursorfont.h>
 #include <GL/glx.h>
-#ifdef USE_GTK_PLUG
+#ifdef HAVE_GTK2
 #include <gtk/gtk.h>
 #endif
 #include <string>
 #include <map>
 #include "pluginbase.h"
-//#include <SDL.h>
-//#include <SDL_thread.h>
-
 #include "log.h"
 #include "prlock.h"
 #include "prcvar.h"
@@ -95,7 +92,12 @@
     int32 Write(NPStream *stream, int32 offset, int32 len, void *buffer);
     NPError WriteStatus(char *msg) const;
     void shut();
-
+#ifdef HAVE_GTK2
+    GtkWidget *getWidget() { return _gtkwidget; };
+    void setWidget(GtkWidget *win) { _gtkwidget = win; };
+#endif
+    
+    
     // accessors
     const char  *getVersion();
     Window      getWindow()     { return _window; };
@@ -114,6 +116,7 @@
                          (void *)_glxContext, this);
         if (gxDisplay && _glxContext && _window) {
             glXMakeCurrent(gxDisplay, _window, _glxContext);
+            XSync(gxDisplay, False);
         }
     }
     inline void unsetGL() {
@@ -211,8 +214,8 @@
     PRThread            *_thread;
     PRUintn             _thread_key;
 
-#ifdef USE_GTK_PLUG
-    NPBool              _newwin;
+#ifdef HAVE_GTK2
+//    NPBool              _newwin;
     GtkWidget           *_gtkwidget;
     unsigned long       _delete_signal_id;
 #endif
Index: gnash/server/Object.h
diff -u gnash/server/Object.h:1.5 gnash/server/Object.h:1.6
--- gnash/server/Object.h:1.5   Thu Mar  9 19:29:06 2006
+++ gnash/server/Object.h       Thu Mar 30 01:52:00 2006
@@ -341,7 +341,7 @@
        bool m_is_protected;
 
        /// mask for flags
-       const static int as_prop_flags_mask = 0x7;
+       static const int as_prop_flags_mask = 0x7;
 
        /// Default constructor
        as_prop_flags() : m_flags(0), m_is_protected(false)
Index: gnash/utilities/Makefile.am
diff -u gnash/utilities/Makefile.am:1.14 gnash/utilities/Makefile.am:1.15
--- gnash/utilities/Makefile.am:1.14    Wed Mar 29 05:42:42 2006
+++ gnash/utilities/Makefile.am Thu Mar 30 01:52:00 2006
@@ -25,7 +25,7 @@
 MP3_LIBS = $(MAD_LIBS)
 endif
 
-AM_CPPFLAGS = -Wall
+AM_CPPFLAGS = # -Wall
 AM_LDFLAGS = \
        ../backend/libgnashbackend.la \
        ../server/libgnashserver.la \




reply via email to

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