shithub: npe

Download patch

ref: e9af700c67b80a62075dac2faf0520715ba95aca
parent: 497593ad933bb1eaf22a8c359d5e2a67a40e7ed0
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jul 30 04:38:46 EDT 2021

kbd: ignore repeats with non-text codes

ctrl+LETTER does NOT generate the actual letter on repeats,
so disable those until we roll out our on key repeats that do.

--- a/libnpe_sdl2/events.c
+++ b/libnpe_sdl2/events.c
@@ -76,7 +76,7 @@
 int
 SDL_PollEvent(SDL_Event *e)
 {
-	int t, down;
+	int t, down, text;
 
 	if(e == nil) /* FIXME need to buffer the event so it won't get lost */
 		return 0;
@@ -85,7 +85,8 @@
 	case Ckey:
 		memset(e, 0, sizeof(*e));
 		recv(salt[Ckeytype].c, &t);
-		if(npe_sdl.textinput && (kmod & ~KMOD_LSHIFT) == 0 && rune >= 0x20 && (rune < KF || rune >= KF+0x1000)){
+		text = rune >= 0x20 && (rune < KF || rune >= KF+0x1000);
+		if(npe_sdl.textinput && (kmod & ~KMOD_LSHIFT) == 0 && text){
 			if(t != Rrepeat)
 				break;
 			e->type = SDL_TEXTINPUT;
@@ -93,7 +94,7 @@
 		}else if((npe_sdl.hints & Altf4noclose) == 0 && (kmod & KMOD_LALT) != 0 && rune == (KF|4)){
 			e->type = SDL_QUIT;
 			return 1;
-		}else if(npe_sdl.textinput && t == Rdown){
+		}else if(npe_sdl.textinput && t == Rrepeat && !text){
 			break;
 		}else{
 			e->type = (t == Rup) ? SDL_KEYUP : SDL_KEYDOWN;