summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2023-04-20 08:22:45 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2023-04-20 08:22:45 +0000
commit4314d2be3b83b4872c922c2476618bacbf033efc (patch)
tree93d8d61faf02508801041a31c2fedf6c5a5ee02b
parent00a9a74513c6199fd7d50163e94abaedccd3c089 (diff)
downloadVirtualBox-svn-4314d2be3b83b4872c922c2476618bacbf033efc.tar.gz
Check if XDG_SESSION_TYPE is set to tty, else GUI refuses to start in ssh sessions.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@99478 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--Config.kmk1
-rw-r--r--src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/Config.kmk b/Config.kmk
index debd2924d81..aaa4db6a6b3 100644
--- a/Config.kmk
+++ b/Config.kmk
@@ -7874,6 +7874,7 @@ ifdef VBOX_WITH_QTGUI
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBoxQtGuiExe_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
+ TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -Wl,-rpath,$(PATH_SDK_QT5_LIB)
TEMPLATE_VBoxQtGuiExe_LIBS += \
$(VBOX_XCURSOR_LIBS) \
Xext \
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp
index 454685c0b0e..afc32d4008f 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp
@@ -739,6 +739,10 @@ uint32_t NativeWindowSubsystem::X11GetAppRootWindow()
DisplayServerType NativeWindowSubsystem::detectDisplayServerType()
{
+ /* Warning: All the following assumes:
+ - the system does not have several sessions with different display server configurations,
+ - XDG_SESSION_TYPE is set accordingly.
+ */
const char *pSessionType = RTEnvGet("XDG_SESSION_TYPE");
if (pSessionType != NULL)
{
@@ -751,6 +755,14 @@ DisplayServerType NativeWindowSubsystem::detectDisplayServerType()
}
else if (RTStrIStr(pSessionType, "x11"))
return DisplayServerType_XOrg;
+ /* On systemd systems XDG_SESSION_TYPE is set to tty for ssh sessions. Check xserver processes then:*/
+ else if (RTStrIStr(pSessionType, "tty"))
+ {
+ if (RTProcIsRunningByName("Xorg"))
+ return DisplayServerType_XOrg;
+ else if (RTProcIsRunningByName("Xwayland"))
+ return DisplayServerType_XWayland;
+ }
}
return DisplayServerType_Unknown;
}