Bug 534644 - implement Qt ipc/chromium backend, first part. r=benjamin, r=jones.chris.g
authorOleg Romashin <romaxa@gmail.com>
Thu, 28 Jan 2010 07:22:41 +0200
changeset 37598 77f8b0f93f38dd9156d66ad8b901e6e8195f915a
parent 37597 4c3d6950eb499a26569c6535f628b63e5e273ee7
child 37599 d96f5ba97233629f07ccac3d4a6abd96175b3be7
push id11383
push userromaxa@gmail.com
push dateThu, 28 Jan 2010 05:23:15 +0000
treeherdermozilla-central@77f8b0f93f38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenjamin, jones.chris.g
bugs534644
milestone1.9.3a1pre
Bug 534644 - implement Qt ipc/chromium backend, first part. r=benjamin, r=jones.chris.g
dom/plugins/Makefile.in
dom/plugins/NPEventX11.h
dom/plugins/PluginModuleChild.cpp
ipc/chromium/Makefile.in
ipc/chromium/src/base/message_loop.cc
ipc/chromium/src/chrome/common/chrome_paths.cc
ipc/ipdl/Makefile.in
layout/build/Makefile.in
modules/plugin/base/src/Makefile.in
--- a/dom/plugins/Makefile.in
+++ b/dom/plugins/Makefile.in
@@ -118,9 +118,11 @@ LOCAL_INCLUDES = \
   $(NULL)
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 endif
 
 include $(topsrcdir)/config/rules.mk
 
+CXXFLAGS += $(TK_CFLAGS)
+
 DEFINES += -DFORCE_PR_LOG
--- a/dom/plugins/NPEventX11.h
+++ b/dom/plugins/NPEventX11.h
@@ -37,16 +37,21 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_dom_plugins_NPEventX11_h
 #define mozilla_dom_plugins_NPEventX11_h 1
 
 #if defined(MOZ_WIDGET_GTK2)
 #  include <gdk/gdkx.h>
+#elif defined(MOZ_WIDGET_QT)
+// X11/X.h has #define CursorShape 0, but Qt's qnamespace.h defines
+//   enum CursorShape { ... }.  Good times!
+#  undef CursorShape
+#  include <QX11Info>
 #else
 #  error Implement me for your toolkit
 #endif
 
 #include "npapi.h"
 
 namespace mozilla {
 
@@ -109,28 +114,34 @@ struct ParamTraits<mozilla::plugins::NPR
         aLog->append(L"(XEvent)");
     }
 
 private:
     static Display* GetXDisplay(const XAnyEvent& ev)
     {
         // TODO: get Display* from Window in |ev|
 
-        // FIXME: do this using Xlib, don't use Gdk
-        
+        // FIXME: do this using Xlib
+#if defined(MOZ_WIDGET_GTK2)
         return GDK_DISPLAY();
+#elif defined(MOZ_WIDGET_QT)
+        return QX11Info::display();
+#endif
     }
 
     static Display* GetXDisplay(const XErrorEvent& ev)
     {
         // TODO: get Display* from Window in |ev|
 
-        // FIXME: do this using Xlib, don't use Gdk
-        
+        // FIXME: do this using Xlib
+#if defined(MOZ_WIDGET_GTK2)
         return GDK_DISPLAY();
+#elif defined(MOZ_WIDGET_QT)
+        return QX11Info::display();
+#endif
     }
 
     static void SetXDisplay(XEvent& ev)
     {
         if (ev.type >= KeyPress) {
             ev.xany.display = GetXDisplay(ev.xany);
         }
         else {
--- a/dom/plugins/PluginModuleChild.cpp
+++ b/dom/plugins/PluginModuleChild.cpp
@@ -34,17 +34,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/plugins/PluginModuleChild.h"
 
-#ifdef OS_LINUX
+#ifdef MOZ_WIDGET_GTK2
 #include <gtk/gtk.h>
 #endif
 
 #include "nsILocalFile.h"
 
 #include "pratom.h"
 #include "nsDebug.h"
 #include "nsCOMPtr.h"
@@ -229,17 +229,17 @@ wrap_gtk_plug_embedded(GtkPlug* plug) {
     }
 }
 #endif
 
 bool
 PluginModuleChild::InitGraphics()
 {
     // FIXME/cjones: is this the place for this?
-#if defined(OS_LINUX)
+#if defined(MOZ_WIDGET_GTK2)
     gtk_init(0, 0);
 
     // GtkPlug is a static class so will leak anyway but this ref makes sure.
     gpointer gtk_plug_class = g_type_class_ref(GTK_TYPE_PLUG);
 
     // The dispose method is a good place to hook into the destruction process
     // because the reference count should be 1 the last time dispose is
     // called.  (Toggle references wouldn't detect if the reference count
--- a/ipc/chromium/Makefile.in
+++ b/ipc/chromium/Makefile.in
@@ -241,24 +241,18 @@ ifdef OS_LINUX # {
 
 CPPSRCS += \
   atomicops_internals_x86_gcc.cc \
   base_paths_linux.cc \
   data_pack.cc \
   file_util_linux.cc \
   file_version_info_linux.cc \
   idle_timer_none.cc \
-  message_pump_glib.cc \
   process_util_linux.cc \
   time_posix.cc \
-  chrome_paths_linux.cc \
-  owned_widget_gtk.cc \
-  platform_util_linux.cc \
-  transport_dib_linux.cc \
-  x11_util.cc \
   $(NULL)
 
 endif # } OS_LINUX
 
 # libevent
 
 ifdef OS_POSIX # {
 
--- a/ipc/chromium/src/base/message_loop.cc
+++ b/ipc/chromium/src/base/message_loop.cc
@@ -14,17 +14,17 @@
 #include "base/thread_local.h"
 
 #if defined(OS_MACOSX)
 #include "base/message_pump_mac.h"
 #endif
 #if defined(OS_POSIX)
 #include "base/message_pump_libevent.h"
 #endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) && !defined(CHROMIUM_MOZILLA_BUILD)
 #include "base/message_pump_glib.h"
 #endif
 
 #ifdef CHROMIUM_MOZILLA_BUILD
 #include "MessagePump.h"
 #endif
 
 using base::Time;
@@ -107,17 +107,17 @@ MessageLoop::MessageLoop(Type type)
   } else {
     DCHECK(type_ == TYPE_UI);
     pump_ = new base::MessagePumpForUI();
   }
 #elif defined(OS_POSIX)
   if (type_ == TYPE_UI) {
 #if defined(OS_MACOSX)
     pump_ = base::MessagePumpMac::Create();
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) && !defined(CHROMIUM_MOZILLA_BUILD)
     pump_ = new base::MessagePumpForUI();
 #endif  // OS_LINUX
   } else if (type_ == TYPE_IO) {
     pump_ = new base::MessagePumpLibevent();
   } else {
     pump_ = new base::MessagePumpDefault();
   }
 #endif  // OS_POSIX
