diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-10-11 15:35:29 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-12-14 00:58:32 +0100 |
commit | b9db0b55cb68985185feff891146beef6456c427 (patch) | |
tree | 25b21f1ea5ce6637e92a0567ad511168c58fc96a /gdk | |
parent | 9aba77e31b9f825bd1d67b28c1c887d350f7affc (diff) | |
download | gtk+-b9db0b55cb68985185feff891146beef6456c427.tar.gz |
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.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkdisplay.c | 4 | ||||
-rw-r--r-- | gdk/gdkevents.c | 22 | ||||
-rw-r--r-- | gdk/gdkeventsprivate.h | 76 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 6 | ||||
-rw-r--r-- | gdk/wayland/gdkdevice-wayland.c | 52 | ||||
-rw-r--r-- | gdk/wayland/gdkdnd-wayland.c | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-core-x11.c | 30 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-xi2.c | 42 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 8 | ||||
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 28 | ||||
-rw-r--r-- | gdk/x11/gdkeventsource.c | 18 |
12 files changed, 127 insertions, 165 deletions
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index efdfaf6fc8..bd43125192 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -543,8 +543,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 6afaf6c4ce..ec2cf65398 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; @@ -1720,13 +1720,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); @@ -1970,8 +1970,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; } @@ -1989,9 +1989,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) diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h index 6681fe3743..5275712038 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. */ @@ -98,9 +96,7 @@ struct _GdkEventExpose */ struct _GdkEventMotion { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; gdouble x; gdouble y; @@ -140,9 +136,7 @@ struct _GdkEventMotion */ struct _GdkEventButton { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; gdouble x; gdouble y; @@ -190,9 +184,7 @@ struct _GdkEventButton */ struct _GdkEventTouch { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; gdouble x; gdouble y; @@ -238,9 +230,7 @@ struct _GdkEventTouch */ struct _GdkEventScroll { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; gdouble x; gdouble y; @@ -286,9 +276,7 @@ struct _GdkEventScroll */ struct _GdkEventKey { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; guint state; guint keyval; @@ -327,9 +315,7 @@ struct _GdkEventKey */ struct _GdkEventCrossing { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; GdkWindow *subwindow; guint32 time; gdouble x; @@ -354,9 +340,7 @@ struct _GdkEventCrossing */ struct _GdkEventFocus { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; gint16 in; }; @@ -374,9 +358,7 @@ struct _GdkEventFocus */ struct _GdkEventConfigure { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; gint x, y; gint width; gint height; @@ -396,9 +378,7 @@ struct _GdkEventConfigure */ struct _GdkEventProperty { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; GdkAtom atom; guint32 time; guint state; @@ -425,9 +405,7 @@ struct _GdkEventProperty */ struct _GdkEventProximity { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; GdkDevice *device; }; @@ -445,9 +423,7 @@ struct _GdkEventProximity */ struct _GdkEventWindowState { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; GdkWindowState changed_mask; GdkWindowState new_window_state; }; @@ -474,9 +450,7 @@ struct _GdkEventWindowState * Since: 2.8 */ struct _GdkEventGrabBroken { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; gboolean keyboard; gboolean implicit; GdkWindow *grab_window; @@ -499,9 +473,7 @@ struct _GdkEventGrabBroken { * Generated during DND operations. */ struct _GdkEventDND { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; GdkDragContext *context; guint32 time; @@ -531,9 +503,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; @@ -572,9 +542,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; @@ -605,9 +573,7 @@ struct _GdkEventTouchpadPinch { * Since: 3.22 */ struct _GdkEventPadButton { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; guint group; guint button; @@ -633,9 +599,7 @@ struct _GdkEventPadButton { * Since: 3.22 */ struct _GdkEventPadAxis { - GdkEventType type; - GdkWindow *window; - gint8 send_event; + GdkEventAny any; guint32 time; guint group; guint index; @@ -660,9 +624,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 8acc87d3c7..80cb046744 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -2539,9 +2539,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 5bd5c85f3f..66c89efd3c 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -596,7 +596,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; @@ -627,7 +627,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; @@ -653,7 +653,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); @@ -1222,7 +1222,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; @@ -1382,7 +1382,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)); @@ -1431,7 +1431,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)); @@ -1482,7 +1482,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)); @@ -1550,7 +1550,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)); @@ -1796,8 +1796,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); @@ -1834,8 +1834,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); @@ -2025,7 +2025,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)); @@ -2232,7 +2232,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)); @@ -2442,7 +2442,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)); @@ -2544,7 +2544,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)); @@ -3273,7 +3273,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); @@ -3281,7 +3281,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); } @@ -3415,7 +3415,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); @@ -3440,7 +3440,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); @@ -3464,7 +3464,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); @@ -3534,7 +3534,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); @@ -3812,7 +3812,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); @@ -3888,7 +3888,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); @@ -4012,7 +4012,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; @@ -4129,7 +4129,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 34cf3f35d1..3bf40aca5f 100644 --- a/gdk/wayland/gdkdnd-wayland.c +++ b/gdk/wayland/gdkdnd-wayland.c @@ -121,7 +121,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/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index ebfe9ab113..d7fa1861e0 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -933,8 +933,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 c1b5427a01..8394fd8504 100644 --- a/gdk/x11/gdkdevicemanager-core-x11.c +++ b/gdk/x11/gdkdevicemanager-core-x11.c @@ -196,7 +196,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); @@ -487,7 +487,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; @@ -498,7 +498,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; @@ -515,8 +515,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; @@ -557,8 +557,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; @@ -586,8 +586,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; @@ -617,8 +617,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, gdk_event_set_display (event, display); - 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 @@ -657,8 +657,8 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, gdk_event_set_display (event, display); - 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 @@ -889,8 +889,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 07c2113993..f16f5b233d 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -1420,9 +1420,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); @@ -1495,7 +1495,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; @@ -1506,7 +1506,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; @@ -1528,9 +1528,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; @@ -1550,7 +1550,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) @@ -1605,7 +1605,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) @@ -1617,7 +1617,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; @@ -1634,8 +1634,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; @@ -1655,7 +1655,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) @@ -1681,11 +1681,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; @@ -1704,7 +1704,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) @@ -1749,9 +1749,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; @@ -1780,7 +1780,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) @@ -1809,7 +1809,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; @@ -1818,7 +1818,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 7ec5f869ec..9dbbfafb97 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -948,8 +948,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; @@ -1040,8 +1040,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; diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 9bbd7018ad..b7a57bdd34 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -1087,8 +1087,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); @@ -1136,7 +1136,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); @@ -1251,8 +1251,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)); @@ -1858,7 +1858,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); @@ -1895,7 +1895,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)); @@ -1948,7 +1948,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); @@ -2005,7 +2005,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)); @@ -2351,11 +2351,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; @@ -2400,8 +2400,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)); @@ -3213,7 +3213,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 975ed89432..5c5ce1bafd 100644 --- a/gdk/x11/gdkeventsource.c +++ b/gdk/x11/gdkeventsource.c @@ -136,9 +136,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_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_SCREEN (event->any.window)); + focus_in = (event->any.type == GDK_ENTER_NOTIFY); if (x11_screen->wmspec_check_window) return; @@ -159,12 +159,12 @@ 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)); - gdk_display_put_event (gdk_window_get_display (event->window), focus_event); + gdk_display_put_event (gdk_window_get_display (event->any.window), focus_event); gdk_event_free (focus_event); } } @@ -181,8 +181,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); @@ -359,7 +359,7 @@ gdk_event_source_translate_event (GdkX11Display *x11_display, 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); |