shithub: patch

Download patch

ref: 081e2f6b62a7c9372862b6ff83a93cbaae3eb9dc
parent: 05fe34f08ba2fefa2b5b6911bf322a8ef44eb03c
author: qwx <qwx@sciops.net>
date: Mon Nov 7 04:39:06 EST 2022

npe-modhacks: fix ridiculous precedence issue screwing up ft2 state

--- a/npe-modhacks
+++ b/npe-modhacks
@@ -1,15 +1,20 @@
 diff c653369e862d2b2235133cfcb0391bc4809ce4b1 uncommitted
 --- a/include/npe/SDL2/SDL_keycode.h
 +++ b/include/npe/SDL2/SDL_keycode.h
-@@ -81,13 +81,13 @@
+@@ -79,23 +79,24 @@
+ 
+ 	SDLK_LALT = Kalt,
  	SDLK_RALT = Kaltgr, /* FIXME what about keyboards without it? */
- 	/* FIXME no distinction */
+-	/* FIXME no distinction */
++	/* FIXME hacks */
++	Krshift = Spec|0x69,
++	Krctl = Spec|0x6a,
  	SDLK_LSHIFT = Kshift,
 -	SDLK_RSHIFT = SDLK_LSHIFT,
-+	SDLK_RSHIFT = Spec|0x69,	/* hack */
++	SDLK_RSHIFT = Krshift,
  	SDLK_LCTRL = Kctl,
 -	SDLK_RCTRL = '>', /* FIXME this is a hack */
-+	SDLK_RCTRL = Spec|0x6a,		/* hack */
++	SDLK_RCTRL = Krctl,
 +	SDLK_CAPSLOCK = Kcaps,
  
  	/* FIXME not bound to anything */
@@ -18,6 +23,16 @@
  	SDLK_KP_ENTER,
  	SDLK_AC_BACK,
  
+-	/* FIXME no distinction */
+ 	KMOD_LSHIFT = 1<<0,
+-	KMOD_RSHIFT = KMOD_LSHIFT,
++	KMOD_RSHIFT = 1<<6,	/* hack */
+ 	KMOD_LCTRL = 1<<1,
+-	KMOD_RCTRL = KMOD_LCTRL,
++	KMOD_RCTRL = 1<<7,	/* hack */
+ 	KMOD_LALT = 1<<2,
+ 	KMOD_RALT = 1<<3,
+ 	KMOD_LGUI = 1<<4,
 --- a/libnpe_sdl2/events.c
 +++ b/libnpe_sdl2/events.c
 @@ -206,6 +206,9 @@
@@ -25,8 +40,8 @@
  	if(r == Kmod4) return SDL_SCANCODE_LGUI;
  	if(r == Kaltgr) return SDL_SCANCODE_RALT;
 +	if(r == Kcaps) return SDL_SCANCODE_CAPSLOCK;
-+	if(r == Spec|0x69) return SDL_SCANCODE_RSHIFT;
-+	if(r == Spec|0x6a) return SDL_SCANCODE_RCTRL;
++	if(r == Krshift) return SDL_SCANCODE_RSHIFT;
++	if(r == Krctl) return SDL_SCANCODE_RCTRL;
  
  	if(r >= (KF|1) && r <= (KF|12)) return SDL_SCANCODE_F1 + r - (KF|1);
  
@@ -39,12 +54,27 @@
  					else if(r == Kctl)
  						kmod |= KMOD_LCTRL;
  					else if(r == Kaltgr)
-@@ -323,6 +328,8 @@
+@@ -300,6 +305,10 @@
+ 						kmod |= KMOD_RALT;
+ 					else if(r == Kmod4)
+ 						kmod |= KMOD_LGUI;
++					else if(r == Krshift)
++						kmod |= KMOD_RSHIFT;
++					else if(r == Krctl)
++						kmod |= KMOD_RCTRL;
+ 					else{
+ 						o = npe_sdl.textinput ? r : tolowerrune(r);
+ 						continue;
+@@ -323,6 +332,12 @@
  						kmod &= ~KMOD_LSHIFT;
  					else if(r == Kctl)
  						kmod &= ~KMOD_LCTRL;
 +					else if (r == Kcaps)
 +						kmod &= ~KMOD_CAPS;
++					else if (r == Krshift)
++						kmod &= ~KMOD_RSHIFT;
++					else if (r == Krctl)
++						kmod &= ~KMOD_RCTRL;
  					else{
  						t = Rup;
  						send(salt[Ckey].c, &r);