TolikPylypchuk / SharpHook

SharpHook provides a cross-platform global keyboard and mouse hook, event simulation, and text entry simulation for .NET
https://sharphook.tolik.io
MIT License
347 stars 32 forks source link

Mouse movement issue in sharphook with multiple displays #104

Closed imtadashi closed 5 months ago

imtadashi commented 6 months ago

I was testing Sharphook in my application and found an issue. I have 3 displays in this order where Display 1 is the primary display image

At first with this display order mouse movement works fine, but when I remove the 3rd display, image

I get mouse conflict. I noticed that the mouse movements x axis is like this: Actual X axis: 50 3rd Display Width(removed display): 500 Executing X axis: 50 + 500 (removed 3rd display width)

But while the process was running, if I start another application, that new x axis is working fine. But the one already created before removing the 3rd display has the issue.

TolikPylypchuk commented 6 months ago

Hi! Thanks for posting this issue!

Could you please clarify a little what you mean? Is this a problem with a global hook reporting incorrect mouse coordinates, or is it a problem with simulating mouse movement using EventSimulator? Also, do you mean that this happens only while an application is already running when you remove the screen, correct?

imtadashi commented 6 months ago

Hi @TolikPylypchuk

This problem occurs when simulating mouse movement using EventSimulator. And this happens only while an application is already running when I remove the screen. If I run the application after I removed the screen, simulations works fine.

I tested with two applications at the same time. First I started Application-1 and removed a screen. Now the problem occurs. Then I started Application-2. But in Application-2, mouse movement works fine. At the same time in Application-1, mouse movement has issues.

TolikPylypchuk commented 6 months ago

OK, got it. I will look into it soon.

TolikPylypchuk commented 5 months ago

I've fixed the problem, and the fix will be available in the next release - hopefully, soon as I have one more bug to tackle.

TolikPylypchuk commented 5 months ago

I've just released version 5.3.5 which fixes this bug, so this issue can be closed.