moved window management out of graphics module, fixed #54