Re: GtkTextView question
- From: Gustavo Giráldez <gustavo giraldez gmx net>
- To: Havoc Pennington <hp redhat com>
- Cc: gtk-list gnome org, gtk-devel-list gnome org
- Subject: Re: GtkTextView question
- Date: 08 Jul 2002 17:49:18 -0300
Hi Havoc,
On Fri, 2002-07-05 at 10:37, Havoc Pennington wrote:
> Gustavo Giráldez <gustavo giraldez gmx net> writes:
> > Is there some way to know in advance which lines will a GtkTextView
> > widget show on the screen before the expose event? I'm writing an
> > incremental syntax highlighter (actually modifying GtkSourceView to do
> > incremental highlighting) and I need this information beforehand to
> > perform the tagging right before the expose event.
> >
> > I tried hooking up the expose event, but I get some weird reentrancy
> > (when I scroll too quickly) that causes an assertion on
> > onscreen_validated to fail. And besides, I don't think that's the
> > correct way of doing it.
> >
> > Any ideas? Can this actually be done?
> >
>
> I'm sure you can get it to work, you may need to look at gtktextview.c
> and work with the internals a bit, or make small tweaks to the
> internals and get those in bugzilla.
Thanks for getting me into this :-) I browsed the TextView sources and
now I have a good idea of how the whole thing works (very nice
architecture btw). The failed assertion I was getting was actually a
real bug (#78513). So now my expose handler approach works. Anyway I
would like to implement a more elegant solution.
> Generally I'd try using an idle handler, I guess, similar to the way
> validation is done; but you need to set up the priorities of your
> handler so that it runs before the validation handlers.
I don't think an idle handler will help me here. I already have a low
priority handler highlighting all the buffer. But what I want is to
always have the onscreen lines highlighted. That's why I hooked up in
the expose handler to highlight before painting (only the lines which
fit in the screen).
> It'd be nice to have an API extension that works for this sort of
> thing; my initial idea would be some kind of about_to_validate signal
> that indicates a range is about to be validated. Of course that's
> going to make all the scrolling/validation code in gtktextview.c even
> _more_ scary... not a happy thought.
What I really need is the view to tell me which portion of the text is
about to draw. By looking at the code I think a signal emission in
gtk_text_view_validate_onscreen() should probably be enough. Maybe I'm
missing something? If that's ok I can work out a patch.
Thanks,
Gustavo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]