refact, win, clipboard, notify callback, tmp commit

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-06-29 11:28:55 +08:00
parent 152da86665
commit 1dd599b011
5 changed files with 57 additions and 4 deletions

View File

@@ -1455,7 +1455,8 @@ UINT wait_response_event(wfClipboard *clipboard, HANDLE event, void **data)
clipboard->context->IsStopped = FALSE;
DWORD waitOnceTimeoutMillis = 50;
int waitCount = 1000 * clipboard->context->ResponseWaitTimeoutSecs / waitOnceTimeoutMillis;
for (int i = 0; i < waitCount * 3; i++)
int i = 0;
for (; i < waitCount; i++)
{
DWORD waitRes = WaitForSingleObject(event, waitOnceTimeoutMillis);
if (waitRes == WAIT_TIMEOUT && clipboard->context->IsStopped == FALSE)
@@ -1488,6 +1489,16 @@ UINT wait_response_event(wfClipboard *clipboard, HANDLE event, void **data)
return rc;
}
if (i == waitCount)
{
NOTIFICATION_MESSAGE msg;
msg.type = 2;
msg.msg = "timeout waiting for response";
msg.details = NULL;
clipboard->context->NotifyClipboardMsg(&msg);
rc = ERROR_INTERNAL_ERROR;
}
if ((*data) != NULL)
{
if (!ResetEvent(event))