Thunks/X11: Add more symbols

This commit is contained in:
Tony Wasserka 2022-07-29 18:21:02 +02:00
parent 7c6d49155c
commit 737e76968a
3 changed files with 112 additions and 1 deletions

View File

@ -9,6 +9,8 @@ $end_info$
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/XKBlib.h>
// Include Xlibint.h and undefine some of its macros that clash with the standard library
#include <X11/Xlibint.h>
#undef min
@ -54,6 +56,25 @@ extern "C" {
return rv;
}
char* XGetIMValues(XIM ic, ...) {
fprintf(stderr, "XGetIMValues\n");
va_list ap;
std::vector<void*> args;
va_start(ap, ic);
for (;;) {
auto arg = va_arg(ap, void*);
if (arg == 0)
break;
args.push_back(arg);
fprintf(stderr, "%p\n", arg);
}
va_end(ap);
auto rv = fexfn_pack_XGetIMValues_internal(ic, args.size(), &args[0]);
fprintf(stderr, "RV: %p\n", rv);
return rv;
}
_XIC* XCreateIC(XIM im, ...) {
fprintf(stderr, "XCreateIC\n");
va_list ap;

View File

@ -9,8 +9,17 @@ $end_info$
#include <stdio.h>
#include <X11/Xlib.h>
// Include Xlibint.h and undefine some of its macros that clash with the standard library
#include <X11/Xlibint.h>
#undef min
#undef max
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/extensions/XKBstr.h>
#include "common/Host.h"
#include <dlfcn.h>
@ -45,7 +54,23 @@ char* fexfn_impl_libX11_XGetICValues_internal(XIC a_0, size_t count, unsigned lo
case 6: return fexldr_ptr_libX11_XGetICValues(a_0, list[0], list[1], list[2], list[3], list[4], list[5], nullptr); break;
case 7: return fexldr_ptr_libX11_XGetICValues(a_0, list[0], list[1], list[2], list[3], list[4], list[5], list[6], nullptr); break;
default:
fprintf(stderr, "XCreateIC_internal FAILURE\n");
fprintf(stderr, "XCreateICValues_internal FAILURE\n");
return ErrorReply;
}
}
char* fexfn_impl_libX11_XGetIMValues_internal(XIM a_0, size_t count, void **list) {
switch(count) {
case 0: return fexldr_ptr_libX11_XGetIMValues(a_0, nullptr); break;
case 1: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], nullptr); break;
case 2: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], nullptr); break;
case 3: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], list[2], nullptr); break;
case 4: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], list[2], list[3], nullptr); break;
case 5: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], list[2], list[3], list[4], nullptr); break;
case 6: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], list[2], list[3], list[4], list[5], nullptr); break;
case 7: return fexldr_ptr_libX11_XGetIMValues(a_0, list[0], list[1], list[2], list[3], list[4], list[5], list[6], nullptr); break;
default:
fprintf(stderr, "XCreateIMValues_internal FAILURE\n");
return ErrorReply;
}
}

View File

@ -4,6 +4,8 @@
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/ImUtil.h>
#include <X11/Xlibint.h>
#include <X11/XKBlib.h>
@ -442,6 +444,8 @@ template<> struct fex_gen_config<XCreateIC> {
};
template<> struct fex_gen_config<XIfEvent> {};
template<> struct fex_gen_config<XCheckIfEvent> {};
// TODO: Make returned function pointer guest-callable. For now, just pretend it already is.
template<> struct fex_gen_config<XSetErrorHandler> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XInternAtom> {};
@ -524,3 +528,64 @@ template<> struct fex_gen_config<XMatchVisualInfo> {};
template<> struct fex_gen_config<XPutImage> {};
template<> struct fex_gen_config<XCreateImage> {};
template<> struct fex_gen_config<XDisplayHeight> {};
template<> struct fex_gen_config<XkbFreeKeyboard> {};
template<> struct fex_gen_config<XkbSetDetectableAutoRepeat> {};
template<> struct fex_gen_config<XkbGetMap> {};
template<> struct fex_gen_config<XkbGetUpdatedMap> {};
template<> struct fex_gen_config<XkbQueryExtension> {};
template<> struct fex_gen_config<XkbSelectEvents> {};
template<> struct fex_gen_config<XkbGetState> {};
template<> struct fex_gen_config<XSynchronize> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XGetIMValues> {
using uniform_va_type = void*;
};
template<> struct fex_gen_config<XESetEventToWire> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetWireToEvent> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetCreateFont> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetFreeGC> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetFlushGC> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetCreateGC> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetCopyGC> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetFreeFont> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetCloseDisplay> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetCopyEventCookie> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetWireToEventCookie> : fexgen::returns_guest_pointer {};
// TODO: Should probably catch these with a custom handler
template<> struct fex_gen_config<XESetErrorString> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XESetError> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<XSetIOErrorHandler> : fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<_XRead32> {};
template<> struct fex_gen_config<_XRead> {};
template<> struct fex_gen_config<_XReadPad> {};
template<> struct fex_gen_config<_XData32> {};
template<> struct fex_gen_config<_XEatData> {};
template<> struct fex_gen_config<_XEatDataWords> {};
template<> struct fex_gen_config<_XGetAsyncReply> {};
template<> struct fex_gen_config<_XSend> {};
template<> struct fex_gen_config<_XFlush> {};
template<> struct fex_gen_config<_XFlushGCCache> {};
template<> struct fex_gen_config<_XAllocScratch> {};
template<> struct fex_gen_config<_XGetRequest> {};
template<> struct fex_gen_config<_XGetBitsPerPixel> {};
template<> struct fex_gen_config<_XGetScanlinePad> {};
template<> struct fex_gen_config<_XVIDtoVisual> {};
template<> struct fex_gen_config<_XSetLastRequestRead> {};
template<> struct fex_gen_config<_XDeqAsyncHandler> {};
template<> struct fex_gen_config<_XAllocTemp> {};
template<> struct fex_gen_config<_XFreeTemp> {};
template<> struct fex_gen_config<_XUnknownNativeEvent> {};
template<> struct fex_gen_config<_XIsEventCookie> {};
template<> struct fex_gen_config<XkbFreeClientMap> {};
// TODO: Vtable support...
template<> struct fex_gen_config<_XInitImageFuncPtrs> {};