DIVGAMES / DIV-Games-Studio

Complete cross platform games development package, originally for DOS but now available on modern platforms.
GNU General Public License v3.0
236 stars 30 forks source link

Keyboard shortcuts with Alt + key (Temporarily fixed) #37

Open daltomi opened 2 years ago

daltomi commented 2 years ago

Hi all.

I try to describe the problem with 2 examples:

1) When I have the source editor open (window focus) and I press the keyboard shortcut alt + x (exit), the letter x is printed in the editor 2 times (where the insert cursor is located) before displaying the dialog box corresponding to the shortcut.

2) When I have the source editor open (window focus) and I press the keyboard shortcut alt + f (find) the letter f is printed in the editor 2 times (where the insert cursor is located) before displaying the dialog box corresponding to the shortcut. 1662301040

The same goes for other keyboard shortcuts involving alt, like: alt + s(shell)

Very important: with the keyboard shortcut involving ctrl this does not happen. For example, to search for text there are 2 keyboard shortcuts: alt + f and ctrl + f, only with alt + f the bug happens.

some CMake log

```bash -- BUILDING FOR LINUX -- SETTING SDL to 1.2 -- Buiding LINUX 64bit CMake Warning at CMakeLists.txt:81 (MESSAGE): TODO - FIX RUNNER DEFINITION -- Adding Libraries -- CMAKE_FIND_ROOT_PATH: -- CMAKE_SYSTEM_LIBRARY_PATH: /usr/lib/X11 -- CMAKE_INCLUDE_PATH: -- CMAKE_SYSTEM_INCLUDE_PATH: /usr/include/X11 -- Adding SDL Library -- Adding SDL NET -- Adding SDL Mixer -- Adding ZLIB -- Adding MODE8 (VPE) -- Adding DLL PLUGIN Support -- Using SDL-1 -- Configuring done -- Generating done ```

Note: Linux x64 (ArchLinux), SDL 1.2

Versions:

I apologize in advance if I am late in replying.

Greetings.


Since I don't know if the problem is internal or external, it remains pending:

TODO:

daltomi commented 1 year ago

Very important: with the keyboard shortcut involving ctrl this does not happen. For example, to search for text there are 2 keyboard shortcuts: alt + f and ctrl + f, only with alt + f the bug happens.

As I said it only happens with the alt key, so one solution for now is to ignore that same key as well.

diff --git a/src/divedit.c b/src/divedit.c
index d930c88..1dc0794 100644
--- a/src/divedit.c
+++ b/src/divedit.c
@@ -846,7 +846,7 @@ void editor() {

 //ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ

-  if (!(shift_status&4) && ascii) {
+  if (!((shift_status&4) | (shift_status&8)) && ascii) {
     if (ascii==cr) f_enter(); else if (ascii!=0x1b) {
       if (modo_cursor) f_sobreescribir(); else f_insertar();
     }
MikeDX commented 1 year ago

Would love to see a cross platform fix for this. It also seems to break differently based upon which sdl version is used.