[gtk/current-event-apis: 7/7] Drop gtk_get_current_ apis
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/current-event-apis: 7/7] Drop gtk_get_current_ apis
- Date: Sat, 11 Apr 2020 19:10:11 +0000 (UTC)
commit 240e8c81283be5781636b7b6a482aa2b58665fc2
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 11 15:04:52 2020 -0400
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.
docs/reference/gtk/gtk4-sections.txt | 6 ---
docs/reference/gtk/migrating-3to4.xml | 9 +++++
gtk/gtkmain.c | 76 -----------------------------------
gtk/gtkmain.h | 9 -----
gtk/gtkprivate.h | 2 +
5 files changed, 11 insertions(+), 91 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 64c459a197..338ea2b06a 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml
index 570bdca0d7..bb44f1a8a4 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -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>
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 986e7ae8a0..a34d2a8f84 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 16fb5743d5..ba1e1ac9f8 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -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
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 9e8300d1a3..4985f2d125 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]