From 681d5253c49e2baaf17698846ec5ff0825495c6d Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 14 May 2009 15:36:18 -0500 Subject: [PATCH] spin on GetCurrentButtonState before warping cursor when grabbing cocoa input. this keeps the window from jumping if you click on its titlebar to focus --- basis/core-graphics/core-graphics.factor | 2 ++ basis/ui/backend/cocoa/cocoa.factor | 1 + 2 files changed, 3 insertions(+) diff --git a/basis/core-graphics/core-graphics.factor b/basis/core-graphics/core-graphics.factor index e9158be47d..6612a43dca 100644 --- a/basis/core-graphics/core-graphics.factor +++ b/basis/core-graphics/core-graphics.factor @@ -116,6 +116,8 @@ FUNCTION: CGError CGAssociateMouseAndMouseCursorPosition ( boolean_t connected ) FUNCTION: CGError CGWarpMouseCursorPosition ( CGPoint newCursorPosition ) ; +FUNCTION: uint GetCurrentButtonState ( ) ; + > -> frame CGRect>rect rect-center NSScreen -> screens 0 -> objectAtIndex: -> frame CGRect-h [ drop first ] [ swap second - ] 2bi + [ GetCurrentButtonState zero? not ] [ yield ] while CGWarpMouseCursorPosition drop ; M: cocoa-ui-backend (ungrab-input) ( handle -- )