From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Owen Taylor Newsgroups: gmane.emacs.devel Subject: Re: Gtk scrollbar: thumb too short Date: 28 Mar 2003 12:27:43 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <1048872463.17161.132.camel@localhost.localdomain> References: <20030325193739.ZGIN3924.fep01-svc.swip.net@gaffa.gaia.swipnet.se> <3E8345E8.4090509@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1048873016 19449 80.91.224.249 (28 Mar 2003 17:36:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 28 Mar 2003 17:36:56 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Mar 28 18:36: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 18yxmg-00053U-00 for ; Fri, 28 Mar 2003 18:36: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 18yxp8-0006hP-00 for ; Fri, 28 Mar 2003 18:39:26 +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 18yxlZ-0000BV-04 for emacs-devel@quimby.gnus.org; Fri, 28 Mar 2003 12:35:45 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18yxim-0007IN-00 for emacs-devel@gnu.org; Fri, 28 Mar 2003 12:32:52 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18yxhu-0006hD-00 for emacs-devel@gnu.org; Fri, 28 Mar 2003 12:31:58 -0500 Original-Received: from nat-pool-rdu.redhat.com ([66.187.233.200] helo=lacrosse.corp.redhat.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18yxfa-0005n1-00; Fri, 28 Mar 2003 12:29:34 -0500 Original-Received: from landau.devel.redhat.com (landau.devel.redhat.com [172.16.56.103])h2SHTSo29294; Fri, 28 Mar 2003 12:29:28 -0500 Original-To: rms@gnu.org In-Reply-To: X-Mailer: Ximian Evolution 1.2.2 (1.2.2-0) Original-cc: "Jan D." Original-cc: kai.grossjohann@uni-duisburg.de 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:12713 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12713 On Fri, 2003-03-28 at 10:21, Richard Stallman wrote: > > What happens if the app specifies a position that is less than one > > page away from the end? Is that considered invalid? > > Not invalid, but the position is silently changed to be a page away from the > end. GTK scroll bars adjust position values to be in the interval > [minimum value for the scroll bar, maximum value - one page size] > > I think GTK should have an option to accept such values > and display them in some sensible way. > > > My suggestion is to display a thumb that rises from the bottom of the > > scroll bar, but is shorter than normal, as if the bottom of the thumb > > were hidden beyond the end of the scroll bar. Others may think > > of a better way to indicate this situation. > > As the native scroll bars do? The disadvantage is that then the > thumb size in relation to the scroll bar size looses the > connection of how much of the buffer you are seeing w.r.t. the > size of the buffer. > > Either we are miscommunicating about something basic, or I disagree. > In what I envision, the visible thumb size would reflect the amount of > real text visible in the window. As window-start gets closer to > point-max, the amount of visible text decreases, and so should the > thumb size. This is certainly _also_ a possible interpretation the scrollbar thumb size: n_characters_visible / n_total_characters is as logical as: (n_characters_visible + (factor) * n_dummy_lines) / (n_total_characters + (factor) * n_dummy_lines) But if you take this interpretation then when you "overscroll", then the scrollbar should simply get smaller, not go off the end of the scrollbar. An observation I'd make is that a scrollbar really encodes two things: - A value - A percentage of a total size If we look at the scrollbar on the screen, we have: v = thumb_start / (trough_pixels - thumb_pixels) p = thumb_pixels / trough_pixels For the normal GTK+ case these two quantities are related to the document size. v = start_of_visible / MAX (size_of_visible, size_of_document) - size_of_visible p = size_of_visible / MAX (size_of_visible, size_of_document) Or, in terms of GtkAdjustment parameters v = value / (max - page_size) p = page_size / max For what you want in Emacs, v and p are computed differently: v = start_of_visible / character_index_of_start_of_last_line p = visible_chars / total_chars What we simply need to do is compute GtkAdjustment parameters that give these same v and p. Fixing, say, max = total_characters, then we have: max = total_characters page_size = max * p = visible_characters value = v * (max - page_size) = (start_of_visible / character_index_of_start_of_last_line) * (total_chars - visible_chars) Now, clearly there are some complexities from the fact that visible_chars changes as the position changes. But I think the approach is workable and will be a whole lot less confusing then some sort of idea of the thumb of the scrollbar going off the edge of the scrollbar trough. Regards, Owen