summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-24 10:59:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-24 12:56:18 +0200
commit8719c42ebab0b135b50d559830bfe2c2e0e8debb (patch)
tree0dd889a6f78d0c7d29af4c33f2f7b9c018ff6e07
parentgtk[3|4] wrap gtk_widget_get_window/gtk_native_get_surface (diff)
downloadcore-8719c42ebab0b135b50d559830bfe2c2e0e8debb.tar.gz
core-8719c42ebab0b135b50d559830bfe2c2e0e8debb.zip
gtk[3|4] wrap surface_create_similar_surface variants
Change-Id: Iaa101b1d691fa84693b350460a4c69a1f5aad245 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116045 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx12
-rw-r--r--vcl/unx/gtk3/gtkframe.cxx15
2 files changed, 16 insertions, 11 deletions
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 6203d10d4530..cf1454b6f589 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -133,6 +133,18 @@ inline void widget_set_cursor(GtkWidget *pWidget, GdkCursor *pCursor)
#endif
}
+inline cairo_surface_t * surface_create_similar_surface(GdkSurface *pSurface,
+ cairo_content_t eContent,
+ int nWidth,
+ int nHeight)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+ return gdk_surface_create_similar_surface(pSurface, eContent, nWidth, nHeight);
+#else
+ return gdk_window_create_similar_surface(pSurface, eContent, nWidth, nHeight);
+#endif
+}
+
#if GTK_CHECK_VERSION(4, 0, 0)
typedef double gtk_coord;
#else
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 9c79efbf738c..40add0ea7f10 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -1716,17 +1716,10 @@ void GtkSalFrame::AllocateFrame()
if (m_pSurface)
cairo_surface_destroy(m_pSurface);
-#if !GTK_CHECK_VERSION(4, 0, 0)
- m_pSurface = gdk_window_create_similar_surface(widget_get_surface(m_pWindow),
- CAIRO_CONTENT_COLOR_ALPHA,
- aFrameSize.getX(),
- aFrameSize.getY());
-#else
- m_pSurface = gdk_surface_create_similar_surface(widget_get_surface(m_pWindow),
- CAIRO_CONTENT_COLOR_ALPHA,
- aFrameSize.getX(),
- aFrameSize.getY());
-#endif
+ m_pSurface = surface_create_similar_surface(widget_get_surface(m_pWindow),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ aFrameSize.getX(),
+ aFrameSize.getY());
m_aFrameSize = aFrameSize;
cairo_surface_set_user_data(m_pSurface, SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr);