From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Gtk scrollbar: thumb too short Date: Thu, 27 Mar 2003 18:23:21 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200303272323.h2RNNMbw031029@rum.cs.yale.edu> References: <200303271914.h2RJEdbL026474@stubby.bodenonline.com> <3E834774.6080604@swipnet.se> <200303271904.h2RJ48b0029268@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1048807446 15932 80.91.224.249 (27 Mar 2003 23:24:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 27 Mar 2003 23:24:06 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Mar 28 00:24:02 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 18ygj3-00048P-00 for ; Fri, 28 Mar 2003 00:24:01 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18ygl9-0004gv-00 for ; Fri, 28 Mar 2003 00:26:11 +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 18ygip-00007Z-05 for emacs-devel@quimby.gnus.org; Thu, 27 Mar 2003 18:23:47 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18ygiU-00006V-00 for emacs-devel@gnu.org; Thu, 27 Mar 2003 18:23:26 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18ygiR-0008R8-00 for emacs-devel@gnu.org; Thu, 27 Mar 2003 18:23:25 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.10.13) id 18ygiR-0008QN-00 for emacs-devel@gnu.org; Thu, 27 Mar 2003 18:23:23 -0500 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h2RNNMPe031031 for ; Thu, 27 Mar 2003 18:23:22 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h2RNNMbw031029; Thu, 27 Mar 2003 18:23:22 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: 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:12682 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12682 > I've just thought of an alternative trick to what the Motif code uses: > use the Xaw system in general, but while dragging force the thumb size > to 0. I don't have a patch yet, but it might be a better solution > than what Motif uses right now. The only disadvantage compared to > the native scrollbar should be that the thumb size will be wrong > while dragging (which it is already anyway). Here's a sample patch for Motif users. The main problem with it is that the thumb size is left as 0 when the mouse button is released and is only reset to its true value after a cursor movement or a click or .... anything. But that's the same problem as what Owen is complaingin about and I have another patch in the works for it. Stefan Index: xterm.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xterm.c,v retrieving revision 1.785 diff -u -u -b -r1.785 xterm.c --- xterm.c 23 Mar 2003 00:59:23 -0000 1.785 +++ xterm.c 27 Mar 2003 23:21:48 -0000 @@ -4105,9 +4109,7 @@ /* Minimum and maximum values used for Motif scroll bars. */ -#define XM_SB_MIN 1 #define XM_SB_MAX 10000000 -#define XM_SB_RANGE (XM_SB_MAX - XM_SB_MIN) /* Scroll bar callback for Motif scroll bars. WIDGET is the scroll @@ -4157,17 +4159,14 @@ case XmCR_DRAG: { - int slider_size; - int dragging_down_p = (INTEGERP (bar->dragging) - && XINT (bar->dragging) <= cs->value); - - /* Get the slider size. */ + /* Set the slider size to 0 to make sure we can drag to point-max. */ BLOCK_INPUT; - XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); + XmScrollBarSetValues (widget, cs->value, 1, + 0, 0, False); UNBLOCK_INPUT; - whole = XM_SB_RANGE - slider_size; - portion = min (cs->value - XM_SB_MIN, whole); + whole = XM_SB_MAX - 1; + portion = min (cs->value, whole); part = scroll_bar_handle; bar->dragging = make_number (cs->value); } @@ -4382,7 +4381,7 @@ #ifdef USE_MOTIF /* Set resources. Create the widget. */ XtSetArg (av[ac], XtNmappedWhenManaged, False); ++ac; - XtSetArg (av[ac], XmNminimum, XM_SB_MIN); ++ac; + XtSetArg (av[ac], XmNminimum, 0); ++ac; XtSetArg (av[ac], XmNmaximum, XM_SB_MAX); ++ac; XtSetArg (av[ac], XmNorientation, XmVERTICAL); ++ac; XtSetArg (av[ac], XmNprocessingDirection, XmMAX_ON_BOTTOM), ++ac; @@ -4576,22 +4575,6 @@ #ifdef USE_MOTIF - /* We use an estimate of 30 chars per line rather than the real - `portion' value. This has the disadvantage that the thumb size - is not very representative, but it makes our life a lot easier. - Otherwise, we have to constantly adjust the thumb size, which - we can't always do quickly enough: while dragging, the size of - the thumb might prevent the user from dragging the thumb all the - way to the end. but Motif and some versions of Xaw3d don't allow - updating the thumb size while dragging. Also, even if we can update - its size, the update will often happen too late. - If you don't believe it, check out revision 1.650 of xterm.c to see - what hoops we were going through and the still poor behavior we got. */ - portion = XFASTINT (XWINDOW (bar->window)->height) * 30; - /* When the thumb is at the bottom, position == whole. - So we need to increase `whole' to make space for the thumb. */ - whole += portion; - if (whole <= 0) top = 0, shown = 1; else @@ -4607,14 +4590,13 @@ /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX is the scroll bar's maximum and MIN is the scroll bar's minimum value. */ - size = shown * XM_SB_RANGE; - size = min (size, XM_SB_RANGE); + size = shown * XM_SB_MAX; + size = min (size, XM_SB_MAX); size = max (size, 1); /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ - value = top * XM_SB_RANGE; + value = top * XM_SB_MAX; value = min (value, XM_SB_MAX - size); - value = max (value, XM_SB_MIN); XmScrollBarSetValues (widget, value, size, 0, 0, False); }