Merge branch 'event-types' into 'master'

Rework event types

Closes #2585

See merge request GNOME/gtk!1702
This commit is contained in:
Matthias Clasen 2020-04-16 20:36:24 +00:00
commit 60329c3cda
37 changed files with 2635 additions and 1906 deletions

View File

@ -299,8 +299,9 @@
in GTK 4. in GTK 4.
</para> </para>
<para> <para>
GdkEvent is now a strictly read-only boxed type, and you GdkEvent is now a strictly read-only type, and you
can no longer change any of its fields. can no longer change any of its fields, or construct new
events.
</para> </para>
</section> </section>
@ -308,7 +309,7 @@
<title>Stop using gdk_surface_set_event_compression</title> <title>Stop using gdk_surface_set_event_compression</title>
<para> <para>
Event compression is now always enabled. If you need to see the uncoalesced Event compression is now always enabled. If you need to see the uncoalesced
motion history, use gdk_event_get_motion_history(). motion history, use gdk_motion_event_get_history() on the latest motion event.
</para> </para>
</section> </section>
@ -318,8 +319,8 @@
Warping the pointer is disorienting and unfriendly to users. Warping the pointer is disorienting and unfriendly to users.
GTK 4 does not support it. In special circumstances (such as when GTK 4 does not support it. In special circumstances (such as when
implementing remote connection UIs) it can be necessary to implementing remote connection UIs) it can be necessary to
warp the pointer; in this case, use platform APIs such as XWarpPointer warp the pointer; in this case, use platform APIs such as
directly. <function>XWarpPointer()</function> directly.
</para> </para>
</section> </section>

View File

