Cocoa fix [#21866] : force mouse move event to be sent upon cursor position set request
This commit is contained in:
parent
f3f8855dfe
commit
5c24ce16b2
@ -331,7 +331,7 @@ public:
|
||||
* @param y The y-coordinate of the cursor.
|
||||
* @return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const = 0;
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
|
||||
|
||||
/***************************************************************************************
|
||||
** Access to mouse button and keyboard states.
|
||||
|
@ -531,7 +531,7 @@ GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt
|
||||
}
|
||||
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
|
||||
GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||
{
|
||||
float xf=(float)x, yf=(float)y;
|
||||
|
||||
|
@ -156,7 +156,7 @@ public:
|
||||
* @param y The y-coordinate of the cursor.
|
||||
* @return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
/***************************************************************************************
|
||||
** Access to mouse button and keyboard states.
|
||||
|
@ -179,8 +179,8 @@ public:
|
||||
* @param y The y-coordinate of the cursor.
|
||||
* @return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
|
||||
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
/***************************************************************************************
|
||||
** Access to mouse button and keyboard states.
|
||||
***************************************************************************************/
|
||||
@ -272,6 +272,14 @@ protected:
|
||||
*/
|
||||
GHOST_TSuccess handleKeyEvent(void *eventPtr);
|
||||
|
||||
/**
|
||||
* Performs the actual cursor position update (location in screen coordinates).
|
||||
* @param x The x-coordinate of the cursor.
|
||||
* @param y The y-coordinate of the cursor.
|
||||
* @return Indication of success.
|
||||
*/
|
||||
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
/** Start time at initialization. */
|
||||
GHOST_TUns64 m_start_time;
|
||||
|
||||
|
@ -807,7 +807,23 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
|
||||
/**
|
||||
* @note : expect Cocoa screen coordinates
|
||||
*/
|
||||
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
|
||||
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||
{
|
||||
GHOST_TInt32 wx,wy;
|
||||
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
|
||||
if (!window) return GHOST_kFailure;
|
||||
|
||||
setMouseCursorPosition(x, y);
|
||||
|
||||
//Force mouse move event (not pushed by Cocoa)
|
||||
window->screenToClient(x, y, wx, wy);
|
||||
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, wx,wy));
|
||||
m_outsideLoopEventProcessed = true;
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||
{
|
||||
float xf=(float)x, yf=(float)y;
|
||||
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
|
||||
@ -1517,7 +1533,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
|
||||
//Set new cursor position
|
||||
window->clientToScreen(x_mouse, y_mouse, x_cur, y_cur);
|
||||
setCursorPosition(x_cur, y_cur); /* wrap */
|
||||
setMouseCursorPosition(x_cur, y_cur); /* wrap */
|
||||
|
||||
//Post event
|
||||
window->getCursorGrabInitPos(x_cur, y_cur);
|
||||
|
@ -273,7 +273,7 @@ GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
|
||||
}
|
||||
|
||||
|
||||
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
|
||||
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||
{
|
||||
return ::SetCursorPos(x, y) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
* @param y The y-coordinate of the cursor.
|
||||
* @return Indication of success.
|
||||
*/
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
|
||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
|
||||
/***************************************************************************************
|
||||
** Access to mouse button and keyboard states.
|
||||
|
@ -970,7 +970,7 @@ GHOST_SystemX11::
|
||||
setCursorPosition(
|
||||
GHOST_TInt32 x,
|
||||
GHOST_TInt32 y
|
||||
) const {
|
||||
) {
|
||||
|
||||
// This is a brute force move in screen coordinates
|
||||
// XWarpPointer does relative moves so first determine the
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
setCursorPosition(
|
||||
GHOST_TInt32 x,
|
||||
GHOST_TInt32 y
|
||||
) const;
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the state of all modifier keys.
|
||||
|
Loading…
Reference in New Issue
Block a user