spin on GetCurrentButtonState before warping cursor when grabbing cocoa input. this keeps the window from jumping if you click on its titlebar to focus

db4
Joe Groff 2009-05-14 15:36:18 -05:00
parent 92e508356e
commit 606ed8aaa1
2 changed files with 3 additions and 0 deletions

View File

@ -116,6 +116,8 @@ FUNCTION: CGError CGAssociateMouseAndMouseCursorPosition ( boolean_t connected )
FUNCTION: CGError CGWarpMouseCursorPosition ( CGPoint newCursorPosition ) ;
FUNCTION: uint GetCurrentButtonState ( ) ;
<PRIVATE
: bitmap-flags ( -- flags )

View File

@ -128,6 +128,7 @@ M: cocoa-ui-backend (grab-input) ( handle -- )
window>> -> frame CGRect>rect rect-center
NSScreen -> screens 0 -> objectAtIndex: -> frame CGRect-h
[ drop first ] [ swap second - ] 2bi <CGPoint>
[ GetCurrentButtonState zero? not ] [ yield ] while
CGWarpMouseCursorPosition drop ;
M: cocoa-ui-backend (ungrab-input) ( handle -- )