VirtualBox

Changeset 106753 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Oct 28, 2024 2:23:51 PM (3 months ago)
Author:
vboxsync
Message:

Additions: Linux/Wayland: Split Clipboard and DnD helpers, bugref:10796.

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/wayland-helper.h

    r106061 r106753  
    137137
    138138/**
     139 * Wayland Desktop Environment helper clipboard operations.
     140 */
     141typedef struct
     142{
     143
     144    /**
     145     * Initialization callback.
     146     *
     147     * @returns IPRT status code.
     148     */
     149    DECLCALLBACKMEMBER(int, pfnInit, (void));
     150
     151    /**
     152     * Termination callback.
     153     *
     154     * @returns IPRT status code.
     155     */
     156    DECLCALLBACKMEMBER(int, pfnTerm, (void));
     157
     158    /**
     159     * Callback to set host clipboard connection handle.
     160     *
     161     * @param   pCtx    Host service connection context.
     162     */
     163    DECLCALLBACKMEMBER(void, pfnSetClipboardCtx, (PVBGLR3SHCLCMDCTX pCtx));
     164
     165    /**
     166     * Callback to force guest to announce its clipboard content.
     167     *
     168     * @returns IPRT status code.
     169     */
     170    DECLCALLBACKMEMBER(int, pfnPopup, (void));
     171
     172    /** A callback to notify guest about new content in host clipboard. */
     173    PFNHOSTCLIPREPORTFMTS pfnHGClipReport;
     174
     175    /** Callback to notify guest that host wants to read clipboard data in specified format. */
     176    PFNHOSTCLIPREAD pfnGHClipRead;
     177
     178} VBCLWAYLANDHELPER_CLIPBOARD;
     179
     180/**
     181 * Wayland Desktop Environment helper DnD operations.
     182 */
     183typedef struct
     184{
     185
     186    /**
     187     * Initialization callback.
     188     *
     189     * @returns IPRT status code.
     190     */
     191    DECLCALLBACKMEMBER(int, pfnInit, (void));
     192
     193    /**
     194     * Termination callback.
     195     *
     196     * @returns IPRT status code.
     197     */
     198    DECLCALLBACKMEMBER(int, pfnTerm, (void));
     199
     200} VBCLWAYLANDHELPER_DND;
     201
     202/**
    139203 * Wayland Desktop Environment helper definition structure.
    140204 */
     
    150214     * which is compatible with the helper.
    151215     *
    152      * @returns Helpercapabilities bitmask as described by VBOX_WAYLAND_HELPER_CAP_XXX.
     216     * @returns Helper capabilities bitmask as described by VBOX_WAYLAND_HELPER_CAP_XXX.
    153217     */
    154218    DECLCALLBACKMEMBER(int, pfnProbe, (void));
    155219
    156     /**
    157      * Initialization callback.
    158      *
    159      * @returns IPRT status code.
    160      */
    161     DECLCALLBACKMEMBER(int, pfnInit, (void));
    162 
    163     /**
    164      * Termination callback.
    165      *
    166      * @returns IPRT status code.
    167      */
    168     DECLCALLBACKMEMBER(int, pfnTerm, (void));
    169 
    170     /**
    171      * Callback to set host clipboard connection handle.
    172      *
    173      * @param   pCtx    Host service connection context.
    174      */
    175     DECLCALLBACKMEMBER(void, pfnSetClipboardCtx, (PVBGLR3SHCLCMDCTX pCtx));
    176 
    177     /**
    178      * Callback to force guest to announce its clipboard content.
    179      *
    180      * @returns IPRT status code.
    181      */
    182     DECLCALLBACKMEMBER(int, pfnPopup, (void));
    183 
    184     PFNHOSTCLIPREPORTFMTS pfnHGClipReport;
    185     PFNHOSTCLIPREAD pfnGHClipRead;
     220    /** Helper functions for clipboard operations. */
     221    VBCLWAYLANDHELPER_CLIPBOARD clip;
     222
     223    /** Helper functions for DnD operations. */
     224    VBCLWAYLANDHELPER_DND dnd;
    186225
    187226} VBCLWAYLANDHELPER;
  • trunk/src/VBox/Additions/x11/VBoxClient/wayland.cpp

    r106061 r106753  
    8585    {
    8686        /* Provide helper with host clipboard service connection handle. */
    87         g_pWaylandHelperClipboard->pfnSetClipboardCtx(&ctx.CmdCtx);
     87        g_pWaylandHelperClipboard->clip.pfnSetClipboardCtx(&ctx.CmdCtx);
    8888
    8989        /* Process host events. */
    9090        while (!ASMAtomicReadBool(&g_fShutdown))
    9191        {
    92             rc = VBClClipboardReadHostEvent(&ctx, g_pWaylandHelperClipboard->pfnHGClipReport,
    93                                             g_pWaylandHelperClipboard->pfnGHClipRead);
     92            rc = VBClClipboardReadHostEvent(&ctx,
     93                                            g_pWaylandHelperClipboard->clip.pfnHGClipReport,
     94                                            g_pWaylandHelperClipboard->clip.pfnGHClipRead);
    9495            if (RT_FAILURE(rc))
    9596            {
     
    179180                                if (RTStrNCmp(pszValue, "0", GUEST_PROP_MAX_NAME_LEN) == 0)
    180181                                {
    181                                     rc = g_pWaylandHelperClipboard->pfnPopup();
     182                                    rc = g_pWaylandHelperClipboard->clip.pfnPopup();
    182183                                    VBClLogVerbose(1, "trigger popup, rc=%Rrc\n", rc);
    183184                                }
     
    238239                && !RT_VALID_PTR(g_pWaylandHelperClipboard))
    239240            {
    240                 if (RT_VALID_PTR(g_apWaylandHelpers[idxHelper]->pfnInit))
     241                if (RT_VALID_PTR(g_apWaylandHelpers[idxHelper]->clip.pfnInit))
    241242                {
    242                     rc = g_apWaylandHelpers[idxHelper]->pfnInit();
     243                    rc = g_apWaylandHelpers[idxHelper]->clip.pfnInit();
    243244                    if (RT_SUCCESS(rc))
    244245                        g_pWaylandHelperClipboard = g_apWaylandHelpers[idxHelper];
     
    256257                && !RT_VALID_PTR(g_pWaylandHelperDnd))
    257258            {
    258                 if (RT_VALID_PTR(g_apWaylandHelpers[idxHelper]->pfnInit))
     259                if (RT_VALID_PTR(g_apWaylandHelpers[idxHelper]->dnd.pfnInit))
    259260                {
    260                     rc = g_apWaylandHelpers[idxHelper]->pfnInit();
     261                    rc = g_apWaylandHelpers[idxHelper]->dnd.pfnInit();
    261262                    if (RT_SUCCESS(rc))
    262263                        g_pWaylandHelperDnd = g_apWaylandHelpers[idxHelper];
     
    389390
    390391    if (   RT_VALID_PTR(g_pWaylandHelperClipboard)
    391         && RT_VALID_PTR(g_pWaylandHelperClipboard->pfnTerm))
    392         rc = g_pWaylandHelperClipboard->pfnTerm();
     392        && RT_VALID_PTR(g_pWaylandHelperClipboard->clip.pfnTerm))
     393        rc = g_pWaylandHelperClipboard->clip.pfnTerm();
    393394
    394395    if (   RT_SUCCESS(rc)
    395396        && RT_VALID_PTR(g_pWaylandHelperDnd)
    396         && RT_VALID_PTR(g_pWaylandHelperDnd->pfnTerm))
    397         rc = g_pWaylandHelperDnd->pfnTerm();
     397        && RT_VALID_PTR(g_pWaylandHelperDnd->dnd.pfnTerm))
     398        rc = g_pWaylandHelperDnd->dnd.pfnTerm();
    398399
    399400    return rc;
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