From 6ad244502d1c3c09a26012c5e7fad901c95cc38e Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Fri, 1 May 2026 21:38:49 +1200 Subject: Fix the buttons and implement hooks for future webkit bindings to build on top of --- src/saffron_window.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/saffron_window.c') diff --git a/src/saffron_window.c b/src/saffron_window.c index 41bc050..34da341 100644 --- a/src/saffron_window.c +++ b/src/saffron_window.c @@ -14,6 +14,8 @@ SaffronWindow* saffron_window_new(const char* title, int w, int h) { window->title = title; window->w = w; window->h = h; + memset(window->hooks, 0, sizeof(window->hooks)); + window->hook_count = 0; Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY; window->sdl_window = SDL_CreateWindow(title, w, h, flags); @@ -81,6 +83,10 @@ void saffron_window_main(SaffronWindow *window) { if (event.type == SDL_EVENT_WINDOW_RESIZED) { handle_window_resized(&event, window); } + for (int i = 0; i < window->hook_count; i++) { + bool consumed = window->hooks[i].callback(&event); + if (consumed) break; + } } SDL_SetRenderDrawColor(window->renderer, 0, 0, 0, 255); -- cgit v1.2.3