events: reorganize getters

Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
This commit is contained in:
Matthias Clasen 2020-02-17 22:11:56 -05:00
parent f1cf0eb3fc
commit b1eaa502df
50 changed files with 1455 additions and 1776 deletions

View File

@ -105,7 +105,7 @@ day_selected_cb (GtkCalendar *calendar,
if (gdk_event_get_event_type (event) != GDK_BUTTON_PRESS)
return;
gdk_event_get_coords (event, &x, &y);
gdk_event_get_position (event, &x, &y);
gtk_widget_translate_coordinates (gtk_get_event_widget (event),
GTK_WIDGET (calendar),
x, y,

View File

@ -141,7 +141,7 @@ clicked (GtkGestureClick *gesture,
window = gtk_widget_get_ancestor (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)), GTK_TYPE_WINDOW);
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), NULL);
gdk_event_get_state (event, &state);
state = gdk_event_get_modifier_state (event);
if (state & GDK_CONTROL_MASK)
{

View File

@ -43,7 +43,7 @@
* context = gdk_display_get_app_launch_context (display);
*
* gdk_app_launch_context_set_display (display);
* gdk_app_launch_context_set_timestamp (event->time);
* gdk_app_launch_context_set_timestamp (gdk_event_get_time (event));
*
* if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
* g_warning ("Launching failed: %s\n", error->message);

File diff suppressed because it is too large Load Diff

View File

@ -330,159 +330,137 @@ typedef enum
} GdkCrossingMode;
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
GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkEvent * gdk_event_ref (GdkEvent *event);
GdkEvent * gdk_event_ref (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_event_unref (GdkEvent *event);
void gdk_event_unref (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_event_get_surface (GdkEvent *event);
GdkEventType gdk_event_get_event_type (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint32 gdk_event_get_time (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_state (GdkEvent *event,
GdkModifierType *state);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_coords (GdkEvent *event,
gdouble *x_win,
gdouble *y_win);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_button (GdkEvent *event,
guint *button);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_click_count (GdkEvent *event,
guint *click_count);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_keyval (GdkEvent *event,
guint *keyval);
GdkSurface * gdk_event_get_surface (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_keycode (GdkEvent *event,
guint16 *keycode);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_key_is_modifier (GdkEvent *event,
gboolean *is_modifier);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_key_group (GdkEvent *event,
guint *group);
GdkDevice * gdk_event_get_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_scroll_direction (GdkEvent *event,
GdkScrollDirection *direction);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_scroll_deltas (GdkEvent *event,
gdouble *delta_x,
gdouble *delta_y);
GdkDevice * gdk_event_get_source_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_is_scroll_stop_event (GdkEvent *event);
GdkDeviceTool * gdk_event_get_device_tool (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_axis (GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value);
GDK_AVAILABLE_IN_ALL
GdkDevice* gdk_event_get_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkDevice* gdk_event_get_source_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_triggers_context_menu (GdkEvent *event);
guint32 gdk_event_get_time (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_events_get_distance (GdkEvent *event1,
GdkEvent *event2,
gdouble *distance);
GDK_AVAILABLE_IN_ALL
gboolean gdk_events_get_angle (GdkEvent *event1,
GdkEvent *event2,
gdouble *angle);
GDK_AVAILABLE_IN_ALL
gboolean gdk_events_get_center (GdkEvent *event1,
GdkEvent *event2,
gdouble *x,
gdouble *y);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gdk_event_get_display (GdkEvent *event);
GdkDisplay * gdk_event_get_display (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkEventSequence *gdk_event_get_event_sequence (GdkEvent *event);
GdkEventSequence * gdk_event_get_event_sequence (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkEventType gdk_event_get_event_type (GdkEvent *event);
GdkModifierType gdk_event_get_modifier_state (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkSeat *gdk_event_get_seat (GdkEvent *event);
gboolean gdk_event_get_position (GdkEvent *event,
double *x,
double *y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_axes (GdkEvent *event,
double **axes,
guint *n_axes);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_axis (GdkEvent *event,
GdkAxisUse axis_use,
double *value);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool *gdk_event_get_device_tool (GdkEvent *event);
guint gdk_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkScrollDirection gdk_scroll_event_get_direction (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event,
double *delta_x,
double *delta_y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keyval (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keycode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_scancode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_group (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_is_modifier (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_focus_event_get_in (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_touch_event_get_emulating_pointer (GdkEvent *event);
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
void gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_touchpad_event_get_n_fingers (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
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);
GDK_AVAILABLE_IN_ALL
double gdk_touchpad_pinch_event_get_scale (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_pad_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_pad_axis_event_get_value (GdkEvent *event,
guint *index,
double *value);
GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_drag_event_get_drop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_grab_broken_event_get_grab_surface (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
int gdk_event_get_scancode (GdkEvent *event);
GList * gdk_event_get_motion_history (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
gboolean gdk_event_triggers_context_menu (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_is_sent (GdkEvent *event);
gboolean gdk_events_get_distance (GdkEvent *event1,
GdkEvent *event2,
double *distance);
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_event_get_drop (GdkEvent *event);
gboolean gdk_events_get_angle (GdkEvent *event1,
GdkEvent *event2,
double *angle);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_crossing_mode (GdkEvent *event,
GdkCrossingMode *mode);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_crossing_detail (GdkEvent *event,
GdkNotifyType *detail);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touchpad_gesture_phase (GdkEvent *event,
GdkTouchpadGesturePhase *phase);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touchpad_gesture_n_fingers (GdkEvent *event,
guint *n_fingers);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touchpad_deltas (GdkEvent *event,
double *dx,
double *dy);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touchpad_angle_delta (GdkEvent *event,
double *delta);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touchpad_scale (GdkEvent *event,
double *scale);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_touch_emulating_pointer (GdkEvent *event,
gboolean *emulating);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_grab_surface (GdkEvent *event,
GdkSurface **surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_focus_in (GdkEvent *event,
gboolean *focus_in);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pad_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pad_button (GdkEvent *event,
guint *button);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pad_axis_value (GdkEvent *event,
guint *index,
gdouble *value);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_axes (GdkEvent *event,
gdouble **axes,
guint *n_axes);
GDK_AVAILABLE_IN_ALL
GList * gdk_event_get_motion_history (GdkEvent *event);
gboolean gdk_events_get_center (GdkEvent *event1,
GdkEvent *event2,
double *x,
double *y);
G_END_DECLS

View File

@ -521,55 +521,9 @@ struct _GdkEventPadGroupMode {
/*
* GdkEvent:
* @type: the #GdkEventType
* @any: a #GdkEventAny
* @motion: a #GdkEventMotion
* @button: a #GdkEventButton
* @touch: a #GdkEventTouch
* @scroll: a #GdkEventScroll
* @key: a #GdkEventKey
* @crossing: a #GdkEventCrossing
* @focus_change: a #GdkEventFocus
* @configure: a #GdkEventConfigure
* @proximity: a #GdkEventProximity
* @dnd: a #GdkEventDND
* @grab_broken: a #GdkEventGrabBroken
* @touchpad_swipe: a #GdkEventTouchpadSwipe
* @touchpad_pinch: a #GdkEventTouchpadPinch
* @pad_button: a #GdkEventPadButton
* @pad_axis: a #GdkEventPadAxis
* @pad_group_mode: a #GdkEventPadGroupMode
*
* A #GdkEvent contains a union of all of the event types,
* and allows access to the data fields in a number of ways.
*
* The event type is always the first field in all of the event types, and
* can always be accessed with the following code, no matter what type of
* event it is:
* |[<!-- language="C" -->
* GdkEvent *event;
* GdkEventType type;
*
* type = event->type;
* ]|
*
* To access other fields of the event, the pointer to the event
* can be cast to the appropriate event type, or the union member
* name can be used. For example if the event type is %GDK_BUTTON_PRESS
* then the x coordinate of the button press can be accessed with:
* |[<!-- language="C" -->
* GdkEvent *event;
* gdouble x;
*
* x = ((GdkEventButton*)event)->x;
* ]|
* or:
* |[<!-- language="C" -->
* GdkEvent *event;
* gdouble x;
*
* x = event->button.x;
* ]|
* The GdkEvent struct is private and should only be accessed
* using the accessor functions.
*/
union _GdkEvent
{

View File

@ -559,11 +559,14 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
* |[<!-- language="C" -->
* // We want to ignore irrelevant modifiers like ScrollLock
* #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
* gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
* event->state, event->group,
* state = gdk_event_get_modifier_state (event);
* gdk_keymap_translate_keyboard_state (keymap,
* gdk_key_event_get_keycode (event),
* state,
* gdk_key_event_get_group (event),
* &keyval, NULL, NULL, &consumed);
* if (keyval == GDK_PLUS &&
* (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
* (state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
* // Control was pressed
* ]|
*
@ -574,7 +577,7 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
* |[<!-- language="C" -->
* // XXX Dont do this XXX
* if (keyval == accel_keyval &&
* (event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
* (state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
* // Accelerator was pressed
* ]|
*

View File

@ -2675,6 +2675,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
GdkDeviceGrabInfo *button_release_grab;
GdkPointerSurfaceInfo *pointer_info = NULL;
GdkDevice *device, *source_device;
GdkEventType type;
_gdk_display_update_last_event (display, event);
@ -2708,21 +2709,21 @@ _gdk_windowing_got_event (GdkDisplay *display,
}
}
event_surface = event->any.surface;
event_surface = gdk_event_get_surface (event);
if (!event_surface)
goto out;
if (event->any.type == GDK_ENTER_NOTIFY)
type = gdk_event_get_event_type (event);
if (type == GDK_ENTER_NOTIFY)
_gdk_display_set_surface_under_pointer (display, device, event_surface);
else if (event->any.type == GDK_LEAVE_NOTIFY)
else if (type == GDK_LEAVE_NOTIFY)
_gdk_display_set_surface_under_pointer (display, device, NULL);
if ((event->any.type == GDK_BUTTON_RELEASE ||
event->any.type == GDK_TOUCH_CANCEL ||
event->any.type == GDK_TOUCH_END) &&
!event->any.send_event)
if (type == GDK_BUTTON_RELEASE ||
type == GDK_TOUCH_CANCEL ||
type == GDK_TOUCH_END)
{
if (event->any.type == GDK_BUTTON_RELEASE ||
if (type == GDK_BUTTON_RELEASE ||
gdk_event_get_pointer_emulated (event))
{
button_release_grab =
@ -2730,7 +2731,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
if (button_release_grab &&
button_release_grab->implicit &&
(event->button.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (event->button.button - 1))) == 0)
(gdk_event_get_modifier_state (event) & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (gdk_button_event_get_button (event) - 1))) == 0)
{
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = FALSE;
@ -3995,16 +3996,29 @@ is_key_event (GdkEvent *event)
return FALSE;
}
static void
static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event)
{
GdkSurface *surface;
surface = gdk_event_get_surface (event);
if (!surface->parent)
return gdk_event_ref (event);
while (surface->parent)
surface = surface->parent;
g_set_object (&event->any.surface, surface);
return gdk_event_key_new (gdk_event_get_event_type (event),
surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_key_event_get_keyval (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_scancode (event),
gdk_key_event_get_group (event),
gdk_key_event_is_modifier (event));
}
static void
@ -4025,49 +4039,44 @@ add_event_mark (GdkEvent *event,
{
case GDK_MOTION_NOTIFY:
{
GdkEventMotion *motion = (GdkEventMotion *)event;
double x, y;
gdk_event_get_position (event, &x, &y);
message = g_strdup_printf ("{x=%lf, y=%lf, state=0x%x}",
motion->x, motion->y, motion->state);
x, y,
gdk_event_get_modifier_state (event));
break;
}
case GDK_BUTTON_PRESS:
{
GdkEventButton *button = (GdkEventButton *)event;
message = g_strdup_printf ("{button=%u, x=%lf, y=%lf, state=0x%x}",
button->button, button->x, button->y, button->state);
break;
}
case GDK_BUTTON_RELEASE:
{
GdkEventButton *button = (GdkEventButton *)event;
double x, y;
gdk_event_get_position (event, &x, &y);
message = g_strdup_printf ("{button=%u, x=%lf, y=%lf, state=0x%x}",
button->button, button->x, button->y, button->state);
gdk_button_event_get_button (event),
x, y,
gdk_event_get_modifier_state (event));
break;
}
case GDK_KEY_PRESS:
{
GdkEventKey *key = (GdkEventKey *)event;
message = g_strdup_printf ("{keyval=%u, state=0x%x, hardware_keycode=%u key_scancode=%u group=%u is_modifier=%u}",
key->keyval, key->state, key->hardware_keycode, key->key_scancode, key->group, key->is_modifier);
break;
}
case GDK_KEY_RELEASE:
{
GdkEventKey *key = (GdkEventKey *)event;
message = g_strdup_printf ("{keyval=%u, state=0x%x, hardware_keycode=%u key_scancode=%u group=%u is_modifier=%u}",
key->keyval, key->state, key->hardware_keycode, key->key_scancode, key->group, key->is_modifier);
gdk_key_event_get_keyval (event),
gdk_event_get_modifier_state (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_scancode (event),
gdk_key_event_get_group (event),
gdk_key_event_is_modifier (event));
break;
}
case GDK_CONFIGURE:
{
GdkEventConfigure *config = (GdkEventConfigure *)event;
message = g_strdup_printf ("{x=%d, y=%d, width=%d, height=%d}",
config->x, config->y, config->width, config->height);
int width, height;
gdk_configure_event_get_size (event, &width, &height);
message = g_strdup_printf ("{width=%d, height=%d}", width, height);
break;
}
@ -4127,9 +4136,15 @@ gdk_surface_handle_event (GdkEvent *event)
}
else
{
GdkEvent *emitted;
if (is_key_event (event))
rewrite_event_for_toplevel (event);
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
emitted = rewrite_event_for_toplevel (event);
else
emitted = gdk_event_ref (event);
g_signal_emit (gdk_event_get_surface (emitted), signals[EVENT], 0, emitted, &handled);
gdk_event_unref (emitted);
}
if (GDK_PROFILER_IS_RUNNING)

View File

@ -1478,7 +1478,7 @@ gdk_wayland_seat_set_frame_event (GdkWaylandSeat *seat,
GdkEvent *event)
{
if (seat->pointer_info.frame.event &&
seat->pointer_info.frame.event->any.type != event->any.type)
gdk_event_get_event_type (seat->pointer_info.frame.event) != gdk_event_get_event_type (event))
gdk_wayland_seat_flush_frame_event (seat);
seat->pointer_info.frame.event = event;
@ -1612,10 +1612,13 @@ pointer_handle_motion (void *data,
NULL);
gdk_wayland_seat_set_frame_event (seat, event);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("motion %f %f, seat %p state %d",
event->motion.x, event->motion.y,
seat, event->motion.state));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
}
if (display->seat_version < WL_POINTER_HAS_FRAME)
gdk_wayland_seat_flush_frame_event (seat);
@ -1683,10 +1686,10 @@ pointer_handle_button (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("button %d %s, seat %p state %d",
event->button.button,
gdk_button_event_get_button (event),
state ? "press" : "release",
seat,
event->button.state));
gdk_event_get_modifier_state (event)));
if (display->seat_version < WL_POINTER_HAS_FRAME)
gdk_wayland_seat_flush_frame_event (seat);
@ -1950,7 +1953,7 @@ keyboard_handle_leave (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("focus out, seat %p surface %p",
seat, event->any.surface));
seat, gdk_event_get_surface (event)));
_gdk_wayland_display_deliver_event (seat->display, event);
}
@ -2048,9 +2051,10 @@ deliver_key_event (GdkWaylandSeat *seat,
"mods 0x%x",
(state ? "press" : "release"),
(from_key_repeat ? " (repeat)" : ""),
event->any.surface,
event->key.hardware_keycode, event->key.keyval,
event->key.state));
gdk_event_get_surface (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_keyval (event),
gdk_event_get_modifier_state (event)));
if (!xkb_keymap_key_repeats (xkb_keymap, key))
return;
@ -2304,8 +2308,12 @@ touch_handle_down (void *data,
mimic_pointer_emulating_touch_info (seat->touch_master, touch);
}
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("touch begin %f %f", event->touch.x, event->touch.y));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
g_message ("touch begin %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
}
@ -2336,8 +2344,12 @@ touch_handle_up (void *data,
NULL,
touch->initial_touch);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("touch end %f %f", event->touch.x, event->touch.y));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("touch end %f %f", x, y);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -2377,8 +2389,12 @@ touch_handle_motion (void *data,
NULL,
touch->initial_touch);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("touch update %f %f", event->touch.x, event->touch.y));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
g_message ("touch update %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
}
@ -2451,11 +2467,14 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
n_fingers,
dx, dy);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
event->any.type, event->touchpad_swipe.x,
event->touchpad_swipe.y, seat,
event->touchpad_swipe.state));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event), x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
}
@ -2546,11 +2565,15 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
dx, dy,
scale, angle_delta * G_PI / 180);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
event->any.type, event->touchpad_pinch.x,
event->touchpad_pinch.y, seat,
event->touchpad_pinch.state));
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
}
@ -3217,6 +3240,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
guint32 time)
{
GdkEvent *event;
GdkEventType type;
event = tablet->pointer_info.frame.event;
tablet->pointer_info.frame.event = NULL;
@ -3226,16 +3250,18 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
gdk_event_ref (event);
if (event->any.type == GDK_PROXIMITY_OUT)
emulate_crossing (event->any.surface, NULL,
type = gdk_event_get_event_type (event);
if (type == GDK_PROXIMITY_OUT)
emulate_crossing (gdk_event_get_surface (event), NULL,
tablet->master, GDK_LEAVE_NOTIFY,
GDK_CROSSING_NORMAL, time);
_gdk_wayland_display_deliver_event (gdk_seat_get_display (tablet->seat),
event);
if (event->any.type == GDK_PROXIMITY_IN)
emulate_crossing (event->any.surface, NULL,
if (type == GDK_PROXIMITY_IN)
emulate_crossing (gdk_event_get_surface (event), NULL,
tablet->master, GDK_ENTER_NOTIFY,
GDK_CROSSING_NORMAL, time);
@ -3247,7 +3273,7 @@ gdk_wayland_tablet_set_frame_event (GdkWaylandTabletData *tablet,
GdkEvent *event)
{
if (tablet->pointer_info.frame.event &&
tablet->pointer_info.frame.event->any.type != event->any.type)
gdk_event_get_event_type (tablet->pointer_info.frame.event) != gdk_event_get_event_type (event))
gdk_wayland_tablet_flush_frame_event (tablet, GDK_CURRENT_TIME);
tablet->pointer_info.frame.event = event;
@ -3703,7 +3729,7 @@ tablet_tool_handle_frame (void *data,
frame_event = tablet->pointer_info.frame.event;
if (frame_event && frame_event->any.type == GDK_PROXIMITY_OUT)
if (frame_event && gdk_event_get_event_type (frame_event) == GDK_PROXIMITY_OUT)
{
tool->current_tablet = NULL;
tablet->current_tool = NULL;

View File

@ -3841,7 +3841,7 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
device = GDK_WAYLAND_DEVICE (gdk_event_get_device (event));
seat = gdk_wayland_device_get_wl_seat (GDK_DEVICE (device));
gdk_event_get_coords (event, &x, &y);
gdk_event_get_position (event, &x, &y);
serial = _gdk_wayland_device_get_implicit_grab_serial (device, event);

View File

@ -758,13 +758,16 @@ void
_gdk_win32_print_event (GdkEvent *event)
{
const char *kvname;
double x, y;
GdkCrossingMode mode;
GdkNotifyType detail;
GdkScrollDirection direction;
g_print ("%s%*s===> ", (debug_indent > 0 ? "\n" : ""), debug_indent, "");
switch (event->any.type)
switch (gdk_event_get_event_type (event))
{
#define CASE(x) case x: g_print (#x); break;
CASE (GDK_DELETE);
CASE (GDK_DESTROY);
CASE (GDK_MOTION_NOTIFY);
CASE (GDK_BUTTON_PRESS);
CASE (GDK_BUTTON_RELEASE);
@ -786,81 +789,72 @@ _gdk_win32_print_event (GdkEvent *event)
}
g_print (" %p @ %ums ",
event->any.surface ? GDK_SURFACE_HWND (event->any.surface) : NULL,
GDK_SURFACE_HWND (gdk_event_get_surface (event)),
gdk_event_get_time (event));
switch (event->any.type)
switch (gdk_event_get_event_type (event))
{
case GDK_MOTION_NOTIFY:
g_print ("(%.4g,%.4g) (%.4g,%.4g)",
event->motion.x, event->motion.y,
event->motion.x_root, event->motion.y_root);
print_event_state (event->motion.state);
gdk_event_get_position (event, &x, &y);
g_print ("(%.4g,%.4g) ", x, y);
print_event_state (gdk_event_get_modifier_state (event));
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
g_print ("%d (%.4g,%.4g) (%.4g,%.4g) ",
event->button.button,
event->button.x, event->button.y,
event->button.x_root, event->button.y_root);
print_event_state (event->button.state);
gdk_event_get_position (event, &x, &y);
g_print ("%d (%.4g,%.4g) ", gdk_button_event_get_button (event), x, y);
print_event_state (gdk_event_get_modifier_state (event));
break;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
kvname = gdk_keyval_name (event->key.keyval);
kvname = gdk_keyval_name (gdk_key_event_get_keyval (event));
g_print ("%#.02x group:%d %s",
event->key.hardware_keycode, event->key.group,
gdk_key_event_get_keycode (event),
gdk_key_event_get_group (event),
(kvname ? kvname : "??"));
print_event_state (event->key.state);
print_event_state (gdk_event_get_modifier_state (event));
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
g_print ("%p (%.4g,%.4g) (%.4g,%.4g) %s %s%s",
event->crossing.child_surface == NULL ? NULL : GDK_SURFACE_HWND (event->crossing.child_surface),
event->crossing.x, event->crossing.y,
event->crossing.x_root, event->crossing.y_root,
(event->crossing.mode == GDK_CROSSING_NORMAL ? "NORMAL" :
(event->crossing.mode == GDK_CROSSING_GRAB ? "GRAB" :
(event->crossing.mode == GDK_CROSSING_UNGRAB ? "UNGRAB" :
gdk_event_get_position (event, &x, &y);
mode = gdk_crossing_event_get_mode (event);
detail = gdk_crossing_event_get_detail (event);
g_print ("(%.4g,%.4g) %s %s",
x, y,
(mode == GDK_CROSSING_NORMAL ? "NORMAL" :
(mode == GDK_CROSSING_GRAB ? "GRAB" :
(mode == GDK_CROSSING_UNGRAB ? "UNGRAB" :
"???"))),
(event->crossing.detail == GDK_NOTIFY_ANCESTOR ? "ANCESTOR" :
(event->crossing.detail == GDK_NOTIFY_VIRTUAL ? "VIRTUAL" :
(event->crossing.detail == GDK_NOTIFY_INFERIOR ? "INFERIOR" :
(event->crossing.detail == GDK_NOTIFY_NONLINEAR ? "NONLINEAR" :
(event->crossing.detail == GDK_NOTIFY_NONLINEAR_VIRTUAL ? "NONLINEAR_VIRTUAL" :
(event->crossing.detail == GDK_NOTIFY_UNKNOWN ? "UNKNOWN" :
"???")))))),
event->crossing.focus ? " FOCUS" : "");
print_event_state (event->crossing.state);
(detail == GDK_NOTIFY_ANCESTOR ? "ANCESTOR" :
(detail == GDK_NOTIFY_VIRTUAL ? "VIRTUAL" :
(detail == GDK_NOTIFY_INFERIOR ? "INFERIOR" :
(detail == GDK_NOTIFY_NONLINEAR ? "NONLINEAR" :
(detail == GDK_NOTIFY_NONLINEAR_VIRTUAL ? "NONLINEAR_VIRTUAL" :
(detail == GDK_NOTIFY_UNKNOWN ? "UNKNOWN" :
"???")))))));
print_event_state (gdk_event_get_modifier_state (event));
break;
case GDK_FOCUS_CHANGE:
g_print ("%s", (event->focus_change.in ? "IN" : "OUT"));
g_print ("%s", (gdk_focus_event_get_in (event) ? "IN" : "OUT"));
break;
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
case GDK_DROP_START:
if (event->dnd.drop != NULL)
g_print ("ctx:%p: %s",
event->dnd.drop,
_gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG (event->dnd.drop)->protocol));
g_print ("DND");
break;
case GDK_SCROLL:
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
event->scroll.x, event->scroll.y,
event->scroll.x_root, event->scroll.y_root,
(event->scroll.direction == GDK_SCROLL_UP ? "UP" :
(event->scroll.direction == GDK_SCROLL_DOWN ? "DOWN" :
(event->scroll.direction == GDK_SCROLL_LEFT ? "LEFT" :
(event->scroll.direction == GDK_SCROLL_RIGHT ? "RIGHT" :
direction = gdk_scroll_event_get_direction (event);
g_print (" %s ",
(direction == GDK_SCROLL_UP ? "UP" :
(direction == GDK_SCROLL_DOWN ? "DOWN" :
(direction == GDK_SCROLL_LEFT ? "LEFT" :
(direction == GDK_SCROLL_RIGHT ? "RIGHT" :
"???")))));
print_event_state (event->scroll.state);
print_event_state (gdk_event_get_modifier_state (event));
break;
case GDK_GRAB_BROKEN:
g_print ("%s %s %p",
(event->grab_broken.keyboard ? "KEYBOARD" : "POINTER"),
(event->grab_broken.implicit ? "IMPLICIT" : "EXPLICIT"),
(event->grab_broken.grab_surface ? GDK_SURFACE_HWND (event->grab_broken.grab_surface) : 0));
g_print ("Grab broken");
default:
/* Nothing */
break;

View File

@ -4969,7 +4969,7 @@ gdk_win32_surface_show_window_menu (GdkSurface *window,
return FALSE;
}
gdk_event_get_coords (event, &event_x, &event_y);
gdk_event_get_position (event, &event_x, &event_y);
x = round (event_x);
y = round (event_y);

View File

@ -1183,7 +1183,7 @@ set_user_time (GdkEvent *event)
GdkSurface *surface;
guint32 time;
surface = event->any.surface;
surface = gdk_event_get_surface (event);
g_return_if_fail (GDK_IS_SURFACE (surface));
time = gdk_event_get_time (event);
@ -1656,16 +1656,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->sourceid));
axes = translate_axes (device,
event->button.x,
event->button.y,
event->any.surface,
(double) xev->event_x / scale,
(double) xev->event_y / scale,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, event->button.axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, event->button.axes, GDK_AXIS_Y, &y);
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
@ -1741,16 +1741,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
}
axes = translate_axes (device,
event->motion.x,
event->motion.y,
event->any.surface,
(double) xev->event_x / scale,
(double) xev->event_y / scale,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_Y, &y);
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
@ -1798,16 +1798,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state |= GDK_BUTTON1_MASK;
axes = translate_axes (device,
event->touch.x,
event->touch.y,
event->any.surface,
(double) xev->event_x / scale,
(double) xev->event_y / scale,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_Y, &y);
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
@ -1856,16 +1856,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state |= GDK_BUTTON1_MASK;
axes = translate_axes (device,
event->touch.x,
event->touch.y,
event->any.surface,
(double) xev->event_x / scale,
(double) xev->event_y / scale,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_Y, &y);
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{

View File

@ -2244,16 +2244,15 @@ static gboolean
gdk_dnd_handle_motion_event (GdkDrag *drag,
GdkEvent *event)
{
GdkModifierType state;
double x, y;
int x_root, y_root;
if (!gdk_event_get_state ((GdkEvent *) event, &state))
return FALSE;
x_root = event->any.surface->x + event->motion.x;
y_root = event->any.surface->y + event->motion.y;
gdk_drag_update (drag, x_root, y_root, state,
gdk_event_get_time ((GdkEvent *) event));
gdk_event_get_position (event, &x, &y);
x_root = event->any.surface->x + x;
y_root = event->any.surface->y + y;
gdk_drag_update (drag, x_root, y_root,
gdk_event_get_modifier_state (event),
gdk_event_get_time (event));
return TRUE;
}

View File

@ -135,8 +135,8 @@ create_synth_crossing_event (GdkEventType evtype,
g_assert (evtype == GDK_ENTER_NOTIFY || evtype == GDK_LEAVE_NOTIFY);
gdk_event_get_state (real_event, &state);
gdk_event_get_coords (real_event, &x, &y);
state = gdk_event_get_modifier_state (real_event);
gdk_event_get_position (real_event, &x, &y);
event = gdk_event_crossing_new (evtype,
real_event->any.surface,
gdk_event_get_device (real_event),

View File

@ -4651,7 +4651,7 @@ gdk_x11_surface_show_window_menu (GdkSurface *surface,
g_intern_static_string ("_GTK_SHOW_WINDOW_MENU")))
return FALSE;
gdk_event_get_coords (event, &x, &y);
gdk_event_get_position (event, &x, &y);
gdk_x11_surface_get_root_coords (surface, x, y, &x_root, &y_root);
device = gdk_event_get_device (event);
g_object_get (G_OBJECT (device),

View File

@ -118,9 +118,9 @@ atk_key_event_from_gdk_event_key (GdkEventKey *key,
guint16 keycode;
type = gdk_event_get_event_type ((GdkEvent *)key);
gdk_event_get_state ((GdkEvent *)key, &state);
gdk_event_get_keyval ((GdkEvent *)key, &keyval);
gdk_event_get_keycode ((GdkEvent *)key, &keycode);
state = gdk_event_get_modifier_state ((GdkEvent *)key);
keyval = gdk_key_event_get_keyval ((GdkEvent *)key);
keycode = gdk_key_event_get_keycode ((GdkEvent *)key);
if (type == GDK_KEY_PRESS)
event->type = ATK_KEY_EVENT_PRESS;

View File

@ -1771,9 +1771,6 @@ gtk_bindings_activate_event (GObject *object,
GdkDisplay *display;
GtkKeyHash *key_hash;
gboolean handled = FALSE;
guint16 keycode;
GdkModifierType state;
guint group;
if (!GTK_IS_WIDGET (object))
return FALSE;
@ -1781,15 +1778,11 @@ gtk_bindings_activate_event (GObject *object,
display = gtk_widget_get_display (GTK_WIDGET (object));
key_hash = binding_key_hash_for_keymap (gdk_display_get_keymap (display));
gdk_event_get_keycode ((GdkEvent *)event, &keycode);
gdk_event_get_state ((GdkEvent *)event, &state);
gdk_event_get_key_group ((GdkEvent *)event, &group);
entries = _gtk_key_hash_lookup (key_hash,
keycode,
state,
gdk_key_event_get_keycode ((GdkEvent *)event),
gdk_event_get_modifier_state ((GdkEvent *)event),
BINDING_MOD_MASK () & ~GDK_RELEASE_MASK,
group);
gdk_key_event_get_group((GdkEvent *)event));
handled = gtk_bindings_activate_list (object, entries,
gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_RELEASE);

View File

@ -322,7 +322,7 @@ touch_release_in_button (GtkButton *button)
return FALSE;
}
gdk_event_get_coords (event, &x, &y);
gdk_event_get_position (event, &x, &y);
gdk_event_unref (event);

View File

@ -1024,12 +1024,9 @@ gtk_cell_area_real_event (GtkCellArea *area,
if (event_type == GDK_KEY_PRESS && (flags & GTK_CELL_RENDERER_FOCUSED) != 0)
{
guint keyval;
/* Cancel any edits in progress */
if (priv->edited_cell &&
gdk_event_get_keyval (event, &keyval) &&
keyval == GDK_KEY_Escape)
gdk_key_event_get_keyval (event) == GDK_KEY_Escape)
{
gtk_cell_area_stop_editing (area, TRUE);
retval = TRUE;
@ -1039,7 +1036,8 @@ gtk_cell_area_real_event (GtkCellArea *area,
{
guint button;
if (gdk_event_get_button (event, &button) && button == GDK_BUTTON_PRIMARY)
button = gdk_button_event_get_button (event);
if (button == GDK_BUTTON_PRIMARY)
{
GtkCellRenderer *renderer = NULL;
GtkCellRenderer *focus_renderer;
@ -1048,7 +1046,7 @@ gtk_cell_area_real_event (GtkCellArea *area,
/* We may need some semantics to tell us the offset of the event
* window we are handling events for (i.e. GtkTreeView has a bin_window) */
gdk_event_get_coords (event, &event_x, &event_y);
gdk_event_get_position (event, &event_x, &event_y);
/* Dont try to search for an event coordinate that is not in the area, that will
* trigger a runtime warning.

View File

@ -766,7 +766,7 @@ gtk_drop_target_handle_event (GtkEventController *controller,
GtkDropStatus status;
gboolean found = FALSE;
drop = gdk_event_get_drop (event);
drop = gdk_drag_event_get_drop (event);
status = gtk_drop_target_get_drop_status (dest, drop);
if (status == GTK_DROP_STATUS_DENIED)
@ -818,7 +818,7 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
g_return_if_fail (event != NULL);
event_type = gdk_event_get_event_type (event);
drop = gdk_event_get_drop (event);
drop = gdk_drag_event_get_drop (event);
switch ((guint) event_type)
{

View File

@ -207,7 +207,7 @@ gtk_drag_source_filter_event (GtkEventController *controller,
guint n_fingers;
g_object_get (G_OBJECT (controller), "n-points", &n_points, NULL);
gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers == n_points)
return FALSE;

View File

@ -120,7 +120,7 @@ gtk_event_controller_key_handle_event (GtkEventController *controller,
key->current_event = event;
gdk_event_get_state (event, &state);
state = gdk_event_get_modifier_state (event);
if (key->state != state)
{
gboolean unused;
@ -129,8 +129,8 @@ gtk_event_controller_key_handle_event (GtkEventController *controller,
g_signal_emit (controller, signals[MODIFIERS], 0, state, &unused);
}
gdk_event_get_keycode (event, &keycode);
gdk_event_get_keyval (event, &keyval);
keycode = gdk_key_event_get_keycode (event);
keyval = gdk_key_event_get_keyval (event);
if (event_type == GDK_KEY_PRESS)
{
@ -495,21 +495,17 @@ gtk_event_controller_key_forward (GtkEventControllerKey *controller,
* @controller: a #GtkEventControllerKey
*
* Gets the key group of the current event of this @controller.
* See gdk_event_get_key_group().
* See gdk_key_event_get_group().
*
* Returns: the key group
**/
guint
gtk_event_controller_key_get_group (GtkEventControllerKey *controller)
{
guint group;
g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_KEY (controller), FALSE);
g_return_val_if_fail (controller->current_event != NULL, FALSE);
gdk_event_get_key_group (controller->current_event, &group);
return group;
return gdk_key_event_get_group (controller->current_event);
}
/**

View File

@ -249,17 +249,20 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
if (gdk_event_get_event_type (event) != GDK_SCROLL)
return FALSE;
if ((scroll->flags & (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL)) == 0)
return FALSE;
/* FIXME: Handle device changes */
if (gdk_event_get_scroll_deltas (event, &dx, &dy))
direction = gdk_scroll_event_get_direction (event);
if (direction == GDK_SCROLL_SMOOTH)
{
GdkDevice *device = gdk_event_get_source_device (event);
GdkInputSource input_source = gdk_device_get_source (device);
gdk_scroll_event_get_deltas (event, &dx, &dy);
if (!scroll->active &&
(input_source == GDK_SOURCE_TRACKPOINT ||
input_source == GDK_SOURCE_TOUCHPAD))
@ -297,7 +300,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
}
}
}
else if (gdk_event_get_scroll_direction (event, &direction))
else
{
switch (direction)
{
@ -333,7 +336,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
}
if (scroll->active && gdk_event_is_scroll_stop_event (event))
if (scroll->active && gdk_scroll_event_is_stop (event))
{
g_signal_emit (controller, signals[SCROLL_END], 0);
scroll->active = FALSE;

View File

@ -236,7 +236,7 @@ _gtk_gesture_get_n_touchpad_points (GtkGesture *gesture,
GtkGesturePrivate *priv;
PointData *data;
GdkEventType event_type;
GdkTouchpadGesturePhase phase;
GdkTouchpadGesturePhase phase = 0;
guint n_fingers = 0;
priv = gtk_gesture_get_instance_private (gesture);
@ -251,7 +251,11 @@ _gtk_gesture_get_n_touchpad_points (GtkGesture *gesture,
event_type = gdk_event_get_event_type (data->event);
gdk_event_get_touchpad_gesture_phase (data->event, &phase);
if (EVENT_IS_TOUCHPAD_GESTURE (data->event))
{
phase = gdk_touchpad_event_get_gesture_phase (data->event);
n_fingers = gdk_touchpad_event_get_n_fingers (data->event);
}
if (only_active &&
(data->state == GTK_EVENT_SEQUENCE_DENIED ||
@ -259,9 +263,6 @@ _gtk_gesture_get_n_touchpad_points (GtkGesture *gesture,
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END)))
return 0;
if (!gdk_event_get_touchpad_gesture_n_fingers (data->event, &n_fingers))
return 0;
return n_fingers;
}
@ -390,7 +391,6 @@ static void
_update_touchpad_deltas (PointData *data)
{
GdkEvent *event = data->event;
GdkEventType event_type;
GdkTouchpadGesturePhase phase;
double dx;
double dy;
@ -398,13 +398,10 @@ _update_touchpad_deltas (PointData *data)
if (!event)
return;
event_type = gdk_event_get_event_type (event);
gdk_event_get_touchpad_gesture_phase (event, &phase);
gdk_event_get_touchpad_deltas (event, &dx, &dy);
if (event_type == GDK_TOUCHPAD_SWIPE ||
event_type == GDK_TOUCHPAD_PINCH)
if (EVENT_IS_TOUCHPAD_GESTURE (event))
{
phase = gdk_touchpad_event_get_gesture_phase (event);
gdk_touchpad_event_get_deltas (event, &dx, &dy);
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
data->accum_dx = data->accum_dy = 0;
else if (phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE)
@ -452,9 +449,6 @@ _gtk_gesture_update_point (GtkGesture *gesture,
gboolean existed, touchpad;
PointData *data;
if (!gdk_event_get_coords (event, NULL, NULL))
return FALSE;
device = gdk_event_get_device (event);
if (!device)
@ -612,7 +606,7 @@ gtk_gesture_handle_event (GtkEventController *controller,
GdkDevice *source_device;
gboolean was_recognized;
GdkEventType event_type;
GdkTouchpadGesturePhase phase;
GdkTouchpadGesturePhase phase = 0;
GdkModifierType state;
GtkWidget *target;
@ -625,8 +619,9 @@ gtk_gesture_handle_event (GtkEventController *controller,
sequence = gdk_event_get_event_sequence (event);
was_recognized = gtk_gesture_is_recognized (gesture);
event_type = gdk_event_get_event_type (event);
gdk_event_get_state (event, &state);
gdk_event_get_touchpad_gesture_phase (event, &phase);
state = gdk_event_get_modifier_state (event);
if (EVENT_IS_TOUCHPAD_GESTURE (event))
phase = gdk_touchpad_event_get_gesture_phase (event);
target = gtk_event_controller_get_target (controller);
@ -714,9 +709,9 @@ gtk_gesture_handle_event (GtkEventController *controller,
}
else if (event_type == GDK_GRAB_BROKEN)
{
GdkSurface *surface = NULL;
GdkSurface *surface;
gdk_event_get_grab_surface (event, &surface);
surface = gdk_grab_broken_event_get_grab_surface (event);
if (!surface || !gesture_within_surface (gesture, surface))
_gtk_gesture_cancel_all (gesture);
@ -1308,7 +1303,7 @@ gtk_gesture_get_bounding_box (GtkGesture *gesture,
event_type == GDK_BUTTON_RELEASE)
continue;
gdk_event_get_coords (data->event, &x, &y);
gdk_event_get_position (data->event, &x, &y);
n_points++;
x1 = MIN (x1, x);
y1 = MIN (y1, y);
@ -1630,7 +1625,6 @@ _gtk_gesture_get_pointer_emulating_sequence (GtkGesture *gesture,
GdkEventSequence *seq;
GHashTableIter iter;
PointData *data;
gboolean emulating;
g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
@ -1644,8 +1638,7 @@ _gtk_gesture_get_pointer_emulating_sequence (GtkGesture *gesture,
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
gdk_event_get_touch_emulating_pointer (data->event, &emulating);
if (!emulating)
if (!gdk_touch_event_get_emulating_pointer (data->event))
continue;
/* Fall through */
case GDK_BUTTON_PRESS:

View File

@ -213,7 +213,7 @@ gtk_gesture_click_begin (GtkGesture *gesture,
event_type = gdk_event_get_event_type (event);
if (event_type == GDK_BUTTON_PRESS)
gdk_event_get_button (event, &button);
button = gdk_button_event_get_button (event);
else if (event_type == GDK_TOUCH_BEGIN)
button = 1;
else
@ -325,7 +325,9 @@ gtk_gesture_click_handle_event (GtkEventController *controller,
(gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE ||
gdk_event_get_event_type (event) == GDK_TOUCH_END))
{
if (!gdk_event_get_button (event, &button))
if (gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE)
button = gdk_button_event_get_button (event);
else
button = 0;
g_signal_emit (controller, signals[UNPAIRED_RELEASE], 0,
x, y, button, sequence);

View File

@ -69,7 +69,7 @@ gtk_gesture_drag_filter_event (GtkEventController *controller,
guint n_fingers;
g_object_get (G_OBJECT (controller), "n-points", &n_points, NULL);
gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers == n_points)
return FALSE;

View File

@ -97,7 +97,7 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
goto out;
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
gdk_event_get_touchpad_gesture_phase (last_event, &phase);
phase = gdk_touchpad_event_get_gesture_phase (last_event);
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
@ -179,7 +179,7 @@ gtk_gesture_rotate_filter_event (GtkEventController *controller,
{
guint n_fingers;
gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers == 2)
return FALSE;
@ -203,11 +203,10 @@ gtk_gesture_rotate_handle_event (GtkEventController *controller,
priv = gtk_gesture_rotate_get_instance_private (rotate);
gdk_event_get_touchpad_gesture_phase (event, &phase);
gdk_event_get_touchpad_angle_delta (event, &delta);
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);
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END)
priv->accum_touchpad_angle = 0;

View File

@ -142,7 +142,6 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
guint button = 0, state, i;
gboolean retval, test_touchscreen = FALSE;
GdkEventType event_type;
gboolean emulating;
source_device = gdk_event_get_source_device (event);
@ -162,8 +161,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_END:
case GDK_TOUCH_UPDATE:
gdk_event_get_touch_emulating_pointer (event, &emulating);
if (priv->exclusive && !emulating)
if (priv->exclusive && !gdk_touch_event_get_emulating_pointer (event))
return FALSE;
sequence = gdk_event_get_event_sequence (event);
@ -174,15 +172,14 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
if (priv->touch_only && !test_touchscreen && source != GDK_SOURCE_TOUCHSCREEN)
return FALSE;
gdk_event_get_button (event, &button);
button = gdk_button_event_get_button (event);
break;
case GDK_MOTION_NOTIFY:
if (!gtk_gesture_handles_sequence (GTK_GESTURE (controller), sequence))
return FALSE;
if (priv->touch_only && !test_touchscreen && source != GDK_SOURCE_TOUCHSCREEN)
return FALSE;
if (!gdk_event_get_state (event, &state))
return FALSE;
state = gdk_event_get_modifier_state (event);
if (priv->current_button > 0 && priv->current_button <= 5 &&
(state & (GDK_BUTTON1_MASK << (priv->current_button - 1))))

View File

@ -70,7 +70,7 @@ gtk_gesture_stylus_handle_event (GtkEventController *controller,
n_signal = UP;
break;
case GDK_MOTION_NOTIFY:
gdk_event_get_state (event, &modifiers);
modifiers = gdk_event_get_modifier_state (event);
if (modifiers & GDK_BUTTON1_MASK)
n_signal = MOTION;

View File

@ -92,7 +92,7 @@ gtk_gesture_swipe_filter_event (GtkEventController *controller,
g_object_get (G_OBJECT (controller), "n-points", &n_points, NULL);
gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers == n_points)
return FALSE;

View File

@ -94,7 +94,7 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
goto out;
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
gdk_event_get_touchpad_gesture_phase (last_event, &phase);
phase = gdk_touchpad_event_get_gesture_phase (last_event);
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
@ -104,7 +104,7 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
double scale;
/* Touchpad pinch */
gdk_event_get_touchpad_scale (last_event, &scale);
scale = gdk_touchpad_pinch_event_get_scale (last_event);
*distance = scale;
}
else
@ -156,7 +156,7 @@ gtk_gesture_zoom_filter_event (GtkEventController *controller,
{
guint n_fingers;
gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers == 2)
return FALSE;

View File

@ -2133,12 +2133,12 @@ gtk_icon_view_button_press (GtkGestureClick *gesture,
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
if (button == GDK_BUTTON_PRIMARY &&
gdk_event_get_state ((GdkEvent *) event, &state))
if (button == GDK_BUTTON_PRIMARY)
{
GdkModifierType extend_mod_mask;
GdkModifierType modify_mod_mask;
state = gdk_event_get_modifier_state ((GdkEvent *)event);
extend_mod_mask =
gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_EXTEND_SELECTION);
@ -2279,7 +2279,7 @@ button_event_modifies_selection (GdkEventButton *event)
{
guint state;
gdk_event_get_state ((GdkEvent *) event, &state);
state = gdk_event_get_modifier_state ((GdkEvent *) event);
return (state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
}

View File

@ -893,7 +893,7 @@ beep_surface (GdkSurface *surface)
static gboolean
no_sequence_matches (GtkIMContextSimple *context_simple,
gint n_compose,
GdkEventKey *event)
GdkEvent *event)
{
GtkIMContextSimplePrivate *priv = context_simple->priv;
GtkIMContext *context;
@ -917,11 +917,11 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
{
guint tmp_keyval = priv->compose_buffer[len + i];
GdkEvent *tmp_event = gdk_event_key_new (GDK_KEY_PRESS,
event->any.surface,
event->any.device,
event->any.source_device,
event->time,
event->state,
gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
tmp_keyval,
tmp_keyval,
tmp_keyval,
@ -932,14 +932,16 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
g_object_unref (tmp_event);
}
return gtk_im_context_filter_keypress (context, event);
return gtk_im_context_filter_keypress (context, (GdkEventKey *)event);
}
else if (gdk_event_get_keyval ((GdkEvent *) event, &keyval))
else
{
keyval = gdk_key_event_get_keyval (event);
priv->compose_buffer[0] = 0;
if (n_compose > 1) /* Invalid sequence */
{
beep_surface (gdk_event_get_surface ((GdkEvent *) event));
beep_surface (gdk_event_get_surface (event));
return TRUE;
}
@ -952,8 +954,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
else
return FALSE;
}
else
return FALSE;
return FALSE;
}
static gboolean
@ -974,8 +975,7 @@ canonical_hex_keyval (GdkEventKey *event)
gint n_vals = 0;
gint i;
if (!gdk_event_get_keyval ((GdkEvent *) event, &event_keyval))
return 0;
event_keyval = gdk_key_event_get_keyval ((GdkEvent *)event);
/* See if the keyval is already a hex digit */
if (is_hex_keyval (event_keyval))
@ -985,7 +985,7 @@ canonical_hex_keyval (GdkEventKey *event)
* any other state, and return that hex keyval if so
*/
gdk_keymap_get_entries_for_keycode (keymap,
gdk_event_get_scancode ((GdkEvent *) event),
gdk_key_event_get_scancode ((GdkEvent *) event),
NULL,
&keyvals, &n_vals);
@ -1039,9 +1039,8 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
while (priv->compose_buffer[n_compose] != 0)
n_compose++;
if (!gdk_event_get_keyval ((GdkEvent *) event, &keyval) ||
!gdk_event_get_state ((GdkEvent *) event, &state))
return GDK_EVENT_PROPAGATE;
keyval = gdk_key_event_get_keyval ((GdkEvent *)event);
state = gdk_event_get_modifier_state ((GdkEvent *)event);
if (gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_RELEASE)
{
@ -1355,7 +1354,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
}
/* The current compose_buffer doesn't match anything */
return no_sequence_matches (context_simple, n_compose, event);
return no_sequence_matches (context_simple, n_compose, (GdkEvent *)event);
}
static void

View File

@ -353,13 +353,14 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
{
return gtk_im_context_filter_keypress (slave, event);
}
else if (gdk_event_get_keyval ((GdkEvent *) event, &keyval) &&
gdk_event_get_state ((GdkEvent *) event, &state))
else
{
GdkDisplay *display;
GdkModifierType no_text_input_mask;
display = gdk_surface_get_display (gdk_event_get_surface ((GdkEvent *) event));
keyval = gdk_key_event_get_keyval ((GdkEvent *) event);
state = gdk_event_get_modifier_state ((GdkEvent *) event);
display = gdk_event_get_display ((GdkEvent *) event);
no_text_input_mask =
gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),

View File

@ -4648,7 +4648,7 @@ gtk_label_drag_gesture_begin (GtkGestureDrag *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
gdk_event_get_state (event, &state_mask);
state_mask = gdk_event_get_modifier_state (event);
if ((info->selection_anchor != info->selection_end) &&
(state_mask & GDK_SHIFT_MASK))

View File

@ -1081,75 +1081,92 @@ static GdkEvent *
rewrite_event_for_surface (GdkEvent *event,
GdkSurface *new_surface)
{
GdkEventType type;
double x, y;
double dx, dy;
if (!gdk_event_get_coords (event, &x, &y) ||
!gdk_surface_translate_coordinates (event->any.surface, new_surface, &x, &y))
{
x = y = 0;
}
type = gdk_event_get_event_type (event);
switch ((guint) event->any.type)
switch ((guint) type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
return gdk_event_button_new (event->any.type,
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
gdk_event_get_position (event, &x, &y);
gdk_surface_translate_coordinates (gdk_event_get_surface (event), new_surface, &x, &y);
break;
default:
x = y = 0;
break;
}
switch ((guint) type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
return gdk_event_button_new (type,
new_surface,
event->any.device,
event->any.source_device,
event->button.tool,
event->button.time,
event->button.state,
event->button.button,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_button_event_get_button (event),
x, y,
NULL); // FIXME copy axes
case GDK_MOTION_NOTIFY:
return gdk_event_motion_new (new_surface,
event->any.device,
event->any.source_device,
event->motion.tool,
event->motion.time,
event->motion.state,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
x, y,
NULL); // FIXME copy axes
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
return gdk_event_touch_new (event->any.type,
event->touch.sequence,
return gdk_event_touch_new (type,
gdk_event_get_event_sequence (event),
new_surface,
event->any.device,
event->any.source_device,
event->touch.time,
event->touch.state,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
x, y,
NULL, // FIXME copy axes
event->touch.emulating_pointer);
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,
event->any.device,
event->any.source_device,
event->touchpad_swipe.time,
event->touchpad_swipe.state,
event->touchpad_swipe.phase,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_touchpad_event_get_gesture_phase (event),
x, y,
event->touchpad_swipe.n_fingers,
event->touchpad_swipe.dx,
event->touchpad_swipe.dy);
gdk_touchpad_event_get_n_fingers (event),
dx, dy);
case GDK_TOUCHPAD_PINCH:
gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_event_touchpad_pinch_new (new_surface,
event->any.device,
event->any.source_device,
event->touchpad_pinch.time,
event->touchpad_pinch.state,
event->touchpad_pinch.phase,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_touchpad_event_get_gesture_phase (event),
x, y,
event->touchpad_pinch.n_fingers,
event->touchpad_pinch.dx,
event->touchpad_pinch.dy,
event->touchpad_pinch.scale,
event->touchpad_pinch.angle_delta);
gdk_touchpad_event_get_n_fingers (event),
dx, dy,
gdk_touchpad_pinch_event_get_scale (event),
gdk_touchpad_pinch_event_get_angle_delta (event));
default:
break;
}
@ -1173,7 +1190,7 @@ rewrite_event_for_grabs (GdkEvent *event)
GdkDisplay *display;
GdkDevice *device;
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_SCROLL:
case GDK_BUTTON_PRESS:
@ -1189,7 +1206,7 @@ rewrite_event_for_grabs (GdkEvent *event)
case GDK_TOUCH_CANCEL:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
display = gdk_surface_get_display (event->any.surface);
display = gdk_event_get_display (event);
device = gdk_event_get_device (event);
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events) ||
@ -1270,7 +1287,7 @@ translate_event_coordinates (GdkEvent *event,
*x = *y = 0;
if (!gdk_event_get_coords (event, &event_x, &event_y))
if (!gdk_event_get_position (event, &event_x, &event_y))
return FALSE;
event_widget = gtk_get_event_widget (event);
@ -1352,7 +1369,7 @@ update_pointer_focus_state (GtkWindow *toplevel,
if (old_target == new_target)
return old_target;
gdk_event_get_coords (event, &x, &y);
gdk_event_get_position (event, &x, &y);
gtk_window_update_pointer_focus (toplevel, device, sequence,
new_target, x, y);
@ -1362,7 +1379,7 @@ update_pointer_focus_state (GtkWindow *toplevel,
static gboolean
is_pointing_event (GdkEvent *event)
{
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_MOTION_NOTIFY:
case GDK_ENTER_NOTIFY:
@ -1386,7 +1403,7 @@ is_pointing_event (GdkEvent *event)
static gboolean
is_key_event (GdkEvent *event)
{
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
@ -1400,7 +1417,7 @@ is_key_event (GdkEvent *event)
static gboolean
is_focus_event (GdkEvent *event)
{
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_FOCUS_CHANGE:
return TRUE;
@ -1413,7 +1430,7 @@ is_focus_event (GdkEvent *event)
static gboolean
is_dnd_event (GdkEvent *event)
{
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
@ -1452,21 +1469,22 @@ handle_pointing_event (GdkEvent *event)
GdkDevice *device;
gdouble x, y;
GtkWidget *native;
GdkEventType type;
event_widget = gtk_get_event_widget (event);
device = gdk_event_get_device (event);
if (!device || !gdk_event_get_coords (event, &x, &y))
return event_widget;
gdk_event_get_position (event, &x, &y);
toplevel = GTK_WINDOW (gtk_widget_get_root (event_widget));
native = GTK_WIDGET (gtk_widget_get_native (event_widget));
type = gdk_event_get_event_type (event);
sequence = gdk_event_get_event_sequence (event);
switch ((guint) event->any.type)
switch ((guint) type)
{
case GDK_LEAVE_NOTIFY:
if (event->crossing.mode == GDK_CROSSING_NORMAL &&
if (gdk_crossing_event_get_mode (event) == GDK_CROSSING_NORMAL &&
gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, NULL))
{
/* We have an implicit grab, wait for the corresponding
@ -1478,14 +1496,13 @@ handle_pointing_event (GdkEvent *event)
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
old_target = update_pointer_focus_state (toplevel, event, NULL);
if (event->any.type == GDK_LEAVE_NOTIFY)
if (type == GDK_LEAVE_NOTIFY)
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), old_target, NULL,
event, event->crossing.mode);
event, gdk_crossing_event_get_mode (event));
break;
case GDK_ENTER_NOTIFY:
if (event->crossing.mode == GDK_CROSSING_GRAB ||
event->crossing.mode == GDK_CROSSING_UNGRAB)
if (gdk_crossing_event_get_mode (event) == GDK_CROSSING_GRAB ||
gdk_crossing_event_get_mode (event) == GDK_CROSSING_UNGRAB)
break;
G_GNUC_FALLTHROUGH;
case GDK_TOUCH_BEGIN:
@ -1501,7 +1518,7 @@ handle_pointing_event (GdkEvent *event)
old_target = update_pointer_focus_state (toplevel, event, target);
if (event->any.type == GDK_MOTION_NOTIFY || event->any.type == GDK_ENTER_NOTIFY)
if (type == GDK_MOTION_NOTIFY || type == GDK_ENTER_NOTIFY)
{
if (!gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device,
sequence))
@ -1513,7 +1530,7 @@ handle_pointing_event (GdkEvent *event)
gtk_window_maybe_update_cursor (toplevel, NULL, device);
}
if (event->any.type == GDK_TOUCH_BEGIN)
if (type == GDK_TOUCH_BEGIN)
gtk_window_set_pointer_focus_grab (toplevel, device, sequence, target);
/* Let it take the effective pointer focus anyway, as it may change due
@ -1527,10 +1544,10 @@ handle_pointing_event (GdkEvent *event)
device,
sequence);
gtk_window_set_pointer_focus_grab (toplevel, device, sequence,
event->any.type == GDK_BUTTON_PRESS ?
type == GDK_BUTTON_PRESS ?
target : NULL);
if (event->any.type == GDK_BUTTON_RELEASE)
if (type == GDK_BUTTON_RELEASE)
{
GtkWidget *new_target;
new_target = gtk_widget_pick (GTK_WIDGET (native), x, y, GTK_PICK_DEFAULT);
@ -1541,7 +1558,7 @@ handle_pointing_event (GdkEvent *event)
gtk_window_maybe_update_cursor (toplevel, NULL, device);
}
set_widget_active_state (target, event->any.type == GDK_BUTTON_RELEASE);
set_widget_active_state (target, type == GDK_BUTTON_RELEASE);
break;
case GDK_SCROLL:
@ -1581,9 +1598,7 @@ handle_dnd_event (GdkEvent *event)
event_widget = gtk_get_event_widget (event);
if (!gdk_event_get_coords (event, &x, &y))
return event_widget;
gdk_event_get_position (event, &x, &y);
native = GTK_WIDGET (gtk_widget_get_native (event_widget));
target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
@ -1633,9 +1648,9 @@ gtk_main_do_event (GdkEvent *event)
target_widget = handle_pointing_event (event);
else if (is_key_event (event))
{
if (event->any.type == GDK_KEY_PRESS &&
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS &&
GTK_IS_WINDOW (target_widget) &&
gtk_window_activate_key (GTK_WINDOW (target_widget), (GdkEventKey *) event))
gtk_window_activate_key (GTK_WINDOW (target_widget), event))
goto cleanup;
target_widget = handle_key_event (event);
@ -1669,7 +1684,7 @@ gtk_main_do_event (GdkEvent *event)
* This is the key to implementing modality.
*/
if (!grab_widget ||
((gtk_widget_is_sensitive (target_widget) || event->any.type == GDK_SCROLL) &&
((gtk_widget_is_sensitive (target_widget) || gdk_event_get_event_type (event) == GDK_SCROLL) &&
gtk_widget_is_ancestor (target_widget, grab_widget)))
grab_widget = target_widget;
@ -1698,7 +1713,7 @@ gtk_main_do_event (GdkEvent *event)
* Drag events are also not redirected, since it isn't
* clear what the semantics of that would be.
*/
switch ((guint)event->any.type)
switch ((guint)gdk_event_get_event_type (event))
{
case GDK_DELETE:
g_object_ref (target_widget);
@ -2165,7 +2180,10 @@ gtk_get_current_event_state (GdkModifierType *state)
g_return_val_if_fail (state != NULL, FALSE);
if (current_events)
return gdk_event_get_state (current_events->data, state);
{
*state = gdk_event_get_modifier_state (current_events->data);
return TRUE;
}
else
{
*state = 0;
@ -2201,17 +2219,16 @@ gtk_get_current_event_device (void)
* Returns: (transfer none) (nullable): the widget that originally
* received @event, or %NULL
*/
GtkWidget*
GtkWidget *
gtk_get_event_widget (GdkEvent *event)
{
GtkWidget *widget;
GdkSurface *surface;
widget = NULL;
if (event && event->any.surface &&
(!gdk_surface_is_destroyed (event->any.surface)))
widget = gtk_native_get_for_surface (event->any.surface);
surface = gdk_event_get_surface (event);
if (surface && !gdk_surface_is_destroyed (surface))
return gtk_native_get_for_surface (surface);
return widget;
return NULL;
}
static gboolean
@ -2238,7 +2255,7 @@ propagate_event_up (GtkWidget *widget,
* event
*/
if (!gtk_widget_is_sensitive (widget))
handled_event = event->any.type != GDK_SCROLL;
handled_event = gdk_event_get_event_type (event) != GDK_SCROLL;
else if (gtk_widget_get_realized (widget))
handled_event = gtk_widget_event (widget, event, target);
@ -2291,7 +2308,7 @@ propagate_event_down (GtkWidget *widget,
/* stop propagating on SCROLL, but don't handle the event, so it
* can propagate up again and reach its handling widget
*/
if (event->any.type == GDK_SCROLL)
if (gdk_event_get_event_type (event) == GDK_SCROLL)
break;
else
handled_event = TRUE;

View File

@ -1424,12 +1424,12 @@ do_popup_menu_for_process_tree_view (GtkWidget *widget,
op);
gtk_container_add (GTK_CONTAINER (menu), item);
if (event && gdk_event_triggers_context_menu (event) &&
gdk_event_get_coords (event, &x, &y))
if (event && gdk_event_triggers_context_menu (event))
{
GtkTreePath *path;
GtkTreeSelection *selection;
gdk_event_get_position (event, &x, &y);
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (op->priv->process_tree_view),
(gint) x,
(gint) y,

View File

@ -240,7 +240,7 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
guint index, mode, group;
gdouble value = 0;
gdk_event_get_pad_group_mode (event, &group, &mode);
gdk_pad_event_get_group_mode (event, &group, &mode);
if (event_type == GDK_PAD_GROUP_MODE)
{
gtk_pad_controller_handle_mode_switch (pad_controller,
@ -254,13 +254,13 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
{
case GDK_PAD_BUTTON_PRESS:
type = GTK_PAD_ACTION_BUTTON;
gdk_event_get_pad_button (event, &index);
index = gdk_pad_button_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_event_get_pad_axis_value (event, &index, &value);
gdk_pad_axis_event_get_value (event, &index, &value);
break;
default:
return GDK_EVENT_PROPAGATE;

View File

@ -1866,7 +1866,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
gdk_event_get_state (event, &state_mask);
state_mask = gdk_event_get_modifier_state (event);
shift_pressed = (state_mask & GDK_SHIFT_MASK) != 0;
source_device = gdk_event_get_source_device ((GdkEvent *) event);

View File

@ -1201,7 +1201,7 @@ captured_motion (GtkScrolledWindow *sw,
if (priv->vscrollbar_visible)
indicator_start_fade (&priv->vindicator, 1.0);
gdk_event_get_state (event, &state);
state = gdk_event_get_modifier_state (event);
target = gtk_widget_pick (GTK_WIDGET (sw), x, y, GTK_PICK_DEFAULT);

View File

@ -2622,7 +2622,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
priv->select_words = FALSE;
priv->select_lines = FALSE;
gdk_event_get_state (event, &state);
state = gdk_event_get_modifier_state (event);
extend_selection =
(state &

View File

@ -5175,14 +5175,6 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
GTK_EVENT_SEQUENCE_CLAIMED);
gtk_text_view_reset_blink_time (text_view);
#if 0
/* debug hack */
if (event->button == GDK_BUTTON_SECONDARY && (event->state & GDK_CONTROL_MASK) != 0)
_gtk_text_buffer_spew (GTK_TEXT_VIEW (widget)->buffer);
else if (event->button == GDK_BUTTON_SECONDARY)
gtk_text_layout_spew (GTK_TEXT_VIEW (widget)->layout);
#endif
device = gdk_event_get_source_device ((GdkEvent *) event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
@ -5215,7 +5207,7 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
gboolean extends = FALSE;
GdkModifierType state;
gdk_event_get_state (event, &state);
state = gdk_event_get_modifier_state (event);
if (state &
gtk_widget_get_modifier_mask (GTK_WIDGET (text_view),

View File

@ -851,7 +851,7 @@ tooltips_enabled (GdkEvent *event)
return FALSE;
}
gdk_event_get_state (event, &event_state);
event_state = gdk_event_get_modifier_state (event);
if ((event_state &
(GDK_BUTTON1_MASK |
GDK_BUTTON2_MASK |
@ -886,7 +886,7 @@ _gtk_tooltip_handle_event (GtkWidget *target,
event_type = gdk_event_get_event_type (event);
surface = gdk_event_get_surface (event);
gdk_event_get_coords (event, &dx, &dy);
gdk_event_get_position (event, &dx, &dy);
gtk_tooltip_handle_event_internal (event_type, surface, target, dx, dy);
}

View File

@ -2947,7 +2947,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
gdk_event_get_state (event, &modifiers);
modifiers = gdk_event_get_modifier_state (event);
/* decide if we edit */
if (button == GDK_BUTTON_PRIMARY &&

View File

@ -2075,70 +2075,84 @@ _gtk_widget_emulate_press (GtkWidget *widget,
if (event_widget == widget)
return;
gdk_event_get_coords (event, &x, &y);
if (!gtk_widget_compute_point (event_widget,
GTK_WIDGET (gtk_widget_get_root (event_widget)),
&GRAPHENE_POINT_INIT (x, y),
&p))
return;
if (event->any.type == GDK_TOUCH_BEGIN ||
event->any.type == GDK_TOUCH_UPDATE ||
event->any.type == GDK_TOUCH_END)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_MOTION_NOTIFY:
gdk_event_get_position (event, &x, &y);
if (!gtk_widget_compute_point (event_widget,
GTK_WIDGET (gtk_widget_get_root (event_widget)),
&GRAPHENE_POINT_INIT (x, y),
&p))
return;
break;
default:
return;
}
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
press = gdk_event_touch_new (GDK_TOUCH_BEGIN,
event->touch.sequence,
event->any.surface,
event->any.device,
event->any.source_device,
event->touch.time,
event->touch.state,
gdk_event_get_event_sequence (event),
gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
p.x, p.y,
NULL,
event->touch.emulating_pointer);
}
else if (event->any.type == GDK_BUTTON_PRESS ||
event->any.type == GDK_BUTTON_RELEASE)
{
gdk_touch_event_get_emulating_pointer (event));
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
press = gdk_event_button_new (GDK_BUTTON_PRESS,
event->any.surface,
event->any.device,
event->any.source_device,
event->button.tool,
event->button.time,
event->button.state,
event->button.button,
gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_button_event_get_button (event),
p.x, p.y,
NULL);
}
else if (event->any.type == GDK_MOTION_NOTIFY)
{
int button;
if (event->motion.state & GDK_BUTTON3_MASK)
button = 3;
else if (event->motion.state & GDK_BUTTON2_MASK)
button = 2;
else
{
if ((event->motion.state & GDK_BUTTON1_MASK) == 0)
g_critical ("Guessing button number 1 on generated button press event");
break;
case GDK_MOTION_NOTIFY:
{
GdkModifierType state = gdk_event_get_modifier_state (event);
int button;
if (state & GDK_BUTTON3_MASK)
button = 3;
else if (state & GDK_BUTTON2_MASK)
button = 2;
else
{
if ((state & GDK_BUTTON1_MASK) == 0)
g_critical ("Guessing button number 1 on generated button press event");
button = 1;
}
button = 1;
}
press = gdk_event_button_new (GDK_BUTTON_PRESS,
event->any.surface,
event->any.device,
event->any.source_device,
NULL,
event->motion.time,
event->motion.state,
button,
p.x, p.y,
NULL);
press = gdk_event_button_new (GDK_BUTTON_PRESS,
gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
button,
p.x, p.y,
NULL);
}
break;
default:
g_assert_not_reached ();
}
else
return;
next_child = event_widget;
parent = _gtk_widget_get_parent (next_child);
@ -2201,10 +2215,10 @@ _gtk_widget_get_emulating_sequence (GtkWidget *widget,
last_event = _gtk_widget_get_last_event (widget, sequence, &target);
if (last_event &&
(last_event->any.type == GDK_TOUCH_BEGIN ||
last_event->any.type == GDK_TOUCH_UPDATE ||
last_event->any.type == GDK_TOUCH_END) &&
last_event->touch.emulating_pointer)
(gdk_event_get_event_type (last_event) == GDK_TOUCH_BEGIN ||
gdk_event_get_event_type (last_event) == GDK_TOUCH_UPDATE ||
gdk_event_get_event_type (last_event) == GDK_TOUCH_END) &&
gdk_touch_event_get_emulating_pointer (last_event))
return TRUE;
}
else
@ -4771,7 +4785,7 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
}
#define WIDGET_REALIZED_FOR_EVENT(widget, event) \
(event->any.type == GDK_FOCUS_CHANGE || _gtk_widget_get_realized(widget))
(gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE || _gtk_widget_get_realized (widget))
/**
* gtk_widget_event:
@ -4918,7 +4932,7 @@ event_surface_is_still_viewable (GdkEvent *event)
* at the last moment, since the event may have been queued
* up behind other events, held over a recursive main loop, etc.
*/
switch ((guint) event->any.type)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
@ -4926,7 +4940,7 @@ event_surface_is_still_viewable (GdkEvent *event)
case GDK_ENTER_NOTIFY:
case GDK_PROXIMITY_IN:
case GDK_SCROLL:
return event->any.surface && gdk_surface_is_viewable (event->any.surface);
return gdk_surface_is_viewable (gdk_event_get_surface (event));
#if 0
/* The following events are the second half of paired events;
@ -4959,7 +4973,7 @@ translate_event_coordinates (GdkEvent *event,
*x = *y = 0;
if (!gdk_event_get_coords (event, &event_x, &event_y))
if (!gdk_event_get_position (event, &event_x, &event_y))
return FALSE;
event_widget = gtk_get_event_widget (event);
@ -5004,8 +5018,8 @@ gtk_widget_event_internal (GtkWidget *widget,
return_val |= gtk_widget_run_controllers (widget, event, target, x, y, GTK_PHASE_BUBBLE);
if (return_val == FALSE &&
(event->any.type == GDK_KEY_PRESS ||
event->any.type == GDK_KEY_RELEASE))
(gdk_event_get_event_type (event) == GDK_KEY_PRESS ||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE))
return_val |= gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event);
return return_val;

View File

@ -1430,7 +1430,7 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
double tx, ty;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gdk_event_get_coords (event, &tx, &ty);
gdk_event_get_position (event, &tx, &ty);
gdk_surface_begin_resize_drag_for_device (priv->surface,
(GdkSurfaceEdge) region,
gdk_event_get_device ((GdkEvent *) event),
@ -5994,7 +5994,7 @@ _gtk_window_query_nonaccels (GtkWindow *window,
/**
* gtk_window_propagate_key_event:
* @window: a #GtkWindow
* @event: a #GdkEventKey
* @event: a #GdkEvent
*
* Propagate a key press or release event to the focus widget and
* up the focus container chain until a widget handles @event.
@ -6006,8 +6006,8 @@ _gtk_window_query_nonaccels (GtkWindow *window,
* Returns: %TRUE if a widget in the focus chain handled the event.
*/
gboolean
gtk_window_propagate_key_event (GtkWindow *window,
GdkEventKey *event)
gtk_window_propagate_key_event (GtkWindow *window,
GdkEvent *event)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
gboolean handled = FALSE;
@ -8184,8 +8184,8 @@ _gtk_window_set_window_group (GtkWindow *window,
}
static gboolean
gtk_window_activate_menubar (GtkWindow *window,
GdkEventKey *event)
gtk_window_activate_menubar (GtkWindow *window,
GdkEvent *event)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
guint keyval = 0;
@ -8199,12 +8199,16 @@ gtk_window_activate_menubar (GtkWindow *window,
return FALSE;
}
if (!(gdk_event_get_event_type (event) == GDK_KEY_PRESS ||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE))
return FALSE;
/* FIXME this is wrong, needs to be in the global accel resolution
* thing, to properly consider i18n etc., but that probably requires
* AccelGroup changes etc.
*/
if (event->keyval == keyval &&
((event->state & gtk_accelerator_get_default_mod_mask ()) ==
if (gdk_key_event_get_keyval (event) == keyval &&
((gdk_event_get_modifier_state (event) & gtk_accelerator_get_default_mod_mask ()) ==
(mods & gtk_accelerator_get_default_mod_mask ())))
{
GList *tmp_menubars, *l;
@ -8388,7 +8392,7 @@ gtk_window_free_key_hash (GtkWindow *window)
/**
* gtk_window_activate_key:
* @window: a #GtkWindow
* @event: a #GdkEventKey
* @event: a #GdkEvent
*
* Activates mnemonics and accelerators for this #GtkWindow. This is normally
* called by the default ::key_press_event handler for toplevel windows,
@ -8398,8 +8402,8 @@ gtk_window_free_key_hash (GtkWindow *window)
* Returns: %TRUE if a mnemonic or accelerator was found and activated.
*/
gboolean
gtk_window_activate_key (GtkWindow *window,
GdkEventKey *event)
gtk_window_activate_key (GtkWindow *window,
GdkEvent *event)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkKeyHash *key_hash;
@ -8409,16 +8413,20 @@ gtk_window_activate_key (GtkWindow *window,
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (!(gdk_event_get_event_type (event) == GDK_KEY_PRESS ||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE))
return FALSE;
key_hash = gtk_window_get_key_hash (window);
if (key_hash)
{
GSList *tmp_list;
GSList *entries = _gtk_key_hash_lookup (key_hash,
event->hardware_keycode,
event->state,
gdk_key_event_get_keycode (event),
gdk_event_get_modifier_state (event),
gtk_accelerator_get_default_mod_mask (),
event->group);
gdk_key_event_get_group (event));
g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
"gtk-enable-accels", &enable_accels,

View File

@ -230,10 +230,10 @@ GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window);
GDK_AVAILABLE_IN_ALL
gboolean gtk_window_activate_key (GtkWindow *window,
GdkEventKey *event);
GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gtk_window_propagate_key_event (GtkWindow *window,
GdkEventKey *event);
GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gtk_window_present (GtkWindow *window);

View File

@ -135,7 +135,7 @@ handle_event (GtkInspectorWindow *iw, GdkEvent *event)
{
guint keyval = 0;
gdk_event_get_keyval (event, &keyval);
keyval = gdk_key_event_get_keyval (event);
if (keyval == GDK_KEY_Escape)
{
g_signal_handlers_disconnect_by_func (iw, handle_event, NULL);

View File

@ -20,7 +20,10 @@ start_resize (GtkGestureClick *gesture,
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
event = gtk_get_current_event ();
gdk_event_get_button (event, &button);
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
button = gdk_button_event_get_button (event);
else
button = 0;
timestamp = gdk_event_get_time (event);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
@ -65,7 +68,10 @@ start_move (GtkGestureClick *gesture,
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
event = gtk_get_current_event ();
gdk_event_get_button (event, &button);
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
button = gdk_button_event_get_button (event);
else
button = 0;
timestamp = gdk_event_get_time (event);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),