[gtk+/wip/carlosg/event-as-object: 1/23] gdk: Refurbish GdkEvent struct hierarchy



commit 6b243012cc53a2d1df21a1f38d05268f567df15a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 11 15:35:29 2017 +0200

    gdk: Refurbish GdkEvent struct hierarchy
    
    Make all specific event structs contain a GdkEventAny, so the base
    struct can be extended without modifying structs all over the place.

 gdk/gdkdisplay.c                    |    4 +-
 gdk/gdkevents.c                     |   24 +++++-----
 gdk/gdkeventsprivate.h              |   88 +++++++++--------------------------
 gdk/gdkwindow.c                     |    6 +-
 gdk/wayland/gdkdevice-wayland.c     |   54 +++++++++++-----------
 gdk/wayland/gdkdnd-wayland.c        |    2 +-
 gdk/wayland/gdkselection-wayland.c  |   12 ++--
 gdk/wayland/gdkwindow-wayland.c     |    4 +-
 gdk/x11/gdkdevicemanager-core-x11.c |   30 ++++++------
 gdk/x11/gdkdevicemanager-xi2.c      |   42 ++++++++--------
 gdk/x11/gdkdisplay-x11.c            |   28 ++++++------
 gdk/x11/gdkdnd-x11.c                |   28 ++++++------
 gdk/x11/gdkeventsource.c            |   16 +++---
 gtk/a11y/gtkentryaccessible.c       |    6 +-
 gtk/gtktreeview.c                   |    8 ++--
 gtk/gtkwidget.c                     |    6 +-
 gtk/gtkwindow.c                     |    6 +-
 17 files changed, 160 insertions(+), 204 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index f8989c6..ec4c0b5 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -618,8 +618,8 @@ generate_grab_broken_event (GdkDisplay *display,
       GdkEvent *event;
 
       event = gdk_event_new (GDK_GRAB_BROKEN);
-      event->grab_broken.window = g_object_ref (window);
-      event->grab_broken.send_event = FALSE;
+      event->any.window = g_object_ref (window);
+      event->any.send_event = FALSE;
       event->grab_broken.implicit = implicit;
       event->grab_broken.grab_window = grab_window;
       gdk_event_set_device (event, device);
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 139ff48..20b7f56 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -277,18 +277,18 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
         break;
 
       if (pending_motion_window != NULL &&
-          pending_motion_window != event->event.motion.window)
+          pending_motion_window != event->event.any.window)
         break;
 
       if (pending_motion_device != NULL &&
           pending_motion_device != event->event.motion.device)
         break;
 
-      if (!event->event.motion.window->event_compression)
+      if (!event->event.any.window->event_compression)
         break;
 
-      pending_motion_window = event->event.motion.window;
-      pending_motion_device = event->event.motion.device;
+      pending_motion_window = event->event.any.window;
+      pending_motion_device = event->motion.device;
       pending_motions = tmp_list;
 
       tmp_list = tmp_list->prev;
@@ -1886,13 +1886,13 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
       GdkDisplay *display;
       GdkModifierType modifier;
 
-      g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
+      g_return_val_if_fail (GDK_IS_WINDOW (bevent->any.window), FALSE);
 
       if (bevent->button == GDK_BUTTON_SECONDARY &&
           ! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
         return TRUE;
 
-      display = gdk_window_get_display (bevent->window);
+      display = gdk_window_get_display (bevent->any.window);
 
       modifier = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
                                                GDK_MODIFIER_INTENT_CONTEXT_MENU);
@@ -2163,8 +2163,8 @@ gdk_get_pending_window_state_event_link (GdkWindow *window)
     {
       GdkEventPrivate *event = tmp_list->data;
 
-      if (event->event.type == GDK_WINDOW_STATE &&
-          event->event.window_state.window == window)
+      if (event->event.any.type == GDK_WINDOW_STATE &&
+          event->event.any.window == window)
         return tmp_list;
     }
 
@@ -2182,9 +2182,9 @@ _gdk_set_window_state (GdkWindow      *window,
 
   g_return_if_fail (window != NULL);
 
-  temp_event.window_state.window = window;
-  temp_event.window_state.type = GDK_WINDOW_STATE;
-  temp_event.window_state.send_event = FALSE;
+  temp_event.any.window = window;
+  temp_event.any.type = GDK_WINDOW_STATE;
+  temp_event.any.send_event = FALSE;
   temp_event.window_state.new_window_state = new_state;
 
   if (temp_event.window_state.new_window_state == window->state)
@@ -3037,7 +3037,7 @@ gdk_event_set_selection (GdkEvent  *event,
                          GdkAtom    selection,
                          guint32    time)
 {
-  event->selection.window = g_object_ref (window);
+  event->any.window = g_object_ref (window);
   event->selection.selection = selection;
   event->selection.time = time;
 }
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index fb2c62a..188f197 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -64,9 +64,7 @@ struct _GdkEventAny
  */
 struct _GdkEventExpose
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkRectangle area;
   cairo_region_t *region;
   gint count; /* If non-zero, how many more events follow. */
@@ -89,9 +87,7 @@ struct _GdkEventExpose
  */
 struct _GdkEventVisibility
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkVisibilityState state;
 };
 
@@ -121,9 +117,7 @@ struct _GdkEventVisibility
  */
 struct _GdkEventMotion
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   gdouble x;
   gdouble y;
@@ -163,9 +157,7 @@ struct _GdkEventMotion
  */
 struct _GdkEventButton
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   gdouble x;
   gdouble y;
@@ -213,9 +205,7 @@ struct _GdkEventButton
  */
 struct _GdkEventTouch
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   gdouble x;
   gdouble y;
@@ -261,9 +251,7 @@ struct _GdkEventTouch
  */
 struct _GdkEventScroll
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   gdouble x;
   gdouble y;
