From 3ad537fdbb7fdacf99b0a1a9b1b5029c041e7308 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 16 Sep 2020 21:14:18 +1000 Subject: [PATCH] Tidy up --- v2/internal/ffenestri/ffenestri_darwin.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 26d7e029..82e8abbe 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -33,23 +33,13 @@ extern const char *icon[]; int debug; // Dispatch Method -typedef void (*dispatchMethod)(void *app, void *); -typedef void (^inlineDispatchMethod)(void); - -// execOnMainThread will execute the given `func` pointer, -// passing app as the first argument and args as the second -void execOnMainThread(void *app, void *func, void *args) { - dispatch_async(dispatch_get_main_queue(), ^{ - ((dispatchMethod)func)(app, args); - }); -} +typedef void (^dispatchMethod)(void); // dispatch will execute the given `func` pointer -void dispatch(inlineDispatchMethod func) { +void dispatch(dispatchMethod func) { dispatch_async(dispatch_get_main_queue(), func); } - // App Delegate typedef struct AppDel { Class isa; @@ -88,8 +78,6 @@ void Debug(char *message, ... ) { } } - - extern void messageFromWindowCallback(const char *); typedef void (*ffenestriCallback)(const char *); @@ -213,16 +201,14 @@ void Quit(void *appPointer) { } // SetTitle sets the main window title to the given string -void SetTitle(void *appPointer, const char *title) { +void SetTitle(struct Application *app, const char *title) { Debug("SetTitle Called"); - struct Application *app = (struct Application*) appPointer; ON_MAIN_THREAD( msg(app->mainWindow, s("setTitle:"), str(title)); ) } -void toggleFullscreen(void *appPointer) { - struct Application *app = (struct Application*) appPointer; +void toggleFullscreen(struct Application *app) { ON_MAIN_THREAD( app->fullscreen = !app->fullscreen; msg(app->mainWindow, s("toggleFullScreen:"));