summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-24 14:37:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-24 16:32:06 +0200
commit175a039fe70ab33fc1a68e21043b086b67d602e4 (patch)
treec4cadaa9d543b9a7b97f89b3e43acdfc07123483
parentgtk4: restore GtkFixed container for SalObjects (diff)
downloadcore-175a039fe70ab33fc1a68e21043b086b67d602e4.tar.gz
core-175a039fe70ab33fc1a68e21043b086b67d602e4.zip
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@redhat.com>
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx9
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx9
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);