Bug 583179 - Make sure meego touch is only used in parent process. r=dougt
authorJan Arne Petersen <jap@gnome.org>
Tue, 03 Aug 2010 10:44:46 -0700
changeset 48828 3e77780b80723c718bc1409887c057a626c078a5
parent 48824 2f187db8f5f62b36c0ea2a9129530bf710312989
child 48829 cb95b8d67bdd4a07d5c093cb85a1106f9e6574d8
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdougt
bugs583179
milestone2.0b3pre
Bug 583179 - Make sure meego touch is only used in parent process. r=dougt
toolkit/xre/Makefile.in
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -101,16 +101,20 @@ CPPSRCS += nsNativeAppSupportBeOS.cpp
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 CPPSRCS += nsNativeAppSupportUnix.cpp
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
 CPPSRCS += nsNativeAppSupportQt.cpp
 CPPSRCS += nsQAppInstance.cpp
 EXPORTS += nsQAppInstance.h
+ifdef MOZ_ENABLE_MEEGOTOUCH
+MOCSRCS += moc_MozMeegoAppService.cpp
+CPPSRCS += moc_MozMeegoAppService.cpp
+endif
 else
 CPPSRCS += nsNativeAppSupportDefault.cpp
 endif
 endif
 endif
 endif
 endif
 endif
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -49,19 +49,23 @@ using mozilla::dom::ContentParent;
 #if defined(XP_OS2) && defined(MOZ_OS2_HIGH_MEMORY)
 // os2safe.h has to be included before os2.h, needed for high mem
 #include <os2safe.h>
 #endif
 
 #define XPCOM_TRANSLATE_NSGM_ENTRY_POINT 1
 
 #if defined(MOZ_WIDGET_QT)
-#include <qwidget.h>
-#include <qapplication.h>
-#endif
+#include <QApplication>
+#include <QScopedPointer>
+#ifdef MOZ_ENABLE_MEEGOTOUCH
+#include <MApplication>
+#include "MozMeegoAppService.h"
+#endif // MOZ_ENABLE_MEEGOTOUCH
+#endif // MOZ_WIDGET_QT
 
 #include "nsAppRunner.h"
 #include "nsUpdateDriver.h"
 
 #ifdef XP_MACOSX
 #include "MacLaunchHelper.h"
 #include "MacApplicationDelegate.h"
 #include "MacAutoreleasePool.h"
@@ -3123,19 +3127,30 @@ XRE_main(int argc, char* argv[], const n
     }
 #endif
 
 #if defined(MOZ_WIDGET_QT)
     const char* qgraphicssystemARG = NULL;
     ar = CheckArg("graphicssystem", PR_TRUE, &qgraphicssystemARG, PR_FALSE);
     if (ar == ARG_FOUND)
       PR_SetEnv(PR_smprintf("MOZ_QT_GRAPHICSSYSTEM=%s", qgraphicssystemARG));
-    QApplication app(gArgc, gArgv);
-
-    QStringList nonQtArguments = app.arguments();
+
+#ifdef MOZ_ENABLE_MEEGOTOUCH
+    QScopedPointer<QApplication> app;
+    if (XRE_GetProcessType() == GeckoProcessType_Default) {
+      MozMeegoAppService *appService = new MozMeegoAppService;
+      app.reset(new MApplication(gArgc, gArgv, appService));
+    } else {
+      app.reset(new QApplication(gArgc, gArgv));
+    }
+#else
+    QScopedPointer<QApplication> app(new QApplication(gArgc, gArgv));
+#endif
+
+    QStringList nonQtArguments = app->arguments();
     gQtOnlyArgc = 1;
     gQtOnlyArgv = (char**) malloc(sizeof(char*) 
                   * (gRestartArgc - nonQtArguments.size() + 2));
 
     // copy binary path
     gQtOnlyArgv[0] = gRestartArgv[0];
 
     for (int i = 1; i < gRestartArgc; ++i) {