From e9a03443c7f8ae33306a7f18df5e6e5ec5a57ed5 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 31 Jul 2000 22:59:29 +0000 Subject: [PATCH] Fix problem where computation was depending on widget->allocation instead Mon Jul 31 18:37:36 2000 Owen Taylor * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation was depending on widget->allocation instead of the width of text_area, which was incorrect for subclasses like GtkSpinButton. * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos with width == 1 tests that should be width == -1. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gdk/gdkpango.c | 4 ++-- gtk/gtkentry.c | 13 ++++++++----- 9 files changed, 73 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e58e000f0a..c4d03bb230 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Mon Jul 31 18:37:36 2000 Owen Taylor + + * gtk/gtkentry.c (entry_adjust_scroll): Fix problem where computation + was depending on widget->allocation instead of the width of text_area, + which was incorrect for subclasses like GtkSpinButton. + + * gdk/gdkpango.c (gdk_draw_layout): Fix a couple of typos + with width == 1 tests that should be width == -1. + Mon Jul 31 16:45:48 2000 Owen Taylor * gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken, diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c index 561a1cce6e..85655e302d 100644 --- a/gdk/gdkpango.c +++ b/gdk/gdkpango.c @@ -278,9 +278,9 @@ gdk_draw_layout (GdkDrawable *drawable, pango_layout_line_get_extents (line, NULL, &logical_rect); - if (width != 1 && align == PANGO_ALIGN_RIGHT) + if (width != -1 && align == PANGO_ALIGN_RIGHT) x_offset = width - logical_rect.width; - else if (width != 1 && align == PANGO_ALIGN_CENTER) + else if (width != -1 && align == PANGO_ALIGN_CENTER) x_offset = (width - logical_rect.width) / 2; else x_offset = 0; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index b4e424f91a..050709181a 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -589,6 +589,8 @@ gtk_entry_realize (GtkWidget *widget) gtk_editable_claim_selection (editable, TRUE, GDK_CURRENT_TIME); gtk_im_context_set_client_window (entry->im_context, entry->text_area); + + entry_adjust_scroll (entry); } static void @@ -723,10 +725,9 @@ gtk_entry_size_allocate (GtkWidget *widget, allocation->width - widget->style->xthickness * 2, requisition.height - widget->style->ythickness * 2); + /* And make sure the cursor is on screen */ + entry_adjust_scroll (entry); } - - /* And make sure the cursor is on screen */ - entry_adjust_scroll (entry); } static void @@ -1387,11 +1388,13 @@ entry_adjust_scroll (GtkEntry *entry) g_return_if_fail (GTK_IS_ENTRY (entry)); widget = GTK_WIDGET (entry); - text_area_width = widget->allocation.width - 2 * (widget->style->xthickness + INNER_BORDER); - if (!entry->layout) + if (!entry->layout || !GTK_WIDGET_REALIZED (entry)) return; + gdk_window_get_size (entry->text_area, &text_area_width, NULL); + text_area_width -= 2 * INNER_BORDER; + line = pango_layout_get_lines (entry->layout)->data; /* Display as much text as we can */