aboutsummaryrefslogtreecommitdiff
path: root/include/saffronwebkit.h
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-05-02 18:29:13 +1200
committerArslaan Pathan <[email protected]>2026-05-02 18:29:13 +1200
commit95c3a91a092c0bf51ec4e70c46b92b70997be952 (patch)
treef74ae2303ee4a1304fe4644a577115bfff4e3908 /include/saffronwebkit.h
parent060a5a156f7d7233051bf7dd5ccfe6988bd29335 (diff)
downloadsaffronwebkit-95c3a91a092c0bf51ec4e70c46b92b70997be952.tar.xz
saffronwebkit-95c3a91a092c0bf51ec4e70c46b92b70997be952.zip
shoot, i forgot to commit for the entirety of kiwihacks T_T
Diffstat (limited to 'include/saffronwebkit.h')
-rw-r--r--include/saffronwebkit.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/saffronwebkit.h b/include/saffronwebkit.h
new file mode 100644
index 0000000..4287b48
--- /dev/null
+++ b/include/saffronwebkit.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2026 Arslaan Pathan
+// This code contains excerpts from wpe-sdl-simple, which is released under MIT.
+// The original source code is available here: https://github.com/aperezdc/wpe-sdl-simple
+// See external_licenses/COPYING_wpe-sdl-simple.txt
+#ifndef SAFFRONWEBKIT_H
+#define SAFFRONWEBKIT_H
+
+#include "wpe/wpe-platform.h"
+#include <saffron.h>
+#include <wpe/webkit.h>
+#include <SDL3/SDL.h>
+#include <SDL3/SDL_egl.h>
+#include <SDL3/SDL_opengles2.h>
+
+// The web content area - view that renders to SDL
+struct _WPEViewSDL3 {
+ WPEView parent;
+ void* userdata;
+};
+
+// Window/toplevel container that owns all the web views - tab/window manager
+struct _WPEToplevelSDL3 {
+ WPEToplevel parent;
+ WPEView *view;
+ SDL_Texture *texture;
+};
+
+// Manages EGL/SDL display - global WPE context
+struct _WPEDisplaySDL3 {
+ WPEDisplay parent;
+
+ SDL_InitFlags init_flags;
+
+ SDL_Window *hidden_window;
+ SDL_GLContext gl_context;
+
+ EGLDisplay egl_display;
+
+ PFNEGLDESTROYIMAGEKHRPROC destroyImage;
+ PFNGLEGLIMAGETARGETTEXTURE2DOESPROC imageTargetTexture2DOES;
+};
+
+typedef struct {
+ GMainContext* main_context;
+ WPEDisplay* display;
+} SFWKContext;
+
+typedef struct {
+ SaffronWidget base;
+ WPEToplevel* toplevel;
+ WPEView* wpeview;
+ WebKitWebView* wkwebview;
+ SDL_Renderer* renderer;
+} SFWKWebView;
+
+SFWKContext* sfwk_init(); // can return NULL! be careful!
+
+void sfwk_process_event(SFWKContext* context, SFWKWebView* webview, SDL_Event* event); // the user needs to attach this to a saffron_hook_sdl_all_events
+
+SFWKWebView* sfwk_webview_new(SFWKContext* context, const char* url, int w, int h);
+
+#endif