Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Oct 8, 2024
1 parent 48611e8 commit a7db8ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions JL.Windows/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected override async void OnSourceInitialized(EventArgs e)
if (CoreConfigManager.CaptureTextFromClipboard)
{
s_clipboardSequenceNo = WinApi.GetClipboardSequenceNo();
_ = CopyFromClipboard();
_ = await CopyFromClipboard().ConfigureAwait(true);
}

FirstPopupWindow.Owner = this;
Expand All @@ -122,7 +122,7 @@ protected override async void OnSourceInitialized(EventArgs e)
await WindowsUtils.InitializeMainWindow().ConfigureAwait(false);
}

private bool CopyFromClipboard()
private async Task<bool> CopyFromClipboard()
{
bool gotTextFromClipboard = false;
while (Clipboard.ContainsText() && !gotTextFromClipboard)
Expand All @@ -137,6 +137,7 @@ private bool CopyFromClipboard()
catch (ExternalException ex)
{
Utils.Logger.Warning(ex, "CopyFromClipboard failed");
await Task.Delay(5).ConfigureAwait(true);
}
}

Expand Down Expand Up @@ -250,7 +251,7 @@ private async void ClipboardChanged(object? sender, EventArgs? e)
}

s_clipboardSequenceNo = currentClipboardSequenceNo;
bool gotTextFromClipboard = CopyFromClipboard();
bool gotTextFromClipboard = await CopyFromClipboard().ConfigureAwait(true);

if (gotTextFromClipboard
&& ConfigManager.AutoLookupFirstTermWhenTextIsCopiedFromClipboard
Expand Down

0 comments on commit a7db8ab

Please sign in to comment.