Title: [121445] trunk/Source/WebCore
Revision
121445
Author
[email protected]
Date
2012-06-28 11:15:17 -0700 (Thu, 28 Jun 2012)

Log Message

[GTK] Remove Windows support from plugins/gtk/
https://bugs.webkit.org/show_bug.cgi?id=89501

Patch by Kalev Lember <[email protected]> on 2012-06-28
Reviewed by Martin Robinson.

The GTK+ port now uses plugins/gtk/ on Windows, which leaves
PluginPackageGtk.cpp and PluginViewGtk.cpp solely for XP_UNIX platforms.

* plugins/gtk/PluginPackageGtk.cpp:
(WebCore::PluginPackage::fetchInfo):
(WebCore::webkitgtkXError):
(WebCore::PluginPackage::load):
* plugins/gtk/PluginViewGtk.cpp:
(WebCore::getRootWindow):
(WebCore::PluginView::updatePluginWidget):
(WebCore::PluginView::paint):
(WebCore::PluginView::handleKeyboardEvent):
(WebCore::setXCrossingEventSpecificFields):
(WebCore::PluginView::handleMouseEvent):
(WebCore::PluginView::handleFocusOutEvent):
(WebCore::PluginView::setNPWindowIfNeeded):
(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue):
(WebCore::getPluginDisplay):
(WebCore::getVisualAndColormap):
(WebCore::PluginView::platformStart):
(WebCore::PluginView::platformDestroy):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121444 => 121445)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 18:09:14 UTC (rev 121444)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 18:15:17 UTC (rev 121445)
@@ -1,3 +1,33 @@
+2012-06-28  Kalev Lember  <[email protected]>
+
+        [GTK] Remove Windows support from plugins/gtk/
+        https://bugs.webkit.org/show_bug.cgi?id=89501
+
+        Reviewed by Martin Robinson.
+
+        The GTK+ port now uses plugins/gtk/ on Windows, which leaves
+        PluginPackageGtk.cpp and PluginViewGtk.cpp solely for XP_UNIX platforms.
+
+        * plugins/gtk/PluginPackageGtk.cpp:
+        (WebCore::PluginPackage::fetchInfo):
+        (WebCore::webkitgtkXError):
+        (WebCore::PluginPackage::load):
+        * plugins/gtk/PluginViewGtk.cpp:
+        (WebCore::getRootWindow):
+        (WebCore::PluginView::updatePluginWidget):
+        (WebCore::PluginView::paint):
+        (WebCore::PluginView::handleKeyboardEvent):
+        (WebCore::setXCrossingEventSpecificFields):
+        (WebCore::PluginView::handleMouseEvent):
+        (WebCore::PluginView::handleFocusOutEvent):
+        (WebCore::PluginView::setNPWindowIfNeeded):
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue):
+        (WebCore::getPluginDisplay):
+        (WebCore::getVisualAndColormap):
+        (WebCore::PluginView::platformStart):
+        (WebCore::PluginView::platformDestroy):
+
 2012-06-28  Simon Fraser  <[email protected]>
 
         Change FrameView::scrollContentsFastPath to use m_fixedObjects

Modified: trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp (121444 => 121445)


--- trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp	2012-06-28 18:09:14 UTC (rev 121444)
+++ trunk/Source/WebCore/plugins/gtk/PluginPackageGtk.cpp	2012-06-28 18:15:17 UTC (rev 121445)
@@ -42,7 +42,6 @@
 
 bool PluginPackage::fetchInfo()
 {
-#if defined(XP_UNIX)
     if (!load())
         return false;
 
@@ -97,13 +96,8 @@
     g_strfreev(mimeDescs);
 
     return true;
-#else
-    notImplemented();
-    return false;
-#endif
 }
 
-#if defined(XP_UNIX)
 static int webkitgtkXError(Display* xdisplay, XErrorEvent* error)
 {
     gchar errorMessage[64];
@@ -117,7 +111,6 @@
               error->request_code, error->minor_code);
     return 0;
 }
