Re: Outstanding patches, #15891



On Mon, 13 Aug 2001, Matthias Clasen wrote:

> Ok, here is an updated patch incorporating Tims comments. 
> This one doesn't flicker. 
> 
> Ok to commit ?
> 
> 
> Index: gtk/gtktooltips.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtktooltips.c,v
> retrieving revision 1.40
> diff -u -3 -p -u -r1.40 gtktooltips.c
> --- gtk/gtktooltips.c 2001/07/18 23:39:23 1.40
> +++ gtk/gtktooltips.c 2001/08/13 07:43:09
> @@ -243,39 +243,54 @@ gtk_tooltips_set_tip (GtkTooltips *toolt
>    g_return_if_fail (widget != NULL);
>  
>    tooltipsdata = gtk_tooltips_data_get (widget);
> -  if (tooltipsdata)
> -    gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
>  
>    if (!tip_text)
> -    return;
> -
> -  tooltipsdata = g_new0 (GtkTooltipsData, 1);
> -
> -  if (tooltipsdata != NULL)
>      {
> +      if (tooltipsdata)
> + gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
> +      return;
> +    }
> +  
> +  if (tooltips->active_tips_data 
> +      && tooltips->active_tips_data->widget == widget
> +      && GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
> +    {
> +      tooltipsdata->tip_text = g_strdup (tip_text);
> +      tooltipsdata->tip_private = g_strdup (tip_private);

you need to free the old tip_text and tip_private.

> +      gtk_tooltips_draw_tips (tooltips);
> +    }
> +  else 
> +    {
> +      gtk_widget_ref (widget);
> +      
> +      if (tooltipsdata)
> + gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
> +      
> +      tooltipsdata = g_new0 (GtkTooltipsData, 1);
> +      
>        tooltipsdata->tooltips = tooltips;
>        tooltipsdata->widget = widget;
> -      gtk_widget_ref (widget);
>  
>        tooltipsdata->tip_text = g_strdup (tip_text);
>        tooltipsdata->tip_private = g_strdup (tip_private);
>  
>        tooltips->tips_data_list = g_list_append (tooltips->tips_data_list,
> -                                             tooltipsdata);
> +      tooltipsdata);

this looks odd, did you really re-indent that way? ;)

>        gtk_signal_connect_after(GTK_OBJECT (widget), "event",
> -                               (GtkSignalFunc) gtk_tooltips_event_handler,
> -                         (gpointer) tooltipsdata);
> +          (GtkSignalFunc) gtk_tooltips_event_handler,
> +          (gpointer) tooltipsdata);

the "(gpointer)" cast should be removed.

>        gtk_object_set_data (GTK_OBJECT (widget), tooltips_data_key,
> -                           (gpointer) tooltipsdata);
> +      (gpointer) tooltipsdata);
dito

>  
>        gtk_signal_connect (GTK_OBJECT (widget), "unmap",
> -                          (GtkSignalFunc) gtk_tooltips_widget_unmap,
> -                          (gpointer) tooltipsdata);
> +     (GtkSignalFunc) gtk_tooltips_widget_unmap,
> +     (gpointer) tooltipsdata);
dito

>  
>        gtk_signal_connect (GTK_OBJECT (widget), "unrealize",
> -                          (GtkSignalFunc) gtk_tooltips_widget_unmap,
> -                          (gpointer) tooltipsdata);
> +     (GtkSignalFunc) gtk_tooltips_widget_unmap,
> +     (gpointer) tooltipsdata);
dito

>  
>        gtk_signal_connect (GTK_OBJECT (widget), "destroy",
>       (GtkSignalFunc) gtk_tooltips_widget_remove,
> @@ -306,10 +321,7 @@ gtk_tooltips_draw_tips (GtkTooltips * to
>    if (!tooltips->tip_window)
>      gtk_tooltips_force_window (tooltips);
>    else if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
> -    {
> -      gtk_widget_hide (tooltips->tip_window);
> -      g_get_current_time (&tooltips->last_popdown);
> -    }
> +    g_get_current_time (&tooltips->last_popdown);
>  
>    gtk_widget_ensure_style (tooltips->tip_window);
>    style = tooltips->tip_window->style;
> @@ -344,7 +356,7 @@ gtk_tooltips_draw_tips (GtkTooltips * to
>    else
>      y = y + widget->allocation.height + 4;
>  
> -  gtk_widget_set_uposition (tooltips->tip_window, x, y);
> +  gtk_window_move (tooltips->tip_window, x, y);
>    gtk_widget_show (tooltips->tip_window);
>  }

ok, i think this is ok now, but of course i could be wrong,
did you actually give this some testing?

---
ciaoTJ





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