VirtualBox

Ignore:
Timestamp:
Sep 2, 2014 6:28:04 AM (10 years ago)
Author:
vboxsync
Message:

Additions/x11/VBoxClient: clean-up and some C++ to C conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r48945 r52562  
    278278}
    279279
    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     }
     280static const char *getPidFilePath()
     281{
     282    return ".vboxclient-clipboard.pid";
     283}
     284
     285static 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
     297struct VBCLSERVICE vbclClipboardInterface =
     298{
     299    getPidFilePath,
     300    VBClServiceDefaultHandler, /* init */
     301    run,
     302    VBClServiceDefaultHandler, /* pause */
     303    VBClServiceDefaultHandler, /* resume */
     304    VBClServiceDefaultCleanup   
    300305};
    301306
    302 VBoxClient::Service *VBoxClient::GetClipboardService()
    303 {
    304     return new ClipboardService;
    305 }
     307struct CLIPBOARDSERVICE
     308{
     309    struct VBCLSERVICE *pInterface;
     310};
     311
     312struct 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.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette