Some changes to make sure that the right window is printed too when using a popover menu window