Skip to main content
Topic: r2611 - keys ctrl+M (Read 3110 times) previous topic - next topic

Re: r2611 - keys ctrl+M

Reply #1
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 ****ociate 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.

Re: r2611 - keys ctrl+M

Reply #2
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.. :)

Re: r2611 - keys ctrl+M

Reply #3
In trunk, seems to work as intended.


 

Re: r2611 - keys ctrl+M

Reply #5
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.

Re: r2611 - keys ctrl+M

Reply #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 p****ed to the main event handler.

That means, Ctrl+M releases focus in textinput, but will be p****ed 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.