Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add resize option to scroll wheel and title bar scroll action #239

Closed
rp1231 opened this issue Jul 29, 2022 · 28 comments
Closed
Labels
enhancement New feature or request WIP Work in progress

Comments

@rp1231
Copy link

rp1231 commented Jul 29, 2022

This was one of the first things that I tried to add it wasn't in the options.
Seems like a very intuitive feature.

@rp1231
Copy link
Author

rp1231 commented Jul 29, 2022

Maybe the window resizes proportionally when scrolling?

@xan2622
Copy link

xan2622 commented Jul 29, 2022

If you meant :

  • scrolling up to resize the window vertically (increasing its height)
  • scrolling down to resize the window horizontally (increasing its width)

... then I like this idea. 👍

There might also be an option to set how many pixels (or % of the size) each mouse wheel notch should increase.

@rp1231
Copy link
Author

rp1231 commented Jul 29, 2022

What I meant was:

  • Scrolling up makes the window larger
  • Scrolling down makes the window smaller
    (Both width and height resize proportionally during both actions
    -with the point of origin being the titlebar- in case of the titlebar scroll action
    -the point of origin while using the hotkey can be the window fractions maybe idk)
  • scrolling up to resize the window vertically (increasing its height)
  • scrolling down to resize the window horizontally (increasing its width)

In this case you are just increasing the window, the decreasing part gets completely left out

There might also be an option to set how many pixels (or % of the size) each mouse wheel notch should increase.

This seems like a pretty cool idea

@RamonUnch RamonUnch added the enhancement New feature or request label Jul 30, 2022
@RamonUnch
Copy link
Owner

Here is a quick test version.
The idea is that the zooming mode depends on which of the 9 quadrant you are in.
The corresponding quadrant does not move when you zoom in/out, the center mode zooms in all directions and by default the windows increase/decrease 5% in width and 1% with shift.

It is still work in progress.

AltSnap1.55test5_x64.zip
AltSnap1.55test5_i386.zip

@RamonUnch RamonUnch added the WIP Work in progress label Aug 4, 2022
@xan2622
Copy link

xan2622 commented Aug 4, 2022

I have just tried this "AltSnap1.55test5_x64.zip" version and wow.. this is impressive!
I haven't noticed any bug.

@Ichisich
Copy link

Ichisich commented Aug 4, 2022

One suggestion.

Let the window border recognize the screen edge, or, preferably, behave accordingly to the Snap window edges to: setting.

@RamonUnch
Copy link
Owner

Let the window border recognize the screen edge, or, preferably, behave accordingly to the Snap window edges to: setting.

For sure it is coming...
However it will be like with resizing, the "center" mode does not snap.

@rp1231
Copy link
Author

rp1231 commented Aug 4, 2022

Thanks this works great!

Would it be possible to add horizontal resizing as well along with the vertical resizing?

@rp1231
Copy link
Author

rp1231 commented Aug 4, 2022

Ok I just noticed that the titlebar zoom window action also uses the window fractions.
Would it be possible to add both horizontal and vertical resizing for the center titlebar fraction?

@RamonUnch
Copy link
Owner

Would it be possible to add both horizontal and vertical resizing for the center titlebar fraction?

How would that be done?

Ok I just noticed that the titlebar zoom window action also uses the window fractions.

Usually the Titlebar action is exactly the same than the normal one.

@rp1231
Copy link
Author

rp1231 commented Aug 4, 2022

Would it be possible to add both horizontal and vertical resizing for the center titlebar fraction?

How would that be done?

I'm not a programmer and not sure of the technicalities which is why I am asking if it would be possible.....

Ok I just noticed that the titlebar zoom window action also uses the window fractions.

Usually the Titlebar action is exactly the same than the normal one.

Yep, realized that later on.

@RamonUnch
Copy link
Owner

Here is an improved version.

  • Snapping is supported.
  • more stable when windows gets out of bound (except in center mode)
  • also you can use Ctrl+Wheel in the top-center quadrant for a horizontal (bilateral resize).

hooks1.55test6_i386.zip
hooks1.55test6_x64.zip

@RamonUnch
Copy link
Owner

Would it be possible to add both horizontal and vertical resizing for the center titlebar fraction?

How would that be done?

I'm not a programmer and not sure of the technicalities which is why I am asking if it would be possible.....

Actually I was just wondering which key could have been used to invert between horizontal and vertical, but Ctrl is the obvious choice as it can already be used to idicate a vertical only center resize (using the resize action).

@rp1231
Copy link
Author

rp1231 commented Aug 4, 2022

Aah ok, I see. I misunderstood XD
What I meant was that in the titlebar scroll action the window should resize in both directions(horizontal and vertical) by default.
Having a key(ctrl) in this case defeats the purpose of a titlebar scroll action as it is usually used when a key(alt) cannot be pressed.

The test6 works fine btw

@RamonUnch
Copy link
Owner

What I meant was that in the titlebar scroll action the window should resize in both directions(horizontal and vertical) by default.

You mean only in the case of titlebar?
I think a separate action could be made that would expend more like that so that people have more choice.

@RamonUnch
Copy link
Owner

RamonUnch commented Aug 5, 2022

This one have two zoom option, the second one corresponds to what you want.
You can exchange between both behavior using Ctrl.
AltSnap1.55test7_x64.zip
AltSnap1.55test7_i386.zip

@rp1231
Copy link
Author

rp1231 commented Aug 5, 2022

Yes, this works perfect!
Can it also be made to respect the resizing rules of the window.

For example the AltSnap configuration window can't be resized normally.
But using AltSnap, you can resize it and it leads to weird proportions.
AltSnap_KQEzWOjOfX

