add window listener and window adapter