Changeset 106411 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
- Timestamp:
- Oct 17, 2024 7:44:43 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
r106061 r106411 35 35 #include <iprt/win/windows.h> 36 36 #include "VBoxTray.h" 37 #include "VBoxTrayInternal.h" 37 38 #include "VBoxHelpers.h" 38 39 #include "VBoxDnD.h" … … 130 131 * Initializes the proxy window with a given DnD context. 131 132 * 132 * @return IPRTstatus code.133 * @return VBox status code. 133 134 * @param a_pCtx Pointer to context to use. 134 135 */ … … 161 162 162 163 if (RT_FAILURE(rc)) 163 LogRel(("DnD: Failed to initialize proxy window, rc=%Rrc\n", rc));164 VBoxTrayError("DnD: Failed to initialize proxy window, rc=%Rrc\n", rc); 164 165 165 166 LogFlowThisFunc(("Returning rc=%Rrc\n", rc)); … … 203 204 * Thread for handling the window's message pump. 204 205 * 205 * @return IPRTstatus code.206 * @return VBox status code. 206 207 * @param hThread Handle to this thread. 207 208 * @param pvUser Pointer to VBoxDnDWnd instance which … … 312 313 else 313 314 { 314 LogRel(("DnD: Unable to initialize OLE, hr=%Rhrc\n", hr));315 VBoxTrayError("DnD: Unable to initialize OLE, hr=%Rhrc\n", hr); 315 316 rc = VERR_COM_UNEXPECTED; 316 317 } … … 415 416 if (RT_FAILURE(rc)) 416 417 { 417 LogRel(("DnD: Failed to create proxy window, rc=%Rrc\n", rc));418 VBoxTrayError("DnD: Failed to create proxy window, rc=%Rrc\n", rc); 418 419 return -1; 419 420 } … … 626 627 case VBGLR3DNDEVENTTYPE_QUIT: 627 628 { 628 LogRel(("DnD: Received quit message, shutting down ...\n"));629 VBoxTrayInfo("DnD: Received quit message, shutting down ...\n"); 629 630 PostQuitMessage(0); 630 631 } … … 652 653 default: 653 654 { 654 LogRel(("DnD: Received unsupported message '%RU32'\n", pVbglR3Event->enmType));655 VBoxTrayVerbose(1, "DnD: Received unsupported message '%RU32'\n", pVbglR3Event->enmType); 655 656 rc = VERR_NOT_SUPPORTED; 656 657 break; … … 662 663 { 663 664 /* Tell the user. */ 664 LogRel(("DnD: Processing message %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc));665 VBoxTrayError("DnD: Processing message %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc); 665 666 666 667 /* If anything went wrong, do a reset and start over. */ … … 691 692 * Registers this proxy window as a local drop target. 692 693 * 693 * @return IPRTstatus code.694 * @return VBox status code. 694 695 */ 695 696 int VBoxDnDWnd::RegisterAsDropTarget(void) … … 721 722 } 722 723 if (hrc != DRAGDROP_E_INVALIDHWND) /* Could be because the DnD host service is not available. */ 723 LogRel(("DnD: Creating drop target failed with hr=%Rhrc\n", hrc)); 724 VBoxTrayError("DnD: Creating drop target failed with hr=%Rhrc\n", hrc); 725 724 726 LogFlowFuncLeaveRC(VERR_NOT_SUPPORTED); 725 727 return VERR_NOT_SUPPORTED; /* Report back DnD as not being supported. */ … … 729 731 * Unregisters this proxy as a drop target. 730 732 * 731 * @return IPRTstatus code.733 * @return VBox status code. 732 734 */ 733 735 int VBoxDnDWnd::UnregisterAsDropTarget(void) … … 761 763 * Handles the creation of a proxy window. 762 764 * 763 * @return IPRTstatus code.765 * @return VBox status code. 764 766 */ 765 767 int VBoxDnDWnd::OnCreate(void) … … 769 771 if (RT_FAILURE(rc)) 770 772 { 771 LogRel(("DnD: Connection to host service failed, rc=%Rrc\n", rc));773 VBoxTrayError("DnD: Connection to host service failed, rc=%Rrc\n", rc); 772 774 return rc; 773 775 } … … 796 798 { 797 799 LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", m_enmMode, m_enmState)); 798 LogRel(("DnD: Drag and drop operation aborted\n"));800 VBoxTrayInfo("DnD: Drag and drop operation aborted\n"); 799 801 800 802 int rc = RTCritSectEnter(&m_CritSect); … … 820 822 * the guest's screen to initiate a host -> guest DnD operation. 821 823 * 822 * @return IPRTstatus code.824 * @return VBox status code. 823 825 * @param a_lstFormats Supported formats offered by the host. 824 826 * @param a_fDndLstActionsAllowed Supported actions offered by the host. … … 859 861 AssertReturnStmt(paFormatEtc, RTMemTmpFree(paFormatEtc), VERR_NO_TMP_MEMORY); 860 862 861 LogRel2(("DnD: Reported formats:\n"));863 VBoxTrayVerbose(1, "DnD: Reported formats:\n"); 862 864 for (size_t i = 0; i < a_lstFormats.size(); i++) 863 865 { … … 908 910 } 909 911 910 LogRel2(("DnD: \t%s: %RTbool\n", a_lstFormats.at(i).c_str(), fSupported));912 VBoxTrayVerbose(1, "DnD: \t%s: %RTbool\n", a_lstFormats.at(i).c_str(), fSupported); 911 913 } 912 914 … … 927 929 } 928 930 929 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,930 strMsg.c_str(), VBOX_DND_SHOWBALLOON_HEADER,931 15 * 1000 /* Time to display in msec */, NIIF_INFO);931 VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 932 strMsg.c_str(), VBOX_DND_SHOWBALLOON_HEADER, 933 15 * 1000 /* Time to display in msec */, NIIF_INFO); 932 934 } 933 935 … … 938 940 if (cFormatsActive) 939 941 { 940 LogRel2(("DnD: %RU32 supported formats found:\n", cFormatsActive));942 VBoxTrayVerbose(1, "DnD: %RU32 supported formats found:\n", cFormatsActive); 941 943 for (size_t i = 0; i < cFormatsActive; i++) 942 LogRel2(("DnD: \t%s\n", this->m_lstFmtActive.at(i).c_str()));944 VBoxTrayVerbose(1, "DnD: \t%s\n", this->m_lstFmtActive.at(i).c_str()); 943 945 } 944 946 else 945 LogRel(("DnD: Warning: No supported drag and drop formats on the guest found!\n"));947 VBoxTrayInfo("DnD: Warning: No supported drag and drop formats on the guest found!\n"); 946 948 947 949 /* … … 961 963 } 962 964 963 LogRel2(("DnD: Supported drop actions: 0x%x\n", m_startupInfo.dwOKEffects));965 VBoxTrayVerbose(1, "DnD: Supported drop actions: 0x%x\n", m_startupInfo.dwOKEffects); 964 966 965 967 #ifdef RT_EXCEPTIONS_ENABLED … … 994 996 * the guest's screen. 995 997 * 996 * @return IPRTstatus code.998 * @return VBox status code. 997 999 * @param u32xPos Absolute X position (in pixels) of the host cursor 998 1000 * inside the guest. … … 1044 1046 * the guest's screen again. 1045 1047 * 1046 * @return IPRTstatus code.1048 * @return VBox status code. 1047 1049 */ 1048 1050 int VBoxDnDWnd::OnHgLeave(void) … … 1052 1054 1053 1055 if (g_cVerbosity) 1054 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,1055 "Leave: Host -> Guest", VBOX_DND_SHOWBALLOON_HEADER,1056 15 * 1000 /* Time to display in msec */, NIIF_INFO);1056 VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1057 "Leave: Host -> Guest", VBOX_DND_SHOWBALLOON_HEADER, 1058 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1057 1059 1058 1060 int rc = Abort(); … … 1066 1068 * and therefore start a "drop" action in the guest. 1067 1069 * 1068 * @return IPRTstatus code.1070 * @return VBox status code. 1069 1071 */ 1070 1072 int VBoxDnDWnd::OnHgDrop(void) … … 1079 1081 { 1080 1082 if (g_cVerbosity) 1081 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,1082 "Drop: Host -> Guest", VBOX_DND_SHOWBALLOON_HEADER,1083 15 * 1000 /* Time to display in msec */, NIIF_INFO);1083 VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1084 "Drop: Host -> Guest", VBOX_DND_SHOWBALLOON_HEADER, 1085 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1084 1086 1085 1087 if (m_lstFmtActive.size() >= 1) … … 1101 1103 if (RT_SUCCESS(rc)) 1102 1104 { 1103 LogRel(("DnD: Requesting data as '%s' ...\n", m_strFmtReq.c_str()));1105 VBoxTrayInfo("DnD: Requesting data as '%s' ...\n", m_strFmtReq.c_str()); 1104 1106 rc = VbglR3DnDHGSendReqData(&m_cmdCtx, m_strFmtReq.c_str()); 1105 1107 if (RT_FAILURE(rc)) … … 1109 1111 } 1110 1112 else /* Should never happen. */ 1111 LogRel(("DnD: Error: Host did not specify a data format for drop data\n"));1113 VBoxTrayError("DnD: Host did not specify a data format for drop data\n"); 1112 1114 } 1113 1115 … … 1120 1122 * to the guest after a "drop" event. 1121 1123 * 1122 * @return IPRTstatus code.1124 * @return VBox status code. 1123 1125 * @param pMeta Pointer to meta data received. 1124 1126 */ … … 1147 1149 case VBGLR3GUESTDNDMETADATATYPE_URI_LIST: 1148 1150 { 1149 LogRel2(("DnD: URI transfer root directory is '%s'\n", DnDTransferListGetRootPathAbs(&pMeta->u.URI.Transfer))); 1151 VBoxTrayVerbose(1, "DnD: URI transfer root directory is '%s'\n", 1152 DnDTransferListGetRootPathAbs(&pMeta->u.URI.Transfer)); 1150 1153 1151 1154 char *pszBuf; … … 1186 1189 * host -> guest operation. 1187 1190 * 1188 * @return IPRTstatus code.1191 * @return VBox status code. 1189 1192 */ 1190 1193 int VBoxDnDWnd::OnHgCancel(void) … … 1213 1216 * this class again. 1214 1217 * 1215 * @return IPRTstatus code.1218 * @return VBox status code. 1216 1219 */ 1217 1220 int VBoxDnDWnd::OnGhIsDnDPending(void) … … 1335 1338 case VERR_ACCESS_DENIED: 1336 1339 { 1337 rc = hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,1338 szMsg, szTitle,1339 15 * 1000 /* Time to display in msec */, NIIF_INFO);1340 rc = VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1341 szMsg, szTitle, 1342 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1340 1343 AssertRC(rc); 1341 1344 break; … … 1346 1349 } 1347 1350 1348 LogRel2(("DnD: Host refuses drag and drop operation from guest: %Rrc\n", rc2));1351 VBoxTrayVerbose(1, "DnD: Host refuses drag and drop operation from guest: %Rrc\n", rc2); 1349 1352 Reset(); 1350 1353 } … … 1363 1366 * to send data in a specific format the host requested. 1364 1367 * 1365 * @return IPRTstatus code.1368 * @return VBox status code. 1366 1369 * @param pszFormat Format the host requests the data in. 1367 1370 * @param cbFormat Size (in bytes) of format string. … … 1381 1384 strMsg += RTCStringFmt("Format: %s\n", strFormat.c_str()); 1382 1385 1383 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,1384 strMsg.c_str(), VBOX_DND_SHOWBALLOON_HEADER,1385 15 * 1000 /* Time to display in msec */, NIIF_INFO);1386 VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1387 strMsg.c_str(), VBOX_DND_SHOWBALLOON_HEADER, 1388 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1386 1389 } 1387 1390 … … 1448 1451 * this class after processing. 1449 1452 * 1450 * @return IPRTstatus code.1453 * @return VBox status code. 1451 1454 * @param pEvent Event to inject. 1452 1455 */ … … 1464 1467 if (s_iBitchedAboutFailedDnDMessages++ < 32) 1465 1468 { 1466 LogRel(("DnD: Processing event %p failed with %ld (%Rrc), skipping\n",1467 pEvent, dwErr, RTErrConvertFromWin32(dwErr)));1469 VBoxTrayError("DnD: Processing event %p failed with %ld (%Rrc), skipping\n", 1470 pEvent, dwErr, RTErrConvertFromWin32(dwErr)); 1468 1471 } 1469 1472 … … 1483 1486 * and do a reconnect to the DnD HGCM service. 1484 1487 * 1485 * @returns IPRTstatus code.1488 * @returns VBox status code. 1486 1489 */ 1487 1490 int VBoxDnDWnd::checkForSessionChange(void) … … 1508 1511 * Hides the proxy window again. 1509 1512 * 1510 * @return IPRTstatus code.1513 * @return VBox status code. 1511 1514 */ 1512 1515 int VBoxDnDWnd::Hide(void) … … 1524 1527 * spawned across all active guest monitors. 1525 1528 * 1526 * @return IPRTstatus code.1529 * @return VBox status code. 1527 1530 */ 1528 1531 int VBoxDnDWnd::makeFullscreen(void) … … 1588 1591 { 1589 1592 DWORD dwErr = GetLastError(); 1590 LogRel(("DnD: Failed to set proxy window position, rc=%Rrc\n",1591 RTErrConvertFromWin32(dwErr)));1593 VBoxTrayError("DnD: Failed to set proxy window position, rc=%Rrc\n", 1594 RTErrConvertFromWin32(dwErr)); 1592 1595 } 1593 1596 } 1594 1597 else 1595 LogRel(("DnD: Failed to determine virtual screen size, rc=%Rrc\n", rc));1598 VBoxTrayError("DnD: Failed to determine virtual screen size, rc=%Rrc\n", rc); 1596 1599 1597 1600 LogFlowFuncLeaveRC(rc); … … 1602 1605 * Moves the guest mouse cursor to a specific position. 1603 1606 * 1604 * @return IPRTstatus code.1607 * @return VBox status code. 1605 1608 * @param x X position (in pixels) to move cursor to. 1606 1609 * @param y Y position (in pixels) to move cursor to. … … 1648 1651 * Releases a previously pressed left guest mouse button. 1649 1652 * 1650 * @return IPRTstatus code.1653 * @return VBox status code. 1651 1654 */ 1652 1655 int VBoxDnDWnd::mouseRelease(void) … … 1699 1702 * Sets the current operation mode of this proxy window. 1700 1703 * 1701 * @return IPRTstatus code.1704 * @return VBox status code. 1702 1705 * @param enmMode New mode to set. 1703 1706 */ … … 1751 1754 } 1752 1755 1753 /** 1754 * Initializes drag and drop. 1755 * 1756 * @return IPRT status code. 1757 * @param pEnv The DnD service's environment. 1758 * @param ppInstance The instance pointer which refer to this object. 1759 */ 1760 DECLCALLBACK(int) VBoxDnDInit(const PVBOXSERVICEENV pEnv, void **ppInstance) 1756 1757 /** 1758 * @interface_method_impl{VBOXSERVICEDESC,pfnPreInit} 1759 */ 1760 static DECLCALLBACK(int) vbtrDnDPreInit(void) 1761 { 1762 return VINF_SUCCESS; 1763 } 1764 1765 1766 /** 1767 * @interface_method_impl{VBOXSERVICEDESC,pfnOption} 1768 */ 1769 static DECLCALLBACK(int) vbtrDnDOption(const char **ppszShort, int argc, char **argv, int *pi) 1770 { 1771 RT_NOREF(ppszShort, argc, argv, pi); 1772 1773 return -1; 1774 } 1775 1776 /** 1777 * @interface_method_impl{VBOXSERVICEDESC,pfnInit} 1778 */ 1779 DECLCALLBACK(int) vbtrDnDInit(const PVBOXTRAYSVCENV pEnv, void **ppInstance) 1761 1780 { 1762 1781 AssertPtrReturn(pEnv, VERR_INVALID_POINTER); … … 1774 1793 { 1775 1794 /* Do not do drag and drop for remote sessions. */ 1776 LogRel(("DnD: Drag and drop has been disabled for a remote session\n"));1795 VBoxTrayInfo("DnD: Drag and drop has been disabled for a remote session\n"); 1777 1796 rc = VERR_NOT_SUPPORTED; 1778 1797 } … … 1791 1810 if (!fSupportedOS) 1792 1811 { 1793 LogRel(("DnD: Not supported Windows version, disabling drag and drop support\n"));1812 VBoxTrayInfo("DnD: Not supported Windows version, disabling drag and drop support\n"); 1794 1813 rc = VERR_NOT_SUPPORTED; 1795 1814 } … … 1842 1861 *ppInstance = pCtx; 1843 1862 1844 LogRel(("DnD: Drag and drop service successfully started\n"));1863 VBoxTrayInfo("DnD: Drag and drop service successfully started\n"); 1845 1864 } 1846 1865 else 1847 LogRel(("DnD: Initializing drag and drop service failed with rc=%Rrc\n", rc));1866 VBoxTrayError("DnD: Initializing drag and drop service failed with rc=%Rrc\n", rc); 1848 1867 1849 1868 LogFlowFuncLeaveRC(rc); … … 1851 1870 } 1852 1871 1853 DECLCALLBACK(int) VBoxDnDStop(void *pInstance) 1872 /** 1873 * @interface_method_impl{VBOXSERVICEDESC,pfnStop} 1874 */ 1875 DECLCALLBACK(int) vbtrDnDStop(void *pInstance) 1854 1876 { 1855 1877 AssertPtrReturn(pInstance, VERR_INVALID_POINTER); … … 1870 1892 } 1871 1893 1872 DECLCALLBACK(void) VBoxDnDDestroy(void *pInstance) 1894 /** 1895 * @interface_method_impl{VBOXSERVICEDESC,pfnInit} 1896 */ 1897 DECLCALLBACK(void) vbtrDnDDestroy(void *pInstance) 1873 1898 { 1874 1899 AssertPtrReturnVoid(pInstance); … … 1897 1922 } 1898 1923 1899 DECLCALLBACK(int) VBoxDnDWorker(void *pInstance, bool volatile *pfShutdown) 1924 /** 1925 * @interface_method_impl{VBOXSERVICEDESC,pfnWorker} 1926 */ 1927 DECLCALLBACK(int) vbtrDnDWorker(void *pInstance, bool volatile *pfShutdown) 1900 1928 { 1901 1929 AssertPtr(pInstance); … … 1918 1946 1919 1947 if (g_cVerbosity) 1920 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,1921 RTCStringFmt("Running (worker client ID %RU32)", pCtx->cmdCtx.uClientID).c_str(),1922 VBOX_DND_SHOWBALLOON_HEADER,1923 15 * 1000 /* Time to display in msec */, NIIF_INFO);1948 VBoxTrayHlpShowBalloonTipEx(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1949 RTCStringFmt("Running (worker client ID %RU32)", pCtx->cmdCtx.uClientID).c_str(), 1950 VBOX_DND_SHOWBALLOON_HEADER, 1951 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1924 1952 1925 1953 /** @todo At the moment we only have one DnD proxy window. */ … … 1950 1978 cMsgSkippedInvalid = 0; /* Reset skipped messages count. */ 1951 1979 1952 LogRel2(("DnD: Received new event, type=%RU32, rc=%Rrc\n", pVbglR3Event->enmType, rc));1980 VBoxTrayVerbose(2, "DnD: Received new event, type=%RU32, rc=%Rrc\n", pVbglR3Event->enmType, rc); 1953 1981 1954 1982 /* pEvent now owns pVbglR3Event. */ … … 1963 1991 } 1964 1992 else 1965 LogRel(("DnD: Processing proxy window event %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc));1993 VBoxTrayInfo("DnD: Processing proxy window event %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc); 1966 1994 } 1967 1995 … … 1981 2009 if (cMsgSkippedInvalid++ > 32) 1982 2010 { 1983 LogRel(("DnD: Too many invalid/skipped messages from host, exiting ...\n"));2011 VBoxTrayInfo("DnD: Too many invalid/skipped messages from host, exiting ...\n"); 1984 2012 break; 1985 2013 } … … 2011 2039 VbglR3DnDDisconnect(&pCtx->cmdCtx); 2012 2040 2013 LogRel(("DnD: Ended\n"));2041 VBoxTrayInfo("DnD: Ended\n"); 2014 2042 2015 2043 LogFlowFuncLeaveRC(rc); … … 2020 2048 * The service description. 2021 2049 */ 2022 VBOX SERVICEDESC g_SvcDescDnD =2050 VBOXTRAYSVCDESC g_SvcDescDnD = 2023 2051 { 2024 2052 /* pszName. */ … … 2026 2054 /* pszDescription. */ 2027 2055 "Drag and Drop", 2056 /* pszUsage. */ 2057 NULL, 2058 /* pszOptions. */ 2059 NULL, 2028 2060 /* methods */ 2029 VBoxDnDInit, 2030 VBoxDnDWorker, 2031 VBoxDnDStop, 2032 VBoxDnDDestroy 2061 vbtrDnDPreInit, 2062 vbtrDnDOption, 2063 vbtrDnDInit, 2064 vbtrDnDWorker, 2065 vbtrDnDStop, 2066 vbtrDnDDestroy 2033 2067 }; 2034 2068
Note:
See TracChangeset
for help on using the changeset viewer.