From b1efbef458ec6ff8a5ca4e4d34f25bf551ebddb6 Mon Sep 17 00:00:00 2001 From: thesource Date: Wed, 13 Nov 2024 08:52:02 +0300 Subject: [PATCH] Don't use ifdef, just try every method to obtain display handle, rename attr variable --- desmume/src/frontend/posix/shared/egl_3Demu.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/desmume/src/frontend/posix/shared/egl_3Demu.cpp b/desmume/src/frontend/posix/shared/egl_3Demu.cpp index e344568bf..49e118567 100644 --- a/desmume/src/frontend/posix/shared/egl_3Demu.cpp +++ b/desmume/src/frontend/posix/shared/egl_3Demu.cpp @@ -46,14 +46,12 @@ static bool __egl_initOpenGL(const int requestedAPI, const int requestedProfile, EGLint eglMajorVersion; EGLint eglMinorVersion; -#ifdef EGL_VERSION_1_5 - EGLAttrib attr[] = {EGL_NONE}; - currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, EGL_DEFAULT_DISPLAY, attr); + EGLAttrib displayAttr[] = {EGL_NONE}; + currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, EGL_DEFAULT_DISPLAY, displayAttr); if(currDisplay == EGL_NO_DISPLAY) - currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_XCB_EXT, EGL_DEFAULT_DISPLAY, attr); -#else - currDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); -#endif + currDisplay = eglGetPlatformDisplay(EGL_PLATFORM_XCB_EXT, EGL_DEFAULT_DISPLAY, displayAttr); + if(currDisplay == EGL_NO_DISPLAY) + currDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if(currDisplay == EGL_NO_DISPLAY) { puts("EGL: failed to obtain display handle");