From ad452e359d379fe8ee6b16a5a4648ff69a7fafe2 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Fri, 13 Oct 2000 01:10:21 +0000 Subject: [PATCH] fix for bug 45162 new plugins shouldn't use GdkSuperWin's, but instead should use XIDs. sr=blizzard r=valeski git-svn-id: svn://10.0.0.236/trunk@81092 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/ns4xPluginInstance.cpp | 15 +++++++-------- .../modules/plugin/nglsrc/ns4xPluginInstance.cpp | 15 +++++++-------- .../modules/plugin/samples/simple/npsimple.cpp | 9 +++++++-- mozilla/modules/plugin/test/npsimple.cpp | 9 +++++++-- mozilla/widget/src/gtk/nsWindow.cpp | 2 +- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index 35fef5aadb8..abdd9c18708 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -29,9 +29,9 @@ #include "nscore.h" #if defined(MOZ_WIDGET_GTK) +#include +#include #include "gtkxtbin.h" -#include "gdksuperwin.h" -#include "gtkmozbox.h" #endif #include "nsPluginSafety.h" @@ -517,7 +517,6 @@ NS_IMETHODIMP ns4xPluginInstance::Destroy(void) NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) { #ifdef MOZ_WIDGET_GTK - GdkSuperWin *superwin; NPSetWindowCallbackStruct *ws; #endif @@ -547,12 +546,12 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) ws = (NPSetWindowCallbackStruct *)window->ws_info; - superwin = GDK_SUPERWIN(window->window); - if (superwin && superwin->bin_window) + GdkWindow *win = gdk_window_lookup((XID)window->window); + if (win) { #ifdef NS_DEBUG printf("About to create new xtbin of %i X %i from %p...\n", - window->width, window->height, superwin->bin_window); + window->width, window->height, win); #endif #if 1 @@ -575,7 +574,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) if (!mXtBin) { - mXtBin = gtk_xtbin_new(superwin->bin_window, 0); + mXtBin = gtk_xtbin_new(win, 0); } gtk_widget_set_usize(mXtBin, window->width, window->height); @@ -594,7 +593,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) ws->depth = gdk_rgb_get_visual()->depth; ws->display = GTK_XTBIN(mXtBin)->xtdisplay; ws->visual = GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()); - ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_window_get_colormap(superwin->bin_window)); + ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_window_get_colormap(win)); XFlush(ws->display); } // !window->ws_info diff --git a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp index 35fef5aadb8..abdd9c18708 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp @@ -29,9 +29,9 @@ #include "nscore.h" #if defined(MOZ_WIDGET_GTK) +#include +#include #include "gtkxtbin.h" -#include "gdksuperwin.h" -#include "gtkmozbox.h" #endif #include "nsPluginSafety.h" @@ -517,7 +517,6 @@ NS_IMETHODIMP ns4xPluginInstance::Destroy(void) NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) { #ifdef MOZ_WIDGET_GTK - GdkSuperWin *superwin; NPSetWindowCallbackStruct *ws; #endif @@ -547,12 +546,12 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) ws = (NPSetWindowCallbackStruct *)window->ws_info; - superwin = GDK_SUPERWIN(window->window); - if (superwin && superwin->bin_window) + GdkWindow *win = gdk_window_lookup((XID)window->window); + if (win) { #ifdef NS_DEBUG printf("About to create new xtbin of %i X %i from %p...\n", - window->width, window->height, superwin->bin_window); + window->width, window->height, win); #endif #if 1 @@ -575,7 +574,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) if (!mXtBin) { - mXtBin = gtk_xtbin_new(superwin->bin_window, 0); + mXtBin = gtk_xtbin_new(win, 0); } gtk_widget_set_usize(mXtBin, window->width, window->height); @@ -594,7 +593,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) ws->depth = gdk_rgb_get_visual()->depth; ws->display = GTK_XTBIN(mXtBin)->xtdisplay; ws->visual = GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()); - ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_window_get_colormap(superwin->bin_window)); + ws->colormap = GDK_COLORMAP_XCOLORMAP(gdk_window_get_colormap(win)); XFlush(ws->display); } // !window->ws_info diff --git a/mozilla/modules/plugin/samples/simple/npsimple.cpp b/mozilla/modules/plugin/samples/simple/npsimple.cpp index 22c677e090e..4021d15efbd 100644 --- a/mozilla/modules/plugin/samples/simple/npsimple.cpp +++ b/mozilla/modules/plugin/samples/simple/npsimple.cpp @@ -941,10 +941,15 @@ SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window) if (window == NULL || window->window == NULL) return NS_ERROR_NULL_POINTER; - if ( fPlatform.superwin == (GdkSuperWin *)window->window ) + + GdkWindow *win = gdk_window_lookup((XID)window->window); + + if ( fPlatform.superwin && fPlatform.superwin->bin_window == win ) return NS_OK; - fPlatform.superwin = (GdkSuperWin *)window->window; + // should we destroy fPlatform.superwin ?? + + fPlatform.superwin = gdk_superwin_new(win, 0, 0, window->width, window->height); // a little cleanup if (fPlatform.label) diff --git a/mozilla/modules/plugin/test/npsimple.cpp b/mozilla/modules/plugin/test/npsimple.cpp index 22c677e090e..4021d15efbd 100644 --- a/mozilla/modules/plugin/test/npsimple.cpp +++ b/mozilla/modules/plugin/test/npsimple.cpp @@ -941,10 +941,15 @@ SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window) if (window == NULL || window->window == NULL) return NS_ERROR_NULL_POINTER; - if ( fPlatform.superwin == (GdkSuperWin *)window->window ) + + GdkWindow *win = gdk_window_lookup((XID)window->window); + + if ( fPlatform.superwin && fPlatform.superwin->bin_window == win ) return NS_OK; - fPlatform.superwin = (GdkSuperWin *)window->window; + // should we destroy fPlatform.superwin ?? + + fPlatform.superwin = gdk_superwin_new(win, 0, 0, window->width, window->height); // a little cleanup if (fPlatform.label) diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index f9b216177fc..2a356192f28 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -1940,7 +1940,7 @@ void * nsWindow::GetNativeData(PRUint32 aDataType) return NULL; } } - return (void *)mSuperWin; + return (void *)GDK_WINDOW_XWINDOW(mSuperWin->bin_window); } return nsWidget::GetNativeData(aDataType);