-#endif
 
 static bool moduleMixesGtkSymbols(GModule* module)
 {
@@ -167,14 +160,12 @@
 
     m_isLoaded = true;
 
-#if defined(XP_UNIX)
     if (!g_strcmp0(baseName.get(), "libflashplayer.so")) {
         // Flash plugin can produce X errors that are handled by the GDK X error handler, which
         // exits the process. Since we don't want to crash due to flash bugs, we install a
         // custom error handler to show a warning when a X error happens without aborting.
         XSetErrorHandler(webkitgtkXError);
     }
-#endif
 
     NP_InitializeFuncPtr NP_Initialize = 0;
     m_NPP_Shutdown = 0;
@@ -192,11 +183,7 @@
 
     initializeBrowserFuncs();
 
-#if defined(XP_UNIX)
     npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs);
-#else
-    npErr = NP_Initialize(&m_browserFuncs);
-#endif
     if (npErr != NPERR_NO_ERROR)
         goto abort;
 

Modified: trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp (121444 => 121445)


--- trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp	2012-06-28 18:09:14 UTC (rev 121444)
+++ trunk/Source/WebCore/plugins/gtk/PluginViewGtk.cpp	2012-06-28 18:15:17 UTC (rev 121445)
@@ -70,7 +70,6 @@
 #endif
 #include <gtk/gtk.h>
 
-#if defined(XP_UNIX)
 #define String XtStringType
 #include "RefPtrCairo.h"
 #include "gtk2xtbin.h"
@@ -79,11 +78,6 @@
 #include <X11/extensions/Xrender.h>
 #include <cairo/cairo-xlib.h>
 #include <gdk/gdkx.h>
-#elif defined(GDK_WINDOWING_WIN32)
-#include "PluginMessageThrottlerWin.h"
-#include <gdk/gdkwin32.h>
-#undef String
-#endif
 
 using JSC::ExecState;
 using JSC::Interpreter;
@@ -116,14 +110,12 @@
     return accepted;
 }
 
-#if defined(XP_UNIX)
 static Window getRootWindow(Frame* parentFrame)
 {
     GtkWidget* parentWidget = parentFrame->view()->hostWindow()->platformPageClient();
     GdkScreen* gscreen = gtk_widget_get_screen(parentWidget);
     return GDK_WINDOW_XWINDOW(gdk_screen_get_root_window(gscreen));
 }
-#endif
 
 void PluginView::updatePluginWidget()
 {
@@ -146,7 +138,6 @@
     if (m_status != PluginStatusLoadedSuccessfully)
         return;
 
-#if defined(XP_UNIX)
     if (!m_isWindowed && !m_windowRect.isEmpty()) {
         Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
         if (m_drawable)
@@ -157,7 +148,6 @@
                                    ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth);
         XSync(display, false); // make sure that the server knows about the Drawable
     }
-#endif
 
     setNPWindowIfNeeded();
 }
@@ -197,7 +187,6 @@
     if (m_isWindowed)
         return;
 
-#if defined(XP_UNIX)
     if (!m_drawable)
         return;
 
@@ -271,7 +260,6 @@
     cairo_paint(cr);
 
     cairo_restore(cr);
-#endif // defined(XP_UNIX)
 }
 
 void PluginView::handleKeyboardEvent(KeyboardEvent* event)
@@ -285,7 +273,6 @@
         return;
 
     NPEvent xEvent;
-#if defined(XP_UNIX)
     initXEvent(&xEvent);
     GdkEventKey* gdkEvent = event->keyEvent()->gdkEventKey();
 
@@ -305,13 +292,11 @@
     xEvent.xkey.y = 0;
     xEvent.xkey.x_root = 0;
     xEvent.xkey.y_root = 0;
-#endif
 
     if (dispatchNPEvent(xEvent))
         event->setDefaultHandled();
 }
 
-#if defined(XP_UNIX)
 static unsigned int inputEventState(MouseEvent* event)
 {
     unsigned int state = 0;
@@ -402,7 +387,6 @@
     xcrossing.same_screen = true;
     xcrossing.focus = false;
 }
