Bug 624165 Cleanup plugins code, remove kill MOZ_COMPOSITED_PLUGINS and MOZ_USE_IMAGE_EXPOSE r=dougt

This commit is contained in:
Oleg Romashin 2011-05-25 16:54:30 -04:00
parent 32e8962d5a
commit d0ac388d68
6 changed files with 5 additions and 582 deletions

View File

@ -2159,13 +2159,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
return NPERR_GENERIC_ERROR;
}
#if (MOZ_PLATFORM_MAEMO == 5)
case NPNVSupportsWindowlessLocal: {
*(NPBool*)result = PR_TRUE;
return NPERR_NO_ERROR;
}
#endif
#ifdef XP_MACOSX
case NPNVpluginDrawingModel: {
if (npp) {
@ -2282,12 +2275,6 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
return inst->SetWindowless(bWindowless);
#endif
}
#if (MOZ_PLATFORM_MAEMO == 5)
case NPPVpluginWindowlessLocalBool: {
NPBool bWindowlessLocal = (result != nsnull);
return inst->SetWindowlessLocal(bWindowlessLocal);
}
#endif
case NPPVpluginTransparentBool: {
NPBool bTransparent = (result != nsnull);
return inst->SetTransparent(bTransparent);

View File

@ -597,15 +597,6 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, PRInt16* result)
nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
{
#if (MOZ_PLATFORM_MAEMO == 5)
// The maemo flash plugin does not remember this. It sets the
// value, but doesn't support the get value.
if (variable == NPPVpluginWindowlessLocalBool) {
*(NPBool*)value = mWindowlessLocal;
return NS_OK;
}
#endif
if (!mPlugin || !mPlugin->GetLibrary())
return NS_ERROR_FAILURE;

View File

@ -104,15 +104,6 @@ public:
SetPluginInstance(aPluginInstance);
return NS_OK;
}
#if (MOZ_PLATFORM_MAEMO == 5) && defined(MOZ_WIDGET_GTK2)
#define MOZ_COMPOSITED_PLUGINS
#endif
#ifdef MOZ_COMPOSITED_PLUGINS
/* XXX: we use this to leak the socket widget out from nsPlugNativeWindowGtk2
so that Renderer::NativeDraw() in nsObjectFrame.cpp can draw the widget.
I don't currently know a better way to do this... */
void *mPlugWindow;
#endif
protected:
nsRefPtr<nsNPAPIPluginInstance> mPluginInstance;

View File

@ -49,17 +49,6 @@
#include <gdk/gdkx.h>
#include <gdk/gdk.h>
#if (MOZ_PLATFORM_MAEMO == 5)
#define MOZ_COMPOSITED_PLUGINS
#endif
#ifdef MOZ_COMPOSITED_PLUGINS
extern "C" {
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xcomposite.h>
}
#endif
#include "gtk2xtbin.h"
class nsPluginNativeWindowGtk2 : public nsPluginNativeWindow {
@ -78,15 +67,6 @@ private:
nsresult CreateXEmbedWindow();
nsresult CreateXtWindow();
void SetAllocation();
#ifdef MOZ_COMPOSITED_PLUGINS
nsresult CreateXCompositedWindow();
static GdkFilterReturn plugin_composite_filter_func (GdkXEvent *xevent,
GdkEvent *event,
gpointer data);
Damage mDamage;
GtkWidget* mParentWindow;
#endif
};
static gboolean plug_removed_cb (GtkWidget *widget, gpointer data);
@ -109,10 +89,6 @@ nsPluginNativeWindowGtk2::nsPluginNativeWindowGtk2() : nsPluginNativeWindow()
mWsInfo.visual = nsnull;
mWsInfo.colormap = 0;
mWsInfo.depth = 0;
#ifdef MOZ_COMPOSITED_PLUGINS
mDamage = 0;
mParentWindow = 0;
#endif
}
nsPluginNativeWindowGtk2::~nsPluginNativeWindowGtk2()
@ -120,16 +96,6 @@ nsPluginNativeWindowGtk2::~nsPluginNativeWindowGtk2()
if(mSocketWidget) {
gtk_widget_destroy(mSocketWidget);
}
#ifdef MOZ_COMPOSITED_PLUGINS
if (mParentWindow) {
gtk_widget_destroy(mParentWindow);
}
if (mDamage) {
gdk_window_remove_filter (nsnull, plugin_composite_filter_func, this);
}
#endif
}
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
@ -147,38 +113,6 @@ nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindo
return NS_OK;
}
#ifdef MOZ_COMPOSITED_PLUGINS
/* the base xdamage event number.*/
static int xdamage_event_base;
GdkFilterReturn
nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
{
nsPluginNativeWindowGtk2 *native_window = (nsPluginNativeWindowGtk2*)data;
XDamageNotifyEvent *ev;
ev = (XDamageNotifyEvent *) xevent;
if (ev->type != xdamage_event_base + XDamageNotify)
return GDK_FILTER_CONTINUE;
//printf("Damage event %d %d %d %d\n",ev->area.x, ev->area.y, ev->area.width, ev->area.height);
XDamageSubtract (GDK_DISPLAY(), native_window->mDamage, None, None);
/* We try to do our area invalidation here */
NPRect rect;
rect.top = ev->area.x;
rect.left = ev->area.y;
rect.right = ev->area.x + ev->area.width;
rect.bottom = ev->area.y + ev->area.height;
if (native_window->mPluginInstance)
native_window->mPluginInstance->InvalidateRect(&rect);
return GDK_FILTER_REMOVE;
}
#endif
nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
{
if (aPluginInstance) {
@ -197,11 +131,7 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
#endif
if (needXEmbed) {
#ifdef MOZ_COMPOSITED_PLUGINS
rv = CreateXCompositedWindow();
#else
rv = CreateXEmbedWindow();
#endif
}
else {
rv = CreateXtWindow();
@ -300,94 +230,6 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow() {
return NS_OK;
}
#ifdef MOZ_COMPOSITED_PLUGINS
#include <dlfcn.h>
nsresult nsPluginNativeWindowGtk2::CreateXCompositedWindow() {
NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
mParentWindow = gtk_window_new(GTK_WINDOW_POPUP);
mSocketWidget = gtk_socket_new();
GdkWindow *parent_win = mParentWindow->window;
//attach the socket to the container widget
gtk_widget_set_parent_window(mSocketWidget, parent_win);
// 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.
// SYNTAX ERROR.
g_signal_connect(mSocketWidget, "plug_removed",
G_CALLBACK(plug_removed_cb), NULL);
g_signal_connect(mSocketWidget, "destroy",
G_CALLBACK(gtk_widget_destroyed), &mSocketWidget);
/*gpointer user_data = NULL;
gdk_window_get_user_data(parent_win, &user_data);
*/
GtkContainer *container = GTK_CONTAINER(mParentWindow);
gtk_container_add(container, mSocketWidget);
gtk_widget_realize(mSocketWidget);
// Resize before we show
SetAllocation();
gtk_widget_set_size_request (mSocketWidget, width, height);
/* move offscreen */
gtk_window_move (GTK_WINDOW(mParentWindow), width+1000, height+1000);
gtk_widget_show(mSocketWidget);
gtk_widget_show_all(mParentWindow);
/* store away a reference to the socketwidget */
mPlugWindow = (mSocketWidget);
gdk_flush();
window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
/* This is useful if we still have the plugin window inline
* i.e. firefox vs. fennec */
// gdk_window_set_composited(mSocketWidget->window, TRUE);
if (!mDamage) {
/* we install a general handler instead of one specific to a particular window
* because we don't have a GdkWindow for the plugin window */
gdk_window_add_filter (parent_win, plugin_composite_filter_func, this);
int junk;
if (!XDamageQueryExtension (GDK_DISPLAY (), &xdamage_event_base, &junk))
printf ("This requires the XDamage extension");
mDamage = XDamageCreate(GDK_DISPLAY(), (Drawable)window, XDamageReportNonEmpty);
XCompositeRedirectWindow (GDK_DISPLAY(),
(Drawable)window,
CompositeRedirectManual);
/* this is a hack to avoid having flash causing a crash when it is unloaded.
* libplayback sets up dbus_connection_filters. When flash is unloaded it takes
* libplayback with it, however the connection filters are not removed
* which causes a crash when dbus tries to execute them. dlopening libplayback
* ensures that those functions stay around even after flash is gone. */
static void *libplayback_handle;
if (!libplayback_handle) {
libplayback_handle = dlopen("libplayback-1.so.0", RTLD_NOW);
}
}
// Fill out the ws_info structure.
// (The windowless case is done in nsObjectFrame.cpp.)
GdkWindow *gdkWindow = gdk_window_lookup((XID)window);
mWsInfo.display = GDK_WINDOW_XDISPLAY(gdkWindow);
mWsInfo.colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(gdkWindow));
GdkVisual* gdkVisual = gdk_drawable_get_visual(gdkWindow);
mWsInfo.visual = GDK_VISUAL_XVISUAL(gdkVisual);
mWsInfo.depth = gdkVisual->depth;
return NS_OK;
}
#endif
void nsPluginNativeWindowGtk2::SetAllocation() {
if (!mSocketWidget)
return;

View File

@ -152,7 +152,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
, mHasPainted(false)
, mSurfaceDifferenceRect(0,0,0,0)
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
, mMaemoImageRendering(PR_FALSE)
, mMaemoImageRendering(PR_TRUE)
#endif
{
memset(&mWindow, 0, sizeof(mWindow));

View File

@ -534,10 +534,6 @@ private:
char **mCachedAttrParamNames;
char **mCachedAttrParamValues;
#ifdef MOZ_COMPOSITED_PLUGINS
nsIntPoint mLastPoint;
#endif
#ifdef XP_MACOSX
NPEventModel mEventModel;
#endif
@ -551,10 +547,6 @@ private:
nsresult EnsureCachedAttrParamArrays();
#ifdef MOZ_COMPOSITED_PLUGINS
nsEventStatus ProcessEventX11Composited(const nsGUIEvent & anEvent);
#endif
#ifdef MOZ_X11
class Renderer
#if defined(MOZ_WIDGET_GTK2)
@ -2245,11 +2237,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
if (mInstanceOwner) {
NPWindow *window;
mInstanceOwner->GetWindow(window);
#ifdef MOZ_COMPOSITED_PLUGINS
{
#else
if (window->type == NPWindowTypeDrawable) {
#endif
gfxRect frameGfxRect =
PresContext()->AppUnitsToGfxUnits(aPluginRect);
gfxRect dirtyGfxRect =
@ -3148,10 +3136,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
mCachedAttrParamValues = nsnull;
mDestroyWidget = PR_FALSE;
#ifdef MOZ_COMPOSITED_PLUGINS
mLastPoint = nsIntPoint(0,0);
#endif
#ifdef XP_MACOSX
#ifndef NP_NO_QUICKDRAW
mEventModel = NPEventModelCarbon;
@ -4624,7 +4608,7 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
{
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
#if !defined(XP_MACOSX)
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
return aKeyEvent->PreventDefault(); // consume event
// continue only for cases without child window
@ -4685,7 +4669,7 @@ nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent)
nsresult
nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
{
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
#if !defined(XP_MACOSX)
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
return aMouseEvent->PreventDefault(); // consume event
// continue only for cases without child window
@ -4759,7 +4743,7 @@ nsPluginInstanceOwner::MouseOut(nsIDOMEvent* aMouseEvent)
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
{
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
#if !defined(XP_MACOSX)
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
return aMouseEvent->PreventDefault(); // consume event
// continue only for cases without child window
@ -4822,350 +4806,10 @@ static unsigned int XInputEventState(const nsInputEvent& anEvent)
}
#endif
#ifdef MOZ_COMPOSITED_PLUGINS
static void find_dest_id(XID top, XID *root, XID *dest, int target_x, int target_y)
{
XID target_id = top;
XID parent;
XID *children;
unsigned int nchildren;
Display *display = DefaultXDisplay();
while (1) {
loop:
//printf("searching %x\n", target_id);
if (!XQueryTree(display, target_id, root, &parent, &children, &nchildren) ||
!nchildren)
break;
for (unsigned int i=0; i<nchildren; i++) {
Window root;
int x, y;
unsigned int width, height;
unsigned int border_width, depth;
XGetGeometry(display, children[i], &root, &x, &y,
&width, &height, &border_width,
&depth);
//printf("target: %d %d\n", target_x, target_y);
//printf("geom: %dx%x @ %dx%d\n", width, height, x, y);
// XXX: we may need to be more careful here, i.e. if
// this condition matches more than one child
if (target_x >= x && target_y >= y &&
target_x <= x + int(width) &&
target_y <= y + int(height)) {
target_id = children[i];
// printf("found new target: %x\n", target_id);
XFree(children);
goto loop;
}
}
XFree(children);
/* no children contain the target */
break;
}
*dest = target_id;
}
#endif
#ifdef MOZ_COMPOSITED_PLUGINS
nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent& anEvent)
{
//printf("nsGUIEvent.message: %d\n", anEvent.message);
nsEventStatus rv = nsEventStatus_eIgnore;
if (!mInstance || !mObjectFrame) // if mInstance is null, we shouldn't be here
return rv;
// this code supports windowless plugins
nsIWidget* widget = anEvent.widget;
XEvent pluginEvent;
pluginEvent.type = 0;
switch(anEvent.eventStructType)
{
case NS_MOUSE_EVENT:
{
switch (anEvent.message)
{
case NS_MOUSE_CLICK:
case NS_MOUSE_DOUBLECLICK:
// Button up/down events sent instead.
return rv;
}
// Get reference point relative to plugin origin.
const nsPresContext* presContext = mObjectFrame->PresContext();
nsPoint appPoint =
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
presContext->AppUnitsToDevPixels(appPoint.y));
mLastPoint = pluginPoint;
const nsMouseEvent& mouseEvent =
static_cast<const nsMouseEvent&>(anEvent);
// Get reference point relative to screen:
nsIntPoint rootPoint(-1,-1);
if (widget)
rootPoint = anEvent.refPoint + widget->WidgetToScreenOffset();
#ifdef MOZ_WIDGET_GTK2
Window root = GDK_ROOT_WINDOW();
#elif defined(MOZ_WIDGET_QT)
Window root = QX11Info::appRootWindow();
#else
Window root = None;
#endif
switch (anEvent.message)
{
case NS_MOUSE_ENTER_SYNTH:
case NS_MOUSE_EXIT_SYNTH:
{
XCrossingEvent& event = pluginEvent.xcrossing;
event.type = anEvent.message == NS_MOUSE_ENTER_SYNTH ?
EnterNotify : LeaveNotify;
event.root = root;
event.time = anEvent.time;
event.x = pluginPoint.x;
event.y = pluginPoint.y;
event.x_root = rootPoint.x;
event.y_root = rootPoint.y;
event.state = XInputEventState(mouseEvent);
// information lost
event.subwindow = None;
event.mode = -1;
event.detail = NotifyDetailNone;
event.same_screen = True;
event.focus = mContentFocused;
}
break;
case NS_MOUSE_MOVE:
{
XMotionEvent& event = pluginEvent.xmotion;
event.type = MotionNotify;
event.root = root;
event.time = anEvent.time;
event.x = pluginPoint.x;
event.y = pluginPoint.y;
event.x_root = rootPoint.x;
event.y_root = rootPoint.y;
event.state = XInputEventState(mouseEvent);
// information lost
event.subwindow = None;
event.is_hint = NotifyNormal;
event.same_screen = True;
XEvent be;
be.xmotion = pluginEvent.xmotion;
//printf("xmotion: %d %d\n", be.xmotion.x, be.xmotion.y);
XID w = (XID)mPluginWindow->window;
be.xmotion.window = w;
XSendEvent (be.xmotion.display, w,
FALSE, ButtonMotionMask, &be);
}
break;
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
{
XButtonEvent& event = pluginEvent.xbutton;
event.type = anEvent.message == NS_MOUSE_BUTTON_DOWN ?
ButtonPress : ButtonRelease;
event.root = root;
event.time = anEvent.time;
event.x = pluginPoint.x;
event.y = pluginPoint.y;
event.x_root = rootPoint.x;
event.y_root = rootPoint.y;
event.state = XInputEventState(mouseEvent);
switch (mouseEvent.button)
{
case nsMouseEvent::eMiddleButton:
event.button = 2;
break;
case nsMouseEvent::eRightButton:
event.button = 3;
break;
default: // nsMouseEvent::eLeftButton;
event.button = 1;
break;
}
// information lost:
event.subwindow = None;
event.same_screen = True;
XEvent be;
be.xbutton = event;
XID target;
XID root;
int wx, wy;
unsigned int width, height, border_width, depth;
//printf("xbutton: %d %d %d\n", anEvent.message, be.xbutton.x, be.xbutton.y);
XID w = (XID)mPluginWindow->window;
XGetGeometry(DefaultXDisplay(), w, &root, &wx, &wy, &width, &height, &border_width, &depth);
find_dest_id(w, &root, &target, pluginPoint.x + wx, pluginPoint.y + wy);
be.xbutton.window = target;
XSendEvent (DefaultXDisplay(), target,
FALSE, event.type == ButtonPress ? ButtonPressMask : ButtonReleaseMask, &be);
}
break;
}
}
break;
//XXX case NS_MOUSE_SCROLL_EVENT: not received.
case NS_KEY_EVENT:
if (anEvent.pluginEvent)
{
XKeyEvent &event = pluginEvent.xkey;
#ifdef MOZ_WIDGET_GTK2
event.root = GDK_ROOT_WINDOW();
event.time = anEvent.time;
const GdkEventKey* gdkEvent =
static_cast<const GdkEventKey*>(anEvent.pluginEvent);
event.keycode = gdkEvent->hardware_keycode;
event.state = gdkEvent->state;
switch (anEvent.message)
{
case NS_KEY_DOWN:
// Handle NS_KEY_DOWN for modifier key presses
// For non-modifiers we get NS_KEY_PRESS
if (gdkEvent->is_modifier)
event.type = XKeyPress;
break;
case NS_KEY_PRESS:
event.type = XKeyPress;
break;
case NS_KEY_UP:
event.type = KeyRelease;
break;
}
#endif
#ifdef MOZ_WIDGET_QT
const nsKeyEvent& keyEvent = static_cast<const nsKeyEvent&>(anEvent);
memset( &event, 0, sizeof(event) );
event.time = anEvent.time;
QWidget* qWidget = static_cast<QWidget*>(widget->GetNativeData(NS_NATIVE_WINDOW));
if (qWidget)
event.root = qWidget->x11Info().appRootWindow();
// deduce keycode from the information in the attached QKeyEvent
const QKeyEvent* qtEvent = static_cast<const QKeyEvent*>(anEvent.pluginEvent);
if (qtEvent) {
if (qtEvent->nativeModifiers())
event.state = qtEvent->nativeModifiers();
else // fallback
event.state = XInputEventState(keyEvent);
if (qtEvent->nativeScanCode())
event.keycode = qtEvent->nativeScanCode();
else // fallback
event.keycode = XKeysymToKeycode( (widget ? static_cast<Display*>(widget->GetNativeData(NS_NATIVE_DISPLAY)) : nsnull), qtEvent->key());
}
switch (anEvent.message)
{
case NS_KEY_DOWN:
event.type = XKeyPress;
break;
case NS_KEY_UP:
event.type = KeyRelease;
break;
}
#endif
// Information that could be obtained from pluginEvent but we may not
// want to promise to provide:
event.subwindow = None;
event.x = 0;
event.y = 0;
event.x_root = -1;
event.y_root = -1;
event.same_screen = False;
XEvent be;
be.xkey = event;
XID target;
XID root;
int wx, wy;
unsigned int width, height, border_width, depth;
//printf("xkey: %d %d %d\n", anEvent.message, be.xkey.keycode, be.xkey.state);
XID w = (XID)mPluginWindow->window;
XGetGeometry(DefaultXDisplay(), w, &root, &wx, &wy, &width, &height, &border_width, &depth);
find_dest_id(w, &root, &target, mLastPoint.x + wx, mLastPoint.y + wy);
be.xkey.window = target;
XSendEvent (DefaultXDisplay(), target,
FALSE, event.type == XKeyPress ? KeyPressMask : KeyReleaseMask, &be);
}
else
{
// If we need to send synthesized key events, then
// DOMKeyCodeToGdkKeyCode(keyEvent.keyCode) and
// gdk_keymap_get_entries_for_keyval will be useful, but the
// mappings will not be unique.
NS_WARNING("Synthesized key event not sent to plugin");
}
break;
default:
switch (anEvent.message)
{
case NS_FOCUS_CONTENT:
case NS_BLUR_CONTENT:
{
XFocusChangeEvent &event = pluginEvent.xfocus;
event.type =
anEvent.message == NS_FOCUS_CONTENT ? FocusIn : FocusOut;
// information lost:
event.mode = -1;
event.detail = NotifyDetailNone;
}
break;
}
}
if (!pluginEvent.type) {
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("Unhandled event message %d with struct type %d\n",
anEvent.message, anEvent.eventStructType));
return rv;
}
// Fill in (useless) generic event information.
XAnyEvent& event = pluginEvent.xany;
event.display = widget ?
static_cast<Display*>(widget->GetNativeData(NS_NATIVE_DISPLAY)) : nsnull;
event.window = None; // not a real window
// information lost:
event.serial = 0;
event.send_event = False;
#if 0
/* we've sent the event via XSendEvent so don't send it directly to the plugin */
PRInt16 response = kNPEventNotHandled;
mInstance->HandleEvent(&pluginEvent, &response);
if (response == kNPEventHandled)
rv = nsEventStatus_eConsumeNoDefault;
#endif
return rv;
}
#endif
nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
{
// printf("nsGUIEvent.message: %d\n", anEvent.message);
#ifdef MOZ_COMPOSITED_PLUGINS
if (mPluginWindow && (mPluginWindow->type != NPWindowTypeDrawable))
return ProcessEventX11Composited(anEvent);
#endif
nsEventStatus rv = nsEventStatus_eIgnore;
if (!mInstance || !mObjectFrame) // if mInstance is null, we shouldn't be here
@ -6040,9 +5684,6 @@ nsPluginInstanceOwner::Renderer::DrawWithXlib(gfxXlibSurface* xsurface,
}
#endif
#ifdef MOZ_COMPOSITED_PLUGINS
if (mWindow->type == NPWindowTypeDrawable)
#endif
{
if (doupdatewindow)
instance->SetWindow(mWindow);
@ -6063,9 +5704,7 @@ nsPluginInstanceOwner::Renderer::DrawWithXlib(gfxXlibSurface* xsurface,
if (!dirtyRect.IntersectRect(dirtyRect, clipRect))
return NS_OK;
#ifdef MOZ_COMPOSITED_PLUGINS
if (mWindow->type == NPWindowTypeDrawable) {
#endif
{
XEvent pluginEvent = XEvent();
XGraphicsExposeEvent& exposeEvent = pluginEvent.xgraphicsexpose;
// set the drawing info
@ -6084,34 +5723,7 @@ nsPluginInstanceOwner::Renderer::DrawWithXlib(gfxXlibSurface* xsurface,
exposeEvent.minor_code = 0;
instance->HandleEvent(&pluginEvent, nsnull);
#ifdef MOZ_COMPOSITED_PLUGINS
}
else {
/* XXX: this is very nasty. We need a better way of getting at mPlugWindow */
GtkWidget *plug = (GtkWidget*)(((nsPluginNativeWindow*)mWindow)->mPlugWindow);
//GtkWidget *plug = (GtkWidget*)(((nsPluginNativeWindowGtk2*)mWindow)->mSocketWidget);
/* Cairo has bugs with IncludeInferiors when using paint
* so we use XCopyArea directly instead. */
XGCValues gcv;
gcv.subwindow_mode = IncludeInferiors;
gcv.graphics_exposures = False;
Drawable drawable = xsurface->XDrawable();
GC gc = XCreateGC(DefaultXDisplay(), drawable, GCGraphicsExposures | GCSubwindowMode, &gcv);
/* The source and destination appear to always line up, so src and dest
* coords should be the same */
XCopyArea(DefaultXDisplay(), gdk_x11_drawable_get_xid(plug->window),
drawable,
gc,
mDirtyRect.x,
mDirtyRect.y,
mDirtyRect.width,
mDirtyRect.height,
mDirtyRect.x,
mDirtyRect.y);
XFreeGC(DefaultXDisplay(), gc);
}
#endif
return NS_OK;
}
#endif