VirtualBox

Changeset 85923 in vbox


Ignore:
Timestamp:
Aug 28, 2020 10:27:21 AM (4 years ago)
Author:
vboxsync
Message:

DnD/X11: More (optional) release logging for onX11ClientMessage(); minor cleanup.

File:
1 edited

Legend:

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

    r85922 r85923  
    937937                && m_wndCur               == static_cast<Window>(e.xclient.data.l[XdndStatusWindow]))
    938938            {
    939                 bool fAcceptDrop     = ASMBitTest   (&e.xclient.data.l[XdndStatusFlags], 0); /* Does the target accept the drop? */
    940                 RTCString strActions = xAtomToString( e.xclient.data.l[XdndStatusAction]);
    941 #ifdef LOG_ENABLED
    942                 bool fWantsPosition  = ASMBitTest   (&e.xclient.data.l[XdndStatusFlags], 1); /* Does the target want XdndPosition messages? */
    943                 char *pszWndName = wndX11GetNameA(e.xclient.data.l[XdndStatusWindow]);
     939                Window wndTarget = static_cast<Window>(e.xclient.data.l[XdndStatusWindow]);
     940
     941                /* Does the target accept the drop? */
     942                const bool fAcceptDrop    = e.xclient.data.l[XdndStatusFlags] & VBOX_XDND_STATUS_FLAG_ACCEPT;
     943                /* Does the target want XdndPosition messages? */
     944                const bool fWantsPosition = e.xclient.data.l[XdndStatusFlags] & VBOX_XDND_STATUS_FLAG_WANTS_POS;
     945                RT_NOREF(fWantsPosition);
     946
     947                char *pszWndName = wndX11GetNameA(m_wndCur);
    944948                AssertPtr(pszWndName);
    945949
     
    949953                 * the host as a response of a previous DnD message.
    950954                 */
    951                 LogFlowThisFunc(("XA_XdndStatus: wnd=%#x ('%s'), fAcceptDrop=%RTbool, fWantsPosition=%RTbool, strActions=%s\n",
    952                                  e.xclient.data.l[XdndStatusWindow], pszWndName, fAcceptDrop, fWantsPosition, strActions.c_str()));
     955                RTCString strActions = xAtomToString(e.xclient.data.l[XdndStatusAction]);
     956
     957                VBClLogInfo("Target window %#x ('%s') %s accept data with actions '%s'\n",
     958                            wndTarget, pszWndName, fAcceptDrop ? "does" : "does not", strActions.c_str());
     959
     960                const uint16_t x  = RT_HI_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgXY]);
     961                const uint16_t y  = RT_LO_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgXY]);
     962                const uint16_t cx = RT_HI_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgWH]);
     963                const uint16_t cy = RT_LO_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgWH]);
     964
     965                if (cx && cy)
     966                {
     967                    VBClLogInfo("Target window %#x ('%s') reported dead area at %RU16,%RU16 (%RU16 x %RU16)\n",
     968                                wndTarget, pszWndName, x, y, cx, cy);
     969                    /** @todo Save dead area and don't send XdndPosition messages anymore into it. */
     970                }
     971
     972                if (m_wndCur == wndTarget)
     973                {
     974                    VBOXDNDACTION dndAction = VBOX_DND_ACTION_IGNORE; /* Default is ignoring. */
     975                    /** @todo Compare this with the allowed actions. */
     976                    if (fAcceptDrop)
     977                        dndAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[XdndStatusAction]));
     978
     979                    rc = VbglR3DnDHGSendAckOp(&m_dndCtx, dndAction);
     980                }
     981                else
     982                    VBClLogInfo("Target window %#x ('%s') is not our current window, skipping\n", wndTarget, pszWndName);
    953983
    954984                RTStrFree(pszWndName);
    955 
    956                 uint16_t x  = RT_HI_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgXY]);
    957                 uint16_t y  = RT_LO_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgXY]);
    958                 uint16_t cx = RT_HI_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgWH]);
    959                 uint16_t cy = RT_LO_U16((uint32_t)e.xclient.data.l[XdndStatusNoMsgWH]);
    960                 LogFlowThisFunc(("\tReported dead area: x=%RU16, y=%RU16, cx=%RU16, cy=%RU16\n", x, y, cx, cy));
    961 #endif
    962                 VBOXDNDACTION dndAction = VBOX_DND_ACTION_IGNORE; /* Default is ignoring. */
    963                 /** @todo Compare this with the allowed actions. */
    964                 if (fAcceptDrop)
    965                     dndAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[XdndStatusAction]));
    966 
    967                 rc = VbglR3DnDHGSendAckOp(&m_dndCtx, dndAction);
    968985            }
    969986            else if (e.xclient.message_type == xAtom(XA_XdndFinished))
    970987            {
    971 #ifdef LOG_ENABLED
    972                 bool fSucceeded = ASMBitTest(&e.xclient.data.l[XdndFinishedFlags], 0);
    973 
    974                 char *pszWndName = wndX11GetNameA(e.xclient.data.l[XdndFinishedWindow]);
     988                Window wndTarget = static_cast<Window>(e.xclient.data.l[XdndFinishedWindow]);
     989
     990                const bool fSucceeded = e.xclient.data.l[XdndFinishedFlags] & VBOX_XDND_FINISHED_FLAG_SUCCEEDED;
     991
     992                char *pszWndName = wndX11GetNameA(wndTarget);
    975993                AssertPtr(pszWndName);
     994
     995                const char *pcszAction = xAtomToString(e.xclient.data.l[XdndFinishedAction]).c_str();
    976996
    977997                /* This message is sent on an un/successful DnD drop request. */
    978998                LogFlowThisFunc(("XA_XdndFinished: wnd=%#x ('%s'), success=%RTbool, action=%s\n",
    979                                  e.xclient.data.l[XdndFinishedWindow], pszWndName, fSucceeded,
    980                                  xAtomToString(e.xclient.data.l[XdndFinishedAction]).c_str()));
     999                                 wndTarget, pszWndName, fSucceeded, pcszAction));
     1000
     1001                VBClLogInfo("Target window %#x ('%s') has %s the data with action '%s'\n",
     1002                            wndTarget, pszWndName, fSucceeded ? "accepted" : "rejected", pcszAction ? "<None>" : pcszAction);
    9811003
    9821004                RTStrFree(pszWndName);
    983 #endif
    9841005
    9851006                reset();
     
    9871008            else
    9881009            {
    989                 char *pszWndName = wndX11GetNameA(e.xclient.data.l[0]);
    990                 AssertPtr(pszWndName);
    991                 LogFlowThisFunc(("Unhandled: wnd=%#x ('%s'), msg=%s\n",
    992                                  e.xclient.data.l[0], pszWndName, xAtomToString(e.xclient.message_type).c_str()));
    993                 RTStrFree(pszWndName);
    994 
     1010                LogFlowThisFunc(("Unhandled client message '%s'\n", xAtomToString(e.xclient.message_type).c_str()));
    9951011                rc = VERR_NOT_SUPPORTED;
    9961012            }
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