Change style->white to style->base[] where appropriate. Change the default

* gtk/gtkentry.c gtk/gtkinputdialog.c gtk/gtklist.c
	  gtk/gtklistitem.c gtktree.c gtk/gtktreeitem.c testgtkrc:

	  Change style->white to style->base[] where appropriate.
	  Change the default style to make this apparent. (Yes, it's
	  ugly... it can be removed later)
This commit is contained in:
Owen Taylor
1998-02-13 05:26:33 +00:00
parent 888470ee29
commit 041983a776
10 changed files with 41 additions and 34 deletions

View File

@ -344,10 +344,10 @@ gtk_entry_init (GtkEntry *entry)
gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY, gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY,
GDK_TARGET_STRING, gtk_entry_selection_handler, GDK_TARGET_STRING, gtk_entry_selection_handler,
NULL, NULL); NULL);
gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom, gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom,
GDK_TARGET_STRING, gtk_entry_selection_handler, GDK_TARGET_STRING, gtk_entry_selection_handler,
NULL, NULL); NULL);
if (!text_atom) if (!text_atom)
text_atom = gdk_atom_intern ("TEXT", FALSE); text_atom = gdk_atom_intern ("TEXT", FALSE);
@ -355,11 +355,11 @@ gtk_entry_init (GtkEntry *entry)
gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY, gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY,
text_atom, text_atom,
gtk_entry_selection_handler, gtk_entry_selection_handler,
NULL, NULL); NULL);
gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom, gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom,
text_atom, text_atom,
gtk_entry_selection_handler, gtk_entry_selection_handler,
NULL, NULL); NULL);
if (!ctext_atom) if (!ctext_atom)
ctext_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE); ctext_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
@ -367,11 +367,11 @@ gtk_entry_init (GtkEntry *entry)
gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY, gtk_selection_add_handler (GTK_WIDGET(entry), GDK_SELECTION_PRIMARY,
ctext_atom, ctext_atom,
gtk_entry_selection_handler, gtk_entry_selection_handler,
NULL, NULL); NULL);
gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom, gtk_selection_add_handler (GTK_WIDGET(entry), clipboard_atom,
ctext_atom, ctext_atom,
gtk_entry_selection_handler, gtk_entry_selection_handler,
NULL, NULL); NULL);
} }
GtkWidget* GtkWidget*
@ -599,8 +599,8 @@ gtk_entry_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
gdk_window_set_background (entry->text_area, &widget->style->white); gdk_window_set_background (entry->text_area, &widget->style->base[GTK_STATE_NORMAL]);
#ifdef USE_XIM #ifdef USE_XIM
if (gdk_im_ready ()) if (gdk_im_ready ())
@ -664,7 +664,7 @@ gtk_entry_realize (GtkWidget *widget)
} }
gdk_ic_set_attr (entry->ic,"preeditAttributes", gdk_ic_set_attr (entry->ic,"preeditAttributes",
"foreground", widget->style->fg[GTK_STATE_NORMAL].pixel, "foreground", widget->style->fg[GTK_STATE_NORMAL].pixel,
"background", widget->style->white.pixel, "background", widget->style->base[GTK_STATE_NORMAL].pixel,
NULL); NULL);
} }
} }
@ -720,8 +720,9 @@ gtk_entry_draw_focus (GtkWidget *widget)
} }
else else
{ {
gdk_draw_rectangle (widget->window, widget->style->white_gc, FALSE, gdk_draw_rectangle (widget->window,
x + 2, y + 2, width - 5, height - 5); widget->style->base_gc[GTK_WIDGET_STATE(widget)],
FALSE, x + 2, y + 2, width - 5, height - 5);
} }
gtk_draw_shadow (widget->style, widget->window, gtk_draw_shadow (widget->style, widget->window,
@ -1457,7 +1458,7 @@ gtk_entry_draw_text (GtkEntry *entry)
gtk_entry_make_backing_pixmap (entry, width, height); gtk_entry_make_backing_pixmap (entry, width, height);
drawable = entry->backing_pixmap; drawable = entry->backing_pixmap;
gdk_draw_rectangle (drawable, gdk_draw_rectangle (drawable,
widget->style->white_gc, widget->style->base_gc[GTK_WIDGET_STATE(widget)],
TRUE, TRUE,
0, 0, 0, 0,
width, width,
@ -1570,7 +1571,7 @@ gtk_entry_draw_cursor_on_drawable (GtkEntry *entry, GdkDrawable *drawable)
(entry->selection_start_pos == entry->selection_end_pos)) (entry->selection_start_pos == entry->selection_end_pos))
gc = widget->style->fg_gc[GTK_STATE_NORMAL]; gc = widget->style->fg_gc[GTK_STATE_NORMAL];
else else
gc = widget->style->white_gc; gc = widget->style->base_gc[GTK_WIDGET_STATE(widget)];
gdk_window_get_size (entry->text_area, NULL, &text_area_height); gdk_window_get_size (entry->text_area, NULL, &text_area_height);
gdk_draw_line (drawable, gc, xoffset, 0, xoffset, text_area_height); gdk_draw_line (drawable, gc, xoffset, 0, xoffset, text_area_height);

View File

@ -529,7 +529,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
gtk_widget_realize (inputd->axis_list); gtk_widget_realize (inputd->axis_list);
gdk_window_set_background (inputd->axis_list->window, gdk_window_set_background (inputd->axis_list->window,
&inputd->axis_list->style->white); &inputd->axis_list->style->base[GTK_STATE_NORMAL]);
for (i=GDK_AXIS_X;i<GDK_AXIS_LAST;i++) for (i=GDK_AXIS_X;i<GDK_AXIS_LAST;i++)
{ {
@ -664,7 +664,7 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
gtk_widget_realize (inputd->keys_list); gtk_widget_realize (inputd->keys_list);
gdk_window_set_background (inputd->keys_list->window, gdk_window_set_background (inputd->keys_list->window,
&inputd->keys_list->style->white); &inputd->keys_list->style->base[GTK_STATE_NORMAL]);
for (i=0;i<info->num_keys;i++) for (i=0;i<info->num_keys;i++)
{ {

View File

@ -604,7 +604,8 @@ gtk_list_realize (GtkWidget *widget)
gdk_window_set_user_data (widget->window, widget); gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
} }
static void static void

View File

@ -145,7 +145,8 @@ gtk_list_item_realize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (parent_class)->realize) if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
} }
static void static void
@ -222,7 +223,8 @@ gtk_list_item_draw (GtkWidget *widget,
if (!GTK_WIDGET_IS_SENSITIVE (widget)) if (!GTK_WIDGET_IS_SENSITIVE (widget))
gtk_style_set_background (widget->style, widget->window, GTK_STATE_INSENSITIVE); gtk_style_set_background (widget->style, widget->window, GTK_STATE_INSENSITIVE);
else if (widget->state == GTK_STATE_NORMAL) else if (widget->state == GTK_STATE_NORMAL)
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
else else
gtk_style_set_background (widget->style, widget->window, widget->state); gtk_style_set_background (widget->style, widget->window, widget->state);
@ -251,7 +253,7 @@ gtk_list_item_draw_focus (GtkWidget *widget)
else if (!GTK_WIDGET_IS_SENSITIVE (widget)) else if (!GTK_WIDGET_IS_SENSITIVE (widget))
gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE]; gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE];
else if (widget->state == GTK_STATE_NORMAL) else if (widget->state == GTK_STATE_NORMAL)
gc = widget->style->white_gc; gc = widget->style->base_gc[GTK_STATE_NORMAL];
else else
gc = widget->style->bg_gc[widget->state]; gc = widget->style->bg_gc[widget->state];
@ -294,7 +296,7 @@ gtk_list_item_expose (GtkWidget *widget,
if (!GTK_WIDGET_IS_SENSITIVE (widget)) if (!GTK_WIDGET_IS_SENSITIVE (widget))
gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_INSENSITIVE]); gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_INSENSITIVE]);
else if (widget->state == GTK_STATE_NORMAL) else if (widget->state == GTK_STATE_NORMAL)
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
else else
gdk_window_set_background (widget->window, &widget->style->bg[widget->state]); gdk_window_set_background (widget->window, &widget->style->bg[widget->state]);

