spin on GetCurrentButtonState before warping cursor when grabbing cocoa input. this keeps the window from jumping if you click on its titlebar to focus
							parent
							
								
									92e508356e
								
							
						
					
					
						commit
						606ed8aaa1
					
				| 
						 | 
				
			
			@ -116,6 +116,8 @@ FUNCTION: CGError CGAssociateMouseAndMouseCursorPosition ( boolean_t connected )
 | 
			
		|||
 | 
			
		||||
FUNCTION: CGError CGWarpMouseCursorPosition ( CGPoint newCursorPosition ) ;
 | 
			
		||||
 | 
			
		||||
FUNCTION: uint GetCurrentButtonState ( ) ;
 | 
			
		||||
 | 
			
		||||
<PRIVATE
 | 
			
		||||
 | 
			
		||||
: bitmap-flags ( -- flags )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 -- )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue