The border -- including the title bar -- of a window doesn't count as leaving the window, but doesn't recognize clicking or unclicking of any form. It doesn't have proper coordinates and really isn't part of the useable window. This may be intended behavior, but if it is, I have to suggest a small alteration like a mouse event for leaving the useable portion of the window. This would allow drag and drop type scripts to properly detect when the mouse left the useable portion of the window.