Make the default default colormap the GdkRGB colormap, not the system

Fri Sep  7 18:50:59 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
	Make the default default colormap the GdkRGB colormap,
	not the system colormap.

	* gtk/gtkinvisible.c (gtk_invisible_init)
	  gtk/gtkwindow.c (gtk_window_init): Set the current
	colormap, as returned by _gtk_widget_peek_colormap()
	on the widget.

	* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
	to GTK+. Make it return %NULL instead of the default
	colormap if no colormap has explicitely been pushed.

	* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
	colormaps on ancestral widgets before defaulting the
	the system default colormap.

	* docs/Changes-2.0.txt: explain colormap changes.
This commit is contained in:
Owen Taylor 2001-09-07 23:11:17 +00:00 committed by Owen Taylor
parent 51d551786a
commit 6341c2f9a2
12 changed files with 196 additions and 30 deletions

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -1,3 +1,24 @@
Fri Sep 7 18:50:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_get_default_colormap):
Make the default default colormap the GdkRGB colormap,
not the system colormap.
* gtk/gtkinvisible.c (gtk_invisible_init)
gtk/gtkwindow.c (gtk_window_init): Set the current
colormap, as returned by _gtk_widget_peek_colormap()
on the widget.
* gtk/gtkwidget.[ch]: Export _gtk_widget_peek_colormap
to GTK+. Make it return %NULL instead of the default
colormap if no colormap has explicitely been pushed.
* gtk/gtkwidget.c (gtk_widget_get_colormap): Check for
colormaps on ancestral widgets before defaulting the
the system default colormap.
* docs/Changes-2.0.txt: explain colormap changes.
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c: add some lame code to handle G_MININT, fixes

View File

@ -477,7 +477,21 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
gdk_wm_take_focus gdk_atom_intern ("WM_TAKE_FOCUS", FALSE)
gdk_wm_protocols gdk_atom_intern ("WM_PROTOCOLS", FALSE)
* The handling of Colormaps and widgets has been changed:
- The default colormap for widgets is now the GdkRGB colormap, not
the system default colormap. If you try to use resources created for
a widget (e.g., widget->style) with a window using the system
colormap, errors will result on some machines.
- gtk_widget_push/pop_colormap() only cause the colormap to be
explicitely set on toplevel widgets not on all widgets. The
colormap for other widgets (when not set using
gtk_widget_set_colormap()), is determined by finding the nearest
ancestor with a colormap set on it explicitely, or if that
fails, the default colormap.

View File

@ -83,6 +83,8 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
static void
gtk_invisible_init (GtkInvisible *invisible)
{
GdkColormap *colormap;
GTK_WIDGET_UNSET_FLAGS (invisible, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (invisible, GTK_TOPLEVEL);
@ -90,6 +92,10 @@ gtk_invisible_init (GtkInvisible *invisible)
gtk_object_sink (GTK_OBJECT (invisible));
invisible->has_user_ref_count = TRUE;
colormap = _gtk_widget_peek_colormap ();
if (colormap)
gtk_widget_set_colormap (GTK_WIDGET (invisible), colormap);
}
static void

View File

@ -194,7 +194,6 @@ static gboolean gtk_widget_real_focus_out_event (GtkWidget *widget,
GdkEventFocus *event);
static gboolean gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction);
static GdkColormap* gtk_widget_peek_colormap (void);
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
static void gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data);
@ -1253,11 +1252,6 @@ gtk_widget_init (GtkWidget *widget)
widget->style = gtk_widget_get_default_style ();
gtk_style_ref (widget->style);
colormap = gtk_widget_peek_colormap ();
if (colormap != gtk_widget_get_default_colormap ())
gtk_widget_set_colormap (widget, colormap);
}
@ -4695,10 +4689,15 @@ gtk_widget_get_colormap (GtkWidget *widget)
if (colormap)
return colormap;
}
colormap = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_colormap);
if (colormap)
return colormap;
while (widget)
{
colormap = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_colormap);
if (colormap)
return colormap;
widget = widget->parent;
}
return gtk_widget_get_default_colormap ();
}
@ -4944,14 +4943,8 @@ gtk_widget_push_colormap (GdkColormap *cmap)
void
gtk_widget_pop_colormap (void)
{
GSList *tmp;
if (colormap_stack)
{
tmp = colormap_stack;
colormap_stack = colormap_stack->next;
g_slist_free_1 (tmp);
}
colormap_stack = g_slist_delete_link (colormap_stack, colormap_stack);
}
/**
@ -4987,7 +4980,7 @@ GdkColormap*
gtk_widget_get_default_colormap (void)
{
if (!default_colormap)
gtk_widget_set_default_colormap (gdk_colormap_get_system ());
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
return default_colormap;
}
@ -5346,20 +5339,18 @@ gtk_widget_real_size_request (GtkWidget *widget,
requisition->height = widget->requisition.height;
}
/*****************************************
* gtk_widget_peek_colormap:
*
* arguments:
*
* results:
*****************************************/
static GdkColormap*
gtk_widget_peek_colormap (void)
/**
* _gtk_widget_peek_colormap:
*
* Returns colormap currently pushed by gtk_widget_push_colormap, if any.
*
* Return value: the currently pushed colormap, or %NULL if there is none.
**/
GdkColormap*
_gtk_widget_peek_colormap (void)
{
if (colormap_stack)
return (GdkColormap*) colormap_stack->data;
return gtk_widget_get_default_colormap ();
}
static void

View File

@ -757,6 +757,8 @@ GtkWidgetAuxInfo *_gtk_widget_get_aux_info (GtkWidget *widget,
void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
GdkColormap* _gtk_widget_peek_colormap (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -576,6 +576,8 @@ gtk_window_class_init (GtkWindowClass *klass)
static void
gtk_window_init (GtkWindow *window)
{
GdkColormap *colormap;
GTK_WIDGET_UNSET_FLAGS (window, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
@ -610,6 +612,10 @@ gtk_window_init (GtkWindow *window)
window->decorated = TRUE;
window->mnemonic_modifier = GDK_MOD1_MASK;
colormap = _gtk_widget_peek_colormap ();
if (colormap)
gtk_widget_set_colormap (GTK_WIDGET (window), colormap);
gtk_widget_ref (GTK_WIDGET (window));
gtk_object_sink (GTK_OBJECT (window));
window->has_user_ref_count = TRUE;