shithub: npe

Download patch

ref: 87889383a11008a2e525f5abdfb3f9d367f66abd
parent: b464c6ba36c0b351ab087d2fa9eb87302d374393
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jun 13 18:26:02 EDT 2022

sdl: add a dumb version of SDL_QuitRequested

--- a/include/npe/SDL2/SDL.h
+++ b/include/npe/SDL2/SDL.h
@@ -52,6 +52,7 @@
 #include <SDL2/SDL_joystick.h>
 #include <SDL2/SDL_events.h>
 #include <SDL2/SDL_thread.h>
+#include <SDL2/SDL_quit.h>
 #include <SDL2/SDL_rwops.h>
 
 void SDL_StopTextInput(void);
--- a/libnpe_sdl2/events.c
+++ b/libnpe_sdl2/events.c
@@ -16,6 +16,7 @@
 static int kmod;
 static Rune rune;
 static Keyboardctl kctl;
+static int quitreq;
 
 static Alt salt[Numchan+1] = {
 	[Ckey] = { nil, &rune, CHANRCV },
@@ -73,6 +74,12 @@
 	return -1;
 }
 
+int
+SDL_QuitRequested(void)
+{
+	return quitreq;
+}
+
 #define ISTEXT(r) ((r) >= 0x20 && ((r) < KF || (r) >= KF+0x1000))
 
 int
@@ -95,6 +102,7 @@
 			return 1;
 		}else if((npe_sdl.hints & Altf4noclose) == 0 && (kmod & KMOD_LALT) != 0 && rune == (KF|4)){
 			e->type = SDL_QUIT;
+			quitreq = 1;
 			return 1;
 		}else{
 			e->type = (t == Rup) ? SDL_KEYUP : SDL_KEYDOWN;