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