Improved WINDOW_UPDATE handling