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

Non desired window opening alongside ignition GUI #436

Merged
merged 6 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/ignition/rendering/base/BaseRenderEngine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ namespace ignition

protected: bool isHeadless = false;

/// \brief ID from a external window
protected: std::string winID = "";

protected: unsigned int nextSceneId;

IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Expand Down
11 changes: 11 additions & 0 deletions ogre2/src/Ogre2RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ bool Ogre2RenderEngine::LoadImpl(
if (it != _params.end())
std::istringstream(it->second) >> this->isHeadless;

it = _params.find("winID");
if (it != _params.end())
std::istringstream(it->second) >> this->winID;

try
{
this->LoadAttempt();
Expand Down Expand Up @@ -880,6 +884,13 @@ std::string Ogre2RenderEngine::CreateRenderWindow(const std::string &_handle,
params["currentGLContext"] = "true";
}

#if !defined(__APPLE__) && !defined(_MSC_VER)
if (!this->winID.empty())
{
params["parentWindowHandle"] = this->winID;
}
#endif

int attempts = 0;
while (window == nullptr && (attempts++) < 10)
{
Expand Down