aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/saffron_api.h6
-rw-r--r--include/saffron_event_hooks.h13
-rw-r--r--include/saffron_window.h3
3 files changed, 22 insertions, 0 deletions
diff --git a/include/saffron_api.h b/include/saffron_api.h
index 8ad340c..964eaa9 100644
--- a/include/saffron_api.h
+++ b/include/saffron_api.h
@@ -36,4 +36,10 @@ SaffronButton* saffron_button_new_with_text(SaffronText* text, bool enabled, voi
void saffron_widget_set_theme(SaffronWidget* widget, SaffronTheme* theme);
+/* very special function for special things
+ * also because i need an event hook that somewhat works
+ * for kiwihacks hackathon (wpewebkit bindings thing)
+*/
+void saffron_hook_sdl_all_events(SaffronWindow* window, bool (*callback)(SDL_Event* event), int priority);
+
#endif
diff --git a/include/saffron_event_hooks.h b/include/saffron_event_hooks.h
new file mode 100644
index 0000000..92e689e
--- /dev/null
+++ b/include/saffron_event_hooks.h
@@ -0,0 +1,13 @@
+#ifndef SAFFRON_EVENT_HOOKS_H
+#define SAFFRON_EVENT_HOOKS_H
+
+#include <SDL3/SDL.h>
+
+/* this file will not be included in saffron.h. this is an internal file for internal hooking in the event loop. */
+
+typedef struct {
+ bool (*callback)(SDL_Event* event);
+ int priority; // higher num = higher priority
+} SfInternalEventHook;
+
+#endif
diff --git a/include/saffron_window.h b/include/saffron_window.h
index 80aaa39..89bf684 100644
--- a/include/saffron_window.h
+++ b/include/saffron_window.h
@@ -2,6 +2,7 @@
#define SAFFRON_WINDOW_H
#include <SDL3/SDL.h>
+#include "saffron_event_hooks.h"
#include "saffron_widget.h"
typedef struct {
@@ -10,6 +11,8 @@ typedef struct {
SDL_Renderer *renderer;
int w, h;
const char* title;
+ SfInternalEventHook hooks[32];
+ int hook_count;
} SaffronWindow;
#endif