[gtkmm/gtkmm-4-2] Gdk::GLContext: Ignore deprecation of gdk_gl_context_get_shared_context()



commit caf64fbc80d8895df55d46931a541f1892cb565a
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Thu Jul 29 12:07:53 2021 +0200

    Gdk::GLContext: Ignore deprecation of gdk_gl_context_get_shared_context()
    
    It's deprecated in gtk >= 4.3.2.

 gdk/src/glcontext.ccg | 14 ++++++++++++++
 gdk/src/glcontext.hg  |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gdk/src/glcontext.ccg b/gdk/src/glcontext.ccg
index d4202796..c7a03321 100644
--- a/gdk/src/glcontext.ccg
+++ b/gdk/src/glcontext.ccg
@@ -20,6 +20,20 @@
 
 namespace Gdk
 {
+// We hand-code get_shared_context().
+// gdk_gl_context_get_shared_context()is deprecated in gtk >= 4.3.2.
+// Make it possible to build this version of gtkmm with a new gtk without
+// a deprecation warning.
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+Glib::RefPtr<GLContext> GLContext::get_shared_context()
+{
+  auto retvalue = Glib::wrap(gdk_gl_context_get_shared_context(gobj()));
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
 void GLContext::unset_use_es()
 {
   gdk_gl_context_set_use_es(gobj(), -1);
diff --git a/gdk/src/glcontext.hg b/gdk/src/glcontext.hg
index 13ecabfc..cfeddebd 100644
--- a/gdk/src/glcontext.hg
+++ b/gdk/src/glcontext.hg
@@ -46,7 +46,8 @@ public:
   _WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_gl_context_get_display, refreturn, 
constversion, newin "3,18")
   _WRAP_METHOD(Glib::RefPtr<Surface> get_surface(), gdk_gl_context_get_surface, refreturn, newin "3,18")
   _WRAP_METHOD(Glib::RefPtr<const Surface> get_surface() const, gdk_gl_context_get_surface, refreturn, 
constversion, newin "3,18")
-  _WRAP_METHOD(Glib::RefPtr<GLContext> get_shared_context(), gdk_gl_context_get_shared_context, refreturn, 
newin "3,18")
+  _WRAP_METHOD_DOCS_ONLY(gdk_gl_context_get_shared_context, newin "3,18")
+  Glib::RefPtr<GLContext> get_shared_context();
   _WRAP_METHOD(Glib::RefPtr<const GLContext> get_shared_context() const, gdk_gl_context_get_shared_context, 
refreturn, constversion, newin "3,18")
   _WRAP_METHOD(void get_version(int& major, int& minor) const, gdk_gl_context_get_version, newin "3,18")
   _WRAP_METHOD(bool is_legacy() const, gdk_gl_context_is_legacy)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]