Bye bye gtk1 and xlib (part 1 of 2). b=326152 r+sr=roc
git-svn-id: svn://10.0.0.236/trunk@225306 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -59,24 +59,12 @@
|
||||
#include "nsILegacyPluginWrapperOS2.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gtkxtbin.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gtk2xtbin.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_XLIB
|
||||
#include "xlibxtbin.h"
|
||||
#include "xlibrgb.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// CID's && IID's
|
||||
static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
|
||||
@@ -832,13 +820,9 @@ ns4xPluginInstance::~ns4xPluginInstance(void)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("ns4xPluginInstance dtor: this=%p\n",this));
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2)
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
if (mXtBin)
|
||||
gtk_widget_destroy(mXtBin);
|
||||
#elif defined(MOZ_WIDGET_XLIB)
|
||||
if (mXlibXtBin) {
|
||||
delete mXlibXtBin;
|
||||
}
|
||||
#endif
|
||||
|
||||
// clean the stream list if any
|
||||
@@ -863,10 +847,8 @@ NS_IMETHODIMP ns4xPluginInstance::Initialize(nsIPluginInstancePeer* peer)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("ns4xPluginInstance::Initialize this=%p\n",this));
|
||||
|
||||
#if defined (MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2)
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
mXtBin = nsnull;
|
||||
#elif defined(MOZ_WIDGET_XLIB)
|
||||
mXlibXtBin = nsnull;
|
||||
#endif
|
||||
return InitializePlugin(peer);
|
||||
}
|
||||
@@ -885,21 +867,6 @@ NS_IMETHODIMP ns4xPluginInstance::Start(void)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("ns4xPluginInstance::Start this=%p\n",this));
|
||||
|
||||
#ifdef MOZ_WIDGET_XLIB
|
||||
if (mXlibXtBin == nsnull)
|
||||
mXlibXtBin = new xtbin();
|
||||
|
||||
if (mXlibXtBin == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!mXlibXtBin->xtbin_initialized())
|
||||
mXlibXtBin->xtbin_init();
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
printf("Made new XtBin: %p, %d\n", mXlibXtBin, mXlibXtBin->xtbin_initialized());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(mStarted)
|
||||
return NS_OK;
|
||||
else
|
||||
@@ -923,16 +890,11 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2)
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
if (mXtBin) {
|
||||
gtk_widget_destroy(mXtBin);
|
||||
mXtBin = 0;
|
||||
}
|
||||
#elif defined(MOZ_WIDGET_XLIB)
|
||||
if (mXlibXtBin) {
|
||||
mXlibXtBin->xtbin_destroy();
|
||||
mXlibXtBin = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!mStarted)
|
||||
@@ -1143,7 +1105,7 @@ NS_IMETHODIMP ns4xPluginInstance::Destroy(void)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_XLIB)
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
NPSetWindowCallbackStruct *ws;
|
||||
#endif
|
||||
|
||||
@@ -1153,7 +1115,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
|
||||
NPError error;
|
||||
|
||||
#if defined (MOZ_WIDGET_GTK) || defined (MOZ_WIDGET_GTK2)
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
PRBool isXembed = PR_FALSE;
|
||||
// bug 108337, flash plugin on linux doesn't like window->width <= 0
|
||||
if ((PRInt32) window->width <= 0 || (PRInt32) window->height <= 0)
|
||||
@@ -1262,69 +1224,6 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
gtk_xtbin_resize(mXtBin, window->width, window->height);
|
||||
}
|
||||
|
||||
#elif defined(MOZ_WIDGET_XLIB)
|
||||
|
||||
|
||||
// Allocate and fill out the ws_info data
|
||||
if (!window->ws_info) {
|
||||
#ifdef NS_DEBUG
|
||||
printf("About to create new ws_info...\n");
|
||||
#endif
|
||||
|
||||
// allocate a new NPSetWindowCallbackStruct structure at ws_info
|
||||
window->ws_info = (NPSetWindowCallbackStruct *)PR_MALLOC(sizeof(NPSetWindowCallbackStruct));
|
||||
|
||||
if (!window->ws_info)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
ws = (NPSetWindowCallbackStruct *)window->ws_info;
|
||||
|
||||
#if 1
|
||||
/* See comment above in GTK+ port ... */
|
||||
if (mXlibXtBin) {
|
||||
delete mXlibXtBin;
|
||||
mXlibXtBin = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mXlibXtBin) {
|
||||
mXlibXtBin = new xtbin();
|
||||
// Check to see if creating mXlibXtBin failed for some reason.
|
||||
// if it did, we can't go any further.
|
||||
if (!mXlibXtBin)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (window->window) {
|
||||
#ifdef NS_DEBUG
|
||||
printf("About to create new xtbin of %i X %i from %08x...\n",
|
||||
window->width, window->height, window->window);
|
||||
#endif
|
||||
|
||||
mXlibXtBin->xtbin_new((Window)window->window);
|
||||
mXlibXtBin->xtbin_resize(0, 0, window->width, window->height);
|
||||
#ifdef NS_DEBUG
|
||||
printf("About to show xtbin(%p)...\n", mXlibXtBin); fflush(NULL);
|
||||
#endif
|
||||
mXlibXtBin->xtbin_realize();
|
||||
}
|
||||
|
||||
/* Set window attributes */
|
||||
XlibRgbHandle *xlibRgbHandle = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE);
|
||||
Display *xdisplay = xxlib_rgb_get_display(xlibRgbHandle);
|
||||
|
||||
/* Fill in window info structure */
|
||||
ws->type = 0;
|
||||
ws->depth = xxlib_rgb_get_depth(xlibRgbHandle);
|
||||
ws->display = xdisplay;
|
||||
ws->visual = xxlib_rgb_get_visual(xlibRgbHandle);
|
||||
ws->colormap = xxlib_rgb_get_cmap(xlibRgbHandle);
|
||||
XFlush(ws->display);
|
||||
} // !window->ws_info
|
||||
|
||||
// And now point the NPWindow structures window
|
||||
// to the actual X window
|
||||
window->window = (nsPluginPort *)mXlibXtBin->xtbin_xtwindow();
|
||||
#endif // MOZ_WIDGET
|
||||
|
||||
if (fCallbacks->setwindow) {
|
||||
|
||||
Reference in New Issue
Block a user