Skip to content

Commit

Permalink
Add missing wrappings for winewayland.so (#1599)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
strobo5 authored Jun 20, 2024
1 parent 5494d95 commit 22116da
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 8 deletions.
53 changes: 53 additions & 0 deletions src/wrapped/wrappedwaylandclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/wrapped/wrappedwaylandclient_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/wrapped/wrappedxkbregistry_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 22116da

Please sign in to comment.