зеркало из https://github.com/mozilla/gecko-dev.git
Bug 442109 - youtube videos don't play; r=vladimir
This commit is contained in:
Родитель
10ba7084fc
Коммит
fabd738e33
|
@ -302,6 +302,8 @@ PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@
|
|||
XCFLAGS = @XCFLAGS@
|
||||
XLDFLAGS = @XLDFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
XEXT_LIBS = @XEXT_LIBS@
|
||||
XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
|
||||
|
||||
WIN_TOP_SRC = @WIN_TOP_SRC@
|
||||
CYGWIN_WRAPPER = @CYGWIN_WRAPPER@
|
||||
|
|
|
@ -885,6 +885,8 @@ X11/extensions/shape.h
|
|||
X11/extensions/XIElib.h
|
||||
X11/extensions/XShm.h
|
||||
X11/extensions/Xrender.h
|
||||
X11/extensions/Xdamage.h
|
||||
X11/extensions/Xcomposite.h
|
||||
X11/Intrinsic.h
|
||||
X11/keysymdef.h
|
||||
X11/keysym.h
|
||||
|
|
13
configure.in
13
configure.in
|
@ -3165,7 +3165,7 @@ else
|
|||
[MISSING_X="$MISSING_X -lX11"], $XLIBS)
|
||||
AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
|
||||
[MISSING_X="$MISSING_X -lXext"], $XLIBS)
|
||||
|
||||
echo "green"
|
||||
|
||||
AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
|
||||
unset ac_cv_lib_Xt_XtFree
|
||||
|
@ -3256,6 +3256,7 @@ fi # $no_x
|
|||
AC_SUBST(XCFLAGS)
|
||||
AC_SUBST(XLDFLAGS)
|
||||
AC_SUBST(XLIBS)
|
||||
AC_SUBST(XEXT_LIBS)
|
||||
AC_SUBST(XT_LIBS)
|
||||
|
||||
AC_MSG_CHECKING(for ARM SIMD support)
|
||||
|
@ -6234,10 +6235,20 @@ PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
|
|||
MOZ_PLATFORM_HILDON=)
|
||||
if test $MOZ_PLATFORM_HILDON; then
|
||||
AC_DEFINE(MOZ_PLATFORM_HILDON)
|
||||
X11_COMPOSITED_PLUGINS="yes"
|
||||
fi
|
||||
AC_SUBST(LIBHILDONMIME_CFLAGS)
|
||||
AC_SUBST(LIBHILDONMIME_LIBS)
|
||||
|
||||
if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
|
||||
dnl if we have Xcomposite we should also have Xdamage and Xfixes
|
||||
AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
|
||||
[AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
|
||||
AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
|
||||
[MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
|
||||
fi
|
||||
AC_SUBST(XCOMPOSITE_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSSO,libosso,
|
||||
NS_OSSO=1,
|
||||
NS_OSSO=)
|
||||
|
|
|
@ -167,9 +167,15 @@ enum { XKeyPress = KeyPress };
|
|||
#ifdef KeyPress
|
||||
#undef KeyPress
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#define MOZ_COMPOSITED_PLUGINS 1
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -494,6 +500,10 @@ private:
|
|||
char **mCachedAttrParamNames;
|
||||
char **mCachedAttrParamValues;
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
nsIntPoint mLastPoint;
|
||||
#endif
|
||||
|
||||
// pointer to wrapper for nsIDOMContextMenuListener
|
||||
nsRefPtr<nsPluginDOMContextMenuListener> mCXMenuListener;
|
||||
|
||||
|
@ -503,6 +513,10 @@ private:
|
|||
|
||||
nsresult EnsureCachedAttrParamArrays();
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
nsEventStatus ProcessEventX11Composited(const nsGUIEvent & anEvent);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
class Renderer : public gfxGdkNativeRenderer {
|
||||
public:
|
||||
|
@ -1400,8 +1414,11 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
|||
if (mInstanceOwner) {
|
||||
nsPluginWindow * window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
{
|
||||
#else
|
||||
if (window->type == nsPluginWindowType_Drawable) {
|
||||
#endif
|
||||
gfxRect frameGfxRect =
|
||||
PresContext()->AppUnitsToGfxUnits(nsRect(aFramePt, GetSize()));
|
||||
gfxRect dirtyGfxRect =
|
||||
|
@ -2215,6 +2232,10 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
|||
mDestroyWidget = PR_FALSE;
|
||||
mTimerCanceled = PR_TRUE;
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
mLastPoint = nsIntPoint(0,0);
|
||||
#endif
|
||||
|
||||
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
|
||||
("nsPluginInstanceOwner %p created\n", this));
|
||||
}
|
||||
|
@ -3507,7 +3528,7 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
|
||||
nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
#ifndef XP_MACOSX
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
return aKeyEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
|
@ -3568,7 +3589,7 @@ nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent)
|
|||
nsresult
|
||||
nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX)
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
|
@ -3629,12 +3650,11 @@ nsPluginInstanceOwner::MouseOut(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX)
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
|
||||
// don't send mouse events if we are hidden
|
||||
if (!mWidgetVisible)
|
||||
return NS_OK;
|
||||
|
@ -3685,9 +3705,302 @@ static unsigned int XInputEventState(const nsInputEvent& anEvent)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
static void find_dest_id(XID top, XID *root, XID *dest, unsigned int target_x, unsigned int target_y)
|
||||
{
|
||||
XID target_id = top;
|
||||
XID parent;
|
||||
XID *children;
|
||||
unsigned int nchildren;
|
||||
while (1) {
|
||||
loop:
|
||||
//printf("searching %x\n", target_id);
|
||||
XQueryTree(GDK_DISPLAY(), target_id, root, &parent, &children, &nchildren);
|
||||
if (nchildren > 0) {
|
||||
for (unsigned int i=0; i<nchildren; i++) {
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
unsigned int border_width, depth;
|
||||
XGetGeometry(GDK_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 + width) &&
|
||||
target_y <= (y + 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;
|
||||
} else {
|
||||
/* we have no children */
|
||||
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 || !mOwner) // if mInstance is null, we shouldn't be here
|
||||
return rv;
|
||||
|
||||
// this code supports windowless plugins
|
||||
nsIWidget* widget = anEvent.widget;
|
||||
nsPluginEvent pluginEvent;
|
||||
pluginEvent.event.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 = mOwner->PresContext();
|
||||
nsPoint appPoint =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mOwner);
|
||||
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();
|
||||
#else
|
||||
Window root = None; // Could XQueryTree, but this is not important.
|
||||
#endif
|
||||
|
||||
switch (anEvent.message)
|
||||
{
|
||||
case NS_MOUSE_ENTER_SYNTH:
|
||||
case NS_MOUSE_EXIT_SYNTH:
|
||||
{
|
||||
XCrossingEvent& event = pluginEvent.event.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.event.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.event.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.event.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(GDK_DISPLAY(), 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 (GDK_DISPLAY(), target,
|
||||
FALSE, event.type == ButtonPress ? ButtonPressMask : ButtonReleaseMask, &be);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//XXX case NS_MOUSE_SCROLL_EVENT: not received.
|
||||
|
||||
case NS_KEY_EVENT:
|
||||
if (anEvent.nativeMsg)
|
||||
{
|
||||
XKeyEvent &event = pluginEvent.event.xkey;
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
event.root = GDK_ROOT_WINDOW();
|
||||
event.time = anEvent.time;
|
||||
const GdkEventKey* gdkEvent =
|
||||
static_cast<const GdkEventKey*>(anEvent.nativeMsg);
|
||||
event.keycode = gdkEvent->hardware_keycode;
|
||||
event.state = gdkEvent->state;
|
||||
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 nativeMsg 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(GDK_DISPLAY(), 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 (GDK_DISPLAY(), 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.event.xfocus;
|
||||
event.type =
|
||||
anEvent.message == NS_FOCUS_CONTENT ? FocusIn : FocusOut;
|
||||
// information lost:
|
||||
event.mode = -1;
|
||||
event.detail = NotifyDetailNone;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pluginEvent.event.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.event.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;
|
||||
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
/* we've sent the event via XSendEvent so don't send it directly to the plugin */
|
||||
//mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
if (eventHandled)
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
{
|
||||
// printf("nsGUIEvent.message: %d\n", anEvent.message);
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
if (mPluginWindow && mPluginWindow->type != nsPluginWindowType_Drawable)
|
||||
return ProcessEventX11Composited(anEvent);
|
||||
#endif
|
||||
|
||||
nsEventStatus rv = nsEventStatus_eIgnore;
|
||||
if (!mInstance || !mOwner) // if mInstance is null, we shouldn't be here
|
||||
return rv;
|
||||
|
@ -4339,8 +4652,10 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_COMPOSITED_PLUGINS
|
||||
if (doupdatewindow)
|
||||
mInstance->SetWindow(mWindow);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// Translate the dirty rect to drawable coordinates.
|
||||
|
@ -4350,6 +4665,7 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
|||
if (!dirtyRect.IntersectRect(dirtyRect, clipRect))
|
||||
return NS_OK;
|
||||
|
||||
#ifndef MOZ_COMPOSITED_PLUGINS
|
||||
nsPluginEvent pluginEvent;
|
||||
XGraphicsExposeEvent& exposeEvent = pluginEvent.event.xgraphicsexpose;
|
||||
// set the drawing info
|
||||
|
@ -4375,7 +4691,32 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
|||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
/* 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;
|
||||
GC gc = XCreateGC(GDK_DISPLAY(), gdk_x11_drawable_get_xid(drawable), GCGraphicsExposures | GCSubwindowMode, &gcv);
|
||||
/* The source and destination appear to always line up, so src and dest
|
||||
* coords should be the same */
|
||||
XCopyArea(GDK_DISPLAY(), gdk_x11_drawable_get_xid(plug->window),
|
||||
gdk_x11_drawable_get_xid(drawable),
|
||||
gc,
|
||||
mDirtyRect.x,
|
||||
mDirtyRect.y,
|
||||
mDirtyRect.width,
|
||||
mDirtyRect.height,
|
||||
mDirtyRect.x,
|
||||
mDirtyRect.y);
|
||||
XFreeGC(GDK_DISPLAY(), gc);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -103,6 +103,15 @@ public:
|
|||
SetPluginInstance(aPluginInstance);
|
||||
return NS_OK;
|
||||
}
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#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:
|
||||
nsCOMPtr<nsIPluginInstance> mPluginInstance;
|
||||
|
|
|
@ -159,5 +159,5 @@ endif
|
|||
ifdef MOZ_ENABLE_GTK2
|
||||
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
|
||||
CFLAGS += $(MOZ_GTK2_CFLAGS)
|
||||
EXTRA_DSO_LDOPTS += -lgtkxtbin $(XLDFLAGS) $(XT_LIBS) $(MOZ_GTK2_LIBS) $(XLIBS)
|
||||
EXTRA_DSO_LDOPTS += -lgtkxtbin $(XLDFLAGS) $(XT_LIBS) $(MOZ_GTK2_LIBS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS)
|
||||
endif #MOZ_ENABLE_GTK2
|
||||
|
|
|
@ -48,6 +48,18 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#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"
|
||||
#ifdef OJI
|
||||
#include "plstr.h"
|
||||
|
@ -74,6 +86,15 @@ private:
|
|||
nsresult CreateXtWindow();
|
||||
void SetAllocation();
|
||||
PRBool CanGetValueFromPlugin(nsCOMPtr<nsIPluginInstance> &aPluginInstance);
|
||||
#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);
|
||||
|
@ -95,6 +116,10 @@ nsPluginNativeWindowGtk2::nsPluginNativeWindowGtk2() : nsPluginNativeWindow()
|
|||
mWsInfo.visual = nsnull;
|
||||
mWsInfo.colormap = 0;
|
||||
mWsInfo.depth = 0;
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
mDamage = 0;
|
||||
mParentWindow = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsPluginNativeWindowGtk2::~nsPluginNativeWindowGtk2()
|
||||
|
@ -102,6 +127,16 @@ 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)
|
||||
|
@ -119,6 +154,49 @@ 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;
|
||||
XserverRegion parts;
|
||||
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);
|
||||
parts = XFixesCreateRegion (GDK_DISPLAY(), 0, 0);
|
||||
XDamageSubtract (GDK_DISPLAY(), native_window->mDamage, None, parts);
|
||||
|
||||
/* We try to do our area invalidation here */
|
||||
nsPluginRect 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;
|
||||
|
||||
/* There might be a better way to do this? */
|
||||
if (native_window->mPluginInstance) {
|
||||
nsCOMPtr<nsIPluginInstancePeer> peer;
|
||||
if (NS_SUCCEEDED(native_window->mPluginInstance->GetPeer(getter_AddRefs(peer))) && peer) {
|
||||
nsCOMPtr<nsIWindowlessPluginInstancePeer> wpeer(do_QueryInterface(peer));
|
||||
if (wpeer) {
|
||||
// XXX nsRect & NPRect are structurally equivalent
|
||||
wpeer->InvalidateRect(&rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_FILTER_REMOVE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if(aPluginInstance) {
|
||||
|
@ -134,7 +212,11 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aP
|
|||
#endif
|
||||
}
|
||||
if(needXEmbed) {
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
CreateXCompositedWindow();
|
||||
#else
|
||||
CreateXEmbedWindow();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
CreateXtWindow();
|
||||
|
@ -215,6 +297,82 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
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 = (nsPluginPort *)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);
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -228,7 +228,7 @@ EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
|
|||
endif
|
||||
|
||||
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
|
||||
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(MOZ_PANGO_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) -lgthread-2.0
|
||||
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) -lgthread-2.0
|
||||
EXTRA_DSO_LDOPTS += $(FT2_LIBS)
|
||||
endif
|
||||
|
||||
|
|
|
@ -138,6 +138,8 @@ EXTRA_DSO_LDOPTS += \
|
|||
$(MOZ_STARTUP_NOTIFICATION_LIBS) \
|
||||
$(XLDFLAGS) \
|
||||
$(XLIBS) \
|
||||
$(XEXT_LIBS) \
|
||||
$(XCOMPOSITE_LIBS) \
|
||||
$(MOZ_GTK2_LIBS) \
|
||||
-lthebes \
|
||||
$(LCMS_LIBS) \
|
||||
|
|
|
@ -122,7 +122,7 @@ LIBS += \
|
|||
|
||||
# Add explicit X11 dependency when building against X11 toolkits
|
||||
ifneq (,$(filter gtk gtk2 xlib,$(MOZ_WIDGET_TOOLKIT)))
|
||||
LIBS += $(XLDFLAGS) $(XLIBS)
|
||||
LIBS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
|
|
Загрузка…
Ссылка в новой задаче