about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Büchler <michael.buechler@posteo.net>2024-06-20 08:24:48 +0200
committerGitHub <noreply@github.com>2024-06-20 08:24:48 +0200
commit22116dabc3f7d0f67a56ea216359930c83ca673a (patch)
tree4872f888ecdfb8cd689b09c54faf5ba75f691bdc
parent5494d95b6b3bf9265983d92e46a7ae02c390e300 (diff)
downloadbox64-22116dabc3f7d0f67a56ea216359930c83ca673a.tar.gz
box64-22116dabc3f7d0f67a56ea216359930c83ca673a.zip
Add missing wrappings for winewayland.so (#1599)
* Add missing wrappings for winewayland.so

These were missing on wine-9.9 built with `--enable-win64` and
`--with-wayland=yes` on Ubuntu 24.04 "noble".

Does not work at this point! Now there is a SIGILL during/after mapping
winewayland.so due to a missing zxdg_output_v1 listener.

* wrappedwaylandclient: add zxdg_output_v1 listener

This is used by wine's waylandclient.so. Tested with wine-9.9 regedit
and winecfg.
-rw-r--r--src/wrapped/wrappedwaylandclient.c53
-rw-r--r--src/wrapped/wrappedwaylandclient_private.h12
-rw-r--r--src/wrapped/wrappedxkbregistry_private.h4
3 files changed, 61 insertions, 8 deletions
diff --git a/src/wrapped/wrappedwaylandclient.c b/src/wrapped/wrappedwaylandclient.c
index 44c41ef8..416dbf4c 100644
--- a/src/wrapped/wrappedwaylandclient.c
+++ b/src/wrapped/wrappedwaylandclient.c
@@ -475,6 +475,57 @@ static void* find_zwp_relative_pointer_v1_listener_Fct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for wayland-client zwp_relative_pointer_v1_listener callback\n");
     return NULL;
 }
