diff options
author | Havoc Pennington <hp@pobox.com> | 2000-12-04 01:15:37 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-12-04 01:15:37 +0000 |
commit | 5995baabef8988cbb5d6f9f01d8731f069f79524 (patch) | |
tree | a54cf207dca23815ff7698256a47b4986801c37e /gtk | |
parent | b18bb07b2d825d3788ab30f955a2fe2c6ad2915a (diff) | |
download | gtk+-5995baabef8988cbb5d6f9f01d8731f069f79524.tar.gz |
Remove "draw" virtual method and signal
2000-12-02 Havoc Pennington <hp@pobox.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove "draw" virtual
method and signal
* gtk/gtkwidget.c (gtk_widget_draw): Now just queues a draw then
calls gdk_window_process_updates() to push the exposes through
(gtk_widget_class_init): No more draw signal, no
gtk_widget_real_draw()
* gtk/gtkbin.c (gtk_bin_draw): remove
* gtk/gtkbox.c (gtk_box_draw): remove
* gtk/gtkbutton.c (gtk_button_draw): remove
* gtk/gtkcalendar.c (gtk_calendar_draw): remove
* gtk/gtkcheckbutton.c (gtk_check_button_draw): remove
* gtk/gtkcheckmenuitem.c (gtk_check_menu_item_draw): remove
* gtk/gtkclist.c (gtk_clist_draw): remove
* gtk/gtkentry.c (gtk_entry_draw): remove
* gtk/gtkeventbox.c (gtk_event_box_draw): remove
* gtk/gtkfixed.c (gtk_fixed_draw): remove
* gtk/gtkframe.c (gtk_frame_draw): remove
* gtk/gtkhandlebox.c (gtk_handle_box_draw): remove
* gtk/gtkhpaned.c (gtk_hpaned_draw): remove
* gtk/gtklayout.c (gtk_layout_draw): remove
* gtk/gtklist.c (gtk_list_draw): remove
* gtk/gtklistitem.c (gtk_list_item_draw): remove
* gtk/gtkmenu.c (gtk_menu_draw): remove
* gtk/gtkmenubar.c (gtk_menu_bar_draw): remove
* gtk/gtkmenuitem.c (gtk_menu_item_draw): remove
* gtk/gtknotebook.c (gtk_notebook_draw): remove
* gtk/gtkoptionmenu.c (gtk_option_menu_draw): remove
* gtk/gtkpacker.c (gtk_packer_draw): remove
* gtk/gtkrange.c (gtk_range_draw): remove
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_draw): remove
* gtk/gtkspinbutton.c (gtk_spin_button_draw): remove
* gtk/gtktable.c (gtk_table_draw): remove
* gtk/gtktearoffmenuitem.c (gtk_tearoff_menu_item_draw): remove
* gtk/gtktext.c (gtk_text_draw): remove
* gtk/gtktextview.c (gtk_text_view_draw): remove
* gtk/gtktogglebutton.c (gtk_toggle_button_draw): remove
* gtk/gtktoolbar.c (gtk_toolbar_draw): remove
* gtk/gtktree.c (gtk_tree_draw): remove
* gtk/gtktreeitem.c (gtk_tree_item_draw): remove
* gtk/gtktreeview.c (gtk_tree_view_draw): remove
* gtk/gtkviewport.c (gtk_viewport_draw): remove
* gtk/gtkvpaned.c (gtk_vpaned_draw): remove
* gtk/gtkvscale.c (gtk_vscale_draw): remove
* gtk/gtkwindow.c (gtk_window_draw): remove
Diffstat (limited to 'gtk')
41 files changed, 27 insertions, 1439 deletions
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c index b65b8706ea..8d3e924622 100644 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@ -31,8 +31,6 @@ static void gtk_bin_class_init (GtkBinClass *klass); static void gtk_bin_init (GtkBin *bin); static void gtk_bin_map (GtkWidget *widget); static void gtk_bin_unmap (GtkWidget *widget); -static void gtk_bin_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_bin_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_bin_add (GtkContainer *container, @@ -89,7 +87,6 @@ gtk_bin_class_init (GtkBinClass *class) widget_class->map = gtk_bin_map; widget_class->unmap = gtk_bin_unmap; - widget_class->draw = gtk_bin_draw; widget_class->expose_event = gtk_bin_expose; container_class->add = gtk_bin_add; @@ -154,26 +151,6 @@ gtk_bin_unmap (GtkWidget *widget) gtk_widget_unmap (bin->child); } -static void -gtk_bin_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_BIN (widget)); - - bin = GTK_BIN (widget); - - if (GTK_WIDGET_DRAWABLE (bin)) - { - if (bin->child && GTK_WIDGET_DRAWABLE (bin->child) && - gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } -} - static gint gtk_bin_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 2aed1be88b..32ab748c14 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -51,8 +51,6 @@ static void gtk_box_set_arg (GtkObject *object, guint arg_id); static void gtk_box_map (GtkWidget *widget); static void gtk_box_unmap (GtkWidget *widget); -static void gtk_box_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_box_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_box_add (GtkContainer *container, @@ -128,7 +126,6 @@ gtk_box_class_init (GtkBoxClass *class) widget_class->map = gtk_box_map; widget_class->unmap = gtk_box_unmap; - widget_class->draw = gtk_box_draw; widget_class->expose_event = gtk_box_expose; container_class->add = gtk_box_add; @@ -632,35 +629,6 @@ gtk_box_unmap (GtkWidget *widget) } } -static void -gtk_box_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBox *box; - GtkBoxChild *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_BOX (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - box = GTK_BOX (widget); - - children = box->children; - while (children) - { - child = children->data; - children = children->next; - - if (GTK_WIDGET_DRAWABLE (child->widget) && - gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - } -} - static gint gtk_box_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 2898cc0db8..639edbca1a 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -72,8 +72,6 @@ static void gtk_button_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_button_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_button_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_button_draw_focus (GtkWidget *widget); static void gtk_button_draw_default (GtkWidget *widget); static gint gtk_button_expose (GtkWidget *widget, @@ -190,7 +188,6 @@ gtk_button_class_init (GtkButtonClass *klass) widget_class->activate_signal = button_signals[CLICKED]; widget_class->realize = gtk_button_realize; - widget_class->draw = gtk_button_draw; widget_class->draw_focus = gtk_button_draw_focus; widget_class->draw_default = gtk_button_draw_default; widget_class->size_request = gtk_button_size_request; @@ -695,33 +692,6 @@ gtk_button_paint (GtkWidget *widget, } static void -gtk_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_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_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); - } -} - -static void gtk_button_draw_focus (GtkWidget *widget) { gtk_widget_draw (widget, NULL); diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 0a5b283ea8..cde5e8cf67 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -307,8 +307,6 @@ static void gtk_calendar_paint_day_num (GtkWidget *widget, static void gtk_calendar_paint_day (GtkWidget *widget, gint row, gint col); -static void gtk_calendar_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_calendar_compute_days (GtkCalendar *calendar); static gint left_x_for_column (GtkCalendar *calendar, gint column); @@ -358,7 +356,6 @@ gtk_calendar_class_init (GtkCalendarClass *class) widget_class->realize = gtk_calendar_realize; widget_class->unrealize = gtk_calendar_unrealize; widget_class->expose_event = gtk_calendar_expose; - widget_class->draw = gtk_calendar_draw; widget_class->draw_focus = gtk_calendar_draw_focus; widget_class->size_request = gtk_calendar_size_request; widget_class->size_allocate = gtk_calendar_size_allocate; @@ -1495,19 +1492,6 @@ gtk_calendar_expose (GtkWidget *widget, } static void -gtk_calendar_draw (GtkWidget *widget, - GdkRectangle *area) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_CALENDAR (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - gtk_calendar_paint (widget, area); - -} - -static void gtk_calendar_paint (GtkWidget *widget, GdkRectangle *area) { diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 219060ae79..681082d7ec 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -34,8 +34,6 @@ static void gtk_check_button_class_init (GtkCheckButtonClass *klass); static void gtk_check_button_init (GtkCheckButton *check_button); -static void gtk_check_button_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_check_button_draw_focus (GtkWidget *widget); static void gtk_check_button_size_request (GtkWidget *widget, GtkRequisition *requisition); @@ -86,7 +84,6 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) widget_class = (GtkWidgetClass*) class; parent_class = gtk_type_class (gtk_toggle_button_get_type ()); - widget_class->draw = gtk_check_button_draw; widget_class->draw_focus = gtk_check_button_draw_focus; widget_class->size_request = gtk_check_button_size_request; widget_class->size_allocate = gtk_check_button_size_allocate; @@ -160,40 +157,6 @@ gtk_check_button_paint (GtkWidget *widget, } static void -gtk_check_button_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkCheckButton *check_button; - GtkToggleButton *toggle_button; - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_CHECK_BUTTON (widget)); - g_return_if_fail (area != NULL); - - check_button = GTK_CHECK_BUTTON (widget); - toggle_button = GTK_TOGGLE_BUTTON (widget); - bin = GTK_BIN (widget); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - if (toggle_button->draw_indicator) - { - gtk_check_button_paint (widget, area); - - if (bin->child && gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } - else - { - if (GTK_WIDGET_CLASS (parent_class)->draw) - (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area); - } - } -} - -static void gtk_check_button_draw_focus (GtkWidget *widget) { gint border_width; diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index cf6a517e88..5c4560fde4 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -38,8 +38,6 @@ enum { static void gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass); static void gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item); -static void gtk_check_menu_item_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_check_menu_item_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_check_menu_item_activate (GtkMenuItem *menu_item); @@ -93,7 +91,6 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM); - widget_class->draw = gtk_check_menu_item_draw; widget_class->expose_event = gtk_check_menu_item_expose; menu_item_class->activate = gtk_check_menu_item_activate; @@ -182,20 +179,6 @@ gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item) check_menu_item->always_show_toggle = FALSE; } -static void -gtk_check_menu_item_draw (GtkWidget *widget, - GdkRectangle *area) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_CLASS (parent_class)->draw) - (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area); - - gtk_check_menu_item_draw_indicator (GTK_CHECK_MENU_ITEM (widget), area); -} - static gint gtk_check_menu_item_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 4519ac87b0..8af4a01eba 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -196,8 +196,6 @@ static void gtk_clist_realize (GtkWidget *widget); static void gtk_clist_unrealize (GtkWidget *widget); static void gtk_clist_map (GtkWidget *widget); static void gtk_clist_unmap (GtkWidget *widget); -static void gtk_clist_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_clist_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_clist_key_press (GtkWidget *widget, @@ -671,7 +669,6 @@ gtk_clist_class_init (GtkCListClass *klass) widget_class->unrealize = gtk_clist_unrealize; widget_class->map = gtk_clist_map; widget_class->unmap = gtk_clist_unmap; - widget_class->draw = gtk_clist_draw; widget_class->button_press_event = gtk_clist_button_press; widget_class->button_release_event = gtk_clist_button_release; widget_class->motion_notify_event = gtk_clist_motion; @@ -4425,7 +4422,6 @@ gtk_clist_finalize (GObject *object) * gtk_clist_unrealize * gtk_clist_map * gtk_clist_unmap - * gtk_clist_draw * gtk_clist_expose * gtk_clist_style_set * gtk_clist_key_press @@ -4767,53 +4763,6 @@ gtk_clist_unmap (GtkWidget *widget) } } -static void -gtk_clist_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkCList *clist; - gint border_width; - GdkRectangle child_area; - int i; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_CLIST (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - clist = GTK_CLIST (widget); - border_width = GTK_CONTAINER (widget)->border_width; - - gdk_window_clear_area (widget->window, - area->x - border_width, - area->y - border_width, - area->width, area->height); - - /* draw list shadow/border */ - gtk_draw_shadow (widget->style, widget->window, - GTK_STATE_NORMAL, clist->shadow_type, - 0, 0, - clist->clist_window_width + - (2 * widget->style->xthickness), - clist->clist_window_height + - (2 * widget->style->ythickness) + - clist->column_title_area.height); - - gdk_window_clear_area (clist->clist_window, 0, 0, 0, 0); - draw_rows (clist, NULL); - - for (i = 0; i < clist->columns; i++) - { - if (!clist->column[i].visible) - continue; - if (clist->column[i].button && - gtk_widget_intersect(clist->column[i].button, area, &child_area)) - gtk_widget_draw (clist->column[i].button, &child_area); - } - } -} - static gint gtk_clist_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 45c7f05927..5256278144 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -97,8 +97,6 @@ static void gtk_entry_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_entry_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_entry_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_entry_draw_focus (GtkWidget *widget); static gint gtk_entry_expose (GtkWidget *widget, GdkEventExpose *event); @@ -521,7 +519,6 @@ gtk_entry_class_init (GtkEntryClass *class) widget_class->draw_focus = gtk_entry_draw_focus; widget_class->size_request = gtk_entry_size_request; widget_class->size_allocate = gtk_entry_size_allocate; - widget_class->draw = gtk_entry_draw; widget_class->expose_event = gtk_entry_expose; widget_class->button_press_event = gtk_entry_button_press; widget_class->button_release_event = gtk_entry_button_release; @@ -836,33 +833,6 @@ gtk_entry_size_allocate (GtkWidget *widget, } static void -gtk_entry_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkEntry *entry; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_ENTRY (widget)); - g_return_if_fail (area != NULL); - - entry = GTK_ENTRY (widget); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - GdkRectangle tmp_area = *area; - - tmp_area.x -= widget->style->xthickness; - tmp_area.y -= widget->style->xthickness; - - gdk_window_begin_paint_rect (entry->text_area, &tmp_area); - gtk_widget_draw_focus (widget); - gtk_entry_draw_text (GTK_ENTRY (widget)); - gtk_entry_draw_cursor (GTK_ENTRY (widget)); - gdk_window_end_paint (entry->text_area); - } -} - -static void gtk_entry_draw_focus (GtkWidget *widget) { gint width, height; diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 8ca709b015..186f1cc75e 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -37,8 +37,6 @@ static void gtk_event_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_event_box_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_event_box_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_event_box_expose (GtkWidget *widget, GdkEventExpose *event); @@ -78,7 +76,6 @@ gtk_event_box_class_init (GtkEventBoxClass *class) widget_class->realize = gtk_event_box_realize; widget_class->size_request = gtk_event_box_size_request; widget_class->size_allocate = gtk_event_box_size_allocate; - widget_class->draw = gtk_event_box_draw; widget_class->expose_event = gtk_event_box_expose; } @@ -203,34 +200,6 @@ gtk_event_box_paint (GtkWidget *widget, 0, 0, -1, -1); } -static void -gtk_event_box_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin; - GdkRectangle tmp_area; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_EVENT_BOX (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - bin = GTK_BIN (widget); - tmp_area = *area; - tmp_area.x -= GTK_CONTAINER (widget)->border_width; - tmp_area.y -= GTK_CONTAINER (widget)->border_width; - - gtk_event_box_paint (widget, &tmp_area); - - if (bin->child) - { - if (gtk_widget_intersect (bin->child, &tmp_area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } - } -} - static gint gtk_event_box_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 423e9643d1..bf1af52853 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -37,8 +37,6 @@ static void gtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_fixed_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_fixed_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_fixed_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_fixed_add (GtkContainer *container, @@ -97,7 +95,6 @@ gtk_fixed_class_init (GtkFixedClass *class) widget_class->realize = gtk_fixed_realize; widget_class->size_request = gtk_fixed_size_request; widget_class->size_allocate = gtk_fixed_size_allocate; - widget_class->draw = gtk_fixed_draw; widget_class->expose_event = gtk_fixed_expose; container_class->add = gtk_fixed_add; @@ -352,35 +349,6 @@ gtk_fixed_paint (GtkWidget *widget, area->width, area->height); } -static void -gtk_fixed_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkFixed *fixed; - GtkFixedChild *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_FIXED (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - fixed = GTK_FIXED (widget); - gtk_fixed_paint (widget, area); - - children = fixed->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - } -} - static gint gtk_fixed_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index b562cf549e..61a2a74192 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -47,8 +47,6 @@ static void gtk_frame_get_arg (GtkObject *object, guint arg_id); static void gtk_frame_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_frame_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_frame_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_frame_size_request (GtkWidget *widget, @@ -124,7 +122,6 @@ gtk_frame_class_init (GtkFrameClass *class) object_class->set_arg = gtk_frame_set_arg; object_class->get_arg = gtk_frame_get_arg; - widget_class->draw = gtk_frame_draw; widget_class->expose_event = gtk_frame_expose; widget_class->size_request = gtk_frame_size_request; widget_class->size_allocate = gtk_frame_size_allocate; @@ -420,26 +417,6 @@ gtk_frame_paint (GtkWidget *widget, } } -static void -gtk_frame_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin = GTK_BIN (widget); - GtkFrame *frame = GTK_FRAME (widget); - GdkRectangle child_area; - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_frame_paint (widget, area); - - if (bin->child && gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - - if (frame->label_widget && gtk_widget_intersect (frame->label_widget, area, &child_area)) - gtk_widget_draw (frame->label_widget, &child_area); - } -} - static gboolean gtk_frame_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index e62230bcf8..a7ef0415d2 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -116,8 +116,6 @@ static void gtk_handle_box_draw_ghost (GtkHandleBox *hb); static void gtk_handle_box_paint (GtkWidget *widget, GdkEventExpose *event, GdkRectangle *area); -static void gtk_handle_box_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_handle_box_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_handle_box_button_changed (GtkWidget *widget, @@ -205,7 +203,6 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) widget_class->style_set = gtk_handle_box_style_set; widget_class->size_request = gtk_handle_box_size_request; widget_class->size_allocate = gtk_handle_box_size_allocate; - widget_class->draw = gtk_handle_box_draw; widget_class->expose_event = gtk_handle_box_expose; widget_class->button_press_event = gtk_handle_box_button_changed; widget_class->button_release_event = gtk_handle_box_button_changed; @@ -832,41 +829,6 @@ gtk_handle_box_paint (GtkWidget *widget, } } -static void -gtk_handle_box_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkHandleBox *hb; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - g_return_if_fail (area != NULL); - - hb = GTK_HANDLE_BOX (widget); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - if (hb->child_detached) - { - /* The area parameter does not make sense in this case, so we - * repaint everything. - */ - - gtk_handle_box_draw_ghost (hb); - - area->x = 0; - area->y = 0; - area->width = 2 * GTK_CONTAINER (hb)->border_width + DRAG_HANDLE_SIZE; - area->height = area->width + GTK_BIN (hb)->child->allocation.height; - area->width += GTK_BIN (hb)->child->allocation.width; - - gtk_handle_box_paint (widget, NULL, area); - } - else - gtk_handle_box_paint (widget, NULL, area); - } -} - static gint gtk_handle_box_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c index 8747a0c1f1..32fa276ce3 100644 --- a/gtk/gtkhpaned.c +++ b/gtk/gtkhpaned.c @@ -32,8 +32,6 @@ static void gtk_hpaned_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_hpaned_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_hpaned_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_hpaned_xor_line (GtkPaned *paned); static gboolean gtk_hpaned_button_press (GtkWidget *widget, GdkEventButton *event); @@ -76,7 +74,6 @@ gtk_hpaned_class_init (GtkHPanedClass *class) widget_class->size_request = gtk_hpaned_size_request; widget_class->size_allocate = gtk_hpaned_size_allocate; - widget_class->draw = gtk_hpaned_draw; widget_class->button_press_event = gtk_hpaned_button_press; widget_class->button_release_event = gtk_hpaned_button_release; widget_class->motion_notify_event = gtk_hpaned_motion; @@ -225,56 +222,6 @@ gtk_hpaned_size_allocate (GtkWidget *widget, } static void -gtk_hpaned_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkPaned *paned; - GdkRectangle handle_area, child_area; - guint16 border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_PANED (widget)); - - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) - { - paned = GTK_PANED (widget); - border_width = GTK_CONTAINER (paned)->border_width; - - gdk_window_clear_area (widget->window, - area->x, area->y, area->width, - area->height); - - handle_area.x = paned->handle_xpos; - handle_area.y = paned->handle_ypos; - handle_area.width = paned->handle_size; - handle_area.height = paned->handle_height; - - if (gdk_rectangle_intersect (&handle_area, area, &child_area)) - { - child_area.x -= paned->handle_xpos; - child_area.y -= paned->handle_ypos; - - gtk_paint_handle (widget->style, - paned->handle, - GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - &child_area, - widget, - "paned", - 0, 0, -1, -1, - GTK_ORIENTATION_VERTICAL); - - } - /* Redraw the children - */ - if (paned->child1 && gtk_widget_intersect (paned->child1, area, &child_area)) - gtk_widget_draw(paned->child1, &child_area); - if (paned->child2 && gtk_widget_intersect(paned->child2, area, &child_area)) - gtk_widget_draw(paned->child2, &child_area); - } -} - -static void gtk_hpaned_xor_line (GtkPaned *paned) { GtkWidget *widget; diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c index c8442fb70c..67ab9f4c75 100644 --- a/gtk/gtkhscale.c +++ b/gtk/gtkhscale.c @@ -62,8 +62,6 @@ static void gtk_hscale_pos_background (GtkHScale *hscale, gint *h); static void gtk_hscale_draw_slider (GtkRange *range); static void gtk_hscale_draw_value (GtkScale *scale); -static void gtk_hscale_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_hscale_trough_keys (GtkRange *range, GdkEventKey *key, GtkScrollType *scroll, @@ -119,7 +117,6 @@ gtk_hscale_class_init (GtkHScaleClass *class) widget_class->realize = gtk_hscale_realize; widget_class->size_request = gtk_hscale_size_request; widget_class->size_allocate = gtk_hscale_size_allocate; - widget_class->draw = gtk_hscale_draw; range_class->slider_update = gtk_range_default_hslider_update; range_class->trough_click = gtk_range_default_htrough_click; @@ -250,50 +247,6 @@ gtk_hscale_realize (GtkWidget *widget) gdk_window_show (range->slider); } -static void -gtk_hscale_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkRange *range; - GdkRectangle tmp_area; - GdkRectangle child_area; - gint x, y, width, height; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_RANGE (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) - { - range = GTK_RANGE (widget); - - gtk_hscale_pos_background (GTK_HSCALE (widget), &x, &y, &width, &height); - - tmp_area.x = x; - tmp_area.y = y; - tmp_area.width = width; - tmp_area.height = height; - - if (gdk_rectangle_intersect (area, &tmp_area, &child_area)) - gtk_range_draw_background (range); - - gtk_hscale_pos_trough (GTK_HSCALE (widget), &x, &y, &width, &height); - - tmp_area.x = x; - tmp_area.y = y; - tmp_area.width = width; - tmp_area.height = height; - - if (gdk_rectangle_intersect (area, &tmp_area, &child_area)) - { - gtk_range_draw_trough (range); - gtk_range_draw_slider (range); - gtk_range_draw_step_forw (range); - gtk_range_draw_step_back (range); - } - } -} - static void gtk_hscale_clear_background (GtkRange *range) { diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index b1b87ea0d0..4de204496b 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -53,8 +53,6 @@ static void gtk_layout_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_layout_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_layout_expose (GtkWidget *widget, GdkEventExpose *event); @@ -387,7 +385,6 @@ gtk_layout_class_init (GtkLayoutClass *class) widget_class->map = gtk_layout_map; widget_class->size_request = gtk_layout_size_request; widget_class->size_allocate = gtk_layout_size_allocate; - widget_class->draw = gtk_layout_draw; widget_class->expose_event = gtk_layout_expose; container_class->remove = gtk_layout_remove; @@ -606,36 +603,6 @@ gtk_layout_size_allocate (GtkWidget *widget, gtk_signal_emit_by_name (GTK_OBJECT (layout->vadjustment), "changed"); } -static void -gtk_layout_draw (GtkWidget *widget, GdkRectangle *area) -{ - GList *tmp_list; - GtkLayout *layout; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_LAYOUT (widget)); - - layout = GTK_LAYOUT (widget); - - /* We don't have any way of telling themes about this properly, - * so we just assume a background pixmap - */ - if (!GTK_WIDGET_APP_PAINTABLE (widget)) - gdk_window_clear_area (layout->bin_window, - area->x, area->y, area->width, area->height); - - tmp_list = layout->children; - while (tmp_list) - { - GtkLayoutChild *child = tmp_list->data; - tmp_list = tmp_list->next; - - if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } -} - static gint gtk_layout_expose (GtkWidget *widget, GdkEventExpose *event) { diff --git a/gtk/gtklist.c b/gtk/gtklist.c index 1043e147ff..ced05ccda1 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -66,8 +66,6 @@ static void gtk_list_map (GtkWidget *widget); static void gtk_list_unmap (GtkWidget *widget); static void gtk_list_style_set (GtkWidget *widget, GtkStyle *previous_style); -static void gtk_list_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_list_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_list_motion_notify (GtkWidget *widget, @@ -249,7 +247,6 @@ gtk_list_class_init (GtkListClass *class) widget_class->unmap = gtk_list_unmap; widget_class->style_set = gtk_list_style_set; widget_class->realize = gtk_list_realize; - widget_class->draw = gtk_list_draw; widget_class->expose_event = gtk_list_expose; widget_class->button_press_event = gtk_list_button_press; widget_class->button_release_event = gtk_list_button_release; @@ -838,35 +835,6 @@ gtk_list_button_release (GtkWidget *widget, return FALSE; } -static void -gtk_list_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkList *list; - GtkWidget *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_LIST (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - list = GTK_LIST (widget); - - children = list->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child, area, &child_area)) - gtk_widget_draw (child, &child_area); - } - } -} - static gint gtk_list_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index e4bf4a2ab9..3e40c0f8cf 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -56,8 +56,6 @@ static void gtk_list_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_list_item_style_set (GtkWidget *widget, GtkStyle *previous_style); -static void gtk_list_item_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_list_item_draw_focus (GtkWidget *widget); static gint gtk_list_item_button_press (GtkWidget *widget, GdkEventButton *event); @@ -193,7 +191,6 @@ gtk_list_item_class_init (GtkListItemClass *class) widget_class->size_request = gtk_list_item_size_request; widget_class->size_allocate = gtk_list_item_size_allocate; widget_class->style_set = gtk_list_item_style_set; - widget_class->draw = gtk_list_item_draw; widget_class->draw_focus = gtk_list_item_draw_focus; widget_class->button_press_event = gtk_list_item_button_press; widget_class->expose_event = gtk_list_item_expose; @@ -457,55 +454,6 @@ gtk_list_item_style_set (GtkWidget *widget, } static void -gtk_list_item_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_LIST_ITEM (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - bin = GTK_BIN (widget); - - if (widget->state == GTK_STATE_NORMAL) - { - gdk_window_set_back_pixmap (widget->window, NULL, TRUE); - gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height); - } - else - { - gtk_paint_flat_box(widget->style, widget->window, - widget->state, GTK_SHADOW_ETCHED_OUT, - area, widget, "listitem", - 0, 0, -1, -1); - } - - if (bin->child && gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - - if (GTK_WIDGET_HAS_FOCUS (widget)) - { - if (GTK_IS_LIST (widget->parent) && GTK_LIST (widget->parent)->add_mode) - gtk_paint_focus (widget->style, widget->window, - NULL, widget, "add-mode", - 0, 0, - widget->allocation.width - 1, - widget->allocation.height - 1); - else - gtk_paint_focus (widget->style, widget->window, - NULL, widget, NULL, - 0, 0, - widget->allocation.width - 1, - widget->allocation.height - 1); - } - } -} - -static void gtk_list_item_draw_focus (GtkWidget *widget) { g_return_if_fail (widget != NULL); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 7d3f2e879b..8056c4a8a7 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -68,8 +68,6 @@ static void gtk_menu_size_request (GtkWidget *widget, static void gtk_menu_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_menu_paint (GtkWidget *widget); -static void gtk_menu_draw (GtkWidget *widget, - GdkRectangle *area); static gboolean gtk_menu_expose (GtkWidget *widget, GdkEventExpose *event); static gboolean gtk_menu_key_press (GtkWidget *widget, @@ -162,7 +160,6 @@ gtk_menu_class_init (GtkMenuClass *class) widget_class->realize = gtk_menu_realize; widget_class->unrealize = gtk_menu_unrealize; - widget_class->draw = gtk_menu_draw; widget_class->size_request = gtk_menu_size_request; widget_class->size_allocate = gtk_menu_size_allocate; widget_class->expose_event = gtk_menu_expose; @@ -1337,37 +1334,6 @@ gtk_menu_paint (GtkWidget *widget) } } -static void -gtk_menu_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkMenuShell *menu_shell; - GtkWidget *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_MENU (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_menu_paint (widget); - - menu_shell = GTK_MENU_SHELL (widget); - - children = menu_shell->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child, area, &child_area)) - gtk_widget_draw (child, &child_area); - } - } -} - static gboolean gtk_menu_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index c50130ac17..3be496c728 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -54,8 +54,6 @@ static void gtk_menu_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_menu_bar_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_menu_bar_expose (GtkWidget *widget, GdkEventExpose *event); @@ -102,8 +100,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class) object_class->set_arg = gtk_menu_bar_set_arg; object_class->get_arg = gtk_menu_bar_get_arg; - - widget_class->draw = gtk_menu_bar_draw; + widget_class->size_request = gtk_menu_bar_size_request; widget_class->size_allocate = gtk_menu_bar_size_allocate; widget_class->expose_event = gtk_menu_bar_expose; @@ -369,37 +366,6 @@ gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area) } } -static void -gtk_menu_bar_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkMenuShell *menu_shell; - GtkWidget *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_MENU_BAR (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_menu_bar_paint (widget, area); - - menu_shell = GTK_MENU_SHELL (widget); - - children = menu_shell->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child, area, &child_area)) - gtk_widget_draw (child, &child_area); - } - } -} - static gint gtk_menu_bar_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index bb80966a18..7069af9c38 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -57,8 +57,6 @@ static void gtk_menu_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_menu_item_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_menu_item_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_menu_item_expose (GtkWidget *widget, GdkEventExpose *event); @@ -172,7 +170,6 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) widget_class->activate_signal = menu_item_signals[ACTIVATE]; widget_class->size_request = gtk_menu_item_size_request; widget_class->size_allocate = gtk_menu_item_size_allocate; - widget_class->draw = gtk_menu_item_draw; widget_class->expose_event = gtk_menu_item_expose; widget_class->show_all = gtk_menu_item_show_all; widget_class->hide_all = gtk_menu_item_hide_all; @@ -523,31 +520,6 @@ gtk_menu_item_paint (GtkWidget *widget, } } -static void -gtk_menu_item_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_MENU_ITEM (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_menu_item_paint (widget, area); - - bin = GTK_BIN (widget); - - if (bin->child) - { - if (gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } - } -} - static gint gtk_menu_item_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 0082272bb7..87010ec8b2 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -100,8 +100,6 @@ static void gtk_notebook_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_notebook_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_notebook_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_notebook_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_notebook_button_press (GtkWidget *widget, @@ -290,7 +288,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) widget_class->unrealize = gtk_notebook_unrealize; widget_class->size_request = gtk_notebook_size_request; widget_class->size_allocate = gtk_notebook_size_allocate; - widget_class->draw = gtk_notebook_draw; widget_class->expose_event = gtk_notebook_expose; widget_class->button_press_event = gtk_notebook_button_press; widget_class->button_release_event = gtk_notebook_button_release; @@ -471,7 +468,6 @@ gtk_notebook_get_arg (GtkObject *object, * gtk_notebook_realize * gtk_notebook_size_request * gtk_notebook_size_allocate - * gtk_notebook_draw * gtk_notebook_expose * gtk_notebook_button_press * gtk_notebook_button_release @@ -924,49 +920,6 @@ gtk_notebook_size_allocate (GtkWidget *widget, gtk_notebook_set_shape (notebook); } -static void -gtk_notebook_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkNotebook *notebook; - GdkRectangle child_area; - GdkRectangle draw_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_NOTEBOOK (widget)); - g_return_if_fail (area != NULL); - - notebook = GTK_NOTEBOOK (widget); - - draw_area = *area; - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gboolean have_visible_child; - - have_visible_child = notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child); - - if (have_visible_child != notebook->have_visible_child) - { - notebook->have_visible_child = have_visible_child; - draw_area.x = 0; - draw_area.y = 0; - draw_area.width = widget->allocation.width; - draw_area.height = widget->allocation.height; - } - - gtk_notebook_paint (widget, &draw_area); - - gtk_widget_draw_focus (widget); - - if (notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child) && - gtk_widget_intersect (notebook->cur_page->child, &draw_area, &child_area)) - gtk_widget_draw (notebook->cur_page->child, &child_area); - } - else - notebook->have_visible_child = FALSE; -} - static gint gtk_notebook_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index db1a4f4b6e..30e857dfa2 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -49,8 +49,6 @@ static void gtk_option_menu_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_option_menu_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_option_menu_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_option_menu_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_option_menu_button_press (GtkWidget *widget, @@ -117,8 +115,7 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class) parent_class = gtk_type_class (gtk_button_get_type ()); object_class->destroy = gtk_option_menu_destroy; - - widget_class->draw = gtk_option_menu_draw; + widget_class->size_request = gtk_option_menu_size_request; widget_class->size_allocate = gtk_option_menu_size_allocate; widget_class->expose_event = gtk_option_menu_expose; @@ -409,27 +406,6 @@ gtk_option_menu_paint (GtkWidget *widget, } } -static void -gtk_option_menu_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkWidget *child; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_OPTION_MENU (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_option_menu_paint (widget, area); - - child = GTK_BIN (widget)->child; - if (child && gtk_widget_intersect (child, area, &child_area)) - gtk_widget_draw (child, &child_area); - } -} - static gint gtk_option_menu_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c index f4e98362ac..3609bfeb4f 100644 --- a/gtk/gtkpacker.c +++ b/gtk/gtkpacker.c @@ -127,8 +127,6 @@ static void gtk_packer_class_init (GtkPackerClass *klass); static void gtk_packer_init (GtkPacker *packer); static void gtk_packer_map (GtkWidget *widget); static void gtk_packer_unmap (GtkWidget *widget); -static void gtk_packer_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_packer_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_packer_size_request (GtkWidget *widget, @@ -224,7 +222,6 @@ gtk_packer_class_init (GtkPackerClass *klass) widget_class->map = gtk_packer_map; widget_class->unmap = gtk_packer_unmap; - widget_class->draw = gtk_packer_draw; widget_class->expose_event = gtk_packer_expose; widget_class->size_request = gtk_packer_size_request; @@ -896,35 +893,6 @@ gtk_packer_unmap (GtkWidget *widget) } } -static void -gtk_packer_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkPacker *packer; - GtkPackerChild *child; - GdkRectangle child_area; - GList *children; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_PACKER (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - packer = GTK_PACKER (widget); - - children = g_list_first(packer->children); - while (children != NULL) - { - child = children->data; - children = g_list_next(children); - - if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - } - -} - static gint gtk_packer_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index d32e2c35be..54a2dd769e 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -49,8 +49,6 @@ static void gtk_range_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void gtk_range_destroy (GtkObject *object); -static void gtk_range_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_range_draw_focus (GtkWidget *widget); static void gtk_range_unrealize (GtkWidget *widget); static gint gtk_range_expose (GtkWidget *widget, @@ -140,7 +138,6 @@ gtk_range_class_init (GtkRangeClass *class) object_class->get_arg = gtk_range_get_arg; object_class->destroy = gtk_range_destroy; - widget_class->draw = gtk_range_draw; widget_class->draw_focus = gtk_range_draw_focus; widget_class->unrealize = gtk_range_unrealize; widget_class->expose_event = gtk_range_expose; @@ -756,28 +753,6 @@ gtk_range_destroy (GtkObject *object) } static void -gtk_range_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkRange *range; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_RANGE (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - range = GTK_RANGE (widget); - - gtk_range_draw_background (range); - gtk_range_draw_trough (range); - gtk_range_draw_slider (range); - gtk_range_draw_step_forw (range); - gtk_range_draw_step_back (range); - } -} - -static void gtk_range_draw_focus (GtkWidget *widget) { g_return_if_fail (widget != NULL); diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index b8e2f65a53..af5d485140 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -90,8 +90,6 @@ static void gtk_scrolled_window_destroy (GtkObject *obje static void gtk_scrolled_window_finalize (GObject *object); static void gtk_scrolled_window_map (GtkWidget *widget); static void gtk_scrolled_window_unmap (GtkWidget *widget); -static void gtk_scrolled_window_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_scrolled_window_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_scrolled_window_size_request (GtkWidget *widget, @@ -162,7 +160,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) widget_class->map = gtk_scrolled_window_map; widget_class->unmap = gtk_scrolled_window_unmap; - widget_class->draw = gtk_scrolled_window_draw; widget_class->expose_event = gtk_scrolled_window_expose; widget_class->size_request = gtk_scrolled_window_size_request; widget_class->size_allocate = gtk_scrolled_window_size_allocate; @@ -588,39 +585,6 @@ gtk_scrolled_window_paint (GtkWidget *widget, } } -static void -gtk_scrolled_window_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkScrolledWindow *scrolled_window; - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget)); - g_return_if_fail (area != NULL); - - scrolled_window = GTK_SCROLLED_WINDOW (widget); - bin = GTK_BIN (widget); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - gtk_scrolled_window_paint (widget, area); - - if (bin->child && GTK_WIDGET_VISIBLE (bin->child) && - gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - - if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar) && - gtk_widget_intersect (scrolled_window->hscrollbar, area, &child_area)) - gtk_widget_draw (scrolled_window->hscrollbar, &child_area); - - if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar) && - gtk_widget_intersect (scrolled_window->vscrollbar, area, &child_area)) - gtk_widget_draw (scrolled_window->vscrollbar, &child_area); - } -} - static gint gtk_scrolled_window_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 1c5a484939..ce9a5356f6 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -84,10 +84,6 @@ static void gtk_spin_button_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_spin_button_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_spin_button_paint (GtkWidget *widget, - GdkRectangle *area); -static void gtk_spin_button_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_spin_button_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_spin_button_button_press (GtkWidget *widget, @@ -180,7 +176,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) widget_class->unrealize = gtk_spin_button_unrealize; widget_class->size_request = gtk_spin_button_size_request; widget_class->size_allocate = gtk_spin_button_size_allocate; - widget_class->draw = gtk_spin_button_draw; widget_class->expose_event = gtk_spin_button_expose; widget_class->scroll_event = gtk_spin_button_scroll; widget_class->button_press_event = gtk_spin_button_button_press; @@ -541,60 +536,44 @@ gtk_spin_button_size_allocate (GtkWidget *widget, } } -static void -gtk_spin_button_paint (GtkWidget *widget, - GdkRectangle *area) +static gint +gtk_spin_button_expose (GtkWidget *widget, + GdkEventExpose *event) { GtkSpinButton *spin; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); spin = GTK_SPIN_BUTTON (widget); if (GTK_WIDGET_DRAWABLE (widget)) { + /* FIXME this seems like really broken code - + * why aren't we looking at event->window + * and acting accordingly? + */ + if (spin->shadow_type != GTK_SHADOW_NONE) gtk_paint_box (widget->style, spin->panel, GTK_STATE_NORMAL, spin->shadow_type, - area, widget, "spinbutton", + &event->area, widget, "spinbutton", 0, 0, ARROW_SIZE + 2 * widget->style->xthickness, widget->requisition.height); else { gdk_window_set_back_pixmap (spin->panel, NULL, TRUE); - gdk_window_clear_area (spin->panel, area->x, area->y, area->width, area->height); + gdk_window_clear_area (spin->panel, + event->area.x, event->area.y, + event->area.width, event->area.height); } gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP); gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN); - GTK_WIDGET_CLASS (parent_class)->draw (widget, area); + GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); } -} - -static void -gtk_spin_button_draw (GtkWidget *widget, - GdkRectangle *area) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - gtk_spin_button_paint (widget, area); -} - -static gint -gtk_spin_button_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (GTK_WIDGET_DRAWABLE (widget)) - gtk_spin_button_paint (widget, &event->area); return FALSE; } diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 7d0fd1f59e..e6644d92f1 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -55,8 +55,6 @@ static void gtk_table_init (GtkTable *table); static void gtk_table_finalize (GObject *object); static void gtk_table_map (GtkWidget *widget); static void gtk_table_unmap (GtkWidget *widget); -static void gtk_table_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_table_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_table_size_request (GtkWidget *widget, @@ -147,7 +145,6 @@ gtk_table_class_init (GtkTableClass *class) widget_class->map = gtk_table_map; widget_class->unmap = gtk_table_unmap; - widget_class->draw = gtk_table_draw; widget_class->expose_event = gtk_table_expose; widget_class->size_request = gtk_table_size_request; widget_class->size_allocate = gtk_table_size_allocate; @@ -718,34 +715,6 @@ gtk_table_unmap (GtkWidget *widget) } } -static void -gtk_table_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkTable *table; - GtkTableChild *child; - GList *children; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TABLE (widget)); - - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) - { - table = GTK_TABLE (widget); - - children = table->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - } -} - static gint gtk_table_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c index aa5d0b20aa..72061dd563 100644 --- a/gtk/gtktearoffmenuitem.c +++ b/gtk/gtktearoffmenuitem.c @@ -36,8 +36,6 @@ static void gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass); static void gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item); static void gtk_tearoff_menu_item_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void gtk_tearoff_menu_item_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_tearoff_menu_item_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item); @@ -86,7 +84,6 @@ gtk_tearoff_menu_item_class_init (GtkTearoffMenuItemClass *klass) widget_class = (GtkWidgetClass*) klass; menu_item_class = (GtkMenuItemClass*) klass; - widget_class->draw = gtk_tearoff_menu_item_draw; widget_class->expose_event = gtk_tearoff_menu_item_expose; widget_class->size_request = gtk_tearoff_menu_item_size_request; @@ -194,17 +191,6 @@ gtk_tearoff_menu_item_paint (GtkWidget *widget, } } -static void -gtk_tearoff_menu_item_draw (GtkWidget *widget, - GdkRectangle *area) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TEAROFF_MENU_ITEM (widget)); - g_return_if_fail (area != NULL); - - gtk_tearoff_menu_item_paint (widget, area); -} - static gint gtk_tearoff_menu_item_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 0e9c77ee23..e2f9f49ae5 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -239,8 +239,6 @@ static void gtk_text_real_set_editable (GtkOldEditable *old_editable, gboolean is_editable); /* Event handlers */ -static void gtk_text_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_text_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_text_button_press (GtkWidget *widget, @@ -557,7 +555,6 @@ gtk_text_class_init (GtkTextClass *class) widget_class->draw_focus = gtk_text_draw_focus; widget_class->size_request = gtk_text_size_request; widget_class->size_allocate = gtk_text_size_allocate; - widget_class->draw = gtk_text_draw; widget_class->expose_event = gtk_text_expose; widget_class->button_press_event = gtk_text_button_press; widget_class->button_release_event = gtk_text_button_release; @@ -1670,21 +1667,6 @@ gtk_text_size_allocate (GtkWidget *widget, } } -static void -gtk_text_draw (GtkWidget *widget, - GdkRectangle *area) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TEXT (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - expose_text (GTK_TEXT (widget), area, TRUE); - gtk_widget_draw_focus (widget); - } -} - static gint gtk_text_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 78ac46a6aa..c17b3ab0a9 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -114,8 +114,6 @@ static gint gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event); static gint gtk_text_view_motion_event (GtkWidget *widget, GdkEventMotion *event); -static void gtk_text_view_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_text_view_expose_event (GtkWidget *widget, GdkEventExpose *expose); static void gtk_text_view_draw_focus (GtkWidget *widget); @@ -656,7 +654,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass) widget_class->focus_out_event = gtk_text_view_focus_out_event; widget_class->motion_notify_event = gtk_text_view_motion_event; widget_class->expose_event = gtk_text_view_expose_event; - widget_class->draw = gtk_text_view_draw; widget_class->draw_focus = gtk_text_view_draw_focus; widget_class->drag_begin = gtk_text_view_drag_begin; @@ -2851,84 +2848,6 @@ gtk_text_view_paint (GtkWidget *widget, GdkRectangle *area) area->width, area->height); } -static void -send_expose (GtkTextView *text_view, - GtkTextWindow *win, - GdkRectangle *area) -{ - GdkEventExpose event; - - event.type = GDK_EXPOSE; - event.send_event = TRUE; - event.window = win->bin_window; - event.area = *area; - event.count = 0; - - /* Fix coordinates (convert widget coords to window coords) */ - gtk_text_view_window_to_buffer_coords (text_view, - GTK_TEXT_WINDOW_WIDGET, - event.area.x, - event.area.y, - &event.area.x, - &event.area.y); - - gtk_text_view_buffer_to_window_coords (text_view, - win->type, - event.area.x, - event.area.y, - &event.area.x, - &event.area.y); - - - gdk_window_ref (event.window); - gtk_widget_event (GTK_WIDGET (text_view), (GdkEvent*) &event); - gdk_window_unref (event.window); -} - -static void -gtk_text_view_draw (GtkWidget *widget, GdkRectangle *area) -{ - GdkRectangle intersection; - GtkTextView *text_view; - - text_view = GTK_TEXT_VIEW (widget); - - gtk_text_view_paint (widget, area); - - /* If the area overlaps the "edge" of the widget, draw the focus - * rectangle - */ - if (area->x < FOCUS_EDGE_WIDTH || - area->y < FOCUS_EDGE_WIDTH || - (area->x + area->width) > (widget->allocation.width - FOCUS_EDGE_WIDTH) || - (area->y + area->height) > (widget->allocation.height - FOCUS_EDGE_WIDTH)) - gtk_widget_draw_focus (widget); - - /* Synthesize expose events for the user-drawn border windows, - * just as we would for a drawing area. - */ - - if (text_view->left_window && - gdk_rectangle_intersect (area, &text_view->left_window->allocation, - &intersection)) - send_expose (text_view, text_view->left_window, &intersection); - - if (text_view->right_window && - gdk_rectangle_intersect (area, &text_view->right_window->allocation, - &intersection)) - send_expose (text_view, text_view->right_window, &intersection); - - if (text_view->top_window && - gdk_rectangle_intersect (area, &text_view->top_window->allocation, - &intersection)) - send_expose (text_view, text_view->top_window, &intersection); - - if (text_view->bottom_window && - gdk_rectangle_intersect (area, &text_view->bottom_window->allocation, - &intersection)) - send_expose (text_view, text_view->bottom_window, &intersection); -} - static gint gtk_text_view_expose_event (GtkWidget *widget, GdkEventExpose *event) { diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 951c3ee65c..d9fbee2b05 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -52,8 +52,6 @@ static void gtk_toggle_button_paint (GtkWidget *widget, GdkRectangle *area); static void gtk_toggle_button_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_toggle_button_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_toggle_button_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_toggle_button_pressed (GtkButton *button); @@ -133,7 +131,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) object_class->get_arg = gtk_toggle_button_get_arg; widget_class->size_allocate = gtk_toggle_button_size_allocate; - widget_class->draw = gtk_toggle_button_draw; widget_class->expose_event = gtk_toggle_button_expose; widget_class->realize = gtk_toggle_button_realize; widget_class->unrealize = gtk_toggle_button_unrealize; @@ -420,33 +417,6 @@ gtk_toggle_button_expose (GtkWidget *widget, } static void -gtk_toggle_button_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GdkRectangle child_area; - GdkRectangle tmp_area; - GtkBin *bin; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); - g_return_if_fail (area != NULL); - - bin = GTK_BIN (widget); - - if (GTK_WIDGET_DRAWABLE (widget) && !GTK_WIDGET_NO_WINDOW (widget)) - { - tmp_area = *area; - tmp_area.x -= GTK_CONTAINER (widget)->border_width; - tmp_area.y -= GTK_CONTAINER (widget)->border_width; - - gtk_toggle_button_paint (widget, &tmp_area); - - if (bin->child && gtk_widget_intersect (bin->child, &tmp_area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } -} - -static void gtk_toggle_button_pressed (GtkButton *button) { GtkToggleButton *toggle_button; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 24b4412f7c..de2dad8016 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -75,8 +75,6 @@ static void gtk_toolbar_get_arg (GtkObject *object, static void gtk_toolbar_destroy (GtkObject *object); static void gtk_toolbar_map (GtkWidget *widget); static void gtk_toolbar_unmap (GtkWidget *widget); -static void gtk_toolbar_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_toolbar_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_toolbar_size_request (GtkWidget *widget, @@ -165,7 +163,6 @@ gtk_toolbar_class_init (GtkToolbarClass *class) widget_class->map = gtk_toolbar_map; widget_class->unmap = gtk_toolbar_unmap; - widget_class->draw = gtk_toolbar_draw; widget_class->expose_event = gtk_toolbar_expose; widget_class->size_request = gtk_toolbar_size_request; widget_class->size_allocate = gtk_toolbar_size_allocate; @@ -405,37 +402,6 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, widget->style->ythickness) / 2); } -static void -gtk_toolbar_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkToolbar *toolbar; - GList *children; - GtkToolbarChild *child; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TOOLBAR (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - toolbar = GTK_TOOLBAR (widget); - - for (children = toolbar->children; children; children = children->next) - { - child = children->data; - - if (child->type == GTK_TOOLBAR_CHILD_SPACE) - { - if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE) - gtk_toolbar_paint_space_line (widget, area, child); - } - else if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - } -} - static gint gtk_toolbar_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtktree.c b/gtk/gtktree.c index bc17a19b60..c76d9da3ef 100644 --- a/gtk/gtktree.c +++ b/gtk/gtktree.c @@ -43,8 +43,6 @@ static void gtk_tree_destroy (GtkObject *object); static void gtk_tree_map (GtkWidget *widget); static void gtk_tree_unmap (GtkWidget *widget); static void gtk_tree_realize (GtkWidget *widget); -static void gtk_tree_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_tree_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_tree_motion_notify (GtkWidget *widget, @@ -143,7 +141,6 @@ gtk_tree_class_init (GtkTreeClass *class) widget_class->map = gtk_tree_map; widget_class->unmap = gtk_tree_unmap; widget_class->realize = gtk_tree_realize; - widget_class->draw = gtk_tree_draw; widget_class->expose_event = gtk_tree_expose; widget_class->motion_notify_event = gtk_tree_motion_notify; widget_class->button_press_event = gtk_tree_button_press; @@ -441,43 +438,6 @@ gtk_tree_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } -static void -gtk_tree_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkTree *tree; - GtkWidget *subtree; - GtkWidget *child; - GdkRectangle child_area; - GList *children; - - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TREE (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - tree = GTK_TREE (widget); - - children = tree->children; - while (children) - { - child = children->data; - children = children->next; - - if (gtk_widget_intersect (child, area, &child_area)) - gtk_widget_draw (child, &child_area); - - if((subtree = GTK_TREE_ITEM(child)->subtree) && - GTK_WIDGET_VISIBLE(subtree) && - gtk_widget_intersect (subtree, area, &child_area)) - gtk_widget_draw (subtree, &child_area); - } - } - -} - static gint gtk_tree_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 9ab2e75df4..6f62870e6d 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -64,8 +64,6 @@ static void gtk_tree_item_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_tree_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_tree_item_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_tree_item_draw_focus (GtkWidget *widget); static void gtk_tree_item_paint (GtkWidget *widget, GdkRectangle *area); @@ -164,7 +162,6 @@ gtk_tree_item_class_init (GtkTreeItemClass *class) widget_class->realize = gtk_tree_item_realize; widget_class->size_request = gtk_tree_item_size_request; widget_class->size_allocate = gtk_tree_item_size_allocate; - widget_class->draw = gtk_tree_item_draw; widget_class->draw_focus = gtk_tree_item_draw_focus; widget_class->button_press_event = gtk_tree_item_button_press; widget_class->expose_event = gtk_tree_item_expose; @@ -708,30 +705,6 @@ gtk_tree_item_paint (GtkWidget *widget, } static void -gtk_tree_item_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TREE_ITEM (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - bin = GTK_BIN (widget); - - gtk_tree_item_paint (widget, area); - - if (bin->child && - gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - - } -} - -static void gtk_tree_item_draw_focus (GtkWidget *widget) { g_return_if_fail (widget != NULL); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index f8ed23d770..1262e94808 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -61,8 +61,6 @@ static void gtk_tree_view_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_tree_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_tree_view_draw (GtkWidget *widget, - GdkRectangle *area); static gboolean gtk_tree_view_expose (GtkWidget *widget, GdkEventExpose *event); static gboolean gtk_tree_view_motion (GtkWidget *widget, @@ -203,7 +201,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) widget_class->map = gtk_tree_view_map; widget_class->size_request = gtk_tree_view_size_request; widget_class->size_allocate = gtk_tree_view_size_allocate; - widget_class->draw = gtk_tree_view_draw; widget_class->expose_event = gtk_tree_view_expose; widget_class->motion_notify_event = gtk_tree_view_motion; widget_class->enter_notify_event = gtk_tree_view_enter_notify; @@ -626,51 +623,6 @@ gtk_tree_view_size_allocate (GtkWidget *widget, gtk_tree_view_size_allocate_buttons (widget); } -static void -gtk_tree_view_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GList *tmp_list; - GtkTreeView *tree_view; - GtkTreeViewColumn *column; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TREE_VIEW (widget)); - - tree_view = GTK_TREE_VIEW (widget); - - /* We don't have any way of telling themes about this properly, - * so we just assume a background pixmap - */ - if (!GTK_WIDGET_APP_PAINTABLE (widget)) - { - gdk_window_clear_area (tree_view->priv->bin_window, - area->x, area->y, area->width, area->height); - gdk_window_clear_area (tree_view->priv->header_window, - area->x, area->y, area->width, area->height); - } - - tmp_list = tree_view->priv->children; - while (tmp_list) - { - GtkTreeViewChild *child = tmp_list->data; - tmp_list = tmp_list->next; - - if (gtk_widget_intersect (child->widget, area, &child_area)) - gtk_widget_draw (child->widget, &child_area); - } - for (tmp_list = tree_view->priv->column; tmp_list; tmp_list = tmp_list->next) - { - column = tmp_list->data; - if (!column->visible) - continue; - if (column->button && - gtk_widget_intersect(column->button, area, &child_area)) - gtk_widget_draw (column->button, &child_area); - } -} - /* Warning: Very scary function. * Modify at your own risk */ diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 33282140a2..011636dfb4 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -53,8 +53,6 @@ static void gtk_viewport_realize (GtkWidget *widget); static void gtk_viewport_unrealize (GtkWidget *widget); static void gtk_viewport_paint (GtkWidget *widget, GdkRectangle *area); -static void gtk_viewport_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_viewport_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_viewport_add (GtkContainer *container, @@ -117,7 +115,6 @@ gtk_viewport_class_init (GtkViewportClass *class) widget_class->unmap = gtk_viewport_unmap; widget_class->realize = gtk_viewport_realize; widget_class->unrealize = gtk_viewport_unrealize; - widget_class->draw = gtk_viewport_draw; widget_class->expose_event = gtk_viewport_expose; widget_class->size_request = gtk_viewport_size_request; widget_class->size_allocate = gtk_viewport_size_allocate; @@ -537,49 +534,6 @@ gtk_viewport_paint (GtkWidget *widget, } } -static void -gtk_viewport_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkViewport *viewport; - GtkBin *bin; - GdkRectangle tmp_area; - GdkRectangle child_area; - gint border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_VIEWPORT (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - viewport = GTK_VIEWPORT (widget); - bin = GTK_BIN (widget); - - border_width = GTK_CONTAINER (widget)->border_width; - - tmp_area = *area; - tmp_area.x -= border_width; - tmp_area.y -= border_width; - - gtk_viewport_paint (widget, &tmp_area); - - tmp_area.x += viewport->hadjustment->value - widget->style->xthickness; - tmp_area.y += viewport->vadjustment->value - widget->style->ythickness; - - gtk_paint_flat_box(widget->style, viewport->bin_window, - GTK_STATE_NORMAL, GTK_SHADOW_NONE, - &tmp_area, widget, "viewportbin", - 0, 0, -1, -1); - - if (bin->child) - { - if (gtk_widget_intersect (bin->child, &tmp_area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - } - } -} - static gint gtk_viewport_expose (GtkWidget *widget, GdkEventExpose *event) diff --git a/gtk/gtkvpaned.c b/gtk/gtkvpaned.c index e1a1ee5934..69bfed62d9 100644 --- a/gtk/gtkvpaned.c +++ b/gtk/gtkvpaned.c @@ -32,8 +32,6 @@ static void gtk_vpaned_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_vpaned_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_vpaned_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_vpaned_xor_line (GtkPaned *paned); static gboolean gtk_vpaned_button_press (GtkWidget *widget, GdkEventButton *event); @@ -76,7 +74,6 @@ gtk_vpaned_class_init (GtkVPanedClass *class) widget_class->size_request = gtk_vpaned_size_request; widget_class->size_allocate = gtk_vpaned_size_allocate; - widget_class->draw = gtk_vpaned_draw; widget_class->button_press_event = gtk_vpaned_button_press; widget_class->button_release_event = gtk_vpaned_button_release; widget_class->motion_notify_event = gtk_vpaned_motion; @@ -225,56 +222,6 @@ gtk_vpaned_size_allocate (GtkWidget *widget, } static void -gtk_vpaned_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkPaned *paned; - GdkRectangle handle_area, child_area; - guint16 border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_PANED (widget)); - - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) - { - paned = GTK_PANED (widget); - border_width = GTK_CONTAINER (paned)->border_width; - - gdk_window_clear_area (widget->window, - area->x, area->y, area->width, - area->height); - - handle_area.x = paned->handle_xpos; - handle_area.y = paned->handle_ypos; - handle_area.width = paned->handle_width; - handle_area.height = paned->handle_size; - - if (gdk_rectangle_intersect (&handle_area, area, &child_area)) - { - child_area.x -= paned->handle_xpos; - child_area.y -= paned->handle_ypos; - - gtk_paint_handle (widget->style, - paned->handle, - GTK_STATE_NORMAL, - GTK_SHADOW_NONE, - &child_area, - widget, - "paned", - 0, 0, -1, -1, - GTK_ORIENTATION_HORIZONTAL); - - } - /* Redraw the children - */ - if (paned->child1 && gtk_widget_intersect (paned->child1, area, &child_area)) - gtk_widget_draw (paned->child1, &child_area); - if (paned->child2 && gtk_widget_intersect (paned->child2, area, &child_area)) - gtk_widget_draw (paned->child2, &child_area); - } -} - -static void gtk_vpaned_xor_line (GtkPaned *paned) { GtkWidget *widget; diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c index 5f8e80f902..0beebdb887 100644 --- a/gtk/gtkvscale.c +++ b/gtk/gtkvscale.c @@ -63,8 +63,6 @@ static void gtk_vscale_pos_background (GtkVScale *vscale, gint *h); static void gtk_vscale_draw_slider (GtkRange *range); static void gtk_vscale_draw_value (GtkScale *scale); -static void gtk_vscale_draw (GtkWidget *widget, - GdkRectangle *area); static gint gtk_vscale_trough_keys (GtkRange *range, GdkEventKey *key, GtkScrollType *scroll, @@ -120,7 +118,6 @@ gtk_vscale_class_init (GtkVScaleClass *class) widget_class->realize = gtk_vscale_realize; widget_class->size_request = gtk_vscale_size_request; widget_class->size_allocate = gtk_vscale_size_allocate; - widget_class->draw = gtk_vscale_draw; range_class->slider_update = gtk_range_default_vslider_update; range_class->trough_click = gtk_range_default_vtrough_click; @@ -250,50 +247,6 @@ gtk_vscale_realize (GtkWidget *widget) } static void -gtk_vscale_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GtkRange *range; - GdkRectangle tmp_area; - GdkRectangle child_area; - gint x, y, width, height; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_RANGE (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) - { - range = GTK_RANGE (widget); - - gtk_vscale_pos_background (GTK_VSCALE (widget), &x, &y, &width, &height); - - tmp_area.x = x; - tmp_area.y = y; - tmp_area.width = width; - tmp_area.height = height; - - if (gdk_rectangle_intersect (area, &tmp_area, &child_area)) - gtk_range_draw_background (range); - - gtk_vscale_pos_trough (GTK_VSCALE (widget), &x, &y, &width, &height); - - tmp_area.x = x; - tmp_area.y = y; - tmp_area.width = width; - tmp_area.height = height; - - if (gdk_rectangle_intersect (area, &tmp_area, &child_area)) - { - gtk_range_draw_trough (range); - gtk_range_draw_slider (range); - gtk_range_draw_step_forw (range); - gtk_range_draw_step_back (range); - } - } -} - -static void gtk_vscale_clear_background (GtkRange *range) { GtkWidget *widget; diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 9b71db8829..f873fc7eba 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -52,7 +52,6 @@ enum { UNMAP, REALIZE, UNREALIZE, - DRAW, DRAW_FOCUS, DRAW_DEFAULT, SIZE_REQUEST, @@ -153,8 +152,6 @@ static void gtk_widget_real_map (GtkWidget *widget); static void gtk_widget_real_unmap (GtkWidget *widget); static void gtk_widget_real_realize (GtkWidget *widget); static void gtk_widget_real_unrealize (GtkWidget *widget); -static void gtk_widget_real_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_widget_real_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_widget_real_size_allocate (GtkWidget *widget, @@ -291,7 +288,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->unmap = gtk_widget_real_unmap; klass->realize = gtk_widget_real_realize; klass->unrealize = gtk_widget_real_unrealize; - klass->draw = gtk_widget_real_draw; klass->draw_focus = NULL; klass->size_request = gtk_widget_real_size_request; klass->size_allocate = gtk_widget_real_size_allocate; @@ -398,14 +394,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) GTK_SIGNAL_OFFSET (GtkWidgetClass, unrealize), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - widget_signals[DRAW] = - gtk_signal_new ("draw", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkWidgetClass, draw), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); widget_signals[DRAW_FOCUS] = gtk_signal_new ("draw_focus", GTK_RUN_FIRST, @@ -2010,61 +1998,28 @@ gtk_widget_queue_resize (GtkWidget *widget) * widget. In GTK+ 2.0, the draw method is gone, and instead * gtk_widget_draw() simply invalidates the specified region of the * widget, then updates the invalid region of the widget immediately. + * Usually you don't want to update the region immediately for + * performance reasons, so in general gtk_widget_queue_draw_area() is + * a better choice if you want to draw a region of a widget. * **/ void gtk_widget_draw (GtkWidget *widget, GdkRectangle *area) { - GdkRectangle temp_area; - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); if (GTK_WIDGET_DRAWABLE (widget)) { if (area) - { - if (area->width <= 0 || area->height <= 0) - return; - } + gtk_widget_queue_draw_area (widget, + area->x, area->y, + area->width, area->height); else - { - if (GTK_WIDGET_NO_WINDOW (widget)) - { - temp_area.x = widget->allocation.x; - temp_area.y = widget->allocation.y; - } - else - { - temp_area.x = 0; - temp_area.y = 0; - } - - temp_area.width = widget->allocation.width; - temp_area.height = widget->allocation.height; - area = &temp_area; - } - - if (!GTK_WIDGET_NO_WINDOW (widget) && GTK_WIDGET_DOUBLE_BUFFERED (widget)) - { - GdkRectangle tmp_area = *area; - gint x, y; + gtk_widget_queue_draw (widget); - if (!GTK_WIDGET_TOPLEVEL (widget)) - { - gdk_window_get_position (widget->window, &x, &y); - tmp_area.x -= x - widget->allocation.x; - tmp_area.y -= y - widget->allocation.y; - } - - gdk_window_begin_paint_rect (widget->window, &tmp_area); - } - - gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW], area); - - if (!GTK_WIDGET_NO_WINDOW (widget) && GTK_WIDGET_DOUBLE_BUFFERED (widget)) - gdk_window_end_paint (widget->window); + gdk_window_process_updates (widget->window, TRUE); } } @@ -4838,30 +4793,6 @@ gtk_widget_real_unrealize (GtkWidget *widget) } static void -gtk_widget_real_draw (GtkWidget *widget, - GdkRectangle *area) -{ - GdkEventExpose event; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) - { - event.type = GDK_EXPOSE; - event.send_event = TRUE; - event.window = widget->window; - event.area = *area; - event.count = 0; - - gdk_window_ref (event.window); - gtk_widget_event (widget, (GdkEvent*) &event); - gdk_window_unref (event.window); - } -} - -static void gtk_widget_real_size_request (GtkWidget *widget, GtkRequisition *requisition) { diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 3231e14d06..fb76563f60 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -242,8 +242,6 @@ struct _GtkWidgetClass void (* unmap) (GtkWidget *widget); void (* realize) (GtkWidget *widget); void (* unrealize) (GtkWidget *widget); - void (* draw) (GtkWidget *widget, - GdkRectangle *area); void (* draw_focus) (GtkWidget *widget); void (* draw_default) (GtkWidget *widget); void (* size_request) (GtkWidget *widget, diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 821f9d855e..7860ef9379 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -155,8 +155,6 @@ static void gtk_window_compute_reposition (GtkWindow *window, static void gtk_window_read_rcfiles (GtkWidget *widget, GdkEventClient *event); -static void gtk_window_draw (GtkWidget *widget, - GdkRectangle *area); static void gtk_window_paint (GtkWidget *widget, GdkRectangle *area); static gint gtk_window_expose (GtkWidget *widget, @@ -259,8 +257,7 @@ gtk_window_class_init (GtkWindowClass *klass) widget_class->focus_in_event = gtk_window_focus_in_event; widget_class->focus_out_event = gtk_window_focus_out_event; widget_class->client_event = gtk_window_client_event; - - widget_class->draw = gtk_window_draw; + widget_class->expose_event = gtk_window_expose; container_class->check_resize = gtk_window_check_resize; @@ -2296,14 +2293,3 @@ gtk_window_expose (GtkWidget *widget, return TRUE; } - -static void -gtk_window_draw (GtkWidget *widget, - GdkRectangle *area) -{ - if (!GTK_WIDGET_APP_PAINTABLE (widget)) - gtk_window_paint (widget, area); - - if (GTK_WIDGET_CLASS (parent_class)->draw) - (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area); -} |