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.
This commit is contained in:
Timm Bäder 2019-01-18 08:34:59 +01:00
parent 0e07912231
commit 11f9ae8202
5 changed files with 9 additions and 45 deletions

View File

@ -3362,7 +3362,6 @@ gtk_tooltip_set_icon
gtk_tooltip_set_icon_from_icon_name gtk_tooltip_set_icon_from_icon_name
gtk_tooltip_set_icon_from_gicon gtk_tooltip_set_icon_from_gicon
gtk_tooltip_set_custom gtk_tooltip_set_custom
gtk_tooltip_trigger_tooltip_query
gtk_tooltip_set_tip_area gtk_tooltip_set_tip_area
<SUBSECTION Standard> <SUBSECTION Standard>
GTK_TYPE_TOOLTIP GTK_TYPE_TOOLTIP

View File

@ -377,12 +377,15 @@ gtk_tooltip_set_tip_area (GtkTooltip *tooltip,
* key press. * key press.
*/ */
void void
gtk_tooltip_trigger_tooltip_query (GdkDisplay *display) gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
{ {
GdkDisplay *display;
gint x, y; gint x, y;
GdkSurface *surface; GdkSurface *surface;
GdkDevice *device; GdkDevice *device;
display = gtk_widget_get_display (widget);
/* Trigger logic as if the mouse moved */ /* Trigger logic as if the mouse moved */
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
surface = gdk_device_get_surface_at_position (device, &x, &y); surface = gdk_device_get_surface_at_position (device, &x, &y);

View File

@ -58,10 +58,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_tooltip_set_tip_area (GtkTooltip *tooltip, void gtk_tooltip_set_tip_area (GtkTooltip *tooltip,
const GdkRectangle *rect); const GdkRectangle *rect);
GDK_AVAILABLE_IN_ALL
void gtk_tooltip_trigger_tooltip_query (GdkDisplay *display);
G_END_DECLS G_END_DECLS
#endif /* __GTK_TOOLTIP_H__ */ #endif /* __GTK_TOOLTIP_H__ */

View File

@ -33,6 +33,7 @@ G_BEGIN_DECLS
void _gtk_tooltip_handle_event (GdkEvent *event); void _gtk_tooltip_handle_event (GdkEvent *event);
void _gtk_tooltip_hide (GtkWidget *widget); void _gtk_tooltip_hide (GtkWidget *widget);
void gtk_tooltip_trigger_tooltip_query (GtkWidget *widget);
GtkWidget * _gtk_widget_find_at_coords (GdkSurface *surface, GtkWidget * _gtk_widget_find_at_coords (GdkSurface *surface,
gint surface_x, gint surface_x,

View File

@ -659,9 +659,6 @@ static void gtk_widget_buildable_parser_finished (GtkBuildable
static GtkSizeRequestMode gtk_widget_real_get_request_mode (GtkWidget *widget); 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 template_data_free (GtkWidgetTemplate*template_data);
static void gtk_widget_set_usize_internal (GtkWidget *widget, 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); tmp = (tooltip_window != NULL || tooltip_markup != NULL);
gtk_widget_set_has_tooltip (widget, tmp); gtk_widget_set_has_tooltip (widget, tmp);
if (_gtk_widget_get_visible (widget)) if (_gtk_widget_get_visible (widget))
gtk_widget_queue_tooltip_query (widget); gtk_widget_trigger_tooltip_query (widget);
break; break;
case PROP_TOOLTIP_TEXT: case PROP_TOOLTIP_TEXT:
tooltip_window = g_object_get_qdata (object, quark_tooltip_window); 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); tmp = (tooltip_window != NULL || tooltip_markup != NULL);
gtk_widget_set_has_tooltip (widget, tmp); gtk_widget_set_has_tooltip (widget, tmp);
if (_gtk_widget_get_visible (widget)) if (_gtk_widget_get_visible (widget))
gtk_widget_queue_tooltip_query (widget); gtk_widget_trigger_tooltip_query (widget);
break; break;
case PROP_HALIGN: case PROP_HALIGN:
gtk_widget_set_halign (widget, g_value_get_enum (value)); 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); gtk_widget_set_has_tooltip (widget, has_tooltip);
if (has_tooltip && _gtk_widget_get_visible (widget)) 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 void
gtk_widget_trigger_tooltip_query (GtkWidget *widget) gtk_widget_trigger_tooltip_query (GtkWidget *widget)
{ {
gtk_tooltip_trigger_tooltip_query (gtk_widget_get_display (widget)); gtk_tooltip_trigger_tooltip_query (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");
}
} }
/** /**