diff options
Diffstat (limited to 'src/wrapped/wrappedgdk3.c')
| -rwxr-xr-x | src/wrapped/wrappedgdk3.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/wrapped/wrappedgdk3.c b/src/wrapped/wrappedgdk3.c index d695f451..0aa22cf6 100755 --- a/src/wrapped/wrappedgdk3.c +++ b/src/wrapped/wrappedgdk3.c @@ -54,9 +54,55 @@ static void* findFilterFct(void* fct) #define GO(A) if(my_filter_fct_##A == 0) {my_filter_fct_##A = (uintptr_t)fct; return my_filter_##A; } SUPER() #undef GO - printf_log(LOG_NONE, "Warning, no more slot for gtk-2 GdkFilterFunc callback\n"); + printf_log(LOG_NONE, "Warning, no more slot for gdk-3 GdkFilterFunc callback\n"); return NULL; } +// GSourceFunc +#define GO(A) \ +static uintptr_t my_GSourceFunc_fct_##A = 0; \ +static int my_GSourceFunc_##A(void* a) \ +{ \ + return (int)RunFunctionFmt(my_context, my_GSourceFunc_fct_##A, "p", a); \ +} +SUPER() +#undef GO +static void* findGSourceFunc(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_GSourceFunc_fct_##A == (uintptr_t)fct) return my_GSourceFunc_##A; + SUPER() + #undef GO + #define GO(A) if(my_GSourceFunc_fct_##A == 0) {my_GSourceFunc_fct_##A = (uintptr_t)fct; return my_GSourceFunc_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for gdk-3 GSourceFunc callback\n"); + return NULL; +} +// GDestroyNotify +#define GO(A) \ +static uintptr_t my_GDestroyNotify_fct_##A = 0; \ +static void my_GDestroyNotify_##A(void* data) \ +{ \ + RunFunctionFmt(my_context, my_GDestroyNotify_fct_##A, "p", data); \ +} +SUPER() +#undef GO +static void* findGDestroyNotifyFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_GDestroyNotify_fct_##A == (uintptr_t)fct) return my_GDestroyNotify_##A; + SUPER() + #undef GO + #define GO(A) if(my_GDestroyNotify_fct_##A == 0) {my_GDestroyNotify_fct_##A = (uintptr_t)fct; return my_GDestroyNotify_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for gdk-3 GDestroyNotify callback\n"); + return NULL; +} + +#undef SUPER static void my3_event_handler(void* event, my_signal_t* sig) @@ -120,6 +166,11 @@ EXPORT void my3_gdk_window_remove_filter(x64emu_t* emu, void* window, void* f, v my->gdk_window_remove_filter(window, findFilterFct(f), data); } +EXPORT uint32_t my_gdk_threads_add_idle_full(x64emu_t* emu, int priority, void* f, void* data, void* d) +{ + return my->gdk_threads_add_idle_full(priority, findGSourceFunc(f), data, findGDestroyNotifyFct(d)); +} + #define PRE_INIT \ if(box64_nogtk) \ return -1; |