Changeset 80468 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Aug 28, 2019 9:57:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r80459 r80468 24 24 #include <iprt/semaphore.h> 25 25 #include <iprt/path.h> 26 #include <iprt/rand.h> 26 27 27 28 #include <iprt/errcore.h> … … 35 36 * 36 37 * @returns VBox status code. 37 * @param uID Event ID to associate payload to.38 * @param uID Payload ID to set for this payload. Useful for consequtive payloads. 38 39 * @param pvData Data block to associate to this payload. 39 40 * @param cbData Size (in bytes) of data block to associate. … … 97 98 * @returns VBox status code. 98 99 * @param pEvent Event to initialize. 99 * @param uID ID to use for the event.100 */ 101 int SharedClipboardEventCreate(PSHAREDCLIPBOARDEVENT pEvent, uint16_tuID)100 * @param uID Event ID to use. 101 */ 102 int SharedClipboardEventCreate(PSHAREDCLIPBOARDEVENT pEvent, VBOXCLIPBOARDEVENTID uID) 102 103 { 103 104 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); … … 145 146 * @param uID ID to use for event source. 146 147 */ 147 int SharedClipboardEventSourceCreate(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID)148 int SharedClipboardEventSourceCreate(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTSOURCEID uID) 148 149 { 149 150 AssertPtrReturn(pSource, VERR_INVALID_POINTER); … … 156 157 157 158 pSource->uID = uID; 158 pSource->uEventIDNext = 1; /* Event ID 0 always is reserved (marks "unused"). */ 159 /* Choose a random event ID starting point. */ 160 pSource->uEventIDNext = RTRandU32() % VBOX_SHARED_CLIPBOARD_MAX_EVENTS; 159 161 160 162 LogFlowFuncLeaveRC(rc); … … 189 191 * @param pSource Event source to generate event for. 190 192 */ 191 uint16_tSharedClipboardEventIDGenerate(PSHAREDCLIPBOARDEVENTSOURCE pSource)193 VBOXCLIPBOARDEVENTID SharedClipboardEventIDGenerate(PSHAREDCLIPBOARDEVENTSOURCE pSource) 192 194 { 193 195 AssertPtrReturn(pSource, 0); 194 196 195 197 LogFlowFunc(("uSource=%RU16: New event: %RU16\n", pSource->uID, pSource->uEventIDNext)); 196 return pSource->uEventIDNext++; /** @todo Improve this.*/198 return pSource->uEventIDNext++; /** @todo Handle rollovers? */ 197 199 } 198 200 … … 204 206 * @param uID Event ID to get. 205 207 */ 206 inline PSHAREDCLIPBOARDEVENT sharedClipboardEventGet(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID)208 inline PSHAREDCLIPBOARDEVENT sharedClipboardEventGet(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID) 207 209 { 208 210 PSHAREDCLIPBOARDEVENT pEvIt; … … 223 225 * @param uID Event ID to register. 224 226 */ 225 int SharedClipboardEventRegister(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID)227 int SharedClipboardEventRegister(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID) 226 228 { 227 229 AssertPtrReturn(pSource, VERR_INVALID_POINTER); … … 266 268 * @param uID Event ID to unregister. 267 269 */ 268 int SharedClipboardEventUnregister(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID)270 int SharedClipboardEventUnregister(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID) 269 271 { 270 272 AssertPtrReturn(pSource, VERR_INVALID_POINTER); … … 305 307 * SharedClipboardPayloadFree(). 306 308 */ 307 int SharedClipboardEventWait(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID, RTMSINTERVAL uTimeoutMs,309 int SharedClipboardEventWait(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID, RTMSINTERVAL uTimeoutMs, 308 310 PSHAREDCLIPBOARDEVENTPAYLOAD* ppPayload) 309 311 { … … 340 342 * @param pPayload Event payload to associate. Takes ownership. Optional. 341 343 */ 342 int SharedClipboardEventSignal(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID,344 int SharedClipboardEventSignal(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID, 343 345 PSHAREDCLIPBOARDEVENTPAYLOAD pPayload) 344 346 { … … 376 378 * @param uID Event ID to detach payload for. 377 379 */ 378 void SharedClipboardEventPayloadDetach(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_tuID)380 void SharedClipboardEventPayloadDetach(PSHAREDCLIPBOARDEVENTSOURCE pSource, VBOXCLIPBOARDEVENTID uID) 379 381 { 380 382 AssertPtrReturnVoid(pSource);
Note:
See TracChangeset
for help on using the changeset viewer.