-#endif
 
 void PluginView::handleMouseEvent(MouseEvent* event)
 {
@@ -421,7 +405,6 @@
     }
 
     NPEvent xEvent;
-#if defined(XP_UNIX)
     initXEvent(&xEvent);
 
     IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
@@ -440,13 +423,11 @@
     }
     else
         return;
-#endif
 
     if (dispatchNPEvent(xEvent))
         event->setDefaultHandled();
 }
 
-#if defined(XP_UNIX)
 void PluginView::handleFocusInEvent()
 {
     if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully)
@@ -478,7 +459,6 @@
 
     dispatchNPEvent(npEvent);
 }
-#endif
 
 void PluginView::setParent(ScrollView* parent)
 {
@@ -544,14 +524,12 @@
     if (!m_isWindowed)
         return;
 
-#if defined(XP_UNIX)
     // GtkXtBin will call gtk_widget_size_allocate, so we don't need to do it here.
     if (!m_needsXEmbed) {
         gtk_xtbin_set_position(GTK_XTBIN(platformPluginWidget()), m_windowRect.x(), m_windowRect.y());
         gtk_xtbin_resize(platformPluginWidget(), m_windowRect.width(), m_windowRect.height());
         return;
     }
-#endif
 
     m_delayedAllocation = m_windowRect;
     updateWidgetAllocationAndClip();
@@ -647,20 +625,12 @@
 {
     switch (variable) {
     case NPNVToolkit:
-#if defined(XP_UNIX)
         *static_cast<uint32_t*>(value) = 2;
-#else
-        *static_cast<uint32_t*>(value) = 0;
-#endif
         *result = NPERR_NO_ERROR;
         return true;
 
     case NPNVSupportsXEmbedBool:
-#if defined(XP_UNIX)
         *static_cast<NPBool*>(value) = true;
-#else
-        *static_cast<NPBool*>(value) = false;
-#endif
         *result = NPERR_NO_ERROR;
         return true;
 
@@ -670,11 +640,7 @@
         return true;
 
     case NPNVSupportsWindowless:
-#if defined(XP_UNIX)
         *static_cast<NPBool*>(value) = true;
-#else
-        *static_cast<NPBool*>(value) = false;
-#endif
         *result = NPERR_NO_ERROR;
         return true;
 
@@ -687,18 +653,13 @@
 {
     switch (variable) {
     case NPNVxDisplay:
-#if defined(XP_UNIX)
         if (m_needsXEmbed)
             *(void **)value = (void *)GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
         else
             *(void **)value = (void *)GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay;
         *result = NPERR_NO_ERROR;
-#else
-        *result = NPERR_GENERIC_ERROR;
-#endif
         return true;
 
-#if defined(XP_UNIX)
     case NPNVxtAppContext:
         if (!m_needsXEmbed) {
             *(void **)value = XtDisplayToApplicationContext (GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay);
@@ -707,20 +668,15 @@
         } else
             *result = NPERR_GENERIC_ERROR;
         return true;
-#endif
 
         case NPNVnetscapeWindow: {
             GdkWindow* gdkWindow = gtk_widget_get_window(m_parentFrame->view()->hostWindow()->platformPageClient());
-#if defined(XP_UNIX)
             GdkWindow* toplevelWindow = gdk_window_get_toplevel(gdkWindow);
             if (!toplevelWindow) {
                 *result = NPERR_GENERIC_ERROR;
                 return true;
             }
             *static_cast<Window*>(value) = GDK_WINDOW_XWINDOW(toplevelWindow);
-#elif defined(GDK_WINDOWING_WIN32)
-            *static_cast<HGDIOBJ*>(value) = GDK_WINDOW_HWND(gdkWindow);
-#endif
             *result = NPERR_NO_ERROR;
             return true;
         }
@@ -765,7 +721,6 @@
         gtk_widget_queue_draw(m_parentFrame->view()->hostWindow()->platformPageClient());
 }
 
-#ifndef GDK_WINDOWING_WIN32
 static Display* getPluginDisplay()
 {
     // The plugin toolkit might have a different X connection open.  Since we're
@@ -773,15 +728,9 @@
     // plugins, so we can return that.  We might want to add other implementations here
     // later.
 
-#if defined(XP_UNIX)
     return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-#else
-    return 0;
-#endif
 }
-#endif
 
-#if defined(XP_UNIX)
 static void getVisualAndColormap(int depth, Visual** visual, Colormap* colormap)
 {
     *visual = 0;
@@ -818,7 +767,6 @@
     if (*visual)
         *colormap = XCreateColormap(display, GDK_ROOT_WINDOW(), *visual, AllocNone);
 }
-#endif
 
 gboolean PluginView::plugRemovedCallback(GtkSocket* socket, PluginView* view)
 {
@@ -839,7 +787,6 @@
     ASSERT(m_isStarted);
     ASSERT(m_status == PluginStatusLoadedSuccessfully);
 
-#if defined(XP_UNIX)
     if (m_plugin->pluginFuncs()->getvalue) {
         PluginView::setCurrentPluginView(this);
         JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData());
@@ -848,11 +795,9 @@
         setCallingPlugin(false);
         PluginView::setCurrentPluginView(0);
     }
-#endif
 
     if (m_isWindowed) {
         GtkWidget* pageClient = m_parentFrame->view()->hostWindow()->platformPageClient();
-#if defined(XP_UNIX)
         if (m_needsXEmbed) {
             // If our parent is not anchored the startup process will
             // fail miserably for XEmbed plugins a bit later on when
@@ -868,31 +813,18 @@
             g_signal_connect(platformPluginWidget(), "plug-removed", G_CALLBACK(PluginView::plugRemovedCallback), this);
         } else
             setPlatformWidget(gtk_xtbin_new(pageClient, 0));
-#else
-#if OS(WINDOWS) && !defined(GTK_API_VERSION_2)
-        setPlatformWidget(0);
-#else
-        setPlatformWidget(gtk_socket_new());
-#endif
-        gtk_container_add(GTK_CONTAINER(pageClient), platformPluginWidget());
-#endif
     } else {
         setPlatformWidget(0);
-#if defined(XP_UNIX)
         m_pluginDisplay = getPluginDisplay();
-#endif
     }
 
     show();
 
-#if defined(XP_UNIX)
         NPSetWindowCallbackStruct* ws = new NPSetWindowCallbackStruct();
         ws->type = 0;
-#endif
 
     if (m_isWindowed) {
         m_npWindow.type = NPWindowTypeWindow;
-#if defined(XP_UNIX)
         if (m_needsXEmbed) {
             GtkWidget* widget = platformPluginWidget();
             gtk_widget_realize(widget);
@@ -910,14 +842,10 @@
             ws->colormap = GTK_XTBIN(platformPluginWidget())->xtclient.xtcolormap;
         }
         XFlush (ws->display);
-#elif defined(GDK_WINDOWING_WIN32)
-        m_npWindow.window = (void*)GDK_WINDOW_HWND(gtk_widget_get_window(platformPluginWidget()));
-#endif
     } else {
         m_npWindow.type = NPWindowTypeDrawable;
         m_npWindow.window = 0; // Not used?
 
-#if defined(XP_UNIX)
         GdkScreen* gscreen = gdk_screen_get_default();
         GdkVisual* gvisual = gdk_screen_get_system_visual(gscreen);
 
@@ -939,16 +867,9 @@
         m_npWindow.y = 0;
         m_npWindow.width = -1;
         m_npWindow.height = -1;
-#else
-        notImplemented();
-        m_status = PluginStatusCanNotLoadPlugin;
-        return false;
-#endif
     }
 
-#if defined(XP_UNIX)
     m_npWindow.ws_info = ws;
-#endif
 
     // TODO remove in favor of null events, like mac port?
     if (!(m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall)))
@@ -959,12 +880,10 @@
 
 void PluginView::platformDestroy()
 {
-#if defined(XP_UNIX)
     if (m_drawable) {
         XFreePixmap(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), m_drawable);
         m_drawable = 0;
     }
-#endif
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to