Cursor Grab bugfix: passing NULL for bounds didn't initialize properly.

Symptom: first button drag gets stuck on values.

Cause: Buttons didn't set grab bounds, to use the whole window. But Ghost didn't do anything in that case, it left the bounds value as is. It only affected the first cursor grab, because cursor ungrab sets it to -1, which forces it to use the whole window size (checking every mouse move) for subsequent grabs.

Solution: When NULL, init bounds to window size (and don't query every mouse move).
This commit is contained in:
2009-11-26 02:58:53 +00:00
parent cbc2c1886d
commit eee8bf344a

View File

@@ -109,6 +109,8 @@ GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rec
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1;
else if (bounds) {
m_cursorGrabBounds= *bounds;
} else { /* if bounds not defined, use window */
getClientBounds(m_cursorGrabBounds);
}
m_cursorGrab = mode;
return GHOST_kSuccess;