Delay toplevel creation until after OpenGL initialization.

This commit is contained in:
Bartosz Taudul 2022-11-06 01:14:56 +01:00
parent 4d74968515
commit 1ccc0c39ea
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -121,11 +121,6 @@ Backend::Backend( const char* title, std::function<void()> redraw, RunQueue* mai
s_eglWin = wl_egl_window_create( s_surf, m_winPos.w, m_winPos.h );
s_xdgSurf = xdg_wm_base_get_xdg_surface( s_wm, s_surf );
xdg_surface_add_listener( s_xdgSurf, &surfaceListener, nullptr );
wl_display_roundtrip( s_dpy );
s_toplevel = xdg_surface_get_toplevel( s_xdgSurf );
xdg_toplevel_add_listener( s_toplevel, &toplevelListener, nullptr );
xdg_toplevel_set_title( s_toplevel, title );
constexpr EGLint eglConfigAttrib[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
@ -165,6 +160,11 @@ Backend::Backend( const char* title, std::function<void()> redraw, RunQueue* mai
ImGui_ImplOpenGL3_Init( "#version 150" );
wl_display_roundtrip( s_dpy );
s_toplevel = xdg_surface_get_toplevel( s_xdgSurf );
xdg_toplevel_add_listener( s_toplevel, &toplevelListener, nullptr );
xdg_toplevel_set_title( s_toplevel, title );
ImGuiIO& io = ImGui::GetIO();
io.BackendPlatformName = "wayland (tracy profiler)";
s_time = std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();