#include ONCE "window9.bi"

sub GetWindowsCaptionBorderSize(hw as hwnd , iCaption as gint ptr , iBorder as gint ptr) export
	
	dim as gint iX, iY, iFrameX, iFrameY
	
	dim as any ptr gdkwin = gtk_widget_get_window(hw)
	
	if gdkwin then
		
		gdk_window_get_origin(gdkwin, @iX, @iY)
		
		gdk_window_get_root_origin(gdkwin, @iFrameX, @iFrameY)
		
		*iBorder = abs(iX - iFrameX)
		
		*iCaption = abs(iY - iFrameY) - *iBorder			
		
	EndIf	
	
End Sub