@@ -309,9 +297,7 @@ struct _GdkEventScroll
  */
 struct _GdkEventKey
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   guint state;
   guint keyval;
@@ -350,9 +336,7 @@ struct _GdkEventKey
  */
 struct _GdkEventCrossing
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkWindow *subwindow;
   guint32 time;
   gdouble x;
@@ -377,9 +361,7 @@ struct _GdkEventCrossing
  */
 struct _GdkEventFocus
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   gint16 in;
 };
 
@@ -397,9 +379,7 @@ struct _GdkEventFocus
  */
 struct _GdkEventConfigure
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   gint x, y;
   gint width;
   gint height;
@@ -419,9 +399,7 @@ struct _GdkEventConfigure
  */
 struct _GdkEventProperty
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkAtom atom;
   guint32 time;
   guint state;
@@ -444,9 +422,7 @@ struct _GdkEventProperty
  */
 struct _GdkEventSelection
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkAtom selection;
   GdkAtom target;
   GdkAtom property;
@@ -474,9 +450,7 @@ struct _GdkEventSelection
  */
 struct _GdkEventOwnerChange
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkWindow *owner;
   GdkOwnerChange reason;
   GdkAtom selection;
@@ -505,9 +479,7 @@ struct _GdkEventOwnerChange
  */
 struct _GdkEventProximity
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   GdkDevice *device;
 };
@@ -525,9 +497,7 @@ struct _GdkEventProximity
  */
 struct _GdkEventWindowState
 {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkWindowState changed_mask;
   GdkWindowState new_window_state;
 };
