joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.66k stars 378 forks source link

CTRL + Break from keyboard not working in Comal 2.2 #2559

Open Mikjaer opened 3 years ago

Mikjaer commented 3 years ago

Describe the bug When running Comal 2.2 the CTRL+C / BREAK combo would normally halt program executing on a physical dos system, but on dosbox-x the key-combo does not do anything, but when the ctrl+c is sent through the drop-down menu, the program behaves as expected.

To Reproduce Steps to reproduce the behavior:

  1. Download https://archive.org/details/uni-comal-2.2dos and unpack it somewhere, where dosbox can access it.
  2. Start dosbox, go to directory containing the comal files and run comal
  3. Enter following program: 10 go: 20 print "Foobar" 30 goto go
  4. type "run"
  5. try to use ctrl+c or ctrl+break to halt program execution
  6. try to do it with the menu.

Environment (please complete the following information):

I am pretty sure that this has worked with me before on an earlier install, but i don't have anymore details right now.

Wengier commented 3 years ago

I have tested the program you linked. It is apparently a GW-BASIC-like language where you can break from a running program by pressing Ctrl+Break. However, pressing Ctrl+C won't break from the program, even when I run it from a real MS-DOS system (same for GW-BASIC). So the behavior in DOSBox-X is correct for Ctrl+C, because it is the same when you run it from a real DOS system. As for Ctrl+Break, it does not work on your system probably because the key combination has been hooked by the Windows system, and this was in fact why we added the ability to send the Ctrl+Break key from the drop-down menu. You can either do it from the drop-down menu, or define another key (or key combination) to behave like the Ctrl+Break in order to do it via keyboard instead (define it from the Mapper Editor and then select "Mapper 'Send special key': Ctrl+Break"). Hope this helps.

Mikjaer commented 3 years ago

Maybe that would be an idea to implement this as a default-setting :-)

And yes, Comal is a software development language based on Basic with som structure, mostly stolen from Pascal-type-languages, added on :-)

Wengier commented 3 years ago

DOSBox-X should support Ctrl+Break pretty well as of the latest version (0.83.13 or the upcoming 0.83.14 version), as long as the key is indeed received by DOSBox-X itself. I am not quite sure what "this" refers to when you said "implement this as a default-setting". Can you please explain? Thanks.

Mikjaer commented 3 years ago

"this" refers to the fix you just suggested. It is pretty common to expect ctrl+c alongside ctrl+break, so if ctrl+break for some reason is not working - it would be nice to have the other combo as a fallback :-)

Wengier commented 3 years ago

Sure, you can define the Ctrl+C key combination to act as the Ctrl+Break key combination in the mapper for this if you like, but in such case if a DOS program (e.g. DOS EDIT) specifically expects the Ctrl+C key combination to perform a different function (such as clipboard copy) then it may not work as expected because you have already used it for the purpose of Ctrl+Break. Even though Ctrl+C and Ctrl+Break may have the same functions in some programs, this may not be the case in other programs. Clearly, making this the default setting may cause other problems, and as DOSBox-X wants to implement emulations accurately (i.e. to have the same behavior as in real DOS systems), I would strongly suggest to you to define the key combination yourself for your purpose instead, since the current behavior for Ctrl+C is indeed exactly how it works in a real DOS system, but DOSBox-X does allow you to customize its settings in any ways you wish (even though it is not the default setting). Hope this helps.

Mikjaer commented 3 years ago

To be honest i really don't need "help" i just wanted to report a bug, good luck and thank you.

⁣Get BlueMail for Android ​

On May 31, 2021, 00:15, at 00:15, Wengier @.***> wrote:

Sure, you can define the Ctrl+C key combination to act as the Ctrl+Break key combination in the mapper for this if you like, but in such case if a DOS program (e.g. DOS EDIT) specifically expects the Ctrl+C key combination to perform a different function (such as clipboard copy) then it will may not work as expected because you have already used it for the purpose of Ctrl+Break. Clearly, making this the default setting may cause other problems, and as DOSBox-X wants to implement emulations accurately (i.e. to have the same behavior as in real DOS systems), I would strongly suggest to you to define the key combination yourself for your purpose instead, since the current behavior for Ctrl+C is indeed exactly how it works in a real DOS system, but DOSBox-X does allow you to customize its settings in any ways you wish. Hope this helps.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/joncampbell123/dosbox-x/issues/2559#issuecomment-851069357

Wengier commented 3 years ago

@Mikjaer Got it. I certainly appreciate your feedback too.

grapeli commented 3 years ago

Dosbox-X (Linux SDL2) Ctrl-Break breaks this loop. When I run with keyboard event logging, I get this information. SDL_EVENT_LOGGING=1 dosbox-x

INFO: SDL EVENT: SDL_KEYDOWN (timestamp=146803 windowid=2 state=pressed repeat=false scancode=59 keycode=1073741883 mod=0)
INFO: SDL EVENT: SDL_KEYUP (timestamp=146933 windowid=2 state=released repeat=false scancode=59 keycode=1073741883 mod=0)
INFO: SDL EVENT: SDL_KEYDOWN (timestamp=147863 windowid=2 state=pressed repeat=false scancode=224 keycode=1073742048 mod=64)
INFO: SDL EVENT: SDL_KEYMAPCHANGED
INFO: SDL EVENT: SDL_KEYDOWN (timestamp=148618 windowid=2 state=pressed repeat=false scancode=72 keycode=1073741896 mod=64)
INFO: SDL EVENT: SDL_KEYUP (timestamp=148625 windowid=2 state=released repeat=false scancode=72 keycode=1073741896 mod=64)
INFO: SDL EVENT: SDL_KEYUP (timestamp=148630 windowid=2 state=released repeat=false scancode=224 keycode=1073742048 mod=0)

F2 - scancode=59, LCTRL - scancode=224, Pause - scancode=72 https://github.com/libsdl-org/SDL/blob/main/include/SDL_scancode.h

Wengier commented 3 years ago

@grapeli Yes, the Windows system appears to hook the Ctrl+Break key combination for itself and block it from other applications, unfortunately. But Linux does not do this, so Ctrl+Break will work there. That is why Ctrl+Break is considered a special key that appears in the drop-down menu.

Wengier commented 3 years ago

@Mikjaer I certainly hope to find a way to unhook the Ctrl+Break key combination from Windows so that it can be used normally in DOSBox-X too, but so far I have not found a direct solution to this, and the menu item for Ctrl+Break is the closest thing to it. Or you can always assign another key combination to achieve this function (as mentioned earlier).