[✓][SUG][PL] Support for modifier (Ctrl, Shift, Alt) + hotkeys

Started by Guigui, January 17, 2026, 02:08:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guigui

I love my mousewheel ! And while playing I am undecided wether to use it for the zoom in/out (default iirc), or for the frame stepping forward/backward. So why not use it for both ?

Ideally I think it'd be nice to be able to achieve the following settings :

* mousewheel up = zoom in
* mousewheel down = zoom out (this is already the case by default iirc)

* CTRL + mousewheel up = chosen number of frames step forward
* CTRL + mousewheel down = chosen number of frames step backward



Save One level pack : do you have what it takes to save one Lemming ?
16 levels of medium-hard difficulty.
https://www.lemmingsforums.net/index.php?topic=7216.0

Bravo jolie Ln, tu as trouvé : l'armée de l'air c'est là où on peut te tenir par la main.

WillLem

Quote from: Guigui on January 17, 2026, 02:08:32 AM* CTRL + mousewheel up = chosen number of frames step forward
* CTRL + mousewheel down = chosen number of frames step backward

Hm. I agree, but this would mean treating the modifier keys only as modifiers. They could no longer be used on their own as single-fire key events.

I'm pretty sure a hack exists where you can use a modifier with itself (so, Ctrl+Ctrl) to get essentially the same behaviour as a single keypress, but I wonder if the key has to be held for a certain amount of time for that to work.

So, would anybody mind this being changed? Allow the modifiers to be used as modifiers, but no longer as hotkeys by themselves?

Simon

You don't have to remove single keybindings for this. The program should be able to fire event A on LCtrl-down, and later fire event B on ((LCtrl-held or RCtrl-held) + another-key-down).

LShift-down and LCtrl-down are handy in a left-hand layout.

Does the trouble arise from the design of the keybinding dialog?

-- Simon

WillLem

Quote from: Simon on January 20, 2026, 07:56:00 AMDoes the trouble arise from the design of the keybinding dialog?

No. I don't think the program is able to distinguish between "keydown" and "keyheld", at least not currently.

Wouldn't "keyheld" necessarily have to fire "keydown" anyway? I could be incorrect in this assumption.

Anyways, what would be possible without changing or adding any existing modifier key logic would be to simply implement "Ctrl + zoom hotkey in/out = frame step +1/-1." I'm happy to add that. Most users are likely to leave zoom in/out linked to the mousewheel, and it seems a good idea to also be able to framestep like this by default.

A thought occurs though. Using the mousewheel to framestep is a good idea, but maybe the increments should be slightly larger than 1. I'd suggest somewhere between 5 and 10 as a good alternative. It makes movement forwards & backwards more what you'd expect from mousewheel use.

Guigui

I see the trouble coming from having the modifier keys used only for modifiers too. I think it'd break the habits of many player.
So yeah maybe the latter solution by WillLem where you set a default frameskip on CTRL+wheel up or down is the best.

Personnaly I'd prefer the frame skip to be +/1 frame on the CTRL+wheel, I like to have precise frame step at hand and can use the keyboard if I want faster skips. But while we're at it, why not :

* wheel only = zoom as usual
* CRTL+wheel = +/- 1 frame skip
* SHIFT+wheel = +/- 10 frames skip



Save One level pack : do you have what it takes to save one Lemming ?
16 levels of medium-hard difficulty.
https://www.lemmingsforums.net/index.php?topic=7216.0

Bravo jolie Ln, tu as trouvé : l'armée de l'air c'est là où on peut te tenir par la main.

WillLem

Linking the proposed behaviour to the zoom hotkeys as opposed to directly to the mousewheel handler is by far the easier approach to take here. It's a few lines of code and it works perfectly.

Attempting to hard-code it to the wheel would be a lot more of a bug-prone effort. The wheel can currently have any hotkey action linked to it, so we'd have to find a way to bypass that action (from a place of not necessarily knowing what the action is) as well as implementing the new framestepping behaviour and ensuring that other mousewheel event handling isn't affected. Not trivial, and tbh not worth the effort.

Let's add the framestepping behaviour as a modifier-accessible action of zoom in/out, then. I imagine that the vast majority of users keep zoom in/out linked to the mousewheel anyway. The framestepping, then, is a nice added bonus.

So, ensuring that zoom in/out remains linked to the mousewheel, we have:

Wheel only = zoom in/out
Ctrl+Wheel = step +1/-1
Shift+Wheel = step +10/-10
Alt+Wheel = step +100/-100

Let's give this a try in CE 1.1 and see what we think.

Implemented in commit 2b75880.