From ff535843e88973e12fc22a41881b38e3f27cc5aa Mon Sep 17 00:00:00 2001 From: George Sokianos Date: Tue, 21 Dec 2021 20:26:28 +0000 Subject: [PATCH] Fixed keyboard shortcuts --- README_OS4.md | 4 ++-- data/core/keymap.lua | 3 ++- data/core/modkeys-os4.lua | 15 +++++++++++++++ src/main.c | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 data/core/modkeys-os4.lua diff --git a/README_OS4.md b/README_OS4.md index 13716742..f84725e6 100644 --- a/README_OS4.md +++ b/README_OS4.md @@ -24,10 +24,10 @@ SetEnv SAVE HOME "Sys:home/" ## TODO list - Free lost Gfx memory -- Make the keyboard shortcuts work. Now, everything can be done with mouse clicks at the toolbar at the bottom of the file list at the left. +DONE - Make the keyboard shortcuts work. Now, everything can be done with mouse clicks at the toolbar at the bottom of the file list at the left. - If `HOME` is not set, set it to program folder on program run, having that as an ENV variable, without saving it (only in ENV:) - Make the application aknowledge of the executable file name. Now it works only with the filename `lite` -- Add Amiga versionings +- Add Amiga versioning - Fix the resolution of the fullscreen mode - Fix load file when add an Amiga path at the search line - Add menu items diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 84bcd770..5e09775e 100755 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -6,9 +6,10 @@ keymap.map = {} keymap.reverse_map = {} local macos = rawget(_G, "MACOS_RESOURCES") +local os4 = rawget(_G, "AMIGAOS4") -- Thanks to mathewmariani, taken from his lite-macos github repository. -local modkeys_os = require("core.modkeys-" .. (macos and "macos" or "generic")) +local modkeys_os = require("core.modkeys-" .. (macos and "macos" or os4 and "os4" or "generic")) local modkey_map = modkeys_os.map local modkeys = modkeys_os.keys diff --git a/data/core/modkeys-os4.lua b/data/core/modkeys-os4.lua new file mode 100755 index 00000000..45522e66 --- /dev/null +++ b/data/core/modkeys-os4.lua @@ -0,0 +1,15 @@ +local modkeys = {} + +modkeys.map = { + ["left amiga"] = "cmd", + ["right amiga"] = "cmd", + ["control"] = "ctrl", + ["left shift"] = "shift", + ["right shift"] = "shift", + ["left alt"] = "alt", + ["right alt"] = "altgr", +} + +modkeys.keys = { "cmd", "ctrl", "alt", "altgr", "shift" } + +return modkeys diff --git a/src/main.c b/src/main.c index 5ed8c144..8489ba52 100644 --- a/src/main.c +++ b/src/main.c @@ -168,6 +168,10 @@ init_lua: enable_momentum_scroll(); #endif +#ifdef __amigaos4__ + lua_setglobal(L, "AMIGAOS4"); +#endif + const char *init_lite_code = \ "local core\n" "xpcall(function()\n"