Skip to content

Commit

Permalink
Fix EGL for x11 session using Pipewire
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Oct 23, 2023
1 parent 6de8371 commit db4b07a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sources/grabber/pipewire/PipewireHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,10 @@ void PipewireHandler::initEGL()

if (displayEgl == EGL_NO_DISPLAY)
{
if (((displayEgl = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, (void*)EGL_DEFAULT_DISPLAY, nullptr)) == EGL_NO_DISPLAY) &&
((displayEgl = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR, (void*)EGL_DEFAULT_DISPLAY, nullptr)) == EGL_NO_DISPLAY))
bool x11session = qgetenv("XDG_SESSION_TYPE") == QByteArrayLiteral("x11") && !qEnvironmentVariableIsSet("WAYLAND_DISPLAY");
printf("Session type: %s , X11 detected: %s\n", qgetenv("XDG_SESSION_TYPE").constData(), (x11session) ? "yes" : "no");
if (((x11session || (displayEgl = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, (void*)EGL_DEFAULT_DISPLAY, nullptr)) == EGL_NO_DISPLAY)) &&
((!x11session || (displayEgl = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR, (void*)EGL_DEFAULT_DISPLAY, nullptr)) == EGL_NO_DISPLAY)))
{
printf("PipewireEGL: no EGL display\n");
return;
Expand Down

0 comments on commit db4b07a

Please sign in to comment.