shithub: npe

Download patch

ref: 9c86d94662c9232add279d1240d825de7557e02a
parent: c1c633523f71d1721809440c2a4d98a75bd333e3
author: qwx <qwx@sciops.net>
date: Mon Mar 9 05:58:47 EDT 2026

sdl2: add missing (though redundant) .state in key events

--- a/libnpe_sdl2/events.c
+++ b/libnpe_sdl2/events.c
@@ -196,6 +196,7 @@
 		/* FIXME there is a lot of hope for multiple buttons to never change its state at the same time */
 		if((down = (npe_sdl.m.buttons & 1)) != (npe_sdl.om.buttons & 1)){ /* left */
 			e->type = down ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
+			e->button.state = down ? SDL_PRESSED : SDL_RELEASED;
 			e->button.button = SDL_BUTTON_LEFT;
 			npe_sdl.om.buttons = (npe_sdl.om.buttons & ~1) | (npe_sdl.m.buttons & 1);
 			goto Filter;
@@ -202,6 +203,7 @@
 		}
 		if((down = (npe_sdl.m.buttons & 2)) != (npe_sdl.om.buttons & 2)){ /* middle */
 			e->type = down ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
+			e->button.state = down ? SDL_PRESSED : SDL_RELEASED;
 			e->button.button = SDL_BUTTON_MIDDLE;
 			npe_sdl.om.buttons = (npe_sdl.om.buttons & ~2) | (npe_sdl.m.buttons & 2);
 			goto Filter;
@@ -208,6 +210,7 @@
 		}
 		if((down = (npe_sdl.m.buttons & 4)) != (npe_sdl.om.buttons & 4)){ /* right */
 			e->type = down ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
+			e->button.state = down ? SDL_PRESSED : SDL_RELEASED;
 			e->button.button = SDL_BUTTON_RIGHT;
 			npe_sdl.om.buttons = (npe_sdl.om.buttons & ~4) | (npe_sdl.m.buttons & 4);
 			goto Filter;
@@ -510,6 +513,7 @@
 					else if(r == Kmod4)
 						kmod |= KMOD_LGUI;
 					else{
+						/* FIXME: ??? */
 						o = npe_sdl.textinput ? r : tolowerrune(r);
 						continue;
 					}
--