From 53b8c6dd285bf8aabd88c45f7d881d252a98daa9 Mon Sep 17 00:00:00 2001 From: Jumar Macato <16554748+jmacato@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:42:18 +0800 Subject: [PATCH] Reset scroller valuators on XI2Manager.cs (#16185) When the focus is lost to avoid instant jumps when coming/scrolling from another linux window. --- src/Avalonia.X11/XI2Manager.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Avalonia.X11/XI2Manager.cs b/src/Avalonia.X11/XI2Manager.cs index 84ac7f7c9d..e293e6f135 100644 --- a/src/Avalonia.X11/XI2Manager.cs +++ b/src/Avalonia.X11/XI2Manager.cs @@ -217,6 +217,11 @@ namespace Avalonia.X11 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));