@ -100,7 +100,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface) if (surface)
{ {
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY, event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
surface, surface,
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
@ -119,7 +119,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface) if (surface)
{ {
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY, event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
surface, surface,
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
@ -141,7 +141,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface) if (surface)
{ {
event = gdk_event_motion_new (surface, event = gdk_motion_event_new (surface,
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
NULL, NULL,
@ -165,7 +165,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface) if (surface)
{ {
event = gdk_event_button_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS event = gdk_button_event_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS
? GDK_BUTTON_PRESS ? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE, : GDK_BUTTON_RELEASE,
surface, surface,
@ -188,7 +188,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface) if (surface)
{ {
event = gdk_event_discrete_scroll_new (surface, event = gdk_scroll_event_new_discrete (surface,
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
NULL, NULL,
@ -243,7 +243,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE) if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
state |= GDK_BUTTON1_MASK; state |= GDK_BUTTON1_MASK;
event = gdk_event_touch_new (event_type, event = gdk_touch_event_new (event_type,
GUINT_TO_POINTER (message->touch.sequence_id), GUINT_TO_POINTER (message->touch.sequence_id),
surface, surface,
gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat),
@ -271,7 +271,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
translated.consumed = 0; translated.consumed = 0;
translated.layout = 0; translated.layout = 0;
translated.level = 0; translated.level = 0;
event = gdk_event_key_new (message->base.type == BROADWAY_EVENT_KEY_PRESS event = gdk_key_event_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
? GDK_KEY_PRESS ? GDK_KEY_PRESS
: GDK_KEY_RELEASE, : GDK_KEY_RELEASE,
surface, surface,
@ -298,7 +298,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface) if (surface)
{ {
event = gdk_event_configure_new (surface, event = gdk_configure_event_new (surface,
message->configure_notify.width, message->configure_notify.width,
message->configure_notify.height); message->configure_notify.height);
@ -329,7 +329,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (surface) if (surface)
{ {
event = gdk_event_focus_new (surface, event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat), gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat), gdk_seat_get_keyboard (seat),
FALSE); FALSE);
@ -340,7 +340,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id)); surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (surface) if (surface)
{ {
event = gdk_event_focus_new (surface, event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat), gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat), gdk_seat_get_keyboard (seat),
TRUE); TRUE);

View File

@ -505,7 +505,7 @@ generate_grab_broken_event (GdkDisplay *display,
{ {
GdkEvent *event; GdkEvent *event;
event = gdk_event_grab_broken_new (surface, event = gdk_grab_broken_event_new (surface,
device, device,
device, device,
grab_surface, grab_surface,

View File

@ -915,12 +915,12 @@ gdk_drop_emit_enter_event (GdkDrop *self,
g_warn_if_fail (!priv->entered); g_warn_if_fail (!priv->entered);
event = gdk_event_drag_new (GDK_DRAG_ENTER, event = gdk_dnd_event_new (GDK_DRAG_ENTER,
priv->surface, priv->surface,
priv->device, priv->device,
self, self,
time, time,
0, 0); 0, 0);
priv->entered = TRUE; priv->entered = TRUE;
@ -939,12 +939,12 @@ gdk_drop_emit_motion_event (GdkDrop *self,
g_warn_if_fail (priv->entered); g_warn_if_fail (priv->entered);
event = gdk_event_drag_new (GDK_DRAG_MOTION, event = gdk_dnd_event_new (GDK_DRAG_MOTION,
priv->surface, priv->surface,
priv->device, priv->device,
self, self,
time, time,
x, y); x, y);
gdk_drop_do_emit_event (event, dont_queue); gdk_drop_do_emit_event (event, dont_queue);
} }
@ -959,12 +959,12 @@ gdk_drop_emit_leave_event (GdkDrop *self,
g_warn_if_fail (priv->entered); g_warn_if_fail (priv->entered);
event = gdk_event_drag_new (GDK_DRAG_LEAVE, event = gdk_dnd_event_new (GDK_DRAG_LEAVE,
priv->surface, priv->surface,
priv->device, priv->device,
self, self,
time, time,
0, 0); 0, 0);
priv->entered = FALSE; priv->entered = FALSE;
@ -984,12 +984,12 @@ gdk_drop_emit_drop_event (GdkDrop *self,
g_warn_if_fail (priv->entered); g_warn_if_fail (priv->entered);
g_warn_if_fail (priv->state == GDK_DROP_STATE_NONE); g_warn_if_fail (priv->state == GDK_DROP_STATE_NONE);
event = gdk_event_drag_new (GDK_DROP_START, event = gdk_dnd_event_new (GDK_DROP_START,
priv->surface, priv->surface,
priv->device, priv->device,
self, self,
time, time,
x, y); x, y);
priv->state = GDK_DROP_STATE_DROPPING; priv->state = GDK_DROP_STATE_DROPPING;

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,10 @@ G_BEGIN_DECLS
#define GDK_TYPE_EVENT (gdk_event_get_type ()) #define GDK_TYPE_EVENT (gdk_event_get_type ())
#define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ()) #define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ())
#define GDK_IS_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_EVENT))
#define GDK_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_EVENT, GdkEvent))
#define GDK_IS_EVENT_TYPE(event, type) (gdk_event_get_event_type ((event)) == (type))
/** /**
* GDK_PRIORITY_EVENTS: * GDK_PRIORITY_EVENTS:
@ -98,9 +102,38 @@ G_BEGIN_DECLS
*/ */
#define GDK_BUTTON_SECONDARY (3) #define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
typedef struct _GdkEventSequence GdkEventSequence; #define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
typedef union _GdkEvent GdkEvent; #define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
#define GDK_TYPE_FOCUS_EVENT (gdk_focus_event_get_type())
#define GDK_TYPE_GRAB_BROKEN_EVENT (gdk_grab_broken_event_get_type())
#define GDK_TYPE_KEY_EVENT (gdk_key_event_get_type())
#define GDK_TYPE_MOTION_EVENT (gdk_motion_event_get_type())
#define GDK_TYPE_PAD_EVENT (gdk_pad_event_get_type())
#define GDK_TYPE_PROXIMITY_EVENT (gdk_proximity_event_get_type())
#define GDK_TYPE_SCROLL_EVENT (gdk_scroll_event_get_type())
#define GDK_TYPE_TOUCH_EVENT (gdk_touch_event_get_type())
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
typedef struct _GdkButtonEvent GdkButtonEvent;
typedef struct _GdkConfigureEvent GdkConfigureEvent;
typedef struct _GdkCrossingEvent GdkCrossingEvent;
typedef struct _GdkDeleteEvent GdkDeleteEvent;
typedef struct _GdkDNDEvent GdkDNDEvent;
typedef struct _GdkFocusEvent GdkFocusEvent;
typedef struct _GdkGrabBrokenEvent GdkGrabBrokenEvent;
typedef struct _GdkKeyEvent GdkKeyEvent;
typedef struct _GdkMotionEvent GdkMotionEvent;
typedef struct _GdkPadEvent GdkPadEvent;
typedef struct _GdkProximityEvent GdkProximityEvent;
typedef struct _GdkScrollEvent GdkScrollEvent;
typedef struct _GdkTouchEvent GdkTouchEvent;
typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
/** /**
* GdkEventType: * GdkEventType:
@ -297,7 +330,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_event_get_type (void) G_GNUC_CONST; GType gdk_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_event_sequence_get_type (void) G_GNUC_CONST; GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
@ -348,9 +380,13 @@ gboolean gdk_event_get_axis (GdkEvent *event,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pointer_emulated (GdkEvent *event); gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_button_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
guint gdk_button_event_get_button (GdkEvent *event); guint gdk_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_scroll_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkScrollDirection gdk_scroll_event_get_direction (GdkEvent *event); GdkScrollDirection gdk_scroll_event_get_direction (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event, void gdk_scroll_event_get_deltas (GdkEvent *event,
@ -359,6 +395,8 @@ void gdk_scroll_event_get_deltas (GdkEvent *event,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event); gboolean gdk_scroll_event_is_stop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_key_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keyval (GdkEvent *event); guint gdk_key_event_get_keyval (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keycode (GdkEvent *event); guint gdk_key_event_get_keycode (GdkEvent *event);
@ -371,18 +409,30 @@ guint gdk_key_event_get_level (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_is_modifier (GdkEvent *event); gboolean gdk_key_event_is_modifier (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_focus_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_focus_event_get_in (GdkEvent *event); gboolean gdk_focus_event_get_in (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_touch_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_touch_event_get_emulating_pointer (GdkEvent *event); gboolean gdk_touch_event_get_emulating_pointer (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_crossing_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkCrossingMode gdk_crossing_event_get_mode (GdkEvent *event); GdkCrossingMode gdk_crossing_event_get_mode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event); GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_configure_event_get_size (GdkEvent *event, void gdk_configure_event_get_size (GdkEvent *event,
int *width, int *width,
int *height); int *height);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event); gdk_touchpad_event_get_gesture_phase (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
@ -392,26 +442,41 @@ void gdk_touchpad_event_get_deltas (GdkEvent *event,
double *dx, double *dx,
double *dy); double *dy);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
double gdk_touchpad_pinch_event_get_angle_delta (GdkEvent *event); double gdk_touchpad_event_get_pinch_angle_delta (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
double gdk_touchpad_pinch_event_get_scale (GdkEvent *event); double gdk_touchpad_event_get_pinch_scale (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
guint gdk_pad_button_event_get_button (GdkEvent *event); GType gdk_pad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_pad_axis_event_get_value (GdkEvent *event, guint gdk_pad_event_get_button (GdkEvent *event);
guint *index,
double *value);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_group_mode (GdkEvent *event, void gdk_pad_event_get_axis_value (GdkEvent *event,
guint *group, guint *index,
guint *mode); double *value);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_drag_event_get_drop (GdkEvent *event); void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
GType gdk_dnd_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_dnd_event_get_drop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_grab_broken_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_grab_broken_event_get_grab_surface (GdkEvent *event); GdkSurface * gdk_grab_broken_event_get_grab_surface (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_grab_broken_event_get_implicit (GdkEvent *event);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GList * gdk_event_get_motion_history (GdkEvent *event); GType gdk_motion_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GList * gdk_motion_event_get_history (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_delete_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gdk_proximity_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gdk_event_triggers_context_menu (GdkEvent *event); gboolean gdk_event_triggers_context_menu (GdkEvent *event);

View File

@ -30,74 +30,98 @@
#include <gdk/gdkdevice.h> #include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h> #include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny; #define GDK_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_EVENT, GdkEventClass))
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch;
typedef struct _GdkEventScroll GdkEventScroll;
typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
typedef struct _GdkEventPadButton GdkEventPadButton;
typedef struct _GdkEventPadAxis GdkEventPadAxis;
typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
/* typedef struct _GdkEventClass GdkEventClass;
* GdkEventAny:
* @type: the type of the event. /*< private >
* @surface: the surface which received the event. * GdkEvent:
* @send_event: %TRUE if the event was sent explicitly. * @ref_count: the reference count of the event
* @event_type: the specialized event type
* @surface: the surface of the event
* @device: the device of the event
* @source_device: the source device
* @time: a serial identifier of the event that can be used to order
* two events
* @flags: event flags
* *
* Contains the fields which are common to all event structs. * The abstract type for all windowing system events.
* Any event pointer can safely be cast to a pointer to a #GdkEventAny to
* access these fields.
*/ */
struct _GdkEventAny struct _GdkEvent
{ {
int ref_count; GTypeInstance parent_instance;
GdkEventType type;
grefcount ref_count;
/* Specialised event type */
GdkEventType event_type;
/* The surface of the event */
GdkSurface *surface; GdkSurface *surface;
guint32 time;
guint16 flags; /* The devices associated to the event */
guint pointer_emulated : 1;
guint touch_emulating : 1;
guint scroll_is_stop : 1;
guint key_is_modifier : 1;
guint focus_in : 1;
GdkDevice *device; GdkDevice *device;
GdkDevice *source_device; GdkDevice *source_device;
guint32 time;
guint16 flags;
};
/*< private >
* GdkEventClass:
* @finalize: a function called when the last reference held on an event is
* released; implementations of GdkEvent must chain up to the parent class
*
* The base class for events.
*/
struct _GdkEventClass
{
GTypeClass parent_class;
void (* finalize) (GdkEvent *event);
GdkModifierType (* get_state) (GdkEvent *event);
gboolean (* get_position) (GdkEvent *event,
double *x,
double *y);
GdkEventSequence * (* get_sequence) (GdkEvent *event);
GdkDeviceTool * (* get_tool) (GdkEvent *event);
gboolean (* get_axes) (GdkEvent *event,
double **axes,
guint *n_axes);
}; };
/* /*
* GdkEventMotion: * GdkDeleteEvent:
* @type: the type of the event. *
* @surface: the surface which received the event. * Generated when a surface is deleted.
* @send_event: %TRUE if the event was sent explicitly. */
* @time: the time of the event in milliseconds. struct _GdkDeleteEvent
{
GdkEvent parent_instance;
};
/*
* GdkMotionEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) set during the motion
* event. See #GdkModifierType.
* @x: the x coordinate of the pointer relative to the surface. * @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface. * @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse. * the mouse.
* @state: (type GdkModifierType): a bit-mask representing the state of * @history: (element-type GdkTimeCoord): a list of time and coordinates
* the modifier keys (e.g. Control, Shift and Alt) and the pointer * for other motion events that were compressed before delivering the
* buttons. See #GdkModifierType. * current event
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
* *
* Generated when the pointer moves. * Generated when the pointer moves.
*/ */
struct _GdkEventMotion struct _GdkMotionEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
double x; double x;
double y; double y;
@ -107,15 +131,7 @@ struct _GdkEventMotion
}; };
/* /*
* GdkEventButton: * GdkButtonEvent:
* @type: the type of the event (%GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @state: (type GdkModifierType): a bit-mask representing the state of * @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer * the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType. * buttons. See #GdkModifierType.
@ -123,16 +139,19 @@ struct _GdkEventMotion
* Normally button 1 is the left mouse button, 2 is the middle button, * 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 * and 3 is the right button. On 2-button mice, the middle button can
* often be simulated by pressing both mouse buttons together. * often be simulated by pressing both mouse buttons together.
* @device: the master device that the event originated from. Use * @x: the x coordinate of the pointer relative to the surface.
* gdk_event_get_source_device() to get the slave device. * @y: the y coordinate of the pointer relative to the surface.
* screen. * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @tool: a #GdkDeviceTool
* *
* Used for button press and button release events. The * Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE, * @type field will be one of %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE,
*/ */
struct _GdkEventButton struct _GdkButtonEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
guint button; guint button;
double x; double x;
@ -142,25 +161,16 @@ struct _GdkEventButton
}; };
/* /*
* GdkEventTouch: * GdkTouchEvent:
* @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
* %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse
* @state: (type GdkModifierType): a bit-mask representing the state of * @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer * the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType * buttons. See #GdkModifierType
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of the event's device, or %NULL
* if @device is the mouse
* @sequence: the event sequence that the event belongs to * @sequence: the event sequence that the event belongs to
* @emulating_pointer: whether the event should be used for emulating * @emulated: whether the event is the result of a pointer emulation
* pointer event
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen
* *
* Used for touch events. * Used for touch events.
* @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE, * @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
@ -173,22 +183,21 @@ struct _GdkEventButton
* (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be * (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
* several active sequences at the same time. * several active sequences at the same time.
*/ */
struct _GdkEventTouch struct _GdkTouchEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
double x; double x;
double y; double y;
double *axes; double *axes;
GdkEventSequence *sequence; GdkEventSequence *sequence;
gboolean touch_emulating;
gboolean pointer_emulated;
}; };
/* /*
* GdkEventScroll: * GdkScrollEvent:
* @type: the type of the event (%GDK_SCROLL).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface. * @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface. * @y: the y coordinate of the pointer relative to the surface.
* @state: (type GdkModifierType): a bit-mask representing the state of * @state: (type GdkModifierType): a bit-mask representing the state of
@ -197,10 +206,11 @@ struct _GdkEventTouch
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP, * @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or * %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
* %GDK_SCROLL_SMOOTH). * %GDK_SCROLL_SMOOTH).
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* @delta_x: the x coordinate of the scroll delta * @delta_x: the x coordinate of the scroll delta
* @delta_y: the y coordinate of the scroll delta * @delta_y: the y coordinate of the scroll delta
* @pointer_emulated: whether the scroll event was the result of
* a pointer emulation
* @tool: a #GdkDeviceTool
* *
* Generated from button presses for the buttons 4 to 7. Wheel mice are * Generated from button presses for the buttons 4 to 7. Wheel mice are
* usually configured to generate button press events for buttons 4 and 5 * usually configured to generate button press events for buttons 4 and 5
@ -211,18 +221,30 @@ struct _GdkEventTouch
* these, the scroll deltas can be obtained with * these, the scroll deltas can be obtained with
* gdk_event_get_scroll_deltas(). * gdk_event_get_scroll_deltas().
*/ */
struct _GdkEventScroll struct _GdkScrollEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
double x; double x;
double y; double y;
GdkModifierType state; GdkModifierType state;
GdkScrollDirection direction; GdkScrollDirection direction;
double delta_x; double delta_x;
double delta_y; double delta_y;
gboolean pointer_emulated;
gboolean is_stop;
GdkDeviceTool *tool; GdkDeviceTool *tool;
}; };
/*
* GdkTranslatedKey:
* @keyval: the translated key symbol
* @consumed: the consumed modifiers
* @layout: the keyboard layout
* @level: the layout level
*
* Describes a translated key code.
*/
typedef struct { typedef struct {
guint keyval; guint keyval;
GdkModifierType consumed; GdkModifierType consumed;
@ -231,11 +253,7 @@ typedef struct {
} GdkTranslatedKey; } GdkTranslatedKey;
/* /*
* GdkEventKey: * GdkKeyEvent:
* @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @state: (type GdkModifierType): a bit-mask representing the state of * @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer * the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType. * buttons. See #GdkModifierType.
@ -245,41 +263,40 @@ typedef struct {
* *
* Describes a key press or key release event. * Describes a key press or key release event.
*/ */
struct _GdkEventKey struct _GdkKeyEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
guint32 keycode; guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2]; GdkTranslatedKey translated[2];
}; };
/* /*
* GdkEventCrossing: * GdkCrossingEvent:
* @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY). * @state: (type GdkModifierType): a bit-mask representing the state of
* @surface: the surface which received the event. * the modifier keys (e.g. Control, Shift and Alt) and the pointer
* @send_event: %TRUE if the event was sent explicitly. * buttons. See #GdkModifierType.
* @child_surface: the surface that was entered or left.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB, * @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or * %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
* %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB, * %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
* and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized, * and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
* never native. * never native.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR, * @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
* %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or * %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
* %GDK_NOTIFY_NONLINEAR_VIRTUAL). * %GDK_NOTIFY_NONLINEAR_VIRTUAL).
* @focus: %TRUE if @surface is the focus surface or an inferior. * @focus: %TRUE if @surface is the focus surface or an inferior.
* @state: (type GdkModifierType): a bit-mask representing the state of * @child_surface: the surface that was entered or left.
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* *
* Generated when the pointer enters or leaves a surface. * Generated when the pointer enters or leaves a surface.
*/ */
struct _GdkEventCrossing struct _GdkCrossingEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
GdkCrossingMode mode; GdkCrossingMode mode;
double x; double x;
@ -290,10 +307,7 @@ struct _GdkEventCrossing
}; };
/* /*
* GdkEventFocus: * GdkFocusEvent:
* @type: the type of the event (%GDK_FOCUS_CHANGE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if * @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
* it has lost the focus. * it has lost the focus.
* @mode: the crossing mode * @mode: the crossing mode
@ -301,19 +315,15 @@ struct _GdkEventCrossing
* *
* Describes a change of keyboard focus. * Describes a change of keyboard focus.
*/ */
struct _GdkEventFocus struct _GdkFocusEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
gint16 in;
GdkCrossingMode mode; gboolean focus_in;
GdkNotifyType detail;
}; };
/* /*
* GdkEventConfigure: * GdkConfigureEvent:
* @type: the type of the event (%GDK_CONFIGURE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @x: the new x coordinate of the surface, relative to its parent. * @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent. * @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface. * @width: the new width of the surface.
@ -321,9 +331,10 @@ struct _GdkEventFocus
* *
* Generated when a surface size or position has changed. * Generated when a surface size or position has changed.
*/ */
struct _GdkEventConfigure struct _GdkConfigureEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
int x; int x;
int y; int y;
int width; int width;
@ -331,36 +342,23 @@ struct _GdkEventConfigure
}; };
/* /*
* GdkEventProximity: * GdkProximityEvent:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT). * @tool: the #GdkDeviceTool associated to the event
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* *
* Proximity events are generated when using GDKs wrapper for the * A proximity event indicates that a tool of a graphic tablet, or similar
* XInput extension. The XInput extension is an add-on for standard X * devices that report proximity, has moved in or out of contact with the
* that allows you to use nonstandard devices such as graphics tablets. * tablet, or perhaps that the users finger has moved in or out of contact
* A proximity event indicates that the stylus has moved in or out of * with a touch screen.
* contact with the tablet, or perhaps that the users 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.
*/ */
struct _GdkEventProximity struct _GdkProximityEvent
{ {
GdkEventAny any; GdkEvent parent_instance;
GdkDeviceTool *tool; GdkDeviceTool *tool;
}; };
/* /*
* GdkEventGrabBroken: * GdkGrabBrokenEvent:
* @type: the type of the event (%GDK_GRAB_BROKEN)
* @surface: the surface which received the event, i.e. the surface
* that previously owned the grab
* @send_event: %TRUE if the event was sent explicitly.
* @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer * @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
* grab was broken * grab was broken
* @implicit: %TRUE if the broken grab was implicit * @implicit: %TRUE if the broken grab was implicit
@ -372,67 +370,39 @@ struct _GdkEventProximity
* when the grab surface becomes unviewable (i.e. it or one of its ancestors * when the grab surface becomes unviewable (i.e. it or one of its ancestors
* is unmapped), or if the same application grabs the pointer or keyboard * is unmapped), or if the same application grabs the pointer or keyboard
* again. Note that implicit grabs (which are initiated by button presses) * again. Note that implicit grabs (which are initiated by button presses)
* can also cause #GdkEventGrabBroken events. * can also cause #GdkGrabBrokenEvent events.
*/ */
struct _GdkEventGrabBroken { struct _GdkGrabBrokenEvent
GdkEventAny any; {
GdkEvent parent_instance;
gboolean keyboard; gboolean keyboard;
gboolean implicit; gboolean implicit;
GdkSurface *grab_surface; GdkSurface *grab_surface;
}; };
/* /*
* GdkEventDND: * GdkDNDEvent:
* @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
* %GDK_DRAG_MOTION or %GDK_DROP_START)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @drop: the #GdkDrop for the current DND operation. * @drop: the #GdkDrop for the current DND operation.
* @time: the time of the event in milliseconds. * @x: the X coordinate of the pointer
* @y: the Y coordinate of the pointer
* *
* Generated during DND operations. * Generated during DND operations.
*/ */
struct _GdkEventDND { struct _GdkDNDEvent
GdkEventAny any; {
GdkEvent parent_instance;
GdkDrop *drop; GdkDrop *drop;
double x; double x;
double y; double y;
}; };
/* /*
* GdkEventTouchpadSwipe: * GdkTouchpadEvent:
* @type: the type of the event (%GDK_TOUCHPAD_SWIPE)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the swipe
* @time: the time of the event in milliseconds
* @x: The X coordinate of the pointer
* @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point
* @state: (type GdkModifierType): a bit-mask representing the state of * @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer * the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType. * buttons. See #GdkModifierType.
*
* Generated during touchpad swipe gestures.
*/
struct _GdkEventTouchpadSwipe {
GdkEventAny any;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
double x;
double y;
double dx;
double dy;
};
/*
* GdkEventTouchpadPinch:
* @type: the type of the event (%GDK_TOUCHPAD_PINCH)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture * @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the pinch * @n_fingers: The number of fingers triggering the pinch
* @time: the time of the event in milliseconds * @time: the time of the event in milliseconds
@ -440,18 +410,17 @@ struct _GdkEventTouchpadSwipe {
* @y: The Y coordinate of the pointer * @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point * @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point * @dy: Movement delta in the Y axis of the swipe focal point
* @angle_delta: The angle change in radians, negative angles * @angle_delta: For pinch events, the angle change in radians, negative angles
* denote counter-clockwise movements * denote counter-clockwise movements
* @scale: The current scale, relative to that at the time of * @scale: For pinch events, the current scale, relative to that at the time of
* the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event * the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* *
* Generated during touchpad swipe gestures. * Generated during touchpad gestures.
*/ */
struct _GdkEventTouchpadPinch { struct _GdkTouchpadEvent
GdkEventAny any; {
GdkEvent parent_instance;
GdkModifierType state; GdkModifierType state;
gint8 phase; gint8 phase;
gint8 n_fingers; gint8 n_fingers;
@ -463,99 +432,20 @@ struct _GdkEventTouchpadPinch {
double scale; double scale;
}; };
/* struct _GdkPadEvent
* GdkEventPadButton: {
* @type: the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_BUTTON_RELEASE). GdkEvent parent_instance;
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the button belongs to. A %GDK_SOURCE_TABLET_PAD device
* may have one or more groups containing a set of buttons/rings/strips each.
* @button: The pad button that was pressed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
*/
struct _GdkEventPadButton {
GdkEventAny any;
guint group;
guint button;
guint mode;
};
/*
* GdkEventPadAxis:
* @type: the type of the event (%GDK_PAD_RING or %GDK_PAD_STRIP).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the ring/strip belongs to. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @index: number of strip/ring that was interacted. This number is 0-indexed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
* @value: The current value for the given axis.
*
* Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
*/
struct _GdkEventPadAxis {
GdkEventAny any;
guint group; guint group;
guint index;
guint mode; guint mode;
guint button;
guint index;
double value; double value;
}; };
/* void gdk_event_init_types (void);
* GdkEventPadGroupMode:
* @type: the type of the event (%GDK_PAD_GROUP_MODE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group that is switching mode. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @mode: The new mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
*/
struct _GdkEventPadGroupMode {
GdkEventAny any;
guint group;
guint mode;
};
/* GdkEvent * gdk_button_event_new (GdkEventType type,
* GdkEvent:
*
* The GdkEvent struct is private and should only be accessed
* using the accessor functions.
*/
union _GdkEvent
{
GdkEventAny any;
GdkEventMotion motion;
GdkEventButton button;
GdkEventTouch touch;
GdkEventScroll scroll;
GdkEventKey key;
GdkEventCrossing crossing;
GdkEventFocus focus_change;
GdkEventConfigure configure;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventGrabBroken grab_broken;
GdkEventTouchpadSwipe touchpad_swipe;
GdkEventTouchpadPinch touchpad_pinch;
GdkEventPadButton pad_button;
GdkEventPadAxis pad_axis;
GdkEventPadGroupMode pad_group_mode;
};
GdkEvent * gdk_event_button_new (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
@ -567,7 +457,7 @@ GdkEvent * gdk_event_button_new (GdkEventType type,
double y, double y,
double *axes); double *axes);
GdkEvent * gdk_event_motion_new (GdkSurface *surface, GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
GdkDeviceTool *tool, GdkDeviceTool *tool,
@ -577,7 +467,7 @@ GdkEvent * gdk_event_motion_new (GdkSurface *surface,
double y, double y,
double *axes); double *axes);
GdkEvent * gdk_event_crossing_new (GdkEventType type, GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
@ -588,14 +478,14 @@ GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkCrossingMode mode, GdkCrossingMode mode,
GdkNotifyType notify); GdkNotifyType notify);
GdkEvent * gdk_event_proximity_new (GdkEventType type, GdkEvent * gdk_proximity_event_new (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
GdkDeviceTool *tool, GdkDeviceTool *tool,
guint32 time); guint32 time);
GdkEvent * gdk_event_key_new (GdkEventType type, GdkEvent * gdk_key_event_new (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
@ -606,18 +496,18 @@ GdkEvent * gdk_event_key_new (GdkEventType type,
GdkTranslatedKey *translated, GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock); GdkTranslatedKey *no_lock);
GdkEvent * gdk_event_focus_new (GdkSurface *surface, GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
gboolean focus_in); gboolean focus_in);
GdkEvent * gdk_event_configure_new (GdkSurface *surface, GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width, int width,
int height); int height);
GdkEvent * gdk_event_delete_new (GdkSurface *surface); GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_event_scroll_new (GdkSurface *surface, GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
GdkDeviceTool *tool, GdkDeviceTool *tool,
@ -627,7 +517,7 @@ GdkEvent * gdk_event_scroll_new (GdkSurface *surface,
double delta_y, double delta_y,
gboolean is_stop); gboolean is_stop);
GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface, GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
GdkDeviceTool *tool, GdkDeviceTool *tool,
@ -636,7 +526,7 @@ GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkScrollDirection direction, GdkScrollDirection direction,
gboolean emulated); gboolean emulated);
GdkEvent * gdk_event_touch_new (GdkEventType type, GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence, GdkEventSequence *sequence,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
@ -648,7 +538,7 @@ GdkEvent * gdk_event_touch_new (GdkEventType type,
double *axes, double *axes,
gboolean emulating); gboolean emulating);
GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface, GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time,
@ -660,7 +550,7 @@ GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
double dx, double dx,
double dy); double dy);
GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface, GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time,
@ -674,7 +564,7 @@ GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
double scale, double scale,
double angle_delta); double angle_delta);
GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface, GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time,
@ -683,7 +573,7 @@ GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
guint mode, guint mode,
double value); double value);
GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface, GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time,
@ -692,7 +582,7 @@ GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
guint mode, guint mode,
double value); double value);
GdkEvent * gdk_event_pad_button_new (GdkEventType type, GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
@ -701,14 +591,14 @@ GdkEvent * gdk_event_pad_button_new (GdkEventType type,
guint button, guint button,
guint mode); guint mode);
GdkEvent * gdk_event_pad_group_mode_new (GdkSurface *surface, GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time,
guint group, guint group,
guint mode); guint mode);
GdkEvent * gdk_event_drag_new (GdkEventType type, GdkEvent * gdk_dnd_event_new (GdkEventType type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDrop *drop, GdkDrop *drop,
@ -716,12 +606,12 @@ GdkEvent * gdk_event_drag_new (GdkEventType type,
double x, double x,
double y); double y);
GdkEvent * gdk_event_grab_broken_new (GdkSurface *surface, GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
GdkSurface *grab_surface, GdkSurface *grab_surface,
gboolean implicit); gboolean implicit);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */ #endif /* __GDK_EVENTS_PRIVATE_H__ */

