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_window.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_window.c')
| -rw-r--r-- | src/saffron_window.c | 6 |
1 files changed, 6 insertions, 0 deletions
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); |
