Backout de697e323b39, b778d551c9e5, and 4b9414cba94d (bug 544088) due to build bustage.

This commit is contained in:
Ryan VanderMeulen 2012-07-12 19:52:15 -04:00
Родитель 23527cee98
Коммит cd30f80bb5
11 изменённых файлов: 99 добавлений и 263 удалений

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

@ -112,7 +112,7 @@ public:
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer);
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
NS_OVERRIDE virtual bool IsOOP() { return false; }
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing);
#endif

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

@ -992,7 +992,7 @@ nsNPAPIPluginInstance::UseAsyncPainting(bool* aIsAsync)
if (!library)
return NS_ERROR_FAILURE;
*aIsAsync = library->IsOOP();
*aIsAsync = library->UseAsyncPainting();
return NS_OK;
}

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

@ -11,7 +11,6 @@
#include "nsDebug.h"
#include "nsPluginNativeWindow.h"
#include "nsNPAPIPlugin.h"
#include "npapi.h"
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
@ -33,7 +32,7 @@ private:
* that encapsulates the Xt toolkit within a Gtk Application.
*/
GtkWidget* mSocketWidget;
nsresult CreateXEmbedWindow(bool aEnableXtFocus);
nsresult CreateXEmbedWindow();
nsresult CreateXtWindow();
void SetAllocation();
};
@ -106,10 +105,8 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
printf("nsPluginNativeWindowGtk2: NPPVpluginNeedsXEmbed=%d\n", needsXEmbed);
#endif
bool isOOPPlugin = aPluginInstance->GetPlugin()->GetLibrary()->IsOOP();
if (needsXEmbed || isOOPPlugin) {
bool enableXtFocus = !needsXEmbed;
rv = CreateXEmbedWindow(enableXtFocus);
if (needsXEmbed) {
rv = CreateXEmbedWindow();
}
else {
rv = CreateXtWindow();
@ -132,7 +129,7 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
// Point the NPWindow structures window to the actual X window
window = (void*)GTK_XTBIN(mSocketWidget)->xtwindow;
}
else { // XEmbed or OOP&Xt
else { // XEmbed
SetAllocation();
window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
}
@ -149,7 +146,7 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
return NS_OK;
}
nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow(bool aEnableXtFocus) {
nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow() {
NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
GdkDisplay *display = gdk_display_get_default();
GdkWindow *parent_win = gdk_x11_window_lookup_for_display(display, (XID)window);
@ -158,10 +155,6 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow(bool aEnableXtFocus) {
//attach the socket to the container widget
gtk_widget_set_parent_window(mSocketWidget, parent_win);
// enable/disable focus event handlers,
// see plugin_window_filter_func() for details
g_object_set_data(G_OBJECT(mSocketWidget), "enable-xt-focus", (void *)aEnableXtFocus);
// Make sure to handle the plug_removed signal. If we don't the
// socket will automatically be destroyed when the plug is
// removed, which means we're destroying it more than once.

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

@ -108,9 +108,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
, mAsyncInvalidateTask(0)
, mCachedWindowActor(nsnull)
, mCachedElementActor(nsnull)
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
, mXEmbed(false)
#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
#if defined(OS_WIN)
, mPluginWindowHWND(0)
, mPluginWndProc(0)
@ -149,15 +146,13 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
#endif
{
memset(&mWindow, 0, sizeof(mWindow));
mWindow.type = NPWindowTypeWindow;
mData.ndata = (void*) this;
mData.pdata = nsnull;
mAsyncBitmaps.Init();
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
mWindow.ws_info = &mWsInfo;
memset(&mWsInfo, 0, sizeof(mWsInfo));
mWsInfo.display = NULL;
mXtClient.top_widget = NULL;
mWsInfo.display = DefaultXDisplay();
#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
#if defined(OS_WIN)
memset(&mAlphaExtract, 0, sizeof(mAlphaExtract));
@ -311,15 +306,6 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
*((NPNToolkitType*)aValue) = NPNVGtk2;
return NPERR_NO_ERROR;
case NPNVxDisplay:
if (!mWsInfo.display) {
// We are called before Initialize() so we have to call it now.
Initialize();
NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
}
*(void **)aValue = mWsInfo.display;
return NPERR_NO_ERROR;
#elif defined(OS_WIN)
case NPNVToolkit:
return NPERR_GENERIC_ERROR;
@ -506,19 +492,6 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
if (!CallNPN_SetValue_NPPVpluginWindow(windowed, &rv))
return NPERR_GENERIC_ERROR;
NPWindowType newWindowType = windowed ? NPWindowTypeWindow : NPWindowTypeDrawable;
if (mWindow.type != newWindowType && mWsInfo.display) {
// plugin type has been changed but we already have a valid display
// so update it for the recent plugin mode
if (mXEmbed || !windowed) {
// Use default GTK display for XEmbed and windowless plugins
mWsInfo.display = DefaultXDisplay();
}
else {
mWsInfo.display = xt_client_get_display();
}
}
mWindow.type = newWindowType;
return rv;
}
@ -1002,52 +975,6 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
#endif
}
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
// Create a new window from NPWindow
bool PluginInstanceChild::CreateWindow(const NPRemoteWindow& aWindow)
{
PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
FULLFUNCTION,
aWindow.window,
aWindow.x, aWindow.y,
aWindow.width, aWindow.height));
if (mXEmbed) {
mWindow.window = reinterpret_cast<void*>(aWindow.window);
}
else {
Window browserSocket = (Window)(aWindow.window);
xt_client_init(&mXtClient, mWsInfo.visual, mWsInfo.colormap, mWsInfo.depth);
xt_client_create(&mXtClient, browserSocket, mWindow.width, mWindow.height);
mWindow.window = (void *)XtWindow(mXtClient.child_widget);
}
return true;
}
// Destroy window
void PluginInstanceChild::DeleteWindow()
{
PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
FULLFUNCTION,
mWindow.window,
mWindow.x, mWindow.y,
mWindow.width, mWindow.height));
if (!mWindow.window)
return;
if (mXtClient.top_widget) {
xt_client_unrealize(&mXtClient);
xt_client_destroy(&mXtClient);
mXtClient.top_widget = NULL;
}
// We don't have to keep the plug-in window ID any longer.
mWindow.window = nsnull;
}
#endif
bool
PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
{
@ -1061,11 +988,10 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
AssertPluginThread();
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
// The minimum info is sent over IPC to allow this
// code to determine the rest.
mWindow.window = reinterpret_cast<void*>(aWindow.window);
mWindow.x = aWindow.x;
mWindow.y = aWindow.y;
mWindow.width = aWindow.width;
@ -1078,12 +1004,8 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
&mWsInfo.visual, &mWsInfo.depth))
return false;
if (!mWindow.window && mWindow.type == NPWindowTypeWindow) {
CreateWindow(aWindow);
}
#ifdef MOZ_WIDGET_GTK2
if (mXEmbed && gtk_check_version(2,18,7) != NULL) { // older
if (gtk_check_version(2,18,7) != NULL) { // older
if (aWindow.type == NPWindowTypeWindow) {
GdkWindow* socket_window = gdk_window_lookup(static_cast<GdkNativeWindow>(aWindow.window));
if (socket_window) {
@ -1214,33 +1136,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
bool
PluginInstanceChild::Initialize()
{
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
NPError rv;
if (mWsInfo.display) {
// Already initialized
return false;
}
// Request for windowless plugins is set in newp(), before this call.
if (mWindow.type == NPWindowTypeWindow) {
AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(&mXEmbed, &rv);
// Set up Xt loop for windowed plugins without XEmbed support
if (!mXEmbed) {
xt_client_xloop_create();
}
}
// Use default GTK display for XEmbed and windowless plugins
if (mXEmbed || mWindow.type != NPWindowTypeWindow) {
mWsInfo.display = DefaultXDisplay();
}
else {
mWsInfo.display = xt_client_get_display();
}
#endif
return true;
}
@ -4101,12 +3996,5 @@ PluginInstanceChild::AnswerNPP_Destroy(NPError* aResult)
mAsyncBitmaps.Enumerate(DeleteSurface, this);
}
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
if (mWindow.type == NPWindowTypeWindow && !mXEmbed) {
xt_client_xloop_destroy();
}
DeleteWindow();
#endif
return true;
}

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

@ -35,10 +35,6 @@ using namespace mozilla::plugins::PluginUtilsOSX;
#include <map>
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
#include "gtk2xtbin.h"
#endif
namespace mozilla {
namespace layers {
@ -193,11 +189,6 @@ protected:
virtual bool
RecvNPP_DidComposite();
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
bool CreateWindow(const NPRemoteWindow& aWindow);
void DeleteWindow();
#endif
public:
PluginInstanceChild(const NPPluginFuncs* aPluginIface);
@ -384,8 +375,6 @@ private:
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
NPSetWindowCallbackStruct mWsInfo;
bool mXEmbed;
XtClient mXtClient;
#elif defined(OS_WIN)
HWND mPluginWindowHWND;
WNDPROC mPluginWndProc;

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

@ -70,7 +70,7 @@ public:
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer) = 0;
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
virtual bool IsOOP() = 0;
virtual bool UseAsyncPainting() = 0;
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
#endif

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

@ -1094,19 +1094,7 @@ _getvalue(NPP aNPP,
*(NPBool*)aValue = value ? true : false;
return result;
}
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
case NPNVxDisplay: {
if (aNPP) {
return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
}
else {
*(void **)aValue = xt_client_get_display();
}
return NPERR_NO_ERROR;
}
case NPNVxtAppContext:
return NPERR_GENERIC_ERROR;
#endif
default: {
if (aNPP) {
return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
@ -1950,7 +1938,13 @@ PluginModuleChild::AllocPPluginInstance(const nsCString& aMimeType,
}
#endif
return new PluginInstanceChild(&mFunctions);
nsAutoPtr<PluginInstanceChild> childInstance(
new PluginInstanceChild(&mFunctions));
if (!childInstance->Initialize()) {
*rv = NPERR_GENERIC_ERROR;
return 0;
}
return childInstance.forget();
}
void
@ -2043,8 +2037,6 @@ PluginModuleChild::AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor
return true;
}
childInstance->Initialize();
#if defined(XP_MACOSX) && defined(__i386__)
// If an i386 Mac OS X plugin has selected the Carbon event model then
// we have to fail. We do not support putting Carbon event model plugins

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

@ -244,7 +244,7 @@ private:
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer);
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
NS_OVERRIDE virtual bool IsOOP() { return true; }
NS_OVERRIDE virtual bool UseAsyncPainting() { return true; }
NS_OVERRIDE
virtual nsresult SetBackgroundUnknown(NPP instance);
NS_OVERRIDE

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

@ -5412,10 +5412,8 @@ plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
else
#endif
if(GTK_IS_SOCKET(widget)) {
if (!g_object_get_data(G_OBJECT(widget), "enable-xt-focus")) {
nswindow->SetPluginType(nsWindow::PluginType_XEMBED);
break;
}
nswindow->SetPluginType(nsWindow::PluginType_XEMBED);
break;
}
}
nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);

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

