unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Subject: Re: Gtk scrollbar: thumb too short
Date: Thu, 27 Mar 2003 18:23:21 -0500	[thread overview]
Message-ID: <200303272323.h2RNNMbw031029@rum.cs.yale.edu> (raw)
In-Reply-To: 200303271904.h2RJ48b0029268@rum.cs.yale.edu

> 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);
     }

       reply	other threads:[~2003-03-27 23:23 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200303271914.h2RJEdbL026474@stubby.bodenonline.com>
     [not found] ` <3E834774.6080604@swipnet.se>
     [not found]   ` <200303271904.h2RJ48b0029268@rum.cs.yale.edu>
2003-03-27 23:23     ` Stefan Monnier [this message]
2003-03-25 14:51 Gtk scrollbar: thumb too short Kai Großjohann
2003-03-25 18:54 ` Jan D.
2003-03-25 19:55   ` Stefan Monnier
2003-03-26 18:26     ` Jan D.
2003-03-26 19:07       ` Stefan Monnier
2003-03-27  3:29   ` Richard Stallman
2003-03-27 14:51     ` Stefan Monnier
2003-03-27 15:48     ` Owen Taylor
2003-03-27 16:30       ` Stefan Monnier
2003-03-27 21:07         ` Owen Taylor
2003-03-27 21:41           ` Stefan Monnier
2003-03-27 21:42           ` Luc Teirlinck
2003-03-27 21:41             ` Owen Taylor
2003-03-27 22:18               ` Luc Teirlinck
2003-03-27 22:46                 ` Jody Goldberg
2003-03-28  2:15               ` Luc Teirlinck
2003-03-28  4:28                 ` Owen Taylor
2003-03-28  6:07                   ` Luc Teirlinck
2003-03-29 18:38                     ` Richard Stallman
2003-03-28 13:35                   ` Stefan Monnier
2003-03-28 13:55                     ` Luc Teirlinck
2003-03-27 16:50       ` Andreas Schwab
2003-03-27 18:27         ` Jan D.
2003-03-27 20:54         ` Owen Taylor
2003-03-28  1:48           ` Miles Bader
2003-03-28  1:42       ` Miles Bader
2003-03-28  1:51         ` Miles Bader
2003-03-28 15:04           ` Kim F. Storm
     [not found]             ` <m21y0rruj4.fsf@primate.xs4all.nl>
2003-03-28 23:57               ` Kim F. Storm
     [not found]                 ` <m2wuijqdu3.fsf@primate.xs4all.nl>
2003-03-29  1:26                   ` Kim F. Storm
2003-03-31  7:52             ` Miles Bader
2003-03-31 11:04               ` Kim F. Storm
2003-03-28 12:43         ` Robert J. Chassell
2003-03-28 13:34           ` Luc Teirlinck
2003-03-28 15:11             ` Robert J. Chassell
2003-03-28 15:50               ` Luc Teirlinck
2003-03-28 13:38           ` Stefan Monnier
2003-03-28 16:18             ` Robert J. Chassell
2003-03-28 16:49               ` Stefan Monnier
2003-03-29 18:39             ` Richard Stallman
2003-03-29 18:43               ` Stefan Monnier
2003-03-28 15:20       ` Richard Stallman
2003-03-28 15:44         ` Owen Taylor
2003-03-28 18:25           ` Jan D.
2003-03-27 18:41     ` Jan D.
2003-03-28 15:21       ` Richard Stallman
2003-03-28 17:27         ` Owen Taylor
2003-03-30 19:24           ` Richard Stallman
2003-03-31 18:12             ` Owen Taylor
2003-03-31 22:06               ` Luc Teirlinck
2003-03-31 22:16                 ` Owen Taylor
2003-03-31 22:27                   ` Luc Teirlinck
2003-03-31 23:29                   ` Luc Teirlinck
2003-03-31 22:23               ` Robert J. Chassell
2003-04-01  0:28               ` Luc Teirlinck
2003-04-01 17:48                 ` Owen Taylor
2003-04-02  1:39                   ` Miles Bader
2003-04-02  2:30                   ` Luc Teirlinck
2003-04-01  9:38               ` Richard Stallman
2003-04-01 17:26                 ` Owen Taylor
2003-04-02  1:33                   ` Miles Bader
2003-04-02  3:30                     ` Luc Teirlinck
2003-04-02  3:55                       ` Miles Bader
2003-04-02  4:29                         ` Luc Teirlinck
2003-04-02  4:42                           ` Miles Bader
2003-04-02 11:07                           ` Kai Großjohann
2003-04-02 13:52                             ` Luc Teirlinck
2003-04-02 13:11                               ` Kai Großjohann
2003-04-02 14:42                                 ` Luc Teirlinck
2003-04-02 14:03                                   ` Kai Großjohann
2003-04-03 10:38                               ` Richard Stallman
2003-04-07 15:35                                 ` Owen Taylor
2003-04-07 16:57                                   ` Stefan Monnier
2003-04-07 18:30                                     ` Owen Taylor
2003-04-07 18:38                                       ` Stefan Monnier
2003-04-07 18:57                                         ` Owen Taylor
2003-04-07 19:02                                           ` Stefan Monnier
2003-04-07 19:21                                             ` Owen Taylor
2003-04-07 19:30                                               ` Stefan Monnier
2003-04-08  2:30                                   ` Richard Stallman
2003-04-08 14:56                                     ` Owen Taylor
2003-04-08 23:36                                       ` Miles Bader
2003-04-09  1:58                                       ` Richard Stallman
2003-04-09 14:46                                         ` Owen Taylor
2003-04-10  6:22                                           ` Richard Stallman
2003-04-10  6:48                                             ` Miles Bader
2003-04-11  8:51                                               ` Richard Stallman
2003-04-10 17:37                                             ` Jan D.
2003-04-11  8:51                                               ` Richard Stallman
2003-04-11 12:26                                                 ` Luc Teirlinck
2003-04-11 12:53                                                   ` Jan D.
2003-04-11 13:08                                                     ` Luc Teirlinck
2003-04-11 14:02                                                       ` Kai Großjohann
2003-04-11 14:28                                                         ` Stefan Monnier
2003-04-11 15:33                                                           ` Kai Großjohann
2003-04-12  3:02                                                             ` Luc Teirlinck
2003-04-12  8:56                                                               ` Kai Großjohann
2003-04-12 11:58                                                                 ` Miles Bader
2003-04-12 14:56                                                                 ` Luc Teirlinck
2003-04-12 14:58                                                                   ` Kai Großjohann
2003-04-13 11:22                                                                   ` Richard Stallman
2003-04-15  1:24                                                                     ` Luc Teirlinck
2003-04-15  1:31                                                                       ` Miles Bader
2003-04-15  1:42                                                                         ` Luc Teirlinck
2003-04-15  7:18                                                                       ` Kai Großjohann
2003-04-15 13:01                                                                         ` Luc Teirlinck
2003-04-16  4:39                                                                       ` Richard Stallman
2003-04-17  3:59                                                                         ` Luc Teirlinck
2003-04-17  4:09                                                                           ` Luc Teirlinck
2003-04-11 15:23                                                         ` Andreas Schwab
2003-04-11 16:30                                                           ` Kai Großjohann
2003-04-11 16:55                                                             ` Robert J. Chassell
2003-04-11 20:42                                                               ` Kai Großjohann
2003-04-11 21:33                                                                 ` Robert J. Chassell
2003-04-12  0:05                                                                 ` Miles Bader
2003-04-12  0:47                                                                   ` Luc Teirlinck
2003-04-12  2:11                                                                     ` Miles Bader
2003-04-11 16:36                                                         ` Robert J. Chassell
2003-04-11 17:07                                                           ` Kai Großjohann
2003-04-11 17:46                                                             ` Luc Teirlinck
2003-04-11 21:13                                                             ` Robert J. Chassell
2003-04-12 17:07                                                         ` Richard Stallman
2003-04-11 13:12                                                     ` Luc Teirlinck
2003-04-11 16:13                                                     ` Robert J. Chassell
2003-04-12 17:07                                                   ` Richard Stallman
2003-04-10 17:33                                     ` Jan D.
2003-04-02 12:56                           ` Robert J. Chassell
2003-04-02 14:07                           ` Stefan Monnier
2003-04-03  1:34                             ` Miles Bader
2003-04-03 15:35                               ` Stefan Monnier
2003-04-02  9:19                   ` Richard Stallman
2003-03-28 18:12         ` Jan D.
2003-03-28 22:25           ` Robert J. Chassell
2003-03-28 22:35           ` Robert J. Chassell
2003-03-29 17:06             ` Jan D.
2003-03-26 16:47 ` Richard Stallman
2003-03-26 18:32   ` Jan D.
2003-03-27 19:04     ` Richard Stallman
2003-04-01 19:29 ` Kai Großjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200303272323.h2RNNMbw031029@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).