RamonUnch / AltSnap

Maintained continuation of Stefan Sundin's AltDrag
GNU General Public License v3.0
2.08k stars 66 forks source link

Try to Improve Movement pool rate strategy #452

Open RamonUnch opened 1 year ago

RamonUnch commented 1 year ago

With this build you can set RezTimer=3 to combine the the option with the usual Move/Resize rates.

So if you got a 1KHz mouse and a 100Hz Monitor you can try to set MoveRate=10 or maybe a bit lower and set RezTimer=3

It is still WIP...

@Ichisich you might be interested by this build.

AltSnap1.61test21_i386.zip AltSnap1.61test21_x64.zip

Ichisich commented 1 year ago

Looks promising.

Subjective RezTimer=3 and MoveRate=7 gives excellent results with a 1000Hz mouse and 75Hz display. It also consumes less CPU power than RefreshRate=0 or native dragging but a bit more than RezTimer=1, so the later should still be preferable for 60Hz displays.

Additionally, it avoids some strange behavior a low Moverate can have with certain applications (bug of the applications, not AltSnap). It also reduces some 1000Hz polling rate issues https://github.com/RamonUnch/AltSnap/issues/446 thanks to the higher MoveRate, without the disadvantages a higher MoveRate normally has.

Ichisich commented 11 months ago

Subjective RezTimer=3 and MoveRate=7 gives excellent results with a 1000Hz mouse and 75Hz display. It also consumes less CPU power than RefreshRate=0 or native dragging but a bit more than RezTimer=1, so the later should still be preferable for 60Hz displays.

As RezTimer=3 and MoveRate=7 gives great results with 75Hz display refresh and RezTimer=1 with a 60Hz refresh, but judder otherwise: Is there a possibility AltSnap to auto-recognize display refresh changes and adapt accordingly? Alternatively, in case you think this is too niche or intrusive, a simple command line parameter to change RezTimer would already be sufficient.

RamonUnch commented 11 months ago

Is there a possibility AltSnap to auto-recognize display refresh changes and adapt accordingly?

This should already be the case.

RezTimer=2
; Set to 1 to move the window only when the timestamp of
; a mouse event is different from the previous one, every 16ms
; more or less. MoveRate and ResizeRate and RefreshRate
; will have no effect if the option is enabled.
; This is overall the option that gives the best performances.
; It can be combined with FullWin=0 mode for ~0% CPU usage.
; Set to 2 for auto-mode, where RezTimer is only enabled if
; display frequency is set to 60Hz.
; Set to 3 to combine with the MoveRate and ResizeRate options.

However it only checks display frequency once at startup but I do not think people change display settings that often for this to matter.

So what I should do is to also check in the case of RezTimer=3 to be equivalent to RezTimer=1 when using 60Hz monitor.

RamonUnch commented 11 months ago

However there is no reliable way to get mouse frequency. The only way is by asking the user to shake the mouse quickly and to count mouse events/sec.

Ichisich commented 11 months ago

Ah, I still use an older Frankenstein ini and wasn't aware of RezTimer=2.

However it only checks display frequency once at startup but I do not think people change display settings that often for this to matter.

I constantly do, for video editing and video games. But admittedly, it's still a niche issue.

So what I should do is to also check in the case of RezTimer=3 to be equivalent to RezTimer=1 when using 60Hz monitor.

Nah, RezTimer=1 is still the best option for 60Hz. My plea would be to change to RezTimer=3 when changing to everything besides 60Hz and change back to RezTimer=1 when 60Hz gets enabled.

But as I said, if it's too much hassle, a command line like altsnap -rX for the RezTimer would be sufficient.

RamonUnch commented 11 months ago

I will add a -r option to reload the settings. I also will make a RezTimer=4 that auto to 1 or 3 depending on the Display frequency. so you will just have to call AltSnap.exe -r or as usual enable/disable AltSnap. This is the simplest for me.

So you just need to set RezTimer=4.

here is the associated test build: AltSnap1.62test10_x64.zip

Ichisich commented 11 months ago

Thanks, much appreciated.

Ichisich commented 11 months ago

RezTimer=4 works as intended when enabling/disabling Altsnap. altsnap -r seems to not affect the config.

RamonUnch commented 11 months ago

Does it work if you use an admin elevated prompt or if you use runas? I guess I must allow one more messages to go from nona-dmin to admin...

Ichisich commented 11 months ago

You're right, altsnap -r gets recognized when using the elevated console. I didn't consider the config itself as elevated, when using elevated AltSnap.

RamonUnch commented 11 months ago

This build should allow the message to come from a non elevated prompt. AltSnap1.62_test11_x64.zip

Ichisich commented 11 months ago

Perfect.