Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Embedded Game Window with user arguments #101739

Merged

Conversation

Hilderin
Copy link
Contributor

This should fixes the user command line arguments when using -- or ++.

Tested with the issue MRP with and without the --.

@Hilderin Hilderin added this to the 4.4 milestone Jan 18, 2025
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, code looks good.

}

E = N;
}

// Add the editor window's native ID so the started game can directly set it as its parent.
r_arguments.push_back("--wid");
r_arguments.push_back(itos(DisplayServer::get_singleton()->window_get_native_handle(DisplayServer::WINDOW_HANDLE, get_window()->get_window_id())));
List<String>::Element *N = r_arguments.insert_before(user_args_element, "--wid");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: insert_before handle nullptr as push_back, so it's fine if it's not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I used a if(user_args_element) push_back else insert_before then I saw at insert_before handles nullptr as you said. Would it be preferable to manage the nullptr here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's fine as is.

@Repiteo Repiteo merged commit 6fcaf71 into godotengine:master Jan 20, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jan 20, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[4.4-beta.1] Game editor not embedded due to parameters for it being after main_run_args and --.
3 participants