Drop gtk_get_current_ apis

We have event controller apis to replace these.
There is one remaining use of gtk_get_current_event_time
in gtkwindow.c, so we can't drop the implementation yet.

Add a section in the migration guide for this.
This commit is contained in:
Matthias Clasen 2020-04-11 15:04:52 -04:00
parent 443fd4d63d
commit feee281cf8
5 changed files with 11 additions and 91 deletions

View File

@ -4287,12 +4287,6 @@ gtk_init_check
<SUBSECTION>
GTK_PRIORITY_RESIZE
<SUBSECTION>
gtk_get_current_event
gtk_get_current_event_time
gtk_get_current_event_state
gtk_get_current_event_device
<SUBSECTION Private>
gtk_init_abi_check
gtk_init_check_abi_check

View File

@ -339,6 +339,15 @@
</para>
</section>
<section>
<title>Stop using gtk_get_current_... APIs</title>
<para>
The function gtk_get_current_event() and its variants have been
replaced by equivalent event controller APIs:
gtk_event_controller_get_current_event(), etc.
</para>
</section>
<section>
<title>Adapt to surface API changes</title>
<para>

View File

@ -2014,37 +2014,6 @@ gtk_grab_remove (GtkWidget *widget)
}
}
/**
* gtk_get_current_event:
*
* Obtains a reference of the event currently being processed by GTK.
*
* For example, if you are handling a #GtkButton::clicked signal,
* the current event will be the #GdkEventButton that triggered
* the ::clicked signal.
*
* Returns: (transfer full) (nullable): a reference of the current event, or
* %NULL if there is no current event. The returned event must be
* freed with g_object_unref().
*/
GdkEvent*
gtk_get_current_event (void)
{
if (current_events)
return gdk_event_ref (current_events->data);
else
return NULL;
}
/**
* gtk_get_current_event_time:
*
* If there is a current event and it has a timestamp,
* return that timestamp, otherwise return %GDK_CURRENT_TIME.
*
* Returns: the timestamp from the current event,
* or %GDK_CURRENT_TIME.
*/
guint32
gtk_get_current_event_time (void)
{
@ -2054,51 +2023,6 @@ gtk_get_current_event_time (void)
return GDK_CURRENT_TIME;
}
/**
* gtk_get_current_event_state:
* @state: (out): a location to store the state of the current event
*
* If there is a current event and it has a state field, place
* that state field in @state and return %TRUE, otherwise return
* %FALSE.
*
* Returns: %TRUE if there was a current event and it
* had a state field
*/
gboolean
gtk_get_current_event_state (GdkModifierType *state)
{
g_return_val_if_fail (state != NULL, FALSE);
if (current_events)
{
*state = gdk_event_get_modifier_state (current_events->data);
return TRUE;
}
else
{
*state = 0;
return FALSE;
}
}
/**
* gtk_get_current_event_device:
*
* If there is a current event and it has a device, return that
* device, otherwise return %NULL.
*
* Returns: (transfer none) (nullable): a #GdkDevice, or %NULL
*/
GdkDevice *
gtk_get_current_event_device (void)
{
if (current_events)
return gdk_event_get_device (current_events->data);
else
return NULL;
}
/**
* gtk_get_event_widget:
* @event: a #GdkEvent

View File

@ -107,15 +107,6 @@ PangoLanguage *gtk_get_default_language (void);
GDK_AVAILABLE_IN_ALL
GtkTextDirection gtk_get_locale_direction (void);
GDK_AVAILABLE_IN_ALL
GdkEvent * gtk_get_current_event (void);
GDK_AVAILABLE_IN_ALL
guint32 gtk_get_current_event_time (void);
GDK_AVAILABLE_IN_ALL
gboolean gtk_get_current_event_state (GdkModifierType *state);
GDK_AVAILABLE_IN_ALL
GdkDevice *gtk_get_current_event_device (void);
G_END_DECLS

View File

@ -91,6 +91,8 @@ void gtk_main_do_event (GdkEvent *event);
GtkWidget *gtk_get_event_widget (GdkEvent *event);
guint32 gtk_get_current_event_time (void);
void check_crossing_invariants (GtkWidget *widget,
GtkCrossingData *crossing);