From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Gtk scrollbar: thumb too short Date: Mon, 14 Apr 2003 20:24:32 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200304150124.h3F1OWT06102@eel.dms.auburn.edu> References: <200304111308.h3BD8oW03188@eel.dms.auburn.edu> <844r55f7yr.fsf@lucy.is.informatik.uni-duisburg.de> <84ptnt6oc8.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1050370019 16644 80.91.224.249 (15 Apr 2003 01:26:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2003 01:26:59 +0000 (UTC) Cc: kai.grossjohann@gmx.net Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 15 03:26:57 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 195FDt-0004K8-00 for ; Tue, 15 Apr 2003 03:26:57 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 195FFV-0002NX-00 for ; Tue, 15 Apr 2003 03:28:38 +0200 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 195FCs-0006q3-03 for emacs-devel@quimby.gnus.org; Mon, 14 Apr 2003 21:25:54 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 195FC9-0006Ww-00 for emacs-devel@gnu.org; Mon, 14 Apr 2003 21:25:09 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 195FBr-0005fn-00 for emacs-devel@gnu.org; Mon, 14 Apr 2003 21:24:52 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 195FBh-0005XI-00; Mon, 14 Apr 2003 21:24:41 -0400 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) h3F1OVoc027955; Mon, 14 Apr 2003 20:24:31 -0500 (CDT) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.11.6+Sun/8.11.6) id h3F1OWT06102; Mon, 14 Apr 2003 20:24:32 -0500 (CDT) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Sun, 13 Apr 2003 07:22:42 -0400) Original-cc: emacs-devel@gnu.org 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:13233 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13233 Richard Stallman wrote: There is some chance we will change the behavior of the native scrollbar; people have proposed some interesting ideas. However, people have not yet implemented them, and if they do, we will have to try them out before deciding whether to use them. So I would say the chance of a change is less than 50%. If I understand correctly Kai made three proposals: 1. Implement stickiness. 2. Only allow overscrolling if the end of the buffer was visible at the start of scrolling. 3. Use the Motiv - current GTK behavior but color the piece of the scrollbar that corresponds to the empty space at the bottom differently. If I understand correctly, you only considered 1. and 2. worth a try. Personally, I only feel comfortable implementing 2. and only for the native scrollbar. (I am not familiar enough with the other scrollbars.) Below is a rough implementation, only meant for people to "play" with to see if they like it. If people are interested, I would make the new behavior customizable and one could then decide what the default behavior should be. Note that my implementation only applies to the native scrollbar. Description of new behavior: First time scrolling stops with the last screenfull of real text visible, unless the end of the buffer is visible at the outset and stays visible. In other words, if you scroll up to see what is above and scroll back down, you can not (immediately) overscroll. To overscroll, you have to first scroll to the bottom (unless you already are there), grab the thumb (*not* click above the thumb) and scroll down, without first scrolling up. I personally would only recommend making the new behavior a customizable option, with the old behavior the default. Since this is just a rough implementation, I do not yet send a diff, but instead the new versions of scroll-bar-drag and scroll-bar-drag-1. One can put these in a file in emacs-lisp-mode, do C-M-x and start playing. Of course, like any new behavior, one first has to get used to it, and then use it in some actual "real work", before one can really judge. The new behavior is meant for people who only occasionally want to overscroll, and most of the time only want to scroll to the end of the buffer. In the final version, you will always be able to temporarily (or on a buffer-by-buffer basis) change your usual default, using the customizable variable I would define. First, however, I want to check whether there is any interest. ===File ~/dragstuff.el====================================== (defun scroll-bar-drag-1 (event) (let* ((start-position (event-start event)) (window (nth 0 start-position)) (portion-whole (nth 2 start-position))) (save-excursion (set-buffer (window-buffer window)) ;; Calculate position relative to the accessible part of the buffer. (goto-char (+ (point-min) (scroll-bar-scale portion-whole (- (point-max) (point-min))))) (beginning-of-line) (set-window-start window (point)) (if (eq (window-end nil t) (point-max)) (when (and (boundp end-visible) (not end-visible)) (goto-char (point-max)) (beginning-of-line) (recenter -1)) (setq end-visible nil))))) (defun scroll-bar-drag (event) "Scroll the window by dragging the scroll bar slider. If you click outside the slider, the window scrolls to bring the slider there." (interactive "e") (let* (done end-visible (echo-keystrokes 0) (end-position (event-end event)) (window (nth 0 end-position)) (before-scroll)) (with-current-buffer (window-buffer window) (setq before-scroll point-before-scroll)) (save-selected-window (select-window window) (setq end-visible (= (point-max) (window-end nil t))) (setq before-scroll (or before-scroll (point)))) (scroll-bar-drag-1 event) (track-mouse (while (not done) (setq event (read-event)) (if (eq (car-safe event) 'mouse-movement) (setq event (read-event))) (cond ((eq (car-safe event) 'scroll-bar-movement) (scroll-bar-drag-1 event)) (t ;; Exit when we get the drag event; ignore that event. (setq done t))))) (sit-for 0) (with-current-buffer (window-buffer window) (setq point-before-scroll before-scroll)))) ============================================================