From: asjo@koldfront.dk (Adam Sjøgren)
To: 1036@debbugs.gnu.org
Subject: bug#1036: [PATCH] Add scroll-bar-adjust-thumb-portion.
Date: Mon, 31 Dec 2012 02:48:01 +0100 [thread overview]
Message-ID: <87r4m7uh4e.fsf@topper.koldfront.dk> (raw)
In-Reply-To: <08F7728F-7C66-4679-B905-E548DDA0E0FA@Freenet.DE>
On Mon, 03 Dec 2012 12:22:11 -0500, Stefan wrote:
>> If we are to provide a user option for this, we should do it for all
>> toolkits.
> Yes, we should do that (and share more of the code, as well).
Here is a new patch that handles both toolskits that use the "* 30"
method.
Let me know what else I can do to move this forward.
Thanks!
Adam
---
src/ChangeLog | 9 +++++++++
src/gtkutil.c | 18 +++++++++++-------
src/xterm.c | 41 ++++++++++++++++++++++++++---------------
3 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 08b0a59..d653cb5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2012-12-31 Adam Sjøgren <asjo@koldfront.dk>
+
+ * xterm.c (scroll-bar-adjust-thumb-portion): New variable to
+ determine whether scroll bar thumb size should be adjusted or
+ not. Use variable for MOTIF.
+
+ * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for
+ GTK.
+
2012-12-30 Paul Eggert <eggert@cs.ucla.edu>
* coding.c (Qmac): Now static.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 7b05cff..ba532c2 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3795,13 +3795,17 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
- /* We do the same as for MOTIF in xterm.c, assume 30 chars per line
- rather than the real portion value. This makes the thumb less likely
- to resize and that looks better. */
- portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 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 (scroll_bar_adjust_thumb_portion_p)
+ {
+ /* We do the same as for MOTIF in xterm.c, use 30 chars per
+ line rather than the real portion value. This makes the
+ thumb less likely to resize and that looks better. */
+ portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 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;
diff --git a/src/xterm.c b/src/xterm.c
index 374b628..446565a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4803,21 +4803,24 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
#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 = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 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 (scroll_bar_adjust_thumb_portion_p)
+ {
+ /* 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 = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 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;
@@ -10785,6 +10788,14 @@ With MS Windows or Nextstep, the value is t. */);
Vx_toolkit_scroll_bars = Qnil;
#endif
+ DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
+ scroll_bar_adjust_thumb_portion_p,
+ doc: /* Non-nil means adjust the thumb in the
+scroll bar to be less likely to resize which looks better.
+Set to nil if you want the thumb to fill the whole scroll bar
+when the entire buffer is visible. */);
+ scroll_bar_adjust_thumb_portion_p = 1;
+
staticpro (&last_mouse_motion_frame);
last_mouse_motion_frame = Qnil;
--
1.7.10.4
--
"Noone stops you Adam Sjøgren
Like you stop yourself" asjo@koldfront.dk
next prev parent reply other threads:[~2012-12-31 1:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 21:05 bug#1036: 23.0.60; GTK+ scroll-bars don't show relation of viewport to whole buffer Peter Dyballa
2008-09-28 1:17 ` Stefan Monnier
2012-12-02 13:07 ` bug#1036: [PATCH] * xterm.c (gtk-scroll-bar-adjust-thumb-portion): New variable to determine whether gtk scroll bar thumb size should be adjusted or not. * gtkutil.c (gtk-scroll-bar-adjust-thumb-portion): Use variable Adam Sjøgren
2012-12-02 20:51 ` Jan Djärv
2012-12-03 17:22 ` Stefan Monnier
2012-12-31 1:48 ` Adam Sjøgren [this message]
2013-01-04 13:46 ` bug#1036: [PATCH] Add scroll-bar-adjust-thumb-portion Jan D.
2013-01-04 19:15 ` Glenn Morris
2013-01-04 19:27 ` bug#1036: " Adam Sjøgren
2013-01-13 15:57 ` Jan Djärv
2013-01-13 15:58 ` Jan Djärv
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=87r4m7uh4e.fsf@topper.koldfront.dk \
--to=asjo@koldfront.dk \
--cc=1036@debbugs.gnu.org \
/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).