[gtk] tooltip: Remove gtk_tooltip_trigger_tooltip_query
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] tooltip: Remove gtk_tooltip_trigger_tooltip_query
- Date: Fri, 18 Jan 2019 19:06:15 +0000 (UTC)
commit 11f9ae8202463352bf7fe779876501760872c385
Author: Timm Bäder <mail baedert org>
Date: Fri Jan 18 08:34:59 2019 +0100
tooltip: Remove gtk_tooltip_trigger_tooltip_query
As stated by the documentation, this should be called when a widget gets
updated, but in that case, one can equally use
gtk_widget_trigger_tooltip_query.
docs/reference/gtk/gtk4-sections.txt | 1 -
gtk/gtktooltip.c | 5 ++++-
gtk/gtktooltip.h | 4 ----
gtk/gtktooltipprivate.h | 1 +
gtk/gtkwidget.c | 43 ++++--------------------------------
5 files changed, 9 insertions(+), 45 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 2e24ff6f3d..ae7361936a 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -3362,7 +3362,6 @@ gtk_tooltip_set_icon
gtk_tooltip_set_icon_from_icon_name
gtk_tooltip_set_icon_from_gicon
gtk_tooltip_set_custom
-gtk_tooltip_trigger_tooltip_query
gtk_tooltip_set_tip_area
<SUBSECTION Standard>
GTK_TYPE_TOOLTIP
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 92abb13a2e..6bcbbd6f24 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -377,12 +377,15 @@ gtk_tooltip_set_tip_area (GtkTooltip *tooltip,
* key press.
*/
void
-gtk_tooltip_trigger_tooltip_query (GdkDisplay *display)
+gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
{
+ GdkDisplay *display;
gint x, y;
GdkSurface *surface;
GdkDevice *device;
+ display = gtk_widget_get_display (widget);
+
/* Trigger logic as if the mouse moved */
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
surface = gdk_device_get_surface_at_position (device, &x, &y);
diff --git a/gtk/gtktooltip.h b/gtk/gtktooltip.h
index b5c634d8ec..d5812d5428 100644
--- a/gtk/gtktooltip.h
+++ b/gtk/gtktooltip.h
@@ -58,10 +58,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_tooltip_set_tip_area (GtkTooltip *tooltip,
const GdkRectangle *rect);
-GDK_AVAILABLE_IN_ALL
-void gtk_tooltip_trigger_tooltip_query (GdkDisplay *display);
-
-
G_END_DECLS
#endif /* __GTK_TOOLTIP_H__ */
diff --git a/gtk/gtktooltipprivate.h b/gtk/gtktooltipprivate.h
index 5427820189..b7db6097d6 100644
--- a/gtk/gtktooltipprivate.h
+++ b/gtk/gtktooltipprivate.h
@@ -33,6 +33,7 @@ G_BEGIN_DECLS
void _gtk_tooltip_handle_event (GdkEvent *event);
void _gtk_tooltip_hide (GtkWidget *widget);
+void gtk_tooltip_trigger_tooltip_query (GtkWidget *widget);
GtkWidget * _gtk_widget_find_at_coords (GdkSurface *surface,
gint surface_x,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index fb7216d28d..be1f058555 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -659,9 +659,6 @@ static void gtk_widget_buildable_parser_finished (GtkBuildable
static GtkSizeRequestMode gtk_widget_real_get_request_mode (GtkWidget *widget);
-static void gtk_widget_queue_tooltip_query (GtkWidget *widget);
-
-
static void template_data_free (GtkWidgetTemplate*template_data);
static void gtk_widget_set_usize_internal (GtkWidget *widget,
@@ -2249,7 +2246,7 @@ gtk_widget_set_property (GObject *object,
tmp = (tooltip_window != NULL || tooltip_markup != NULL);
gtk_widget_set_has_tooltip (widget, tmp);
if (_gtk_widget_get_visible (widget))
- gtk_widget_queue_tooltip_query (widget);
+ gtk_widget_trigger_tooltip_query (widget);
break;
case PROP_TOOLTIP_TEXT:
tooltip_window = g_object_get_qdata (object, quark_tooltip_window);
@@ -2270,7 +2267,7 @@ gtk_widget_set_property (GObject *object,
tmp = (tooltip_window != NULL || tooltip_markup != NULL);
gtk_widget_set_has_tooltip (widget, tmp);
if (_gtk_widget_get_visible (widget))
- gtk_widget_queue_tooltip_query (widget);
+ gtk_widget_trigger_tooltip_query (widget);
break;
case PROP_HALIGN:
gtk_widget_set_halign (widget, g_value_get_enum (value));
@@ -10886,7 +10883,7 @@ gtk_widget_set_tooltip_window (GtkWidget *widget,
gtk_widget_set_has_tooltip (widget, has_tooltip);
if (has_tooltip && _gtk_widget_get_visible (widget))
- gtk_widget_queue_tooltip_query (widget);
+ gtk_widget_trigger_tooltip_query (widget);
}
/**
@@ -10918,39 +10915,7 @@ gtk_widget_get_tooltip_window (GtkWidget *widget)
void
gtk_widget_trigger_tooltip_query (GtkWidget *widget)
{
- gtk_tooltip_trigger_tooltip_query (gtk_widget_get_display (widget));
-}
-
-static guint tooltip_query_id;
-static GSList *tooltip_query_displays;
-
-static gboolean
-tooltip_query_idle (gpointer data)
-{
- g_slist_foreach (tooltip_query_displays, (GFunc)gtk_tooltip_trigger_tooltip_query, NULL);
- g_slist_free_full (tooltip_query_displays, g_object_unref);
-
- tooltip_query_displays = NULL;
- tooltip_query_id = 0;
-
- return FALSE;
-}
-
-static void
-gtk_widget_queue_tooltip_query (GtkWidget *widget)
-{
- GdkDisplay *display;
-
- display = gtk_widget_get_display (widget);
-
- if (!g_slist_find (tooltip_query_displays, display))
- tooltip_query_displays = g_slist_prepend (tooltip_query_displays, g_object_ref (display));
-
- if (tooltip_query_id == 0)
- {
- tooltip_query_id = g_idle_add (tooltip_query_idle, NULL);
- g_source_set_name_by_id (tooltip_query_id, "[gtk+] tooltip_query_idle");
- }
+ gtk_tooltip_trigger_tooltip_query (widget);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]