From d1e07dbee875ad7fecf69fd0d7abdd1756abfc63 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Thu, 12 Nov 1998 23:38:42 +0000 Subject: [PATCH] cast NULL to GtkItemFactoryCallback to ensure proper type (SunPro cc * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to ensure proper type (SunPro cc complains) * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" * gtk/gtktogglebutton.c: use our own draw method so we get proper redraws on active state -Yosh --- ChangeLog | 10 +++++++ ChangeLog.pre-2-0 | 10 +++++++ ChangeLog.pre-2-10 | 10 +++++++ ChangeLog.pre-2-2 | 10 +++++++ ChangeLog.pre-2-4 | 10 +++++++ ChangeLog.pre-2-6 | 10 +++++++ ChangeLog.pre-2-8 | 10 +++++++ gtk/gtkitemfactory.c | 3 +- gtk/gtklist.c | 2 +- gtk/gtktogglebutton.c | 69 +++++++++++++++++++++++++++++++++++-------- 10 files changed, 129 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f60549f9a4..5e66147d72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f60549f9a4..5e66147d72 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Thu Nov 12 15:33:54 PST 1998 Manish Singh + + * gtk/gtkitemfactory.c: cast NULL to GtkItemFactoryCallback to + ensure proper type (SunPro cc complains) + + * gtk/gtklist.c: removed bogus '*' from "*GTK_CONTAINER_CLASS" + + * gtk/gtktogglebutton.c: use our own draw method so we get proper + redraws on active state + Thu Nov 12 00:26:13 1998 Lars Hamann * gtk/gtkstyle.c (gtk_default_draw_box_gap): use GtkPositionType diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c index 8639cb46a8..60377a4b23 100644 --- a/gtk/gtkitemfactory.c +++ b/gtk/gtkitemfactory.c @@ -1108,7 +1108,8 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory, gtk_item_factory_add_item (ifactory, path, entry->accelerator, (type_id == quark_type_branch || - type_id == quark_type_last_branch) ? NULL : entry->callback, + type_id == quark_type_last_branch) ? + (GtkItemFactoryCallback) NULL : entry->callback, entry->callback_action, callback_data, callback_type, item_type_path, diff --git a/gtk/gtklist.c b/gtk/gtklist.c index a0318615b9..8795dbb156 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -946,7 +946,7 @@ gtk_list_focus (GtkContainer *container, else if (container->focus_child == NULL || !GTK_WIDGET_HAS_FOCUS (container->focus_child)) { - if (*GTK_CONTAINER_CLASS (parent_class)->focus) + if (GTK_CONTAINER_CLASS (parent_class)->focus) return_val = GTK_CONTAINER_CLASS (parent_class)->focus (container, direction); } diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index cd8e6e04e2..1ac4f00513 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -40,7 +40,10 @@ enum { static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass); static void gtk_toggle_button_init (GtkToggleButton *toggle_button); -static void gtk_toggle_button_draw_focus (GtkWidget *widget); +static void gtk_toggle_button_paint (GtkWidget *widget, + GdkRectangle *area); +static void gtk_toggle_button_draw (GtkWidget *widget, + GdkRectangle *area); static void gtk_toggle_button_pressed (GtkButton *button); static void gtk_toggle_button_released (GtkButton *button); static void gtk_toggle_button_clicked (GtkButton *button); @@ -115,7 +118,7 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) object_class->set_arg = gtk_toggle_button_set_arg; object_class->get_arg = gtk_toggle_button_get_arg; - widget_class->draw_focus = gtk_toggle_button_draw_focus; + widget_class->draw = gtk_toggle_button_draw; widget_class->realize = gtk_toggle_button_realize; widget_class->unrealize = gtk_toggle_button_unrealize; @@ -248,7 +251,8 @@ gtk_toggle_button_toggled (GtkToggleButton *toggle_button) static void -gtk_toggle_button_draw_focus (GtkWidget *widget) +gtk_toggle_button_paint (GtkWidget *widget, + GdkRectangle *area) { GtkButton *button; GtkToggleButton *toggle_button; @@ -256,9 +260,6 @@ gtk_toggle_button_draw_focus (GtkWidget *widget) gint width, height; gint x, y; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); - if (GTK_WIDGET_DRAWABLE (widget)) { button = GTK_BUTTON (widget); @@ -269,6 +270,18 @@ gtk_toggle_button_draw_focus (GtkWidget *widget) width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2; height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2; + gdk_window_set_back_pixmap (widget->window, NULL, TRUE); + gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height); + + 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, "togglebuttondefault", + x, y, width, height); + } + if (GTK_WIDGET_CAN_DEFAULT (widget)) { x += widget->style->klass->xthickness; @@ -287,15 +300,19 @@ gtk_toggle_button_draw_focus (GtkWidget *widget) height -= 2; } - if (toggle_button->active) + if ((GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) || + toggle_button->active) shadow_type = GTK_SHADOW_IN; else shadow_type = GTK_SHADOW_OUT; - gtk_paint_box (widget->style, widget->window, - GTK_WIDGET_STATE (widget), shadow_type, - NULL, widget, "togglebutton", - x, y, width, height); + if ((button->relief != GTK_RELIEF_NONE) || + ((GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL) && + (GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE))) + gtk_paint_box (widget->style, widget->window, + GTK_WIDGET_STATE (widget), + shadow_type, area, widget, "togglebutton", + x, y, width, height); if (GTK_WIDGET_HAS_FOCUS (widget)) { @@ -305,10 +322,36 @@ gtk_toggle_button_draw_focus (GtkWidget *widget) height += 2; gtk_paint_focus (widget->style, widget->window, - NULL, widget, "togglebutton", + area, widget, "togglebutton", x, y, width - 1, height - 1); } - gtk_widget_draw (GTK_BIN (widget)->child, NULL); + } +} + +static void +gtk_toggle_button_draw (GtkWidget *widget, + GdkRectangle *area) +{ + GtkButton *button; + GdkRectangle child_area; + GdkRectangle tmp_area; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); + g_return_if_fail (area != NULL); + + if (GTK_WIDGET_DRAWABLE (widget)) + { + button = GTK_BUTTON (widget); + + tmp_area = *area; + tmp_area.x -= GTK_CONTAINER (button)->border_width; + tmp_area.y -= GTK_CONTAINER (button)->border_width; + + gtk_toggle_button_paint (widget, &tmp_area); + + if (GTK_BIN (button)->child && gtk_widget_intersect (GTK_BIN (button)->child, &tmp_area, &child_area)) + gtk_widget_draw (GTK_BIN (button)->child, &child_area); } }