Restructure the GdkEvent type hierarchy

GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
This commit is contained in:
Emmanuele Bassi 2020-04-16 17:23:36 +01:00
parent 96cfb12946
commit f28aa1ba02
34 changed files with 2623 additions and 1896 deletions

View File

@ -299,8 +299,9 @@
in GTK 4.
</para>
<para>
GdkEvent is now a strictly read-only boxed type, and you
can no longer change any of its fields.
GdkEvent is now a strictly read-only type, and you
can no longer change any of its fields, or construct new
events.
</para>
</section>
@ -308,7 +309,7 @@
<title>Stop using gdk_surface_set_event_compression</title>
<para>
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>
</section>
@ -318,8 +319,8 @@
Warping the pointer is disorienting and unfriendly to users.
GTK 4 does not support it. In special circumstances (such as when
implementing remote connection UIs) it can be necessary to
warp the pointer; in this case, use platform APIs such as XWarpPointer
directly.
warp the pointer; in this case, use platform APIs such as
<function>XWarpPointer()</function> directly.
</para>
</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));
if (surface)
{
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
surface,
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));
if (surface)
{
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
surface,
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));
if (surface)
{
event = gdk_event_motion_new (surface,
event = gdk_motion_event_new (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
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));
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_RELEASE,
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));
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),
NULL,
@ -243,7 +243,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
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),
surface,
gdk_seat_get_pointer (seat),
@ -271,7 +271,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
translated.consumed = 0;
translated.layout = 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_RELEASE,
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));
if (surface)
{
event = gdk_event_configure_new (surface,
event = gdk_configure_event_new (surface,
message->configure_notify.width,
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));
if (surface)
{
event = gdk_event_focus_new (surface,
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
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));
if (surface)
{
event = gdk_event_focus_new (surface,
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
TRUE);

View File

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

View File

@ -915,12 +915,12 @@ gdk_drop_emit_enter_event (GdkDrop *self,
g_warn_if_fail (!priv->entered);
event = gdk_event_drag_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_dnd_event_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
priv->entered = TRUE;
@ -939,12 +939,12 @@ gdk_drop_emit_motion_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
event = gdk_event_drag_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_dnd_event_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
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);
event = gdk_event_drag_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_dnd_event_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
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->state == GDK_DROP_STATE_NONE);
event = gdk_event_drag_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_dnd_event_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
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_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:
@ -98,9 +102,38 @@ G_BEGIN_DECLS
*/
#define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
typedef struct _GdkEventSequence GdkEventSequence;
typedef union _GdkEvent GdkEvent;
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
#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:
@ -297,7 +330,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gdk_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
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
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
guint gdk_button_event_get_button (GdkEvent *event);
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);
GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event,
@ -359,6 +395,8 @@ void gdk_scroll_event_get_deltas (GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
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);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keycode (GdkEvent *event);
@ -371,18 +409,30 @@ guint gdk_key_event_get_level (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_is_modifier (GdkEvent *event);
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);
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);
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);
GDK_AVAILABLE_IN_ALL
GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
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,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
@ -392,26 +442,41 @@ void gdk_touchpad_event_get_deltas (GdkEvent *event,
double *dx,
double *dy);
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
double gdk_touchpad_pinch_event_get_scale (GdkEvent *event);
double gdk_touchpad_event_get_pinch_scale (GdkEvent *event);
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
void gdk_pad_axis_event_get_value (GdkEvent *event,
guint *index,
double *value);
guint gdk_pad_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
void gdk_pad_event_get_axis_value (GdkEvent *event,
guint *index,
double *value);
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
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
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
gboolean gdk_event_triggers_context_menu (GdkEvent *event);

View File

