Commit e9a03443 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

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.
parent 44afc537
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,
......
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,
......
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,
......
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,
......
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,
......
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,
......
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,
......
......@@ -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;
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment