Re: horrible things



jacob berkman <jacob ximian com> writes:

> this patch allows the gtk docs to build w/o an X connection.
> 
> this is not the most elegant solution, but i think it isn't all that bad
> either.  i just want to get a feeling on possible better ways to fix
> this, or if it's not interesting to people.  i am just happy to maybe be
> able to finally build a snapshot of this stuff :)
> 
> these seem to be the only widgets requiring gdk_display to be
> initialized during their class creating.

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.

(I think there should be a fix for at least gtkcolorsel.c on
Erwann's gtk-multihead branch.)

Regards,
                                        Owen

> Index: gtk/gtkcolorsel.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkcolorsel.c,v
> retrieving revision 1.77
> diff -u -r1.77 gtkcolorsel.c
> --- gtk/gtkcolorsel.c	2001/08/05 15:27:30	1.77
> +++ gtk/gtkcolorsel.c	2001/10/03 19:31:53
> @@ -1712,13 +1712,19 @@
>                                                        default_colors,
>                                                        G_PARAM_READWRITE));
>  
> -  g_object_get (G_OBJECT (gtk_settings_get_default ()),
> -                "gtk-color-palette",
> -                &palette,
> -                NULL);
> +  /* when building documentation, we may not have an X connection */
> +#if defined (GDK_WINDOWING_X11)
> +  if (GDK_DISPLAY ())
> +#endif
> +    {
> +      g_object_get (G_OBJECT (gtk_settings_get_default ()),
> +		    "gtk-color-palette",
> +		    &palette,
> +		    NULL);
>    
> -  fill_palette_from_string (palette);
> -  g_free (palette);
> +      fill_palette_from_string (palette);
> +      g_free (palette);
> +    }
>  
>    change_palette_hook = default_change_palette_func;
>    
> Index: gtk/gtkpreview.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkpreview.c,v
> retrieving revision 1.36
> diff -u -r1.36 gtkpreview.c
> --- gtk/gtkpreview.c	2001/07/18 23:39:23	1.36
> +++ gtk/gtkpreview.c	2001/10/03 19:31:53
> @@ -37,6 +37,10 @@
>  #include "gtksignal.h"
>  #include "gtkintl.h"
>  
> +#include "gdkconfig.h"
> +#if defined (GDK_WINDOWING_X11)
> +#include "x11/gdkx.h"
> +#endif
>  
>  #define PREVIEW_CLASS(w)      GTK_PREVIEW_CLASS (GTK_OBJECT (w)->klass)
>  
> @@ -117,16 +121,26 @@
>    widget_class->size_allocate = gtk_preview_size_allocate;
>    widget_class->expose_event = gtk_preview_expose;
>  
> -  klass->info.visual = NULL;
> -  klass->info.cmap = NULL;
> -
>    klass->info.lookup = NULL;
>  
>    klass->info.gamma = 1.0;
>  
> -  gdk_rgb_init ();
> -  klass->info.cmap = gdk_rgb_get_cmap ();
> -  klass->info.visual = gdk_rgb_get_visual ();
> +  /* when building documentation, we may not have an X connection */
> +#if defined (GDK_WINDOWING_X11)
> +  if (GDK_DISPLAY ())
> +    {
> +#endif
> +      gdk_rgb_init ();
> +      klass->info.cmap = gdk_rgb_get_cmap ();
> +      klass->info.visual = gdk_rgb_get_visual ();
> +#if defined (GDK_WINDOWING_X11)
> +    }
> +  else
> +    {
> +      klass->info.visual = NULL;
> +      klass->info.cmap = NULL;
> +    }
> +#endif
>  
>    g_object_class_install_property (gobject_class,
>                                     PROP_EXPAND,
> Index: gdk/x11/gdkevents-x11.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
> retrieving revision 1.62
> diff -u -r1.62 gdkevents-x11.c
> --- gdk/x11/gdkevents-x11.c	2001/10/03 18:19:47	1.62
> +++ gdk/x11/gdkevents-x11.c	2001/10/03 19:31:54
> @@ -2136,6 +2136,9 @@
>    gint i;
>    GValue tmp_val = { 0, };
>  
> +  if (!xsettings_client)
> +    return FALSE;
> +
>    for (i = 0; i < G_N_ELEMENTS (settings_map) ; i++)
>      if (strcmp (settings_map[i].gdk_name, name) == 0)
>        {




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