On Hën , 2003-12-22 at 09:42, JP Rosevear wrote: > On Sun, 2003-12-07 at 17:30, Rodney Dawes wrote: > > Oops, forgot to mention, this is for both HEAD and 1.4. It is > > broken in both places. > > > > -- dobey > > > > On Die , 2003-12-07 at 17:24, Rodney Dawes wrote: > > > The following patch fixes EComboButton to fix bug #46349 by > > > fixing the paint calls to do essentially the same things that > > > GtkButton does, so that the widget looks correct in all themes, > > > for all the states and relief types. > > Seems ok, although I don't understand why you commented out two > existing lines of code. Doh. They should have just been deleted. I commented them out when making the patch so as to not lose the code if I needed it, and as a reference. But the code isn't needed and I didn't catch the comments when I made the patch. -- dobey
Index: e-combo-button.c =================================================================== RCS file: /cvs/gnome/evolution/widgets/misc/e-combo-button.c,v retrieving revision 1.14 diff -u -r1.14 e-combo-button.c --- e-combo-button.c 23 Jul 2003 13:49:30 -0000 1.14 +++ e-combo-button.c 22 Dec 2003 16:11:24 -0000 @@ -137,51 +137,83 @@ GdkRectangle *area) { EComboButtonPrivate *priv = combo_button->priv; + GtkWidget *widget = GTK_WIDGET (combo_button); GtkShadowType shadow_type; + gboolean interior_focus; int separator_x; + int focus_width, focus_pad; + int x, y, width, height; + int border_width; - gdk_window_set_back_pixmap (GTK_WIDGET (combo_button)->window, NULL, TRUE); - gdk_window_clear_area (GTK_WIDGET (combo_button)->window, - area->x, area->y, - area->width, area->height); - - /* Only paint the outline if we are in prelight state. */ - if (GTK_WIDGET_STATE (combo_button) != GTK_STATE_PRELIGHT - && GTK_WIDGET_STATE (combo_button) != GTK_STATE_ACTIVE) - return; + if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) + shadow_type = GTK_SHADOW_IN; + else if (GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE + && GTK_WIDGET_STATE (widget) != GTK_STATE_PRELIGHT) + shadow_type = GTK_SHADOW_NONE; + else + shadow_type = GTK_SHADOW_OUT; + + border_width = GTK_CONTAINER (widget)->border_width; + + x = widget->allocation.x + border_width; + y = widget->allocation.y + border_width; + width = widget->allocation.width - border_width * 2; + height = widget->allocation.height - border_width * 2; separator_x = (priv->label->allocation.width + priv->label->allocation.x + priv->arrow_pixmap->allocation.x) / 2; - if (GTK_WIDGET_STATE (combo_button) == GTK_STATE_ACTIVE) - shadow_type = GTK_SHADOW_IN; - else - shadow_type = GTK_SHADOW_OUT; + gtk_widget_style_get (GTK_WIDGET (widget), + "focus-line-width", &focus_width, + "focus-padding", &focus_pad, + "interior-focus", &interior_focus, + NULL); + + if (GTK_WIDGET_HAS_DEFAULT (widget) + && GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL) + gtk_paint_box (widget->style, widget->window, + GTK_STATE_NORMAL, GTK_SHADOW_IN, + area, widget, "buttondefault", + x, y, width, height); + + if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget)) { + x += focus_width + focus_pad; + y += focus_width + focus_pad; + width -= 2 * (focus_width + focus_pad); + height -= 2 * (focus_width + focus_pad); + } + + if (GTK_WIDGET_STATE (widget) != GTK_STATE_ACTIVE + || GTK_BUTTON (widget)->depressed) { + gtk_paint_box (widget->style, widget->window, + GTK_WIDGET_STATE (widget), shadow_type, + area, widget, "button", + x, y, separator_x, height); + gtk_paint_box (widget->style, widget->window, + GTK_WIDGET_STATE (widget), shadow_type, + area, widget, "button", + separator_x, y, width - separator_x, height); + } - gtk_paint_box (GTK_WIDGET (combo_button)->style, - GTK_WIDGET (combo_button)->window, - GTK_STATE_PRELIGHT, - shadow_type, - area, - GTK_WIDGET (combo_button), - "button", - 0, - 0, - separator_x, - GTK_WIDGET (combo_button)->allocation.height); - - gtk_paint_box (GTK_WIDGET (combo_button)->style, - GTK_WIDGET (combo_button)->window, - GTK_STATE_PRELIGHT, - shadow_type, - area, - GTK_WIDGET (combo_button), - "button", - separator_x, - 0, - GTK_WIDGET (combo_button)->allocation.width - separator_x, - GTK_WIDGET (combo_button)->allocation.height); + if (GTK_WIDGET_HAS_FOCUS (widget)) { + if (interior_focus) { + x += widget->style->xthickness + focus_pad; + y += widget->style->ythickness + focus_pad; + width -= 2 * (widget->style->xthickness + focus_pad); + height -= 2 * (widget->style->xthickness + focus_pad); + } else { + x -= focus_width + focus_pad; + y -= focus_width + focus_pad; + width += 2 * (focus_width + focus_pad); + height += 2 * (focus_width + focus_pad); + } + + gtk_paint_focus (widget->style, widget->window, + GTK_WIDGET_STATE (widget), + area, widget, "button", + x, y, width, height); + } }
Attachment:
signature.asc
Description: This is a digitally signed message part