gtk: s/gdk_event_free/g_object_unref/

This commit is contained in:
Carlos Garnacho 2017-10-31 13:45:41 +01:00
parent b03d3fb268
commit d491e49fd6
13 changed files with 28 additions and 28 deletions

View File

@ -323,13 +323,13 @@ touch_release_in_button (GtkButton *button)
if (gdk_event_get_event_type (event) != GDK_TOUCH_END) if (gdk_event_get_event_type (event) != GDK_TOUCH_END)
{ {
gdk_event_free (event); g_object_unref (event);
return FALSE; return FALSE;
} }
gdk_event_get_coords (event, &x, &y); gdk_event_get_coords (event, &x, &y);
gdk_event_free (event); g_object_unref (event);
if (gtk_widget_contains (GTK_WIDGET (button), x, y)) if (gtk_widget_contains (GTK_WIDGET (button), x, y))
return TRUE; return TRUE;

View File

@ -1225,7 +1225,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
* 3. During a timeout handler, if you want to start a drag after the mouse * 3. During a timeout handler, if you want to start a drag after the mouse
* button is held down for some time. Try to save the last event that you got * button is held down for some time. Try to save the last event that you got
* from the mouse, using gdk_event_copy(), and pass it to this function * from the mouse, using gdk_event_copy(), and pass it to this function
* (remember to free the event with gdk_event_free() when you are done). * (remember to free the event with g_object_unref() when you are done).
* If you can really not pass a real event, pass %NULL instead. * If you can really not pass a real event, pass %NULL instead.
* *
* Returns: (transfer none): the context for this drag * Returns: (transfer none): the context for this drag

View File

@ -8622,7 +8622,7 @@ gtk_entry_do_popup (GtkEntry *entry,
} }
} }
g_clear_pointer (&trigger_event, gdk_event_free); g_clear_object (&trigger_event);
} }
static gboolean static gboolean

View File

@ -529,7 +529,7 @@ _gtk_gesture_update_point (GtkGesture *gesture,
} }
if (data->event) if (data->event)
gdk_event_free (data->event); g_object_unref (data->event);
data->event = gdk_event_copy (event); data->event = gdk_event_copy (event);
_update_touchpad_deltas (data); _update_touchpad_deltas (data);
@ -912,7 +912,7 @@ free_point_data (gpointer data)
PointData *point = data; PointData *point = data;
if (point->event) if (point->event)
gdk_event_free (point->event); g_object_unref (point->event);
g_free (point); g_free (point);
} }

View File

@ -1057,7 +1057,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
gdk_event_set_keyval (tmp_event, priv->compose_buffer[len + i]); gdk_event_set_keyval (tmp_event, priv->compose_buffer[len + i]);
gtk_im_context_filter_keypress (context, (GdkEventKey *)tmp_event); gtk_im_context_filter_keypress (context, (GdkEventKey *)tmp_event);
gdk_event_free (tmp_event); g_object_unref (tmp_event);
} }
return gtk_im_context_filter_keypress (context, event); return gtk_im_context_filter_keypress (context, event);

View File

@ -1416,7 +1416,7 @@ synth_crossing (GtkWidget *widget,
event->crossing.detail = notify_type; event->crossing.detail = notify_type;
gtk_widget_event (widget, event); gtk_widget_event (widget, event);
gdk_event_free (event); g_object_unref (event);
} }
static GtkWidget * static GtkWidget *
@ -1912,7 +1912,7 @@ gtk_main_do_event (GdkEvent *event)
g_list_free_1 (tmp_list); g_list_free_1 (tmp_list);
if (rewritten_event) if (rewritten_event)
gdk_event_free (rewritten_event); g_object_unref (rewritten_event);
} }
/** /**
@ -2332,7 +2332,7 @@ gtk_device_grab_remove (GtkWidget *widget,
* *
* Returns: (transfer full) (nullable): a copy of the current event, or * Returns: (transfer full) (nullable): a copy of the current event, or
* %NULL if there is no current event. The returned event must be * %NULL if there is no current event. The returned event must be
* freed with gdk_event_free(). * freed with g_object_unref().
*/ */
GdkEvent* GdkEvent*
gtk_get_current_event (void) gtk_get_current_event (void)

View File

