Scrolling in Entry boxes
- From: Thomas Leonard <tal197 ecs soton ac uk>
- To: gtk-devel-list redhat com
- Subject: Scrolling in Entry boxes
- Date: Fri, 4 Feb 2000 14:18:55 +0000 (GMT)
Hi,
I've noticed that the scrolling in the Entry boxes seems to be a bit off.
For example, find a entry and type a long string. Once it starts scrolling
you'll find that the cursor isn't visible - it's off the right hand side.
If you then press Left the cursor comes into view and the last character
scrolls out of view (quite unneccessarily!). Pressing Right again causes
the cursor to disappear again and you can't even see all of the character
*before* the cursor anymore.
The problem seems to be caused by the INNER_BORDER width, which isn't
taken into account by the scrolling function. This patch seems to fix it.
Oddly, the entry draws text in the right border but not the left (try
increasing INNER_BORDER to see the effect), although this isn't a big
problem.
diff -ur old-gtk/gtk/gtkentry.c new-gtk/gtk/gtkentry.c
--- old-gtk/gtk/gtkentry.c Mon Nov 22 21:52:47 1999
+++ new-gtk/gtk/gtkentry.c Thu Feb 3 14:39:28 2000
@@ -1581,6 +1581,8 @@
gdk_window_get_size (entry->text_area, &text_area_width, NULL);
+ text_area_width -= INNER_BORDER * 2;
+
/* Display as much text as we can */
max_offset = MAX(0, entry->char_offset[entry->text_length] -
text_area_width);
@@ -1593,7 +1595,7 @@
if (xoffset < 0)
entry->scroll_offset += xoffset;
- else if (xoffset > text_area_width)
+ else if (xoffset >= text_area_width)
entry->scroll_offset += xoffset - text_area_width + 1;
gtk_widget_queue_draw (GTK_WIDGET (entry));
I'm not sure that the change from > to >= makes much difference, but it
seems neater.
Thomas Leonard
--
tal197@ecs.soton.ac.uk
3rd year computer science
The ROX desktop (free/GPL) : http://www.ecs.soton.ac.uk/~tal197/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]