View File

@ -530,13 +530,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0, 0,
g_signal_accumulator_true_handled, g_signal_accumulator_true_handled,
NULL, NULL,
_gdk_marshal_BOOLEAN__BOXED, _gdk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
1, 1,
GDK_TYPE_EVENT); GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT], g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
_gdk_marshal_BOOLEAN__BOXEDv); _gdk_marshal_BOOLEAN__POINTERv);
/** /**
* GdkSurface::enter-montor: * GdkSurface::enter-montor:
@ -2840,7 +2840,7 @@ add_event_mark (GdkEvent *event,
g_type_class_unref (class); g_type_class_unref (class);
kind = value ? value->value_nick : "event"; kind = value ? value->value_nick : "event";
switch (event_type) switch ((int) event_type)
{ {
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
{ {
@ -2932,8 +2932,11 @@ gdk_surface_handle_event (GdkEvent *event)
if (gdk_event_get_event_type (event) == GDK_CONFIGURE) if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{ {
int width, height;
gdk_configure_event_get_size (event, &width, &height);
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0, g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
event->configure.width, event->configure.height); width, height);
handled = TRUE; handled = TRUE;
} }
else else

View File

@ -589,7 +589,7 @@ emulate_crossing (GdkSurface *surface,
double x, y; double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, &state); gdk_surface_get_device_position (surface, device, &x, &y, &state);
event = gdk_event_crossing_new (type, event = gdk_crossing_event_new (type,
surface, surface,
device, device,
device, device,
@ -614,7 +614,7 @@ emulate_touch_crossing (GdkSurface *surface,
{ {
GdkEvent *event; GdkEvent *event;
event = gdk_event_crossing_new (type, event = gdk_crossing_event_new (type,
surface, surface,
device, device,
source, source,
@ -633,7 +633,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in, gboolean focus_in,
guint32 time_) guint32 time_)
{ {
GdkEvent *event = gdk_event_focus_new (surface, device, device, focus_in); GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event); _gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
} }
@ -1360,7 +1360,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source; GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source); source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_event_discrete_scroll_new (seat->pointer_info.focus, event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
source, source,
NULL, NULL,
@ -1382,7 +1382,7 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source; GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source); source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_event_scroll_new (seat->pointer_info.focus, event = gdk_scroll_event_new (seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
source, source,
NULL, NULL,
@ -1498,7 +1498,7 @@ pointer_handle_enter (void *data,
seat->pointer_info.surface_y = wl_fixed_to_double (sy); seat->pointer_info.surface_y = wl_fixed_to_double (sy);
seat->pointer_info.enter_serial = serial; seat->pointer_info.enter_serial = serial;
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY, event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
seat->pointer_info.focus, seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
@ -1541,7 +1541,7 @@ pointer_handle_leave (void *data,
_gdk_wayland_display_update_serial (display_wayland, serial); _gdk_wayland_display_update_serial (display_wayland, serial);
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY, event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
seat->pointer_info.focus, seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
@ -1586,7 +1586,7 @@ pointer_handle_motion (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (sx); seat->pointer_info.surface_x = wl_fixed_to_double (sx);
seat->pointer_info.surface_y = wl_fixed_to_double (sy); seat->pointer_info.surface_y = wl_fixed_to_double (sy);
event = gdk_event_motion_new (seat->pointer_info.focus, event = gdk_motion_event_new (seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
NULL, NULL,
@ -1649,7 +1649,7 @@ pointer_handle_button (void *data,
if (state) if (state)
seat->pointer_info.press_serial = serial; seat->pointer_info.press_serial = serial;
event = gdk_event_button_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE, event = gdk_button_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
seat->pointer_info.focus, seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
@ -1914,7 +1914,7 @@ keyboard_handle_enter (void *data,
g_object_ref (seat->keyboard_focus); g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0; seat->repeat_key = 0;
event = gdk_event_focus_new (seat->keyboard_focus, event = gdk_focus_event_new (seat->keyboard_focus,
seat->master_keyboard, seat->master_keyboard,
seat->keyboard, seat->keyboard,
TRUE); TRUE);
@ -1949,7 +1949,7 @@ keyboard_handle_leave (void *data,
_gdk_wayland_display_update_serial (display, serial); _gdk_wayland_display_update_serial (display, serial);
event = gdk_event_focus_new (seat->keyboard_focus, event = gdk_focus_event_new (seat->keyboard_focus,
seat->master_keyboard, seat->master_keyboard,
seat->keyboard, seat->keyboard,
FALSE); FALSE);
@ -2075,7 +2075,7 @@ deliver_key_event (GdkWaylandSeat *seat,
no_lock = translated; no_lock = translated;
} }
event = gdk_event_key_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE, event = gdk_key_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
seat->keyboard_focus, seat->keyboard_focus,
seat->master_keyboard, seat->master_keyboard,
seat->keyboard, seat->keyboard,
@ -2375,7 +2375,7 @@ touch_handle_down (void *data,
touch->y = wl_fixed_to_double (y); touch->y = wl_fixed_to_double (y);
touch->touch_down_serial = serial; touch->touch_down_serial = serial;
event = gdk_event_touch_new (GDK_TOUCH_BEGIN, event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id), GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface, touch->surface,
seat->touch_master, seat->touch_master,
@ -2418,7 +2418,7 @@ touch_handle_up (void *data,
_gdk_wayland_display_update_serial (display, serial); _gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_seat_get_touch (seat, id); touch = gdk_wayland_seat_get_touch (seat, id);
event = gdk_event_touch_new (GDK_TOUCH_END, event = gdk_touch_event_new (GDK_TOUCH_END,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id), GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface, touch->surface,
seat->touch_master, seat->touch_master,
@ -2463,7 +2463,7 @@ touch_handle_motion (void *data,
if (touch->initial_touch) if (touch->initial_touch)
mimic_pointer_emulating_touch_info (seat->touch_master, touch); mimic_pointer_emulating_touch_info (seat->touch_master, touch);
event = gdk_event_touch_new (GDK_TOUCH_UPDATE, event = gdk_touch_event_new (GDK_TOUCH_UPDATE,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id), GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface, touch->surface,
seat->touch_master, seat->touch_master,
@ -2509,7 +2509,7 @@ touch_handle_cancel (void *data,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch)) while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{ {
event = gdk_event_touch_new (GDK_TOUCH_CANCEL, event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id), GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface, touch->surface,
seat->touch_master, seat->touch_master,
@ -2541,7 +2541,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time; seat->pointer_info.time = _time;
event = gdk_event_touchpad_swipe_new (seat->pointer_info.focus, event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
_time, _time,
@ -2638,7 +2638,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time; seat->pointer_info.time = _time;
event = gdk_event_touchpad_pinch_new (seat->pointer_info.focus, event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
seat->master_pointer, seat->master_pointer,
seat->pointer, seat->pointer,
_time, _time,
@ -3469,7 +3469,7 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_device_tablet_clone_tool_axes (tablet, tool->tool); gdk_wayland_device_tablet_clone_tool_axes (tablet, tool->tool);
gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device); gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device);
event = gdk_event_proximity_new (GDK_PROXIMITY_IN, event = gdk_proximity_event_new (GDK_PROXIMITY_IN,
tablet->pointer_info.focus, tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
@ -3500,7 +3500,7 @@ tablet_tool_handle_proximity_out (void *data,
g_message ("proximity out, seat %p, tool %d", tool->seat, g_message ("proximity out, seat %p, tool %d", tool->seat,
gdk_device_tool_get_tool_type (tool->tool))); gdk_device_tool_get_tool_type (tool->tool)));
event = gdk_event_proximity_new (GDK_PROXIMITY_OUT, event = gdk_proximity_event_new (GDK_PROXIMITY_OUT,
tablet->pointer_info.focus, tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
@ -3537,7 +3537,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat); GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event; GdkEvent *event;
event = gdk_event_button_new (evtype, event = gdk_button_event_new (evtype,
tablet->pointer_info.focus, tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
@ -3603,7 +3603,7 @@ tablet_tool_handle_motion (void *data,
tablet->pointer_info.surface_x, tablet->pointer_info.surface_x,
tablet->pointer_info.surface_y)); tablet->pointer_info.surface_y));
event = gdk_event_motion_new (tablet->pointer_info.focus, event = gdk_motion_event_new (tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
tool->tool, tool->tool,
@ -3765,7 +3765,7 @@ tablet_tool_handle_wheel (void *data,
return; return;
/* Send smooth event */ /* Send smooth event */
event = gdk_event_scroll_new (tablet->pointer_info.focus, event = gdk_scroll_event_new (tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
tablet->current_tool->tool, tablet->current_tool->tool,
@ -3777,7 +3777,7 @@ tablet_tool_handle_wheel (void *data,
_gdk_wayland_display_deliver_event (seat->display, event); _gdk_wayland_display_deliver_event (seat->display, event);
/* Send discrete event */ /* Send discrete event */
event = gdk_event_discrete_scroll_new (tablet->pointer_info.focus, event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
tablet->master, tablet->master,
tablet->current_device, tablet->current_device,
tablet->current_tool->tool, tablet->current_tool->tool,
@ -3888,7 +3888,7 @@ tablet_pad_ring_handle_frame (void *data,
GDK_SEAT_NOTE (seat, EVENTS, GDK_SEAT_NOTE (seat, EVENTS,
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring)); g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
event = gdk_event_pad_ring_new (seat->keyboard_focus, event = gdk_pad_event_new_ring (seat->keyboard_focus,
pad->device, pad->device,
pad->device, pad->device,
time, time,
@ -3963,7 +3963,7 @@ tablet_pad_strip_handle_frame (void *data,
g_message ("tablet pad strip handle frame, strip = %p", g_message ("tablet pad strip handle frame, strip = %p",
wp_tablet_pad_strip)); wp_tablet_pad_strip));
event = gdk_event_pad_strip_new (seat->keyboard_focus, event = gdk_pad_event_new_strip (seat->keyboard_focus,
pad->device, pad->device,
pad->device, pad->device,
time, time,
@ -4089,7 +4089,7 @@ tablet_pad_group_handle_mode (void *data,
group->current_mode = mode; group->current_mode = mode;
n_group = g_list_index (pad->mode_groups, group); n_group = g_list_index (pad->mode_groups, group);
event = gdk_event_pad_group_mode_new (seat->keyboard_focus, event = gdk_pad_event_new_group_mode (seat->keyboard_focus,
pad->device, pad->device,
pad->device, pad->device,
time, time,
@ -4201,7 +4201,7 @@ tablet_pad_handle_button (void *data,
g_assert (group != NULL); g_assert (group != NULL);
n_group = g_list_index (pad->mode_groups, group); n_group = g_list_index (pad->mode_groups, group);
event = gdk_event_pad_button_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED event = gdk_pad_event_new_button (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
? GDK_PAD_BUTTON_PRESS ? GDK_PAD_BUTTON_PRESS
: GDK_PAD_BUTTON_RELEASE, : GDK_PAD_BUTTON_RELEASE,
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus, GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
@ -5031,7 +5031,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GDK_CURRENT_TIME); GDK_CURRENT_TIME);
} }
event = gdk_event_touch_new (GDK_TOUCH_CANCEL, event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id), GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface, touch->surface,
seat->touch_master, seat->touch_master,

View File

@ -891,7 +891,7 @@ gdk_wayland_surface_resize (GdkSurface *surface,
GdkDisplay *display; GdkDisplay *display;
GdkEvent *event; GdkEvent *event;
event = gdk_event_configure_new (surface, width, height); event = gdk_configure_event_new (surface, width, height);
gdk_wayland_surface_update_size (surface, width, height, scale); gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface); _gdk_surface_update_size (surface);
@ -1461,7 +1461,7 @@ gdk_wayland_surface_handle_close (GdkSurface *surface)
GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface)); GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface));
event = gdk_event_delete_new (surface); event = gdk_delete_event_new (surface);
_gdk_wayland_display_deliver_event (display, event); _gdk_wayland_display_deliver_event (display, event);
} }
@ -3817,7 +3817,8 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
double x, y; double x, y;
uint32_t serial; uint32_t serial;
switch ((guint) event->any.type) GdkEventType event_type = gdk_event_get_event_type (event);
switch ((guint) event_type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:

View File

@ -1063,7 +1063,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK)); | GDK_BUTTON5_MASK));
event = gdk_event_button_new (event_type, event = gdk_button_event_new (event_type,
window, window,
device_manager->core_pointer, device_manager->core_pointer,
GDK_DEVICE (source_device), GDK_DEVICE (source_device),
@ -1077,10 +1077,11 @@ gdk_input_other_event (GdkDisplay *display,
GDK_NOTE (EVENTS_OR_INPUT, GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB button %s:%d %g,%g\n", g_print ("WINTAB button %s:%d %g,%g\n",
(event->any.type == GDK_BUTTON_PRESS ? (event->event_type == GDK_BUTTON_PRESS ?
"press" : "release"), "press" : "release"),
event->button.button, ((GdkButtonEvent *) event)->button,
event->button.x, event->button.y)); ((GdkButtonEvent *) event)->x,
((GdkButtonEvent *) event)->y));
} }
else else
{ {
@ -1097,7 +1098,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK)); | GDK_BUTTON5_MASK));
event = gdk_event_motion_new (window, event = gdk_motion_event_new (window,
device_manager->core_pointer, device_manager->core_pointer,
GDK_DEVICE (source_device), GDK_DEVICE (source_device),
NULL, NULL,
@ -1108,7 +1109,8 @@ gdk_input_other_event (GdkDisplay *display,
axes); axes);
GDK_NOTE (EVENTS_OR_INPUT, GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB motion: %g,%g\n", g_print ("WINTAB motion: %g,%g\n",
event->motion.x, event->motion.y)); ((GdkMotionEvent *) event)->x,
((GdkMotionEvent *) event)->y));
} }
return event; return event;

