Skip to content

Commit

Permalink
Merge pull request #42 from ovpoddar/main
Browse files Browse the repository at this point in the history
update the Linux scroll issue, and also modify the windows error.
  • Loading branch information
lucassklp committed Jul 1, 2023
2 parents 02ed37a + e3793fc commit 95348aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
26 changes: 16 additions & 10 deletions Desktop.Robot/Linux/Robot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,24 @@ public override void MouseMove(int x, int y)

public override void MouseScrollVertical(int value)
{
if (value < 0)
do
{
click(true, Common.UP_BUTTON);
Thread.Sleep(-value);
click(false, Common.UP_BUTTON);
}
else
{
click(true, Common.DOWN_BUTTON);
Thread.Sleep(value);
click(false, Common.DOWN_BUTTON);
if (value < 0)
{
click(true, Common.UP_BUTTON);
Thread.Sleep(100);
click(false, Common.UP_BUTTON);
value++;
}
else
{
click(true, Common.DOWN_BUTTON);
Thread.Sleep(100);
click(false, Common.DOWN_BUTTON);
value--;
}
}
while (value != 0);
}


Expand Down
4 changes: 2 additions & 2 deletions Desktop.Robot/Windows/Robot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ public enum InputType : uint

public override void MouseScrollVertical(int value)
{
var input = new[]
var inputs = new[]
{
new Input
{
Type = InputType.Mouse,
MouseInputWithUnion = new MouseInput(value, MouseState.MouseWheelUpDown)
}
};
var response = SendInput(1, input, Marshal.SizeOf(input));
var response = SendInput(1, inputs, Marshal.SizeOf(inputs[0]));
Debug.Assert(response == 0);
}
}
Expand Down

0 comments on commit 95348aa

Please sign in to comment.