[gtkmm] Gdk::Device, DeviceManager, Display: Add and deprecate



commit 82a8cebc89672e666df1e40dd2ded88f5e50408f
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue Dec 29 17:04:15 2015 +0100

    Gdk::Device, DeviceManager, Display: Add and deprecate
    
    gdk/src/device.[hg|ccg]: Deprecate grab() and ungrab(). Add get_seat().
    gdk/src/devicemanager.hg: Deprecate list_devices() and get_client_pointer().
    gdk/src/display.[hg|ccg]: Deprecate get_device_manager(). Add list_seats(),
    get_default_seat(), signal_seat_added() and signal_seat_removed().
    Bug #759806.

 gdk/src/device.ccg       |    5 +++++
 gdk/src/device.hg        |   17 ++++++++++++++---
 gdk/src/devicemanager.hg |   14 +++++++++-----
 gdk/src/display.ccg      |    1 +
 gdk/src/display.hg       |   18 ++++++++++++++++--
 5 files changed, 45 insertions(+), 10 deletions(-)
---
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 90eab66..fb5f51e 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -18,6 +18,7 @@
 #include <gdk/gdk.h>
 #include <gdkmm/cursor.h>
 #include <gdkmm/display.h>
+#include <gdkmm/seat.h>
 #include <gdkmm/window.h>
 
 namespace Gdk
@@ -71,10 +72,14 @@ Glib::RefPtr<const Window> Device::get_window_at_position() const
   return const_cast<Device*>(this)->get_window_at_position();
 }
 
+_DEPRECATE_IFDEF_START
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 GrabStatus Device::grab(const Glib::RefPtr<Window>& window, GrabOwnership grab_ownership, bool owner_events, 
EventMask event_mask, guint32 time_)
 {
   return static_cast<GrabStatus>(gdk_device_grab(gobj(), Glib::unwrap(window), 
static_cast<GdkGrabOwnership>(grab_ownership), static_cast<int>(owner_events), 
static_cast<GdkEventMask>(event_mask), nullptr, time_));
 }
