[gtk+/wip/carlosg/event-as-object: 4/23] gtk/a11y: Use allocated events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-as-object: 4/23] gtk/a11y: Use allocated events
- Date: Tue, 31 Oct 2017 16:02:28 +0000 (UTC)
commit 353f1412361e0adf53a0659c1138d75cbdaa3b45
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Oct 25 12:26:32 2017 +0200
gtk/a11y: Use allocated events
Using stack allocated GdkEvent will not be ok when they become
objects.
gtk/a11y/gtkentryaccessible.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index d5e3035..27cd4a8 100644
--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -221,7 +221,7 @@ gtk_entry_icon_accessible_do_action (AtkAction *action,
GtkEntryIconAccessible *icon = (GtkEntryIconAccessible *)action;
GtkWidget *widget;
GtkEntry *gtk_entry;
- GdkEvent event;
+ GdkEvent *event;
GdkRectangle icon_area;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry));
@@ -241,16 +241,17 @@ gtk_entry_icon_accessible_do_action (AtkAction *action,
return FALSE;
gtk_entry_get_icon_area (gtk_entry, icon->pos, &icon_area);
- memset (&event, 0, sizeof (event));
- event.any.type = GDK_BUTTON_PRESS;
- event.any.window = gtk_widget_get_window (widget);
- event.button.button = 1;
- event.any.send_event = TRUE;
- event.button.time = GDK_CURRENT_TIME;
- event.button.x = icon_area.x;
- event.button.y = icon_area.y;
-
- g_signal_emit_by_name (widget, "icon-press", 0, icon->pos, &event);
+
+ event = gdk_event_new (GDK_BUTTON_PRESS);
+ event->any.window = g_object_ref (gtk_widget_get_window (widget));
+ event->button.button = 1;
+ event->any.send_event = TRUE;
+ event->button.time = GDK_CURRENT_TIME;
+ event->button.x = icon_area.x;
+ event->button.y = icon_area.y;
+
+ g_signal_emit_by_name (widget, "icon-press", 0, icon->pos, event);
+ gdk_event_free (event);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]