Merge "Refactor the native window api return codes and simplify the window use"