mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
rectangles: add basic tooltip support
We definitely want to do something better, but this at least allows testing some data which is useful now to see what is going on.
This commit is contained in:
@ -117,6 +117,24 @@ sp_mark_visualizer_row_worker (GTask *task,
|
||||
g_task_return_pointer (task, g_steal_pointer (&state->rects), (GDestroyNotify)rectangles_free);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sp_mark_visualizer_row_query_tooltip (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean keyboard_mode,
|
||||
GtkTooltip *tooltip)
|
||||
{
|
||||
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)widget;
|
||||
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
||||
|
||||
g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
|
||||
|
||||
if (priv->rectangles == NULL)
|
||||
return FALSE;
|
||||
|
||||
return rectangles_query_tooltip (priv->rectangles, tooltip, priv->group, x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sp_mark_visualizer_row_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
@ -282,6 +300,7 @@ sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
|
||||
object_class->set_property = sp_mark_visualizer_row_set_property;
|
||||
|
||||
widget_class->draw = sp_mark_visualizer_row_draw;
|
||||
widget_class->query_tooltip = sp_mark_visualizer_row_query_tooltip;
|
||||
|
||||
visualizer_class->set_reader = sp_mark_visualizer_row_set_reader;
|
||||
|
||||
@ -308,6 +327,8 @@ sp_mark_visualizer_row_init (SpMarkVisualizerRow *self)
|
||||
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
||||
PangoAttrList *attrs = pango_attr_list_new ();
|
||||
|
||||
gtk_widget_set_has_tooltip (GTK_WIDGET (self), TRUE);
|
||||
|
||||
pango_attr_list_insert (attrs, pango_attr_scale_new (PANGO_SCALE_SMALL * PANGO_SCALE_SMALL));
|
||||
|
||||
priv->label = g_object_new (GTK_TYPE_LABEL,
|
||||
|
||||
Reference in New Issue
Block a user