Similarly, with mpv, a media player.
Normally when you resize the window, the window size conforms to the aspect ratio of the window.
But when you resize it using Alt snap, It stops following those rules.

@RamonUnch
Copy link
Owner

RamonUnch commented Aug 5, 2022

hooks1.55test8_i386.zip
hooks1.55test8_x64.zip

Aspect ratio cannot be perfect because there is a minimum step in each direction for snapping, plus there is rounding error at every step.

You can prevent AltSnap from resizing windows that are not resizable by disabling the Resize all windows option. this is unrelated and has been the case for a while now.

This version also fixes the window running out of the screen when zooming too much problem.

@rp1231
Copy link
Author

rp1231 commented Aug 5, 2022

Thanks,
Disabling the resize all windows option fixed the problem.

And I can confirm that the running out of screen problem is fixed as well.

@RamonUnch
Copy link
Owner

Well I improved slightly the snapping behavior, to make it a bit less snappy in some cases.
The advantage is that it no longer sticks when resizing slowly.

The other advantage is that it can now keep the aspect ratio of windows much better. Not perfect though.

Also you can configure the ZoomFrac and ZoomFracShift values in the [Advanced] section of the .ini file, to select by which fraction of the window it should increase / decrease its size.
Default was ZoomFrac=20 ZoomFracShift=100 increasing by a 20th/100th. but I found that it was a bit slow for me so I set the default to 16th/64th which seems a slightly better balance for me.

In the [Advanced] section


ZoomFrac=16
ZoomFracShift=64
; By which fraction (2-255) the Zoom action should increase/decrease the size
; of the pointed window. ZoomFrac is without shift and ZoomFracShift
; is with shift. Default is 16th/64th (ZoomFrac=16, ZoomFracShift=64).
; Formula: New Window Size = OldSize + OldSize/ZoomFrac

AltSnap1.55test14_i386.zip
AltSnap1.55test14_x64.zip

@rp1231
Copy link
Author

rp1231 commented Aug 7, 2022

This build works fine without any problems for me.
Haven't really put the zoomFrac feature through its paces though as I'm pretty happy with the default settings.

Regarding the aspect ratio, I'm not really able to tell the difference tbh.
Just wanted to ask what the difference in resizing method is between resizing with the mouse without altsnap,
and resizing with altsnap.

Bringing this up just with regards to the mpv player specifically:
If I resize the window without altsnap, it is configured to stick to the aspect ratio of the video and it works fine.

But if I resize the window with altsnap, it behaves as if the aspect ratio restriction doesn't exist at all, even if the resize all windows option is turned off.

Would there be any way to send the normal mouse resizing command instead of the altsnap resizing command?

I hope I'm making sense.

@RamonUnch
Copy link
Owner

Would there be any way to send the normal mouse resizing command instead of the altsnap resizing command?

Unfortunately there is only few documented function to move a window and they are all based on SetWindowPos(). I suspect Microsoft added a new way of resizing/moving windows via the DWM but it is not available for programs.

@rp1231
Copy link
Author

rp1231 commented Aug 7, 2022

Ah ok I see.
Thanks.

@rp1231
Copy link
Author

rp1231 commented Aug 26, 2022

Would there be any way to send the normal mouse resizing command instead of the altsnap resizing command?

Unfortunately there is only few documented function to move a window and they are all based on SetWindowPos(). I suspect Microsoft added a new way of resizing/moving windows via the DWM but it is not available for programs.

@RamonUnch
I think I "might" have found a solution for this.
Would it be possible to send a WM_EXITSIZEMOVE message after each/the scroll event for the zoom 2 option?

This is a theory based on this post I found on the autohotkey forums:
https://www.autohotkey.com/boards/viewtopic.php?t=4922#:~:text=In%20my%20case%2C%20I%20solved%20the%20problem%20sending%20the%20WM_EXITSIZEMOVE%20message%3A

This person was facing a similar issue and was able to solve his problem by sending the WM_EXITSIZEMOVE message.

@RamonUnch
Copy link
Owner

I already use the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages in the Move and Resize actions, My observation is that it was mostly a placebo but I forgot to add it to the Zoom action. it will be done for sure.

@rp1231
Copy link
Author

rp1231 commented Aug 27, 2022

I already use the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages in the Move and Resize actions, My observation is that it was mostly a placebo but I forgot to add it to the Zoom action. it will be done for sure.

@RamonUnch
I tried out the code that guy had posted from within autohotkey and it doesn't seem to have any effect.
So I think that it would be best if you didn't waste your effort on this.

Thanks

@rp1231
Copy link
Author

rp1231 commented Aug 27, 2022

I already use the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages in the Move and Resize actions, My observation is that it was mostly a placebo but I forgot to add it to the Zoom action. it will be done for sure.

Also since you already use these messages in the resize action,
and the resize action also leads to the distortion of the aspect ratio.
Sending this message is probably not the solution.

But one last message that I found from the thread is the WM-SIZING message:
https://www.autohotkey.com/boards/viewtopic.php?t=4922#:~:text=messages%2C%20including%20WM_ENTERSIZEMOVE%2C-,WM_SIZING,-and%20WM_EXITSIZEMOVE.

Do you think that would work?
I think this might based on the description here:
https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing

@rp1231
Copy link
Author

rp1231 commented Aug 27, 2022

Ok nvm this as well, I tried out this as well via authotkey and It didn't have any effect.
(If i've done it correctly, at least I think I have)

Let me know if you think otherwise.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Work in progress
Projects
None yet
Development

No branches or pull requests

4 participants