ref: 97b0f025ed8634b2c7c9a346330226aea0788f82
parent: 081e2f6b62a7c9372862b6ff83a93cbaae3eb9dc
author: qwx <qwx@sciops.net>
date: Sun Nov 27 04:27:24 EST 2022
npe-modhacks: add volume up/down, default ft2 volume shortcuts broken
--- a/npe-modhacks
+++ b/npe-modhacks
@@ -6,7 +6,7 @@
SDLK_LALT = Kalt,
SDLK_RALT = Kaltgr, /* FIXME what about keyboards without it? */
- /* FIXME no distinction */
-+ /* FIXME hacks */
++ /* FIXME: hacks */
+ Krshift = Spec|0x69,
+ Krctl = Spec|0x6a,
SDLK_LSHIFT = Kshift,
@@ -26,16 +26,16 @@
- /* FIXME no distinction */
KMOD_LSHIFT = 1<<0,
- KMOD_RSHIFT = KMOD_LSHIFT,
-+ KMOD_RSHIFT = 1<<6, /* hack */
++ KMOD_RSHIFT = 1<<6,
KMOD_LCTRL = 1<<1,
- KMOD_RCTRL = KMOD_LCTRL,
-+ KMOD_RCTRL = 1<<7, /* hack */
++ KMOD_RCTRL = 1<<7,
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 @@
+@@ -206,6 +206,11 @@
if(r == Kalt) return SDL_SCANCODE_LALT;
if(r == Kmod4) return SDL_SCANCODE_LGUI;
if(r == Kaltgr) return SDL_SCANCODE_RALT;
@@ -42,10 +42,12 @@
+ if(r == Kcaps) return SDL_SCANCODE_CAPSLOCK;
+ if(r == Krshift) return SDL_SCANCODE_RSHIFT;
+ if(r == Krctl) return SDL_SCANCODE_RCTRL;
++ if(r == Kvolup) return SDL_SCANCODE_VOLUMEUP;
++ if(r == Kvoldn) return SDL_SCANCODE_VOLUMEDOWN;
if(r >= (KF|1) && r <= (KF|12)) return SDL_SCANCODE_F1 + r - (KF|1);
-@@ -294,6 +297,8 @@
+@@ -294,6 +299,8 @@
kmod |= KMOD_LALT;
}else if (r == Kshift)
kmod |= KMOD_LSHIFT;
@@ -54,7 +56,7 @@
else if(r == Kctl)
kmod |= KMOD_LCTRL;
else if(r == Kaltgr)
-@@ -300,6 +305,10 @@
+@@ -300,6 +307,10 @@
kmod |= KMOD_RALT;
else if(r == Kmod4)
kmod |= KMOD_LGUI;
@@ -65,7 +67,7 @@
else{
o = npe_sdl.textinput ? r : tolowerrune(r);
continue;
-@@ -323,6 +332,12 @@
+@@ -323,6 +334,12 @@
kmod &= ~KMOD_LSHIFT;
else if(r == Kctl)
kmod &= ~KMOD_LCTRL;