Untrap Mouse with Remappable Hotkey

Started by WillLem, April 14, 2023, 04:27:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

The mouse is currently untrapped by either Alt+Tab or fast movement. Could the hotkey be assignable instead of set to Alt+Tab?

Simon

#1
Alt+Tab is Windows's built-in to focus a different window. Lix doesn't trigger the focussing/unfocussing, Windows does. Lix merely reacts to the focussing/unfocussing that Alt+Tab produces: On losing focus, I untrap. On regaining focus, I trap. I'll keep this behavior in addition to any mappable hotkeys.

What do you expect from a custom hotkey that Alt+Tab doesn't give you?
Merely easier to press?
Something else?

Have you activated Options -> Controls -> Fast Movement Untraps Mouse?
What problems does that option have?

I still have an open bug from 2017 on github, #233: Windows, mouse feels too strongly trapped even with fast-untraps.
Do you have this problem with the activated option Fast Movement Untraps Mouse?
Should we lower the threshold on Windows for Fast Movement Untraps Mouse?

-- Simon

Forestidia86

You can untrap with the Win key as well I think.

WillLem

Quote from: Simon on April 14, 2023, 08:48:18 AM
Alt+Tab is Windows's built-in to focus a different window. Lix doesn't trigger the focussing/unfocussing, Windows does.

Ah, that explains why it sometimes auto-switches to Explorer view or other Desktop applications. Another reason I don't favour this hotkey combo, but good to know why it's happening.

Quote from: Simon on April 14, 2023, 08:48:18 AM
What do you expect from a custom hotkey that Alt+Tab doesn't give you?
Merely easier to press?

Don't undermine/underestimate ease of use.

Hitting 2 keys vs hitting 1 key is already 50% less efficient. Factor in that one of these keys must be held whilst hitting the other, and you could argue it's up to 75% less efficient than just hitting one key.

Splitting hairs, maybe, but improvement is improvement.

Quote from: Simon on April 14, 2023, 08:48:18 AM
Have you activated Options -> Controls -> Fast Movement Untraps Mouse?
What problems does that option have?

To be fair, it's probably my own fault that I have issues with the fast-movement mechanism.

Like with most other windowed software than I use, I have the window edges almost to the edge of the screen. I do this so that I can access the desktop and taskbar easily, but still get almost a full screen's worth of app. With this being the case, it's far too easy for the mouse to drift back into the Lix window and get re-trapped.

So, to answer the second part of this - my problem is more due to my chosen window size than with the speed of the untrap mechanism itself.

Maybe the app shouldn't re-trap unless directly interacted with? I'm pretty sure Neo/SuperLemmix behaves this way (i.e. once untrapped, you can drift the cursor across the window without the app trapping it again).

Quote from: Forestidia86 on April 14, 2023, 06:50:33 PM
You can untrap with the Win key as well I think.

Indeed you can. But, this also opens the Windows menu, which must then be closed. Hitting the Win key twice is better than Alt+Tab, admittedly. It's still 50% less efficient than a single hotkey, but - again - maybe I'm being a bit pedantic here.

Thinking about it, the behaviour I'm actually after is for Lix not to re-trap the mouse unless directly interacted with. Then, fast movement to untrap would be fine.

Simon

#4
Thanks, this is helpful.

For Lix 0.10.8, I'll remove the re-trapping on mouseover. You'll have to click into Lix to re-trap the mouse. Lix 0.10.8 will release this weekend. Lix 0.10.8 is out.

-- Simon

Simon

Last month, WillLem and I talked in Mumble about the mouse-trapping/freeing behavior. I changed it between 0.10.7 and 0.10.8, and it's identical from Lix 0.10.8 through Lix 0.10.10.

I forgot to write down your verdict. I believe you wanted stronger resistance, but not impossible resistance, against fast-movement-frees-mouse.

WillLem: What would you like exactly?

-- Simon

Simon

From September 2017 by mobius:
github #233: Windows, mouse feels too strongly trapped even with fast-untraps

mobius wanted the trapping weaker, but WillLem wants it stronger.

Should we have an option to set the strength with which you have to move the mouse against the sides to untrap?

-- Simon

WillLem

Quote from: Simon on May 31, 2023, 10:31:49 PM
WillLem: What would you like exactly?
---
Should we have an option to set the strength with which you have to move the mouse against the sides to untrap?

Honestly, a dedicated hotkey would be best. But, the idea of being able to set the release strength seems to be the best option for the mouse movement since it fits more use cases, so I support that as well.

Simon

This is still open. There should be the remappable mouse-freeing key, the strength setting, or both.

-- Simon

WillLem

Reading a few of the recent Lix topics reminded me of this one.

Remappable hotkey would still be great if it isn't too difficult to implement. Adjustable movement strength would also be welcome.

If you like, it might be a fun challenge for me to try doing these features myself and send them to you as a PR! Let me know if you'd be happy with this and I'll gladly take a look at it.

Simon

#10
I do weird things with the mouse, but have your best shot at it, sure.

For development, win-build.bat isn't ideal; it produces optimized release builds and takes a long time to run. You'll want fast compile times.

In the Lix root directory, open a shell (shift + right click, then: open terminal or open command prompt). The command line during development will be dub build to only build it, or dub (without anything else) to build and run it. Press up-arrow to re-run a previous command.

Interesting starting points can be hardware/mouse.d and file/options/allopts.d.

The hotkey will be universal throughout the entire graphical program. Most hotkeys are not like that; the only other hotkey of this nature is the screenshotting key. Maybe imitate what I do for that.

-- Simon

WillLem

OK, I'm running into some issues getting D set up on my system. It wants to install Visual Studio 2019 but I already have 2022.

Could we meet on Mumble sometime? It might will definitely be easier to get everything set up and running with you there! Once setup is done and I can build Lix, I'll be happy to take a look at the proposed hotkey feature.

Simon

This Sunday, Nov 24th, at 15:00 UTC, I'll have time for Mumble. We should be done after 0-2 hours. There will be multiplayer Lix on 18:00 UTC.

Uncheck all Visual Studio things that the installer offers. I haven't installed Windows DMD in a while (I've been building Windows binaries with LDC and use an outdated DMD for smaller tests), I don't know 100 % what the current installer does.

-- Simon

WillLem

Quote from: Simon on November 22, 2024, 11:12:21 PMThis Sunday, Nov 24th, at 15:00 UTC, I'll have time for Mumble. We should be done after 0-2 hours. There will be multiplayer Lix on 18:00 UTC.

Great, see you then! I'll join the Lix multiplayer as well :)

Simon

I investigated the mouse code with WillLem, and showed him how to reveal the OS mouse cursor at all times in addition to the Lix crosshair.

When I saw this in action, I realized: It should be easy to make an option for the strength of the trapping. But does anybody want a strength option? The alternative would be a hotkey to release the mouse on demand.

Even now, it should already be possible to untrap by pressing Alt+Tab or the Win key.

-- Simon