forked from Public-Mirror/Textractor
refactor
This commit is contained in:
parent
749f8fa596
commit
c5b1e6988e
@ -175,14 +175,11 @@ namespace Host
|
|||||||
{
|
{
|
||||||
while (WaitForSingleObject(clipboardUpdate, INFINITE) == WAIT_OBJECT_0)
|
while (WaitForSingleObject(clipboardUpdate, INFINITE) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
for (int retry = 0; retry < 3; ++retry) // retry loop in case something else is using the clipboard
|
std::optional<std::wstring> clipboardText;
|
||||||
|
for (int retry = 0; !clipboardText && retry < 3; ++retry) // retry loop in case something else is using the clipboard
|
||||||
{
|
{
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
if (auto text = Util::GetClipboardText())
|
if (clipboardText = Util::GetClipboardText()) GetThread(clipboard).AddSentence(std::move(clipboardText.value()));
|
||||||
{
|
|
||||||
GetThread(clipboard).AddSentence(std::move(text.value()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user