diff --git a/mozilla/modules/plugin/samples/simple/Makefile.in b/mozilla/modules/plugin/samples/simple/Makefile.in index cb231110a5d..69dcb543f38 100644 --- a/mozilla/modules/plugin/samples/simple/Makefile.in +++ b/mozilla/modules/plugin/samples/simple/Makefile.in @@ -34,6 +34,8 @@ CPPSRCS = npsimple.cpp LOCAL_INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../public +EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lgtksuperwin $(TK_LIBS) + include $(topsrcdir)/config/rules.mk CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS) diff --git a/mozilla/modules/plugin/samples/simple/npsimple.cpp b/mozilla/modules/plugin/samples/simple/npsimple.cpp index 3357da8e1fe..d56bf683bfa 100644 --- a/mozilla/modules/plugin/samples/simple/npsimple.cpp +++ b/mozilla/modules/plugin/samples/simple/npsimple.cpp @@ -48,6 +48,8 @@ #include #include #include +#include +#include /*------------------------------------------------------------------------------ * Windows Includes @@ -97,11 +99,12 @@ typedef struct _PlatformInstance #ifdef XP_UNIX typedef struct _PlatformInstance { - Window window; - GtkWidget *widget; - Display * display; - uint32 x, y; - uint32 width, height; + Window window; + GtkWidget *moz_box; + GdkSuperWin *superwin; + Display * display; + uint32 x, y; + uint32 width, height; } PlatformInstance; #endif /* XP_UNIX */ @@ -1057,7 +1060,8 @@ SimplePluginInstance::PlatformNew(void) nsresult SimplePluginInstance::PlatformDestroy(void) { - gtk_widget_destroy(fPlatform.widget); + gtk_widget_destroy(fPlatform.moz_box); + fPlatform.moz_box = 0; return NS_OK; } @@ -1070,17 +1074,22 @@ SimplePluginInstance::PlatformDestroy(void) nsresult SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window) { +#ifdef NS_DEBUG + printf("SimplePluginInstance::PlatformSetWindow\n"); +#endif if (window == NULL || window->window == NULL) return NS_ERROR_NULL_POINTER; - fPlatform.widget = (GtkWidget *)window->window; + fPlatform.superwin = (GdkSuperWin *)window->window; + fPlatform.moz_box = gtk_mozbox_new(fPlatform.superwin->bin_window); + GtkWidget *button; button = gtk_button_new_with_label("Hello World"); - gtk_layout_put(GTK_LAYOUT(fPlatform.widget), button, 0, 0); + gtk_container_add(GTK_CONTAINER(fPlatform.moz_box), button); gtk_widget_show(button); - gtk_widget_show(fPlatform.widget); + gtk_widget_show(fPlatform.moz_box); return NS_OK; } diff --git a/mozilla/modules/plugin/test/Makefile.in b/mozilla/modules/plugin/test/Makefile.in index cb231110a5d..69dcb543f38 100644 --- a/mozilla/modules/plugin/test/Makefile.in +++ b/mozilla/modules/plugin/test/Makefile.in @@ -34,6 +34,8 @@ CPPSRCS = npsimple.cpp LOCAL_INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../public +EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lgtksuperwin $(TK_LIBS) + include $(topsrcdir)/config/rules.mk CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS) diff --git a/mozilla/modules/plugin/test/npsimple.cpp b/mozilla/modules/plugin/test/npsimple.cpp index 3357da8e1fe..d56bf683bfa 100644 --- a/mozilla/modules/plugin/test/npsimple.cpp +++ b/mozilla/modules/plugin/test/npsimple.cpp @@ -48,6 +48,8 @@ #include #include #include +#include +#include /*------------------------------------------------------------------------------ * Windows Includes @@ -97,11 +99,12 @@ typedef struct _PlatformInstance #ifdef XP_UNIX typedef struct _PlatformInstance { - Window window; - GtkWidget *widget; - Display * display; - uint32 x, y; - uint32 width, height; + Window window; + GtkWidget *moz_box; + GdkSuperWin *superwin; + Display * display; + uint32 x, y; + uint32 width, height; } PlatformInstance; #endif /* XP_UNIX */ @@ -1057,7 +1060,8 @@ SimplePluginInstance::PlatformNew(void) nsresult SimplePluginInstance::PlatformDestroy(void) { - gtk_widget_destroy(fPlatform.widget); + gtk_widget_destroy(fPlatform.moz_box); + fPlatform.moz_box = 0; return NS_OK; } @@ -1070,17 +1074,22 @@ SimplePluginInstance::PlatformDestroy(void) nsresult SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window) { +#ifdef NS_DEBUG + printf("SimplePluginInstance::PlatformSetWindow\n"); +#endif if (window == NULL || window->window == NULL) return NS_ERROR_NULL_POINTER; - fPlatform.widget = (GtkWidget *)window->window; + fPlatform.superwin = (GdkSuperWin *)window->window; + fPlatform.moz_box = gtk_mozbox_new(fPlatform.superwin->bin_window); + GtkWidget *button; button = gtk_button_new_with_label("Hello World"); - gtk_layout_put(GTK_LAYOUT(fPlatform.widget), button, 0, 0); + gtk_container_add(GTK_CONTAINER(fPlatform.moz_box), button); gtk_widget_show(button); - gtk_widget_show(fPlatform.widget); + gtk_widget_show(fPlatform.moz_box); return NS_OK; }