unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Bisson <mbisson@ccs.neu.edu>
To: 37359@debbugs.gnu.org
Subject: bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
Date: Mon, 9 Sep 2019 14:27:07 -0400 (EDT)	[thread overview]
Message-ID: <581256029.1395514.1568053627475.JavaMail.zimbra@zimbra.ccs.neu.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

Hi Emacs maintainers,

I noticed that I was only able to set the "truck" color for scrollbars on Motif.  I tried a variety of methods, including explicitly setting resources for the scrollbar class as documented by the libXm API, and using foreground and background faces, but to no avail.  After looking at the code in src/xterm.c, I noticed that the creation code was not quite correct, so I patched the code (attached):

On Motif scrollbars, "foreground" has no meaning, while "background" means the truck and arrow colors, and "trough" means the background of the entire widget.  I have hooked up the Emacs scrollbar "foreground" color to the XmNbackground resource, and the "background" color to XmNtroughColor.  This is more in line with how Xaw scrollbars behave.

I am still a little flummoxed as to why the more sweeping resource settings like "*XmScrollBar*troughColor" seem to have no effect, but that's an issue for another day, and I may look into it further as I have time.

My Emacs environment is 26.3 (but I noticed this code has been like this a long time) running on 64-bit Linux (Gentoo).  The Motif version is 2.3.8.

Thanks,
-Matt

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-ignored-Motif-scrollbar-resources.patch --]
[-- Type: text/x-patch; name=0001-Fix-ignored-Motif-scrollbar-resources.patch, Size: 1448 bytes --]

From 60cf87f9fc6104ae44c31125b2f5050cb31b9e4a Mon Sep 17 00:00:00 2001
From: Matt Bisson <mbisson@vmware.com>
Date: Mon, 9 Sep 2019 10:46:20 -0400
Subject: [PATCH] Fix ignored Motif scrollbar resources.

On Motif scrollbars, "foreground" has no meaning, while "background"
means the truck and arrow colors, and "trough" means the background of
the entire widget.  I have hooked up the Emacs scrollbar "foreground"
color to the XmNbackground resource, and the "background" color to
XmNtroughColor.  This is more in line with how Xaw scrollbars behave.
---
 src/xterm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 3cadf69380..70e45a964b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5925,17 +5925,19 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
   XtSetArg (av[ac], XmNincrement, 1); ++ac;
   XtSetArg (av[ac], XmNpageIncrement, 1); ++ac;
 
+  /* Note: "background" is the thumb color, and "trough" is the color behind
+     everything. */
   pixel = f->output_data.x->scroll_bar_foreground_pixel;
   if (pixel != -1)
     {
-      XtSetArg (av[ac], XmNforeground, pixel);
+      XtSetArg (av[ac], XmNbackground, pixel);
       ++ac;
     }
 
   pixel = f->output_data.x->scroll_bar_background_pixel;
   if (pixel != -1)
     {
-      XtSetArg (av[ac], XmNbackground, pixel);
+      XtSetArg (av[ac], XmNtroughColor, pixel);
       ++ac;
     }
 
-- 
2.23.0


             reply	other threads:[~2019-09-09 18:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 18:27 Matt Bisson [this message]
2019-09-10  7:56 ` bug#37359: [PATCH] Fix ignored Motif scrollbar resources martin rudalics
2019-09-10 13:26   ` Matt Bisson
2019-09-10 20:25     ` martin rudalics
2019-09-10 20:35       ` Matt Bisson
2019-09-16 20:00         ` Glenn Morris
2019-09-16 20:14           ` Matt Bisson
2019-09-17  1:13             ` Glenn Morris
2019-09-17 15:41       ` Matt Bisson
2019-09-17 15:55         ` Eli Zaretskii
2019-09-18  7:46         ` martin rudalics
2019-09-19  8:16         ` martin rudalics
2019-10-07  4:54           ` Lars Ingebrigtsen
2019-10-07  9:26             ` martin rudalics
2019-10-07 13:27               ` Matt Bisson

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=581256029.1395514.1568053627475.JavaMail.zimbra@zimbra.ccs.neu.edu \
    --to=mbisson@ccs.neu.edu \
    --cc=37359@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).