Skip to content

Commit

Permalink
Fix compilation without wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
Etaash-mathamsetty authored and flightlessmango committed Sep 9, 2024
1 parent 2e7e86f commit 8b7dae6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gl/inject_egl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include "mesa/util/os_time.h"
#include "blacklist.h"
#include "gl_hud.h"
#ifdef HAVE_WAYLAND
#include "wayland_hook.h"
#endif

using namespace MangoHud::GL;

Expand Down Expand Up @@ -92,13 +94,15 @@ EXPORT_C_(void*) eglGetPlatformDisplay( unsigned int platform, void* native_disp
if (!pfn_eglGetPlatformDisplay)
pfn_eglGetPlatformDisplay = reinterpret_cast<decltype(pfn_eglGetPlatformDisplay)>(get_egl_proc_address("eglGetPlatformDisplay"));

#ifdef HAVE_WAYLAND
if(platform == EGL_PLATFORM_WAYLAND_KHR)
{
wl_display_ptr = (struct wl_display*)native_display;
HUDElements.display_server = HUDElements.display_servers::WAYLAND;
wl_handle = real_dlopen("libwayland-client.so", RTLD_LAZY);
init_wayland_data();
}
#endif

return pfn_eglGetPlatformDisplay(platform, native_display, attrib_list);
}
Expand All @@ -110,6 +114,7 @@ EXPORT_C_(void*) eglGetDisplay( void* native_display )
if (!pfn_eglGetDisplay)
pfn_eglGetDisplay = reinterpret_cast<decltype(pfn_eglGetDisplay)>(get_egl_proc_address("eglGetDisplay"));

#ifdef HAVE_WAYLAND
try
{
void** display_ptr = (void**)native_display;
Expand All @@ -125,6 +130,7 @@ EXPORT_C_(void*) eglGetDisplay( void* native_display )
catch(...)
{
}
#endif

return pfn_eglGetDisplay(native_display);
}
Expand Down

0 comments on commit 8b7dae6

Please sign in to comment.