[Libreoffice-commits] core.git: vcl/inc vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 24 14:32:50 UTC 2021


 vcl/inc/unx/gtk/gtkdata.hxx |    9 +++++++++
 vcl/unx/gtk3/gtkinst.cxx    |    9 ++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 175a039fe70ab33fc1a68e21043b086b67d602e4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 24 14:37:20 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 24 16:32:06 2021 +0200

    gtk4: make opengl slide transitions work again
    
    Change-Id: Id64d8759d1c98a973445f52ccfc5df9f0e084743
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116060
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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);


More information about the Libreoffice-commits mailing list