diff options
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappeddecor0types.h | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappeddecor0.c | 74 | ||||
| -rw-r--r-- | src/wrapped/wrappeddecor0_private.h | 2 |
4 files changed, 79 insertions, 3 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 200d3d7a..db4b1db2 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -4018,6 +4018,8 @@ wrappeddbusmenuglib: - iFppp: - dbusmenu_client_add_type_handler wrappeddecor0: +- pFpppp: + - libdecor_decorate wrappedevent21: - vFpiwpp: - event_set diff --git a/src/wrapped/generated/wrappeddecor0types.h b/src/wrapped/generated/wrappeddecor0types.h index 2c28e733..4861d276 100644 --- a/src/wrapped/generated/wrappeddecor0types.h +++ b/src/wrapped/generated/wrappeddecor0types.h @@ -11,7 +11,9 @@ #define ADDED_FUNCTIONS() #endif +typedef void* (*pFpppp_t)(void*, void*, void*, void*); -#define SUPER() ADDED_FUNCTIONS() +#define SUPER() ADDED_FUNCTIONS() \ + GO(libdecor_decorate, pFpppp_t) #endif // __wrappeddecor0TYPES_H_ diff --git a/src/wrapped/wrappeddecor0.c b/src/wrapped/wrappeddecor0.c index 409aa09f..5b14ce56 100644 --- a/src/wrapped/wrappeddecor0.c +++ b/src/wrapped/wrappeddecor0.c @@ -25,6 +25,78 @@ const char* decor0Name = "libdecor-0.so.0"; #include "generated/wrappeddecor0types.h" -//#include "wrappercallback.h" +#include "wrappercallback.h" + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ +GO(4) \ + +// libdecor_frame_interface ... +typedef struct my_libdecor_frame_interface_s { + uintptr_t configure; //vFppp + uintptr_t close; //vFpp + uintptr_t commit; //vFpp + uintptr_t dismiss_popup; //vFppp + uintptr_t reserved0; + uintptr_t reserved1; + uintptr_t reserved2; + uintptr_t reserved3; + uintptr_t reserved4; + uintptr_t reserved5; + uintptr_t reserved6; + uintptr_t reserved7; + uintptr_t reserved8; + uintptr_t reserved9; +} my_libdecor_frame_interface_t; +#define GO(A) \ +static my_libdecor_frame_interface_t* ref_libdecor_frame_interface_##A = NULL; \ +static void my_libdecor_frame_interface_configure_##A(void* a, void* b, void* c) \ +{ \ + RunFunctionFmt(ref_libdecor_frame_interface_##A->configure, "ppp", a, b, c); \ +} \ +static void my_libdecor_frame_interface_close_##A(void* a, void* b) \ +{ \ + RunFunctionFmt(ref_libdecor_frame_interface_##A->close, "pp", a, b); \ +} \ +static void my_libdecor_frame_interface_commit_##A(void* a, void* b) \ +{ \ + RunFunctionFmt(ref_libdecor_frame_interface_##A->commit, "pp", a, b); \ +} \ +static void my_libdecor_frame_interface_dismiss_popup_##A(void* a, void* b, void* c) \ +{ \ + RunFunctionFmt(ref_libdecor_frame_interface_##A->dismiss_popup, "ppp", a, b, c); \ +} \ +static my_libdecor_frame_interface_t my_libdecor_frame_interface_fct_##A = { \ + (uintptr_t)my_libdecor_frame_interface_configure_##A, \ + (uintptr_t)my_libdecor_frame_interface_close_##A, \ + (uintptr_t)my_libdecor_frame_interface_commit_##A, \ + (uintptr_t)my_libdecor_frame_interface_dismiss_popup_##A, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ +}; +SUPER() +#undef GO +static void* find_libdecor_frame_interface_Fct(void* fct) +{ + if(!fct) return fct; + #define GO(A) if(ref_libdecor_frame_interface_##A == fct) return &my_libdecor_frame_interface_fct_##A; + SUPER() + #undef GO + #define GO(A) if(ref_libdecor_frame_interface_##A == 0) {ref_libdecor_frame_interface_##A = fct; return &my_libdecor_frame_interface_fct_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libdecor_frame_interface callback\n"); + return NULL; +} + +#undef SUPER + +EXPORT void* my_libdecor_decorate(x64emu_t* emu, void* context, void* wl_surface, void* iface, void* data) +{ + iface = find_libdecor_frame_interface_Fct(iface); + return my->libdecor_decorate(context, wl_surface, iface, data); +} #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappeddecor0_private.h b/src/wrapped/wrappeddecor0_private.h index 84ae70b5..c41a1409 100644 --- a/src/wrapped/wrappeddecor0_private.h +++ b/src/wrapped/wrappeddecor0_private.h @@ -4,7 +4,7 @@ GO(libdecor_configuration_get_content_size, iFpppp) GO(libdecor_configuration_get_window_state, iFpp) -GO(libdecor_decorate, pFpppp) +GOM(libdecor_decorate, pFEpppp) GO(libdecor_dispatch, iFpi) GO(libdecor_frame_close, vFp) GO(libdecor_frame_commit, vFppp) |