@ -30,74 +30,98 @@
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny;
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;
#define GDK_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_EVENT, GdkEventClass))
/*
* GdkEventAny:
* @type: the type of the event.
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
typedef struct _GdkEventClass GdkEventClass;
/*< private >
* GdkEvent:
* @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.
* Any event pointer can safely be cast to a pointer to a #GdkEventAny to
* access these fields.
* The abstract type for all windowing system events.
*/
struct _GdkEventAny
struct _GdkEvent
{
int ref_count;
GdkEventType type;
GTypeInstance parent_instance;
grefcount ref_count;
/* Specialised event type */
GdkEventType event_type;
/* The surface of the event */
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;
/* The devices associated to the event */
GdkDevice *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:
* @type: the type of 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.
* GdkDeleteEvent:
*
* Generated when a surface is deleted.
*/
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.
* @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
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
* @history: (element-type GdkTimeCoord): a list of time and coordinates
* for other motion events that were compressed before delivering the
* current event
*
* Generated when the pointer moves.
*/
struct _GdkEventMotion
struct _GdkMotionEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
double x;
double y;
@ -107,15 +131,7 @@ struct _GdkEventMotion
};
/*
* GdkEventButton:
* @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.
* GdkButtonEvent:
* @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.
@ -123,16 +139,19 @@ struct _GdkEventMotion
* Normally button 1 is the left mouse button, 2 is the middle button,
* and 3 is the right button. On 2-button mice, the middle button can
* often be simulated by pressing both mouse buttons together.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
* @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.
* @tool: a #GdkDeviceTool
*
* Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE,
*/
struct _GdkEventButton
struct _GdkButtonEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
guint button;
double x;
@ -142,25 +161,16 @@ struct _GdkEventButton
};
/*
* GdkEventTouch:
* @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
* GdkTouchEvent:
* @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
* @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
* @emulating_pointer: whether the event should be used for emulating
* pointer event
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen
* @emulated: whether the event is the result of a pointer emulation
*
* Used for touch events.
* @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
* several active sequences at the same time.
*/
struct _GdkEventTouch
struct _GdkTouchEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
double x;
double y;
double *axes;
GdkEventSequence *sequence;
gboolean touch_emulating;
gboolean pointer_emulated;
};
/*
* GdkEventScroll:
* @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.
* GdkScrollEvent:
* @x: the x 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
@ -197,10 +206,11 @@ struct _GdkEventTouch
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
* %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_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
* 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
* gdk_event_get_scroll_deltas().
*/
struct _GdkEventScroll
struct _GdkScrollEvent
{
GdkEventAny any;
GdkEvent parent_instance;
double x;
double y;
GdkModifierType state;
GdkScrollDirection direction;
double delta_x;
double delta_y;
gboolean pointer_emulated;
gboolean is_stop;
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 {
guint keyval;
GdkModifierType consumed;
@ -231,11 +253,7 @@ typedef struct {
} GdkTranslatedKey;
/*
* GdkEventKey:
* @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.
* GdkKeyEvent:
* @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.
@ -245,41 +263,40 @@ typedef struct {
*
* Describes a key press or key release event.
*/
struct _GdkEventKey
struct _GdkKeyEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2];
};
/*
* GdkEventCrossing:
* @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @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.
* GdkCrossingEvent:
* @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.
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
* %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,
* 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,
* %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
* %GDK_NOTIFY_NONLINEAR_VIRTUAL).
* @focus: %TRUE if @surface is the focus surface or an inferior.
* @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.
* @child_surface: the surface that was entered or left.
*
* Generated when the pointer enters or leaves a surface.
*/
struct _GdkEventCrossing
struct _GdkCrossingEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
GdkCrossingMode mode;
double x;
@ -290,10 +307,7 @@ struct _GdkEventCrossing
};
/*
* GdkEventFocus:
* @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.
* GdkFocusEvent:
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
* it has lost the focus.
* @mode: the crossing mode
@ -301,19 +315,15 @@ struct _GdkEventCrossing
*
* Describes a change of keyboard focus.
*/
struct _GdkEventFocus
struct _GdkFocusEvent
{
GdkEventAny any;
gint16 in;
GdkCrossingMode mode;
GdkNotifyType detail;
GdkEvent parent_instance;
gboolean focus_in;
};
/*
* GdkEventConfigure:
* @type: the type of the event (%GDK_CONFIGURE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* GdkConfigureEvent:
* @x: the new x 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.
@ -321,9 +331,10 @@ struct _GdkEventFocus
*
* Generated when a surface size or position has changed.
*/
struct _GdkEventConfigure
struct _GdkConfigureEvent
{
GdkEventAny any;
GdkEvent parent_instance;
int x;
int y;
int width;
@ -331,36 +342,23 @@ struct _GdkEventConfigure
};
/*
* GdkEventProximity:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
* @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.
* GdkProximityEvent:
* @tool: the #GdkDeviceTool associated to the event
*
* Proximity events are generated when using GDKs wrapper for the
* XInput extension. The XInput extension is an add-on for standard X
* that allows you to use nonstandard devices such as graphics tablets.
* A proximity event indicates that the stylus has moved in or out of
* 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.
* A proximity event indicates that a tool of a graphic tablet, or similar
* devices that report proximity, has moved in or out of contact with the
* tablet, or perhaps that the users finger has moved in or out of contact
* with a touch screen.
*/
struct _GdkEventProximity
struct _GdkProximityEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkDeviceTool *tool;
};
/*
* GdkEventGrabBroken:
* @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.
* GdkGrabBrokenEvent:
* @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
* grab was broken
* @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
* is unmapped), or if the same application grabs the pointer or keyboard
* again. Note that implicit grabs (which are initiated by button presses)
* can also cause #GdkEventGrabBroken events.
* can also cause #GdkGrabBrokenEvent events.
*/
struct _GdkEventGrabBroken {
GdkEventAny any;
struct _GdkGrabBrokenEvent
{
GdkEvent parent_instance;
gboolean keyboard;
gboolean implicit;
GdkSurface *grab_surface;
};
/*
* GdkEventDND:
* @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.
* GdkDNDEvent:
* @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.
*/
struct _GdkEventDND {
GdkEventAny any;
struct _GdkDNDEvent
{
GdkEvent parent_instance;
GdkDrop *drop;
double x;
double y;
};
/*
* GdkEventTouchpadSwipe:
* @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
* GdkTouchpadEvent:
* @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.
*/
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
* @n_fingers: The number of fingers triggering the pinch
* @time: the time of the event in milliseconds
@ -440,18 +410,17 @@ struct _GdkEventTouchpadSwipe {
* @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
* @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
* @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
* @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 {
GdkEventAny any;
struct _GdkTouchpadEvent
{
GdkEvent parent_instance;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
@ -463,99 +432,20 @@ struct _GdkEventTouchpadPinch {
double scale;
};
/*
* GdkEventPadButton:
* @type: the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_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.
* @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;
};
struct _GdkPadEvent
{
GdkEvent parent_instance;
/*
* 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 index;
guint mode;
guint button;
guint index;
double value;
};
/*
* 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;
};
void gdk_event_init_types (void);
/*
* 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,
GdkEvent * gdk_button_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@ -567,7 +457,7 @@ GdkEvent * gdk_event_button_new (GdkEventType type,
double y,
double *axes);
GdkEvent * gdk_event_motion_new (GdkSurface *surface,
GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@ -577,7 +467,7 @@ GdkEvent * gdk_event_motion_new (GdkSurface *surface,
double y,
double *axes);
GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@ -588,14 +478,14 @@ GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkCrossingMode mode,
GdkNotifyType notify);
GdkEvent * gdk_event_proximity_new (GdkEventType type,
GdkEvent * gdk_proximity_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time);
GdkEvent * gdk_event_key_new (GdkEventType type,
GdkEvent * gdk_key_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@ -606,18 +496,18 @@ GdkEvent * gdk_event_key_new (GdkEventType type,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock);
GdkEvent * gdk_event_focus_new (GdkSurface *surface,
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in);
GdkEvent * gdk_event_configure_new (GdkSurface *surface,
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width,
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 *source_device,
GdkDeviceTool *tool,
@ -627,7 +517,7 @@ GdkEvent * gdk_event_scroll_new (GdkSurface *surface,
double delta_y,
gboolean is_stop);
GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@ -636,7 +526,7 @@ GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkScrollDirection direction,
gboolean emulated);
GdkEvent * gdk_event_touch_new (GdkEventType type,
GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
GdkDevice *device,
@ -648,7 +538,7 @@ GdkEvent * gdk_event_touch_new (GdkEventType type,
double *axes,
gboolean emulating);
GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@ -660,7 +550,7 @@ GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
double dx,
double dy);
GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@ -674,7 +564,7 @@ GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
double scale,
double angle_delta);
GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@ -683,7 +573,7 @@ GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@ -692,7 +582,7 @@ GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_event_pad_button_new (GdkEventType type,
GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@ -701,14 +591,14 @@ GdkEvent * gdk_event_pad_button_new (GdkEventType type,
guint button,
guint mode);
GdkEvent * gdk_event_pad_group_mode_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint mode);
GdkEvent * gdk_event_drag_new (GdkEventType type,
GdkEvent * gdk_dnd_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDrop *drop,
@ -716,12 +606,12 @@ GdkEvent * gdk_event_drag_new (GdkEventType type,
double x,
double y);
GdkEvent * gdk_event_grab_broken_new (GdkSurface *surface,
GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkSurface *grab_surface,
gboolean implicit);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */

View File

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

View File

@ -589,7 +589,7 @@ emulate_crossing (GdkSurface *surface,
double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, &state);
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
surface,
device,
device,
@ -614,7 +614,7 @@ emulate_touch_crossing (GdkSurface *surface,
{
GdkEvent *event;
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
surface,
device,
source,
@ -633,7 +633,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in,
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);
}
@ -1360,7 +1360,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
GdkDevice *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,
source,
NULL,
@ -1382,7 +1382,7 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
GdkDevice *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,
source,
NULL,
@ -1498,7 +1498,7 @@ pointer_handle_enter (void *data,
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
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->master_pointer,
seat->pointer,
@ -1541,7 +1541,7 @@ pointer_handle_leave (void *data,
_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->master_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_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->pointer,
NULL,
@ -1649,7 +1649,7 @@ pointer_handle_button (void *data,
if (state)
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->master_pointer,
seat->pointer,
@ -1914,7 +1914,7 @@ keyboard_handle_enter (void *data,
g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0;
event = gdk_event_focus_new (seat->keyboard_focus,
event = gdk_focus_event_new (seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
TRUE);
@ -1949,7 +1949,7 @@ keyboard_handle_leave (void *data,
_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->keyboard,
FALSE);
@ -2075,7 +2075,7 @@ deliver_key_event (GdkWaylandSeat *seat,
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->master_keyboard,
seat->keyboard,
@ -2375,7 +2375,7 @@ touch_handle_down (void *data,
touch->y = wl_fixed_to_double (y);
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),
touch->surface,
seat->touch_master,
@ -2418,7 +2418,7 @@ touch_handle_up (void *data,
_gdk_wayland_display_update_serial (display, serial);
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),
touch->surface,
seat->touch_master,
@ -2463,7 +2463,7 @@ touch_handle_motion (void *data,
if (touch->initial_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),
touch->surface,
seat->touch_master,
@ -2509,7 +2509,7 @@ touch_handle_cancel (void *data,
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),
touch->surface,
seat->touch_master,
@ -2541,7 +2541,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
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->pointer,
_time,
@ -2638,7 +2638,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
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->pointer,
_time,
@ -3469,7 +3469,7 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_device_tablet_clone_tool_axes (tablet, tool->tool);
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->master,
tablet->current_device,
@ -3500,7 +3500,7 @@ tablet_tool_handle_proximity_out (void *data,
g_message ("proximity out, seat %p, tool %d", tool->seat,
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->master,
tablet->current_device,
@ -3537,7 +3537,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event;
event = gdk_event_button_new (evtype,
event = gdk_button_event_new (evtype,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@ -3603,7 +3603,7 @@ tablet_tool_handle_motion (void *data,
tablet->pointer_info.surface_x,
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->current_device,
tool->tool,
@ -3765,7 +3765,7 @@ tablet_tool_handle_wheel (void *data,
return;
/* Send smooth event */
event = gdk_event_scroll_new (tablet->pointer_info.focus,
event = gdk_scroll_event_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tablet->current_tool->tool,
@ -3777,7 +3777,7 @@ tablet_tool_handle_wheel (void *data,
_gdk_wayland_display_deliver_event (seat->display, 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->current_device,
tablet->current_tool->tool,
@ -3888,7 +3888,7 @@ tablet_pad_ring_handle_frame (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
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,
time,
@ -3963,7 +3963,7 @@ tablet_pad_strip_handle_frame (void *data,
g_message ("tablet pad strip handle frame, strip = %p",
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,
time,
@ -4089,7 +4089,7 @@ tablet_pad_group_handle_mode (void *data,
group->current_mode = mode;
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,
time,
@ -4201,7 +4201,7 @@ tablet_pad_handle_button (void *data,
g_assert (group != NULL);
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_RELEASE,
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
@ -5031,7 +5031,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
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),
touch->surface,
seat->touch_master,

View File

@ -891,7 +891,7 @@ gdk_wayland_surface_resize (GdkSurface *surface,
GdkDisplay *display;
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_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));
event = gdk_event_delete_new (surface);
event = gdk_delete_event_new (surface);
_gdk_wayland_display_deliver_event (display, event);
}
@ -3817,7 +3817,8 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
double x, y;
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_RELEASE:

View File

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

View File

@ -2515,7 +2515,8 @@ gdk_win32_drag_handle_event (GdkDrag *drag,
if (!drag_win32->handle_events)
{
/* 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;
}

View File

@ -207,7 +207,7 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_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);
}
@ -233,7 +233,7 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
source_device = device_manager->system_pointer;
}
event = gdk_event_grab_broken_new (window,
event = gdk_grab_broken_event_new (window,
device,
source_device,
grab_window,
@ -885,12 +885,8 @@ decode_key_lparam (LPARAM lParam)
static void
fixup_event (GdkEvent *event)
{
if (event->any.surface)
g_object_ref (event->any.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);
if (event->surface)
g_object_ref (event->surface);
}
void
@ -1080,7 +1076,7 @@ send_crossing_event (GdkDisplay *display,
pt = *screen_pt;
ScreenToClient (GDK_SURFACE_HWND (window), &pt);
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
window,
device_manager->core_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_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_event_button_new (type,
event = gdk_button_event_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
@ -2133,7 +2129,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
@ -2336,7 +2332,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = group;
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_RELEASE,
window,
@ -2413,7 +2409,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = get_active_group ();
translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
@ -2427,7 +2423,7 @@ gdk_event_translate (MSG *msg,
_gdk_win32_append_event (event);
/* Build a key release event. */
event = gdk_event_key_new (GDK_KEY_RELEASE,
event = gdk_key_event_new (GDK_KEY_RELEASE,
window,
device_manager_win32->core_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_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->system_pointer,
NULL,
@ -2767,7 +2763,7 @@ gdk_event_translate (MSG *msg,
*/
delta_y *= -1.0;
event = gdk_event_scroll_new (window,
event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@ -2790,7 +2786,7 @@ gdk_event_translate (MSG *msg,
? GDK_SCROLL_RIGHT
: 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->system_pointer,
NULL,
@ -3425,7 +3421,7 @@ gdk_event_translate (MSG *msg,
if (GDK_SURFACE_DESTROYED (window))
break;
event = gdk_event_delete_new (window);
event = gdk_delete_event_new (window);
_gdk_win32_append_event (event);
@ -3459,7 +3455,7 @@ gdk_event_translate (MSG *msg,
if (window == NULL || GDK_SURFACE_DESTROYED (window))
break;
event = gdk_event_delete_new (window);
event = gdk_delete_event_new (window);
_gdk_win32_append_event (event);

View File

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

View File

@ -1448,7 +1448,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
{
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_event_unref (event);
}
@ -1584,7 +1584,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
{
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_RELEASE,
surface,
@ -1654,7 +1654,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
event = gdk_event_discrete_scroll_new (surface,
event = gdk_scroll_event_new_discrete (surface,
device,
source_device,
NULL,
@ -1684,7 +1684,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / 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_RELEASE,
surface,
@ -1739,7 +1739,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
xev->deviceid, xev->sourceid,
xev->event, delta_x, delta_y));
event = gdk_event_scroll_new (surface,
event = gdk_scroll_event_new (surface,
device,
source_device,
NULL,
@ -1760,7 +1760,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_event_motion_new (surface,
event = gdk_motion_event_new (surface,
device,
source_device,
source_device->last_tool,
@ -1808,7 +1808,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / 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_END,
GUINT_TO_POINTER (xev->detail),
@ -1858,7 +1858,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / 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),
surface,
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_LEAVE_NOTIFY,
surface,

View File

@ -799,7 +799,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
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)
gdk_surface_destroy_notify (surface);
@ -918,10 +918,10 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
xevent->xconfigure.event == xevent->xconfigure.window)
{
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,
(xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale,
(xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale);
event = gdk_configure_event_new (surface, c_w, c_h);
if (!xevent->xconfigure.send_event &&
!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_height = xevent->xconfigure.height;
surface->width = event->configure.width;
surface->height = event->configure.height;
gdk_configure_event_get_size (event, &surface->width, &surface->height);
_gdk_surface_update_size (surface);
_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"))
{
/* The delete window request specifies a window
* to delete. We don't actually destroy the
* window because "it is only a request". (The
* window might contain vital data that the
* program does not want destroyed). Instead
* the event is passed along to the program,
* which should then destroy the window.
*/
/* The delete window request specifies a window
* to delete. We don't actually destroy the
* window because "it is only a request". (The
* window might contain vital data that the
* program does not want destroyed). Instead
* the event is passed along to the program,
* which should then destroy the window.
*/
GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("delete window:\t\twindow: %ld",
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]);

View File

@ -1023,7 +1023,7 @@ send_client_message_async (GdkDrag *drag,
static void
xdnd_send_xevent (GdkX11Drag *drag_x11,
XEvent *event_send)
XEvent *event_send)
{
GdkDrag *drag = GDK_DRAG (drag_x11);
GdkDisplay *display = gdk_drag_get_display (drag);
@ -2184,15 +2184,15 @@ gdk_drag_update (GdkDrag *drag,
}
static gboolean
gdk_dnd_handle_motion_event (GdkDrag *drag,
GdkEvent *event)
gdk_dnd_handle_motion_event (GdkDrag *drag,
GdkEvent *event)
{
double x, y;
int x_root, y_root;
gdk_event_get_position (event, &x, &y);
x_root = event->any.surface->x + x;
y_root = event->any.surface->y + y;
x_root = event->surface->x + x;
y_root = event->surface->y + y;
gdk_drag_update (drag, x_root, y_root,
gdk_event_get_modifier_state (event),
gdk_event_get_time (event));
@ -2200,8 +2200,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
}
static gboolean
gdk_dnd_handle_key_event (GdkDrag *drag,
GdkEventKey *event)
gdk_dnd_handle_key_event (GdkDrag *drag,
GdkEvent *event)
{
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkModifierType state;
@ -2209,12 +2209,14 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
gint dx, dy;
dx = dy = 0;
state = event->state;
pointer = gdk_device_get_associated_device (gdk_event_get_device ((GdkEvent *) event));
state = gdk_event_get_modifier_state (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:
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_event_get_time ((GdkEvent *) event));
gdk_event_get_time (event));
return TRUE;
}
static gboolean
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
GdkEventGrabBroken *event)
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
GdkEvent *event)
{
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.
* Also, don't cancel if we re-grab on the widget or on our IPC window, for
* example, when changing the drag cursor.
*/
if (event->implicit ||
event->grab_surface == x11_drag->drag_surface ||
event->grab_surface == x11_drag->ipc_surface)
if (is_implicit ||
grab_surface == x11_drag->drag_surface ||
grab_surface == x11_drag->ipc_surface)
return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) !=
gdk_drag_get_device (drag))
if (gdk_event_get_device (event) != gdk_drag_get_device (drag))
return FALSE;
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE;
}
static gboolean
gdk_dnd_handle_button_event (GdkDrag *drag,
GdkEventButton *event)
gdk_dnd_handle_button_event (GdkDrag *drag,
GdkEvent *event)
{
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
@ -2347,17 +2352,21 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
if (!x11_drag->grab_seat)
return FALSE;
switch ((guint) event->any.type)
switch ((guint) event->event_type)
{
case GDK_MOTION_NOTIFY:
return gdk_dnd_handle_motion_event (drag, event);
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_RELEASE:
return gdk_dnd_handle_key_event (drag, &event->key);
return gdk_dnd_handle_key_event (drag, event);
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:
break;
}

View File

@ -105,7 +105,7 @@ handle_focus_change (GdkEvent *event)
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;
had_focus = HAS_FOCUS (toplevel);
@ -115,7 +115,7 @@ handle_focus_change (GdkEvent *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_source_device (event),
focus_in);
@ -135,7 +135,7 @@ create_synth_crossing_event (GdkEventType evtype,
g_assert (evtype == GDK_ENTER_NOTIFY || evtype == GDK_LEAVE_NOTIFY);
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_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;
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_RELEASE:

View File

@ -384,7 +384,7 @@ gtk_drop_target_handle_event (GtkEventController *controller,
GdkDragAction preferred;
/* 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);
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:
{
/* 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);
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);
GdkDragAction preferred_action;
drop = gdk_drag_event_get_drop (event);
drop = gdk_dnd_event_get_drop (event);
/* sanity check */
g_return_val_if_fail (self->drop == drop, FALSE);
if (self->rejected)
@ -243,7 +243,7 @@ gtk_drop_target_async_handle_event (GtkEventController *controller,
{
gboolean handled;
drop = gdk_drag_event_get_drop (event);
drop = gdk_dnd_event_get_drop (event);
/* sanity check */
g_return_val_if_fail (self->drop == drop, FALSE);
if (self->rejected)

View File

@ -92,12 +92,12 @@ gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, _gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__BOXED,
_gtk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT], G_TYPE_FROM_CLASS (klass),
_gtk_marshal_BOOLEAN__BOXEDv);
_gtk_marshal_BOOLEAN__POINTERv);
}
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)
{
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 ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END)
priv->accum_touchpad_angle = 0;

View File

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

View File

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

View File

@ -2275,11 +2275,10 @@ gtk_icon_view_button_press (GtkGestureClick *gesture,
}
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;
}
@ -2293,7 +2292,7 @@ gtk_icon_view_button_release (GtkGestureClick *gesture,
GtkIconView *icon_view = user_data;
int button = gtk_gesture_single_get_current_button (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)
icon_view->priv->pressed_button = -1;

View File

@ -806,7 +806,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
translated.consumed = 0;
translated.layout = 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_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 ());
gdk_event_init_types ();
gsk_ensure_resources ();
gsk_render_node_init_types ();
_gtk_ensure_resources ();
@ -1109,7 +1110,7 @@ rewrite_event_for_surface (GdkEvent *event,
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
return gdk_event_button_new (type,
return gdk_button_event_new (type,
new_surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
@ -1120,7 +1121,7 @@ rewrite_event_for_surface (GdkEvent *event,
x, y,
NULL); // FIXME copy axes
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_source_device (event),
gdk_event_get_device_tool (event),
@ -1132,7 +1133,7 @@ rewrite_event_for_surface (GdkEvent *event,
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
return gdk_event_touch_new (type,
return gdk_touch_event_new (type,
gdk_event_get_event_sequence (event),
new_surface,
gdk_event_get_device (event),
@ -1144,7 +1145,7 @@ rewrite_event_for_surface (GdkEvent *event,
gdk_touch_event_get_emulating_pointer (event));
case GDK_TOUCHPAD_SWIPE:
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_source_device (event),
gdk_event_get_time (event),
@ -1155,7 +1156,7 @@ rewrite_event_for_surface (GdkEvent *event,
dx, dy);
case GDK_TOUCHPAD_PINCH:
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_source_device (event),
gdk_event_get_time (event),
@ -1164,8 +1165,8 @@ rewrite_event_for_surface (GdkEvent *event,
x, y,
gdk_touchpad_event_get_n_fingers (event),
dx, dy,
gdk_touchpad_pinch_event_get_scale (event),
gdk_touchpad_pinch_event_get_angle_delta (event));
gdk_touchpad_event_get_pinch_scale (event),
gdk_touchpad_event_get_pinch_angle_delta (event));
default:
break;
}
@ -1230,6 +1231,7 @@ static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event)
{
GdkSurface *surface;
GdkKeyEvent *key_event;
surface = gdk_event_get_surface (event);
if (!surface->parent)
@ -1238,7 +1240,10 @@ rewrite_event_for_toplevel (GdkEvent *event)
while (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,
gdk_event_get_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_event_get_modifier_state (event),
gdk_key_event_is_modifier (event),
&event->key.translated[0],
&event->key.translated[1]);
&key_event->translated[0],
&key_event->translated[1]);
}
static gboolean
@ -1505,7 +1510,7 @@ handle_pointing_event (GdkEvent *event)
break;
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);
gtk_drop_begin_event (drop, GDK_DRAG_LEAVE);
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) &&
(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_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);
}
else if (type == GDK_TOUCH_BEGIN)
@ -1740,7 +1745,7 @@ gtk_main_do_event (GdkEvent *event)
case GDK_DRAG_MOTION:
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_propagate_event (target_widget, event);
gtk_drop_end_event (drop);

View File

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

View File

@ -243,13 +243,13 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
{
case GDK_PAD_BUTTON_PRESS:
type = GTK_PAD_ACTION_BUTTON;
index = gdk_pad_button_event_get_button (event);
index = gdk_pad_event_get_button (event);
break;
case GDK_PAD_RING:
case GDK_PAD_STRIP:
type = event_type == GDK_PAD_RING ?
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;
default:
return GDK_EVENT_PROPAGATE;

View File

@ -1963,7 +1963,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
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_surface (event),
gdk_event_get_device (event),
@ -1976,7 +1976,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
break;
case GDK_BUTTON_PRESS:
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_device (event),
gdk_event_get_source_device (event),
@ -2002,7 +2002,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
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_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);
static void gtk_window_do_popup (GtkWindow *window,
GdkEventButton *event);
GdkEvent *event);
static void gtk_window_css_changed (GtkWidget *widget,
GtkCssStyleChange *change);
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"))
gdk_toplevel_minimize (GDK_TOPLEVEL (priv->surface));
else if (g_str_equal (action, "menu"))
gtk_window_do_popup (window, (GdkEventButton*) event);
gtk_window_do_popup (window, event);
else
{
g_warning ("Unsupported titlebar action %s", action);
@ -5895,8 +5895,8 @@ close_window_clicked (GtkModelButton *button,
}
static void
gtk_window_do_popup_fallback (GtkWindow *window,
GdkEventButton *event)
gtk_window_do_popup_fallback (GtkWindow *window,
GdkEvent *event)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *menuitem;
@ -6005,12 +6005,12 @@ gtk_window_do_popup_fallback (GtkWindow *window,
}
static void
gtk_window_do_popup (GtkWindow *window,
GdkEventButton *event)
gtk_window_do_popup (GtkWindow *window,
GdkEvent *event)
{
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);
}

View File

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

View File

@ -1,84 +1,36 @@
#include <gtk/gtk.h>
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventKey GdkEventKey;
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];
};
#define GTK_COMPILATION
#include "gdk/gdkeventsprivate.h"
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);
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)
key_event_new (GdkEventType event_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 ||
type == GDK_KEY_RELEASE, NULL);
event->event_type = event_type;
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;
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;
return event;
}
static void
@ -378,16 +330,16 @@ test_trigger_trigger (void)
translated.consumed = 0;
translated.layout = keys[0].group;
translated.level = keys[0].level;
event = gdk_event_key_new (GDK_KEY_PRESS,
surface,
device,
device,
GDK_CURRENT_TIME,
keys[0].keycode,
tests[i].state,
FALSE,
&translated,
&translated);
event = key_event_new (GDK_KEY_PRESS,
surface,
device,
device,
GDK_CURRENT_TIME,
keys[0].keycode,
tests[i].state,
FALSE,
&translated,
&translated);
for (j = 0; j < 4; j++)
{
g_assert_cmpint (gtk_shortcut_trigger_trigger (trigger[j], event, tests[i].mnemonic), ==, tests[i].result[j]);