Skip to content

Commit

Permalink
Bug 1336048 - Add display detection to dom/ipc/ContentChild.cpp, r=gl…
Browse files Browse the repository at this point in the history
…andium

MozReview-Commit-ID: CwcGXFiIl4e

--HG--
extra : rebase_source : 04a6b70562cf292f2d5ba45b8e72788684f3baa8
  • Loading branch information
stransky committed Feb 7, 2017
1 parent 9358862 commit 97b5e78
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions dom/ipc/ContentChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand All @@ -536,7 +541,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
// XRE_InitChildProcess().
nullptr,
option_name,
display_name,
const_cast<char*>(display_name),
nullptr
};
char** argvp = argv;
Expand Down
4 changes: 2 additions & 2 deletions toolkit/xre/nsAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions toolkit/xre/nsAppRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,8 @@ void SetupErrorHandling(const char* progname);
*/
uint32_t MultiprocessBlockPolicy();

#ifdef MOZ_WIDGET_GTK
const char* DetectDisplay();
#endif

#endif // nsAppRunner_h__

0 comments on commit 97b5e78

Please sign in to comment.