+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
+2001-10-28 jacob berkman <jacob@ximian.com>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_class_init): do not call
+ gtk_settings_get_default() here as that requires an X connection
+ (which breaks doc building with no X connection) and is not
+ multihead safe
+ (gtk_color_selection_init): delay palette loading until realize
+ time
+ (gtk_color_selection_realize): load the palette, and initialize
+ the global palette if it hasn't been already
+
+ * gtk/gtkpreview.c (gtk_preview_class_init): don't initialize the
+ visual/cmap fields of klass->info since they are gone
+ (gtk_preview_get_visual): just return gdk_rgb_get_visual ()
+ (gtk_preview_get_cmap): just return gdk_rgb_get_colormap ()
+ (gtk_preview_realize): don't set VISUAL and COLORMAP attributes
+
+ * gtk/gtkpreview.h (struct _GtkPreviewInfo): remove visual and
+ cmap fields
+ (gtk_preview_get_visual):
+ (gtk_preview_get_cmap): mark as deprecated
+
+ * docs/Changes-2.0.txt: add a little note about the GtkPreviewInfo
+ changes
+
Sun Oct 28 09:15:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontext.h (struct _GtkIMContext): Fixed
If you aren't using GDK and GTK+ functions from multiple threads,
there is no reason to call gdk_threads_init().
+
+* The GtkPreviewInfo struct has had its visual and colormap fields
+ removed. Also, gtk_preview_get_cmap() and gtk_preview_get_visual()
+ are deprecated, as GdkRgb works on any colormap and visual. You no
+ longer need to gtk_widget_push_cmap (gtk_preview_get_cmap ()) in
+ your code.
static void gtk_color_selection_class_init (GtkColorSelectionClass *klass);
static void gtk_color_selection_destroy (GtkObject *object);
static void gtk_color_selection_finalize (GObject *object);
+static void gtk_color_selection_realize (GtkWidget *widget);
static void update_color (GtkColorSelection *colorsel);
static void gtk_color_selection_set_property (GObject *object,
guint prop_id,
GdkColor *color);
static void gtk_color_selection_unset_palette_color (GtkColorSelection *colorsel,
gint index);
+static void default_change_palette_func (const GdkColor *colors,
+ gint n_colors);
static gpointer parent_class = NULL;
static guint color_selection_signals[LAST_SIGNAL] = { 0 };
static gchar* default_colors = "black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90";
-static GtkColorSelectionChangePaletteFunc change_palette_hook = NULL;
+static GtkColorSelectionChangePaletteFunc change_palette_hook = default_change_palette_func;
static GdkColor current_colors[GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT];
{
GtkObjectClass *object_class;
GObjectClass *gobject_class;
- gchar *palette;
+ GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (klass);
gobject_class = G_OBJECT_CLASS (klass);
+ widget_class = GTK_WIDGET_CLASS (klass);
parent_class = gtk_type_class (GTK_TYPE_VBOX);
gobject_class->set_property = gtk_color_selection_set_property;
gobject_class->get_property = gtk_color_selection_get_property;
+ widget_class->realize = gtk_color_selection_realize;
+
g_object_class_install_property (gobject_class,
PROP_HAS_OPACITY_CONTROL,
g_param_spec_boolean ("has_opacity_control",
_("Palette to use in the color selector"),
default_colors,
G_PARAM_READWRITE));
-
- 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);
}
/* widget functions */
gtk_widget_show_all (top_hbox);
- /* 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);
-
/* hide unused stuff */
if (priv->has_opacity == FALSE)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gtk_color_selection_realize (GtkWidget *widget)
+{
+ GtkColorSelection *colorsel = GTK_COLOR_SELECTION (widget);
+ ColorSelectionPrivate *priv = colorsel->private_data;
+ gchar *palette;
+ static gboolean initialized = FALSE;
+
+ if (!initialized)
+ {
+ g_object_get (gtk_settings_get_default (),
+ "gtk-color-palette", &palette,
+ NULL);
+
+ fill_palette_from_string (palette);
+ g_free (palette);
+
+ g_signal_connect (gtk_settings_get_default (),
+ "notify::gtk-color-palette",
+ G_CALLBACK (palette_change_notify_class),
+ NULL);
+
+ initialized = TRUE;
+ }
+
+ /* Set default colors */
+
+ update_palette (colorsel);
+ priv->settings_connection =
+ g_signal_connect (gtk_settings_get_default (),
+ "notify::gtk-color-palette",
+ G_CALLBACK (palette_change_notify_instance),
+ colorsel);
+
+ if (GTK_WIDGET_CLASS (parent_class)->realize)
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+}
/**
* gtk_color_selection_new:
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 ();
g_object_class_install_property (gobject_class,
PROP_EXPAND,
g_return_if_fail (GTK_IS_PREVIEW (preview));
g_return_if_fail (data != NULL);
- g_return_if_fail (preview_class->info.visual != NULL);
bpp = (preview->type == GTK_PREVIEW_COLOR ? 3 : 1);
rowstride = (preview->buffer_width * bpp + 3) & -4;
GdkVisual*
gtk_preview_get_visual (void)
{
- if (!preview_class)
- preview_class = gtk_type_class (gtk_preview_get_type ());
-
- return preview_class->info.visual;
+ return gdk_rgb_get_visual ();
}
GdkColormap*
gtk_preview_get_cmap (void)
{
- if (!preview_class)
- preview_class = gtk_type_class (gtk_preview_get_type ());
-
- return preview_class->info.cmap;
+ return gdk_rgb_get_colormap ();
}
GtkPreviewInfo*
attributes.y = widget->allocation.y + (widget->allocation.height - attributes.height) / 2;;
attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = preview_class->info.visual;
- attributes.colormap = preview_class->info.cmap;
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+ attributes_mask = GDK_WA_X | GDK_WA_Y;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
struct _GtkPreviewInfo
{
- GdkVisual *visual;
- GdkColormap *cmap;
-
guchar *lookup;
gdouble gamma;
void gtk_preview_set_reserved (gint nreserved);
void gtk_preview_set_dither (GtkPreview *preview,
GdkRgbDither dither);
+#ifndef GTK_DISABLE_DEPRECATED
GdkVisual* gtk_preview_get_visual (void);
GdkColormap* gtk_preview_get_cmap (void);
+#endif
GtkPreviewInfo* gtk_preview_get_info (void);
/* This function reinitializes the preview colormap and visual from