Fixed a number of bugs in the handling of window parent and owner and
added a regression test (based on the work of Bill Medland).

9 files changed