Handle focused windows properly