@@ -554,9 +524,7 @@ struct _GdkEventWindowState
  * Since: 2.8
  */
 struct _GdkEventGrabBroken {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   gboolean keyboard;
   gboolean implicit;
   GdkWindow *grab_window;
@@ -579,9 +547,7 @@ struct _GdkEventGrabBroken {
  * Generated during DND operations.
  */
 struct _GdkEventDND {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   GdkDragContext *context;
 
   guint32 time;
@@ -611,9 +577,7 @@ struct _GdkEventDND {
  * Generated during touchpad swipe gestures.
  */
 struct _GdkEventTouchpadSwipe {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   gint8 phase;
   gint8 n_fingers;
   guint32 time;
@@ -652,9 +616,7 @@ struct _GdkEventTouchpadSwipe {
  * Generated during touchpad swipe gestures.
  */
 struct _GdkEventTouchpadPinch {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   gint8 phase;
   gint8 n_fingers;
   guint32 time;
@@ -685,9 +647,7 @@ struct _GdkEventTouchpadPinch {
  * Since: 3.22
  */
 struct _GdkEventPadButton {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   guint group;
   guint button;
@@ -713,9 +673,7 @@ struct _GdkEventPadButton {
  * Since: 3.22
  */
 struct _GdkEventPadAxis {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   guint group;
   guint index;
@@ -740,9 +698,7 @@ struct _GdkEventPadAxis {
  * Since: 3.22
  */
 struct _GdkEventPadGroupMode {
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
+  GdkEventAny any;
   guint32 time;
   guint group;
   guint mode;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 0844587..b15dc84 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2733,9 +2733,9 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
 
   /* Paint the window before the children, clipped to the window region */
 
-  event.expose.type = GDK_EXPOSE;
-  event.expose.window = window; /* we already hold a ref */
-  event.expose.send_event = FALSE;
+  event.any.type = GDK_EXPOSE;
+  event.any.window = window; /* we already hold a ref */
+  event.any.send_event = FALSE;
   event.expose.count = 0;
   event.expose.region = clipped_expose_region;
   cairo_region_get_extents (clipped_expose_region, &event.expose.area);
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 31f2f08..98f44c3 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -617,7 +617,7 @@ emulate_crossing (GdkWindow       *window,
   GdkEvent *event;
 
   event = gdk_event_new (type);
-  event->crossing.window = window ? g_object_ref (window) : NULL;
+  event->any.window = window ? g_object_ref (window) : NULL;
   event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL;
   event->crossing.time = time_;
   event->crossing.mode = mode;
@@ -648,7 +648,7 @@ emulate_touch_crossing (GdkWindow           *window,
   GdkEvent *event;
 
   event = gdk_event_new (type);
-  event->crossing.window = window ? g_object_ref (window) : NULL;
+  event->any.window = window ? g_object_ref (window) : NULL;
   event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL;
   event->crossing.time = time_;
   event->crossing.mode = mode;
@@ -674,7 +674,7 @@ emulate_focus (GdkWindow *window,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_FOCUS_CHANGE);
-  event->focus_change.window = g_object_ref (window);
+  event->any.window = g_object_ref (window);
   event->focus_change.in = focus_in;
   gdk_event_set_device (event, device);
   gdk_event_set_source_device (event, device);
@@ -1086,7 +1086,7 @@ emit_selection_owner_change (GdkWindow *window,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_OWNER_CHANGE);
-  event->owner_change.window = g_object_ref (window);
+  event->any.window = g_object_ref (window);
   event->owner_change.owner = NULL;
   event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
   event->owner_change.selection = atom;
@@ -1311,7 +1311,7 @@ create_scroll_event (GdkWaylandSeat        *seat,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_SCROLL);
-  event->scroll.window = g_object_ref (pointer_info->focus);
+  event->any.window = g_object_ref (pointer_info->focus);
   gdk_event_set_device (event, device);
   gdk_event_set_source_device (event, source_device);
   event->scroll.time = pointer_info->time;
@@ -1471,7 +1471,7 @@ pointer_handle_enter (void              *data,
   seat->pointer_info.enter_serial = serial;
 
   event = gdk_wayland_seat_get_frame_event (seat, GDK_ENTER_NOTIFY);
-  event->crossing.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
@@ -1520,7 +1520,7 @@ pointer_handle_leave (void              *data,
   _gdk_wayland_display_update_serial (display_wayland, serial);
 
   event = gdk_wayland_seat_get_frame_event (seat, GDK_LEAVE_NOTIFY);
-  event->crossing.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, GDK_SEAT (seat));
@@ -1571,7 +1571,7 @@ pointer_handle_motion (void              *data,
   seat->pointer_info.surface_y = wl_fixed_to_double (sy);
 
   event = gdk_wayland_seat_get_frame_event (seat, GDK_MOTION_NOTIFY);
-  event->motion.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
@@ -1639,7 +1639,7 @@ pointer_handle_button (void              *data,
   event = gdk_wayland_seat_get_frame_event (seat,
                                             state ? GDK_BUTTON_PRESS :
                                             GDK_BUTTON_RELEASE);
-  event->button.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
@@ -1885,8 +1885,8 @@ keyboard_handle_enter (void               *data,
   seat->repeat_key = 0;
 
   event = gdk_event_new (GDK_FOCUS_CHANGE);
-  event->focus_change.window = g_object_ref (seat->keyboard_focus);
-  event->focus_change.send_event = FALSE;
+  event->any.window = g_object_ref (seat->keyboard_focus);
+  event->any.send_event = FALSE;
   event->focus_change.in = TRUE;
   gdk_event_set_device (event, seat->master_keyboard);
   gdk_event_set_source_device (event, seat->keyboard);
@@ -1930,8 +1930,8 @@ keyboard_handle_leave (void               *data,
   _gdk_wayland_display_update_serial (display, serial);
 
   event = gdk_event_new (GDK_FOCUS_CHANGE);
-  event->focus_change.window = g_object_ref (seat->keyboard_focus);
-  event->focus_change.send_event = FALSE;
+  event->any.window = g_object_ref (seat->keyboard_focus);
+  event->any.send_event = FALSE;
   event->focus_change.in = FALSE;
   gdk_event_set_device (event, seat->master_keyboard);
   gdk_event_set_source_device (event, seat->keyboard);
@@ -2121,7 +2121,7 @@ deliver_key_event (GdkWaylandSeat *seat,
   seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
 
   event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
-  event->key.window = seat->keyboard_focus ? g_object_ref (seat->keyboard_focus) : NULL;
+  event->any.window = seat->keyboard_focus ? g_object_ref (seat->keyboard_focus) : NULL;
   gdk_event_set_device (event, seat->master_keyboard);
   gdk_event_set_source_device (event, seat->keyboard);
   gdk_event_set_seat (event, GDK_SEAT (seat));
@@ -2329,7 +2329,7 @@ _create_touch_event (GdkWaylandSeat       *seat,
   GdkEvent *event;
 
   event = gdk_event_new (evtype);
-  event->touch.window = g_object_ref (touch->window);
+  event->any.window = g_object_ref (touch->window);
   gdk_event_set_device (event, seat->touch_master);
   gdk_event_set_source_device (event, seat->touch);
   gdk_event_set_seat (event, GDK_SEAT (seat));
@@ -2540,7 +2540,7 @@ emit_gesture_swipe_event (GdkWaylandSeat          *seat,
 
   event = gdk_event_new (GDK_TOUCHPAD_SWIPE);
   event->touchpad_swipe.phase = phase;
-  event->touchpad_swipe.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, GDK_SEAT (seat));
@@ -2643,7 +2643,7 @@ emit_gesture_pinch_event (GdkWaylandSeat          *seat,
 
   event = gdk_event_new (GDK_TOUCHPAD_PINCH);
   event->touchpad_pinch.phase = phase;
-  event->touchpad_pinch.window = g_object_ref (seat->pointer_info.focus);
+  event->any.window = g_object_ref (seat->pointer_info.focus);
   gdk_event_set_device (event, seat->master_pointer);
   gdk_event_set_source_device (event, seat->pointer);
   gdk_event_set_seat (event, GDK_SEAT (seat));
@@ -3460,7 +3460,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
     }
 
   if (event->type == GDK_PROXIMITY_OUT)
-    emulate_crossing (event->proximity.window, NULL,
+    emulate_crossing (event->any.window, NULL,
                       tablet->master, GDK_LEAVE_NOTIFY,
                       GDK_CROSSING_NORMAL, time);
 
@@ -3468,7 +3468,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
                                       event);
 
   if (event->type == GDK_PROXIMITY_IN)
-    emulate_crossing (event->proximity.window, NULL,
+    emulate_crossing (event->any.window, NULL,
                       tablet->master, GDK_ENTER_NOTIFY,
                       GDK_CROSSING_NORMAL, time);
 }
@@ -3602,7 +3602,7 @@ tablet_tool_handle_proximity_in (void                      *data,
   gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device);
 
   event = gdk_wayland_tablet_get_frame_event (tablet, GDK_PROXIMITY_IN);
-  event->proximity.window = g_object_ref (tablet->pointer_info.focus);
+  event->any.window = g_object_ref (tablet->pointer_info.focus);
   gdk_event_set_device (event, tablet->master);
   gdk_event_set_source_device (event, tablet->current_device);
   gdk_event_set_device_tool (event, tool->tool);
@@ -3627,7 +3627,7 @@ tablet_tool_handle_proximity_out (void                      *data,
                        gdk_device_tool_get_tool_type (tool->tool)));
 
   event = gdk_wayland_tablet_get_frame_event (tablet, GDK_PROXIMITY_OUT);
-  event->proximity.window = g_object_ref (tablet->pointer_info.focus);
+  event->any.window = g_object_ref (tablet->pointer_info.focus);
   gdk_event_set_device (event, tablet->master);
   gdk_event_set_source_device (event, tablet->current_device);
   gdk_event_set_device_tool (event, tool->tool);
@@ -3652,7 +3652,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
   GdkEvent *event;
 
   event = gdk_wayland_tablet_get_frame_event (tablet, evtype);
-  event->button.window = g_object_ref (tablet->pointer_info.focus);
+  event->any.window = g_object_ref (tablet->pointer_info.focus);
   gdk_event_set_device (event, tablet->master);
   gdk_event_set_source_device (event, tablet->current_device);
   gdk_event_set_device_tool (event, tablet->current_tool->tool);
@@ -3723,7 +3723,7 @@ tablet_tool_handle_motion (void                      *data,
                        tablet->pointer_info.surface_y));
 
   event = gdk_wayland_tablet_get_frame_event (tablet, GDK_MOTION_NOTIFY);
-  event->motion.window = g_object_ref (tablet->pointer_info.focus);
+  event->any.window = g_object_ref (tablet->pointer_info.focus);
   gdk_event_set_device (event, tablet->master);
   gdk_event_set_source_device (event, tablet->current_device);
   gdk_event_set_device_tool (event, tool->tool);
@@ -4001,7 +4001,7 @@ tablet_pad_ring_handle_frame (void                          *data,
             g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
 
   event = gdk_event_new (GDK_PAD_RING);
-  g_set_object (&event->pad_axis.window, seat->keyboard_focus);
+  g_set_object (&event->any.window, seat->keyboard_focus);
   event->pad_axis.time = time;
   event->pad_axis.group = g_list_index (pad->mode_groups, group);
   event->pad_axis.index = g_list_index (pad->rings, wp_tablet_pad_ring);
@@ -4077,7 +4077,7 @@ tablet_pad_strip_handle_frame (void                           *data,
                        wp_tablet_pad_strip));
 
   event = gdk_event_new (GDK_PAD_STRIP);
-  g_set_object (&event->pad_axis.window, seat->keyboard_focus);
+  g_set_object (&event->any.window, seat->keyboard_focus);
   event->pad_axis.time = time;
   event->pad_axis.group = g_list_index (pad->mode_groups, group);
   event->pad_axis.index = g_list_index (pad->strips, wp_tablet_pad_strip);
@@ -4201,7 +4201,7 @@ tablet_pad_group_handle_mode (void                           *data,
   n_group = g_list_index (pad->mode_groups, group);
 
   event = gdk_event_new (GDK_PAD_GROUP_MODE);
-  g_set_object (&event->pad_button.window, seat->keyboard_focus);
+  g_set_object (&event->any.window, seat->keyboard_focus);
   event->pad_group_mode.group = n_group;
   event->pad_group_mode.mode = mode;
   event->pad_group_mode.time = time;
@@ -4321,7 +4321,7 @@ tablet_pad_handle_button (void                     *data,
   event = gdk_event_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ?
                          GDK_PAD_BUTTON_PRESS :
                          GDK_PAD_BUTTON_RELEASE);
-  g_set_object (&event->pad_button.window, seat->keyboard_focus);
+  g_set_object (&event->any.window, seat->keyboard_focus);
   event->pad_button.button = button;
   event->pad_button.group = n_group;
   event->pad_button.mode = group->current_mode;
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 23fd8ba..1bba2ca 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -126,7 +126,7 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
     window = gdk_drag_context_get_dest_window (context);
 
   event = gdk_event_new (type);
-  event->dnd.window = g_object_ref (window);
+  event->any.window = g_object_ref (window);
   event->dnd.context = g_object_ref (context);
   event->dnd.time = time_;
   event->dnd.x_root = GDK_WAYLAND_DRAG_CONTEXT (context)->x;
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index b98caa8..f1fc583 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -129,8 +129,8 @@ selection_buffer_notify (SelectionBuffer *buffer)
   for (l = buffer->requestors; l; l = l->next)
     {
       event = gdk_event_new (GDK_SELECTION_NOTIFY);
-      event->selection.window = g_object_ref (l->data);
-      event->selection.send_event = FALSE;
+      event->any.window = g_object_ref (l->data);
+      event->any.send_event = FALSE;
       event->selection.selection = buffer->selection;
       event->selection.target = buffer->target;
       event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION");
@@ -598,8 +598,8 @@ gdk_wayland_selection_emit_request (GdkWindow *window,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_SELECTION_REQUEST);
-  event->selection.window = g_object_ref (window);
-  event->selection.send_event = FALSE;
+  event->any.window = g_object_ref (window);
+  event->any.send_event = FALSE;
   event->selection.selection = selection;
   event->selection.target = target;
   event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION");
@@ -1266,8 +1266,8 @@ emit_empty_selection_notify (GdkWindow *requestor,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_SELECTION_NOTIFY);
-  event->selection.window = g_object_ref (requestor);
-  event->selection.send_event = FALSE;
+  event->any.window = g_object_ref (requestor);
+  event->any.send_event = FALSE;
   event->selection.selection = selection;
   event->selection.target = target;
   event->selection.property = GDK_NONE;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 298435e..c2af118 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -985,8 +985,8 @@ gdk_wayland_window_configure (GdkWindow *window,
   GdkEvent *event;
 
   event = gdk_event_new (GDK_CONFIGURE);
-  event->configure.window = g_object_ref (window);
-  event->configure.send_event = FALSE;
+  event->any.window = g_object_ref (window);
+  event->any.send_event = FALSE;
   event->configure.width = width;
   event->configure.height = height;
 
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index c662d21..004db03 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -153,7 +153,7 @@ translate_key_event (GdkDisplay              *display,
   GdkKeymap *keymap = gdk_keymap_get_for_display (display);
   GdkModifierType consumed, state;
 
-  event->key.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
+  event->any.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
   event->key.time = xevent->xkey.time;
   gdk_event_set_device (event, device_manager->core_keyboard);
 
@@ -465,7 +465,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
         case 5: /* down */
         case 6: /* left */
         case 7: /* right */
-          event->scroll.type = GDK_SCROLL;
+          event->any.type = GDK_SCROLL;
 
           if (xevent->xbutton.button == 4)
             event->scroll.direction = GDK_SCROLL_UP;
@@ -476,7 +476,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           else
             event->scroll.direction = GDK_SCROLL_RIGHT;
 
-          event->scroll.window = window;
+          event->any.window = window;
           event->scroll.time = xevent->xbutton.time;
           event->scroll.x = (gdouble) xevent->xbutton.x / scale;
           event->scroll.y = (gdouble) xevent->xbutton.y / scale;
@@ -497,8 +497,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           break;
 
         default:
-          event->button.type = GDK_BUTTON_PRESS;
-          event->button.window = window;
+          event->any.type = GDK_BUTTON_PRESS;
+          event->any.window = window;
           event->button.time = xevent->xbutton.time;
           event->button.x = (gdouble) xevent->xbutton.x / scale;
           event->button.y = (gdouble) xevent->xbutton.y / scale;
@@ -540,8 +540,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           break;
         }
 
-      event->button.type = GDK_BUTTON_RELEASE;
-      event->button.window = window;
+      event->any.type = GDK_BUTTON_RELEASE;
+      event->any.window = window;
       event->button.time = xevent->xbutton.time;
       event->button.x = (gdouble) xevent->xbutton.x / scale;
       event->button.y = (gdouble) xevent->xbutton.y / scale;
@@ -570,8 +570,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           break;
         }
 
-      event->motion.type = GDK_MOTION_NOTIFY;
-      event->motion.window = window;
+      event->any.type = GDK_MOTION_NOTIFY;
+      event->any.window = window;
       event->motion.time = xevent->xmotion.time;
       event->motion.x = (gdouble) xevent->xmotion.x / scale;
       event->motion.y = (gdouble) xevent->xmotion.y / scale;
@@ -609,8 +609,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           break;
         }
 
-      event->crossing.type = GDK_ENTER_NOTIFY;
-      event->crossing.window = window;
+      event->any.type = GDK_ENTER_NOTIFY;
+      event->any.window = window;
       gdk_event_set_device (event, device_manager->core_pointer);
 
       /* If the subwindow field of the XEvent is non-NULL, then
@@ -653,8 +653,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
           break;
         }
 
-      event->crossing.type = GDK_LEAVE_NOTIFY;
-      event->crossing.window = window;
+      event->any.type = GDK_LEAVE_NOTIFY;
+      event->any.window = window;
       gdk_event_set_device (event, device_manager->core_pointer);
 
       /* If the subwindow field of the XEvent is non-NULL, then
@@ -911,8 +911,8 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
       GdkEvent *event;
 
       event = gdk_event_new (GDK_FOCUS_CHANGE);
-      event->focus_change.window = g_object_ref (window);
-      event->focus_change.send_event = FALSE;
+      event->any.window = g_object_ref (window);
+      event->any.send_event = FALSE;
       event->focus_change.in = focus_in;
       gdk_event_set_device (event, device);
       if (source_device)
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 56fb2c8..769c844 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1476,9 +1476,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                              xev->sourceid,
                              xev->detail));
 
-        event->key.type = xev->evtype == XI_KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
+        event->any.type = xev->evtype == XI_KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
 
-        event->key.window = window;
+        event->any.window = window;
 
         event->key.time = xev->time;
         event->key.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
@@ -1551,7 +1551,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                  (xev->detail >= 4 && xev->detail <= 7))
           {
             /* Button presses of button 4-7 are scroll events */
-            event->scroll.type = GDK_SCROLL;
+            event->any.type = GDK_SCROLL;
 
             if (xev->detail == 4)
               event->scroll.direction = GDK_SCROLL_UP;
@@ -1562,7 +1562,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             else
               event->scroll.direction = GDK_SCROLL_RIGHT;
 
-            event->scroll.window = window;
+            event->any.window = window;
             event->scroll.time = xev->time;
             event->scroll.x = (gdouble) xev->event_x / scale;
             event->scroll.y = (gdouble) xev->event_y / scale;
@@ -1584,9 +1584,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
           }
         else
           {
-            event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
+            event->any.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
 
-            event->button.window = window;
+            event->any.window = window;
             event->button.time = xev->time;
             event->button.x = (gdouble) xev->event_x / scale;
             event->button.y = (gdouble) xev->event_y / scale;
@@ -1606,7 +1606,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             event->button.axes = translate_axes (event->button.device,
                                                  event->button.x,
                                                  event->button.y,
-                                                 event->button.window,
+                                                 event->any.window,
                                                  &xev->valuators);
 
             if (gdk_device_get_mode (event->button.device) == GDK_MODE_WINDOW)
@@ -1665,7 +1665,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             scroll_valuators_changed (GDK_X11_DEVICE_XI2 (source_device),
                                       &xev->valuators, &delta_x, &delta_y))
           {
-            event->scroll.type = GDK_SCROLL;
+            event->any.type = GDK_SCROLL;
             event->scroll.direction = GDK_SCROLL_SMOOTH;
 
             if (delta_x == 0.0 && delta_y == 0.0)
@@ -1677,7 +1677,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                 xev->event, delta_x, delta_y));
 
 
-            event->scroll.window = window;
+            event->any.window = window;
             event->scroll.time = xev->time;
             event->scroll.x = (gdouble) xev->event_x / scale;
             event->scroll.y = (gdouble) xev->event_y / scale;
@@ -1694,8 +1694,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             break;
           }
 
-        event->motion.type = GDK_MOTION_NOTIFY;
-        event->motion.window = window;
+        event->any.type = GDK_MOTION_NOTIFY;
+        event->any.window = window;
         event->motion.time = xev->time;
         event->motion.x = (gdouble) xev->event_x / scale;
         event->motion.y = (gdouble) xev->event_y / scale;
@@ -1715,7 +1715,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         event->motion.axes = translate_axes (event->motion.device,
                                              event->motion.x,
                                              event->motion.y,
-                                             event->motion.window,
+                                             event->any.window,
                                              &xev->valuators);
 
         if (gdk_device_get_mode (event->motion.device) == GDK_MODE_WINDOW)
@@ -1741,11 +1741,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                             xev->flags & XITouchEmulatingPointer ? "true" : "false"));
 
         if (ev->evtype == XI_TouchBegin)
-          event->touch.type = GDK_TOUCH_BEGIN;
+          event->any.type = GDK_TOUCH_BEGIN;
         else if (ev->evtype == XI_TouchEnd)
-          event->touch.type = GDK_TOUCH_END;
+          event->any.type = GDK_TOUCH_END;
 
-        event->touch.window = window;
+        event->any.window = window;
         event->touch.time = xev->time;
         event->touch.x = (gdouble) xev->event_x / scale;
         event->touch.y = (gdouble) xev->event_y / scale;
@@ -1764,7 +1764,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         event->touch.axes = translate_axes (event->touch.device,
                                             event->touch.x,
                                             event->touch.y,
-                                            event->touch.window,
+                                            event->any.window,
                                             &xev->valuators);
 
         if (gdk_device_get_mode (event->touch.device) == GDK_MODE_WINDOW)
@@ -1813,9 +1813,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                             xev->detail,
                             xev->flags & XITouchEmulatingPointer ? "true" : "false"));
 
-        event->touch.window = window;
+        event->any.window = window;
         event->touch.sequence = GUINT_TO_POINTER (xev->detail);
-        event->touch.type = GDK_TOUCH_UPDATE;
+        event->any.type = GDK_TOUCH_UPDATE;
         event->touch.time = xev->time;
         event->touch.x = (gdouble) xev->event_x / scale;
         event->touch.y = (gdouble) xev->event_y / scale;
@@ -1844,7 +1844,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         event->touch.axes = translate_axes (event->touch.device,
                                             event->touch.x,
                                             event->touch.y,
-                                            event->touch.window,
+                                            event->any.window,
                                             &xev->valuators);
 
         if (gdk_device_get_mode (event->touch.device) == GDK_MODE_WINDOW)
@@ -1873,7 +1873,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                              xev->deviceid, xev->sourceid,
                              xev->detail, xev->mode));
 
-        event->crossing.type = (ev->evtype == XI_Enter) ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
+        event->any.type = (ev->evtype == XI_Enter) ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
 
         event->crossing.x = (gdouble) xev->event_x / scale;
         event->crossing.y = (gdouble) xev->event_y / scale;
@@ -1882,7 +1882,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         event->crossing.time = xev->time;
         event->crossing.focus = xev->focus;
 
-        event->crossing.window = window;
+        event->any.window = window;
         event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xev->child);
 
         device = g_hash_table_lookup (device_manager->id_table,
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index cc34d8c..022ff48 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -796,8 +796,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
           break;
         }
 
-      event->visibility.type = GDK_VISIBILITY_NOTIFY;
-      event->visibility.window = window;
+      event->any.type = GDK_VISIBILITY_NOTIFY;
+      event->any.window = window;
 
       switch (xevent->xvisibility.state)
        {
@@ -976,8 +976,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
        return_val = FALSE;
       else
        {
-         event->configure.type = GDK_CONFIGURE;
-         event->configure.window = window;
+         event->any.type = GDK_CONFIGURE;
+         event->any.window = window;
          event->configure.width = (xevent->xconfigure.width + window_impl->window_scale - 1) / 
window_impl->window_scale;
          event->configure.height = (xevent->xconfigure.height + window_impl->window_scale - 1) / 
window_impl->window_scale;
 
@@ -1068,8 +1068,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
 
       if (window->event_mask & GDK_PROPERTY_CHANGE_MASK)
        {
-         event->property.type = GDK_PROPERTY_NOTIFY;
-         event->property.window = window;
+         event->any.type = GDK_PROPERTY_NOTIFY;
+         event->any.window = window;
          event->property.atom = gdk_x11_xatom_to_atom_for_display (display, xevent->xproperty.atom);
          event->property.time = xevent->xproperty.time;
          event->property.state = xevent->xproperty.state;
@@ -1086,8 +1086,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
 
       if (_gdk_x11_selection_filter_clear_event (&xevent->xselectionclear))
        {
-         event->selection.type = GDK_SELECTION_CLEAR;
-         event->selection.window = window;
+         event->any.type = GDK_SELECTION_CLEAR;
+         event->any.window = window;
          event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, 
xevent->xselectionclear.selection);
          event->selection.time = xevent->xselectionclear.time;
        }
@@ -1101,8 +1101,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
                g_message ("selection request:\twindow: %ld",
                           xevent->xproperty.window));
 
-      event->selection.type = GDK_SELECTION_REQUEST;
-      event->selection.window = window;
+      event->any.type = GDK_SELECTION_REQUEST;
+      event->any.window = window;
       event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, 
xevent->xselectionrequest.selection);
       event->selection.target = gdk_x11_xatom_to_atom_for_display (display, 
xevent->xselectionrequest.target);
       if (xevent->xselectionrequest.property == None)
@@ -1123,8 +1123,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
                g_message ("selection notify:\twindow: %ld",
                           xevent->xproperty.window));
 
-      event->selection.type = GDK_SELECTION_NOTIFY;
-      event->selection.window = window;
+      event->any.type = GDK_SELECTION_NOTIFY;
+      event->any.window = window;
       event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, xevent->xselection.selection);
       event->selection.target = gdk_x11_xatom_to_atom_for_display (display, xevent->xselection.target);
       if (xevent->xselection.property == None)
@@ -1177,8 +1177,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
               gdk_display_set_composited (display, composited);
             }
 
-         event->owner_change.type = GDK_OWNER_CHANGE;
-         event->owner_change.window = window;
+         event->any.type = GDK_OWNER_CHANGE;
+         event->any.window = window;
           if (selection_notify->owner != None)
             event->owner_change.owner = gdk_x11_window_foreign_new_for_display (display,
                                                                                 selection_notify->owner);
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 11585dd..a7ca704 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -978,8 +978,8 @@ xdnd_status_filter (GdkXEvent *xev,
       if (context_x11->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
         context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
 
-      event->dnd.send_event = FALSE;
-      event->dnd.type = GDK_DRAG_STATUS;
+      event->any.send_event = FALSE;
+      event->any.type = GDK_DRAG_STATUS;
       event->dnd.context = context;
       gdk_event_set_device (event, gdk_drag_context_get_device (context));
       g_object_ref (context);
@@ -1027,7 +1027,7 @@ xdnd_finished_filter (GdkXEvent *xev,
       if (context_x11->version == 5)
         context_x11->drop_failed = xevent->xclient.data.l[1] == 0;
 
-      event->dnd.type = GDK_DROP_FINISHED;
+      event->any.type = GDK_DROP_FINISHED;
       event->dnd.context = context;
       gdk_event_set_device (event, gdk_drag_context_get_device (context));
       g_object_ref (context);
@@ -1147,8 +1147,8 @@ send_client_message_async_cb (Window   window,
       context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
 
       temp_event = gdk_event_new (GDK_DRAG_STATUS);
-      temp_event->dnd.window = g_object_ref (context->source_window);
-      temp_event->dnd.send_event = TRUE;
+      temp_event->any.window = g_object_ref (context->source_window);
+      temp_event->any.send_event = TRUE;
       temp_event->dnd.context = g_object_ref (context);
       temp_event->dnd.time = GDK_CURRENT_TIME;
       gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
@@ -1769,7 +1769,7 @@ xdnd_enter_filter (GdkXEvent *xev,
   xdnd_manage_source_filter (context, context->source_window, TRUE);
   xdnd_read_actions (context_x11);
 
-  event->dnd.type = GDK_DRAG_ENTER;
+  event->any.type = GDK_DRAG_ENTER;
   event->dnd.context = context;
   gdk_event_set_device (event, gdk_drag_context_get_device (context));
   g_object_ref (context);
@@ -1806,7 +1806,7 @@ xdnd_leave_filter (GdkXEvent *xev,
       (display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
       (GDK_WINDOW_XID (display_x11->current_dest_drag->source_window) == source_window))
     {
-      event->dnd.type = GDK_DRAG_LEAVE;
+      event->any.type = GDK_DRAG_LEAVE;
       /* Pass ownership of context to the event */
       event->dnd.context = display_x11->current_dest_drag;
       gdk_event_set_device (event, gdk_drag_context_get_device (event->dnd.context));
@@ -1859,7 +1859,7 @@ xdnd_position_filter (GdkXEvent *xev,
 
       context_x11 = GDK_X11_DRAG_CONTEXT (context);
 
-      event->dnd.type = GDK_DRAG_MOTION;
+      event->any.type = GDK_DRAG_MOTION;
       event->dnd.context = context;
       gdk_event_set_device (event, gdk_drag_context_get_device (context));
       g_object_ref (context);
@@ -1916,7 +1916,7 @@ xdnd_drop_filter (GdkXEvent *xev,
       (GDK_WINDOW_XID (context->source_window) == source_window))
     {
       context_x11 = GDK_X11_DRAG_CONTEXT (context);
-      event->dnd.type = GDK_DROP_START;
+      event->any.type = GDK_DROP_START;
 
       event->dnd.context = context;
       gdk_event_set_device (event, gdk_drag_context_get_device (context));
@@ -2306,11 +2306,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
        * the drag changed
        */
       temp_event = gdk_event_new (GDK_DRAG_STATUS);
-      temp_event->dnd.window = g_object_ref (context->source_window);
+      temp_event->any.window = g_object_ref (context->source_window);
       /* We use this to signal a synthetic status. Perhaps
        * we should use an extra field...
        */
-      temp_event->dnd.send_event = TRUE;
+      temp_event->any.send_event = TRUE;
 
       temp_event->dnd.context = g_object_ref (context);
       temp_event->dnd.time = time;
@@ -2360,8 +2360,8 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
                   context->action = 0;
 
                 temp_event = gdk_event_new (GDK_DRAG_STATUS);
-                temp_event->dnd.window = g_object_ref (context->source_window);
-                temp_event->dnd.send_event = FALSE;
+                temp_event->any.window = g_object_ref (context->source_window);
+                temp_event->any.send_event = FALSE;
                 temp_event->dnd.context = g_object_ref (context);
                 temp_event->dnd.time = time;
                 gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
@@ -2992,7 +2992,7 @@ gdk_dnd_handle_key_event (GdkDragContext    *context,
   state = event->state;
   pointer = gdk_device_get_associated_device (gdk_event_get_device ((GdkEvent *) event));
 
-  if (event->type == GDK_KEY_PRESS)
+  if (event->any.type == GDK_KEY_PRESS)
     {
       switch (event->keyval)
         {
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index ae465db..586b8c6 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -135,9 +135,9 @@ handle_focus_change (GdkEventCrossing *event)
   GdkX11Screen *x11_screen;
   gboolean focus_in, had_focus;
 
-  toplevel = _gdk_x11_window_get_toplevel (event->window);
-  x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->window));
-  focus_in = (event->type == GDK_ENTER_NOTIFY);
+  toplevel = _gdk_x11_window_get_toplevel (event->any.window);
+  x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->any.window));
+  focus_in = (event->any.type == GDK_ENTER_NOTIFY);
 
   if (x11_screen->wmspec_check_window)
     return;
@@ -158,8 +158,8 @@ handle_focus_change (GdkEventCrossing *event)
       GdkEvent *focus_event;
 
       focus_event = gdk_event_new (GDK_FOCUS_CHANGE);
-      focus_event->focus_change.window = g_object_ref (event->window);
-      focus_event->focus_change.send_event = FALSE;
+      focus_event->any.window = g_object_ref (event->any.window);
+      focus_event->any.send_event = FALSE;
       focus_event->focus_change.in = focus_in;
       gdk_event_set_device (focus_event, gdk_event_get_device ((GdkEvent *) event));
 
@@ -180,8 +180,8 @@ create_synth_crossing_event (GdkEventType     evtype,
   g_assert (evtype == GDK_ENTER_NOTIFY || evtype == GDK_LEAVE_NOTIFY);
 
   event = gdk_event_new (evtype);
-  event->crossing.send_event = TRUE;
-  event->crossing.window = g_object_ref (real_event->any.window);
+  event->any.send_event = TRUE;
+  event->any.window = g_object_ref (real_event->any.window);
   event->crossing.detail = GDK_NOTIFY_ANCESTOR;
   event->crossing.mode = mode;
   event->crossing.time = gdk_event_get_time (real_event);
@@ -345,7 +345,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
   if (event &&
       (event->type == GDK_ENTER_NOTIFY ||
        event->type == GDK_LEAVE_NOTIFY) &&
-      event->crossing.window != NULL)
+      event->any.window != NULL)
     {
       /* Handle focusing (in the case where no window manager is running */
       handle_focus_change (&event->crossing);
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index 1df260c..d5e3035 100644
--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -242,10 +242,10 @@ gtk_entry_icon_accessible_do_action (AtkAction *action,
 
   gtk_entry_get_icon_area (gtk_entry, icon->pos, &icon_area);
   memset (&event, 0, sizeof (event));
-  event.button.type = GDK_BUTTON_PRESS;
-  event.button.window = gtk_widget_get_window (widget);
+  event.any.type = GDK_BUTTON_PRESS;
+  event.any.window = gtk_widget_get_window (widget);
   event.button.button = 1;
-  event.button.send_event = TRUE;
+  event.any.send_event = TRUE;
   event.button.time = GDK_CURRENT_TIME;
   event.button.x = icon_area.x;
   event.button.y = icon_area.y;
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 5291940..e56d882 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5794,8 +5794,8 @@ gtk_tree_view_key_press (GtkWidget   *widget,
           gulong popup_menu_id;
 
           new_event = gdk_event_copy ((GdkEvent *) event);
-          g_object_unref (((GdkEventKey *) new_event)->window);
-          ((GdkEventKey *) new_event)->window =
+          g_object_unref (((GdkEventKey *) new_event)->any.window);
+          ((GdkEventKey *) new_event)->any.window =
             g_object_ref (gtk_widget_get_window (search_window));
           gtk_widget_realize (search_window);
 
@@ -10735,8 +10735,8 @@ send_focus_change (GtkWidget *widget,
 
       fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
-      fevent->focus_change.type = GDK_FOCUS_CHANGE;
-      fevent->focus_change.window = g_object_ref (window);
+      fevent->any.type = GDK_FOCUS_CHANGE;
+      fevent->any.window = g_object_ref (window);
       fevent->focus_change.in = in;
       gdk_event_set_device (fevent, device);
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1b4c55c..bd0f635 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3472,7 +3472,7 @@ _gtk_widget_emulate_press (GtkWidget      *widget,
   else if (event->type == GDK_MOTION_NOTIFY)
     {
       press = gdk_event_new (GDK_BUTTON_PRESS);
-      press->button.window = g_object_ref (event->motion.window);
+      press->any.window = g_object_ref (event->any.window);
       press->button.time = event->motion.time;
       press->button.x = event->motion.x;
       press->button.y = event->motion.y;
@@ -10572,8 +10572,8 @@ synth_crossing (GtkWidget       *widget,
 
   event = gdk_event_new (type);
 
-  event->crossing.window = g_object_ref (window);
-  event->crossing.send_event = TRUE;
+  event->any.window = g_object_ref (window);
+  event->any.send_event = TRUE;
   event->crossing.subwindow = g_object_ref (window);
   event->crossing.time = GDK_CURRENT_TIME;
   gdk_device_get_position_double (device,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1943657..436429f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7211,7 +7211,7 @@ gtk_window_configure_event (GtkWidget         *widget,
   if (!_gtk_widget_is_toplevel (widget))
     return FALSE;
 
-  if (_gtk_widget_get_window (widget) != event->window)
+  if (_gtk_widget_get_window (widget) != event->any.window)
     return TRUE;
 
   /* If this is a gratuitous ConfigureNotify that's already
@@ -7636,8 +7636,8 @@ do_focus_change (GtkWidget *widget,
 
       fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
-      fevent->focus_change.type = GDK_FOCUS_CHANGE;
-      fevent->focus_change.window = window;
+      fevent->any.type = GDK_FOCUS_CHANGE;
+      fevent->any.window = window;
       if (window)
         g_object_ref (window);
       fevent->focus_change.in = in;


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