Changeset 52562 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
- Timestamp:
- Sep 2, 2014 6:28:04 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r48945 r52562 278 278 } 279 279 280 class ClipboardService : public VBoxClient::Service 281 { 282 public: 283 virtual const char *getPidFilePath() 284 { 285 return ".vboxclient-clipboard.pid"; 286 } 287 virtual int run(bool fDaemonised /* = false */) 288 { 289 int rc = vboxClipboardConnect(); 290 if (RT_SUCCESS(rc)) 291 rc = vboxClipboardMain(); 292 if (RT_FAILURE(rc)) 293 LogRelFunc(("guest clipboard service terminated abnormally: return code %Rrc\n", rc)); 294 return rc; 295 } 296 virtual void cleanup() 297 { 298 /* Nothing to do. */ 299 } 280 static const char *getPidFilePath() 281 { 282 return ".vboxclient-clipboard.pid"; 283 } 284 285 static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised) 286 { 287 int rc = vboxClipboardConnect(); 288 289 NOREF(ppInterface); 290 if (RT_SUCCESS(rc)) 291 rc = vboxClipboardMain(); 292 if (RT_FAILURE(rc)) 293 LogRelFunc(("guest clipboard service terminated abnormally: return code %Rrc\n", rc)); 294 return rc; 295 } 296 297 struct VBCLSERVICE vbclClipboardInterface = 298 { 299 getPidFilePath, 300 VBClServiceDefaultHandler, /* init */ 301 run, 302 VBClServiceDefaultHandler, /* pause */ 303 VBClServiceDefaultHandler, /* resume */ 304 VBClServiceDefaultCleanup 300 305 }; 301 306 302 VBoxClient::Service *VBoxClient::GetClipboardService() 303 { 304 return new ClipboardService; 305 } 307 struct CLIPBOARDSERVICE 308 { 309 struct VBCLSERVICE *pInterface; 310 }; 311 312 struct VBCLSERVICE **VBClGetClipboardService() 313 { 314 struct CLIPBOARDSERVICE *pService = 315 (struct CLIPBOARDSERVICE *)RTMemAlloc(sizeof(*pService)); 316 317 if (!pService) 318 VBClFatalError(("Out of memory\n")); 319 pService->pInterface = &vbclClipboardInterface; 320 return &pService->pInterface; 321 }
Note:
See TracChangeset
for help on using the changeset viewer.