Browse Source

Fix for Glfw and Wayland crashing when showing the window after being hidden

pull/397/head
Konstantinos Chatzilygeroudis 7 years ago committed by Vladimír Vondruš
parent
commit
c8d2c33ac6
  1. 10
      src/Magnum/Platform/GlfwApplication.cpp

10
src/Magnum/Platform/GlfwApplication.cpp

@ -403,8 +403,14 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf
/* Create window. Hide it by default so we don't have distracting window
blinking in case we have to destroy it again right away. If the creation
succeeds, make the context current so we can query GL_VENDOR below. */
glfwWindowHint(GLFW_VISIBLE, false);
succeeds, make the context current so we can query GL_VENDOR below.
If we are on Wayland, this is causing a segfault; a blinking window is
acceptable in this case. */
constexpr const char waylandString[] = "wayland";
if(std::strncmp(std::getenv("XDG_SESSION_TYPE"), waylandString, sizeof(waylandString)) != 0)
glfwWindowHint(GLFW_VISIBLE, false);
else if(_verboseLog)
Warning{} << "Platform::GlfwApplication: Wayland detected, GL context has to be created with the window visible and may cause flicker on startup";
if((_window = glfwCreateWindow(scaledWindowSize.x(), scaledWindowSize.y(), configuration.title().c_str(), monitor, nullptr)))
glfwMakeContextCurrent(_window);

Loading…
Cancel
Save