Tooltip placement

Fixes #1718 and #1721

Include the window in the "overflow" calculations, and use an unobstructed clone to measure the size of the tooltip.

Also included tests.

Done!