From 014b276774facd8540b2514e5a77e25062e98387 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 3 Jan 2007 16:10:15 +0000 Subject: [PATCH] Work when the entry is not realized. (#392315, Yevgen Muntyan) 2007-01-03 Matthias Clasen * gtk/gtkentry.c (get_text_area_size): Work when the entry is not realized. (#392315, Yevgen Muntyan) * gtk/gtkentry.c (gtk_entry_queue_draw): Use GTK_WIDGET_DRAWABLE() here. (#392227, Chris Wilson) * gtk/gtkentry.c (cursor_blinks): Don't get settings unnecessarily. (#392227) svn path=/trunk/; revision=17030 --- ChangeLog | 11 +++++++++++ gtk/gtkentry.c | 24 ++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9e7270760..049999e630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-01-03 Matthias Clasen + + * gtk/gtkentry.c (get_text_area_size): Work when the + entry is not realized. (#392315, Yevgen Muntyan) + + * gtk/gtkentry.c (gtk_entry_queue_draw): Use + GTK_WIDGET_DRAWABLE() here. (#392227, Chris Wilson) + + * gtk/gtkentry.c (cursor_blinks): Don't get settings + unnecessarily. (#392227) + 2007-01-02 Matthias Clasen * gtk/gtkwindow.c (gtk_window_move_resize): Only process diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a489064f65..de238598dd 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1389,14 +1389,16 @@ get_text_area_size (GtkEntry *entry, "focus-line-width", &focus_width, NULL); - gdk_drawable_get_size (widget->window, NULL, &frame_height); + gtk_widget_get_child_requisition (widget, &requisition); + _gtk_entry_get_borders (entry, &xborder, &yborder); + + if (GTK_WIDGET_REALIZED (widget)) + gdk_drawable_get_size (widget->window, NULL, &frame_height); + else + frame_height = requisition.height; if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus) - height -= 2 * focus_width; - - gtk_widget_get_child_requisition (widget, &requisition); - - _gtk_entry_get_borders (entry, &xborder, &yborder); + frame_height -= 2 * focus_width; if (x) *x = xborder; @@ -3620,7 +3622,7 @@ gtk_entry_draw_cursor (GtkEntry *entry, static void gtk_entry_queue_draw (GtkEntry *entry) { - if (GTK_WIDGET_REALIZED (entry)) + if (GTK_WIDGET_DRAWABLE (entry)) gdk_window_invalidate_rect (entry->text_area, NULL, FALSE); } @@ -5338,14 +5340,16 @@ gtk_entry_drag_data_delete (GtkWidget *widget, static gboolean cursor_blinks (GtkEntry *entry) { - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry)); - gboolean blink; - if (GTK_WIDGET_HAS_FOCUS (entry) && entry->editable && entry->selection_bound == entry->current_pos) { + GtkSettings *settings; + gboolean blink; + + settings = gtk_widget_get_settings (GTK_WIDGET (entry)); g_object_get (settings, "gtk-cursor-blink", &blink, NULL); + return blink; } else