On 02/13/2007 11:15:24 PM, Neil Hodgson wrote:
Nick Treleaven:

I've working on a lightweight IDE, making it scroll a certain line to
1/3 of the view of the editor widget. We used to just send SCI_GOTOLINE in response to a GtkTreeView click - now we are using SCI_LINESCROLL to
get the line in exactly the right place. My problem is we have code
that may cause an initial scroll in reponse to SCI_GOTOLINE, but also
code after a SCN_PAINTED notification that calls SCI_LINESCROLL.

  It would be better to avoid reentrant paints within the SCN_PAINTED
notification. The problem with just deleting the update region when a
reentrant paint occurs is that the original update region is required
by the painting code to ensure accurate and efficient painting. You
may see drawing glitches or crashes if it is just reset. At the point
of the SCN_PAINTED, this code has finished using the update region but
the code you have changed does not know this. A safer change would be
to prevent the synchronous painting in Editor::ScrollTo by calling
Redraw rather than ScrollText if the update region is not NULL.
Thanks for your help. I wasn't sure how to access rgnUpdate from the Editor class, so I made the change in ScintillaGTK::ScrollText. Attached 'gtk-ScrollText-check-rgnUpdate.patch'.

Nick
Index: ScintillaGTK.cxx
===================================================================
--- ScintillaGTK.cxx	(revision 1273)
+++ ScintillaGTK.cxx	(working copy)
@@ -1118,6 +1118,11 @@ void ScintillaGTK::ScrollText(int linesT
 
 	gdk_gc_unref(gc);
 #else
+	// check if e.g. an existing scroll event has occurred
+	if (rgnUpdate != NULL) {
+		Redraw();
+		return;
+	}
 	gdk_window_scroll(wi->window, 0, -diff);
 	gdk_window_process_updates(wi->window, FALSE);
 #endif

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to