Re: horrible things



jacob berkman <jacob ximian com> writes:

> On Wed, 2001-10-03 at 15:48, Owen Taylor wrote:
> > 
> > jacob berkman <jacob ximian com> writes:
> > 
> > > this patch allows the gtk docs to build w/o an X connection.
> > 
> > I'm not taking this patch. We'll need clean solutions of this
> > sort of or GTK+-2.2, so I wouldn't object to clean patches,
> > but I'm not going to put in bad hacks. You _can_ run Xvfb,
> > after all.
> 
> here's a nicer version.  the colorsel fix is from the multihead branch,
> and the preview fix is my own concoction.
> 
> it seems as GtkPreviewClass->info is pretty useless at this point, as
> GdkRgb says about _get_colormap(), so i don't know if you'd rather have
> this done in a better way.
> 
> i ran HEAD gimp and tried some of the filters which use GtkPreview, and
> they didn't complain about anything.

Looks like its definitely heading in the right direction. But
there is a much simpler solution for GtkPreview - just let it
use the default visual and colormap for the widget instead of setting 
something different:

 - The GdkRGB visual/colormap are the default now
 - GdkRGB can render into any visual/colormap now

I think it should be possible to fix GtkPreview with a '-' only
patch.

> +static void
> +gtk_color_selection_realize (GtkWidget *widget)
> +{
> +  GtkColorSelection *colorsel = GTK_COLOR_SELECTION (widget);
> +  ColorSelectionPrivate *priv = colorsel->private_data;
> +  gchar *palette;
> +
> +  g_object_get (G_OBJECT (gtk_settings_get_default ()),
> +                "gtk-color-palette",
> +                &palette,
> +                NULL);
> +  
> +  fill_palette_from_string (palette);
> +  g_free (palette);
> +
> +  change_palette_hook = default_change_palette_func;
> +  
> +  g_signal_connect_data (G_OBJECT (gtk_settings_get_default ()),
> +                         "notify::gtk-color-palette",
> +                         G_CALLBACK (palette_change_notify_class),
> +                         NULL, NULL, 0);

For simplicity, this should be: 

 g_signal_connect (gtk_settings_get_default(), "notify::gtk-color-palette",
                   G_CALLBACK (palette_change_notify_class), NULL);

and correspondingly below.
                  

> +  
> +  /* Set default colors */
> +
> +  update_palette (colorsel);
> +  priv->settings_connection =
> +    g_signal_connect_data (G_OBJECT (gtk_settings_get_default ()),
> +			   "notify::gtk-color-palette",
> +			   G_CALLBACK (palette_change_notify_instance),
> +			   colorsel, NULL, 0);
> +
> +  if (GTK_WIDGET_CLASS (parent_class)->realize)
> +    GTK_WIDGET_CLASS (parent_class)->realize (widget);
> +}

In theory, this needs to be refcounted once-per-display (that
is, disconnect the single signal connection when the last 
colrosel for the display is unrealized.

For GTK+-1.2, once-per-display == once, and I think we can
skip the unrealize safely, but it does need to be once.

Regards,
                                        Owen



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