[Top][All Lists]

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

Re: Emacs GTK scroll-bar flickering

From: Jan D.
Subject: Re: Emacs GTK scroll-bar flickering
Date: Wed, 19 Mar 2003 23:27:51 +0100 (CET)

> address@hidden (Kim F. Storm) writes:
> > Maybe the size of the thumb changes more often with emacs.  IIRC,
> > emacs calculates the thumb size based on the #(characters in the
> > window) / #(characters in the file) ratio, so just dragging the
> > cursor may change the size of the thumb.
> > 
> > If GTK repaints the entire scroll bar when the thumb size changes,
> > maybe that could explain the flicker.
> I don't think that's it, or at least not entirely it, for several
> reasons:

The issues below are due to the other problem I already mentioned,
Emacs does not use a pure GTK event loop.  For example, redraws
are done in an "idle" event handler.  But since Emacs may not call
the event loop when it is idle, redraws must be forced as they happen.

GTK does double buffering in the "idle" redraw handler.  This
double buffering is not done when we push out redraws, it seems.

So Gedit has double buffering, Emacs has not.  This is a huge difference
and explains why the scroll bars in GTK can "get away" with a sloppy
redraw strategy (i.e. clear all and redraw).

When dragging, Emacs exits the GTK event loop and goes back to its
own loop.  Then when an X event comes, it reenters the GTK event loop
until all X events has been processed, then exits and enters again, etc.
All this exiting and entering also seems to defeat the double buffering.

I am trying to figure out a way for Emacs to handle this better.

BTW, the GTK version in CVS has some serious redraw problems when
changing scroll bars, they can even dissappear (C-l should get
them back).  It may be a while before it gets fixed.

        Jan D.

>  (1) If I create a file containing a large number of identical lines,
>      then scrolling in emacs shouldn't change the thumb size, as long as
>      I don't get near the end of the file.  Nevertheless, dragging the
>      scrollbar in emacs flickers noticeably.  My test file, BTW is 68
>      lines of the following:
>         alskdfjlaskdjfalskdjfalskfjlaskdfjalskfjdaskldfj
>  (2) Gedit's scrollbar doesn't flicker _at all_ when the thumb-size
>      changes.  I tested this by taking the above file, copying a bunch
>      of lines from it, and then pasting into the end of the gedit
>      buffer, while carefully watching the scrollbar end-buttons (which
>      are one of the most obvious `flicker points' in emacs); the result
>      was that the thumb shrank quite bit with a few pastes, but the
>      scrollbar update was rock-stable, no flicker at all.
>      It could be, of course, that gedit has some sort of additional
>      graphic optimization to prevent flicker since it uses GTK for all
>      its display.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]