--- a/ipc/chromium/src/chrome/common/chrome_paths.cc
+++ b/ipc/chromium/src/chrome/common/chrome_paths.cc
@@ -27,16 +27,17 @@ bool GetGearsPluginPathFromCommandLine(F
   *path = FilePath::FromWStringHack(plugin_path);
   return !plugin_path.empty();
 #else
   return false;
 #endif
 }
 
 bool PathProvider(int key, FilePath* result) {
+#ifndef CHROMIUM_MOZILLA_BUILD
   // Some keys are just aliases...
   switch (key) {
     case chrome::DIR_APP:
       return PathService::Get(base::DIR_MODULE, result);
     case chrome::DIR_LOGS:
 #ifndef NDEBUG
       return PathService::Get(chrome::DIR_USER_DATA, result);
 #else
@@ -206,16 +207,17 @@ bool PathProvider(int key, FilePath* res
       return false;
   }
 
   if (create_dir && !file_util::PathExists(cur) &&
       !file_util::CreateDirectory(cur))
     return false;
 
   *result = cur;
+#endif
   return true;
 }
 
 // This cannot be done as a static initializer sadly since Visual Studio will
 // eliminate this object file if there is no direct entry point into it.
 void RegisterPathProvider() {
   PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
 }
--- a/ipc/ipdl/Makefile.in
+++ b/ipc/ipdl/Makefile.in
@@ -95,8 +95,12 @@ include $(topsrcdir)/config/rules.mk
 export:: $(ALL_IPDLSRCS)
 	$(PYTHON) $(topsrcdir)/config/pythonpath.py	\
 	  -I$(topsrcdir)/other-licenses/ply		\
 	  $(srcdir)/ipdl.py				\
 	  --outheaders-dir=_ipdlheaders			\
 	  --outcpp-dir=.				\
 	  $(IPDLDIRS:%=-I$(topsrcdir)/%)		\
 	  $^
+
+# We #include some things in the dom/plugins/ directory that rely on
+# toolkit libraries.
+CXXFLAGS    += $(TK_CFLAGS)
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -206,25 +206,20 @@ endif
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(EXTRA_DSO_LIBS) \
 		$(MOZ_UNICHARUTIL_LIBS) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(MOZ_JS_LIBS) \
 		$(NULL)
 
+EXTRA_DSO_LDOPTS += $(TK_LIBS)
+
 ifdef MOZ_ENABLE_GTK2
-EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) \
-		    -lXrender \
-		    $(NULL)
-endif
-
-ifdef MOZ_ENABLE_QT
-EXTRA_DSO_LDOPTS += $(MOZ_QT_LIBS) \
-		    $(NULL)
+EXTRA_DSO_LDOPTS += -lXrender
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 EXTRA_DSO_LDOPTS += $(TK_LIBS)
 OS_LIBS += -framework OpenGL
 endif
 
 # Add explicit X11 dependency when building against X11 toolkits
--- a/modules/plugin/base/src/Makefile.in
+++ b/modules/plugin/base/src/Makefile.in
@@ -120,13 +120,19 @@ ifeq ($(OS_ARCH),WINNT)
 OS_LIBS		+= $(call EXPAND_LIBNAME,version)
 endif
 
 ifeq ($(OS_ARCH), OpenVMS)
 DEFINES		+= -DGENERIC_MOTIF_REDEFINES
 OS_CXXFLAGS	+= -Wc,warn=disa=NOSIMPINT
 endif
 
+CXXFLAGS         += $(TK_CFLAGS)
+EXTRA_DSO_LDOPTS += $(TK_LIBS)
+
 ifdef MOZ_ENABLE_GTK2
-CXXFLAGS        += $(MOZ_GTK2_CFLAGS)
-CFLAGS          += $(MOZ_GTK2_CFLAGS)
-EXTRA_DSO_LDOPTS += -lgtkxtbin $(XLDFLAGS) $(XT_LIBS) $(MOZ_GTK2_LIBS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS)
+EXTRA_DSO_LDOPTS += -lgtkxtbin $(XLDFLAGS) $(XT_LIBS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS)
 endif           #MOZ_ENABLE_GTK2
+
+ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
+EXTRA_DSO_LDOPTS += $(XEXT_LIBS) $(XCOMPOSITE_LIBS)
+endif
+