News:

Want to praise Simutrans?
Your feedback is important for us ;D.

r2611 - keys ctrl+M

Started by Frank, August 15, 2009, 06:44:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank

The keys ctrl+M not works in Simutrans.

In other windows programms ( Total Commander, Opera ) works keys ctrl+M.

Dwachs

Currently (under Windows - cant test on linux now) ctrl-M and enter are treated as if they were the same keys. The same goes for ctrl-H and backspace.

Here is a patch that works under windows. Would somebody please test under linux? The point is that currently one cannot associate ctrl-M and ctrl-H to tools in menuconf.tab.

Ctrl-V will not work either, it is used for pasting.
Parsley, sage, rosemary, and maggikraut.

gerw

When I pressed Ctrl (and no other key), Simutrans raised a "keycode 0, keymode 2"-event. Thus, keycode 0 should be always ignored. Does this also happend in Windows?

I also I added some comments. And please read documentation/coding_styles.txt  ;) ;D  - I've felt like needing more smileys.. :)

prissi

In trunk, seems to work as intended.


z9999

If text input area is focused, ctrl+M acts as retuen key AND acts as short cut key.
Is this intended ? I tested both GDI and SDL.

Dwachs

#6
This has two reasons: (1) in textinput Ctrl+M and Enter are treated as the same keys, (2) if keyboard event releases focus, this event is passed to the main event handler.

That means, Ctrl+M releases focus in textinput, but will be passed to the main event handler, which calles the tool that is mapped to Ctrl+M. The same happens for Enter, but tools cannot be mapped to this key.

Here is a patch. It fixes this bug, but introduces another one: pressing Esc in text-input will now only release focus but does not close the window immediately.

Another way would be to directly patch textinput. But then Ctrl+Enter won't work like Enter.

The main difficulty is to distinguish Enter, Ctrl+M, and Ctrl+Enter.
Parsley, sage, rosemary, and maggikraut.