ControlClick coord issues with mouse wheel. Topic is solved

Report problems with documented functionality
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

ControlClick coord issues with mouse wheel.

Post by safetycar » 20 Nov 2021, 09:43

I've noticed ControlClick misbehaving when the action is a wheel movement depending on the window position.
It was a bit weird to find because not all type of windows fail, but it affects windows like Firefox and Chrome.
To explain it a bit easier, if we imagine the screen as a table of 2x2, ControlClick will work fine when the window has a size and position similar to the cell A1 but will fail on A2, B1 and B2.

After searching it seems to be explained by lParam descriptions on different messages.

Values like WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN... are described as:
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
While WM_MOUSEWHEEL and WM_MOUSEHWHEEL, show this:
lParam
The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.
The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.
Compensating the ControlClick by creating coordinates relative to screen seems to confirm this.
This is some code that I used for testing (while moving the window around):

Code: Select all

f1::
WinGetPos, X, Y, W, H, A
control_desc := "x" X+W/2 " y" Y+H/2
control_desc := "" ; Comment the line out to apply the alternative.
ControlClick, %control_desc%, A, , WheelDown
Sleep, 300
ControlClick, %control_desc%, A, , WheelUp
return

joefiesta
Posts: 494
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: ControlClick coord issues with mouse wheel.

Post by joefiesta » 20 Nov 2021, 10:24

You haven't said in what way controlclick fails or misbehaves. Nor do I understand what "values" like WM_LBUTTONDOWN have to do with your issue.

safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: ControlClick coord issues with mouse wheel.

Post by safetycar » 20 Nov 2021, 10:48

joefiesta wrote:
20 Nov 2021, 10:24
You haven't said in what way controlclick fails or misbehaves. Nor do I understand what "values" like WM_LBUTTONDOWN have to do with your issue.
Because of the coordinate issues it doesn't do the scroll action in coordinates that are too far from the top left corner of the screen.
The documentation of ControlClick says that it takes coordinates relatives to the window, but if done like that normal buttons like Left and Right work but WheelUp and WheelDown fail. (In windows like firefox and chrome)
As far as I could tell ControlClick calls PostMessage with those WM_ parameters and that's why it seems relevant the comparison.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: ControlClick coord issues with mouse wheel.

Post by swagfag » 27 Jan 2022, 09:48

thats some nice microsoft/windows bullshit, but yeah, it can and probably should be fixed in-source.
right now it unconditionally assumes all coordinates are client-based, so it casts them to screen, but there should be a distinction for mousewheel messages

guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: ControlClick coord issues with mouse wheel.

Post by guest3456 » 27 Jan 2022, 11:39

if we are changing ControlClick, it would be nice to have a WM_MOUSEMOVE option added to also first send that msg before sending the click message:

https://www.autohotkey.com/board/topic/96952-possible-controlclick-improve/


lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: ControlClick coord issues with mouse wheel.  Topic is solved

Post by lexikos » 20 Apr 2022, 06:56

Fixed by v1.1.33.11.

Post Reply

Return to “Bug Reports”