Better fix for scrolling problem



Hello,

The fix for the scrolling problem in gnome-help-browser that I mailed
a few days ago doesn't fix all problems. I've looked a bit further and
came up with a better fix. The problem is that in Refresh() in XmHTML.c,
the starting point is computed for the screen update, and it is assumed
that the y coordinates of the objects in the list are strictly increasing.
The problem is that some objects have 0 as y coordinate which messes
things up under certain conditions.

I don't know if it's ok for some objects to have y=0 (at least some of
those, if not all, are of type OBJ_NONE), or if this is a deeper bug.
If you discard the 0s, the list is still not completely sorted (up to
a difference of at most 2 I think). So someone might want to look
into this.

Another problem that I noticed has to do with the layout of tables.
Look at info:libc in the help browser, scroll down, an watch how
the 2nd column drifts to the right.
SetTable() in gtk-xmhtml/layout.c uses box->width to compute the
width of table-entries. At the end of SetTable, box->width is
updated. The effect is that the next table will have slightly shifted
columns. This can't be right.

The following patch solves at least the symptons of the problems.
I substitute one occurrence of box->width by (box->rmargin-box->lmargin),
since that is how box->width is originally defined. I am pretty sure
that this is not the whole solution.

--- XmHTML.c	Wed Dec  2 07:10:03 1998
+++ XmHTML.c	Wed Dec  2 07:10:57 1998
@@ -1169,7 +1169,7 @@
 	{
 		_XmHTMLDebug(1, ("XmHTML.c: Refresh, walking top-up, "
 			"y_start = %i\n", start->y));
-		while(start && y1 <= start->y)
+		while(start && (y1 <= start->y || start->y == 0))
 			start = start->prev;
 		/* get first object with same y position */
 		while(start && start->prev && start->y == start->prev->y)
@@ -2862,8 +2862,8 @@
 			html->html.scroll_y = value;
 
 			/* save new paint engine start */
-/*			html->html.paint_start = html->html.paint_end; */
-			html->html.paint_end = html->html.paint_start;
+			html->html.paint_start = html->html.paint_end;
+/*			html->html.paint_end = html->html.paint_start; */
 			
 			/* small increment */
 			if(inc < html->html.work_height)
--- layout.c	Wed Dec  2 06:54:44 1998
+++ layout.c	Wed Dec  2 07:21:16 1998
@@ -2030,7 +2030,7 @@
 	{
 		/* relative to current box width */
 		if(table->width < 0)
-			twidth = (-table->width * box->width)/100.;
+			twidth = (-table->width * (box->rmargin-box->lmargin))/100.;
 		else
 			twidth = table->width;
 	}

Ronald



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]