diff options
author | Havoc Pennington <hp@redhat.com> | 2001-02-28 19:07:46 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-02-28 19:07:46 +0000 |
commit | 56a2f2c628fb0411f26fa0ecaeee32b5e8aebb32 (patch) | |
tree | 0f0d9db14a657be55d118ced03fd80857dfe5880 /gtk | |
parent | c82dc58f7fceed9878181b50783ebfc80a5a3ae8 (diff) | |
download | gtk+-56a2f2c628fb0411f26fa0ecaeee32b5e8aebb32.tar.gz |
Remove draw_focus and draw_default (gtk_widget_draw_focus): remove this
2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and
draw_default
(gtk_widget_draw_focus): remove this function; we could instead
make it just gtk_widget_draw(), but in most cases I think the
result would be broken user code, so think it's better to have
that code not compile and get fixed
(gtk_widget_draw_default): ditto
* gtk/gtkwidget.c: Add default handlers for focus_in_event and
focus_out_event that set/unset GTK_HAS_FOCUS and call queue_draw
* gtk/gtkwindow.c (gtk_window_set_default): just queue a draw when
widgets lose/get the default, instead of calling draw_default
* docs/Changes-2.0.txt: note about all this
Then fixed every widget in GTK, I won't list all the filenames.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkbutton.c | 50 | ||||
-rw-r--r-- | gtk/gtkcalendar.c | 49 | ||||
-rw-r--r-- | gtk/gtkcheckbutton.c | 18 | ||||
-rw-r--r-- | gtk/gtkclist.c | 7 | ||||
-rw-r--r-- | gtk/gtkctree.c | 3 | ||||
-rw-r--r-- | gtk/gtkentry.c | 7 | ||||
-rw-r--r-- | gtk/gtklistitem.c | 45 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 24 | ||||
-rw-r--r-- | gtk/gtkrange.c | 44 | ||||
-rw-r--r-- | gtk/gtktext.c | 19 | ||||
-rw-r--r-- | gtk/gtktextview.c | 7 | ||||
-rw-r--r-- | gtk/gtktreeitem.c | 47 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 1 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 84 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 4 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 4 |
16 files changed, 46 insertions, 367 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index f1cf1f4ab9..d756af1ba5 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_focus (GtkWidget *widget); -static void gtk_button_draw_default (GtkWidget *widget); static gint gtk_button_expose (GtkWidget *widget, GdkEventExpose *event); static gint gtk_button_button_press (GtkWidget *widget, @@ -84,10 +82,6 @@ static gint gtk_button_enter_notify (GtkWidget *widget, GdkEventCrossing *event); static gint gtk_button_leave_notify (GtkWidget *widget, GdkEventCrossing *event); -static gint gtk_button_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_button_focus_out (GtkWidget *widget, - GdkEventFocus *event); static void gtk_button_add (GtkContainer *container, GtkWidget *widget); static void gtk_button_remove (GtkContainer *container, @@ -147,8 +141,6 @@ gtk_button_class_init (GtkButtonClass *klass) object_class->get_arg = gtk_button_get_arg; widget_class->realize = gtk_button_realize; - widget_class->draw_focus = gtk_button_draw_focus; - widget_class->draw_default = gtk_button_draw_default; widget_class->size_request = gtk_button_size_request; widget_class->size_allocate = gtk_button_size_allocate; widget_class->expose_event = gtk_button_expose; @@ -156,8 +148,6 @@ gtk_button_class_init (GtkButtonClass *klass) widget_class->button_release_event = gtk_button_button_release; widget_class->enter_notify_event = gtk_button_enter_notify; widget_class->leave_notify_event = gtk_button_leave_notify; - widget_class->focus_in_event = gtk_button_focus_in; - widget_class->focus_out_event = gtk_button_focus_out; container_class->add = gtk_button_add; container_class->remove = gtk_button_remove; @@ -690,18 +680,6 @@ gtk_button_paint (GtkWidget *widget, } } -static void -gtk_button_draw_focus (GtkWidget *widget) -{ - gtk_widget_draw (widget, NULL); -} - -static void -gtk_button_draw_default (GtkWidget *widget) -{ - gtk_widget_draw (widget, NULL); -} - static gint gtk_button_expose (GtkWidget *widget, GdkEventExpose *event) @@ -819,34 +797,6 @@ gtk_button_leave_notify (GtkWidget *widget, return FALSE; } -static gint -gtk_button_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return FALSE; -} - -static gint -gtk_button_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return FALSE; -} - static void gtk_button_add (GtkContainer *container, GtkWidget *widget) diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index debb603e37..a9fa8ad1a1 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -284,10 +284,6 @@ static gint gtk_calendar_leave_notify (GtkWidget *widget, GdkEventCrossing *event); static gint gtk_calendar_key_press (GtkWidget *widget, GdkEventKey *event); -static gint gtk_calendar_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_calendar_focus_out (GtkWidget *widget, - GdkEventFocus *event); static void gtk_calendar_state_changed (GtkWidget *widget, GtkStateType previous_state); static void gtk_calendar_style_set (GtkWidget *widget, @@ -358,7 +354,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_focus = gtk_calendar_draw_focus; widget_class->size_request = gtk_calendar_size_request; widget_class->size_allocate = gtk_calendar_size_allocate; widget_class->button_press_event = gtk_calendar_button_press; @@ -366,8 +361,6 @@ gtk_calendar_class_init (GtkCalendarClass *class) widget_class->enter_notify_event = gtk_calendar_enter_notify; widget_class->leave_notify_event = gtk_calendar_leave_notify; widget_class->key_press_event = gtk_calendar_key_press; - widget_class->focus_in_event = gtk_calendar_focus_in; - widget_class->focus_out_event = gtk_calendar_focus_out; widget_class->style_set = gtk_calendar_style_set; widget_class->state_changed = gtk_calendar_state_changed; @@ -1484,7 +1477,7 @@ gtk_calendar_expose (GtkWidget *widget, if (event->window == private_data->week_win) gtk_calendar_paint_week_numbers (widget); if (event->window == widget->window) - gtk_widget_draw_focus (widget); + gtk_calendar_draw_focus (widget); } return FALSE; @@ -1516,7 +1509,7 @@ gtk_calendar_paint (GtkWidget *widget, if (private_data->week_win != NULL) gtk_calendar_paint_week_numbers (widget); - gtk_widget_draw_focus (widget); + gtk_calendar_draw_focus (widget); } static void @@ -2622,25 +2615,6 @@ gtk_calendar_state_changed (GtkWidget *widget, gtk_calendar_set_background (widget); } -static gint -gtk_calendar_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - GtkCalendar *calendar; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - calendar = GTK_CALENDAR (widget); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - gtk_calendar_paint_day (widget, calendar->focus_row, calendar->focus_col); - - return FALSE; -} - static void gtk_calendar_destroy (GtkObject *object) { @@ -2652,25 +2626,6 @@ gtk_calendar_destroy (GtkObject *object) } static gint -gtk_calendar_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - GtkCalendar *calendar; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - calendar = GTK_CALENDAR (widget); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - gtk_calendar_paint_day (widget, calendar->focus_row, calendar->focus_col); - - return FALSE; -} - -static gint gtk_calendar_key_press (GtkWidget *widget, GdkEventKey *event) { diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index dc92a23c8d..fb8d052d12 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -34,7 +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_focus (GtkWidget *widget); static void gtk_check_button_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_check_button_size_allocate (GtkWidget *widget, @@ -84,7 +83,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_focus = gtk_check_button_draw_focus; widget_class->size_request = gtk_check_button_size_request; widget_class->size_allocate = gtk_check_button_size_allocate; widget_class->expose_event = gtk_check_button_expose; @@ -157,22 +155,6 @@ gtk_check_button_paint (GtkWidget *widget, } static void -gtk_check_button_draw_focus (GtkWidget *widget) -{ - gint border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_CHECK_BUTTON (widget)); - - border_width = GTK_CONTAINER (widget)->border_width; - gtk_widget_queue_clear_area (widget->parent, - border_width + widget->allocation.x, - border_width + widget->allocation.y, - widget->allocation.width - 2 * border_width, - widget->allocation.height - 2 * border_width); -} - -static void gtk_check_button_size_request (GtkWidget *widget, GtkRequisition *requisition) { diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index f0ba6b76e5..2c8dec11d3 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -523,7 +523,6 @@ gtk_clist_class_init (GtkCListClass *klass) widget_class->size_allocate = gtk_clist_size_allocate; widget_class->focus_in_event = gtk_clist_focus_in; widget_class->focus_out_event = gtk_clist_focus_out; - widget_class->draw_focus = gtk_clist_draw_focus; widget_class->style_set = gtk_clist_style_set; widget_class->drag_begin = gtk_clist_drag_begin; widget_class->drag_end = gtk_clist_drag_end; @@ -6637,10 +6636,10 @@ gtk_clist_focus_in (GtkWidget *widget, gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW], clist->focus_row, -1, event); else - gtk_widget_draw_focus (widget); + gtk_clist_draw_focus (widget); } else - gtk_widget_draw_focus (widget); + gtk_clist_draw_focus (widget); return FALSE; } @@ -6657,7 +6656,7 @@ gtk_clist_focus_out (GtkWidget *widget, GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + gtk_clist_draw_focus (widget); clist = GTK_CLIST (widget); diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index acc7e128b2..c831f8d07a 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -5781,9 +5781,8 @@ real_undo_selection (GtkCList *clist) if (GTK_WIDGET_HAS_FOCUS (clist) && clist->focus_row != clist->undo_anchor) { - gtk_widget_draw_focus (GTK_WIDGET (clist)); clist->focus_row = clist->undo_anchor; - gtk_widget_draw_focus (GTK_WIDGET (clist)); + gtk_widget_queue_draw (GTK_WIDGET (clist)); } else clist->focus_row = clist->undo_anchor; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 967163ee80..3a087e8992 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -327,7 +327,6 @@ gtk_entry_class_init (GtkEntryClass *class) widget_class->realize = gtk_entry_realize; widget_class->unrealize = gtk_entry_unrealize; - 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->expose_event = gtk_entry_expose; @@ -1033,7 +1032,7 @@ gtk_entry_expose (GtkWidget *widget, entry = GTK_ENTRY (widget); if (widget->window == event->window) - gtk_widget_draw_focus (widget); + gtk_entry_draw_focus (widget); else if (entry->text_area == event->window) { gtk_entry_draw_text (GTK_ENTRY (widget)); @@ -1246,7 +1245,7 @@ gtk_entry_focus_in (GtkWidget *widget, g_return_val_if_fail (event != NULL, FALSE); GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + gtk_entry_draw_focus (widget); gtk_entry_queue_draw (GTK_ENTRY (widget)); GTK_ENTRY (widget)->need_im_reset = TRUE; @@ -1264,7 +1263,7 @@ gtk_entry_focus_out (GtkWidget *widget, g_return_val_if_fail (event != NULL, FALSE); GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + gtk_entry_draw_focus (widget); gtk_entry_queue_draw (GTK_ENTRY (widget)); GTK_ENTRY (widget)->need_im_reset = TRUE; diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 2deb15d2b1..00a819687b 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -56,15 +56,10 @@ 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_focus (GtkWidget *widget); static gint gtk_list_item_button_press (GtkWidget *widget, GdkEventButton *event); static gint gtk_list_item_expose (GtkWidget *widget, GdkEventExpose *event); -static gint gtk_list_item_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_list_item_focus_out (GtkWidget *widget, - GdkEventFocus *event); static void gtk_real_list_item_select (GtkItem *item); static void gtk_real_list_item_deselect (GtkItem *item); static void gtk_real_list_item_toggle (GtkItem *item); @@ -117,11 +112,8 @@ 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_focus = gtk_list_item_draw_focus; widget_class->button_press_event = gtk_list_item_button_press; widget_class->expose_event = gtk_list_item_expose; - widget_class->focus_in_event = gtk_list_item_focus_in; - widget_class->focus_out_event = gtk_list_item_focus_out; item_class->select = gtk_real_list_item_select; item_class->deselect = gtk_real_list_item_deselect; @@ -450,15 +442,6 @@ gtk_list_item_style_set (GtkWidget *widget, gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]); } -static void -gtk_list_item_draw_focus (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_LIST_ITEM (widget)); - - gtk_widget_draw(widget, NULL); -} - static gint gtk_list_item_button_press (GtkWidget *widget, GdkEventButton *event) @@ -531,34 +514,6 @@ gtk_list_item_expose (GtkWidget *widget, return FALSE; } -static gint -gtk_list_item_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return FALSE; -} - -static gint -gtk_list_item_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return FALSE; -} - static void gtk_real_list_item_select (GtkItem *item) { diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 4bb12ec597..ff3b62f6ff 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -143,8 +143,6 @@ static gint gtk_notebook_key_press (GtkWidget *widget, GdkEventKey *event); static gint gtk_notebook_focus_in (GtkWidget *widget, GdkEventFocus *event); -static gint gtk_notebook_focus_out (GtkWidget *widget, - GdkEventFocus *event); static void gtk_notebook_draw_focus (GtkWidget *widget); static void gtk_notebook_style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -299,8 +297,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) widget_class->motion_notify_event = gtk_notebook_motion_notify; widget_class->key_press_event = gtk_notebook_key_press; widget_class->focus_in_event = gtk_notebook_focus_in; - widget_class->focus_out_event = gtk_notebook_focus_out; - widget_class->draw_focus = gtk_notebook_draw_focus; widget_class->style_set = gtk_notebook_style_set; container_class->add = gtk_notebook_add; @@ -979,7 +975,7 @@ gtk_notebook_expose (GtkWidget *widget, if (notebook->cur_page && gtk_widget_intersect (notebook->cur_page->tab_label, &event->area, &child_area)) - gtk_widget_draw_focus (widget); + gtk_notebook_draw_focus (widget); } child_event = *event; @@ -1278,24 +1274,8 @@ gtk_notebook_focus_in (GtkWidget *widget, g_return_val_if_fail (event != NULL, FALSE); GTK_NOTEBOOK (widget)->child_has_focus = FALSE; - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return FALSE; -} - -static gint -gtk_notebook_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - return FALSE; + return (* GTK_WIDGET_CLASS (parent_class)->focus_in_event) (widget, event); } static void diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 76d88cd78a..2ffcc963b5 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -49,7 +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_focus (GtkWidget *widget); static void gtk_range_unrealize (GtkWidget *widget); static gint gtk_range_expose (GtkWidget *widget, GdkEventExpose *event); @@ -65,10 +64,6 @@ static gint gtk_range_enter_notify (GtkWidget *widget, GdkEventCrossing *event); static gint gtk_range_leave_notify (GtkWidget *widget, GdkEventCrossing *event); -static gint gtk_range_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_range_focus_out (GtkWidget *widget, - GdkEventFocus *event); static gint gtk_range_scroll_event (GtkWidget *widget, GdkEventScroll *event); static void gtk_range_style_set (GtkWidget *widget, @@ -138,7 +133,6 @@ gtk_range_class_init (GtkRangeClass *class) object_class->get_arg = gtk_range_get_arg; object_class->destroy = gtk_range_destroy; - widget_class->draw_focus = gtk_range_draw_focus; widget_class->unrealize = gtk_range_unrealize; widget_class->expose_event = gtk_range_expose; widget_class->button_press_event = gtk_range_button_press; @@ -148,8 +142,6 @@ gtk_range_class_init (GtkRangeClass *class) widget_class->key_press_event = gtk_range_key_press; widget_class->enter_notify_event = gtk_range_enter_notify; widget_class->leave_notify_event = gtk_range_leave_notify; - widget_class->focus_in_event = gtk_range_focus_in; - widget_class->focus_out_event = gtk_range_focus_out; widget_class->style_set = gtk_range_style_set; class->slider_width = 11; @@ -798,16 +790,6 @@ gtk_range_destroy (GtkObject *object) } static void -gtk_range_draw_focus (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_RANGE (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) - _gtk_range_draw_trough (GTK_RANGE (widget)); -} - -static void gtk_range_unrealize (GtkWidget *widget) { GtkRange *range; @@ -1272,32 +1254,6 @@ gtk_range_leave_notify (GtkWidget *widget, return TRUE; } -static gint -gtk_range_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return TRUE; -} - -static gint -gtk_range_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - return TRUE; -} - static void gtk_real_range_draw_trough (GtkRange *range) { diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 31b83d4274..243e7fd1d0 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -553,7 +553,6 @@ gtk_text_class_init (GtkTextClass *class) widget_class->unrealize = gtk_text_unrealize; widget_class->style_set = gtk_text_style_set; widget_class->state_changed = gtk_text_state_changed; - 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->expose_event = gtk_text_expose; @@ -1692,7 +1691,7 @@ gtk_text_expose (GtkWidget *widget, else if (event->count == 0) { TDEBUG (("in gtk_text_expose (focus)\n")); - gtk_widget_draw_focus (widget); + gtk_text_draw_focus (widget); } return FALSE; @@ -2228,17 +2227,12 @@ gtk_text_focus_in (GtkWidget *widget, TDEBUG (("in gtk_text_focus_in\n")); - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - #ifdef USE_XIM if (GTK_OLD_EDITABLE (widget)->ic) gdk_im_begin (GTK_OLD_EDITABLE (widget)->ic, GTK_TEXT(widget)->text_area); #endif - draw_cursor (GTK_TEXT(widget), TRUE); - - return FALSE; + return (* GTK_WIDGET_CLASS (parent_class)->focus_in_event) (widget, event); } static gint @@ -2251,16 +2245,11 @@ gtk_text_focus_out (GtkWidget *widget, TDEBUG (("in gtk_text_focus_out\n")); - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - undraw_cursor (GTK_TEXT(widget), TRUE); - #ifdef USE_XIM gdk_im_end (); #endif - - return FALSE; + + return (* GTK_WIDGET_CLASS (parent_class)->focus_out_event) (widget, event); } static void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index a4537d6743..b49438aa8b 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -462,7 +462,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_focus = gtk_text_view_draw_focus; widget_class->drag_begin = gtk_text_view_drag_begin; widget_class->drag_end = gtk_text_view_drag_end; @@ -3160,7 +3159,7 @@ gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event) GtkTextView *text_view = GTK_TEXT_VIEW (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + gtk_widget_queue_draw (widget); if (text_view->cursor_visible && text_view->layout) { @@ -3180,7 +3179,7 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event) GtkTextView *text_view = GTK_TEXT_VIEW (widget); GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + gtk_widget_queue_draw (widget); if (text_view->cursor_visible && text_view->layout) { @@ -3291,7 +3290,7 @@ gtk_text_view_expose_event (GtkWidget *widget, GdkEventExpose *event) } if (event->window == widget->window) - gtk_widget_draw_focus (widget); + gtk_text_view_draw_focus (widget); return TRUE; } diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 35484b6982..6c72379abc 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -65,17 +65,12 @@ 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_focus (GtkWidget *widget); static void gtk_tree_item_paint (GtkWidget *widget, GdkRectangle *area); static gint gtk_tree_item_button_press (GtkWidget *widget, GdkEventButton *event); static gint gtk_tree_item_expose (GtkWidget *widget, GdkEventExpose *event); -static gint gtk_tree_item_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_tree_item_focus_out (GtkWidget *widget, - GdkEventFocus *event); static void gtk_tree_item_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, @@ -146,11 +141,8 @@ 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_focus = gtk_tree_item_draw_focus; widget_class->button_press_event = gtk_tree_item_button_press; widget_class->expose_event = gtk_tree_item_expose; - widget_class->focus_in_event = gtk_tree_item_focus_in; - widget_class->focus_out_event = gtk_tree_item_focus_out; widget_class->map = gtk_tree_item_map; widget_class->unmap = gtk_tree_item_unmap; @@ -703,15 +695,6 @@ gtk_tree_item_paint (GtkWidget *widget, } } -static void -gtk_tree_item_draw_focus (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_TREE_ITEM (widget)); - - gtk_widget_draw(widget, NULL); -} - static gint gtk_tree_item_button_press (GtkWidget *widget, GdkEventButton *event) @@ -755,36 +738,6 @@ gtk_tree_item_expose (GtkWidget *widget, return FALSE; } -static gint -gtk_tree_item_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - - return FALSE; -} - -static gint -gtk_tree_item_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); - - - return FALSE; -} - static void gtk_real_tree_item_select (GtkItem *item) { diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 3f3c5bfb1f..b5c0d5a64c 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -289,7 +289,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) widget_class->leave_notify_event = gtk_tree_view_leave_notify; widget_class->button_press_event = gtk_tree_view_button_press; widget_class->button_release_event = gtk_tree_view_button_release; - widget_class->draw_focus = gtk_tree_view_draw_focus; widget_class->focus_in_event = gtk_tree_view_focus_in; widget_class->focus_out_event = gtk_tree_view_focus_out; diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 852be31e07..629a642b8d 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -52,8 +52,6 @@ enum { UNMAP, REALIZE, UNREALIZE, - DRAW_FOCUS, - DRAW_DEFAULT, SIZE_REQUEST, SIZE_ALLOCATE, STATE_CHANGED, @@ -161,6 +159,10 @@ static gint gtk_widget_real_key_press_event (GtkWidget *widget, GdkEventKey *event); static gint gtk_widget_real_key_release_event (GtkWidget *widget, GdkEventKey *event); +static gint gtk_widget_real_focus_in_event (GtkWidget *widget, + GdkEventFocus *event); +static gint gtk_widget_real_focus_out_event (GtkWidget *widget, + GdkEventFocus *event); static void gtk_widget_style_set (GtkWidget *widget, GtkStyle *previous_style); static void gtk_widget_direction_changed (GtkWidget *widget, @@ -289,7 +291,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_focus = NULL; klass->size_request = gtk_widget_real_size_request; klass->size_allocate = gtk_widget_real_size_allocate; klass->state_changed = NULL; @@ -311,8 +312,8 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->enter_notify_event = NULL; klass->leave_notify_event = NULL; klass->configure_event = NULL; - klass->focus_in_event = NULL; - klass->focus_out_event = NULL; + klass->focus_in_event = gtk_widget_real_focus_in_event; + klass->focus_out_event = gtk_widget_real_focus_out_event; klass->map_event = NULL; klass->unmap_event = NULL; klass->window_state_event = NULL; @@ -396,20 +397,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) GTK_SIGNAL_OFFSET (GtkWidgetClass, unrealize), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); - widget_signals[DRAW_FOCUS] = - gtk_signal_new ("draw_focus", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkWidgetClass, draw_focus), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); - widget_signals[DRAW_DEFAULT] = - gtk_signal_new ("draw_default", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkWidgetClass, draw_default), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); widget_signals[SIZE_REQUEST] = gtk_signal_new ("size_request", GTK_RUN_FIRST, @@ -1881,45 +1868,6 @@ gtk_widget_draw (GtkWidget *widget, } /** - * gtk_widget_draw_focus: - * @widget: a #GtkWidget - * - * This function is only for use in widget implementations. Invokes the - * "draw_focus" virtual method/signal on @widget, causing the focus - * rectangle to be drawn or undrawn according to the focus state of - * the widget. Normally called from widget implementations in the - * "focus_in_event" and "focus_out_event" handlers. - * - **/ -void -gtk_widget_draw_focus (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW_FOCUS]); -} - -/** - * gtk_widget_draw_default: - * @widget: a #GtkWidget - * - * This function is only for use in widget implementations. Invokes the - * "draw_default" virtual method/signal on a widget, causing it to - * draw the default rectangle (indicating that the widget is - * the default widget, i.e. the one that's activated by pressing - * the enter key, generally). - **/ -void -gtk_widget_draw_default (GtkWidget *widget) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW_DEFAULT]); -} - -/** * gtk_widget_size_request: * @widget: a #GtkWidget * @requisition: a #GtkRequisition to be filled in @@ -2262,6 +2210,26 @@ gtk_widget_real_key_release_event (GtkWidget *widget, return handled; } +static gint +gtk_widget_real_focus_in_event (GtkWidget *widget, + GdkEventFocus *event) +{ + GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); + gtk_widget_queue_draw (widget); + + return FALSE; +} + +static gint +gtk_widget_real_focus_out_event (GtkWidget *widget, + GdkEventFocus *event) +{ + GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); + gtk_widget_queue_draw (widget); + + return FALSE; +} + /** * gtk_widget_event: * @widget: a #GtkWidget diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index c512a8991f..b3497aac8f 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_focus) (GtkWidget *widget); - void (* draw_default) (GtkWidget *widget); void (* size_request) (GtkWidget *widget, GtkRequisition *requisition); void (* size_allocate) (GtkWidget *widget, @@ -443,8 +441,6 @@ void gtk_widget_queue_resize (GtkWidget *widget); void gtk_widget_draw (GtkWidget *widget, GdkRectangle *area); #endif /* GTK_DISABLE_DEPRECATED */ -void gtk_widget_draw_focus (GtkWidget *widget); -void gtk_widget_draw_default (GtkWidget *widget); void gtk_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); void gtk_widget_size_allocate (GtkWidget *widget, diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 9b204245e8..5324d0b078 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -586,7 +586,7 @@ gtk_window_set_default (GtkWindow *window, if (window->focus_widget != window->default_widget || !GTK_WIDGET_RECEIVES_DEFAULT (window->default_widget)) GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); - gtk_widget_draw_default (window->default_widget); + gtk_widget_queue_draw (window->default_widget); } window->default_widget = default_widget; @@ -596,7 +596,7 @@ gtk_window_set_default (GtkWindow *window, if (window->focus_widget == NULL || !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)) GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); - gtk_widget_draw_default (window->default_widget); + gtk_widget_queue_draw (window->default_widget); } } } |