From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Recent scroll bar warnings on Motif Date: Mon, 4 Sep 2017 12:13:06 -0700 Organization: UCLA Computer Science Department Message-ID: <7479b1c8-aafa-55ea-bdb2-4fb71b208fbf@cs.ucla.edu> References: <59ABDFAF.30906@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E7F058ACA1F0794FC520C4A8" X-Trace: blaine.gmane.org 1504552429 22345 195.159.176.226 (4 Sep 2017 19:13:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 4 Sep 2017 19:13:49 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: martin rudalics , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 04 21:13:35 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dowoG-0004e9-Mf for ged-emacs-devel@m.gmane.org; Mon, 04 Sep 2017 21:13:24 +0200 Original-Received: from localhost ([::1]:55322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dowoN-0001rl-Rt for ged-emacs-devel@m.gmane.org; Mon, 04 Sep 2017 15:13:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dowoC-0001rM-OL for emacs-devel@gnu.org; Mon, 04 Sep 2017 15:13:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dowo7-00034l-Cf for emacs-devel@gnu.org; Mon, 04 Sep 2017 15:13:20 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:52832) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dowo7-000347-2G for emacs-devel@gnu.org; Mon, 04 Sep 2017 15:13:15 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2942D1609D8; Mon, 4 Sep 2017 12:13:13 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id zLzdzqoYAVM6; Mon, 4 Sep 2017 12:13:06 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CDE741609D1; Mon, 4 Sep 2017 12:13:06 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4wV4KGWrkC7k; Mon, 4 Sep 2017 12:13:06 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.153.184.153]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A34D0160A01; Mon, 4 Sep 2017 12:13:06 -0700 (PDT) In-Reply-To: <59ABDFAF.30906@gmx.at> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217929 Archived-At: This is a multi-part message in MIME format. --------------E7F058ACA1F0794FC520C4A8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Thanks for the heads-up. I installed the attached patch, which should fix= it by=20 reverting my previous change. As the commit message suggests, underlying = bugs=20 probably lurk here. Now is not a good time to disturb them, though. --------------E7F058ACA1F0794FC520C4A8 Content-Type: text/x-patch; name="0001-Revert-recent-float-double-Motif-change.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Revert-recent-float-double-Motif-change.patch" =46rom d4c3669f9dd7a1da013c8d9d3d285fc3b67de533 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 4 Sep 2017 12:08:55 -0700 Subject: [PATCH] =3D?UTF-8?q?Revert=3D20recent=3D20float=3DE2=3D86=3D92do= uble=3D20Motif?=3D =3D?UTF-8?q?=3D20change?=3D MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Martin Rudalics in: http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00014.html * src/xterm.c (xm_scroll_callback, xaw_jump_callback) (x_set_toolkit_scroll_bar_thumb) (x_set_toolkit_horizontal_scroll_bar_thumb): Go back to using =E2=80=98float=E2=80=99 temporaries rather than =E2=80=98= double=E2=80=99. Although quite possibly this masks an underlying bug, we lack time to look into that now. --- src/xterm.c | 58 +++++++++++++++++++++++++------------------------------= --- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index a7a5206..0b94933 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5587,9 +5587,8 @@ xm_scroll_callback (Widget widget, XtPointer client= _data, XtPointer call_data) =20 if (horizontal) { - double dXM_SB_MAX =3D XM_SB_MAX; - portion =3D bar->whole * (cs->value / dXM_SB_MAX); - whole =3D bar->whole * ((XM_SB_MAX - slider_size) / dXM_SB_MAX); + portion =3D bar->whole * ((float)cs->value / XM_SB_MAX); + whole =3D bar->whole * ((float)(XM_SB_MAX - slider_size) / XM_SB_MA= X); portion =3D min (portion, whole); part =3D scroll_bar_horizontal_handle; } @@ -5726,8 +5725,8 @@ xaw_jump_callback (Widget widget, XtPointer client_= data, XtPointer call_data) { struct scroll_bar *bar =3D client_data; float *top_addr =3D call_data; - double top =3D *top_addr; - double shown; + float top =3D *top_addr; + float shown; int whole, portion, height, width; enum scroll_bar_part part; bool horizontal =3D bar->horizontal; @@ -5741,8 +5740,7 @@ xaw_jump_callback (Widget widget, XtPointer client_= data, XtPointer call_data) =20 if (shown < 1) { - double dshown =3D shown; - whole =3D bar->whole - (dshown * bar->whole); + whole =3D bar->whole - (shown * bar->whole); portion =3D min (top * bar->whole, whole); } else @@ -5763,7 +5761,7 @@ xaw_jump_callback (Widget widget, XtPointer client_= data, XtPointer call_data) whole =3D 10000000; portion =3D shown < 1 ? top * whole : 0; =20 - if (shown < 1 && (eabs (top + shown - 1) < 1.0 / height)) + if (shown < 1 && (eabs (top + shown - 1) < 1.0f / height)) /* Some derivatives of Xaw refuse to shrink the thumb when you reach the bottom, so we force the scrolling whenever we see that we're too close to the bottom (in x_set_toolkit_scroll_bar_thumb @@ -6306,8 +6304,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *= bar, int portion, int positio { struct frame *f =3D XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); Widget widget =3D SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); - double dwhole =3D whole; - double top, shown; + float top, shown; =20 block_input (); =20 @@ -6336,8 +6333,8 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *= bar, int portion, int positio top =3D 0, shown =3D 1; else { - top =3D position / dwhole; - shown =3D portion / dwhole; + top =3D (float) position / whole; + shown =3D (float) portion / whole; } =20 if (bar->dragging =3D=3D -1) @@ -6361,14 +6358,13 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar= *bar, int portion, int positio top =3D 0, shown =3D 1; else { - top =3D position / dwhole; - shown =3D portion / dwhole; + top =3D (float) position / whole; + shown =3D (float) portion / whole; } =20 { - double old_top, old_shown; + float old_top, old_shown; Dimension height; - XtVaGetValues (widget, XtNtopOfThumb, &old_top, XtNshown, &old_shown, @@ -6383,21 +6379,19 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar= *bar, int portion, int positio #if ! defined (HAVE_XAW3D) /* With Xaw, 'top' values too closer to 1.0 may cause the thumb to disappear. Fix that. */ - top =3D min (top, 0.99); + top =3D min (top, 0.99f); #endif /* Keep two pixels available for moving the thumb down. */ - shown =3D max (0, min (1 - top - (2.0 / height), shown)); + shown =3D max (0, min (1 - top - (2.0f / height), shown)); #if ! defined (HAVE_XAW3D) /* Likewise with too small 'shown'. */ - shown =3D max (shown, 0.01); + shown =3D max (shown, 0.01f); #endif =20 /* If the call to XawScrollbarSetThumb below doesn't seem to work, check that 'NARROWPROTO' is defined in src/config.h. If this is not so, most likely you need to fix configure. */ - double ftop =3D top, fshown =3D shown; - - if (ftop !=3D old_top || fshown !=3D old_shown) + if (top !=3D old_top || shown !=3D old_shown) { if (bar->dragging =3D=3D -1) XawScrollbarSetThumb (widget, top, shown); @@ -6422,15 +6416,14 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct= scroll_bar *bar, int portion, { struct frame *f =3D XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); Widget widget =3D SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); - double dwhole =3D whole; - double top, shown; + float top, shown; =20 block_input (); =20 #ifdef USE_MOTIF bar->whole =3D whole; - shown =3D portion / dwhole; - top =3D position / (dwhole - portion); + shown =3D (float) portion / whole; + top =3D (float) position / (whole - portion); { int size =3D clip_to_bounds (1, shown * XM_SB_MAX, XM_SB_MAX); int value =3D clip_to_bounds (0, top * (XM_SB_MAX - size), XM_SB_MAX= - size); @@ -6443,8 +6436,8 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct s= croll_bar *bar, int portion, top =3D 0, shown =3D 1; else { - top =3D position / dwhole; - shown =3D portion / dwhole; + top =3D (float) position / whole; + shown =3D (float) portion / whole; } =20 { @@ -6465,13 +6458,13 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct= scroll_bar *bar, int portion, #if ! defined (HAVE_XAW3D) /* With Xaw, 'top' values too closer to 1.0 may cause the thumb to disappear. Fix that. */ - top =3D min (top, 0.99); + top =3D min (top, 0.99f); #endif /* Keep two pixels available for moving the thumb down. */ - shown =3D max (0, min (1 - top - (2.0 / height), shown)); + shown =3D max (0, min (1 - top - (2.0f / height), shown)); #if ! defined (HAVE_XAW3D) /* Likewise with too small 'shown'. */ - shown =3D max (shown, 0.01); + shown =3D max (shown, 0.01f); #endif #endif =20 @@ -6480,8 +6473,7 @@ x_set_toolkit_horizontal_scroll_bar_thumb (struct s= croll_bar *bar, int portion, If this is not so, most likely you need to fix configure. */ XawScrollbarSetThumb (widget, top, shown); #if false - float ftop =3D top, fshown =3D shown; - if (ftop !=3D old_top || fshown !=3D old_shown) + if (top !=3D old_top || shown !=3D old_shown) { if (bar->dragging =3D=3D -1) XawScrollbarSetThumb (widget, top, shown); --=20 2.7.4 --------------E7F058ACA1F0794FC520C4A8--