From 0ed80ea60e1dfc9e1faa6090c97af0fb8fb8d1f7 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Thu, 29 Apr 2010 22:43:15 +1200 Subject: [PATCH] b=561308,539138 Realize GtkPlugs when associated with a socket for consistency with in-process behavior r=cjones --HG-- extra : rebase_source : 96d433c381d6d560ddd566572cfc143d91113453 --- dom/plugins/PluginInstanceChild.cpp | 8 +++++--- dom/plugins/PluginModuleChild.cpp | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index bfea9507a03b..49ac0beac302 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -799,9 +799,11 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) &mWsInfo.visual, &mWsInfo.depth)) return false; - if (aWindow.type == NPWindowTypeWindow) { #ifdef MOZ_WIDGET_GTK2 - if (GdkWindow* socket_window = gdk_window_lookup(aWindow.window)) { + if (aWindow.type == NPWindowTypeWindow + && gtk_check_version(2,18,7) != NULL) { // older + GdkWindow* socket_window = gdk_window_lookup(aWindow.window); + if (socket_window) { // A GdkWindow for the socket already exists. Need to // workaround https://bugzilla.gnome.org/show_bug.cgi?id=607061 // See wrap_gtk_plug_embedded in PluginModuleChild.cpp. @@ -809,8 +811,8 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) "moz-existed-before-set-window", GUINT_TO_POINTER(1)); } -#endif } +#endif if (mPluginIface->setwindow) (void) mPluginIface->setwindow(&mData, &mWindow); diff --git a/dom/plugins/PluginModuleChild.cpp b/dom/plugins/PluginModuleChild.cpp index 9482dcaba78c..d86dc5aab9ea 100644 --- a/dom/plugins/PluginModuleChild.cpp +++ b/dom/plugins/PluginModuleChild.cpp @@ -318,12 +318,18 @@ gtk_plug_scroll_event(GtkWidget *widget, GdkEventScroll *gdk_event) static void wrap_gtk_plug_embedded(GtkPlug* plug) { GdkWindow* socket_window = plug->socket_window; - if (socket_window && - g_object_get_data(G_OBJECT(socket_window), - "moz-existed-before-set-window")) { - // Add missing reference for - // https://bugzilla.gnome.org/show_bug.cgi?id=607061 - g_object_ref(socket_window); + if (socket_window) { + if (gtk_check_version(2,18,7) != NULL // older + && g_object_get_data(G_OBJECT(socket_window), + "moz-existed-before-set-window")) { + // Add missing reference for + // https://bugzilla.gnome.org/show_bug.cgi?id=607061 + g_object_ref(socket_window); + } + + // Ensure the window exists to make this GtkPlug behave like an + // in-process GtkPlug for Flash Player. (Bugs 561308 and 539138). + gtk_widget_realize(GTK_WIDGET(plug)); } if (*real_gtk_plug_embedded) { @@ -448,11 +454,9 @@ PluginModuleChild::InitGraphics() *scroll_event = gtk_plug_scroll_event; } - if (gtk_check_version(2,18,7) != NULL) { // older - GtkPlugEmbeddedFn* embedded = >K_PLUG_CLASS(gtk_plug_class)->embedded; - real_gtk_plug_embedded = *embedded; - *embedded = wrap_gtk_plug_embedded; - } + GtkPlugEmbeddedFn* embedded = >K_PLUG_CLASS(gtk_plug_class)->embedded; + real_gtk_plug_embedded = *embedded; + *embedded = wrap_gtk_plug_embedded; #elif defined(MOZ_WIDGET_QT) nsQAppInstance::AddRef();