[gtkmm] Gdk::Event: Implement a class hierarchy representing different GdkEvent* types



commit 346905f426d0486c91ec9cfe94033f92f8e71efb
Author: Mark Vender <markv743 yahoo co uk>
Date:   Wed May 24 16:08:50 2017 +0200

    Gdk::Event: Implement a class hierarchy representing different GdkEvent* types
    
    * .gitignore: Add gdk/gdkmm/enums.[h|cc].
    * gdk/src/event.[hg|ccg]: Implement a hierarchy representing different
    GdkEvent* types. Remove some functions within Gdk::Event in favor of
    similar functions within subclasses.
    * gdk/src/enums.[hg|ccg]: New files. Move the definitions of event-related enums
    here. Add definitions of new enums. Required to remove dependencies between
    other headers.
    * gdk/src/device.hg: Include enums.h instead of event.h.
    * gdk/src/filelist.am: Add enums.hg.
    * tools/m4/class_gdkevent.m4: New file. Add a generator of boilerplate code for
    Gdk::Event and subclasses. Using existing m4 scripts is not possible,
    because the subclasses share the same gobject_ within Gdk::Event.
    * tools/m4/convert_gdk.m4: Add missing enum conversions.
    * tools/m4/filelist.am: Add class_gdkevent.m4.
    
    Note that existing API doesn't allow to wrap GdkEvent statically (i.e. not
    through a pointer), because allocation, copying and destruction must be done
    using gdk_event_[new|copy|free]() functions.
    
    This is a modified version of Mark Vender's patch in bug 135978. It has been
    modified to be applicable to gtkmm 4.

 .gitignore                 |    2 +
 gdk/src/device.hg          |    2 +-
 gdk/src/enums.ccg          |   15 +
 gdk/src/enums.hg           |   35 ++
 gdk/src/event.ccg          |   57 +++-
 gdk/src/event.hg           |  839 +++++++++++++++++++++++++++++++++++++++++++-
 gdk/src/filelist.am        |    1 +
 tools/m4/class_gdkevent.m4 |  273 ++++++++++++++
 tools/m4/convert_gdk.m4    |    8 +-
 tools/m4/convert_gtkmm.m4  |    1 +
 tools/m4/filelist.am       |    1 +
 11 files changed, 1208 insertions(+), 26 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 92f0531..df2f506 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,6 +66,8 @@ gdk/gdkmm/drawcontext.cc
 gdk/gdkmm/drawcontext.h
 gdk/gdkmm/drawingcontext.cc
 gdk/gdkmm/drawingcontext.h
+gdk/gdkmm/enums.cc
+gdk/gdkmm/enums.h
 gdk/gdkmm/event.cc
 gdk/gdkmm/event.h
 gdk/gdkmm/glcontext.cc
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index e8047de..bd20249 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -19,7 +19,7 @@
 
 //#include <gdkmm/window.h>
 #include <gdkmm/cursor.h>
-#include <gdkmm/event.h>
+#include <gdkmm/enums.h>
 #include <gdkmm/timecoord.h>
 #include <gdk/gdk.h>
 
diff --git a/gdk/src/enums.ccg b/gdk/src/enums.ccg
new file mode 100644
index 0000000..1ce152f
--- /dev/null
+++ b/gdk/src/enums.ccg
@@ -0,0 +1,15 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/gdk/src/enums.hg b/gdk/src/enums.hg
new file mode 100644
index 0000000..278a64e
--- /dev/null
+++ b/gdk/src/enums.hg
@@ -0,0 +1,35 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gdk/gdk.h>
+
+_DEFS(gdkmm,gdk)
+
+namespace Gdk
+{
+_WRAP_ENUM(AxisFlags, GdkAxisFlags)
+_WRAP_ENUM(AxisUse, GdkAxisUse)
+_WRAP_ENUM(CrossingMode, GdkCrossingMode)
+//_WRAP_ENUM(FilterReturn, GdkFilterReturn)
+_WRAP_ENUM(NotifyType, GdkNotifyType)
+_WRAP_ENUM(OwnerChange, GdkOwnerChange)
+_WRAP_ENUM(PropertyState, GdkPropertyState)
+_WRAP_ENUM(ScrollDirection, GdkScrollDirection)
+_WRAP_ENUM(SettingAction, GdkSettingAction)
+// GdkEventVisibility is deprecated and not wrapped in gtkmm.
+//_WRAP_ENUM(VisibilityState, GdkVisibilityState)
+
+} //namespace Gdk
diff --git a/gdk/src/event.ccg b/gdk/src/event.ccg
index 03eeb2e..6e551b7 100644
--- a/gdk/src/event.ccg
+++ b/gdk/src/event.ccg
@@ -1,9 +1,4 @@
-// -*- c++ -*-
-/* $Id: event.ccg,v 1.2 2004/02/10 17:29:54 mxpxpod Exp $ */
-
-/*
- *
- * Copyright 1998-2002 The gtkmm Development Team
+/* Copyright 1998-2002 The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,10 +15,54 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <gdkmm/display.h>
-
 namespace Gdk
 {
+  bool Event::is_send_event() const
+  {
+    return gobj()->any.send_event;
+  }
 
-} //namespace Gdk
+  bool EventButton::get_axis(Gdk::AxisUse axis_use, double& value) const
+  {
+    return gdk_event_get_axis(Event::gobj(), static_cast<GdkAxisUse>(axis_use),
+                              &value);
+  }
+
+  bool EventMotion::get_axis(Gdk::AxisUse axis_use, double& value) const
+  {
+    return gdk_event_get_axis(Event::gobj(), static_cast<GdkAxisUse>(axis_use),
+                              &value);
+  }
+
+  bool EventTouch::get_axis(Gdk::AxisUse axis_use, double& value) const
+  {
+    return gdk_event_get_axis(Event::gobj(), static_cast<GdkAxisUse>(axis_use),
+                              &value);
+  }
 
+  bool EventSelection::has_requestor() const
+  {
+    return gobj()->requestor != nullptr;
+  }
+
+  bool EventOwnerChange::has_owner() const
+  {
+    return gobj()->owner != nullptr;
+  }
+
+  bool EventGrabBroken::is_keyboard() const
+  {
+    return gobj()->keyboard;
+  }
+
+  bool EventGrabBroken::is_implicit() const
+  {
+    return gobj()->implicit;
+  }
+
+  bool EventGrabBroken::has_grab_window() const
+  {
+    return gobj()->grab_window != nullptr;
+  }
+
+} //namespace Gdk
diff --git a/gdk/src/event.hg b/gdk/src/event.hg
index f89f7b1..8989eb3 100644
--- a/gdk/src/event.hg
+++ b/gdk/src/event.hg
@@ -18,8 +18,12 @@
 _DEFS(gdkmm,gdk)
 _CC_INCLUDE(gdk/gdk.h)
 
+#include <glibmm/refptr.h>
 #include <gdkmm/types.h>
+#include <gdkmm/enums.h>
+#include <gdkmm/device.h>
 #include <gdkmm/screen.h>
+#include <gdkmm/window.h>
 
 /* Shadow DELETE macro (from winnt.h).
  */
