shithub: npe

Download patch

ref: cac8df132a2fdc264a86b066b8e58cb48e99956e
parent: 1c19025d71eec5ca1f70c4bd986e1d1079a10049
author: Jacob Moody <moody@posixcafe.org>
date: Sun Jan 29 05:42:03 EST 2023

few more proper event typedefs

--- a/include/npe/SDL2/SDL_events.h
+++ b/include/npe/SDL2/SDL_events.h
@@ -30,19 +30,42 @@
 	SDL_GETEVENT,
 };
 
+typedef struct SDL_WindowEvent SDL_WindowEvent;
+typedef struct SDL_MouseWheelEvent SDL_MouseWheelEvent;
+typedef struct SDL_Keysym SDL_Keysym;
 typedef struct SDL_Event SDL_Event;
 typedef int SDL_eventaction;
 
+struct SDL_WindowEvent {
+	Uint32	type;
+	Uint32	timestamp;
+	Uint32	windowID;
+	Uint8	event;
+	Sint32	data1;
+	Sint32	data;
+};
+
+struct SDL_Keysym {
+	SDL_Scancode scancode;
+	SDL_Keycode sym;
+	Uint16 mod;
+};
+
+struct SDL_MouseWheelEvent {
+	Uint32	type;
+	Uint32	timestamp;
+	Uint32	windowID;
+	Uint32	which;
+	Sint32	x;
+	Sint32	y;
+	Uint32	direction;
+};
+
 struct SDL_Event {
 	int type;
+	SDL_WindowEvent window;
 	struct {
-		int event;
-	}window;
-	struct {
-		struct {
-			SDL_Scancode scancode;
-			SDL_Keycode sym;
-		}keysym;
+		SDL_Keysym keysym;
 		int repeat;
 	}key;
 	struct {
@@ -66,9 +89,7 @@
 	struct {
 		char text[SDL_TEXTINPUTEVENT_TEXT_SIZE+1];
 	}text;
-	struct {
-		int x, y;
-	}wheel;
+	SDL_MouseWheelEvent wheel;
 	struct {
 		char *file;
 	}drop;