diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 13b4cb08..9c9ee0b7 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -3707,8 +3707,8 @@ bool MainFrame::BindControls() #ifdef NO_OGL rb->Hide(); #endif -#ifdef __WXGTK__ - // wxGLCanvas segfaults on Wayland +#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 2, 0) + // wxGLCanvas segfaults on Wayland before wx 3.2 if (wxGetApp().UsingWayland()) { rb->Hide(); } diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 9e826653..9353a959 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -2176,39 +2176,44 @@ void GLDrawingPanel::DrawingPanelInit() glClearColor(0.0, 0.0, 0.0, 1.0); // non-portable vsync code #if defined(__WXGTK__) - static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; - static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; - static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = NULL; + // TODO: Use Wayland EGL equivalent to enable/disable vsync. + if (!IsItWayland()) { + static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; + static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; + static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = NULL; - auto display = GetX11Display(); + // These wayland checks don't work. + auto display = IsItWayland() ? 0 : GetX11Display(); + auto default_screen = IsItWayland() ? 0 : DefaultScreen(display); - char* glxQuery = (char*)glXQueryExtensionsString(display, DefaultScreen(display)); + char* glxQuery = (char*)glXQueryExtensionsString(display, default_screen); - if (strstr(glxQuery, "GLX_EXT_swap_control") != NULL) - { - glXSwapIntervalEXT = reinterpret_cast(glXGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")); - if (glXSwapIntervalEXT) - glXSwapIntervalEXT(glXGetCurrentDisplay(), glXGetCurrentDrawable(), vsync); - else - systemScreenMessage(_("Failed to set glXSwapIntervalEXT")); - } - if (strstr(glxQuery, "GLX_SGI_swap_control") != NULL) - { - glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress((const GLubyte*)("glXSwapIntervalSGI"))); + if (strstr(glxQuery, "GLX_EXT_swap_control") != NULL) + { + glXSwapIntervalEXT = reinterpret_cast(glXGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")); + if (glXSwapIntervalEXT) + glXSwapIntervalEXT(glXGetCurrentDisplay(), glXGetCurrentDrawable(), vsync); + else + systemScreenMessage(_("Failed to set glXSwapIntervalEXT")); + } + if (strstr(glxQuery, "GLX_SGI_swap_control") != NULL) + { + glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress((const GLubyte*)("glXSwapIntervalSGI"))); - if (glXSwapIntervalSGI) - glXSwapIntervalSGI(vsync); - else - systemScreenMessage(_("Failed to set glXSwapIntervalSGI")); - } - if (strstr(glxQuery, "GLX_MESA_swap_control") != NULL) - { - glXSwapIntervalMESA = reinterpret_cast(glXGetProcAddress((const GLubyte*)("glXSwapIntervalMESA"))); + if (glXSwapIntervalSGI) + glXSwapIntervalSGI(vsync); + else + systemScreenMessage(_("Failed to set glXSwapIntervalSGI")); + } + if (strstr(glxQuery, "GLX_MESA_swap_control") != NULL) + { + glXSwapIntervalMESA = reinterpret_cast(glXGetProcAddress((const GLubyte*)("glXSwapIntervalMESA"))); - if (glXSwapIntervalMESA) - glXSwapIntervalMESA(vsync); - else - systemScreenMessage(_("Failed to set glXSwapIntervalMESA")); + if (glXSwapIntervalMESA) + glXSwapIntervalMESA(vsync); + else + systemScreenMessage(_("Failed to set glXSwapIntervalMESA")); + } } #elif defined(__WXMSW__) typedef const char* (*wglext)(); diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index 4fe7ee38..86fc4053 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -358,10 +358,12 @@ bool wxvbamApp::OnInit() { load_opts(); - // wxGLCanvas segfaults under wayland + // wxGLCanvas segfaults under wayland before wx 3.2 +#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 2, 0) if (UsingWayland() && gopts.render_method == RND_OPENGL) { gopts.render_method = RND_SIMPLE; } +#endif // process command-line options for (size_t i = 0; i < pending_optset.size(); i++) {