summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/yasl/gl.h5
-rw-r--r--include/yasl/yasl.h38
2 files changed, 28 insertions, 15 deletions
diff --git a/include/yasl/gl.h b/include/yasl/gl.h
index 66a245a..39d2c63 100644
--- a/include/yasl/gl.h
+++ b/include/yasl/gl.h
@@ -1,4 +1,4 @@
-/** @file Optional OpenGL/OpenGL ES contexts. Attribute lists are per-call. */
+/** @file Optional EGL/OpenGL/OpenGL ES contexts on Linux. Attribute lists are per-call. */
#ifndef YASL_GL_H
#define YASL_GL_H
#include "yasl/yasl.h"
@@ -13,7 +13,8 @@ enum yasl_gl_api { YASL_GL_OPENGL, YASL_GL_OPENGL_ES };
typedef void (*yasl_gl_proc)(void);
/** key/value pairs terminated by END, NULL defaults to GL3.2 core RGBA8 D24 S8.
* share is a live GL surface or NULL. CPU flag is invalid. Context is owned by
- * the returned surface. Detach it from all rendering threads before destruction. */
+ * the returned surface. Detach it from all rendering threads before destruction.
+ * Cocoa returns NULL with YASL_ERROR_UNSUPPORTED; use Metal or MoltenVK. */
YASL_API yasl_surface *yasl_gl_surface_create(const char *title, int width, int height,
unsigned flags, const int *attributes, yasl_surface *share);
/** May run on a rendering thread. NULL detaches this thread's current context. */
diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h
index 38c5b88..c0ebb75 100644
--- a/include/yasl/yasl.h
+++ b/include/yasl/yasl.h
@@ -55,6 +55,20 @@ enum yasl_event_type { YASL_EVENT_NONE, YASL_EVENT_CLOSE, YASL_EVENT_QUIT, YASL_
YASL_EVENT_DRAG, YASL_EVENT_DISPLAY_LOST, YASL_EVENT_DISPLAY_RESTORED };
enum yasl_drop_action { YASL_DROP_OVER, YASL_DROP_LEAVE, YASL_DROP_DATA };
enum yasl_drag_action { YASL_DRAG_OVER, YASL_DRAG_LEAVE, YASL_DRAG_DROP };
+struct yasl_window_payload { int width,height,pixel_width,pixel_height; double scale; unsigned state; };
+struct yasl_key_payload { enum yasl_key key; enum yasl_key_action action; unsigned mods;
+ uint32_t codepoint, shifted, native_code; };
+struct yasl_text_payload { const char *data; size_t length; };
+struct yasl_pointer_payload { double x,y,dx,dy; enum yasl_pointer_action action; unsigned button,buttons,mods; };
+struct yasl_scroll_payload { double x,y,lines_x,lines_y,pixels_x,pixels_y; unsigned valid,source,phase,mods; bool momentum; };
+struct yasl_pen_payload { uint64_t device_id,tool_id; double x,y,pressure,tilt_x,tilt_y,rotation,distance,tangential,wheel_degrees;
+ unsigned axes_valid,axes_changed,buttons,changed_button,tool,action; bool in_contact; };
+struct yasl_composition_payload { const char *data; size_t length; int begin,end; bool active; uint64_t revision,generation; };
+struct yasl_text_edit_payload { const char *data; size_t length,begin,end; uint64_t revision,generation; };
+struct yasl_clipboard_payload { const char *data; size_t length; uint64_t request_id; enum yasl_transfer_status status; };
+struct yasl_drop_payload { enum yasl_drop_action action; double x,y; const char *data; size_t length; };
+struct yasl_drag_payload { enum yasl_drag_action action; double x,y; };
+
/** Read the union member named by type. Strings stay valid until the next wait.
* CLOSE: the user closed this window. QUIT: the system asked the app to quit.
* WINDOW: size, scale or state changed. REFRESH: draw now; sent once the window
@@ -70,20 +84,18 @@ struct yasl_event {
yasl_surface *surface;
uint64_t time_ns;
union {
- struct { int width,height,pixel_width,pixel_height; double scale; unsigned state; } window;
- struct { enum yasl_key key; enum yasl_key_action action; unsigned mods;
- uint32_t codepoint, shifted, native_code; } key;
- struct { const char *data; size_t length; } text;
- struct { double x,y,dx,dy; enum yasl_pointer_action action; unsigned button,buttons,mods; } pointer;
- struct { double x,y,lines_x,lines_y,pixels_x,pixels_y; unsigned valid,source,phase,mods; bool momentum; } scroll;
- struct { uint64_t device_id,tool_id; double x,y,pressure,tilt_x,tilt_y,rotation,distance,tangential,wheel_degrees;
- unsigned axes_valid,axes_changed,buttons,changed_button,tool,action; bool in_contact; } pen;
- struct { const char *data; size_t length; int begin,end; bool active; uint64_t revision,generation; } composition;
- struct { const char *data; size_t length,begin,end; uint64_t revision,generation; } text_edit;
- struct { const char *data; size_t length; uint64_t request_id; enum yasl_transfer_status status; } clipboard;
+ struct yasl_window_payload window;
+ struct yasl_key_payload key;
+ struct yasl_text_payload text;
+ struct yasl_pointer_payload pointer;
+ struct yasl_scroll_payload scroll;
+ struct yasl_pen_payload pen;
+ struct yasl_composition_payload composition;
+ struct yasl_text_edit_payload text_edit;
+ struct yasl_clipboard_payload clipboard;
/** DATA carries a text/uri-list for yasl_drop_next_path; x/y are set for OVER. */
- struct { enum yasl_drop_action action; double x,y; const char *data; size_t length; } drop;
- struct { enum yasl_drag_action action; double x,y; } drag;
+ struct yasl_drop_payload drop;
+ struct yasl_drag_payload drag;
};
};
/** Last error on this thread; success does not clear it. */