Changeset 55422 in vbox for trunk/src/VBox/Additions/x11/VBoxClient
- Timestamp:
- Apr 24, 2015 1:52:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r55401 r55422 5 5 6 6 /* 7 * Copyright (C) 2011-201 4Oracle Corporation7 * Copyright (C) 2011-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 406 406 protected: 407 407 408 uint32_t m_uClientID; 409 DragAndDropService *m_pParent; 410 Display *m_pDisplay; 411 int m_screenId; 412 Screen *m_pScreen; 413 Window m_wndRoot; 414 Window m_wndProxy; 415 Window m_wndCur; 416 long m_curVer; 417 RTCList<Atom> m_formats; 418 RTCList<Atom> m_actions; 408 /** The instance's own DnD context. */ 409 VBGLR3GUESTDNDCMDCTX m_dndCtx; 410 DragAndDropService *m_pParent; 411 Display *m_pDisplay; 412 int m_screenId; 413 Screen *m_pScreen; 414 Window m_wndRoot; 415 Window m_wndProxy; 416 Window m_wndCur; 417 long m_curVer; 418 RTCList<Atom> m_formats; 419 RTCList<Atom> m_actions; 419 420 /** Deferred host to guest selection event for sending to the 420 421 * target window as soon as data from the host arrived. */ 421 XEvent m_eventHgSelection;422 XEvent m_eventHgSelection; 422 423 /** Current operation mode. */ 423 Mode m_mode;424 Mode m_mode; 424 425 /** Current state of operation mode. */ 425 State m_state;426 State m_state; 426 427 /** The instance's own X event queue. */ 427 RTCMTList<XEvent> m_eventQueue;428 RTCMTList<XEvent> m_eventQueue; 428 429 /** Critical section for providing serialized access to list 429 430 * event queue's contents. */ 430 RTCRITSECT m_eventQueueCS;431 RTCRITSECT m_eventQueueCS; 431 432 /** Event for notifying this instance in case of a new 432 433 * event. */ 433 RTSEMEVENT m_hEventSem;434 RTSEMEVENT m_hEventSem; 434 435 /** List of allowed formats. */ 435 RTCList<RTCString> m_lstAllowedFormats;436 RTCList<RTCString> m_lstAllowedFormats; 436 437 }; 437 438 … … 507 508 508 509 DragInstance::DragInstance(Display *pDisplay, DragAndDropService *pParent) 509 : m_uClientID(0) 510 , m_pParent(pParent) 511 , m_pDisplay(pDisplay) 512 , m_pScreen(0) 513 , m_wndRoot(0) 514 , m_wndProxy(0) 515 , m_wndCur(0) 516 , m_curVer(-1) 517 , m_mode(Unknown) 518 , m_state(Uninitialized) 510 : m_pParent(pParent) 511 , m_pDisplay(pDisplay) 512 , m_pScreen(0) 513 , m_wndRoot(0) 514 , m_wndProxy(0) 515 , m_wndCur(0) 516 , m_curVer(-1) 517 , m_mode(Unknown) 518 , m_state(Uninitialized) 519 519 { 520 520 uninit(); … … 527 527 XDestroyWindow(m_pDisplay, m_wndProxy); 528 528 529 if (m_uClientID) 530 { 531 VbglR3DnDDisconnect(m_uClientID); 532 m_uClientID = 0; 533 } 529 VbglR3DnDDisconnect(&m_dndCtx); 534 530 535 531 m_state = Uninitialized; … … 571 567 uninit(); 572 568 573 rc = VbglR3DnDConnect(&m_ uClientID);569 rc = VbglR3DnDConnect(&m_dndCtx); 574 570 if (RT_FAILURE(rc)) 575 571 break; … … 692 688 uAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[4])); 693 689 694 rc = VbglR3DnDHGAcknowledgeOperation( m_uClientID, uAction);690 rc = VbglR3DnDHGAcknowledgeOperation(&m_dndCtx, uAction); 695 691 } 696 692 else if (e.xclient.message_type == xAtom(XA_XdndFinished)) … … 859 855 RTCString strFormat = xAtomToString(e.xselectionrequest.target); 860 856 Assert(strFormat.isNotEmpty()); 861 rc = VbglR3DnDHGRequestData( m_uClientID, strFormat.c_str());857 rc = VbglR3DnDHGRequestData(&m_dndCtx, strFormat.c_str()); 862 858 LogFlowThisFunc(("Requesting data from host as \"%s\", rc=%Rrc\n", 863 859 strFormat.c_str(), rc)); … … 1221 1217 { 1222 1218 /* No window to process, so send a ignore ack event to the host. */ 1223 rc = VbglR3DnDHGAcknowledgeOperation( m_uClientID, DND_IGNORE_ACTION);1219 rc = VbglR3DnDHGAcknowledgeOperation(&m_dndCtx, DND_IGNORE_ACTION); 1224 1220 } 1225 1221 … … 1476 1472 uint32_t uAllActions = toHGCMActions(m_actions); 1477 1473 1478 rc = VbglR3DnDGHAcknowledgePending( m_uClientID, uDefAction, uAllActions, strFormats.c_str());1474 rc = VbglR3DnDGHAcknowledgePending(&m_dndCtx, uDefAction, uAllActions, strFormats.c_str()); 1479 1475 LogFlowThisFunc(("Acknowledging m_uClientID=%RU32, allActions=0x%x, strFormats=%s, rc=%Rrc\n", 1480 m_ uClientID, uAllActions, strFormats.c_str(), rc));1476 m_dndCtx.uClientID, uAllActions, strFormats.c_str(), rc)); 1481 1477 } 1482 1478 } … … 1587 1583 pvDataTmp[cbData++] = '\0'; 1588 1584 1589 rc = VbglR3DnDGHSendData(m_uClientID, strFormat.c_str(), 1590 pvDataTmp, cbData); 1585 rc = VbglR3DnDGHSendData(&m_dndCtx, strFormat.c_str(), pvDataTmp, cbData); 1591 1586 RTMemFree(pvDataTmp); 1592 1587 } … … 1597 1592 { 1598 1593 /* Send the raw data to the host. */ 1599 rc = VbglR3DnDGHSendData(m_uClientID, strFormat.c_str(), 1600 pcData, cbData); 1594 rc = VbglR3DnDGHSendData(&m_dndCtx, strFormat.c_str(), pcData, cbData); 1601 1595 } 1602 1596 1603 LogFlowThisFunc(("Sent strFormat=%s with rc=%Rrc\n", 1604 strFormat.c_str(), rc)); 1597 LogFlowThisFunc(("Sent strFormat=%s, rc=%Rrc\n", strFormat.c_str(), rc)); 1605 1598 1606 1599 if (RT_SUCCESS(rc)) … … 1679 1672 if (RT_FAILURE(rc)) 1680 1673 { 1681 int rc2 = VbglR3DnDGHSendError( m_uClientID, rc);1674 int rc2 = VbglR3DnDGHSendError(&m_dndCtx, rc); 1682 1675 AssertRC(rc2); 1683 1676 } … … 2253 2246 AssertPtr(pThis); 2254 2247 2255 uint32_t uClientID; 2256 int rc = VbglR3DnDConnect(&uClientID); 2248 /* This thread has an own DnD context, e.g. an own client ID. */ 2249 VBGLR3GUESTDNDCMDCTX dndCtx; 2250 2251 int rc = VbglR3DnDConnect(&dndCtx); 2257 2252 if (RT_FAILURE(rc)) 2258 2253 LogRel(("DnD: Unable to connect to drag and drop service, rc=%Rrc\n", rc)); … … 2271 2266 2272 2267 /* Wait for new events. */ 2273 rc = VbglR3DnDProcessNextMessage(uClientID, &e.hgcm); 2274 if (RT_SUCCESS(rc)) 2268 rc = VbglR3DnDProcessNextMessage(&dndCtx, &e.hgcm); 2269 if ( RT_SUCCESS(rc) 2270 || rc == VERR_CANCELLED) 2275 2271 { 2276 2272 cMsgSkippedInvalid = 0; /* Reset skipped messages count. */ … … 2285 2281 else 2286 2282 { 2283 LogFlowFunc(("Processing next message failed with rc=%Rrc\n", rc)); 2284 2287 2285 /* Old(er) hosts either are broken regarding DnD support or otherwise 2288 2286 * don't support the stuff we do on the guest side, so make sure we … … 2299 2297 } while (!ASMAtomicReadBool(&pThis->m_fSrvStopping)); 2300 2298 2301 VbglR3DnDDisconnect( uClientID);2299 VbglR3DnDDisconnect(&dndCtx); 2302 2300 2303 2301 LogFlowFuncLeaveRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.