[gtkmm] Gdk::Display, Seat, Window: Use Gdk::Event instead of GdkEvent



commit 29b183f073ad6fdf96f1ecdd9e43580fc76356b9
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon May 29 16:52:32 2017 +0200

    Gdk::Display, Seat, Window: Use Gdk::Event instead of GdkEvent
    
    Bug 135978

 gdk/src/display.hg      |   10 +++++-----
 gdk/src/seat.hg         |    3 ++-
 gdk/src/window.hg       |    4 ++--
 tools/m4/convert_gdk.m4 |    5 ++++-
 4 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/gdk/src/display.hg b/gdk/src/display.hg
index d56a7e5..eebd776 100644
--- a/gdk/src/display.hg
+++ b/gdk/src/display.hg
@@ -21,6 +21,8 @@
 #include <gdkmm/screen.h>
 #include <gdkmm/applaunchcontext.h>
 #include <gdkmm/types.h> //For ModifierType
+#include <gdkmm/event.h>
+
 _DEFS(gdkmm,gdk)
 _PINCLUDE(glibmm/private/object_p.h)
 
@@ -66,13 +68,11 @@ public:
   _WRAP_METHOD(bool is_composited() const, gdk_display_is_composited)
   _WRAP_METHOD(bool is_rgba() const, gdk_display_is_rgba)
 
-  //TODO: Use C++ Gdk::Event:
   // get_event() removes the next event, if there is one - therefore there is no const version:
-  _WRAP_METHOD(GdkEvent* get_event(), gdk_display_get_event)
+  _WRAP_METHOD(Event get_event(), gdk_display_get_event)
 
-  _WRAP_METHOD(GdkEvent* peek_event(), gdk_display_peek_event)
-  _WRAP_METHOD(GdkEvent* peek_event() const, gdk_display_peek_event, constversion)
-  _WRAP_METHOD(void put_event(GdkEvent* event), gdk_display_put_event)
+  _WRAP_METHOD(Event peek_event() const, gdk_display_peek_event)
+  _WRAP_METHOD(void put_event(const Event& event), gdk_display_put_event)
   _WRAP_METHOD(bool has_pending() const, gdk_display_has_pending)
 
   // Applications should not set these, they are global user-configured settings.
diff --git a/gdk/src/seat.hg b/gdk/src/seat.hg
index db9185f..f8df074 100644
--- a/gdk/src/seat.hg
+++ b/gdk/src/seat.hg
@@ -18,6 +18,7 @@
 #include <glibmm/object.h>
 #include <gdkmm/cursor.h>
 #include <gdkmm/device.h>
+#include <gdkmm/event.h>
 
 _DEFS(gdkmm,gdk)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -59,7 +60,7 @@ public:
                Capabilities capabilities,
                bool owner_events,
                const Glib::RefPtr<Cursor>& cursor = Glib::RefPtr<Cursor>(),
-               const GdkEvent* event = nullptr,
+               const Event& event = Event(),
                const SlotGrabPrepare& slot = SlotGrabPrepare()),
                gdk_seat_grab, slot_name slot, slot_callback Seat_grab_callback, no_slot_copy)
 
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index 0b383ae..d6ac540 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -23,6 +23,7 @@ _CONFIGINCLUDE(gdkmmconfig.h)
 #include <cairomm/region.h>
 #include <cairomm/pattern.h>
 #include <gdkmm/device.h>
+#include <gdkmm/event.h>
 #include <gdkmm/visual.h>
 #include <gdkmm/rgba.h>
 #include <cairomm/context.h>
@@ -344,8 +345,7 @@ public:
 
   _WRAP_METHOD(void set_shadow_width(int left, int right, int top, int bottom), gdk_window_set_shadow_width)
 
-  //TODO: Use Gdk::Event when we use it elsewhere - See also, for instance, Gdk::Display::put_event().
-  _WRAP_METHOD(bool show_window_menu(GdkEvent* event), gdk_window_show_window_menu)
+  _WRAP_METHOD(bool show_window_menu(Event& event), gdk_window_show_window_menu)
 
   /** Creates a new GLContext matching the framebuffer format to the visual of the
    * Window. The context is disconnected from any particular window or surface.
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index 5e39b11..61bb9fe 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -278,7 +278,6 @@ _CONVERSION(`const char*const*',`const char**',`const_cast<const char**>($3)',`$
 
 
 _CONVERSION(GdkFont*, Gdk::Font, `Gdk::Font($3)')
-_CONVERSION(GdkEvent*, Event, `Event($3)')
 
 _CONVERSION(`GdkTimeCoord**&',`GdkTimeCoord***',`&($3)')
 
@@ -297,6 +296,10 @@ _CONVERSION(`Gdk::NativeWindow',`GdkNativeWindow',`static_cast<$2>($3)')
 _CONVERSION(`NativeWindow',`GdkNativeWindow',`static_cast<$2>($3)')
 _CONVERSION(`GdkEvent*',`const GdkEvent*',`($3)')
 
+dnl GdkEvent
+_CONVERSION(`GdkEvent*',`Event',`Event($3)')
+_CONVERSION(`Event&',`GdkEvent*',`($3).gobj()')
+_CONVERSION(`const Event&',`const GdkEvent*',`($3).gobj()')
 
 _CONVERSION(`GdkDragContext*',`Glib::RefPtr<DragContext>',Glib::wrap($3, true))
 _CONVERSION(`GdkDragContext*',`Glib::RefPtr<Gdk::DragContext>',Glib::wrap($3, true))


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