@ -43,15 +43,30 @@ static void gtk_xtbin_destroy (GtkObject *object);
static void gtk_xtbin_shutdown (GtkObject *object);
/* Xt aware XEmbed */
static void xt_client_init (XtClient * xtclient,
Visual *xtvisual,
Colormap xtcolormap,
int xtdepth);
static void xt_client_create (XtClient * xtclient,
Window embeder,
int height,
int width );
static void xt_client_unrealize (XtClient* xtclient);
static void xt_client_destroy (XtClient* xtclient);
static void xt_client_set_info (Widget xtplug,
unsigned long flags);
static void xt_client_event_handler (Widget w,
XtPointer client_data,
XEvent *event);
static void xt_client_handle_xembed_message (Widget w,
XtPointer client_data,
XEvent *event);
static void xt_client_focus_listener (Widget w,
XtPointer user_data,
XEvent *event);
static void xt_add_focus_listener( Widget w, XtPointer user_data );
static void xt_add_focus_listener_tree ( Widget treeroot, XtPointer user_data);
static void xt_remove_focus_listener(Widget w, XtPointer user_data);
static void xt_client_event_handler (Widget w, XtPointer client_data, XEvent *event);
static void xt_client_focus_listener (Widget w, XtPointer user_data, XEvent *event);
static void xt_client_set_info (Widget xtplug, unsigned long flags);
static void send_xembed_message (XtClient *xtclient,
long message,
long detail,
@ -294,8 +309,44 @@ gtk_xtbin_new (GdkWindow *parent_window, String * f)
return (GtkWidget *)NULL;
}
/* Launch X event loop */
xt_client_xloop_create();
/* If this is the first running widget, hook this display into the
mainloop */
if (0 == num_widgets) {
int cnumber;
/*
* hook Xt event loop into the glib event loop.
*/
/* the assumption is that gtk_init has already been called */
GSource* gs = g_source_new(&xt_event_funcs, sizeof(GSource));
if (!gs) {
return NULL;
}
g_source_set_priority(gs, GDK_PRIORITY_EVENTS);
g_source_set_can_recurse(gs, TRUE);
tag = g_source_attach(gs, (GMainContext*)NULL);
#ifdef VMS
cnumber = XConnectionNumber(xtdisplay);
#else
cnumber = ConnectionNumber(xtdisplay);
#endif
xt_event_poll_fd.fd = cnumber;
xt_event_poll_fd.events = G_IO_IN;
xt_event_poll_fd.revents = 0; /* hmm... is this correct? */
g_main_context_add_poll ((GMainContext*)NULL,
&xt_event_poll_fd,
G_PRIORITY_LOW);
/* add a timer so that we can poll and process Xt timers */
xt_polling_timer_id =
g_timeout_add(25,
(GtkFunction)xt_event_polling_timer_callback,
xtdisplay);
}
/* Bump up our usage count */
num_widgets++;
/* Build the hierachy */
xtbin->xtdisplay = xtbin->xtclient.xtdisplay;
@ -406,8 +457,20 @@ gtk_xtbin_destroy (GtkObject *object)
xt_client_destroy(&(xtbin->xtclient));
xtbin->xtwindow = 0;
/* stop X event loop */
xt_client_xloop_destroy();
num_widgets--; /* reduce our usage count */
/* If this is the last running widget, remove the Xt display
connection from the mainloop */
if (0 == num_widgets) {
#ifdef DEBUG_XTBIN
printf("removing the Xt connection from the main loop\n");
#endif
g_main_context_remove_poll((GMainContext*)NULL, &xt_event_poll_fd);
g_source_remove(tag);
g_source_remove(xt_polling_timer_id);
xt_polling_timer_id = 0;
}
}
GTK_OBJECT_CLASS(parent_class)->destroy(object);
@ -418,7 +481,7 @@ gtk_xtbin_destroy (GtkObject *object)
*/
/* Initial Xt plugin */
void
static void
xt_client_init( XtClient * xtclient,
Visual *xtvisual,
Colormap xtcolormap,
@ -458,87 +521,9 @@ xt_client_init( XtClient * xtclient,
xtclient->xtdepth = xtdepth;
}
void
xt_client_xloop_create(void)
{
/* If this is the first running widget, hook this display into the
mainloop */
if (0 == num_widgets) {
int cnumber;
/* Set up xtdisplay in case we're missing one */
if (!xtdisplay) {
(void)xt_client_get_display();
}
/*
* hook Xt event loop into the glib event loop.
*/
/* the assumption is that gtk_init has already been called */
GSource* gs = g_source_new(&xt_event_funcs, sizeof(GSource));
if (!gs) {
return NULL;
}
g_source_set_priority(gs, GDK_PRIORITY_EVENTS);
g_source_set_can_recurse(gs, TRUE);
tag = g_source_attach(gs, (GMainContext*)NULL);
#ifdef VMS
cnumber = XConnectionNumber(xtdisplay);
#else
cnumber = ConnectionNumber(xtdisplay);
#endif
xt_event_poll_fd.fd = cnumber;
xt_event_poll_fd.events = G_IO_IN;
xt_event_poll_fd.revents = 0; /* hmm... is this correct? */
g_main_context_add_poll ((GMainContext*)NULL,
&xt_event_poll_fd,
G_PRIORITY_LOW);
/* add a timer so that we can poll and process Xt timers */
xt_polling_timer_id =
g_timeout_add(25,
(GtkFunction)xt_event_polling_timer_callback,
xtdisplay);
}
/* Bump up our usage count */
num_widgets++;
}
void
xt_client_xloop_destroy(void)
{
num_widgets--; /* reduce our usage count */
/* If this is the last running widget, remove the Xt display
connection from the mainloop */
if (0 == num_widgets) {
#ifdef DEBUG_XTBIN
printf("removing the Xt connection from the main loop\n");
#endif
g_main_context_remove_poll((GMainContext*)NULL, &xt_event_poll_fd);
g_source_remove(tag);
g_source_remove(xt_polling_timer_id);
xt_polling_timer_id = 0;
}
}
/* Get Xt Client display */
Display *
xt_client_get_display(void)
{
if (!xtdisplay) {
XtClient tmp;
xt_client_init(&tmp,NULL,0,0);
}
return xtdisplay;
}
/* Create the Xt client widgets
* */
void
static void
xt_client_create ( XtClient* xtclient ,
Window embedderid,
int height,
@ -614,7 +599,7 @@ xt_client_create ( XtClient* xtclient ,
XSync(xtclient->xtdisplay, FALSE);
}
void
static void
xt_client_unrealize ( XtClient* xtclient )
{
#if XlibSpecificationRelease >= 6
@ -633,7 +618,7 @@ xt_client_unrealize ( XtClient* xtclient )
XtUnrealizeWidget(xtclient->top_widget);
}
void
static void
xt_client_destroy (XtClient* xtclient)
{
if(xtclient->top_widget) {
@ -644,7 +629,7 @@ xt_client_destroy (XtClient* xtclient)
}
}
void
static void
xt_client_set_info (Widget xtplug, unsigned long flags)
{
unsigned long buffer[2];
@ -721,7 +706,7 @@ xt_client_handle_xembed_message(Widget w, XtPointer client_data, XEvent *event)
} /* End of XEmbed Message */
}
void
static void
xt_client_event_handler( Widget w, XtPointer client_data, XEvent *event)
{
XtClient *xtplug = (XtClient*)client_data;
@ -821,7 +806,7 @@ untrap_error(void)
return trapped_error_code;
}
void
static void
xt_client_focus_listener( Widget w, XtPointer user_data, XEvent *event)
{
Display *dpy = XtDisplay(w);

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

@ -120,15 +120,6 @@ typedef struct _WidgetRec {
CorePart core;
} WidgetRec, CoreRec;
/* Exported functions, used by Xt plugins */
void xt_client_create(XtClient * xtclient, Window embeder, int height, int width);
void xt_client_unrealize(XtClient* xtclient);
void xt_client_destroy(XtClient* xtclient);
void xt_client_init(XtClient * xtclient, Visual *xtvisual, Colormap xtcolormap, int xtdepth);
void xt_client_xloop_create(void);
void xt_client_xloop_destroy(void);
Display * xt_client_get_display(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */