Skip to content

Commit 95348aa

Browse files
authored
Merge pull request #42 from ovpoddar/main
update the Linux scroll issue, and also modify the windows error.
2 parents 02ed37a + e3793fc commit 95348aa

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

Desktop.Robot/Linux/Robot.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,24 @@ public override void MouseMove(int x, int y)
7171

7272
public override void MouseScrollVertical(int value)
7373
{
74-
if (value < 0)
74+
do
7575
{
76-
click(true, Common.UP_BUTTON);
77-
Thread.Sleep(-value);
78-
click(false, Common.UP_BUTTON);
79-
}
80-
else
81-
{
82-
click(true, Common.DOWN_BUTTON);
83-
Thread.Sleep(value);
84-
click(false, Common.DOWN_BUTTON);
76+
if (value < 0)
77+
{
78+
click(true, Common.UP_BUTTON);
79+
Thread.Sleep(100);
80+
click(false, Common.UP_BUTTON);
81+
value++;
82+
}
83+
else
84+
{
85+
click(true, Common.DOWN_BUTTON);
86+
Thread.Sleep(100);
87+
click(false, Common.DOWN_BUTTON);
88+
value--;
89+
}
8590
}
91+
while (value != 0);
8692
}
8793

8894

Desktop.Robot/Windows/Robot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ public enum InputType : uint
171171

172172
public override void MouseScrollVertical(int value)
173173
{
174-
var input = new[]
174+
var inputs = new[]
175175
{
176176
new Input
177177
{
178178
Type = InputType.Mouse,
179179
MouseInputWithUnion = new MouseInput(value, MouseState.MouseWheelUpDown)
180180
}
181181
};
182-
var response = SendInput(1, input, Marshal.SizeOf(input));
182+
var response = SendInput(1, inputs, Marshal.SizeOf(inputs[0]));
183183
Debug.Assert(response == 0);
184184
}
185185
}

0 commit comments

Comments
 (0)