Changeset 97739 in vbox
- Timestamp:
- Dec 5, 2022 8:33:18 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 154800
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r97738 r97739 588 588 589 589 /* X11 helpers. */ 590 int mouseCursorFakeMove(void) const;591 int mouseCursorMove(int iPosX, int iPosY) const;590 int mouseCursorFakeMove(void); 591 int mouseCursorMove(int iPosX, int iPosY); 592 592 void mouseButtonSet(Window wndDest, int rx, int ry, int iButton, bool fPress); 593 593 int proxyWinShow(int *piRootX = NULL, int *piRootY = NULL) const; … … 634 634 * Set to 0 if not available / not set yet. */ 635 635 uint8_t m_uXdndVer; 636 /** Last mouse X position (in pixels, absolute to root window). 637 * Set to -1 if not set yet. */ 638 int m_lastMouseX; 639 /** Last mouse Y position (in pixels, absolute to root window). 640 * Set to -1 if not set yet. */ 641 int m_lastMouseY; 636 642 /** List of (Atom) formats the current source/target window supports. */ 637 643 VBoxDnDAtomList m_lstAtomFormats; … … 807 813 /** @todo Support INC (incremental transfers). */ 808 814 809 m_wndCur = 0; 810 m_uXdndVer = 0; 811 m_enmState = Initialized; 812 m_enmMode = Unknown; 815 m_wndCur = 0; 816 m_uXdndVer = 0; 817 m_lastMouseX = -1; 818 m_lastMouseY = -1; 819 m_enmState = Initialized; 820 m_enmMode = Unknown; 821 m_cFailedPendingAttempts = 0; 822 813 823 m_eventQueueList.clear(); 814 m_cFailedPendingAttempts = 0;815 824 816 825 /* Reset the selection request buffer. */ … … 2579 2588 * @returns IPRT status code. 2580 2589 */ 2581 int DragInstance::mouseCursorFakeMove(void) const2590 int DragInstance::mouseCursorFakeMove(void) 2582 2591 { 2583 2592 int iScreenID = XDefaultScreen(m_pDisplay); … … 2627 2636 * @param iPosY Absolute Y coordinate. 2628 2637 */ 2629 int DragInstance::mouseCursorMove(int iPosX, int iPosY) const2630 { 2631 int iScreenID = XDefaultScreen(m_pDisplay);2638 int DragInstance::mouseCursorMove(int iPosX, int iPosY) 2639 { 2640 int const iScreenID = XDefaultScreen(m_pDisplay); 2632 2641 /** @todo What about multiple screens? Test this! */ 2633 2642 2634 const int iScrX = XDisplayWidth(m_pDisplay, iScreenID); 2635 const int iScrY = XDisplayHeight(m_pDisplay, iScreenID); 2636 2637 iPosX = RT_CLAMP(iPosX, 0, iScrX); 2638 iPosY = RT_CLAMP(iPosY, 0, iScrY); 2639 2640 LogFlowThisFunc(("iPosX=%d, iPosY=%d\n", iPosX, iPosY)); 2643 int const iScreenWidth = XDisplayWidth (m_pDisplay, iScreenID); 2644 int const iScreenHeight = XDisplayHeight(m_pDisplay, iScreenID); 2645 2646 iPosX = RT_CLAMP(iPosX, 0, iScreenWidth); 2647 iPosY = RT_CLAMP(iPosY, 0, iScreenHeight); 2648 2649 /* Same mouse position as before? No need to do anything. */ 2650 if ( m_lastMouseX == iPosX 2651 && m_lastMouseY == iPosY) 2652 { 2653 return VINF_SUCCESS; 2654 } 2655 2656 LogFlowThisFunc(("iPosX=%d, iPosY=%d, m_wndRoot=%#x\n", iPosX, iPosY, m_wndRoot)); 2641 2657 2642 2658 /* Move the guest pointer to the DnD position, so we can find the window 2643 2659 * below that position. */ 2644 XWarpPointer(m_pDisplay, None, m_wndRoot, 0, 0, 0, 0, iPosX, iPosY); 2660 int xRc = XWarpPointer(m_pDisplay, None, m_wndRoot, 0, 0, 0, 0, iPosX, iPosY); 2661 if (xRc == Success) 2662 { 2663 XFlush(m_pDisplay); 2664 2665 m_lastMouseX = iPosX; 2666 m_lastMouseY = iPosY; 2667 } 2668 else 2669 VBClLogError("Moving mouse cursor failed: %s", gX11->xErrorToString(xRc).c_str()); 2670 2645 2671 return VINF_SUCCESS; 2646 2672 }
Note:
See TracChangeset
for help on using the changeset viewer.