@@ -35,18 +39,19 @@ enum { DELETE = GTKMM_MACRO_DEFINITION_DELETE };
 extern "C" { typedef union _GdkEvent GdkEvent; }
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
-
 namespace Gdk
 {
 
-_WRAP_ENUM(AxisUse, GdkAxisUse)
-_WRAP_ENUM(AxisFlags, GdkAxisFlags)
+/** Representing an event sequence.
+ * Used to differentiate between multiple touches on multitouch touchscreens.
+ */
+struct EventSequence;
 
-//TODO: Actually use this class instead of GdkEvent?
+/** Represents an event.
+ */
 class Event
 {
-  _CLASS_BOXEDTYPE(Event, GdkEvent, NONE, gdk_event_copy, gdk_event_free)
-  _CUSTOM_STRUCT_PROTOTYPE
+  _CLASS_GDKEVENT(Event, GdkEvent)
   _IGNORE(gdk_event_copy, gdk_event_free)
 public:
 
@@ -57,17 +62,21 @@ public:
     s#^3BUTTON_PRESS#TRIPLE_BUTTON_PRESS#
   )
 
-  _WRAP_METHOD(static Event get(), gdk_event_get)
-  _WRAP_METHOD(static Event peek(), gdk_event_peek)
-  _WRAP_METHOD(void put(), gdk_event_put)
+  /**
+   * Returns the type of the event
+   */
+  _MEMBER_GET(event_type, type, Event::Type, GdkEventType)
 
-  _WRAP_METHOD(static bool events_pending(), gdk_events_pending)
+  /**
+   * Returns the window which received the event
+   */
+  _MEMBER_GET_GOBJECT(window, any.window, Gdk::Window, GdkWindow*)
+
+  /**
+   * Returns @c true if the event was sent explicitly (e.g. using @c XSendEvent)
+   */
+  bool is_send_event() const;
 
-  _WRAP_METHOD(guint32 get_time() const, gdk_event_get_time)
-  _WRAP_METHOD(bool get_state(ModifierType& state) const, gdk_event_get_state)
-  _WRAP_METHOD(bool get_coords(double& x_win, double& y_win) const, gdk_event_get_coords)
-  _WRAP_METHOD(bool get_root_coords(double& x_root, double& y_root) const, gdk_event_get_root_coords)
-  _WRAP_METHOD(bool get_axis(AxisUse axis_use, double& value) const, gdk_event_get_axis)
   //_WRAP_METHOD(void  gdk_event_handler_set(GdkEventFunc func, gpointer data, GDestroyNotify  notify), 
gdk_event_handler_set)
 
   _WRAP_METHOD(static void set_show_events(bool show_events), gdk_set_show_events)
@@ -76,6 +85,806 @@ public:
   _IGNORE(gdk_event_set_screen) //deprecated
   _WRAP_METHOD(Glib::RefPtr<Screen> get_screen(), gdk_event_get_screen, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Screen> get_screen() const, gdk_event_get_screen, refreturn, constversion)
