Bug 1336048 - Add display detection to dom/ipc/ContentChild.cpp, r=glandium

MozReview-Commit-ID: CwcGXFiIl4e

--HG--
extra : rebase_source : 04a6b70562cf292f2d5ba45b8e72788684f3baa8
This commit is contained in:
Martin Stransky 2017-02-07 14:34:23 +01:00
parent 9358862c72
commit 97b5e78aac
3 changed files with 13 additions and 4 deletions

View File

@ -201,6 +201,11 @@
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
#include "VRManagerChild.h"
#ifdef MOZ_WIDGET_GTK
#include "nsAppRunner.h"
#endif
using namespace mozilla;
using namespace mozilla::docshell;
using namespace mozilla::dom::devicestorage;
@ -527,7 +532,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
// to use, and when starting under XWayland, it may choose to start with
// the wayland backend instead of the x11 backend.
// The DISPLAY environment variable is normally set by the parent process.
char* display_name = PR_GetEnv("DISPLAY");
const char* display_name = DetectDisplay();
if (display_name) {
int argc = 3;
char option_name[] = "--display";
@ -536,7 +541,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
// XRE_InitChildProcess().
nullptr,
option_name,
display_name,
const_cast<char*>(display_name),
nullptr
};
char** argvp = argv;

View File

@ -2892,7 +2892,7 @@ static void MOZ_gdk_display_close(GdkDisplay *display)
#endif
}
static const char* detectDisplay(void)
const char* DetectDisplay(void)
{
bool tryX11 = false;
bool tryWayland = false;
@ -3750,7 +3750,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
if (display_name) {
saveDisplayArg = true;
} else {
display_name = detectDisplay();
display_name = DetectDisplay();
if (!display_name) {
return 1;
}

View File

@ -133,4 +133,8 @@ void SetupErrorHandling(const char* progname);
*/
uint32_t MultiprocessBlockPolicy();
#ifdef MOZ_WIDGET_GTK
const char* DetectDisplay();
#endif
#endif // nsAppRunner_h__