[gtkmm] Gdk::Device: Ignore deprecation of gdk_device_get_device_tool()



commit ced0c907b1e9aead8f1fa7615f8adf8dad605c6d
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Feb 1 09:04:43 2022 +0100

    Gdk::Device: Ignore deprecation of gdk_device_get_device_tool()

 gdk/src/device.ccg | 16 ++++++++++++++++
 gdk/src/device.hg  | 10 ++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 0517c911..5b27d09f 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -39,6 +39,22 @@ Glib::RefPtr<const Surface> Device::get_surface_at_position() const
   return const_cast<Device*>(this)->get_surface_at_position();
 }
 
+//TODO: Has gdk_device_get_device_tool() been deprecated by mistake?
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+Glib::RefPtr<DeviceTool> Device::get_device_tool()
+{
+  auto retvalue = Glib::wrap(gdk_device_get_device_tool(gobj()));
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
+}
+
+Glib::RefPtr<const DeviceTool> Device::get_device_tool() const
+{
+  return const_cast<Device*>(this)->get_device_tool();
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
 // Custom wrap_new() because we want to create a DeviceWithPad, if the underlying
 // C class implements the GdkDevicePad interface.
 Glib::ObjectBase* Device_Class::wrap_new(GObject* object)
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index 4b3289ca..2b74facc 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -84,8 +84,14 @@ public:
   _WRAP_METHOD(Glib::RefPtr<const Seat> get_seat() const, gdk_device_get_seat, refreturn, constversion)
 
   _WRAP_METHOD(guint get_num_touches() const, gdk_device_get_num_touches)
-  _WRAP_METHOD(Glib::RefPtr<DeviceTool> get_device_tool(), gdk_device_get_device_tool, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const DeviceTool> get_device_tool() const, gdk_device_get_device_tool, 
refreturn, constversion)
+
+  //TODO: Has gdk_device_get_device_tool() been deprecated by mistake?
+  //_WRAP_METHOD(Glib::RefPtr<DeviceTool> get_device_tool(), gdk_device_get_device_tool, refreturn)
+  //_WRAP_METHOD(Glib::RefPtr<const DeviceTool> get_device_tool() const, gdk_device_get_device_tool, 
refreturn, constversion)
+  _WRAP_METHOD_DOCS_ONLY(gdk_device_get_device_tool)
+  Glib::RefPtr<DeviceTool> get_device_tool();
+  _WRAP_METHOD_DOCS_ONLY(gdk_device_get_device_tool)
+  Glib::RefPtr<const DeviceTool> get_device_tool() const;
 
   _WRAP_METHOD(bool get_caps_lock_state() const, gdk_device_get_caps_lock_state)
   _WRAP_METHOD(bool get_num_lock_state() const, gdk_device_get_num_lock_state)


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