View File

@ -54,10 +54,6 @@ GtkWidget* gtk_radio_button_new (GSList *group);
GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group); GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group);
GtkWidget* gtk_radio_button_new_with_label (GSList *group, GtkWidget* gtk_radio_button_new_with_label (GSList *group,
const gchar *label); const gchar *label);
GtkWidget* gtk_radio_button_new_interp (GtkRadioButton *group);
GtkWidget* gtk_radio_button_new_with_label_interp
(GtkRadioButton *group,
const gchar *label);
GSList* gtk_radio_button_group (GtkRadioButton *radio_button); GSList* gtk_radio_button_group (GtkRadioButton *radio_button);

View File

@ -615,7 +615,8 @@ gtk_tree_realize (GtkWidget *widget)
gdk_window_set_user_data (widget->window, widget); gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
} }

View File

@ -187,7 +187,7 @@ gtk_tree_item_subtree_button_changed_state(GtkWidget *w)
if(GTK_WIDGET_VISIBLE (w)) { if(GTK_WIDGET_VISIBLE (w)) {
if (w->state == GTK_STATE_NORMAL) if (w->state == GTK_STATE_NORMAL)
gdk_window_set_background (w->window, &w->style->white); gdk_window_set_background (w->window, &w->style->base[w->state]);
else else
gdk_window_set_background (w->window, &w->style->bg[w->state]); gdk_window_set_background (w->window, &w->style->bg[w->state]);
@ -410,7 +410,8 @@ gtk_tree_item_realize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (parent_class)->realize) if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
} }
static void static void
@ -602,7 +603,8 @@ gtk_tree_item_draw (GtkWidget *widget,
widget->state == GTK_STATE_SELECTED) widget->state == GTK_STATE_SELECTED)
gtk_style_set_background (widget->style, widget->window, widget->state); gtk_style_set_background (widget->style, widget->window, widget->state);
else else
gdk_window_set_background (widget->window, &widget->style->white); gdk_window_set_background (widget->window,
&widget->style->base[GTK_STATE_NORMAL]);
gdk_window_clear_area (widget->window, gdk_window_clear_area (widget->window,
child_area.x, child_area.y, child_area.x, child_area.y,
@ -623,7 +625,7 @@ gtk_tree_item_draw (GtkWidget *widget,
gtk_style_set_background (widget->style, widget->window, gtk_style_set_background (widget->style, widget->window,
GTK_STATE_INSENSITIVE); GTK_STATE_INSENSITIVE);
else if (widget->state == GTK_STATE_NORMAL) else if (widget->state == GTK_STATE_NORMAL)
gdk_window_set_background(widget->window, &widget->style->white); gdk_window_set_background(widget->window, &widget->style->base[GTK_STATE_NORMAL]);
else else
gtk_style_set_background (widget->style, widget->window, widget->state); gtk_style_set_background (widget->style, widget->window, widget->state);
@ -656,7 +658,7 @@ gtk_tree_item_draw_focus (GtkWidget *widget)
else if (!GTK_WIDGET_IS_SENSITIVE (widget)) else if (!GTK_WIDGET_IS_SENSITIVE (widget))
gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE]; gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE];
else if (widget->state == GTK_STATE_NORMAL) else if (widget->state == GTK_STATE_NORMAL)
gc = widget->style->white_gc; gc = widget->style->base_gc[GTK_STATE_NORMAL];
else else
gc = widget->style->bg_gc[widget->state]; gc = widget->style->bg_gc[widget->state];

View File

@ -1414,7 +1414,8 @@ gtk_widget_queue_draw (GtkWidget *widget)
GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_PENDING); GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_PENDING);
if (gtk_widget_redraw_queue == NULL) if (gtk_widget_redraw_queue == NULL)
gtk_idle_add ((GtkFunction) gtk_widget_idle_draw, NULL); gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
(GtkFunction) gtk_widget_idle_draw, NULL);
gtk_widget_redraw_queue = g_slist_prepend (gtk_widget_redraw_queue, widget); gtk_widget_redraw_queue = g_slist_prepend (gtk_widget_redraw_queue, widget);
} }
@ -1460,7 +1461,8 @@ gtk_widget_queue_resize (GtkWidget *widget)
{ {
GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING); GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING);
if (gtk_widget_resize_queue == NULL) if (gtk_widget_resize_queue == NULL)
gtk_idle_add ((GtkFunction) gtk_widget_idle_sizer, NULL); gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
(GtkFunction) gtk_widget_idle_sizer, NULL);
gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel); gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel);
} }

