Fix move operation for windows hanging off screen

Hack: During a move operation, if we detect that the windows to be moved
remains larger than the requested size, we assume that this is due to
the windows hanging off of the side or the bottom of the screen. In this
case we temporarily re-size the window to half of the requested size
before attempting the move operation again.