Move Window helper methods to a WindowHelpers trait

Fix #2418