fix for bug 45162 new plugins shouldn't use GdkSuperWin's, but instead should use XIDs. sr=blizzard r=valeski

This commit is contained in:
pavlov%netscape.com 2000-10-13 01:10:21 +00:00
Родитель 0bda8b661f
Коммит 542939a025
5 изменённых файлов: 29 добавлений и 21 удалений

Просмотреть файл

@ -29,9 +29,9 @@
#include "nscore.h" #include "nscore.h"
#if defined(MOZ_WIDGET_GTK) #if defined(MOZ_WIDGET_GTK)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include "gtkxtbin.h" #include "gtkxtbin.h"
#include "gdksuperwin.h"
#include "gtkmozbox.h"
#endif #endif
#include "nsPluginSafety.h" #include "nsPluginSafety.h"
@ -517,7 +517,6 @@ NS_IMETHODIMP ns4xPluginInstance::Destroy(void)
NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
{ {
#ifdef MOZ_WIDGET_GTK #ifdef MOZ_WIDGET_GTK
GdkSuperWin *superwin;
NPSetWindowCallbackStruct *ws; NPSetWindowCallbackStruct *ws;
#endif #endif
@ -547,12 +546,12 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
ws = (NPSetWindowCallbackStruct *)window->ws_info; ws = (NPSetWindowCallbackStruct *)window->ws_info;
superwin = GDK_SUPERWIN(window->window); GdkWindow *win = gdk_window_lookup((XID)window->window);
if (superwin && superwin->bin_window) if (win)
{ {
#ifdef NS_DEBUG #ifdef NS_DEBUG
printf("About to create new xtbin of %i X %i from %p...\n", 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 #endif
#if 1 #if 1
@ -575,7 +574,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
if (!mXtBin) { 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); 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->depth = gdk_rgb_get_visual()->depth;
ws->display = GTK_XTBIN(mXtBin)->xtdisplay; ws->display = GTK_XTBIN(mXtBin)->xtdisplay;
ws->visual = GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()); 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); XFlush(ws->display);
} // !window->ws_info } // !window->ws_info

Просмотреть файл

@ -29,9 +29,9 @@
#include "nscore.h" #include "nscore.h"
#if defined(MOZ_WIDGET_GTK) #if defined(MOZ_WIDGET_GTK)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include "gtkxtbin.h" #include "gtkxtbin.h"
#include "gdksuperwin.h"
#include "gtkmozbox.h"
#endif #endif
#include "nsPluginSafety.h" #include "nsPluginSafety.h"
@ -517,7 +517,6 @@ NS_IMETHODIMP ns4xPluginInstance::Destroy(void)
NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
{ {
#ifdef MOZ_WIDGET_GTK #ifdef MOZ_WIDGET_GTK
GdkSuperWin *superwin;
NPSetWindowCallbackStruct *ws; NPSetWindowCallbackStruct *ws;
#endif #endif
@ -547,12 +546,12 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
ws = (NPSetWindowCallbackStruct *)window->ws_info; ws = (NPSetWindowCallbackStruct *)window->ws_info;
superwin = GDK_SUPERWIN(window->window); GdkWindow *win = gdk_window_lookup((XID)window->window);
if (superwin && superwin->bin_window) if (win)
{ {
#ifdef NS_DEBUG #ifdef NS_DEBUG
printf("About to create new xtbin of %i X %i from %p...\n", 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 #endif
#if 1 #if 1
@ -575,7 +574,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
if (!mXtBin) { 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); 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->depth = gdk_rgb_get_visual()->depth;
ws->display = GTK_XTBIN(mXtBin)->xtdisplay; ws->display = GTK_XTBIN(mXtBin)->xtdisplay;
ws->visual = GDK_VISUAL_XVISUAL(gdk_rgb_get_visual()); 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); XFlush(ws->display);
} // !window->ws_info } // !window->ws_info

Просмотреть файл

@ -941,10 +941,15 @@ SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window)
if (window == NULL || window->window == NULL) if (window == NULL || window->window == NULL)
return NS_ERROR_NULL_POINTER; 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; 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 // a little cleanup
if (fPlatform.label) if (fPlatform.label)

Просмотреть файл

@ -941,10 +941,15 @@ SimplePluginInstance::PlatformSetWindow(nsPluginWindow* window)
if (window == NULL || window->window == NULL) if (window == NULL || window->window == NULL)
return NS_ERROR_NULL_POINTER; 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; 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 // a little cleanup
if (fPlatform.label) if (fPlatform.label)

Просмотреть файл

@ -1940,7 +1940,7 @@ void * nsWindow::GetNativeData(PRUint32 aDataType)
return NULL; return NULL;
} }
} }
return (void *)mSuperWin; return (void *)GDK_WINDOW_XWINDOW(mSuperWin->bin_window);
} }
return nsWidget::GetNativeData(aDataType); return nsWidget::GetNativeData(aDataType);