Check for valid transient or modal when switching workspaces, to avoid missing windows to unmap (bug #2518). (Old svn revision: 23767)