Re: Outstanding patches, #15891



On Thu, 9 Aug 2001, Matthias Clasen wrote:

> The bug complains about a the fact that a currently displayed tooltip is
> removed when its text is changed
> with gtk_tooltips_set_tip. It may not be the best practice to continuously
> change tooltip texts, but it still
> seems correct to keep the tooltip displayed in this case.
> 
> Here is a patch which implements this. Ok to commit ?

> @@ -238,11 +238,16 @@ gtk_tooltips_set_tip (GtkTooltips *toolt
>  		      const gchar *tip_private)
>  {
>    GtkTooltipsData *tooltipsdata;
> +  gboolean show_tips;
> 
>    g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
>    g_return_if_fail (widget != NULL);
> 
>    tooltipsdata = gtk_tooltips_data_get (widget);
> +
> +  show_tips = (tooltips->active_tips_data
> +    && tooltips->active_tips_data->widget == widget);
> +
>    if (tooltipsdata)
>      gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);

hm, the gtk_widget_ref (widget) from the if (tooltipsdata != NULL) branched
should be moved prior to gtk_tooltips_widget_remove() to avoid crashes
with widget-post-mortem tooltip changes.
(and the if (tooltipsdata != NULL) is junk btw, g_new0() always returns != NULL).

> @@ -280,6 +285,11 @@ gtk_tooltips_set_tip (GtkTooltips *toolt
>        gtk_signal_connect (GTK_OBJECT (widget), "destroy",
>  			  (GtkSignalFunc) gtk_tooltips_widget_remove,
>  			  (gpointer) tooltipsdata);
> +      if (show_tips)
> +	{
> +	  gtk_tooltips_set_active_widget (tooltips, widget);
> +	  gtk_tooltips_draw_tips (tooltips);

you should do the same check as the timeout function here before
calling draw_tips, i.e. check WIDGET_DRAWABLE(widget).

> +	}
>      }
>  }

have you actually tried this test? e.g. with a timer function
resetting a tooltip ala "n_timer calls %d",count++ ?
the way i read your patch and the tooltips code, this will still result
in bad flickering right?
i think, if we take the measures to fix this tooltip resetting behaviour,
we should do it right, e.g. by checking for (tooltips->widget==widget &&
GTK_WIDGET_DRAWABLE (tooltips->tip_window)) and in that case, spare the
remove and signal connections, just update ->tip_text and ->tip_private
and then fix draw_tips according to:
- don't hide the window if its already visible
- use gtk_window_move() instead of set_uposition()

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]