summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/Plugins/Netscape/x11
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape/x11')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp334
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h76
2 files changed, 216 insertions, 194 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
index c22bc74a2..2bed46aab 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
@@ -25,14 +25,17 @@
*/
#include "config.h"
+#include "NetscapePluginX11.h"
+
#if PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
#include "NetscapePlugin.h"
-
#include "PluginController.h"
#include "WebEvent.h"
#include <WebCore/GraphicsContext.h>
#include <WebCore/NotImplemented.h>
+#include <WebCore/PlatformDisplayX11.h>
+#include <WebCore/XUniquePtr.h>
#if PLATFORM(GTK)
#include <gtk/gtk.h>
@@ -41,8 +44,6 @@
#endif
#include <gdk/gdkx.h>
#include <WebCore/GtkVersioning.h>
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
-#include <Ecore_X.h>
#endif
#if USE(CAIRO)
@@ -55,16 +56,19 @@ using namespace WebCore;
namespace WebKit {
+static inline Display* x11HostDisplay()
+{
+ return downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
+}
+
static Display* getPluginDisplay()
{
#if PLATFORM(GTK)
// Since we're a gdk/gtk app, we'll (probably?) have the same X connection as any gdk-based
// plugins, so we can return that. We might want to add other implementations here later.
return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
- return static_cast<Display*>(ecore_x_display_get());
#else
- return 0;
+ return nullptr;
#endif
}
@@ -72,8 +76,6 @@ static inline int x11Screen()
{
#if PLATFORM(GTK)
return gdk_screen_get_number(gdk_screen_get_default());
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
- return ecore_x_screen_index_get(ecore_x_default_screen_get());
#else
return 0;
#endif
@@ -83,8 +85,6 @@ static inline int displayDepth()
{
#if PLATFORM(GTK)
return gdk_visual_get_depth(gdk_screen_get_system_visual(gdk_screen_get_default()));
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
- return ecore_x_default_depth_get(NetscapePlugin::x11HostDisplay(), ecore_x_default_screen_get());
#else
return 0;
#endif
@@ -94,19 +94,6 @@ static inline unsigned long rootWindowID()
{
#if PLATFORM(GTK)
return GDK_ROOT_WINDOW();
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
- return ecore_x_window_root_first_get();
-#else
- return 0;
-#endif
-}
-
-Display* NetscapePlugin::x11HostDisplay()
-{
-#if PLATFORM(GTK)
- return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
- return static_cast<Display*>(ecore_x_display_get());
#else
return 0;
#endif
@@ -123,187 +110,165 @@ static gboolean socketPlugRemovedCallback(GtkSocket*)
}
#endif
-bool NetscapePlugin::platformPostInitializeWindowed(bool needsXEmbed, uint64_t windowID)
+std::unique_ptr<NetscapePluginX11> NetscapePluginX11::create(NetscapePlugin& plugin)
{
- m_npWindow.type = NPWindowTypeWindow;
- if (!needsXEmbed) {
+#if PLATFORM(GTK)
+ uint64_t windowID = 0;
+#endif
+ if (plugin.isWindowed()) {
+#if PLATFORM(GTK)
+ // NPPVplugiNeedsXEmbed is a boolean value, but at least the
+ // Flash player plugin is using an 'int' instead.
+ int needsXEmbed = 0;
+ plugin.NPP_GetValue(NPPVpluginNeedsXEmbed, &needsXEmbed);
+ if (needsXEmbed) {
+ windowID = plugin.controller()->createPluginContainer();
+ if (!windowID)
+ return nullptr;
+ } else {
+ notImplemented();
+ return nullptr;
+ }
+#else
notImplemented();
- return false;
+ return nullptr;
+#endif
}
- Display* display = x11HostDisplay();
+ Display* display = getPluginDisplay();
+ if (!display)
+ return nullptr;
#if PLATFORM(GTK)
- // It seems flash needs the socket to be in the same process,
- // I guess it uses gdk_window_lookup(), so we create a new socket here
- // containing a plug with the UI process socket embedded.
- m_platformPluginWidget = gtk_plug_new(static_cast<Window>(windowID));
- GtkWidget* socket = gtk_socket_new();
- g_signal_connect(socket, "plug-removed", G_CALLBACK(socketPlugRemovedCallback), 0);
- gtk_container_add(GTK_CONTAINER(m_platformPluginWidget), socket);
- gtk_widget_show(socket);
- gtk_widget_show(m_platformPluginWidget);
-
- m_npWindow.window = GINT_TO_POINTER(gtk_socket_get_id(GTK_SOCKET(socket)));
- GdkWindow* window = gtk_widget_get_window(socket);
- NPSetWindowCallbackStruct* callbackStruct = static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
- callbackStruct->display = GDK_WINDOW_XDISPLAY(window);
- callbackStruct->visual = GDK_VISUAL_XVISUAL(gdk_window_get_visual(window));
- callbackStruct->depth = gdk_visual_get_depth(gdk_window_get_visual(window));
- callbackStruct->colormap = XCreateColormap(display, GDK_ROOT_WINDOW(), callbackStruct->visual, AllocNone);
-#else
- UNUSED_PARAM(windowID);
+ if (plugin.isWindowed())
+ return std::make_unique<NetscapePluginX11>(plugin, display, windowID);
#endif
- XFlush(display);
-
- callSetWindow();
-
- return true;
+ return std::make_unique<NetscapePluginX11>(plugin, display);
}
-bool NetscapePlugin::platformPostInitializeWindowless()
+NetscapePluginX11::NetscapePluginX11(NetscapePlugin& plugin, Display* display)
+ : m_plugin(plugin)
+ , m_pluginDisplay(display)
{
- Display* display = x11HostDisplay();
- m_npWindow.type = NPWindowTypeDrawable;
- m_npWindow.window = 0;
-
+ Display* hostDisplay = x11HostDisplay();
int depth = displayDepth();
-
- NPSetWindowCallbackStruct* callbackStruct = static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
- callbackStruct->display = display;
- callbackStruct->depth = depth;
+ m_setWindowCallbackStruct.display = hostDisplay;
+ m_setWindowCallbackStruct.depth = depth;
XVisualInfo visualTemplate;
visualTemplate.screen = x11Screen();
visualTemplate.depth = depth;
visualTemplate.c_class = TrueColor;
int numMatching;
- XVisualInfo* visualInfo = XGetVisualInfo(display, VisualScreenMask | VisualDepthMask | VisualClassMask,
- &visualTemplate, &numMatching);
+ XUniquePtr<XVisualInfo> visualInfo(XGetVisualInfo(hostDisplay, VisualScreenMask | VisualDepthMask | VisualClassMask, &visualTemplate, &numMatching));
ASSERT(visualInfo);
- Visual* visual = visualInfo[0].visual;
+ Visual* visual = visualInfo.get()[0].visual;
ASSERT(visual);
- XFree(visualInfo);
-
- callbackStruct->visual = visual;
- callbackStruct->colormap = XCreateColormap(display, rootWindowID(), visual, AllocNone);
-
- callSetWindow();
- return true;
+ m_setWindowCallbackStruct.visual = visual;
+ m_setWindowCallbackStruct.colormap = XCreateColormap(hostDisplay, rootWindowID(), visual, AllocNone);
}
-void NetscapePlugin::platformPreInitialize()
-{
-}
-
-bool NetscapePlugin::platformPostInitialize()
+#if PLATFORM(GTK)
+NetscapePluginX11::NetscapePluginX11(NetscapePlugin& plugin, Display* display, uint64_t windowID)
+ : m_plugin(plugin)
+ , m_pluginDisplay(display)
+ , m_windowID(windowID)
{
- uint64_t windowID = 0;
- // NPPVpluginNeedsXEmbed is a boolean value, but at least the
- // Flash player plugin is using an 'int' instead.
- int needsXEmbed = 0;
- if (m_isWindowed) {
- NPP_GetValue(NPPVpluginNeedsXEmbed, &needsXEmbed);
- if (needsXEmbed) {
- windowID = controller()->createPluginContainer();
- if (!windowID)
- return false;
- } else {
- notImplemented();
- return false;
- }
- }
+ // It seems flash needs the socket to be in the same process,
+ // I guess it uses gdk_window_lookup(), so we create a new socket here
+ // containing a plug with the UI process socket embedded.
+ m_platformPluginWidget = gtk_plug_new(static_cast<Window>(windowID));
- if (!(m_pluginDisplay = getPluginDisplay()))
- return false;
+ // Hide the GtkPlug on delete-event since we assume the widget is valid while the plugin is active.
+ // platformDestroy() will be called anyway right after the delete-event.
+ g_signal_connect(m_platformPluginWidget, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), nullptr);
- NPSetWindowCallbackStruct* callbackStruct = new NPSetWindowCallbackStruct;
- callbackStruct->type = 0;
- m_npWindow.ws_info = callbackStruct;
+ GtkWidget* socket = gtk_socket_new();
+ // Do not show the plug widget until the socket is connected.
+ g_signal_connect_swapped(socket, "plug-added", G_CALLBACK(gtk_widget_show), m_platformPluginWidget);
+ g_signal_connect(socket, "plug-removed", G_CALLBACK(socketPlugRemovedCallback), nullptr);
+ gtk_container_add(GTK_CONTAINER(m_platformPluginWidget), socket);
+ gtk_widget_show(socket);
- if (m_isWindowed)
- return platformPostInitializeWindowed(needsXEmbed, windowID);
+ Display* hostDisplay = x11HostDisplay();
+ m_npWindowID = gtk_socket_get_id(GTK_SOCKET(socket));
+ GdkWindow* window = gtk_widget_get_window(socket);
+ m_setWindowCallbackStruct.display = GDK_WINDOW_XDISPLAY(window);
+ m_setWindowCallbackStruct.visual = GDK_VISUAL_XVISUAL(gdk_window_get_visual(window));
+ m_setWindowCallbackStruct.depth = gdk_visual_get_depth(gdk_window_get_visual(window));
+ m_setWindowCallbackStruct.colormap = XCreateColormap(hostDisplay, GDK_ROOT_WINDOW(), m_setWindowCallbackStruct.visual, AllocNone);
- return platformPostInitializeWindowless();
+ XFlush(hostDisplay);
}
+#endif
-void NetscapePlugin::platformDestroy()
+NetscapePluginX11::~NetscapePluginX11()
{
- NPSetWindowCallbackStruct* callbackStruct = static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
- Display* hostDisplay = x11HostDisplay();
- XFreeColormap(hostDisplay, callbackStruct->colormap);
- delete callbackStruct;
+ XFreeColormap(x11HostDisplay(), m_setWindowCallbackStruct.colormap);
- if (m_drawable) {
- XFreePixmap(hostDisplay, m_drawable);
- m_drawable = 0;
- }
+ m_drawable.reset();
#if PLATFORM(GTK)
- if (m_platformPluginWidget) {
+ if (m_platformPluginWidget)
gtk_widget_destroy(m_platformPluginWidget);
- m_platformPluginWidget = 0;
- }
#endif
}
-bool NetscapePlugin::platformInvalidate(const IntRect&)
+NPWindowType NetscapePluginX11::windowType() const
{
- notImplemented();
- return false;
+ return m_plugin.isWindowed() ? NPWindowTypeWindow : NPWindowTypeDrawable;
+}
+
+void* NetscapePluginX11::window() const
+{
+#if PLATFORM(GTK)
+ return m_plugin.isWindowed() ? GINT_TO_POINTER(m_npWindowID) : nullptr;
+#else
+ return nullptr;
+#endif
}
-void NetscapePlugin::platformGeometryDidChange()
+void NetscapePluginX11::geometryDidChange()
{
- if (m_isWindowed) {
+ if (m_plugin.isWindowed()) {
uint64_t windowID = 0;
#if PLATFORM(GTK)
+ if (!gtk_plug_get_embedded(GTK_PLUG(m_platformPluginWidget)))
+ return;
windowID = static_cast<uint64_t>(GDK_WINDOW_XID(gtk_plug_get_socket_window(GTK_PLUG(m_platformPluginWidget))));
#endif
- controller()->windowedPluginGeometryDidChange(m_frameRectInWindowCoordinates, m_clipRect, windowID);
+ m_plugin.controller()->windowedPluginGeometryDidChange(m_plugin.frameRectInWindowCoordinates(), m_plugin.clipRect(), windowID);
return;
}
- Display* display = x11HostDisplay();
- if (m_drawable)
- XFreePixmap(display, m_drawable);
-
- if (m_pluginSize.isEmpty()) {
- m_drawable = 0;
+ m_drawable.reset();
+ if (m_plugin.size().isEmpty())
return;
- }
-
- m_drawable = XCreatePixmap(display, rootWindowID(), m_pluginSize.width(), m_pluginSize.height(), displayDepth());
- XSync(display, false); // Make sure that the server knows about the Drawable.
+ m_drawable = XCreatePixmap(x11HostDisplay(), rootWindowID(), m_plugin.size().width(), m_plugin.size().height(), displayDepth());
+ XSync(x11HostDisplay(), false); // Make sure that the server knows about the Drawable.
}
-void NetscapePlugin::platformVisibilityDidChange()
+void NetscapePluginX11::visibilityDidChange()
{
- if (!m_isWindowed)
- return;
-
+ ASSERT(m_plugin.isWindowed());
uint64_t windowID = 0;
#if PLATFORM(GTK)
+ if (!gtk_plug_get_embedded(GTK_PLUG(m_platformPluginWidget)))
+ return;
windowID = static_cast<uint64_t>(GDK_WINDOW_XID(gtk_plug_get_socket_window(GTK_PLUG(m_platformPluginWidget))));
#endif
- controller()->windowedPluginVisibilityDidChange(m_isVisible, windowID);
- controller()->windowedPluginGeometryDidChange(m_frameRectInWindowCoordinates, m_clipRect, windowID);
+ m_plugin.controller()->windowedPluginVisibilityDidChange(m_plugin.isVisible(), windowID);
+ m_plugin.controller()->windowedPluginGeometryDidChange(m_plugin.frameRectInWindowCoordinates(), m_plugin.clipRect(), windowID);
}
-void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect, bool /*isSnapshot*/)
+void NetscapePluginX11::paint(GraphicsContext& context, const IntRect& dirtyRect)
{
- if (m_isWindowed)
- return;
-
- if (!m_isStarted) {
- // FIXME: we should paint a missing plugin icon.
- return;
- }
+ ASSERT(!m_plugin.isWindowed());
- if (context->paintingDisabled() || !m_drawable)
+ if (context.paintingDisabled() || !m_drawable)
return;
XEvent xevent;
@@ -311,7 +276,7 @@ void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirt
XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose;
exposeEvent.type = GraphicsExpose;
exposeEvent.display = x11HostDisplay();
- exposeEvent.drawable = m_drawable;
+ exposeEvent.drawable = m_drawable.get();
IntRect exposedRect(dirtyRect);
exposeEvent.x = exposedRect.x();
@@ -322,18 +287,15 @@ void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirt
exposeEvent.width = exposedRect.width();
exposeEvent.height = exposedRect.height();
- NPP_HandleEvent(&xevent);
+ m_plugin.NPP_HandleEvent(&xevent);
if (m_pluginDisplay != x11HostDisplay())
XSync(m_pluginDisplay, false);
-#if PLATFORM(GTK) || (PLATFORM(EFL) && USE(CAIRO))
- RefPtr<cairo_surface_t> drawableSurface = adoptRef(cairo_xlib_surface_create(m_pluginDisplay,
- m_drawable,
- static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info)->visual,
- m_pluginSize.width(),
- m_pluginSize.height()));
- cairo_t* cr = context->platformContext()->cr();
+#if PLATFORM(GTK)
+ RefPtr<cairo_surface_t> drawableSurface = adoptRef(cairo_xlib_surface_create(m_pluginDisplay, m_drawable.get(),
+ m_setWindowCallbackStruct.visual, m_plugin.size().width(), m_plugin.size().height()));
+ cairo_t* cr = context.platformContext()->cr();
cairo_save(cr);
cairo_set_source_surface(cr, drawableSurface.get(), 0, 0);
@@ -354,7 +316,7 @@ static inline void initializeXEvent(XEvent& event)
memset(&event, 0, sizeof(XEvent));
event.xany.serial = 0;
event.xany.send_event = false;
- event.xany.display = NetscapePlugin::x11HostDisplay();
+ event.xany.display = x11HostDisplay();
event.xany.window = 0;
}
@@ -452,15 +414,9 @@ static inline void setXCrossingEventFields(XEvent& xEvent, const WebMouseEvent&
xCrossing.focus = false;
}
-bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event)
+bool NetscapePluginX11::handleMouseEvent(const WebMouseEvent& event)
{
- if (m_isWindowed)
- return false;
-
- if ((event.type() == WebEvent::MouseDown || event.type() == WebEvent::MouseUp)
- && event.button() == WebMouseEvent::RightButton
- && quirks().contains(PluginQuirks::IgnoreRightClickInWindowlessMode))
- return false;
+ ASSERT(!m_plugin.isWindowed());
XEvent xEvent;
initializeXEvent(xEvent);
@@ -468,22 +424,20 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event)
switch (event.type()) {
case WebEvent::MouseDown:
case WebEvent::MouseUp:
- setXButtonEventFields(xEvent, event, convertToRootView(IntPoint()));
+ setXButtonEventFields(xEvent, event, m_plugin.convertToRootView(IntPoint()));
break;
case WebEvent::MouseMove:
- setXMotionEventFields(xEvent, event, convertToRootView(IntPoint()));
+ setXMotionEventFields(xEvent, event, m_plugin.convertToRootView(IntPoint()));
break;
+ case WebEvent::MouseForceChanged:
+ case WebEvent::MouseForceDown:
+ case WebEvent::MouseForceUp:
case WebEvent::NoType:
case WebEvent::Wheel:
case WebEvent::KeyDown:
case WebEvent::KeyUp:
case WebEvent::RawKeyDown:
case WebEvent::Char:
-#if ENABLE(GESTURE_EVENTS)
- case WebEvent::GestureScrollBegin:
- case WebEvent::GestureScrollEnd:
- case WebEvent::GestureSingleTap:
-#endif
#if ENABLE(TOUCH_EVENTS)
case WebEvent::TouchStart:
case WebEvent::TouchMove:
@@ -493,7 +447,7 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event)
return false;
}
- return !NPP_HandleEvent(&xEvent);
+ return !m_plugin.NPP_HandleEvent(&xEvent);
}
// We undefine these constants in npruntime_internal.h to avoid collision
@@ -503,22 +457,20 @@ const int kKeyReleaseType = 3;
const int kFocusInType = 9;
const int kFocusOutType = 10;
-bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent& event)
+bool NetscapePluginX11::handleWheelEvent(const WebWheelEvent& event)
{
- if (m_isWindowed)
- return false;
+ ASSERT(!m_plugin.isWindowed());
XEvent xEvent;
initializeXEvent(xEvent);
- setXButtonEventFieldsByWebWheelEvent(xEvent, event, convertToRootView(IntPoint()));
+ setXButtonEventFieldsByWebWheelEvent(xEvent, event, m_plugin.convertToRootView(IntPoint()));
- return !NPP_HandleEvent(&xEvent);
+ return !m_plugin.NPP_HandleEvent(&xEvent);
}
-void NetscapePlugin::platformSetFocus(bool focusIn)
+void NetscapePluginX11::setFocus(bool focusIn)
{
- if (m_isWindowed)
- return;
+ ASSERT(!m_plugin.isWindowed());
XEvent xEvent;
initializeXEvent(xEvent);
@@ -527,36 +479,29 @@ void NetscapePlugin::platformSetFocus(bool focusIn)
focusEvent.mode = NotifyNormal;
focusEvent.detail = NotifyDetailNone;
- NPP_HandleEvent(&xEvent);
-}
-
-bool NetscapePlugin::wantsPluginRelativeNPWindowCoordinates()
-{
- return true;
+ m_plugin.NPP_HandleEvent(&xEvent);
}
-bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event)
+bool NetscapePluginX11::handleMouseEnterEvent(const WebMouseEvent& event)
{
- if (m_isWindowed)
- return false;
+ ASSERT(!m_plugin.isWindowed());
XEvent xEvent;
initializeXEvent(xEvent);
- setXCrossingEventFields(xEvent, event, convertToRootView(IntPoint()), EnterNotify);
+ setXCrossingEventFields(xEvent, event, m_plugin.convertToRootView(IntPoint()), EnterNotify);
- return !NPP_HandleEvent(&xEvent);
+ return !m_plugin.NPP_HandleEvent(&xEvent);
}
-bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event)
+bool NetscapePluginX11::handleMouseLeaveEvent(const WebMouseEvent& event)
{
- if (m_isWindowed)
- return false;
+ ASSERT(!m_plugin.isWindowed());
XEvent xEvent;
initializeXEvent(xEvent);
- setXCrossingEventFields(xEvent, event, convertToRootView(IntPoint()), LeaveNotify);
+ setXCrossingEventFields(xEvent, event, m_plugin.convertToRootView(IntPoint()), LeaveNotify);
- return !NPP_HandleEvent(&xEvent);
+ return !m_plugin.NPP_HandleEvent(&xEvent);
}
static inline void setXKeyEventFields(XEvent& xEvent, const WebKeyboardEvent& webEvent)
@@ -579,8 +524,9 @@ static inline void setXKeyEventFields(XEvent& xEvent, const WebKeyboardEvent& we
xKey.y_root = 0;
}
-bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent& event)
+bool NetscapePluginX11::handleKeyboardEvent(const WebKeyboardEvent& event)
{
+ ASSERT(!m_plugin.isWindowed());
// We don't generate other types of keyboard events via WebEventFactory.
ASSERT(event.type() == WebEvent::KeyDown || event.type() == WebEvent::KeyUp);
@@ -588,7 +534,7 @@ bool NetscapePlugin::platformHandleKeyboardEvent(const WebKeyboardEvent& event)
initializeXEvent(xEvent);
setXKeyEventFields(xEvent, event);
- return !NPP_HandleEvent(&xEvent);
+ return !m_plugin.NPP_HandleEvent(&xEvent);
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h
new file mode 100644
index 000000000..0fe50a1a6
--- /dev/null
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetscapePluginX11_h
+#define NetscapePluginX11_h
+
+#if PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+
+#include "NetscapePluginUnix.h"
+#include <WebCore/XUniqueResource.h>
+
+namespace WebKit {
+
+class NetscapePlugin;
+
+class NetscapePluginX11 final : public NetscapePluginUnix {
+public:
+ static std::unique_ptr<NetscapePluginX11> create(NetscapePlugin&);
+ NetscapePluginX11(NetscapePlugin&, Display*);
+#if PLATFORM(GTK)
+ NetscapePluginX11(NetscapePlugin&, Display*, uint64_t windowID);
+#endif
+ virtual ~NetscapePluginX11();
+
+private:
+ NPWindowType windowType() const override;
+ void* window() const override;
+ NPSetWindowCallbackStruct* windowSystemInfo() override { return &m_setWindowCallbackStruct; }
+ void geometryDidChange() override;
+ void visibilityDidChange() override;
+ void paint(WebCore::GraphicsContext&, const WebCore::IntRect&) override;
+ bool handleMouseEvent(const WebMouseEvent&) override;
+ bool handleWheelEvent(const WebWheelEvent&) override;
+ bool handleMouseEnterEvent(const WebMouseEvent&) override;
+ bool handleMouseLeaveEvent(const WebMouseEvent&) override;
+ bool handleKeyboardEvent(const WebKeyboardEvent&) override;
+ void setFocus(bool) override;
+
+ NetscapePlugin& m_plugin;
+ Display* m_pluginDisplay { nullptr };
+ WebCore::XUniquePixmap m_drawable;
+ NPSetWindowCallbackStruct m_setWindowCallbackStruct;
+#if PLATFORM(GTK)
+ uint64_t m_windowID { 0 };
+ unsigned long m_npWindowID { 0 };
+ GtkWidget* m_platformPluginWidget { nullptr };
+#endif
+};
+} // namespace WebKit
+
+#endif // PLUGIN_ARCHITECTURE(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+
+#endif // NetscapePluginX11_h