View File

@ -2515,7 +2515,8 @@ gdk_win32_drag_handle_event (GdkDrag *drag,
if (!drag_win32->handle_events) if (!drag_win32->handle_events)
{ {
/* FIXME: remove this functionality once gtk no longer calls DnD after drag_done() */ /* FIXME: remove this functionality once gtk no longer calls DnD after drag_done() */
g_warning ("Got an event %d for drag context %p, even though it's done!", event->any.type, drag); g_warning ("Got an event %d for drag context %p, even though it's done!",
event->event_type, drag);
return FALSE; return FALSE;
} }

View File

@ -207,7 +207,7 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_keyboard; device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_keyboard;
source_device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->system_keyboard; source_device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->system_keyboard;
event = gdk_event_focus_new (window, device, source_device, in); event = gdk_focus_event_new (window, device, source_device, in);
_gdk_win32_append_event (event); _gdk_win32_append_event (event);
} }
@ -233,7 +233,7 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
source_device = device_manager->system_pointer; source_device = device_manager->system_pointer;
} }
event = gdk_event_grab_broken_new (window, event = gdk_grab_broken_event_new (window,
device, device,
source_device, source_device,
grab_window, grab_window,
@ -885,12 +885,8 @@ decode_key_lparam (LPARAM lParam)
static void static void
fixup_event (GdkEvent *event) fixup_event (GdkEvent *event)
{ {
if (event->any.surface) if (event->surface)
g_object_ref (event->any.surface); g_object_ref (event->surface);
if (((event->any.type == GDK_ENTER_NOTIFY) ||
(event->any.type == GDK_LEAVE_NOTIFY)) &&
(event->crossing.child_surface != NULL))
g_object_ref (event->crossing.child_surface);
} }
void void
@ -1080,7 +1076,7 @@ send_crossing_event (GdkDisplay *display,
pt = *screen_pt; pt = *screen_pt;
ScreenToClient (GDK_SURFACE_HWND (window), &pt); ScreenToClient (GDK_SURFACE_HWND (window), &pt);
event = gdk_event_crossing_new (type, event = gdk_crossing_event_new (type,
window, window,
device_manager->core_pointer, device_manager->core_pointer,
device_manager->system_pointer, device_manager->system_pointer,
@ -1589,7 +1585,7 @@ generate_button_event (GdkEventType type,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale; current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale; current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_event_button_new (type, event = gdk_button_event_new (type,
window, window,
device_manager->core_pointer, device_manager->core_pointer,
device_manager->system_pointer, device_manager->system_pointer,
@ -2133,7 +2129,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0; translated.consumed = 0;
translated.layout = 0; translated.layout = 0;
translated.level = 0; translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS, event = gdk_key_event_new (GDK_KEY_PRESS,
window, window,
device_manager_win32->core_keyboard, device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard, device_manager_win32->system_keyboard,
@ -2336,7 +2332,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0; translated.consumed = 0;
translated.layout = group; translated.layout = group;
translated.level = 0; translated.level = 0;
event = gdk_event_key_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN) event = gdk_key_event_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
? GDK_KEY_PRESS ? GDK_KEY_PRESS
: GDK_KEY_RELEASE, : GDK_KEY_RELEASE,
window, window,
@ -2413,7 +2409,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0; translated.consumed = 0;
translated.layout = get_active_group (); translated.layout = get_active_group ();
translated.level = 0; translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS, event = gdk_key_event_new (GDK_KEY_PRESS,
window, window,
device_manager_win32->core_keyboard, device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard, device_manager_win32->system_keyboard,
@ -2427,7 +2423,7 @@ gdk_event_translate (MSG *msg,
_gdk_win32_append_event (event); _gdk_win32_append_event (event);
/* Build a key release event. */ /* Build a key release event. */
event = gdk_event_key_new (GDK_KEY_RELEASE, event = gdk_key_event_new (GDK_KEY_RELEASE,
window, window,
device_manager_win32->core_keyboard, device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard, device_manager_win32->system_keyboard,
@ -2641,7 +2637,7 @@ gdk_event_translate (MSG *msg,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale; current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale; current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_event_motion_new (window, event = gdk_motion_event_new (window,
device_manager_win32->core_pointer, device_manager_win32->core_pointer,
device_manager_win32->system_pointer, device_manager_win32->system_pointer,
NULL, NULL,
@ -2767,7 +2763,7 @@ gdk_event_translate (MSG *msg,
*/ */
delta_y *= -1.0; delta_y *= -1.0;
event = gdk_event_scroll_new (window, event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer, device_manager_win32->core_pointer,
device_manager_win32->system_pointer, device_manager_win32->system_pointer,
NULL, NULL,
@ -2790,7 +2786,7 @@ gdk_event_translate (MSG *msg,
? GDK_SCROLL_RIGHT ? GDK_SCROLL_RIGHT
: GDK_SCROLL_LEFT; : GDK_SCROLL_LEFT;
event = gdk_event_discrete_scroll_new (window, event = gdk_scroll_event_new_discrete (window,
device_manager_win32->core_pointer, device_manager_win32->core_pointer,
device_manager_win32->system_pointer, device_manager_win32->system_pointer,
NULL, NULL,
@ -3425,7 +3421,7 @@ gdk_event_translate (MSG *msg,
if (GDK_SURFACE_DESTROYED (window)) if (GDK_SURFACE_DESTROYED (window))
break; break;
event = gdk_event_delete_new (window); event = gdk_delete_event_new (window);
_gdk_win32_append_event (event); _gdk_win32_append_event (event);
@ -3459,7 +3455,7 @@ gdk_event_translate (MSG *msg,
if (window == NULL || GDK_SURFACE_DESTROYED (window)) if (window == NULL || GDK_SURFACE_DESTROYED (window))
break; break;
event = gdk_event_delete_new (window); event = gdk_delete_event_new (window);
_gdk_win32_append_event (event); _gdk_win32_append_event (event);

View File

@ -4462,7 +4462,7 @@ gdk_win32_surface_show_window_menu (GdkSurface *window,
gint x, y; gint x, y;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window); GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
switch (event->any.type) switch ((int) event->event_type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:

View File

@ -1448,7 +1448,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
{ {
GdkEvent *event; GdkEvent *event;
event = gdk_event_focus_new (surface, device, source_device, focus_in); event = gdk_focus_event_new (surface, device, source_device, focus_in);
gdk_display_put_event (gdk_surface_get_display (surface), event); gdk_display_put_event (gdk_surface_get_display (surface), event);
gdk_event_unref (event); gdk_event_unref (event);
} }
@ -1584,7 +1584,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
{ {
no_lock = translated; no_lock = translated;
} }
event = gdk_event_key_new (xev->evtype == XI_KeyPress event = gdk_key_event_new (xev->evtype == XI_KeyPress
? GDK_KEY_PRESS ? GDK_KEY_PRESS
: GDK_KEY_RELEASE, : GDK_KEY_RELEASE,
surface, surface,
@ -1654,7 +1654,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
source_device = g_hash_table_lookup (device_manager->id_table, source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid)); GUINT_TO_POINTER (xev->sourceid));
event = gdk_event_discrete_scroll_new (surface, event = gdk_scroll_event_new_discrete (surface,
device, device,
source_device, source_device,
NULL, NULL,
@ -1684,7 +1684,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale; x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale; y = (double) xev->event_y / scale;
event = gdk_event_button_new (ev->evtype == XI_ButtonPress event = gdk_button_event_new (ev->evtype == XI_ButtonPress
? GDK_BUTTON_PRESS ? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE, : GDK_BUTTON_RELEASE,
surface, surface,
@ -1739,7 +1739,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
xev->deviceid, xev->sourceid, xev->deviceid, xev->sourceid,
xev->event, delta_x, delta_y)); xev->event, delta_x, delta_y));
event = gdk_event_scroll_new (surface, event = gdk_scroll_event_new (surface,
device, device,
source_device, source_device,
NULL, NULL,
@ -1760,7 +1760,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale; x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale; y = (double) xev->event_y / scale;
event = gdk_event_motion_new (surface, event = gdk_motion_event_new (surface,
device, device,
source_device, source_device,
source_device->last_tool, source_device->last_tool,
@ -1808,7 +1808,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale; x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale; y = (double) xev->event_y / scale;
event = gdk_event_touch_new (ev->evtype == XI_TouchBegin event = gdk_touch_event_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN ? GDK_TOUCH_BEGIN
: GDK_TOUCH_END, : GDK_TOUCH_END,
GUINT_TO_POINTER (xev->detail), GUINT_TO_POINTER (xev->detail),
@ -1858,7 +1858,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale; x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale; y = (double) xev->event_y / scale;
event = gdk_event_touch_new (GDK_TOUCH_UPDATE, event = gdk_touch_event_new (GDK_TOUCH_UPDATE,
GUINT_TO_POINTER (xev->detail), GUINT_TO_POINTER (xev->detail),
surface, surface,
device, device,
@ -1911,7 +1911,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
} }
} }
event = gdk_event_crossing_new (ev->evtype == XI_Enter event = gdk_crossing_event_new (ev->evtype == XI_Enter
? GDK_ENTER_NOTIFY ? GDK_ENTER_NOTIFY
: GDK_LEAVE_NOTIFY, : GDK_LEAVE_NOTIFY,
surface, surface,

View File

@ -799,7 +799,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (!is_substructure) if (!is_substructure)
{ {
event = gdk_event_delete_new (surface); event = gdk_delete_event_new (surface);
if (surface && GDK_SURFACE_XID (surface) != x11_screen->xroot_window) if (surface && GDK_SURFACE_XID (surface) != x11_screen->xroot_window)
gdk_surface_destroy_notify (surface); gdk_surface_destroy_notify (surface);
@ -918,10 +918,10 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
xevent->xconfigure.event == xevent->xconfigure.window) xevent->xconfigure.event == xevent->xconfigure.window)
{ {
int x, y; int x, y;
int c_w = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
int c_h = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
event = gdk_event_configure_new (surface, event = gdk_configure_event_new (surface, c_w, c_h);
(xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale,
(xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale);
if (!xevent->xconfigure.send_event && if (!xevent->xconfigure.send_event &&
!xevent->xconfigure.override_redirect && !xevent->xconfigure.override_redirect &&
@ -974,8 +974,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
{ {
surface_impl->unscaled_width = xevent->xconfigure.width; surface_impl->unscaled_width = xevent->xconfigure.width;
surface_impl->unscaled_height = xevent->xconfigure.height; surface_impl->unscaled_height = xevent->xconfigure.height;
surface->width = event->configure.width; gdk_configure_event_get_size (event, &surface->width, &surface->height);
surface->height = event->configure.height;
_gdk_surface_update_size (surface); _gdk_surface_update_size (surface);
_gdk_x11_surface_update_size (surface_impl); _gdk_x11_surface_update_size (surface_impl);
@ -1252,19 +1251,19 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW")) if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW"))
{ {
/* The delete window request specifies a window /* The delete window request specifies a window
* to delete. We don't actually destroy the * to delete. We don't actually destroy the
* window because "it is only a request". (The * window because "it is only a request". (The
* window might contain vital data that the * window might contain vital data that the
* program does not want destroyed). Instead * program does not want destroyed). Instead
* the event is passed along to the program, * the event is passed along to the program,
* which should then destroy the window. * which should then destroy the window.
*/ */
GDK_DISPLAY_NOTE (display, EVENTS, GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("delete window:\t\twindow: %ld", g_message ("delete window:\t\twindow: %ld",
xevent->xclient.window)); xevent->xclient.window));
*event = gdk_event_delete_new (win); *event = gdk_delete_event_new (win);
gdk_x11_surface_set_user_time (win, xevent->xclient.data.l[1]); gdk_x11_surface_set_user_time (win, xevent->xclient.data.l[1]);

View File

@ -1023,7 +1023,7 @@ send_client_message_async (GdkDrag *drag,
static void static void
xdnd_send_xevent (GdkX11Drag *drag_x11, xdnd_send_xevent (GdkX11Drag *drag_x11,
XEvent *event_send) XEvent *event_send)
{ {
GdkDrag *drag = GDK_DRAG (drag_x11); GdkDrag *drag = GDK_DRAG (drag_x11);
GdkDisplay *display = gdk_drag_get_display (drag); GdkDisplay *display = gdk_drag_get_display (drag);
@ -2184,15 +2184,15 @@ gdk_drag_update (GdkDrag *drag,
} }
static gboolean static gboolean
gdk_dnd_handle_motion_event (GdkDrag *drag, gdk_dnd_handle_motion_event (GdkDrag *drag,
GdkEvent *event) GdkEvent *event)
{ {
double x, y; double x, y;
int x_root, y_root; int x_root, y_root;
gdk_event_get_position (event, &x, &y); gdk_event_get_position (event, &x, &y);
x_root = event->any.surface->x + x; x_root = event->surface->x + x;
y_root = event->any.surface->y + y; y_root = event->surface->y + y;
gdk_drag_update (drag, x_root, y_root, gdk_drag_update (drag, x_root, y_root,
gdk_event_get_modifier_state (event), gdk_event_get_modifier_state (event),
gdk_event_get_time (event)); gdk_event_get_time (event));
@ -2200,8 +2200,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
} }
static gboolean static gboolean
gdk_dnd_handle_key_event (GdkDrag *drag, gdk_dnd_handle_key_event (GdkDrag *drag,
GdkEventKey *event) GdkEvent *event)
{ {
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag); GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkModifierType state; GdkModifierType state;
@ -2209,12 +2209,14 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
gint dx, dy; gint dx, dy;
dx = dy = 0; dx = dy = 0;
state = event->state; state = gdk_event_get_modifier_state (event);
pointer = gdk_device_get_associated_device (gdk_event_get_device ((GdkEvent *) event)); pointer = gdk_device_get_associated_device (gdk_event_get_device (event));
if (event->any.type == GDK_KEY_PRESS) if (event->event_type == GDK_KEY_PRESS)
{ {
switch (event->translated[0].keyval) guint keyval = gdk_key_event_get_keyval (event);
switch (keyval)
{ {
case GDK_KEY_Escape: case GDK_KEY_Escape:
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
@ -2287,37 +2289,40 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
} }
gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state, gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,
gdk_event_get_time ((GdkEvent *) event)); gdk_event_get_time (event));
return TRUE; return TRUE;
} }
static gboolean static gboolean
gdk_dnd_handle_grab_broken_event (GdkDrag *drag, gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
GdkEventGrabBroken *event) GdkEvent *event)
{ {
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag); GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
gboolean is_implicit = gdk_grab_broken_event_get_implicit (event);
GdkSurface *grab_surface = gdk_grab_broken_event_get_grab_surface (event);
/* Don't cancel if we break the implicit grab from the initial button_press. /* Don't cancel if we break the implicit grab from the initial button_press.
* Also, don't cancel if we re-grab on the widget or on our IPC window, for * Also, don't cancel if we re-grab on the widget or on our IPC window, for
* example, when changing the drag cursor. * example, when changing the drag cursor.
*/ */
if (event->implicit || if (is_implicit ||
event->grab_surface == x11_drag->drag_surface || grab_surface == x11_drag->drag_surface ||
event->grab_surface == x11_drag->ipc_surface) grab_surface == x11_drag->ipc_surface)
return FALSE; return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) != if (gdk_event_get_device (event) != gdk_drag_get_device (drag))
gdk_drag_get_device (drag))
return FALSE; return FALSE;
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE; return TRUE;
} }
static gboolean static gboolean
gdk_dnd_handle_button_event (GdkDrag *drag, gdk_dnd_handle_button_event (GdkDrag *drag,
GdkEventButton *event) GdkEvent *event)
{ {
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag); GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
@ -2347,17 +2352,21 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
if (!x11_drag->grab_seat) if (!x11_drag->grab_seat)
return FALSE; return FALSE;
switch ((guint) event->any.type) switch ((guint) event->event_type)
{ {
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
return gdk_dnd_handle_motion_event (drag, event); return gdk_dnd_handle_motion_event (drag, event);
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
return gdk_dnd_handle_button_event (drag, &event->button); return gdk_dnd_handle_button_event (drag, event);
case GDK_KEY_PRESS: case GDK_KEY_PRESS:
case GDK_KEY_RELEASE: case GDK_KEY_RELEASE:
return gdk_dnd_handle_key_event (drag, &event->key); return gdk_dnd_handle_key_event (drag, event);
case GDK_GRAB_BROKEN: case GDK_GRAB_BROKEN:
return gdk_dnd_handle_grab_broken_event (drag, &event->grab_broken); return gdk_dnd_handle_grab_broken_event (drag, event);
default: default:
break; break;
} }

View File

@ -105,7 +105,7 @@ handle_focus_change (GdkEvent *event)
toplevel->has_pointer = focus_in; toplevel->has_pointer = focus_in;
if (!event->crossing.focus || toplevel->has_focus_window) if (!gdk_crossing_event_get_focus (event) || toplevel->has_focus_window)
return; return;
had_focus = HAS_FOCUS (toplevel); had_focus = HAS_FOCUS (toplevel);
@ -115,7 +115,7 @@ handle_focus_change (GdkEvent *event)
{ {
GdkEvent *focus_event; GdkEvent *focus_event;
focus_event = gdk_event_focus_new (gdk_event_get_surface (event), focus_event = gdk_focus_event_new (gdk_event_get_surface (event),
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
focus_in); focus_in);
@ -135,7 +135,7 @@ create_synth_crossing_event (GdkEventType evtype,
g_assert (evtype == GDK_ENTER_NOTIFY || evtype == GDK_LEAVE_NOTIFY); g_assert (evtype == GDK_ENTER_NOTIFY || evtype == GDK_LEAVE_NOTIFY);
gdk_event_get_position (real_event, &x, &y); gdk_event_get_position (real_event, &x, &y);
event = gdk_event_crossing_new (evtype, event = gdk_crossing_event_new (evtype,
gdk_event_get_surface (real_event), gdk_event_get_surface (real_event),
gdk_event_get_device (real_event), gdk_event_get_device (real_event),
gdk_event_get_source_device (real_event), gdk_event_get_source_device (real_event),

View File

@ -4574,7 +4574,9 @@ gdk_x11_surface_show_window_menu (GdkSurface *surface,
int x_root, y_root; int x_root, y_root;
XClientMessageEvent xclient = { 0 }; XClientMessageEvent xclient = { 0 };
switch ((guint) event->any.type) GdkEventType event_type = gdk_event_get_event_type (event);
switch ((guint) event_type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:

View File

@ -384,7 +384,7 @@ gtk_drop_target_handle_event (GtkEventController *controller,
GdkDragAction preferred; GdkDragAction preferred;
/* sanity check */ /* sanity check */
g_return_val_if_fail (self->drop == gdk_drag_event_get_drop (event), FALSE); g_return_val_if_fail (self->drop == gdk_dnd_event_get_drop (event), FALSE);
graphene_point_init (&self->coords, x, y); graphene_point_init (&self->coords, x, y);
g_signal_emit (self, signals[MOTION], 0, x, y, &preferred); g_signal_emit (self, signals[MOTION], 0, x, y, &preferred);
@ -403,7 +403,7 @@ gtk_drop_target_handle_event (GtkEventController *controller,
case GDK_DROP_START: case GDK_DROP_START:
{ {
/* sanity check */ /* sanity check */
g_return_val_if_fail (self->drop == gdk_drag_event_get_drop (event), FALSE); g_return_val_if_fail (self->drop == gdk_dnd_event_get_drop (event), FALSE);
graphene_point_init (&self->coords, x, y); graphene_point_init (&self->coords, x, y);
self->dropping = TRUE; self->dropping = TRUE;

View File

@ -220,7 +220,7 @@ gtk_drop_target_async_handle_event (GtkEventController *controller,
GtkWidget *widget = gtk_event_controller_get_widget (controller); GtkWidget *widget = gtk_event_controller_get_widget (controller);
GdkDragAction preferred_action; GdkDragAction preferred_action;
drop = gdk_drag_event_get_drop (event); drop = gdk_dnd_event_get_drop (event);
/* sanity check */ /* sanity check */
g_return_val_if_fail (self->drop == drop, FALSE); g_return_val_if_fail (self->drop == drop, FALSE);
if (self->rejected) if (self->rejected)
@ -243,7 +243,7 @@ gtk_drop_target_async_handle_event (GtkEventController *controller,
{ {
gboolean handled; gboolean handled;
drop = gdk_drag_event_get_drop (event); drop = gdk_dnd_event_get_drop (event);
/* sanity check */ /* sanity check */
g_return_val_if_fail (self->drop == drop, FALSE); g_return_val_if_fail (self->drop == drop, FALSE);
if (self->rejected) if (self->rejected)

View File

@ -542,7 +542,7 @@ gtk_event_controller_get_target (GtkEventController *controller)
* Returns the event that is currently being handled by the * Returns the event that is currently being handled by the
* controller, and %NULL at other times. * controller, and %NULL at other times.
* *
* Returns: (nullable) the event is current handled by @controller * Returns: (nullable) (transfer none): the event is current handled by @controller
*/ */
GdkEvent * GdkEvent *
gtk_event_controller_get_current_event (GtkEventController *controller) gtk_event_controller_get_current_event (GtkEventController *controller)
@ -579,7 +579,7 @@ gtk_event_controller_get_current_event_time (GtkEventController *controller)
* Returns the device of the event that is currently being * Returns the device of the event that is currently being
* handled by the controller, and %NULL otherwise. * handled by the controller, and %NULL otherwise.
* *
* Returns: (nullable): device of the event is current handled by @controller * Returns: (nullable) (transfer none): device of the event is current handled by @controller
*/ */
GdkDevice * GdkDevice *
gtk_event_controller_get_current_event_device (GtkEventController *controller) gtk_event_controller_get_current_event_device (GtkEventController *controller)
@ -593,13 +593,13 @@ gtk_event_controller_get_current_event_device (GtkEventController *controller)
} }
/** /**
* gtk_event_controller_get_current_event_device: * gtk_event_controller_get_current_event_state:
* @controller: a #GtkEventController * @controller: a #GtkEventController
* *
* Returns the modifier state of the event that is currently being * Returns the modifier state of the event that is currently being
* handled by the controller, and 0 otherwise. * handled by the controller, and 0 otherwise.
* *
* Returns: (nullable): modifier state of the event is current handled by @controller * Returns: modifier state of the event is current handled by @controller
*/ */
GdkModifierType GdkModifierType
gtk_event_controller_get_current_event_state (GtkEventController *controller) gtk_event_controller_get_current_event_state (GtkEventController *controller)

View File

@ -92,12 +92,12 @@ gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, _gtk_boolean_handled_accumulator, NULL, 0, _gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__BOXED, _gtk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT); GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT], G_TYPE_FROM_CLASS (klass), g_signal_set_va_marshaller (signals[EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv); _gtk_marshal_BOOLEAN__POINTERv);
} }
static void static void

View File

@ -206,7 +206,7 @@ gtk_gesture_rotate_handle_event (GtkEventController *controller,
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH) if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH)
{ {
phase = gdk_touchpad_event_get_gesture_phase (event); phase = gdk_touchpad_event_get_gesture_phase (event);
delta = gdk_touchpad_pinch_event_get_angle_delta (event); delta = gdk_touchpad_event_get_pinch_angle_delta (event);
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN || if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END) phase == GDK_TOUCHPAD_GESTURE_PHASE_END)
priv->accum_touchpad_angle = 0; priv->accum_touchpad_angle = 0;

View File

@ -290,8 +290,8 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
event = gesture_get_current_event (gesture); event = gesture_get_current_event (gesture);
if (event) if (event && GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY))
history = gdk_event_get_motion_history (event); history = gdk_motion_event_get_history (event);
if (!history) if (!history)
return FALSE; return FALSE;

View File

@ -104,7 +104,7 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
double scale; double scale;
/* Touchpad pinch */ /* Touchpad pinch */
scale = gdk_touchpad_pinch_event_get_scale (last_event); scale = gdk_touchpad_event_get_pinch_scale (last_event);
*distance = scale; *distance = scale;
} }
else else

View File

@ -2275,11 +2275,10 @@ gtk_icon_view_button_press (GtkGestureClick *gesture,
} }
static gboolean static gboolean
button_event_modifies_selection (GdkEventButton *event) button_event_modifies_selection (GdkEvent *event)
{ {
guint state; guint state = gdk_event_get_modifier_state (event);
state = gdk_event_get_modifier_state ((GdkEvent *) event);
return (state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0; return (state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
} }
@ -2293,7 +2292,7 @@ gtk_icon_view_button_release (GtkGestureClick *gesture,
GtkIconView *icon_view = user_data; GtkIconView *icon_view = user_data;
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)); int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)); GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
GdkEventButton *event = (GdkEventButton *)gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence); GdkEvent *event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
if (icon_view->priv->pressed_button == button) if (icon_view->priv->pressed_button == button)
icon_view->priv->pressed_button = -1; icon_view->priv->pressed_button = -1;

View File

@ -806,7 +806,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
translated.consumed = 0; translated.consumed = 0;
translated.layout = 0; translated.layout = 0;
translated.level = 0; translated.level = 0;
GdkEvent *tmp_event = gdk_event_key_new (GDK_KEY_PRESS, GdkEvent *tmp_event = gdk_key_event_new (GDK_KEY_PRESS,
gdk_event_get_surface (event), gdk_event_get_surface (event),
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),

View File

@ -660,6 +660,7 @@ do_post_parse_initialization (void)
gtk_widget_set_default_direction (gtk_get_locale_direction ()); gtk_widget_set_default_direction (gtk_get_locale_direction ());
gdk_event_init_types ();
gsk_ensure_resources (); gsk_ensure_resources ();
gsk_render_node_init_types (); gsk_render_node_init_types ();
_gtk_ensure_resources (); _gtk_ensure_resources ();
@ -1109,7 +1110,7 @@ rewrite_event_for_surface (GdkEvent *event,
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
return gdk_event_button_new (type, return gdk_button_event_new (type,
new_surface, new_surface,
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
@ -1120,7 +1121,7 @@ rewrite_event_for_surface (GdkEvent *event,
x, y, x, y,
NULL); // FIXME copy axes NULL); // FIXME copy axes
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
return gdk_event_motion_new (new_surface, return gdk_motion_event_new (new_surface,
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
gdk_event_get_device_tool (event), gdk_event_get_device_tool (event),
@ -1132,7 +1133,7 @@ rewrite_event_for_surface (GdkEvent *event,
case GDK_TOUCH_UPDATE: case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END: case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL: case GDK_TOUCH_CANCEL:
return gdk_event_touch_new (type, return gdk_touch_event_new (type,
gdk_event_get_event_sequence (event), gdk_event_get_event_sequence (event),
new_surface, new_surface,
gdk_event_get_device (event), gdk_event_get_device (event),
@ -1144,7 +1145,7 @@ rewrite_event_for_surface (GdkEvent *event,
gdk_touch_event_get_emulating_pointer (event)); gdk_touch_event_get_emulating_pointer (event));
case GDK_TOUCHPAD_SWIPE: case GDK_TOUCHPAD_SWIPE:
gdk_touchpad_event_get_deltas (event, &dx, &dy); gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_event_touchpad_swipe_new (new_surface, return gdk_touchpad_event_new_swipe (new_surface,
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
gdk_event_get_time (event), gdk_event_get_time (event),
@ -1155,7 +1156,7 @@ rewrite_event_for_surface (GdkEvent *event,
dx, dy); dx, dy);
case GDK_TOUCHPAD_PINCH: case GDK_TOUCHPAD_PINCH:
gdk_touchpad_event_get_deltas (event, &dx, &dy); gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_event_touchpad_pinch_new (new_surface, return gdk_touchpad_event_new_pinch (new_surface,
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
gdk_event_get_time (event), gdk_event_get_time (event),
@ -1164,8 +1165,8 @@ rewrite_event_for_surface (GdkEvent *event,
x, y, x, y,
gdk_touchpad_event_get_n_fingers (event), gdk_touchpad_event_get_n_fingers (event),
dx, dy, dx, dy,
gdk_touchpad_pinch_event_get_scale (event), gdk_touchpad_event_get_pinch_scale (event),
gdk_touchpad_pinch_event_get_angle_delta (event)); gdk_touchpad_event_get_pinch_angle_delta (event));
default: default:
break; break;
} }
@ -1230,6 +1231,7 @@ static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event) rewrite_event_for_toplevel (GdkEvent *event)
{ {
GdkSurface *surface; GdkSurface *surface;
GdkKeyEvent *key_event;
surface = gdk_event_get_surface (event); surface = gdk_event_get_surface (event);
if (!surface->parent) if (!surface->parent)
@ -1238,7 +1240,10 @@ rewrite_event_for_toplevel (GdkEvent *event)
while (surface->parent) while (surface->parent)
surface = surface->parent; surface = surface->parent;
return gdk_event_key_new (gdk_event_get_event_type (event), key_event = (GdkKeyEvent *) event;
/* FIXME: Avoid direct access to the translated[] field */
return gdk_key_event_new (gdk_event_get_event_type (event),
surface, surface,
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
@ -1246,8 +1251,8 @@ rewrite_event_for_toplevel (GdkEvent *event)
gdk_key_event_get_keycode (event), gdk_key_event_get_keycode (event),
gdk_event_get_modifier_state (event), gdk_event_get_modifier_state (event),
gdk_key_event_is_modifier (event), gdk_key_event_is_modifier (event),
&event->key.translated[0], &key_event->translated[0],
&event->key.translated[1]); &key_event->translated[1]);
} }
static gboolean static gboolean
@ -1505,7 +1510,7 @@ handle_pointing_event (GdkEvent *event)
break; break;
case GDK_DRAG_LEAVE: case GDK_DRAG_LEAVE:
{ {
GdkDrop *drop = gdk_drag_event_get_drop (event); GdkDrop *drop = gdk_dnd_event_get_drop (event);
old_target = update_pointer_focus_state (toplevel, event, NULL); old_target = update_pointer_focus_state (toplevel, event, NULL);
gtk_drop_begin_event (drop, GDK_DRAG_LEAVE); gtk_drop_begin_event (drop, GDK_DRAG_LEAVE);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, NULL, gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, NULL,
@ -1544,10 +1549,10 @@ handle_pointing_event (GdkEvent *event)
else if ((old_target != target) && else if ((old_target != target) &&
(type == GDK_DRAG_ENTER || type == GDK_DRAG_MOTION || type == GDK_DROP_START)) (type == GDK_DRAG_ENTER || type == GDK_DRAG_MOTION || type == GDK_DROP_START))
{ {
GdkDrop *drop = gdk_drag_event_get_drop (event); GdkDrop *drop = gdk_dnd_event_get_drop (event);
gtk_drop_begin_event (drop, type); gtk_drop_begin_event (drop, type);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, target, gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, target,
event, GDK_CROSSING_NORMAL, gdk_drag_event_get_drop (event)); event, GDK_CROSSING_NORMAL, gdk_dnd_event_get_drop (event));
gtk_drop_end_event (drop); gtk_drop_end_event (drop);
} }
else if (type == GDK_TOUCH_BEGIN) else if (type == GDK_TOUCH_BEGIN)
@ -1740,7 +1745,7 @@ gtk_main_do_event (GdkEvent *event)
case GDK_DRAG_MOTION: case GDK_DRAG_MOTION:
case GDK_DROP_START: case GDK_DROP_START:
{ {
GdkDrop *drop = gdk_drag_event_get_drop (event); GdkDrop *drop = gdk_dnd_event_get_drop (event);
gtk_drop_begin_event (drop, gdk_event_get_event_type (event)); gtk_drop_begin_event (drop, gdk_event_get_event_type (event));
gtk_propagate_event (target_widget, event); gtk_propagate_event (target_widget, event);
gtk_drop_end_event (drop); gtk_drop_end_event (drop);

View File

@ -50,6 +50,7 @@ BOOLEAN:VOID
BOOLEAN:BOOLEAN BOOLEAN:BOOLEAN
BOOLEAN:BOOLEAN,BOOLEAN,BOOLEAN BOOLEAN:BOOLEAN,BOOLEAN,BOOLEAN
BOOLEAN:STRING BOOLEAN:STRING
BOOLEAN:POINTER
ENUM:ENUM ENUM:ENUM
ENUM:VOID ENUM:VOID
INT:POINTER INT:POINTER

View File

@ -243,13 +243,13 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
{ {
case GDK_PAD_BUTTON_PRESS: case GDK_PAD_BUTTON_PRESS:
type = GTK_PAD_ACTION_BUTTON; type = GTK_PAD_ACTION_BUTTON;
index = gdk_pad_button_event_get_button (event); index = gdk_pad_event_get_button (event);
break; break;
case GDK_PAD_RING: case GDK_PAD_RING:
case GDK_PAD_STRIP: case GDK_PAD_STRIP:
type = event_type == GDK_PAD_RING ? type = event_type == GDK_PAD_RING ?
GTK_PAD_ACTION_RING : GTK_PAD_ACTION_STRIP; GTK_PAD_ACTION_RING : GTK_PAD_ACTION_STRIP;
gdk_pad_axis_event_get_value (event, &index, &value); gdk_pad_event_get_axis_value (event, &index, &value);
break; break;
default: default:
return GDK_EVENT_PROPAGATE; return GDK_EVENT_PROPAGATE;

View File

@ -81,13 +81,12 @@ window_handle_exported (GtkWindow *window,
/** /**
* gtk_show_uri_full: * gtk_show_uri_full:
* @parent: (allow-none): parent window * @parent: (nullable): parent window
* @uri: the uri to show * @uri: the uri to show
* @timestamp: timestamp from the event that triggered this call, or %GDK_CURRENT_TIME * @timestamp: timestamp from the event that triggered this call, or %GDK_CURRENT_TIME
* @cancellable: (allow-none): a #GCancellable to cancel the launch * @cancellable: (nullable): a #GCancellable to cancel the launch
* @callback (allow-none): a callback to call when the action is complete * @callback (scope async): a callback to call when the action is complete
* @user_data: data to pass to @callback * @user_data: (closure callback): data to pass to @callback
* @destroy: destroy notify for @user_data
* *
* This function launches the default application for showing * This function launches the default application for showing
* a given uri. * a given uri.

View File

@ -4354,7 +4354,7 @@ gtk_text_view_get_gutter (GtkTextView *text_view,
childp = find_child_for_window_type (text_view, win); childp = find_child_for_window_type (text_view, win);
if (*childp != NULL) if (childp != NULL && *childp != NULL)
return GTK_WIDGET (*childp); return GTK_WIDGET (*childp);
return NULL; return NULL;
@ -4388,6 +4388,9 @@ gtk_text_view_set_gutter (GtkTextView *text_view,
win == GTK_TEXT_WINDOW_BOTTOM); win == GTK_TEXT_WINDOW_BOTTOM);
childp = find_child_for_window_type (text_view, win); childp = find_child_for_window_type (text_view, win);
if (childp == NULL)
return;
old_child = *childp; old_child = *childp;
if ((GtkWidget *)old_child == widget) if ((GtkWidget *)old_child == widget)

View File

@ -1963,7 +1963,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
case GDK_TOUCH_BEGIN: case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE: case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END: case GDK_TOUCH_END:
press = gdk_event_touch_new (GDK_TOUCH_BEGIN, press = gdk_touch_event_new (GDK_TOUCH_BEGIN,
gdk_event_get_event_sequence (event), gdk_event_get_event_sequence (event),
gdk_event_get_surface (event), gdk_event_get_surface (event),
gdk_event_get_device (event), gdk_event_get_device (event),
@ -1976,7 +1976,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
break; break;
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
press = gdk_event_button_new (GDK_BUTTON_PRESS, press = gdk_button_event_new (GDK_BUTTON_PRESS,
gdk_event_get_surface (event), gdk_event_get_surface (event),
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),
@ -2002,7 +2002,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
button = 1; button = 1;
} }
press = gdk_event_button_new (GDK_BUTTON_PRESS, press = gdk_button_event_new (GDK_BUTTON_PRESS,
gdk_event_get_surface (event), gdk_event_get_surface (event),
gdk_event_get_device (event), gdk_event_get_device (event),
gdk_event_get_source_device (event), gdk_event_get_source_device (event),

View File

@ -476,7 +476,7 @@ static void gtk_window_activate_default_activate (GtkWidget *widget,
GVariant *parameter); GVariant *parameter);
static void gtk_window_do_popup (GtkWindow *window, static void gtk_window_do_popup (GtkWindow *window,
GdkEventButton *event); GdkEvent *event);
static void gtk_window_css_changed (GtkWidget *widget, static void gtk_window_css_changed (GtkWidget *widget,
GtkCssStyleChange *change); GtkCssStyleChange *change);
static void gtk_window_state_flags_changed (GtkWidget *widget, static void gtk_window_state_flags_changed (GtkWidget *widget,
@ -1211,7 +1211,7 @@ gtk_window_titlebar_action (GtkWindow *window,
else if (g_str_equal (action, "minimize")) else if (g_str_equal (action, "minimize"))
gdk_toplevel_minimize (GDK_TOPLEVEL (priv->surface)); gdk_toplevel_minimize (GDK_TOPLEVEL (priv->surface));
else if (g_str_equal (action, "menu")) else if (g_str_equal (action, "menu"))
gtk_window_do_popup (window, (GdkEventButton*) event); gtk_window_do_popup (window, event);
else else
{ {
g_warning ("Unsupported titlebar action %s", action); g_warning ("Unsupported titlebar action %s", action);
@ -5895,8 +5895,8 @@ close_window_clicked (GtkModelButton *button,
} }
static void static void
gtk_window_do_popup_fallback (GtkWindow *window, gtk_window_do_popup_fallback (GtkWindow *window,
GdkEventButton *event) GdkEvent *event)
{ {
GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *menuitem; GtkWidget *menuitem;
@ -6005,12 +6005,12 @@ gtk_window_do_popup_fallback (GtkWindow *window,
} }
static void static void
gtk_window_do_popup (GtkWindow *window, gtk_window_do_popup (GtkWindow *window,
GdkEventButton *event) GdkEvent *event)
{ {
GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
if (!gdk_toplevel_show_window_menu (GDK_TOPLEVEL (priv->surface), (GdkEvent *) event)) if (!gdk_toplevel_show_window_menu (GDK_TOPLEVEL (priv->surface), event))
gtk_window_do_popup_fallback (window, event); gtk_window_do_popup_fallback (window, event);
} }

View File

@ -23,7 +23,7 @@ inject_event (GdkEvent *event)
{ {
gboolean handled; gboolean handled;
g_signal_emit_by_name (event->any.surface, "event", event, &handled); g_signal_emit_by_name (event->surface, "event", event, &handled);
} }
static void static void
@ -44,7 +44,7 @@ point_press (PointState *point,
if (point == &mouse_state) if (point == &mouse_state)
{ {
ev = gdk_event_button_new (GDK_BUTTON_PRESS, ev = gdk_button_event_new (GDK_BUTTON_PRESS,
surface, surface,
device, device,
device, device,
@ -59,7 +59,7 @@ point_press (PointState *point,
} }
else else
{ {
ev = gdk_event_touch_new (GDK_TOUCH_BEGIN, ev = gdk_touch_event_new (GDK_TOUCH_BEGIN,
EVENT_SEQUENCE (point), EVENT_SEQUENCE (point),
surface, surface,
device, device,
@ -100,7 +100,7 @@ point_update (PointState *point,
if (point == &mouse_state) if (point == &mouse_state)
{ {
ev = gdk_event_motion_new (surface, ev = gdk_motion_event_new (surface,
device, device,
device, device,
NULL, NULL,
@ -114,7 +114,7 @@ point_update (PointState *point,
if (!point->widget || widget != point->widget) if (!point->widget || widget != point->widget)
return; return;
ev = gdk_event_touch_new (GDK_TOUCH_UPDATE, ev = gdk_touch_event_new (GDK_TOUCH_UPDATE,
EVENT_SEQUENCE (point), EVENT_SEQUENCE (point),
surface, surface,
device, device,
@ -157,7 +157,7 @@ point_release (PointState *point,
if ((point->state & (GDK_BUTTON1_MASK << (button - 1))) == 0) if ((point->state & (GDK_BUTTON1_MASK << (button - 1))) == 0)
return; return;
ev = gdk_event_button_new (GDK_BUTTON_RELEASE, ev = gdk_button_event_new (GDK_BUTTON_RELEASE,
surface, surface,
device, device,
device, device,
@ -172,7 +172,7 @@ point_release (PointState *point,
} }
else else
{ {
ev = gdk_event_touch_new (GDK_TOUCH_END, ev = gdk_touch_event_new (GDK_TOUCH_END,
EVENT_SEQUENCE (point), EVENT_SEQUENCE (point),
surface, surface,
device, device,

View File

@ -1,84 +1,36 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
typedef struct _GdkEventAny GdkEventAny; #define GTK_COMPILATION
typedef struct _GdkEventKey GdkEventKey; #include "gdk/gdkeventsprivate.h"
struct _GdkEventAny
{
int ref_count;
GdkEventType type;
GdkSurface *surface;
guint32 time;
guint16 flags;
guint pointer_emulated : 1;
guint touch_emulating : 1;
guint scroll_is_stop : 1;
guint key_is_modifier : 1;
guint focus_in : 1;
GdkDevice *device;
GdkDevice *source_device;
};
typedef struct {
guint keyval;
GdkModifierType consumed;
guint layout;
guint level;
} GdkTranslatedKey;
struct _GdkEventKey
{
GdkEventAny any;
GdkModifierType state;
guint32 keycode;
GdkTranslatedKey translated[2];
};
static GdkEvent * static GdkEvent *
gdk_event_key_new (GdkEventType type, key_event_new (GdkEventType event_type,
GdkSurface *surface, GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkDevice *source_device, GdkDevice *source_device,
guint32 time, guint32 time_,
guint keycode, guint keycode,
GdkModifierType state, GdkModifierType state,
gboolean is_modifier, gboolean is_modifier,
GdkTranslatedKey *translated, GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock); GdkTranslatedKey *no_lock)
static GdkEvent *
gdk_event_key_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint keycode,
GdkModifierType state,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock)
{ {
GdkEventKey *event; GdkKeyEvent *key_event = (GdkKeyEvent *) g_type_create_instance (GDK_TYPE_KEY_EVENT);
GdkEvent *event = (GdkEvent *) key_event;
g_return_val_if_fail (type == GDK_KEY_PRESS || event->event_type = event_type;
type == GDK_KEY_RELEASE, NULL); event->surface = g_object_ref (surface);
event->device = g_object_ref (device);
event->source_device = g_object_ref (source_device);
event->time = time_;
event = g_new0 (GdkEventKey, 1); key_event->keycode = keycode;
key_event->state = state;
key_event->key_is_modifier = is_modifier;
key_event->translated[0] = *translated;
key_event->translated[1] = *no_lock;
event->any.ref_count = 1; return event;
event->any.type = type;
event->any.time = time;
event->any.surface = g_object_ref (surface);
event->any.device = g_object_ref (device);
event->any.source_device = g_object_ref (source_device);
event->keycode = keycode;
event->state = state;
event->any.key_is_modifier = is_modifier;
event->translated[0] = *translated;
event->translated[1] = *no_lock;
return (GdkEvent *)event;
} }
static void static void
@ -378,16 +330,16 @@ test_trigger_trigger (void)
translated.consumed = 0; translated.consumed = 0;
translated.layout = keys[0].group; translated.layout = keys[0].group;
translated.level = keys[0].level; translated.level = keys[0].level;
event = gdk_event_key_new (GDK_KEY_PRESS, event = key_event_new (GDK_KEY_PRESS,
surface, surface,
device, device,
device, device,
GDK_CURRENT_TIME, GDK_CURRENT_TIME,
keys[0].keycode, keys[0].keycode,
tests[i].state, tests[i].state,
FALSE, FALSE,
&translated, &translated,
&translated); &translated);
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
{ {
g_assert_cmpint (gtk_shortcut_trigger_trigger (trigger[j], event, tests[i].mnemonic), ==, tests[i].result[j]); g_assert_cmpint (gtk_shortcut_trigger_trigger (trigger[j], event, tests[i].mnemonic), ==, tests[i].result[j]);