From da5f27f9ce2a568168154f3d30062041a9154bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 25 May 2024 09:10:05 -0700 Subject: [PATCH] X11: Workaround DISPLAY not being set. --- examples/common/entry/entry_x11.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/common/entry/entry_x11.cpp b/examples/common/entry/entry_x11.cpp index c047e26ec..1363854a2 100644 --- a/examples/common/entry/entry_x11.cpp +++ b/examples/common/entry/entry_x11.cpp @@ -336,8 +336,13 @@ namespace entry m_display = XOpenDisplay(NULL); if (NULL == m_display) { - bx::printf("XOpenDisplay failed: DISPLAY environment variable must be set.\n\n"); - return bx::kExitFailure; + // Use `DISPLAY` enviroment variable to pick display. If `DISPLAY` is not set try ":0" + m_display = XOpenDisplay(":0"); + if (NULL == m_display) + { + bx::printf("XOpenDisplay failed: DISPLAY environment variable must be set.\n\n"); + return bx::kExitFailure; + } } int32_t screen = DefaultScreen(m_display);