window edge detection/handling.