Release v0.6.36: offload notification registration and mitigate Viber paste timing
This commit is contained in:
+18
-1
@@ -358,6 +358,14 @@ class Transaction
|
||||
if (!valid())
|
||||
return false;
|
||||
write(clip);
|
||||
// Viber's Qt editor observes clipboard changes asynchronously. Give it
|
||||
// a chance to discard the data object from Ctrl+C before requesting paste.
|
||||
// Recheck ownership and input below; never retry a possibly applied paste.
|
||||
if (lower(processName(target)) == L"viber")
|
||||
{
|
||||
Sleep(75);
|
||||
diagnosticEvent(L"Paste: Viber clipboard notification settling interval completed");
|
||||
}
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
check();
|
||||
@@ -433,6 +441,7 @@ App::App(HINSTANCE h, bool test, const std::filesystem::path &dataRoot) : instan
|
||||
}
|
||||
App::~App()
|
||||
{
|
||||
if (notificationRegistration) CloseHandle(notificationRegistration);
|
||||
if (syncWorker.joinable()) syncWorker.join();
|
||||
if (updateWorker.joinable())
|
||||
updateWorker.join();
|
||||
@@ -1893,6 +1902,14 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case WM_TIMER:
|
||||
if (wp == 6)
|
||||
{
|
||||
if (app->notificationRegistration && WaitForSingleObject(app->notificationRegistration, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
DWORD code = ERROR_GEN_FAILURE;
|
||||
GetExitCodeProcess(app->notificationRegistration, &code);
|
||||
if (code) log(L"Screenshot notification registration helper failed: " + std::to_wstring(code));
|
||||
CloseHandle(app->notificationRegistration);
|
||||
app->notificationRegistration = nullptr;
|
||||
}
|
||||
app->releaseIdleMemory(GetTickCount64());
|
||||
app->pollSync();
|
||||
return 0;
|
||||
@@ -2012,7 +2029,7 @@ int App::execute()
|
||||
log(std::wstring(L"Update completed; running version ") + AppVersion);
|
||||
if (startCommand)
|
||||
PostMessageW(window, WM_HOTKEY, startCommand, 0);
|
||||
try { registerScreenshotNotifications(); }
|
||||
try { notificationRegistration = startScreenshotNotificationRegistration(); }
|
||||
catch(const std::exception &e) { log(L"Screenshot notification registration: "+wide(e.what())); }
|
||||
auto screenshotActivation=startScreenshotActivationListener();
|
||||
MSG msg;
|
||||
|
||||
Reference in New Issue
Block a user