+G_GNUC_END_IGNORE_DEPRECATIONS
+_DEPRECATE_IFDEF_END
 
 std::vector<std::string> Device::list_axes() const
 {
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index b4d974c..ef64dd8 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -39,6 +39,7 @@ _WRAP_ENUM(GrabOwnership, GdkGrabOwnership)
 _WRAP_ENUM(GrabStatus, GdkGrabStatus)
 
 class Display;
+class Seat;
 class Window;
 
 /** A Gdk::Device instance contains a detailed description of an extended input device.
@@ -104,13 +105,20 @@ public:
 
   _WRAP_METHOD(DeviceType get_device_type() const, gdk_device_get_device_type)
 
-  _WRAP_METHOD(GrabStatus grab(const Glib::RefPtr<Window>& window, GrabOwnership grab_ownership, bool 
owner_events, EventMask event_mask, const Glib::RefPtr<Cursor>& cursor, guint32 time_), gdk_device_grab)
+  _WRAP_METHOD(GrabStatus grab(const Glib::RefPtr<Window>& window, GrabOwnership grab_ownership,
+    bool owner_events, EventMask event_mask, const Glib::RefPtr<Cursor>& cursor, guint32 time_),
+    gdk_device_grab, deprecated "Use Gdk::Seat::grab() instead.")
 
+_DEPRECATE_IFDEF_START
   /** See the grab() method which takes more parameters.
+   *
+   * @deprecated Use Gdk::Seat::grab() instead.
    */
   GrabStatus grab(const Glib::RefPtr<Window>& window, GrabOwnership grab_ownership, bool owner_events, 
EventMask event_mask, guint32 time_);
+_DEPRECATE_IFDEF_END
 
-  _WRAP_METHOD(void ungrab(guint32 time_), gdk_device_ungrab)
+  _WRAP_METHOD(void ungrab(guint32 time_), gdk_device_ungrab,
+    deprecated "Use Gdk::Seat::ungrab() instead.")
   _WRAP_METHOD(void warp(const Glib::RefPtr<Screen>& screen, int x, int y), gdk_device_warp)
 
   /** Gets the current location of the device.
@@ -167,7 +175,7 @@ public:
   _WRAP_METHOD(Glib::RefPtr<const Window> get_window_at_position(int& win_x, int& win_y) const, 
gdk_device_get_window_at_position, refreturn, constversion)
 
   //TODO: Would this be ambiguous? Test it.
-  //_WRAP_METHOD(Glib::RefPtr<Window> get_window_at_position(double& win_x, double& win_y), 
gdk_device_get_window_at_position, refreturn)
+  //_WRAP_METHOD(Glib::RefPtr<Window> get_window_at_position(double& win_x, double& win_y), 
gdk_device_get_window_at_position_double, refreturn)
   //_WRAP_METHOD(Glib::RefPtr<const Window> get_window_at_position(double& win_x, double& win_y) const, 
gdk_device_get_window_at_position_double, refreturn, constversion)
 
   /** Obtains the window underneath the device.
@@ -202,6 +210,9 @@ public:
   _WRAP_METHOD(Glib::ustring get_vendor_id() const, gdk_device_get_vendor_id)
   _WRAP_METHOD(Glib::ustring get_product_id(), gdk_device_get_product_id)
 
+  _WRAP_METHOD(Glib::RefPtr<Seat> get_seat(), gdk_device_get_seat, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Seat> get_seat() const, gdk_device_get_seat, refreturn, constversion)
+
 };
 
 } // namespace Gdk
diff --git a/gdk/src/devicemanager.hg b/gdk/src/devicemanager.hg
index e27ab90..89080fe 100644
--- a/gdk/src/devicemanager.hg
+++ b/gdk/src/devicemanager.hg
@@ -118,14 +118,18 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_device_manager_get_display, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_device_manager_get_display, refreturn, 
constversion)
+
 #m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Device> >',`Glib::ListHandler<Glib::RefPtr<Device> 
::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
-  _WRAP_METHOD(std::vector< Glib::RefPtr<Device> > list_devices(DeviceType type), 
gdk_device_manager_list_devices)
+  _WRAP_METHOD(std::vector< Glib::RefPtr<Device> > list_devices(DeviceType type), 
gdk_device_manager_list_devices,
+    deprecated "Use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() 
instead.")
 #m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Device> >',`Glib::ListHandler<Glib::RefPtr<const 
Device> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
-  _WRAP_METHOD(std::vector< Glib::RefPtr<const Device> > list_devices(DeviceType type) const, 
gdk_device_manager_list_devices)
-
+  _WRAP_METHOD(std::vector< Glib::RefPtr<const Device> > list_devices(DeviceType type) const, 
gdk_device_manager_list_devices,
+    deprecated "Use Gdk::Seat::get_pointer(), Gdk::Seat::get_keyboard() and Gdk::Seat::get_slaves() 
instead.")
 
-  _WRAP_METHOD(Glib::RefPtr<Device> get_client_pointer(), gdk_device_manager_get_client_pointer, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Device> get_client_pointer() const, gdk_device_manager_get_client_pointer, 
refreturn, constversion)
+  _WRAP_METHOD(Glib::RefPtr<Device> get_client_pointer(), gdk_device_manager_get_client_pointer, refreturn,
+    deprecated "There is no replacement.")
+  _WRAP_METHOD(Glib::RefPtr<const Device> get_client_pointer() const, gdk_device_manager_get_client_pointer, 
refreturn, constversion,
+    deprecated "There is no replacement.")
 
   //TODO: Signals, properties.
 
diff --git a/gdk/src/display.ccg b/gdk/src/display.ccg
index 6cebffd..661707f 100644
--- a/gdk/src/display.ccg
+++ b/gdk/src/display.ccg
@@ -20,6 +20,7 @@
 
 #include <gdkmm/applaunchcontext.h>
 #include <gdkmm/devicemanager.h>
+#include <gdkmm/seat.h>
 #include <gdkmm/window.h>
 #include <gdk/gdk.h>
 
diff --git a/gdk/src/display.hg b/gdk/src/display.hg
index eccb674..a25a6d1 100644
--- a/gdk/src/display.hg
+++ b/gdk/src/display.hg
@@ -31,6 +31,7 @@ _CC_INCLUDE(gdk/gdk.h)
 
 class Device;
 class DeviceManager;
+class Seat;
 
  /** Gdk::Display object's purpose is two fold:
  *   To grab/ungrab keyboard focus and mouse pointer
@@ -145,20 +146,33 @@ public:
                deprecated "Compositing is an outdated technology that only ever worked on X11.")
   _WRAP_METHOD(void notify_startup_complete(const Glib::ustring& startup_id), 
gdk_display_notify_startup_complete)
 
-  _WRAP_METHOD(Glib::RefPtr<DeviceManager> get_device_manager(), gdk_display_get_device_manager, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const DeviceManager> get_device_manager() const, gdk_display_get_device_manager, 
refreturn, constversion)
+  _WRAP_METHOD(Glib::RefPtr<DeviceManager> get_device_manager(), gdk_display_get_device_manager, refreturn,
+    deprecated "Use get_default_seat() and Gdk::Seat operations.")
+  _WRAP_METHOD(Glib::RefPtr<const DeviceManager> get_device_manager() const, gdk_display_get_device_manager, 
refreturn, constversion,
+    deprecated "Use get_default_seat() and Gdk::Seat operations.")
 
 #m4 _CONVERSION(`GdkAppLaunchContext*',`Glib::RefPtr<AppLaunchContext>', `Glib::wrap($3)')
 #m4 _CONVERSION(`GdkAppLaunchContext*',`Glib::RefPtr<const AppLaunchContext>', `Glib::wrap($3)')
   _WRAP_METHOD(Glib::RefPtr<AppLaunchContext> get_app_launch_context(), gdk_display_get_app_launch_context, 
refreturn)
   _WRAP_METHOD(Glib::RefPtr<const AppLaunchContext> get_app_launch_context() const, 
gdk_display_get_app_launch_context, refreturn, constversion)
 
+  _WRAP_METHOD(Glib::RefPtr<Seat> get_default_seat(), gdk_display_get_default_seat, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Seat> get_default_seat() const, gdk_display_get_default_seat, refreturn, 
constversion)
+
+#m4 
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Seat>>',`Glib::ListHandler<Glib::RefPtr<Seat>>::list_to_vector($3,
 Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(std::vector<Glib::RefPtr<Seat>> list_seats(), gdk_display_list_seats)
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<const Seat>>',`Glib::ListHandler<Glib::RefPtr<const 
Seat>>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(std::vector<Glib::RefPtr<const Seat>> list_seats() const, gdk_display_list_seats)
 
   //We use no_default_handler because GdkDisplayClass is private.
 
   _WRAP_SIGNAL(void closed(bool is_error), closed, no_default_handler)
   _WRAP_SIGNAL(void opened(), opened, no_default_handler)
 
+#m4 _CONVERSION(`GdkSeat*',`const Glib::RefPtr<Seat>&', Glib::wrap($3, true))
+  _WRAP_SIGNAL(void seat_added(const Glib::RefPtr<Seat>& seat), "seat-added", no_default_handler)
+  _WRAP_SIGNAL(void seat_removed(const Glib::RefPtr<Seat>& seat), "seat-removed", no_default_handler)
+
   // There are no properties.
   // We don't wrap the vfuncs because GdkDisplayClass is private.
 };


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