VirtualBox

Changeset 96876 in vbox for trunk/src/VBox/Additions/x11


Ignore:
Timestamp:
Sep 26, 2022 4:11:19 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153783
Message:

Additions: X11: Move Wayland env detection to common place, bugref:10134.

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp

    r96875 r96876  
    776776
    777777/**
    778  * Tries to determine if the session parenting this process is of Xwayland.
    779  * NB: XDG_SESSION_TYPE is a systemd(1) environment variable and is unlikely
    780  * set in non-systemd environments or remote logins.
    781  * Therefore we check the Wayland specific display environment variable first.
    782  */
    783 static bool isXwayland(void)
    784 {
    785     const char *const pDisplayType = RTEnvGet(VBCL_ENV_WAYLAND_DISPLAY);
    786     const char *pSessionType;
    787 
    788     if (pDisplayType != NULL)
    789         return true;
    790 
    791     pSessionType = RTEnvGet(VBCL_ENV_XDG_SESSION_TYPE);
    792     if ((pSessionType != NULL) && (RTStrIStartsWith(pSessionType, "wayland")))
    793         return true;
    794 
    795     return false;
    796 }
    797 
    798 /**
    799778 * @interface_method_impl{VBCLSERVICE,pfnInit}
    800779 */
     
    819798    }
    820799
    821     if (isXwayland())
     800    if (VBClHasWayland())
    822801    {
    823802        rc = VbglR3DrmClientStart();
  • trunk/src/VBox/Additions/x11/VBoxClient/main.cpp

    r96407 r96876  
    119119static char          g_szLogFile[RTPATH_MAX + 128] = "";
    120120
     121/**
     122 * Tries to determine if the session parenting this process is of Xwayland.
     123 * NB: XDG_SESSION_TYPE is a systemd(1) environment variable and is unlikely
     124 * set in non-systemd environments or remote logins.
     125 * Therefore we check the Wayland specific display environment variable first.
     126 */
    121127bool VBClHasWayland(void)
    122128{
    123     return RTEnvGet(VBCL_ENV_WAYLAND_DISPLAY) != NULL;
     129    const char *const pDisplayType = RTEnvGet(VBCL_ENV_WAYLAND_DISPLAY);
     130    const char *pSessionType;
     131
     132    if (pDisplayType != NULL)
     133        return true;
     134
     135    pSessionType = RTEnvGet(VBCL_ENV_XDG_SESSION_TYPE);
     136    if ((pSessionType != NULL) && (RTStrIStartsWith(pSessionType, "wayland")))
     137        return true;
     138
     139    return false;
    124140}
    125141
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette