Changeset 4711 in vbox for trunk/src/VBox/HostServices/SharedClipboard
- Timestamp:
- Sep 11, 2007 1:49:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/win32.cpp
r4071 r4711 21 21 #include <iprt/alloc.h> 22 22 #include <iprt/string.h> 23 #include <iprt/asm.h> 23 24 #include <iprt/assert.h> 24 25 #include <iprt/thread.h> … … 43 44 VBOXCLIPBOARDCLIENTDATA *pClient; 44 45 45 bool fAnnouncing;46 volatile uint32_t u32Announcing; 46 47 }; 47 48 … … 224 225 Log(("WM_DRAWCLIPBOARD next %p\n", pCtx->hwndNextInChain)); 225 226 226 if (!pCtx->fAnnouncing) 227 { 227 if (ASMAtomicCmpXchgU32 (&pCtx->u32Announcing, 0, 1) == false) 228 { 229 /* Could not do 1->0 transition. That means u32Announcing is 0. */ 228 230 vboxClipboardChanged (pCtx); 229 231 } … … 381 383 Log(("WM_USER u32Formats = %02X\n", u32Formats)); 382 384 383 pCtx->fAnnouncing = true;384 385 385 if (OpenClipboard (hwnd)) 386 386 { … … 389 389 Log(("WM_USER emptied clipboard\n")); 390 390 391 HANDLE hClip ;391 HANDLE hClip = NULL; 392 392 393 393 if (u32Formats & VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) 394 394 { 395 395 dprintf(("window proc WM_USER: VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT\n")); 396 hClip = SetClipboardData (CF_UNICODETEXT, NULL); 396 397 /* Prevent the WM_DRAWCLIPBOARD processing. Will be reset in WM_DRAWCLIPBOARD. */ 398 if (ASMAtomicCmpXchgU32 (&pCtx->u32Announcing, 1, 0) == true) 399 { 400 hClip = SetClipboardData (CF_UNICODETEXT, NULL); 401 } 397 402 } 398 403 … … 400 405 { 401 406 dprintf(("window proc WM_USER: VBOX_SHARED_CLIPBOARD_FMT_BITMAP\n")); 402 hClip = SetClipboardData (CF_DIB, NULL); 407 408 /* Prevent the WM_DRAWCLIPBOARD processing. Will be reset in WM_DRAWCLIPBOARD. */ 409 if (ASMAtomicCmpXchgU32 (&pCtx->u32Announcing, 1, 0) == true) 410 { 411 hClip = SetClipboardData (CF_DIB, NULL); 412 } 403 413 } 404 414 … … 409 419 if (format != 0) 410 420 { 411 hClip = SetClipboardData (format, NULL); 421 /* Prevent the WM_DRAWCLIPBOARD processing. Will be reset in WM_DRAWCLIPBOARD. */ 422 if (ASMAtomicCmpXchgU32 (&pCtx->u32Announcing, 1, 0) == true) 423 { 424 hClip = SetClipboardData (format, NULL); 425 } 412 426 } 413 427 } … … 415 429 CloseClipboard(); 416 430 417 dprintf(("window proc WM_USER: hClip %p \n", hClip));431 dprintf(("window proc WM_USER: hClip %p, err %d\n", hClip, GetLastError ())); 418 432 } 419 433 else … … 421 435 dprintf(("window proc WM_USER: failed to open clipboard\n")); 422 436 } 423 424 pCtx->fAnnouncing = false;425 426 437 } break; 427 438 … … 525 536 g_ctx.hRenderEvent = CreateEvent(NULL, TRUE, FALSE, NULL); 526 537 538 g_ctx.u32Announcing = 0; 539 527 540 rc = RTThreadCreate (&g_ctx.thread, VBoxClipboardThread, NULL, 65536, 528 541 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLIP"); … … 605 618 if (OpenClipboard (pClient->pCtx->hwnd)) 606 619 { 620 dprintf(("Clipboard opened.\n")); 621 607 622 if (u32Format & VBOX_SHARED_CLIPBOARD_FMT_BITMAP) 608 623 {
Note:
See TracChangeset
for help on using the changeset viewer.