#include ONCE "window9.bi"

function IsMouseOver(hWin as Hwnd) as long export
	
	dim as Long x  , y 
	
	dim as gint width_b , height_b 

	dim as ListT ptr pListTemp
	
	if hWin = 0 then return 0
	
	pListTemp = cast(ListT ptr,pGlobalTypeWindow9->ListWinAndContainers->findNodeFunc(cint(hWin)))

	
	if pListTemp then
	
		gtk_window_get_size ( GTK_WINDOW(hWin) , @width_b , @height_b )	
		
	else
	
		dim as Long iGadget = ID_In_Number (hWin)
		
		width_b = GadgetWidth (iGadget)
		
		height_b = GadgetHeight (iGadget)

	EndIf
	
	gtk_widget_get_pointer(hWin , @x, @y)
		
	if x < 0 orelse y < 0  orelse x > width_b orelse y > height_b then return 0	
	
	return 1
	
End Function