From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: asjo@koldfront.dk (Adam =?UTF-8?Q?Sj=C3=B8gren?=) Newsgroups: gmane.emacs.bugs Subject: bug#1036: [PATCH] Add scroll-bar-adjust-thumb-portion. Date: Mon, 31 Dec 2012 02:48:01 +0100 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87r4m7uh4e.fsf@topper.koldfront.dk> References: <08F7728F-7C66-4679-B905-E548DDA0E0FA@Freenet.DE> <878v9geh6t.fsf@topper.koldfront.dk> <04F1E5FA-1248-419D-BF2D-CC695CF48C35@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1356918544 11121 80.91.229.3 (31 Dec 2012 01:49:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Dec 2012 01:49:04 +0000 (UTC) To: 1036@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 31 02:49:20 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TpUVA-0002pF-L5 for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Dec 2012 02:49:16 +0100 Original-Received: from localhost ([::1]:55755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpUUv-0002Si-VU for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Dec 2012 20:49:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpUUt-0002Sb-2O for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 20:49:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TpUUp-0005m1-Cm for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 20:48:58 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpUUp-0005lx-9P for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 20:48:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TpUVt-0004bI-SD for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 20:50:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <08F7728F-7C66-4679-B905-E548DDA0E0FA@Freenet.DE> Resent-From: asjo@koldfront.dk (Adam =?UTF-8?Q?Sj=C3=B8gren?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Dec 2012 01:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1036 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 1036-submit@debbugs.gnu.org id=B1036.135691855317617 (code B ref 1036); Mon, 31 Dec 2012 01:50:01 +0000 Original-Received: (at 1036) by debbugs.gnu.org; 31 Dec 2012 01:49:13 +0000 Original-Received: from localhost ([127.0.0.1]:37448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TpUV6-0004a5-IE for submit@debbugs.gnu.org; Sun, 30 Dec 2012 20:49:13 -0500 Original-Received: from 2505ds5-by.0.fullrate.dk ([89.150.142.116]:53735 helo=topper.koldfront.dk) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TpUV3-0004Zx-He for 1036@debbugs.gnu.org; Sun, 30 Dec 2012 20:49:11 -0500 Original-Received: by topper.koldfront.dk (Postfix, from userid 1000) id 4736F50FA6E1; Mon, 31 Dec 2012 02:48:01 +0100 (CET) OpenPGP: id=21BDE416; url=http://asjo.koldfront.dk/gpg.asc X-Now-Playing: So What, Kind Of Blue (Miles Davis) X-Hashcash: 1:21:121231:1036@debbugs.gnu.org::OZZyk/Mqs3pX9ENE:000000000000000000000000000000000000000003jrb X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97, Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69213 Archived-At: 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=F8gren + + * 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 =20 * 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, =20 adj =3D gtk_range_get_adjustment (GTK_RANGE (wscroll)); =20 - /* 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 li= kely - to resize and that looks better. */ - portion =3D WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; - /* When the thumb is at the bottom, position =3D=3D whole. - So we need to increase `whole' to make space for the thumb. */ - whole +=3D 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 =3D WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; + + /* When the thumb is at the bottom, position =3D=3D whole. + So we need to increase `whole' to make space for the thumb. = */ + whole +=3D portion; + } =20 if (whole <=3D 0) top =3D 0, shown =3D 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 =20 #ifdef USE_MOTIF =20 - /* 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 =3D WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; - /* When the thumb is at the bottom, position =3D=3D whole. - So we need to increase `whole' to make space for the thumb. */ - whole +=3D 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 upd= ate + its size, the update will often happen too late. + If you don't believe it, check out revision 1.650 of xterm.c to s= ee + what hoops we were going through and the still poor behavior we g= ot. */ + portion =3D WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; + /* When the thumb is at the bottom, position =3D=3D whole. + So we need to increase `whole' to make space for the thumb. */ + whole +=3D portion; + } =20 if (whole <=3D 0) top =3D 0, shown =3D 1; @@ -10785,6 +10788,14 @@ With MS Windows or Nextstep, the value is t. */); Vx_toolkit_scroll_bars =3D Qnil; #endif =20 + 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 =3D 1; + staticpro (&last_mouse_motion_frame); last_mouse_motion_frame =3D Qnil; =20 --=20 1.7.10.4 --=20 "Noone stops you Adam Sj=F8gren Like you stop yourself" asjo@koldfront.dk