Fix problem where computation was depending on widget->allocation instead

Mon Jul 31 18:37:36 2000  Owen Taylor  <otaylor@redhat.com>

	* 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.
This commit is contained in:
Owen Taylor 2000-07-31 22:59:29 +00:00 committed by Owen Taylor
parent 44afc537b3
commit e9a03443c7
9 changed files with 73 additions and 7 deletions

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -1,3 +1,12 @@
Mon Jul 31 18:37:36 2000 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_process_updates_internal): Replace broken,

View File

@ -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;

View File

@ -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 */