Bug 564770 - provide graphics system parameter for child processes. r=dougt
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3109,16 +3109,20 @@ XRE_main(int argc, char* argv[], const n
const char* desktopStartupIDEnv = PR_GetEnv("DESKTOP_STARTUP_ID");
nsCAutoString desktopStartupID;
if (desktopStartupIDEnv) {
desktopStartupID.Assign(desktopStartupIDEnv);
}
#endif
#if defined(MOZ_WIDGET_QT)
+ const char* qgraphicssystemARG = NULL;
+ ar = CheckArg("graphicssystem", PR_TRUE, &qgraphicssystemARG);
+ if (ar == ARG_FOUND)
+ PR_SetEnv(PR_smprintf("MOZ_QT_GRAPHICSSYSTEM=%s", qgraphicssystemARG));
QApplication app(gArgc, gArgv);
#endif
#if defined(MOZ_WIDGET_GTK2)
#ifdef MOZ_MEMORY
// Disable the slice allocator, since jemalloc already uses similar layout
// algorithms, and using a sub-allocator tends to increase fragmentation.
// This must be done before g_thread_init() is called.
g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
--- a/toolkit/xre/nsQAppInstance.cpp
+++ b/toolkit/xre/nsQAppInstance.cpp
@@ -33,33 +33,38 @@
* 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 "nsQAppInstance.h"
#include <QApplication>
+#include "prenv.h"
// declared in nsAppRunner.cpp
extern int gArgc;
extern char **gArgv;
nsQAppInstance *nsQAppInstance::sQAppInstance = NULL;
int nsQAppInstance::sQAppRefCount = 0;
nsQAppInstance::nsQAppInstance(int gArgc, char** gArgv)
: QApplication(gArgc, gArgv)
{
}
void nsQAppInstance::AddRef(void) {
if (qApp) return;
- if (!sQAppInstance)
+ if (!sQAppInstance) {
+ const char *graphicsSystem = PR_GetEnv("MOZ_QT_GRAPHICSSYSTEM");
+ if (graphicsSystem)
+ QApplication::setGraphicsSystem(QString(graphicsSystem));
sQAppInstance = new nsQAppInstance(gArgc, gArgv);
+ }
sQAppRefCount++;
}
void nsQAppInstance::Release(void) {
if (sQAppInstance && !--sQAppRefCount) {
delete sQAppInstance;
sQAppInstance = NULL;
}