Skip to content

Commit

Permalink
Reset scroller valuators on XI2Manager.cs (#16185)
Browse files Browse the repository at this point in the history
When the focus is lost to avoid instant jumps when coming/scrolling from another linux window.
  • Loading branch information
jmacato authored and grokys committed Aug 2, 2024
1 parent 157c08c commit 9c920b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Avalonia.X11/XI2Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ private void OnEnterLeaveEvent(IXI2Client client, ref XIEnterLeaveEvent ev)
detail == XiEnterLeaveDetail.XINotifyVirtual)
&& buttons == default)
{
foreach (var scroller in _pointerDevice.Scrollers)
{
_pointerDevice.Valuators[scroller.Number].Value = 0;
}

client.ScheduleXI2Input(new RawPointerEventArgs(client.MouseDevice, (ulong)ev.time.ToInt64(),
client.InputRoot,
RawPointerEventType.LeaveWindow, new Point(ev.event_x, ev.event_y), buttons));
Expand Down

0 comments on commit 9c920b4

Please sign in to comment.