[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28122] trunk/blender/intern/ghost: Cocoa fix [#21866] : force mouse move event to be sent upon cursor position set request
Damien Plisson
damien.plisson at yahoo.fr
Sun Apr 11 13:19:30 CEST 2010
Revision: 28122
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28122
Author: damien78
Date: 2010-04-11 13:19:30 +0200 (Sun, 11 Apr 2010)
Log Message:
-----------
Cocoa fix [#21866] : force mouse move event to be sent upon cursor position set request
Modified Paths:
--------------
trunk/blender/intern/ghost/GHOST_ISystem.h
trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h 2010-04-11 11:19:30 UTC (rev 28122)
@@ -331,7 +331,7 @@
* @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.
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp 2010-04-11 11:19:30 UTC (rev 28122)
@@ -531,7 +531,7 @@
}
-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;
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h 2010-04-11 11:19:30 UTC (rev 28122)
@@ -156,7 +156,7 @@
* @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.
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h 2010-04-11 11:19:30 UTC (rev 28122)
@@ -179,8 +179,8 @@
* @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 @@
*/
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;
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-04-11 11:19:30 UTC (rev 28122)
@@ -807,8 +807,24 @@
/**
* @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();
if (!window) return GHOST_kFailure;
@@ -1517,7 +1533,7 @@
//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);
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2010-04-11 11:19:30 UTC (rev 28122)
@@ -273,7 +273,7 @@
}
-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;
}
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h 2010-04-11 11:19:30 UTC (rev 28122)
@@ -153,7 +153,7 @@
* @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.
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp 2010-04-11 11:19:30 UTC (rev 28122)
@@ -970,7 +970,7 @@
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
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.h 2010-04-11 10:49:47 UTC (rev 28121)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.h 2010-04-11 11:19:30 UTC (rev 28122)
@@ -158,7 +158,7 @@
setCursorPosition(
GHOST_TInt32 x,
GHOST_TInt32 y
- ) const;
+ );
/**
* Returns the state of all modifier keys.
More information about the Bf-blender-cvs
mailing list