Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Trace what happens between a gesture's press and its drag
KnifeLemonfa6908e2a21b
diff --git a/src/Filee.App/Services/Triggers/TriggerService.cs b/src/Filee.App/Services/Triggers/TriggerService.csindex 94d48244..16c12357 100644--- a/src/Filee.App/Services/Triggers/TriggerService.cs+++ b/src/Filee.App/Services/Triggers/TriggerService.cs@@ -28,14 +28,19 @@ public sealed class TriggerService : IDisposableprivate HashSet<string> _excluded = new(StringComparer.OrdinalIgnoreCase);/// <summary>- /// FILEE_TRACE_GESTURES=1 logs each mouse press and scope decision, to find why a gesture doesn't fire, and on- /// Windows each mouse move that reached Filee late (a stuck cursor, #511).+ /// FILEE_TRACE_GESTURES=1 logs each mouse press and scope decision, to find why a gesture doesn't fire, each+ /// release with how far the mouse went while held, each drag gesture that fired and each time the gestures are set+ /// again (a press waiting to become a drag is dropped then, #739), and on Windows each mouse move that reached+ /// Filee late (a stuck cursor, #511)./// </summary>private static readonly bool Trace = Environment.GetEnvironmentVariable("FILEE_TRACE_GESTURES") == "1";/// <summary>A mouse move this late (ms) goes to the trace: the clock itself is only 16 ms exact.</summary>private const long LateMove = 50;+ // For the trace: where the last press was, and the held moves since it (the hook thread only).+ private int _pressX, _pressY, _heldMoves, _farthest;+public TriggerService(IPlatformServices platform, ILogger<TriggerService> log): this(platform, log, () => new QueuedGlobalHook()){@@ -49,7 +54,12 @@ public sealed class TriggerService : IDisposable_detector.SystemDragThreshold = platform.SystemDragThreshold;_detector.ScopeFilter = InScope;- _detector.DragStarted += (g, x, y) => Post(() => DragStarted?.Invoke(this, new GestureEventArgs(g, x, y)));+ _detector.DragStarted += (g, x, y) =>+ {+ if (Trace)+ _log.LogInformation("Trace: drag gesture {Gesture} fired at {X},{Y}", g.Kind, x, y);+ Post(() => DragStarted?.Invoke(this, new GestureEventArgs(g, x, y)));+ };_detector.DragEnded += (x, y) => Post(() => DragEnded?.Invoke(this, new GestureEventArgs(null, x, y)));_detector.HoldTriggered += (g, x, y) => Post(() => SelectionGesture?.Invoke(this, new GestureEventArgs(g, x, y)));_detector.KeyChordTriggered += (g, x, y) => Post(() => SelectionGesture?.Invoke(this, new GestureEventArgs(g, x, y)));@@ -134,6 +144,8 @@ public sealed class TriggerService : IDisposablepublic void Apply(AppSettings settings){+ if (Trace)+ _log.LogInformation("Trace: gestures set again ({Count})", settings.Triggers.Count(g => g.Enabled));_detector.Configure(settings.Triggers.Where(g => _platform.SupportsSelectionShortcut || g.Kind == TriggerKind.Drag).ToList());_detector.Paused = settings.Paused;_flipKey = settings.Donut.EffectiveFlipKey(settings.Triggers);@@ -191,11 +203,15 @@ public sealed class TriggerService : IDisposableif (Trace)_log.LogInformation("Trace: press {Button} at {X},{Y}, mask {Mask} = {Modifiers}", e.Data.Button, e.Data.X, e.Data.Y, e.RawEvent.Mask, Map(e.RawEvent.Mask));var (x, y) = ButtonPoint(e);+ (_pressX, _pressY, _heldMoves, _farthest) = (x, y, 0, 0);_detector.MouseDown(Map(e.Data.Button), x, y, Map(e.RawEvent.Mask));};_hook.MouseReleased += (_, e) =>{var (x, y) = ButtonPoint(e);+ if (Trace)+ _log.LogInformation("Trace: release {Button} at {X},{Y} after {Moves} held move(s), at most {Farthest} px from the press",+ e.Data.Button, x, y, _heldMoves, _farthest);_detector.MouseUp(Map(e.Data.Button), x, y);};_hook.MouseDragged += (_, e) => OnMove(e);@@ -320,6 +336,11 @@ public sealed class TriggerService : IDisposable_log.LogInformation("Trace: a mouse move reached Filee {Late} ms late", late);(_estX, _estY) = (e.Data.X, e.Data.Y);LastCursor = (e.Data.X, e.Data.Y);+ if (Trace && HeldButton(e.RawEvent.Mask) != TriggerMouseButton.None)+ {+ _heldMoves++;+ _farthest = Math.Max(_farthest, Math.Max(Math.Abs(e.Data.X - _pressX), Math.Abs(e.Data.Y - _pressY)));+ }_detector.MouseMove(e.Data.X, e.Data.Y, Map(e.RawEvent.Mask), HeldButton(e.RawEvent.Mask));}