@ -1692,7 +1692,7 @@ gtk_menu_popup_internal (GtkMenu *menu,
menu_shell->priv->ignore_enter = TRUE; menu_shell->priv->ignore_enter = TRUE;
source_device = gdk_event_get_source_device (current_event); source_device = gdk_event_get_source_device (current_event);
gdk_event_free (current_event); g_object_unref (current_event);
} }
else else
menu_shell->priv->ignore_enter = TRUE; menu_shell->priv->ignore_enter = TRUE;
@ -1990,7 +1990,7 @@ gtk_menu_popup_at_rect (GtkMenu *menu,
button, button,
activate_time); activate_time);
g_clear_pointer (&current_event, gdk_event_free); g_clear_object (&current_event);
} }
/** /**
@ -2083,7 +2083,7 @@ gtk_menu_popup_at_widget (GtkMenu *menu,
button, button,
activate_time); activate_time);
g_clear_pointer (&current_event, gdk_event_free); g_clear_object (&current_event);
} }
/** /**
@ -2150,7 +2150,7 @@ gtk_menu_popup_at_pointer (GtkMenu *menu,
GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST,
trigger_event); trigger_event);
g_clear_pointer (&current_event, gdk_event_free); g_clear_object (&current_event);
} }
static void static void

View File

@ -423,7 +423,7 @@ gtk_menu_button_toggled (GtkToggleButton *button)
gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE); gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE);
if (event) if (event)
gdk_event_free (event); g_object_unref (event);
} }
} }
else if (priv->popover) else if (priv->popover)

View File

@ -1178,7 +1178,7 @@ gtk_real_menu_item_select (GtkMenuItem *menu_item)
if (current_event) if (current_event)
{ {
source_device = gdk_event_get_source_device (current_event); source_device = gdk_event_get_source_device (current_event);
gdk_event_free (current_event); g_object_unref (current_event);
} }
if ((!source_device || if ((!source_device ||
@ -1516,7 +1516,7 @@ gtk_menu_item_popup_timeout (gpointer data)
priv->timer = 0; priv->timer = 0;
g_clear_pointer (&info->trigger_event, gdk_event_free); g_clear_object (&info->trigger_event);
g_slice_free (PopupInfo, info); g_slice_free (PopupInfo, info);
return FALSE; return FALSE;

View File

@ -8379,7 +8379,7 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
if (gdk_event_get_event_type (current_event) == GDK_SCROLL) if (gdk_event_get_event_type (current_event) == GDK_SCROLL)
move_mark_to_pointer_and_scroll (text_view, "insert"); move_mark_to_pointer_and_scroll (text_view, "insert");
gdk_event_free (current_event); g_object_unref (current_event);
} }
} }
@ -8860,7 +8860,7 @@ gtk_text_view_do_popup (GtkTextView *text_view,
} }
} }
g_clear_pointer (&trigger_event, gdk_event_free); g_clear_object (&trigger_event);
} }
static gboolean static gboolean

View File

@ -5743,7 +5743,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
/* Because we keep the focus on the treeview, we need to forward the /* Because we keep the focus on the treeview, we need to forward the
* key events to the entry, when it is visible. */ * key events to the entry, when it is visible. */
gtk_widget_event (search_window, new_event); gtk_widget_event (search_window, new_event);
gdk_event_free (new_event); g_object_unref (new_event);
g_signal_handler_disconnect (tree_view->priv->search_entry, g_signal_handler_disconnect (tree_view->priv->search_entry,
popup_menu_id); popup_menu_id);
@ -10652,7 +10652,7 @@ send_focus_change (GtkWidget *widget,
gtk_widget_send_focus_change (widget, fevent); gtk_widget_send_focus_change (widget, fevent);
gdk_event_free (fevent); g_object_unref (fevent);
} }
g_list_free (devices); g_list_free (devices);

View File

@ -3448,7 +3448,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
/* Perform propagation state starting from the next child in the chain */ /* Perform propagation state starting from the next child in the chain */
gtk_propagate_event_internal (event_widget, press, next_child); gtk_propagate_event_internal (event_widget, press, next_child);
gdk_event_free (press); g_object_unref (press);
} }
static const GdkEvent * static const GdkEvent *
@ -6511,7 +6511,7 @@ _gtk_widget_captured_event (GtkWidget *widget,
g_object_unref (widget); g_object_unref (widget);
out: out:
gdk_event_free (event_copy); g_object_unref (event_copy);
return return_val; return return_val;
} }
@ -6625,7 +6625,7 @@ gtk_widget_event_internal (GtkWidget *widget,
if (return_val == FALSE) if (return_val == FALSE)
return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_BUBBLE); return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_BUBBLE);
gdk_event_free (event_copy); g_object_unref (event_copy);
return return_val; return return_val;
} }
@ -10291,7 +10291,7 @@ synth_crossing (GtkWidget *widget,
if (widget) if (widget)
gtk_widget_event_internal (widget, event); gtk_widget_event_internal (widget, event);
gdk_event_free (event); g_object_unref (event);
} }
/* /*
@ -13321,7 +13321,7 @@ gtk_widget_get_opacity (GtkWidget *widget)
* *
* gtk_widget_send_focus_change (widget, fevent); * gtk_widget_send_focus_change (widget, fevent);
* *
* gdk_event_free (event); * g_object_unref (event);
* ]| * ]|
* *
* Returns: the return value from the event signal emission: %TRUE * Returns: the return value from the event signal emission: %TRUE

View File

@ -1337,7 +1337,7 @@ send_delete_event (gpointer data)
priv->delete_event_handler = 0; priv->delete_event_handler = 0;
gtk_main_do_event (event); gtk_main_do_event (event);
gdk_event_free (event); g_object_unref (event);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -7637,7 +7637,7 @@ do_focus_change (GtkWidget *widget,
gtk_widget_send_focus_change (widget, fevent); gtk_widget_send_focus_change (widget, fevent);
gdk_event_free (fevent); g_object_unref (fevent);
} }
g_list_free (devices); g_list_free (devices);