about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-04 18:18:18 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-10-04 18:18:18 +0200
commit6ae502f181f161691f43fd1a08ea0b558f3b322d (patch)
treef9ce3690789a95d33f334c2f2da734320a965fcb /src
parent088720db2270207a8ddd5e57eb92c33550ea737c (diff)
downloadbox64-6ae502f181f161691f43fd1a08ea0b558f3b322d.tar.gz
box64-6ae502f181f161691f43fd1a08ea0b558f3b322d.zip
[BOX32] Initalized libX11 if used without loading (becauseit's loaded indirectly with SDL2 for example)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/wrappedlibx11.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c
index 139d19c5..10caa3cc 100644
--- a/src/wrapped32/wrappedlibx11.c
+++ b/src/wrapped32/wrappedlibx11.c
@@ -1612,8 +1612,17 @@ void convert_Screen_to_32(void* d, void* s)
     dst->root_input_mask = to_long(src->root_input_mask);
 }
 
+void* my_dlopen(x64emu_t* emu, void *filename, int flag);
 void* addDisplay(void* d)
 {
+    if(!my_lib) {
+        // the lib has not be loaded directly... need to open it! leaking the lib handle...
+        #ifdef ANDROID
+        my_dlopen(thread_get_emu(), "libX11.so", RTLD_NOW);
+        #else
+        my_dlopen(thread_get_emu(), "libX11.so.6", RTLD_NOW);
+        #endif
+    }
     my_XDisplay_t* dpy = (my_XDisplay_t*)d;
     // look for a free slot, or a display already there
     my_XDisplay_32_t* ret = NULL;