Skip to content

Commit

Permalink
Change timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
dalyIsaac committed Sep 28, 2024
1 parent effc408 commit ea96281
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal void WindowMessageMonitor_DpiChanged(IContext ctx, IInternalContext int
internal async Task WindowMessageMonitor_SessionChanged(IContext ctx, IInternalContext internalCtx)
{
// Given the listener is initialized
MonitorEventListener listener = new(ctx, internalCtx);
MonitorEventListener listener = new(ctx, internalCtx, 500);
listener.Initialize();

NativeManagerUtils.SetupTryEnqueue(ctx);
Expand All @@ -108,7 +108,7 @@ internal async Task WindowMessageMonitor_SessionChanged(IContext ctx, IInternalC
ctx.Store.MonitorEvents,
_windowMessageArgs
);
await Task.Delay(5200);
await Task.Delay(2000);

// Then a dispatch to the store was triggered
ctx.Store.Received(1).Dispatch(new MonitorsChangedTransform());
Expand Down
5 changes: 3 additions & 2 deletions src/Whim/Store/MonitorSector/MonitorEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Whim;

internal class MonitorEventListener(IContext ctx, IInternalContext internalCtx) : IDisposable
internal class MonitorEventListener(IContext ctx, IInternalContext internalCtx, int delayMs = 5000) : IDisposable
{
private readonly IContext _ctx = ctx;
private readonly IInternalContext _internalCtx = internalCtx;
private readonly int _delayMs = delayMs;
private bool _disposedValue;

public void Initialize()
Expand All @@ -29,7 +30,7 @@ private void WindowMessageMonitor_SessionChanged(object? sender, WindowMessageMo
// This gives Windows some to figure out the correct working area.
_ctx.NativeManager.TryEnqueue(async () =>
{
await Task.Delay(5000).ConfigureAwait(true);
await Task.Delay(_delayMs).ConfigureAwait(true);
WindowMessageMonitor_MonitorsChanged(sender, e);
});
}
Expand Down

0 comments on commit ea96281

Please sign in to comment.