From 175a039fe70ab33fc1a68e21043b086b67d602e4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 24 May 2021 14:37:20 +0100 Subject: gtk4: make opengl slide transitions work again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id64d8759d1c98a973445f52ccfc5df9f0e084743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116060 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/inc/unx/gtk/gtkdata.hxx | 9 +++++++++ vcl/unx/gtk3/gtkinst.cxx | 9 ++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 4bc0ff223507..b343021d3d30 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -180,6 +180,15 @@ inline bool surface_get_device_position(GdkSurface* pSurface, #endif } +inline GdkGLContext* surface_create_gl_context(GdkSurface* pSurface) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gdk_surface_create_gl_context(pSurface, nullptr); +#else + return gdk_window_create_gl_context(pSurface, nullptr); +#endif +} + #if !GTK_CHECK_VERSION(4, 0, 0) typedef GtkClipboard GdkClipboard; #endif diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index d21ac27e1d42..dac7738075f4 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -1725,10 +1725,7 @@ private: #else gtk_grid_attach(GTK_GRID(pParent), m_pGLArea, 0, 0, 1, 1); gtk_widget_show(pParent); - gtk_widget_realize(m_pGLArea); - // TODO does realize do the gdk_window_create_gl_context + gdk_gl_context_realize - // and so gtk_gl_area_make_current then does gdk_gl_context_make_current on its - // own ? + gtk_widget_show(m_pGLArea); #endif gtk_gl_area_make_current(GTK_GL_AREA(m_pGLArea)); @@ -1741,9 +1738,8 @@ private: gtk_gl_area_attach_buffers(GTK_GL_AREA(m_pGLArea)); glGenFramebuffersEXT(1, &m_nAreaFrameBuffer); -#if !GTK_CHECK_VERSION(4, 0, 0) GdkSurface* pWindow = widget_get_surface(pParent); - m_pContext = gdk_window_create_gl_context(pWindow, nullptr); + m_pContext = surface_create_gl_context(pWindow); if (!m_pContext) return false; @@ -1751,7 +1747,6 @@ private: return false; gdk_gl_context_make_current(m_pContext); -#endif glGenFramebuffersEXT(1, &m_nFrameBuffer); glGenRenderbuffersEXT(1, &m_nRenderBuffer); glGenRenderbuffersEXT(1, &m_nDepthBuffer); -- cgit