aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneonloop2023-01-22 22:53:47 +0000
committerneonloop2023-01-22 22:53:47 +0000
commit2d94e73539d4ce5de7b998184c2fc0acb23eed1e (patch)
tree1bc8c6d22741002f7b551a98b285f149acf04999
parent7b7d36c91bed45b22ff00a709a108239c25aeaa9 (diff)
downloadpicoarch-2d94e73539d4ce5de7b998184c2fc0acb23eed1e.tar.gz
picoarch-2d94e73539d4ce5de7b998184c2fc0acb23eed1e.tar.bz2
picoarch-2d94e73539d4ce5de7b998184c2fc0acb23eed1e.zip
Fixes conflict between letter and menu action
On some devices, buttons are mapped to letter keys. During file selection, libpicofe would respond to the button press and the letter press, this could cause a freeze. Instead, button presses should never be treated as letter presses.
-rw-r--r--Makefile6
-rw-r--r--patches/libpicofe/0003-avoid-button-conflict.patch17
2 files changed, 21 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 44c2c68..f2488aa 100644
--- a/Makefile
+++ b/Makefile
@@ -147,10 +147,12 @@ print-%:
all: $(BIN) cores
libpicofe/.patched:
- cd libpicofe && git apply -p1 < ../patches/libpicofe/0001-key-combos.patch && git apply -p1 < ../patches/libpicofe/0002-small-screen.patch && touch .patched
+ cd libpicofe && ($(foreach patch, $(sort $(wildcard patches/libpicofe/*.patch)), git apply -p1 < ../$(patch) &&) touch .patched)
+
+reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
clean-libpicofe:
- test ! -f libpicofe/.patched || (cd libpicofe && git apply -p1 -R < ../patches/libpicofe/0002-small-screen.patch && git apply -p1 -R < ../patches/libpicofe/0001-key-combos.patch && rm .patched)
+ test ! -f libpicofe/.patched || (cd libpicofe && ($(foreach patch, $(call reverse,$(sort $(wildcard patches/libpicofe/*.patch))), git apply -R -p1 < ../$(patch) &&) rm .patched))
plat_trimui.o: plat_sdl.c
plat_funkey.o: plat_sdl.c
diff --git a/patches/libpicofe/0003-avoid-button-conflict.patch b/patches/libpicofe/0003-avoid-button-conflict.patch
new file mode 100644
index 0000000..c7ff40e
--- /dev/null
+++ b/patches/libpicofe/0003-avoid-button-conflict.patch
@@ -0,0 +1,17 @@
+diff --git a/in_sdl.c b/in_sdl.c
+index a84c781..22d3b01 100644
+--- a/in_sdl.c
++++ b/in_sdl.c
+@@ -476,10 +476,8 @@ static int in_sdl_menu_translate(void *drv_data, int keycode, char *charcode)
+ else
+ {
+ for (i = 0; i < map_len; i++) {
+- if (map[i].key == keycode) {
+- ret = map[i].pbtn;
+- break;
+- }
++ if (map[i].key == keycode)
++ return map[i].pbtn;
+ }
+
+ if (charcode != NULL && (unsigned int)keycode < SDLK_LAST &&