diff --git a/ChangeLog b/ChangeLog index debf2deab0..e30460c999 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index debf2deab0..e30460c999 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,24 @@ +Sat Oct 17 00:40:51 1998 Owen Taylor + + * gtk/gtkrc.c (gtk_rc_style_init): Duplicate bg_pixmap_name when + merging RC styles. Report new share/themes path for + themes directory. Deref theme engines when appropriate. + + * gtk/gtkclist.c: Set all backgrounds in _style_set(). + Make sure that pixel for xor_gc is never 0. + + * gtk/gtkctree.c: Choose colors for plus/minus more + carefully, in a hopefully style-independent fashion. + (Still needs a bit more work) + + * gtk/gtkwidget.c: Don't send expose events to widgets + which are about to be resized and redrawn. (Needs a + bit more thought.) + + * gtk/gtknotebook.c (gtk_notebook_draw_tab): Avoid + drawing on tabs for newly allocated, un-sized + pages - we'll get the size wrong. + Thu Oct 1 17:38:07 1998 Owen Taylor * gtk/gtkwidget.c (gtk_widget_redraw_queue_remove): Fixed diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 0dd028d51d..08eba995e3 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -360,7 +360,6 @@ static void real_sort_list (GtkCList *clist); /* Fill in data after widget is realized and has style */ static void add_style_data (GtkCList * clist); - static void gtk_clist_style_set (GtkWidget *widget, GtkStyle *previous_style); static GtkContainerClass *parent_class = NULL; @@ -2459,7 +2458,10 @@ gtk_clist_realize (GtkWidget * widget) /* We'll use this gc to do scrolling as well */ gdk_gc_set_exposures (clist->fg_gc, TRUE); - values.foreground = widget->style->white; + if (widget->style->white.pixel == 0) + values.foreground = widget->style->black; + else + values.foreground = widget->style->white; values.function = GDK_XOR; values.subwindow_mode = GDK_INCLUDE_INFERIORS; clist->xor_gc = gdk_gc_new_with_values (widget->window, @@ -6117,24 +6119,19 @@ static void gtk_clist_style_set (GtkWidget *widget, GtkStyle *previous_style) { - GdkRectangle area; - - if (GTK_WIDGET_REALIZED (widget) && - !GTK_WIDGET_NO_WINDOW (widget)) - { - gtk_style_set_background (widget->style, widget->window, widget->state); - if (GTK_WIDGET_DRAWABLE (widget)) - gdk_window_clear (widget->window); + GtkCList *clist; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_CLIST (widget)); + + clist = GTK_CLIST (widget); + + if (GTK_WIDGET_REALIZED (widget)) + { + gtk_style_set_background (widget->style, widget->window, widget->state); + gtk_style_set_background (widget->style, clist->title_window, GTK_STATE_SELECTED); + gdk_window_set_background (clist->clist_window, &widget->style->bg[GTK_STATE_PRELIGHT]); } - if (GTK_CLIST(widget)->vscrollbar) - gtk_widget_queue_draw(GTK_CLIST(widget)->vscrollbar); - if (GTK_CLIST(widget)->hscrollbar) - gtk_widget_queue_draw(GTK_CLIST(widget)->hscrollbar); - area.x = 0; - area.y = 0; - area.width = widget->allocation.width; - area.height = widget->allocation.height; - gtk_clist_draw(widget, &area); } static gint diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index a60a924496..9c92c127e5 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -1811,7 +1811,7 @@ draw_row (GtkCList *clist, default: gdk_draw_rectangle (clist->clist_window, - GTK_WIDGET (clist)->style->fg_gc[GTK_STATE_SELECTED], + GTK_WIDGET (clist)->style->base_gc[GTK_STATE_NORMAL], TRUE, xdest + xoffset, clip_rectangle.y + yoffset, @@ -2078,13 +2078,13 @@ draw_row (GtkCList *clist, if (clist_row->fg_set) tgc = clist->fg_gc; else - tgc = widget->style->fg_gc[GTK_STATE_NORMAL]; + tgc = widget->style->text_gc[GTK_STATE_NORMAL]; cgc = tgc; } else { cgc = - GTK_WIDGET(clist)->style->fg_gc[GTK_STATE_SELECTED]; + GTK_WIDGET(clist)->style->base_gc[GTK_STATE_NORMAL]; tgc = fg_gc; } diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index ae46a4fe7d..3f7d05e471 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2271,7 +2271,8 @@ gtk_notebook_draw_tab (GtkNotebook *notebook, g_return_if_fail (page != NULL); g_return_if_fail (area != NULL); - if (!GTK_WIDGET_MAPPED (page->tab_label)) + if (!GTK_WIDGET_MAPPED (page->tab_label) || + (page->allocation.width == 0) || (page->allocation.height == 0)) return; page_area.x = page->allocation.x; diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 650220280a..09b112df23 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -201,13 +201,13 @@ gtk_rc_get_theme_dir(void) var = getenv("GTK_DATA_PREFIX"); if (var) { - path = g_malloc(strlen(var) + strlen("/share/gtk/themes") +1); - sprintf(path, "%s%s", var, "/share/gtk/themes"); + path = g_malloc(strlen(var) + strlen("/share/themes") +1); + sprintf(path, "%s%s", var, "/share/themes"); } else { - path = g_malloc(strlen(GTK_DATA_PREFIX) + strlen("/share/gtk/themes") +1); - sprintf(path, "%s%s", GTK_DATA_PREFIX, "/share/gtk/themes"); + path = g_malloc(strlen(GTK_DATA_PREFIX) + strlen("/share/themes") +1); + sprintf(path, "%s%s", GTK_DATA_PREFIX, "/share/themes"); } return path; } @@ -442,7 +442,10 @@ gtk_rc_style_unref (GtkRcStyle *rc_style) if (rc_style->ref_count == 0) { if (rc_style->engine) - rc_style->engine->destroy_rc_style (rc_style); + { + rc_style->engine->destroy_rc_style (rc_style); + gtk_theme_engine_unref (rc_style->engine); + } if (rc_style->name) g_free (rc_style->name); @@ -495,13 +498,19 @@ gtk_rc_clear_styles (void) { /* Clear out all old rc_styles */ - g_hash_table_foreach (rc_style_ht, gtk_rc_clear_hash_node, NULL); - g_hash_table_destroy (rc_style_ht); - rc_style_ht = NULL; + if (rc_style_ht) + { + g_hash_table_foreach (rc_style_ht, gtk_rc_clear_hash_node, NULL); + g_hash_table_destroy (rc_style_ht); + rc_style_ht = NULL; + } - g_hash_table_foreach (realized_style_ht, gtk_rc_clear_realized_node, NULL); - g_hash_table_destroy (realized_style_ht); - realized_style_ht = NULL; + if (realized_style_ht) + { + g_hash_table_foreach (realized_style_ht, gtk_rc_clear_realized_node, NULL); + g_hash_table_destroy (realized_style_ht); + realized_style_ht = NULL; + } gtk_rc_free_rc_sets (gtk_rc_sets_widget); g_slist_free (gtk_rc_sets_widget); @@ -890,6 +899,7 @@ gtk_rc_style_to_style (GtkRcStyle *rc_style) if (rc_style->engine) { style->engine = rc_style->engine; + gtk_theme_engine_ref (style->engine); rc_style->engine->rc_style_to_style (style, rc_style); } @@ -924,7 +934,7 @@ gtk_rc_style_init (GSList *rc_styles) for (i=0; i<5; i++) { if (!proto_style->bg_pixmap_name[i] && rc_style->bg_pixmap_name[i]) - proto_style->bg_pixmap_name[i] = rc_style->bg_pixmap_name[i]; + proto_style->bg_pixmap_name[i] = g_strdup (rc_style->bg_pixmap_name[i]); if (!(proto_style->color_flags[i] & GTK_RC_FG) && rc_style->color_flags[i] & GTK_RC_FG) @@ -958,7 +968,10 @@ gtk_rc_style_init (GSList *rc_styles) proto_style->fontset_name = g_strdup (rc_style->fontset_name); if (!proto_style->engine && rc_style->engine) - proto_style->engine = rc_style->engine; + { + proto_style->engine = rc_style->engine; + gtk_theme_engine_ref (proto_style->engine); + } if (proto_style->engine && (proto_style->engine == rc_style->engine)) diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 81485424a4..16f7c2e098 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -728,7 +728,10 @@ gtk_style_destroy (GtkStyle *style) } if (style->engine) - style->engine->destroy_style (style); + { + style->engine->destroy_style (style); + gtk_theme_engine_unref (style->engine); + } gdk_font_unref (style->font); if (style->rc_style) @@ -745,7 +748,7 @@ gtk_style_set_background (GtkStyle *style, GdkPixmap *pixmap; gint parent_relative; - if (style->engine) + if (style->engine && style->engine->set_background) { (*style->engine->set_background) (style, window, state_type); return; diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8da5823ffe..4272967536 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2537,9 +2537,13 @@ gtk_widget_event (GtkWidget *widget, signal_num = CLIENT_EVENT; break; case GDK_EXPOSE: - /* there is no sense in providing a widget with bogus expose events + /* there is no sense in providing a widget with bogus expose events. + * Widgets that are going to be resized don't need to be + * exposed, since they will be redrawn anyways. */ - if (!event->any.window) + if (!event->any.window || + GTK_WIDGET_RESIZE_NEEDED (widget) || + (widget->parent && GTK_WIDGET_RESIZE_NEEDED (widget->parent))) { gtk_widget_unref (widget); return TRUE; diff --git a/gtk/testgtkrc b/gtk/testgtkrc index 7c20f5f153..6ae6080d86 100644 --- a/gtk/testgtkrc +++ b/gtk/testgtkrc @@ -10,7 +10,7 @@ # widget style # widget_class style -#include "/opt/themes/share/gtk/themes/metal/gtkrc" +#include "/opt/themes/share/themes/Motif/gtk/gtkrc" binding "test1" { @@ -31,7 +31,7 @@ binding "test2" # lowest # gtk (used by gtk for internal class bindings) # application (for hard coded bindings on application basis) -# rc (used implicitel by rc files) +# rc (used implicitly by rc files) # highest class "GtkButton" binding "test1" # implicit : rc class "GtkButton" binding : highest "test2" # override "rc" priority diff --git a/tests/testgtkrc b/tests/testgtkrc index 7c20f5f153..6ae6080d86 100644 --- a/tests/testgtkrc +++ b/tests/testgtkrc @@ -10,7 +10,7 @@ # widget style # widget_class style -#include "/opt/themes/share/gtk/themes/metal/gtkrc" +#include "/opt/themes/share/themes/Motif/gtk/gtkrc" binding "test1" { @@ -31,7 +31,7 @@ binding "test2" # lowest # gtk (used by gtk for internal class bindings) # application (for hard coded bindings on application basis) -# rc (used implicitel by rc files) +# rc (used implicitly by rc files) # highest class "GtkButton" binding "test1" # implicit : rc class "GtkButton" binding : highest "test2" # override "rc" priority