play nice with other (legacy) clipboard monitors

This commit is contained in:
Akash Mozumdar 2019-06-18 20:18:42 -04:00
parent f7c2641d58
commit ea8e8fe3ed

View File

@ -174,7 +174,13 @@ namespace Host
std::thread([] std::thread([]
{ {
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
{
Sleep(10);
if (auto text = Util::GetClipboardText()) GetThread(clipboard).AddSentence(std::move(text.value())); if (auto text = Util::GetClipboardText()) GetThread(clipboard).AddSentence(std::move(text.value()));
}
}
throw; throw;
}).detach(); }).detach();
} }