+
+  _WRAP_METHOD(static Event get(), gdk_event_get)
+  _WRAP_METHOD(static Event peek(), gdk_event_peek)
+  _WRAP_METHOD(void put(), gdk_event_put)
+  _WRAP_METHOD(static bool events_pending(), gdk_events_pending)
+};
+
+/** Generated when a key is pressed or released.
+ */
+class EventKey : public Event
+{
+  _CLASS_GDKEVENT(EventKey, GdkEventKey)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the key that was pressed or released. See the <gdk/gdkkeysyms.h>
+   * header file for a complete list of GDK key codes.
+   */
+  _MEMBER_GET(keyval, keyval, guint, guint)
+
+  /**
+   * Returns the raw code of the key that was pressed or released.
+   */
+  _MEMBER_GET(hardware_keycode, hardware_keycode, guint16, guint16)
+
+  /**
+   * Returns the keyboard group
+   */
+  _MEMBER_GET(group, group, guint8, guint8)
+
+  /**
+   * Returns @c true if the hardware keycode is mapped to a modifier key
+   */
+  _MEMBER_GET(is_modifier, is_modifier, bool, guint)
+};
+
+/** Represents a mouse button press or release event.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::BUTTON_PRESS,
+ * Gdk::Event::Type::DOUBLE_BUTTON_PRESS, Gdk::Event::Type::TRIPLE_BUTTON_PRESS
+ * or Gdk::Event::Type::BUTTON_RELEASE.
+ *
+ * Double and triple-clicks result in a sequence of events being received. For
+ * double-clicks the order of events will be:
+ *
+ * @code
+ * Gdk::Event::Type::BUTTON_PRESS
+ * Gdk::Event::Type::BUTTON_RELEASE
+ * Gdk::Event::Type::BUTTON_PRESS
+ * Gdk::Event::Type::DOUBLE_BUTTON_PRESS
+ * Gdk::Event::Type::BUTTON_RELEASE
+ * @endcode
+ *
+ * Note that the first click is received just like a normal button press, while
+ * the second click results in a Gdk::Event::Type::DOUBLE_BUTTON_PRESS being
+ * received just after the Gdk::Event::Type::BUTTON_PRESS.
+ *
+ * Triple-clicks are very similar to double-clicks, except that
+ * Gdk::Event::Type::TRIPLE_BUTTON_PRESS is inserted after the third click.
+ * The order of the events is:
+ *
+ * @code
+ * Gdk::Event::Type::BUTTON_PRESS
+ * Gdk::Event::Type::BUTTON_RELEASE
+ * Gdk::Event::Type::BUTTON_PRESS
+ * Gdk::Event::Type::DOUBLE_BUTTON_PRESS
+ * Gdk::Event::Type::BUTTON_RELEASE
+ * Gdk::Event::Type::BUTTON_PRESS
+ * Gdk::Event::Type::TRIPLE_BUTTON_PRESS
+ * Gdk::Event::Type::BUTTON_RELEASE
+ * @endcode
+ *
+ * For a double click to occur, the second button press must occur within 1/4 of
+ * a second of the first. For a triple click to occur, the third button press
+ * must also occur within 1/2 second of the first button press.
+ */
+class EventButton : public Event
+{
+  _CLASS_GDKEVENT(EventButton, GdkEventButton)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(x, x, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(y, y, double, gdouble)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  _WRAP_METHOD_DOCS_ONLY(gdk_event_get_axis)
+  bool get_axis(Gdk::AxisUse axis_use, double& value) const;
+
+  /**
+   * Returns the number of the button which was pressed or released, numbered
+   * from 1 to 5. Normally button 1 is the left mouse button, 2 is the middle
+   * button, and 3 is the right button. On 2-button mice, the middle button can
+   * often be simulated by pressing both mouse buttons together
+   */
+  _MEMBER_GET(button, button, guint, guint)
+
+  /**
+   * Returns the device where the event originated from.
+   */
+  _MEMBER_GET_GOBJECT(device, device, Gdk::Device, GdkDevice*)
+};
+
+/** Generated when the mouse is scrolled.
+ *
+ * These events are from button presses for the buttons 4 to 7. Wheel mice are
+ * usually configured to generate button press events for buttons 4 and 5 when
+ * the wheel is turned.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::SCROLL.
+ *
+ * Some GDK backends can also generate 'smooth' scroll events, which can be
+ * recognized by the Gdk::ScrollDirection::SMOOTH scroll direction. For these,
+ * scroll deltas can be obtained with @c get_delta_x() and @c get_delta_y.
+ */
+class EventScroll : public Event
+{
+  _CLASS_GDKEVENT(EventScroll, GdkEventScroll)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(x, x, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(y, y, double, gdouble)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  /**
+   * Returns the scroll delta in the X axis. Meaningful only if @c direction()
+   * returns @c Gdk::SCROLL_SMOOTH
+   */
+  _MEMBER_GET(delta_x, delta_x, double, gdouble)
+
+  /**
+   * Returns the scroll delta in the Y axis. Meaningful only if @c direction()
+   * returns @c Gdk::SCROLL_SMOOTH
+   */
+  _MEMBER_GET(delta_y, delta_y, double, gdouble)
+
+  /**
+   * Returns the direction of the scroll.
+   */
+  _MEMBER_GET(direction, direction, ScrollDirection, GdkScrollDirection)
+
+  /**
+   * Returns the device where the event originated from.
+   */
+  _MEMBER_GET_GOBJECT(device, device, Gdk::Device, GdkDevice*)
+};
+
+/** Generated when a mouse pointer is moved.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::MOTION_NOTIFY.
+ */
+class EventMotion : public Event
+{
+  _CLASS_GDKEVENT(EventMotion, GdkEventMotion)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(x, x, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(y, y, double, gdouble)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  _WRAP_METHOD_DOCS_ONLY(gdk_event_get_axis)
+  bool get_axis(Gdk::AxisUse axis_use, double& value) const;
+
+#m4 _CONVERSION(`gint16',`bool',`$3')
+  /**
+   * Returns @c true if the event is motion hint.
+   *
+   * Motion hints are received only if @c Gdk::EventMask::POINTER_MOTION_HINT_MASK is set.
+   * It is used to reduce the number of @c Gdk::Event::Type::MOTION_NOTIFY events received.
+   * Normally a @c Gdk::Event::Type::MOTION_NOTIFY event is received each time the mouse
+   * moves. However, if the application spends a lot of time processing the
+   * event (updating the display, for example), it can lag behind the position
+   * of the mouse. When using @c Gdk::EventMask::POINTER_MOTION_HINT_MASK, fewer
+   * @c Gdk::Event::Type::MOTION_NOTIFY events will be sent, some of which are marked as a
+   * hint To receive more motion events after a motion hint event, the
+   * application needs to asks for more, by calling @c request_motions().
+   */
+  _MEMBER_GET(is_hint, is_hint, bool, gint16)
+
+  _WRAP_METHOD(void request_motions(), gdk_event_request_motions)
+
+  /**
+   * Returns the device where the event originated from.
+   */
+  _MEMBER_GET_GOBJECT(device, device, Gdk::Device, GdkDevice*)
+};
+
+/** Generated during an attached touchscreen is touched.
+ *
+ * @c get_event_type() will return one of Gdk::Event::Type::TOUCH_BEGIN,
+ * Gdk::Event::Type::TOUCH_UPDATE, Gdk::Event::Type::TOUCH_END or
+ * Gdk::Event::Type::TOUCH_CANCEL.
+ *
+ * Touch events are grouped into sequences by means of the sequence field, which
+ * can also be obtained with @c get_event_sequence(). Each sequence
+ * begins with a Gdk::Event::Type::TOUCH_BEGIN event, followed by any number of
+ * Gdk::Event::Type::TOUCH_UPDATE events, and ends with a Gdk::Event::Type::TOUCH_END
+ * (or Gdk::Event::Type::TOUCH_CANCEL) event. With multitouch devices, there may
+ * be several active sequences at the same time.
+ */
+class EventTouch : public Event
+{
+  _CLASS_GDKEVENT(EventTouch, GdkEventTouch)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(x, x, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(y, y, double, gdouble)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  _WRAP_METHOD_DOCS_ONLY(gdk_event_get_axis)
+  bool get_axis(Gdk::AxisUse axis_use, double& value) const;
+
+#m4 _CONVERSION(`const GdkEventSequence*',`const Gdk::EventSequence*',`reinterpret_cast<$2>($3)')
+  /**
+   * Returns the event sequence that the event belongs to
+   */
+  _MEMBER_GET(event_sequence, sequence, const Gdk::EventSequence*, const GdkEventSequence*)
+
+  /**
+   * Returns @c true if the event should be used for emulating pointer event
+   */
+  _MEMBER_GET(is_emulating_pointer, emulating_pointer, bool, gboolean)
+
+  /**
+   * Returns the device where the event originated from.
+   */
+  _MEMBER_GET_GOBJECT(device, device, Gdk::Device, GdkDevice*)
+};
+
+/** Generated when the mouse pointer leaves or enters the window.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::LEAVE_NOTIFY or
+ * @c Gdk::Event::Type::ENTER_NOTIFY.
+ */
+class EventCrossing : public Event
+{
+  _CLASS_GDKEVENT(EventCrossing, GdkEventCrossing)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the window that was entered or left
+   */
+  _MEMBER_GET_GOBJECT(subwindow, subwindow, Gdk::Window, GdkWindow*)
+
+  /**
+   * Returns a bit mask representing the state of the modifier keys (e.g.
+   * Control, Shift and Alt) and the pointer buttons.
+   */
+  _MEMBER_GET(state, state, ModifierType, GdkModifierType)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(x, x, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the window.
+   */
+  _MEMBER_GET(y, y, double, gdouble)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  /*** Returns the crossing mode.
+   * @c Gdk::CrossingMode::GTK_GRAB, Gdk::CrossingMode::GTK_UNGRAB, and
+   * Gdk::CrossingMode::STATE_CHANGED are always synthesized, never native.
+   */
+  _MEMBER_GET(mode, mode, Gdk::CrossingMode, GdkCrossingMode)
+
+  /**
+   * Returns the kind of crossing that has been made
+   */
+  _MEMBER_GET(detail, detail, Gdk::NotifyType, GdkNotifyType)
+
+  /**
+   * Returns @c true if the window was the focus window, @c false otherwise
+   */
+  _MEMBER_GET(focus, focus, bool, gboolean)
+};
+
+/** Generated when all or part of a window becomes visible and needs to be
+ * redrawn.
+ *
+ * @c get_event_type() will return one of Gdk::Event::Type::EXPOSE, Gdk::Event::Type::DAMAGE.
+ */
+class EventExpose : public Event
+{
+  _CLASS_GDKEVENT(EventExpose, GdkEventExpose)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+#m4 _CONVERSION(`GdkRectangle',`const Gdk::Rectangle&',`Glib::wrap(&$3)')
+  /**
+   * Returns the bounding box of the region to be redrawn
+   */
+  _MEMBER_GET(area, area, const Gdk::Rectangle&, GdkRectangle)
+
+#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr<const 
::Cairo::Region>',`::Cairo::RefPtr<::Cairo::Region>(new ::Cairo::Region($3, false /* take ref */))')
+  /**
+   * Returns the region to be redrawn
+   */
+  _MEMBER_GET(region, region, ::Cairo::RefPtr<const ::Cairo::Region>, cairo_region_t*);
+
+  /**
+   * Returns the number of contiguous Gdk::Event::Type::EXPOSE events following this one.
+   * The only use for this is "exposure compression", i.e. handling all contiguous
+   * Gdk::Event::Type::EXPOSE events in one go, though GDK performs some exposure
+   * compression so this is not normally needed.
+   */
+  _MEMBER_GET(count, count, int, gint)
+};
+
+// GdkEventVisibility is deprecated. It's not used in gtk+ 4.
+/* Generated when the visibility status of a window changes.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::VISIBILITY_NOTIFY.
+ */
+//class EventVisibility : public Event
+//{
+//  _CLASS_GDKEVENT(EventVisibility, GdkEventVisibility)
+//  _GDKEVENT_INHERITS(Event, GdkEvent)
+//public:
+  /* The new visibility state
+   */
+//  _MEMBER_GET(state, state, Gdk::VisibilityState, GdkVisibilityState)
+//};
+
+/** Generated when the keyboard focus changes.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::FOCUS_CHANGE.
+ */
+class EventFocus : public Event
+{
+  _CLASS_GDKEVENT(EventFocus, GdkEventFocus)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * @c true if the window gained focus, @c false if lost
+   */
+  _MEMBER_GET(focus, in, bool, gint16)
+};
+
+/** Generated when the position or size of a window changes.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::CONFIGURE.
+ */
+class EventConfigure : public Event
+{
+  _CLASS_GDKEVENT(EventConfigure, GdkEventConfigure)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the new X coordinate of the window, relative to its parent
+   */
+  _MEMBER_GET(x, x, int, gint)
+
+  /**
+   * Returns the new Y coordinate of the window, relative to its parent
+   */
+  _MEMBER_GET(y, y, int, gint)
+
+  /**
+   * Returns the new width of the window
+   */
+  _MEMBER_GET(width, width, int, gint)
+
+  /**
+   * Returns the new height of the window
+   */
+  _MEMBER_GET(height, height, int, gint)
+
+  /**
+   * Convenience method to access all position and size information at once
+   */
+  Gdk::Rectangle get_rect() const;
+};
+
+/** Rarely used event. Generated when a property of a window changes.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::PROPERTY_NOTIFY.
+ */
+class EventProperty : public Event
+{
+  _CLASS_GDKEVENT(EventProperty, GdkEventProperty)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the atom indicating the property that was changed
+   */
+  _MEMBER_GET(atom, atom, GdkAtom, GdkAtom)
+
+  /**
+   * Identifies whether the property was changed (Gdk::PropertyState::NEW_VALUE) or
+   * deleted (Gdk::PropertyState::DELETE).
+   */
+  _MEMBER_GET(state, state, Gdk::PropertyState, GdkPropertyState)
+};
+
+/** Rarely used event. Generated when a selection is requested or ownership of a
+ * selection is taken over by another client application.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::SELECTION_CLEAR,
+ * @c Gdk::Event::Type::SELECTION_NOTIFY or @c Gdk::Event::Type::SELECTION_REQUEST).
+ */
+class EventSelection : public Event
+{
+  _CLASS_GDKEVENT(EventSelection, GdkEventSelection)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the atom identifying the selection
+   */
+  _MEMBER_GET(selection, selection, GdkAtom, GdkAtom)
+
+  /**
+   * Returns the atom identifying the target to which the selection should be
+   * converted
+   */
+  _MEMBER_GET(target, target, GdkAtom, GdkAtom)
+
+  /**
+   * Returns the atom identifying the property in which to place the result of
+   * the conversion
+   */
+  _MEMBER_GET(property, property, GdkAtom, GdkAtom)
+
+  /**
+   * Checks whether there's window on which to place the property. The results
+   * are undefined if @c has_requestor() returns @c false and @c get_requestor
+   * is called.
+   */
+  bool has_requestor() const;
+
+  /**
+   * Returns the window on which to place the property. The results are
+   * undefined if @c has_requestor() would return @c false before the call.
+   */
+  _MEMBER_GET_GOBJECT(requestor, requestor, Gdk::Window, GdkWindow*)
+};
+
+/** Rarely used event. Generated when the owner of a selection changes. On X11,
+ * this information is only available if the X server supports the XFIXES
+ * extension.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::OWNER_CHANGE.
+ */
+class EventOwnerChange : public Event
+{
+  _CLASS_GDKEVENT(EventOwnerChange, GdkEventOwnerChange)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the time at which the ownership changed
+   */
+  _MEMBER_GET(selection_time, selection_time, guint32, guint32)
+
+  /**
+   * Returns the atom identifying the selection
+   */
+  _MEMBER_GET(selection, selection, GdkAtom, GdkAtom)
+
+  /**
+   * Returns the reason of the ownership change
+   */
+  _MEMBER_GET(reason, reason, Gdk::OwnerChange, GdkOwnerChange)
+
+  /**
+   * Checks whether there's new owner of the selection. The results are
+   * undefined if @c has_owner() returns @c false and @c get_owner() is
+   * called.
+   */
+  bool has_owner() const;
+
+  /**
+   * Returns the window which is the new owner of the selection. The results are
+   * undefined if @c has_owner() would return @c false before the call.
+   */
+  _MEMBER_GET_GOBJECT(owner, owner, Gdk::Window, GdkWindow*)
+};
+
+/** Generated during Drag-and-Drop (DND) operations.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::DRAG_ENTER,
+ * @c Gdk::Event::Type::DRAG_LEAVE, @c Gdk::Event::Type::DRAG_MOTION,
+ * @c Gdk::Event::Type::DRAG_STATUS, @c Gdk::Event::Type::DROP_START
+ * or @c Gdk::Event::Type::DROP_FINISHED.
+ */
+class EventDND : public Event
+{
+  _CLASS_GDKEVENT(EventDND, GdkEventDND)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the X coordinate of the pointer relative to the root screen. Only
+   * meaningful if @c get_event_type() returns @c Gdk::Event::Type::DRAG_MOTION or
+   * @c Gdk::Event::Type::DROP_START.
+   */
+  _MEMBER_GET(root_x, x_root, double, gdouble)
+
+  /**
+   * Returns the Y coordinate of the pointer relative to the root screen.
+   */
+  _MEMBER_GET(root_y, y_root, double, gdouble)
+
+  /**
+   * Returns the drag context
+   */
+#m4 _CONVERSION(`GdkDragContext*',`Glib::RefPtr<const Gdk::DragContext>', `Glib::wrap($3)')
+  _MEMBER_GET_GOBJECT(context, context, Gdk::DragContext, GdkDragContext*)
+};
+
+/** Rarely used event. Generated when a stylus has moved in or out of contact
+ * with the tablet, or perhaps that the user's finger has moved in or out of
+ * contact with a touch screen.
+ *
+ * This event type will be used pretty rarely. It only is important for XInput
+ * aware programs that are drawing their own cursor.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::PROXIMITY_IN,
+ * @c Gdk::Event::Type::PROXIMITY_OUT.
+ */
+class EventProximity : public Event
+{
+  _CLASS_GDKEVENT(EventProximity, GdkEventProximity)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns the timestamp of the event in milliseconds
+   */
+  _MEMBER_GET(time, time, guint32, guint32)
+
+  /**
+   * Returns the device where the event originated from.
+   */
+  _MEMBER_GET_GOBJECT(device, device, Gdk::Device, GdkDevice*)
+};
+
+/** Generated when the state of the toplevel window changes.
+ *
+ * @c get_event_type() will return one of @c Gdk::Event::Type::WINDOW_STATE,
+ * @c Gdk::Event::Type::PROXIMITY_OUT.
+ */
+class EventWindowState : public Event
+{
+  _CLASS_GDKEVENT(EventWindowState, GdkEventWindowState)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Returns a bit mask identifying which bits of the state have been changed
+   */
+  _MEMBER_GET(mask, changed_mask, Gdk::Window::State, GdkWindowState)
+
+  /**
+   * Returns the new window state
+   */
+  _MEMBER_GET(state, new_window_state, Gdk::Window::State, GdkWindowState)
+
+};
+
+/** Generated when a setting is modified.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::SETTING.
+ */
+class EventSetting : public Event
+{
+  _CLASS_GDKEVENT(EventSetting, GdkEventSetting)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * Specifies what happened to the setting.
+   */
+  _MEMBER_GET(action, action, Gdk::SettingAction, GdkSettingAction)
+
+  /**
+   * Returns the name of the setting
+   */
+  _MEMBER_GET(name, name, const char*, char*)
+
+};
+
+/** Generated when a pointer or keyboard grab is broken. On X11, this happens
+ * when the grab window becomes unviewable (i.e. it or one of its ancestors is
+ * unmapped), or if the same application grabs the pointer or keyboard again.
+ * Note that implicit grabs (which are initiated by button presses) can also
+ * cause Gdk::EventGrabBroken events.
+ *
+ * @c get_event_type() will return @c Gdk::Event::Type::GRAB_BROKEN.
+ */
+class EventGrabBroken : public Event
+{
+  _CLASS_GDKEVENT(EventGrabBroken, GdkEventGrabBroken)
+  _GDKEVENT_INHERITS(Event, GdkEvent)
+
+public:
+
+  /**
+   * @c true if a keyboard grab was broken, @c false if a pointer grab was
+   * broken
+   */
+  bool is_keyboard() const;
+
+  /**
+   * @c true if a keyboard grab was broken, @c true if a pointer grab was broken
+   */
+  bool is_implicit() const;
+
+  /**
+   * Checks whether this event was caused by another grab in the same
+   * application. In this case, @c get_grab_window() can be used to acquire the
+   * new grab window. The results are undefined if @c has_owner() returns @c
+   * false and @c get_grab_window() is called.
+   */
+  bool has_grab_window() const;
+
+  /**
+   * Returns the new grab window. The results are undefined if @c
+   * has_grab_window() would return @c false before the call.
+   */
+  _MEMBER_GET_GOBJECT(grab_window, grab_window, Gdk::Window, GdkWindow*)
 };
 
 } // namespace Gdk
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index b6499bb..297c292 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -22,6 +22,7 @@ gdkmm_files_any_hg =          \
        dragcontext.hg          \
        drawcontext.hg          \
        drawingcontext.hg               \
+       enums.hg                \
        event.hg                \
        glcontext.hg            \
        monitor.hg \
diff --git a/tools/m4/class_gdkevent.m4 b/tools/m4/class_gdkevent.m4
new file mode 100644
index 0000000..d40b624
--- /dev/null
+++ b/tools/m4/class_gdkevent.m4
@@ -0,0 +1,273 @@
+dnl Gdk::Event and subclasses is a specific case where a class hierarchhy
+dnl refers to a single pointer to a boxed type in the base class.
+dnl
+dnl Add this to Gdk::Event and subclasses (replace Event and GdkEvent with
+dnl the actual name of the class.
+dnl
+dnl _CLASS_GDKEVENT(Event, GdkEvent)
+dnl
+dnl Add this to any subclass Gdk::Event. This instructs to use the functionality
+dnl of the parent class for copying and destruction (note, that creation of new
+dnl events is unsupported). If macro is not defined, gdk_event_copy and
+dnl gdk_event_free are used for these purposes. Replace Event and GdkEvent with
+dnl the identifiers appearing in _CLASS_GDKEVENT of the base class.
+dnl
+dnl _CLASS_GDKEVENT_INHERITS(Event, GdkEvent)
+dnl
+
+define(`_CLASS_GDKEVENT',`dnl
+_PUSH()
+dnl
+dnl  Define the args for later macros
+define(`__CPPNAME__',`$1')
+define(`__CNAME__',`$2')
+
+_POP()
+_SECTION(SECTION_CLASS2)
+') dnl End of _CLASS_GDKEVENT.
+
+define(`_GDKEVENT_INHERITS',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__GDKEVENT_PARENT_CPPNAME__', `$1')
+define(`__GDKEVENT_PARENT_CNAME__', `$2')
+_POP()
+')
+
+dnl
+dnl _END_CLASS_GDKEVENT()
+dnl   denotes the end of a class
+dnl
+define(`_END_CLASS_GDKEVENT',`
+_SECTION(SECTION_HEADER1)
+
+_SECTION(SECTION_HEADER3)
+
+__NAMESPACE_BEGIN__
+
+/**
+ * @relates __NAMESPACE__::__CPPNAME__
+ * @param lhs The left-hand side
+ * @param rhs The right-hand side
+ */
+inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs)
+  { lhs.swap(rhs); }
+
+/// @{
+/**
+ * Wraps a C event instance without making unnecessary copy when the ownership
+ * can not be acquired.
+ *
+ * The @a event pointer must not be deleted until last usage of the returned
+ * instance. Note, that this requirement applies to the pointer itself, in
+ * addition to the object it is pointing to.
+ */
+const __CPPNAME__& wrap_event(const __CNAME__*& event);
+__CPPNAME__& wrap_event(__CNAME__*& event);
+/// @}
+
+__NAMESPACE_END__
+
+namespace Glib {
+
+ifdef(`__BOOL_NO_WRAP_FUNCTION__',`',`dnl else
+
+/**
+ * A Glib::wrap() method for this object.
+ *
+ * @param object The C instance.
+ * @param take_copy False if the result should take ownership of the C instance.
+ * True if it should take a new copy or ref.
+ * @result A C++ instance that wraps this C instance.
+ *
+ * @relates __NAMESPACE__::__CPPNAME__
+ */
+__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy = false);
+')dnl endif __BOOL_NO_WRAP_FUNCTION__
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+template <>
+class Value<__NAMESPACE__::__CPPNAME__> : public Glib::Value_Boxed<__NAMESPACE__::__CPPNAME__>
+{};
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+} // namespace Glib
+
+_SECTION(SECTION_SRC_GENERATED)
+
+ifdef(`__BOOL_NO_WRAP_FUNCTION__',`',`dnl else
+namespace Glib
+{
+
+__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy)
+{
+  return __NAMESPACE__::__CPPNAME__`'(object, take_copy);
+}
+
+} // namespace Glib
+')dnl endif
+
+
+__NAMESPACE_BEGIN__
+
+dnl
+dnl The implementation:
+dnl
+
+dnl All events have the same GType
+// static
+GType __CPPNAME__::get_type()
+{
+  return gdk_event_get_type();
+}
+
+__CPPNAME__::__CPPNAME__`'()
+:
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`dnl
+  __GDKEVENT_PARENT_CPPNAME__`'()
+',`dnl else
+  gobject_(nullptr)
+')dnl endif
+{
+}
+
+__CPPNAME__::__CPPNAME__`'(__CNAME__* gobject, bool make_a_copy)
+:
+  // For Event wrappers, make_a_copy is false by default.  The static
+  // Event wrappers must not take a copy, thus make_a_copy = false
+  // ensures identical behaviour if the default argument is used.
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`dnl
+  __GDKEVENT_PARENT_CPPNAME__`'(reinterpret_cast<__GDKEVENT_PARENT_CNAME__*>(gobject), make_a_copy)
+',`dnl else
+  gobject_((make_a_copy && gobject) ? gdk_event_copy(gobject) : gobject)
+')dnl endif
+{}
+
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`',`dnl We need those functions only for Gdk::Event
+
+__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
+:
+  gobject_((other.gobject_) ? gdk_event_copy(other.gobject_) : nullptr)
+{}
+
+__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other)
+{
+  __CPPNAME__ temp(other);
+  swap(temp);
+  return *this;
+}
+
+__CPPNAME__::~__CPPNAME__`'()
+{
+  if(gobject_) {
+    gdk_event_free(gobject_);
+  }
+}
+')dnl endif
+
+void __CPPNAME__::swap(__CPPNAME__& other)
+{
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`dnl
+  __GDKEVENT_PARENT_CPPNAME__::swap(other);
+',`dnl else
+  __CNAME__ *const temp = gobject_;
+  gobject_ = other.gobject_;
+  other.gobject_ = temp;
+')dnl endif
+}
+
+__CNAME__* __CPPNAME__::gobj_copy() const
+{
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`dnl
+  return reinterpret_cast<__CNAME__*>(__GDKEVENT_PARENT_CPPNAME__::gobj_copy());
+',`dnl else
+  return gdk_event_copy(gobject_);
+')dnl endif
+}
+
+const __CPPNAME__& wrap_event(const __CNAME__*& event)
+{
+  return reinterpret_cast<const __CPPNAME__&>(*event);
+}
+
+__CPPNAME__& wrap_event(__CNAME__*& event)
+{
+  return reinterpret_cast<__CPPNAME__&>(*event);
+}
+
+_IMPORT(SECTION_CC)
+
+__NAMESPACE_END__
+
+
+dnl
+dnl
+_POP()
+dnl
+dnl The actual class declaration:
+dnl
+_IMPORT(SECTION_CLASS1)
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  typedef __CPPNAME__ CppObjectType;
+  typedef __CNAME__ BaseObjectType;
+
+  static GType get_type() G_GNUC_CONST;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`', `dnl else Only add for Gdk::Event
+private:
+  __CNAME__* gobject_;
+public:
+')dnl endif
+
+  /**
+   * Creates an invalid event object. Calling any member functions is undefined
+   * behavior.
+   */
+  __CPPNAME__`'();
+
+  /**
+   * Wraps a C event instance. This constructor either acquires ownership of
+   * @c gobject, or copies it.
+   *
+   * @param gobject Event to wrap
+   * @param make_a_copy if @c false, the ownership of @c gobject is acquired,
+   *        otherwise, a copy is made.
+   */
+  explicit __CPPNAME__`'(__CNAME__* gobject, bool make_a_copy = false);
+
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`', `dnl else Only add for Gdk::Event
+
+  __CPPNAME__`'(const __CPPNAME__& other);
+  __CPPNAME__& operator=(const __CPPNAME__& other);
+
+_IMPORT(SECTION_DTOR_DOCUMENTATION)
+  ~__CPPNAME__`'();
+
+')dnl endif
+
+  void swap(__CPPNAME__& other);
+
+ifdef(`__GDKEVENT_PARENT_CPPNAME__',`dnl
+  /// Provides access to the underlying C instance.
+  __CNAME__*       gobj()       { return reinterpret_cast<__CNAME__*>(__GDKEVENT_PARENT_CPPNAME__::gobj()); }
+
+  /// Provides access to the underlying C instance.
+  const __CNAME__* gobj() const { return reinterpret_cast<const 
__CNAME__*>(__GDKEVENT_PARENT_CPPNAME__::gobj()); }
+',`dnl else
+  ///Provides access to the underlying C instance.
+  __CNAME__*       gobj()       { return gobject_; }
+
+  ///Provides access to the underlying C instance.
+  const __CNAME__* gobj() const { return gobject_; }
+')dnl endif
+  /**
+   * Provides access to the underlying C instance. The caller is responsible for
+   * freeing it with @c gdk_event_free. Use when directly setting fields in structs.
+   */
+  __CNAME__* gobj_copy() const;
+
+private:
+_IMPORT(SECTION_CLASS2)
+')
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index fe66678..21149ea 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -31,12 +31,13 @@ _CONV_ENUM(Gdk,AxisUse)
 _CONV_ENUM(Gdk,ByteOrder)
 _CONV_ENUM(Gdk,CapStyle)
 _CONV_ENUM(Gdk,Colorspace)
+_CONV_ENUM(Gdk,CrossingMode)
 _CONV_INCLASS_ENUM(Gdk,Cursor,Type)
 _CONV_INCLASS_ENUM(Gdk,Device,Type)
 _CONV_ENUM(Gdk,DragAction)
 _CONV_ENUM(Gdk,DragProtocol)
 _CONV_ENUM(Gdk,EventMask)
-_CONV_ENUM(Gdk,Event,Type)
+_CONV_INCLASS_ENUM(Gdk,Event,Type)
 _CONV_ENUM(Gdk,ExtensionMode)
 _CONV_ENUM(Gdk,Fill)
 _CONV_ENUM(Gdk,FillRule)
@@ -54,9 +55,14 @@ _CONV_ENUM(Gdk,JoinStyle)
 _CONV_ENUM(Gdk,LineStyle)
 _CONV_ENUM(Gdk,ModifierType)
 _CONV_ENUM(Gdk,ModifierIntent)
+_CONV_ENUM(Gdk,NotifyType)
 _CONV_ENUM(Gdk,OverlapType)
+_CONV_ENUM(Gdk,OwnerChange)
+_CONV_ENUM(Gdk,PropertyState)
 _CONV_ENUM(Gdk,RgbDither)
+_CONV_ENUM(Gdk,ScrollDirection)
 _CONV_INCLASS_ENUM(Gdk,Seat,Capabilities)
+_CONV_ENUM(Gdk,SettingAction)
 _CONV_ENUM(Gdk,Status)
 _CONV_ENUM(Gdk,SubpixelLayout)
 _CONV_ENUM(Gdk,SubwindowMode)
diff --git a/tools/m4/convert_gtkmm.m4 b/tools/m4/convert_gtkmm.m4
index 1c9f4e1..5eaa628 100644
--- a/tools/m4/convert_gtkmm.m4
+++ b/tools/m4/convert_gtkmm.m4
@@ -16,6 +16,7 @@
 ## License along with this library; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
+include(class_gdkevent.m4)
 include(class_gtkobject.m4)
 include(child_property.m4)
 include(convert_base.m4)
diff --git a/tools/m4/filelist.am b/tools/m4/filelist.am
index c6196a1..0933e11 100644
--- a/tools/m4/filelist.am
+++ b/tools/m4/filelist.am
@@ -17,6 +17,7 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 files_codegen_m4 =             \
+       class_gdkevent.m4               \
        class_gtkobject.m4              \
        child_property.m4               \
        convert.m4              \



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