about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-06-11 18:02:02 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-06-11 18:02:02 +0200
commitbcfd0f7ea3c2341433ed8158cac6b3453d85b602 (patch)
tree49f96deee8e598e949f578a29d96656443e7e00c
parentc404b3e0ab96d40ea8880eddde54a45ffe4b201e (diff)
downloadbox64-bcfd0f7ea3c2341433ed8158cac6b3453d85b602.tar.gz
box64-bcfd0f7ea3c2341433ed8158cac6b3453d85b602.zip
Added one structure to libwayland-clinet and auto bridges all current interfaces
-rw-r--r--src/wrapped/wrappedwaylandclient.c37
-rw-r--r--src/wrapped/wrappedwaylandclient_private.h12
2 files changed, 43 insertions, 6 deletions
diff --git a/src/wrapped/wrappedwaylandclient.c b/src/wrapped/wrappedwaylandclient.c
index c1570cf2..2ecac23c 100644
--- a/src/wrapped/wrappedwaylandclient.c
+++ b/src/wrapped/wrappedwaylandclient.c
@@ -21,4 +21,41 @@
 const char* waylandclientName = "libwayland-client.so.0";
 #define LIBNAME waylandclient
 
+static void AutoBridgeInterfaces(void* lib, bridge_t* bridge)
+{
+    // creates bridges for the various interfaces of this libs...
+    void** p = NULL;
+    p = dlsym(lib, "wl_buffer_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFpp, *p, 0, "wl_buffer_interface_destroy");
+    }
+    p = dlsym(lib, "wl_compositor_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFppu, p[0], 0, "wl_compositor_interface_create_surface");
+        AddAutomaticBridge(bridge, vFppu, p[1], 0, "wl_compositor_interface_create_region");
+    }
+    p = dlsym(lib, "wl_display_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFppu, p[0], 0, "wl_display_interface_sync");
+        AddAutomaticBridge(bridge, vFppu, p[1], 0, "wl_display_interface_get_registry");
+    }
+    p = dlsym(lib, "wl_keyboard_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFpp, *p, 0, "wl_keyboard_interface_release");
+    }
+    p = dlsym(lib, "wl_output_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFpp, *p, 0, "wl_output_interface_release");
+    }
+    p = dlsym(lib, "wl_pointer_interface");
+    if(p) {
+        AddAutomaticBridge(bridge, vFppupii, p[0], 0, "wl_pointer_interface_set_cursor");
+        AddAutomaticBridge(bridge, vFppu, p[1], 0, "wl_pointer_interface_release");
+    }
+}
+
+#define CUSTOM_INIT         \
+    AutoBridgeInterfaces(lib->w.lib, lib->w.bridge);
+
 #include "wrappedlib_init.h"
+
diff --git a/src/wrapped/wrappedwaylandclient_private.h b/src/wrapped/wrappedwaylandclient_private.h
index 5adcbfe4..4e649349 100644
--- a/src/wrapped/wrappedwaylandclient_private.h
+++ b/src/wrapped/wrappedwaylandclient_private.h
@@ -6,9 +6,9 @@
 //GO(wl_array_copy, 
 //GO(wl_array_init, 
 //GO(wl_array_release, 
-//DATA(wl_buffer_interface, 
+DATA(wl_buffer_interface, sizeof(void*)*1)
 //DATA(wl_callback_interface, 
-DATA(wl_compositor_interface, sizeof(void*)*3+sizeof(int)*4)
+DATA(wl_compositor_interface, sizeof(void*)*2)
 //DATA(wl_data_device_interface, 
 //DATA(wl_data_device_manager_interface, 
 //DATA(wl_data_offer_interface, 
@@ -26,14 +26,14 @@ GO(wl_display_flush, iFp)
 GO(wl_display_get_error, iFp)
 GO(wl_display_get_fd, iFp)
 //GO(wl_display_get_protocol_error, 
-DATA(wl_display_interface, sizeof(void*)*3+sizeof(int)*4)
+DATA(wl_display_interface, sizeof(void*)*2)
 GO(wl_display_prepare_read, iFp)
 GO(wl_display_prepare_read_queue, iFpp)
 GO(wl_display_read_events, iFp)
 GO(wl_display_roundtrip, iFp)
 GO(wl_display_roundtrip_queue, iFpp)
 GO(wl_event_queue_destroy, vFp)
-DATA(wl_keyboard_interface, sizeof(void*)*3+sizeof(int)*4)
+DATA(wl_keyboard_interface, sizeof(void*)*1)
 //GO(wl_list_empty, 
 //GO(wl_list_init, 
 //GO(wl_list_insert, 
@@ -41,8 +41,8 @@ DATA(wl_keyboard_interface, sizeof(void*)*3+sizeof(int)*4)
 //GO(wl_list_length, 
 //GO(wl_list_remove, 
 //GO(wl_log_set_handler_client, 
-DATA(wl_output_interface, sizeof(void*)*3+sizeof(int)*4)
-DATA(wl_pointer_interface, sizeof(void*)*3+sizeof(int)*4)
+DATA(wl_output_interface, sizeof(void*)*1)
+DATA(wl_pointer_interface, sizeof(void*)*2)
 //GO(wl_proxy_add_dispatcher, 
 GO(wl_proxy_add_listener, iFppp)
 GO(wl_proxy_create, pFpp)