View File

@ -13,6 +13,7 @@ pixmap_path "."
style "default" style "default"
{ {
fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*" fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*"
base[NORMAL] = { 1.0, 0.8, 0.8 }
} }
style "window" style "window"
@ -61,7 +62,7 @@ style "curve"
fg[NORMAL] = { 58000, 0, 0 } # red fg[NORMAL] = { 58000, 0, 0 } # red
} }
#widget_class "*" style "default" widget_class "*" style "default"
widget_class "GtkWindow" style "window" widget_class "GtkWindow" style "window"
widget_class "GtkDialog" style "window" widget_class "GtkDialog" style "window"
widget_class "GtkFileSelection" style "window" widget_class "GtkFileSelection" style "window"

View File

@ -13,6 +13,7 @@ pixmap_path "."
style "default" style "default"
{ {
fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*" fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*"
base[NORMAL] = { 1.0, 0.8, 0.8 }
} }
style "window" style "window"
@ -61,7 +62,7 @@ style "curve"
fg[NORMAL] = { 58000, 0, 0 } # red fg[NORMAL] = { 58000, 0, 0 } # red
} }
#widget_class "*" style "default" widget_class "*" style "default"
widget_class "GtkWindow" style "window" widget_class "GtkWindow" style "window"
widget_class "GtkDialog" style "window" widget_class "GtkDialog" style "window"
widget_class "GtkFileSelection" style "window" widget_class "GtkFileSelection" style "window"