Changeset 95833 in vbox for trunk/src/VBox
- Timestamp:
- Jul 26, 2022 1:53:35 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
r95734 r95833 49 49 * Defined Constants And Macros * 50 50 *********************************************************************************************************************************/ 51 /* Enable this define to see the proxy window(s) when debugging52 * their behavior. Don't have this enabled in release builds! */53 #ifdef DEBUG54 //# define VBOX_DND_DEBUG_WND55 #endif56 57 51 /** The drag and drop window's window class. */ 58 52 #define VBOX_DND_WND_CLASS "VBoxTrayDnDWnd" … … 228 222 wc.hInstance = hInstance; 229 223 wc.style = CS_NOCLOSE; 230 #ifdef VBOX_DND_DEBUG_WND 231 wc.style |= CS_HREDRAW | CS_VREDRAW; 232 wc.hbrBackground = (HBRUSH)(CreateSolidBrush(RGB(255, 0, 0))); 233 #else 234 wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); 235 #endif 224 225 if (g_cVerbosity) 226 { 227 /* Make it a solid red color so that we can see the window. */ 228 wc.style |= CS_HREDRAW | CS_VREDRAW; 229 wc.hbrBackground = (HBRUSH)(CreateSolidBrush(RGB(255, 0, 0))); 230 } 231 else 232 wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); 233 236 234 if (!RegisterClassEx(&wc)) 237 235 { … … 244 242 if (RT_SUCCESS(rc)) 245 243 { 246 DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE; 247 DWORD dwStyle = WS_POPUP; 248 #ifdef VBOX_DND_DEBUG_WND 249 dwExStyle &= ~WS_EX_TRANSPARENT; /* Remove transparency bit. */ 250 dwStyle |= WS_VISIBLE; /* Make the window visible. */ 251 #endif 244 DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE; 245 DWORD dwStyle = WS_POPUP; 246 if (g_cVerbosity) 247 { 248 dwStyle |= WS_VISIBLE; 249 } 250 else 251 dwExStyle |= WS_EX_TRANSPARENT; 252 252 253 pThis->m_hWnd = CreateWindowEx(dwExStyle, 253 VBOX_DND_WND_CLASS, VBOX_DND_WND_CLASS, 254 dwStyle, 255 #ifdef VBOX_DND_DEBUG_WND 256 CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, NULL, NULL, 257 #else 258 -200, -200, 100, 100, NULL, NULL, 259 #endif 260 hInstance, pThis /* lParm */); 254 VBOX_DND_WND_CLASS, VBOX_DND_WND_CLASS, 255 dwStyle, 256 -200, -200, 100, 100, NULL, NULL, 257 hInstance, pThis /* lParm */); 261 258 if (!pThis->m_hWnd) 262 259 { … … 267 264 else 268 265 { 269 #ifndef VBOX_DND_DEBUG_WND 270 SetWindowPos(pThis->m_hWnd, HWND_TOPMOST, -200, -200, 0, 0, 271 SWP_NOACTIVATE | SWP_HIDEWINDOW 272 | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 266 BOOL fRc = SetWindowPos(pThis->m_hWnd, HWND_TOPMOST, -200, -200, 0, 0, 267 SWP_NOACTIVATE | SWP_HIDEWINDOW 268 | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 269 AssertMsg(fRc, ("Unable to set window position, error=%ld\n", GetLastError())); 270 273 271 LogFlowFunc(("Proxy window created, hWnd=0x%x\n", pThis->m_hWnd)); 274 #else 275 LogFlowFunc(("Debug proxy window created, hWnd=0x%x\n", pThis->m_hWnd)); 276 277 /* 278 * Install some mouse tracking. 279 */ 280 TRACKMOUSEEVENT me; 281 RT_ZERO(me); 282 me.cbSize = sizeof(TRACKMOUSEEVENT); 283 me.dwFlags = TME_HOVER | TME_LEAVE | TME_NONCLIENT; 284 me.hwndTrack = pThis->m_hWnd; 285 BOOL fRc = TrackMouseEvent(&me); 286 Assert(fRc); 287 #endif 272 273 if (g_cVerbosity) 274 { 275 /* 276 * Install some mouse tracking. 277 */ 278 TRACKMOUSEEVENT me; 279 RT_ZERO(me); 280 me.cbSize = sizeof(TRACKMOUSEEVENT); 281 me.dwFlags = TME_HOVER | TME_LEAVE | TME_NONCLIENT; 282 me.hwndTrack = pThis->m_hWnd; 283 284 fRc = TrackMouseEvent(&me); 285 AssertMsg(fRc, ("Unable to enable debug mouse tracking, error=%ld\n", GetLastError())); 286 } 288 287 } 289 288 } … … 830 829 return rc; 831 830 831 if (g_cVerbosity) 832 { 833 RTCString strMsg("Enter: Host -> Guest\n\n"); 834 strMsg += RTCStringFmt("Allowed actions: %#x\n", a_fDndLstActionsAllowed); 835 strMsg += "Formats:\n"; 836 for (size_t i = 0; i < this->m_lstFmtSup.size(); i++) 837 { 838 if (i > 0) 839 strMsg += "\n"; 840 strMsg += this->m_lstFmtSup.at(i); 841 } 842 843 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 844 strMsg.c_str(), "VirtualBox Drag'n Drop", 845 15 * 1000 /* Time to display in msec */, NIIF_INFO); 846 } 847 832 848 /* Save all allowed actions. */ 833 849 this->m_lstActionsAllowed = a_fDndLstActionsAllowed; … … 1016 1032 return VERR_WRONG_ORDER; 1017 1033 1034 if (g_cVerbosity) 1035 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1036 "Leave: Host -> Guest", "VirtualBox Drag'n Drop", 1037 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1038 1018 1039 int rc = Abort(); 1019 1040 … … 1038 1059 if (m_enmState == Dragging) 1039 1060 { 1061 if (g_cVerbosity) 1062 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1063 "Drop: Host -> Guest", "VirtualBox Drag'n Drop", 1064 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1065 1040 1066 if (m_lstFmtActive.size() >= 1) 1041 1067 { … … 1325 1351 int VBoxDnDWnd::OnGhDrop(const RTCString &strFormat, uint32_t dndActionDefault) 1326 1352 { 1327 RT_NOREF(dndActionDefault);1328 1329 1353 LogFlowThisFunc(("mMode=%ld, mState=%ld, pDropTarget=0x%p, strFormat=%s, dndActionDefault=0x%x\n", 1330 1354 m_enmMode, m_enmState, m_pDropTarget, strFormat.c_str(), dndActionDefault)); … … 1332 1356 if (m_enmMode == GH) 1333 1357 { 1358 if (g_cVerbosity) 1359 { 1360 RTCString strMsg("Drop: Guest -> Host\n\n"); 1361 strMsg += RTCStringFmt("Action: %#x\n", dndActionDefault); 1362 strMsg += RTCStringFmt("Format: %s\n", strFormat.c_str()); 1363 1364 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1365 strMsg.c_str(), "VirtualBox Drag'n Drop", 1366 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1367 } 1368 1334 1369 if (m_enmState == Dragging) 1335 1370 { … … 1503 1538 r.right = GetSystemMetrics(SM_CXSCREEN); 1504 1539 r.bottom = GetSystemMetrics(SM_CYSCREEN); 1540 1505 1541 rc = VINF_SUCCESS; 1506 1542 } … … 1521 1557 r.right - r.left, 1522 1558 r.bottom - r.top, 1523 #ifdef VBOX_DND_DEBUG_WND 1524 SWP_SHOWWINDOW | SWP_FRAMECHANGED); 1525 #else 1526 SWP_SHOWWINDOW | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); 1527 #endif 1559 g_cVerbosity 1560 ? SWP_SHOWWINDOW | SWP_FRAMECHANGED 1561 : SWP_SHOWWINDOW | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); 1528 1562 if (fRc) 1529 1563 { … … 1864 1898 return rc; 1865 1899 1900 if (g_cVerbosity) 1901 hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON, 1902 RTCStringFmt("Running (worker client ID %RU32)", pCtx->cmdCtx.uClientID).c_str(), 1903 "VirtualBox Drag'n Drop", 1904 15 * 1000 /* Time to display in msec */, NIIF_INFO); 1905 1866 1906 /** @todo At the moment we only have one DnD proxy window. */ 1867 1907 Assert(pCtx->lstWnd.size() == 1);
Note:
See TracChangeset
for help on using the changeset viewer.