From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: Emacs GTK scroll-bar flickering Date: Wed, 19 Mar 2003 23:27:51 +0100 (CET) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200303192321.h2JNKxbN015050@stubby.bodenonline.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1048112995 18345 80.91.224.249 (19 Mar 2003 22:29:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 19 Mar 2003 22:29:55 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Mar 19 23:29:54 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18vm4I-0004lc-00 for ; Wed, 19 Mar 2003 23:29:54 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18vm5E-0001Dl-00 for ; Wed, 19 Mar 2003 23:30:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vm43-0004Ey-02 for emacs-devel@quimby.gnus.org; Wed, 19 Mar 2003 17:29:39 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18vm3M-0003M5-00 for emacs-devel@gnu.org; Wed, 19 Mar 2003 17:28:56 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18vm35-0002NG-00 for emacs-devel@gnu.org; Wed, 19 Mar 2003 17:28:45 -0500 Original-Received: from stubby.bodenonline.com ([193.201.16.94]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vm33-00025l-00; Wed, 19 Mar 2003 17:28:37 -0500 Original-Received: from accessno42.bodenonline.com (IDENT:root@accessno42.bodenonline.com [193.201.16.44]) h2JNKxbN015050; Thu, 20 Mar 2003 00:21:00 +0100 In-Reply-To: "from Miles Bader at Mar 19, 2003 10:26:16 am" Original-To: Miles Bader X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12470 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12470 > storm@cua.dk (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.