+// zxdg_output_v1_listener ...
+typedef struct my_zxdg_output_v1_listener_s {
+    uintptr_t   logical_position; //vFppii
+    uintptr_t   logical_size; //vFppii
+    uintptr_t   done; //vFpp
+    uintptr_t   name; //vFppp
+    uintptr_t   description; //vFppp
+} my_zxdg_output_v1_listener_t;
+#define GO(A)   \
+static my_zxdg_output_v1_listener_t* ref_zxdg_output_v1_listener_##A = NULL;                                              \
+static void* my_zxdg_output_v1_listener_logical_position_##A(void* a, void* b, int32_t c, int32_t d)  \
+{                                                                                                                                           \
+    RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_position, "ppii", a, b, c, d);                          \
+}                                                                                                                                           \
+static void* my_zxdg_output_v1_listener_logical_size_##A(void* a, void* b, int32_t c, int32_t d)  \
+{                                                                                                                                           \
+    RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_size, "ppii", a, b, c, d);                          \
+}                                                                                                                                           \
+static void* my_zxdg_output_v1_listener_done_##A(void* a, void* b)  \
+{                                                                                                                                           \
+    RunFunctionFmt(ref_zxdg_output_v1_listener_##A->done, "pp", a, b);                          \
+}                                                                                                                                           \
+static void* my_zxdg_output_v1_listener_name_##A(void* a, void* b, void* c)  \
+{                                                                                                                                           \
+    RunFunctionFmt(ref_zxdg_output_v1_listener_##A->name, "ppp", a, b, c);                          \
+}                                                                                                                                           \
+static void* my_zxdg_output_v1_listener_description_##A(void* a, void* b, void* c)  \
+{                                                                                                                                           \
+    RunFunctionFmt(ref_zxdg_output_v1_listener_##A->description, "ppp", a, b, c);                          \
+}                                                                                                                                           \
+static my_zxdg_output_v1_listener_t my_zxdg_output_v1_listener_fct_##A = {                                                \
+    (uintptr_t)my_zxdg_output_v1_listener_logical_position_##A,                                                                     \
+    (uintptr_t)my_zxdg_output_v1_listener_logical_size_##A,                                                                     \
+    (uintptr_t)my_zxdg_output_v1_listener_done_##A,                                                                     \
+    (uintptr_t)my_zxdg_output_v1_listener_name_##A,                                                                     \
+    (uintptr_t)my_zxdg_output_v1_listener_description_##A,                                                                     \
+};
+SUPER()
+#undef GO
+static void* find_zxdg_output_v1_listener_Fct(void* fct)
+{
+    if(!fct) return fct;
+    #define GO(A) if(ref_zxdg_output_v1_listener_##A == fct) return &my_zxdg_output_v1_listener_fct_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(ref_zxdg_output_v1_listener_##A == 0) {ref_zxdg_output_v1_listener_##A = fct; return &my_zxdg_output_v1_listener_fct_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for wayland-client zxdg_output_v1_listener callback\n");
+    return NULL;
+}
 
 #undef SUPER
 
@@ -503,6 +554,8 @@ EXPORT int my_wl_proxy_add_listener(x64emu_t* emu, void* proxy, void** l, void*
         l = find_wl_buffer_listener_Fct(l);
     } else if(!strcmp(proxy_name, "zwp_relative_pointer_v1")) {
         l = find_zwp_relative_pointer_v1_listener_Fct(l);
+    } else if(!strcmp(proxy_name, "zxdg_output_v1")) {
+        l = find_zxdg_output_v1_listener_Fct(l);
     } else
         printf_log(LOG_INFO, "BOX64: Error, Wayland-client, add_listener to %s unknown, will crash soon!\n", proxy_name);
     return my->wl_proxy_add_listener(proxy, l, data);
diff --git a/src/wrapped/wrappedwaylandclient_private.h b/src/wrapped/wrappedwaylandclient_private.h
index ce5e86c0..ba81df11 100644
--- a/src/wrapped/wrappedwaylandclient_private.h
+++ b/src/wrapped/wrappedwaylandclient_private.h
@@ -2,10 +2,10 @@
 #error meh!
 #endif
 
-//GO(wl_array_add, 
+GO(wl_array_add, pFpL)
 //GO(wl_array_copy, 
-//GO(wl_array_init, 
-//GO(wl_array_release, 
+GO(wl_array_init, vFp)
+GO(wl_array_release, vFp)
 DATA(wl_buffer_interface, 40)
 //DATA(wl_callback_interface, 
 DATA(wl_compositor_interface, 40)
@@ -35,11 +35,11 @@ GO(wl_display_roundtrip_queue, iFpp)
 GO(wl_event_queue_destroy, vFp)
 DATA(wl_keyboard_interface, 40)
 //GO(wl_list_empty, 
-//GO(wl_list_init, 
-//GO(wl_list_insert, 
+GO(wl_list_init, vFp)
+GO(wl_list_insert, vFpp)
 //GO(wl_list_insert_list, 
 //GO(wl_list_length, 
-//GO(wl_list_remove, 
+GO(wl_list_remove, vFp)
 //GO(wl_log_set_handler_client, 
 DATA(wl_output_interface, 40)
 DATA(wl_pointer_interface, 40)
diff --git a/src/wrapped/wrappedxkbregistry_private.h b/src/wrapped/wrappedxkbregistry_private.h
index 9062ad22..5d0589cb 100644
--- a/src/wrapped/wrappedxkbregistry_private.h
+++ b/src/wrapped/wrappedxkbregistry_private.h
@@ -9,7 +9,7 @@
 //GO(rxkb_context_include_path_append_default, 
 GO(rxkb_context_new, pFu)
 //GO(rxkb_context_parse, 
-//GO(rxkb_context_parse_default_ruleset, 
+GO(rxkb_context_parse_default_ruleset, uFp)
 //GO(rxkb_context_ref, 
 //GO(rxkb_context_set_log_fn, 
 //GO(rxkb_context_set_log_level, 
@@ -31,7 +31,7 @@ GO(rxkb_layout_get_description, pFp)
 GO(rxkb_layout_get_name, pFp)
 //GO(rxkb_layout_get_popularity, 
 GO(rxkb_layout_get_variant, pFp)
-//GO(rxkb_layout_next, 
+GO(rxkb_layout_next, pFp)
 //GO(rxkb_layout_ref, 
 //GO(rxkb_layout_unref, 
 //GO(rxkb_model_first,