about summary refs log tree commit diff stats
path: root/src/wrapped32/wrappedlibxext.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-05 16:36:31 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-10-05 16:36:31 +0200
commit2a2f82a745ac389e143a2e187029a7ed919e8a39 (patch)
tree8f91f5657d43e09bfcf438d699f75bc8f2a34b16 /src/wrapped32/wrappedlibxext.c
parent13a7801421ea8159917594cec60194a6a2805bdb (diff)
downloadbox64-2a2f82a745ac389e143a2e187029a7ed919e8a39.tar.gz
box64-2a2f82a745ac389e143a2e187029a7ed919e8a39.zip
[BOX32] Added many more 32bits wrapped function (some using wrapperhelper)
Diffstat (limited to 'src/wrapped32/wrappedlibxext.c')
-rw-r--r--src/wrapped32/wrappedlibxext.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/wrapped32/wrappedlibxext.c b/src/wrapped32/wrappedlibxext.c
index 7e90e429..9d7c913a 100644
--- a/src/wrapped32/wrappedlibxext.c
+++ b/src/wrapped32/wrappedlibxext.c
@@ -26,6 +26,9 @@
 
 #define LIBNAME libxext
 
+#include "libtools/my_x11_defs.h"
+#include "libtools/my_x11_defs_32.h"
+
 typedef struct _XImage XImage;
 void BridgeImageFunc(x64emu_t *emu, XImage *img);
 void UnbridgeImageFunc(x64emu_t *emu, XImage *img);
@@ -390,6 +393,66 @@ EXPORT int32_t my32_XShmGetImage(x64emu_t* emu, void* disp, size_t drawable, voi
 //    void *ret = my->XextAddDisplay(extinfo, dpy, extname, &natives, nevents, data);
 //    return ret;
 //}
+void inplace_XdbeVisualInfo_shrink(void* a)
+{
+    if(!a) return;
+    my_XdbeVisualInfo_t *src = a;
+    my_XdbeVisualInfo_32_t* dst = a;
+
+    dst->visual = to_ulong(src->visual);
+    dst->depth = src->depth;
+    dst->perflevel = src->perflevel;
+}
+void inplace_XdbeScreenVisualInfo_shrink(void* a)
+{
+    if(!a) return;
+    my_XdbeScreenVisualInfo_t *src = a;
+    my_XdbeScreenVisualInfo_32_t* dst = a;
+
+    for(int i=0; i<src->count; ++i)
+        inplace_XdbeVisualInfo_shrink(src->visinfo+i);
+    dst->count = src->count;
+    dst->visinfo = to_ptrv(src->visinfo);
+}
+void inplace_XdbeVisualInfo_enlarge(void* a)
+{
+    if(!a) return;
+    my_XdbeVisualInfo_32_t *src = a;
+    my_XdbeVisualInfo_t* dst = a;
+
+    dst->perflevel = src->perflevel;
+    dst->depth = src->depth;
+    dst->visual = from_ulong(src->visual);
+}
+void inplace_XdbeScreenVisualInfo_enlarge(void* a)
+{
+    if(!a) return;
+    my_XdbeScreenVisualInfo_32_t *src = a;
+    my_XdbeScreenVisualInfo_t* dst = a;
+
+    dst->visinfo = from_ptrv(src->visinfo);
+    dst->count = src->count;
+    for(int i=dst->count-1; i>=0; --i)
+        inplace_XdbeVisualInfo_enlarge(dst->visinfo+i);
+}
+
+EXPORT void* my32_XdbeGetVisualInfo(x64emu_t* emu, void* dpy, XID_32* draws, int* num)
+{
+    XID draws_l[*num];
+    if(*num)
+        for(int i=0; i<*num; ++i)
+            draws_l[i] = from_ulong(draws[i]);
+    my_XdbeScreenVisualInfo_t* ret = my->XdbeGetVisualInfo(dpy, draws_l, num);
+    inplace_XdbeScreenVisualInfo_shrink(ret);
+    return ret;
+}
+
+EXPORT void my32_XdbeFreeVisualInfo(x64emu_t* emu, void* infos)
+{
+    inplace_XdbeScreenVisualInfo_enlarge(infos);
+    my->XdbeFreeVisualInfo(infos);
+}
+
 #if 0
 #ifdef ANDROID
 #define NEEDED_LIBS "libX11.so", "libxcb.so", "libXau.so", "libdl.so", "libXdmcp.so"