diff options
| author | Arslaan Pathan <[email protected]> | 2026-05-01 21:38:49 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-05-01 21:38:49 +1200 |
| commit | 6ad244502d1c3c09a26012c5e7fad901c95cc38e (patch) | |
| tree | b0b8106fca78a49e47313f35d8245eeb6980d3ac /src/saffron_event_hooks.c | |
| parent | ccb8f9316c9bc7aded2dd5d74d2e82445bf2f647 (diff) | |
| download | saffron-6ad244502d1c3c09a26012c5e7fad901c95cc38e.tar.xz saffron-6ad244502d1c3c09a26012c5e7fad901c95cc38e.zip | |
Fix the buttons and implement hooks for future webkit bindings to build on top of
Diffstat (limited to 'src/saffron_event_hooks.c')
| -rw-r--r-- | src/saffron_event_hooks.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/saffron_event_hooks.c b/src/saffron_event_hooks.c new file mode 100644 index 0000000..d3a2c43 --- /dev/null +++ b/src/saffron_event_hooks.c @@ -0,0 +1,19 @@ +#include "saffron_api.h" +#include <SDL3/SDL.h> +#include <saffron.h> +#include <saffron_event_hooks.h> + +void saffron_hook_sdl_all_events(SaffronWindow* window, bool (*callback)(SDL_Event* event), int priority) { + window->hooks[window->hook_count].callback = callback; + window->hooks[window->hook_count].priority = priority; + window->hook_count++; + for (int i = 0; i < window->hook_count; i++) { + for (int j = i + 1; j < window->hook_count; j++) { + if (window->hooks[j].priority > window->hooks[i].priority) { + SfInternalEventHook tmp = window->hooks[i]; + window->hooks[i] = window->hooks[j]; + window->hooks[j] = tmp; + } + } + } +} |
