unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
@ 2019-09-09 18:27 Matt Bisson
  2019-09-10  7:56 ` martin rudalics
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Bisson @ 2019-09-09 18:27 UTC (permalink / raw)
  To: 37359

[-- 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-09 18:27 bug#37359: [PATCH] Fix ignored Motif scrollbar resources Matt Bisson
@ 2019-09-10  7:56 ` martin rudalics
  2019-09-10 13:26   ` Matt Bisson
  0 siblings, 1 reply; 15+ messages in thread
From: martin rudalics @ 2019-09-10  7:56 UTC (permalink / raw)
  To: Matt Bisson, 37359

 > 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.

Sounds reasonable so I intend to install it.  I suppose that you have
not done any copyright assignment so I'll mark this as a tiny change.

Thanks, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-10  7:56 ` martin rudalics
@ 2019-09-10 13:26   ` Matt Bisson
  2019-09-10 20:25     ` martin rudalics
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Bisson @ 2019-09-10 13:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: 37359

> I suppose that you have not done any copyright assignment so I'll mark this as a tiny change.

From the copyright assignment page, it seems reasonable to call this a tiny change, so I didn't do the assignment:

> We can accept small changes (roughly, fewer than 15 lines) without an assignment. This is a cumulative limit (e.g., three separate 5 line patches) over all your contributions.

If you prefer, I can go through that process as well.  Whatever is easier.

> Sounds reasonable so I intend to install it.

When you say "install" do you mean you are going to test it, and I should push to the repo (which I am completely willing to do), or do you mean you are going to commit the patch when ready?  (The patch is against the emacs-26 branch, btw.)

Thanks,
-Matt

----- Original Message -----
From: "martin rudalics" <rudalics@gmx.at>
To: "mbisson" <mbisson@ccs.neu.edu>, 37359@debbugs.gnu.org
Sent: Tuesday, September 10, 2019 3:56:03 AM
Subject: Re: bug#37359: [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.

Sounds reasonable so I intend to install it.  I suppose that you have
not done any copyright assignment so I'll mark this as a tiny change.

Thanks, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-10 13:26   ` Matt Bisson
@ 2019-09-10 20:25     ` martin rudalics
  2019-09-10 20:35       ` Matt Bisson
  2019-09-17 15:41       ` Matt Bisson
  0 siblings, 2 replies; 15+ messages in thread
From: martin rudalics @ 2019-09-10 20:25 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359

 > If you prefer, I can go through that process as well.  Whatever is easier.

I obviously prefer that you go through that process so we can accept
your future changes (resolving the "*XmScrollBar*troughColor" issue,
for instance).  But it's not necessary for the change at hand.

 > When you say "install" do you mean you are going to test it, and I
 > should push to the repo (which I am completely willing to do), or do
 > you mean you are going to commit the patch when ready?  (The patch
 > is against the emacs-26 branch, btw.)

I have tested it on current master (Motif 2.3.4) and will commit it
there.  It would be nice though if you provided a ChangeLog entry.

TIA, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-10 20:25     ` martin rudalics
@ 2019-09-10 20:35       ` Matt Bisson
  2019-09-16 20:00         ` Glenn Morris
  2019-09-17 15:41       ` Matt Bisson
  1 sibling, 1 reply; 15+ messages in thread
From: Matt Bisson @ 2019-09-10 20:35 UTC (permalink / raw)
  To: martin rudalics; +Cc: 37359

Good point (about the ChangeLog).  Let me update that, and get the necessary legal items taken care of, and get back to you.  It will be a few days probably, so hopefully nobody is desperate for the fix. ;-D

Thanks,
-Matt

----- Original Message -----
From: "martin rudalics" <rudalics@gmx.at>
To: "mbisson" <mbisson@ccs.neu.edu>
Cc: 37359@debbugs.gnu.org
Sent: Tuesday, September 10, 2019 4:25:18 PM
Subject: Re: bug#37359: [PATCH] Fix ignored Motif scrollbar resources.

> If you prefer, I can go through that process as well.  Whatever is easier.

I obviously prefer that you go through that process so we can accept
your future changes (resolving the "*XmScrollBar*troughColor" issue,
for instance).  But it's not necessary for the change at hand.

 > When you say "install" do you mean you are going to test it, and I
 > should push to the repo (which I am completely willing to do), or do
 > you mean you are going to commit the patch when ready?  (The patch
 > is against the emacs-26 branch, btw.)

I have tested it on current master (Motif 2.3.4) and will commit it
there.  It would be nice though if you provided a ChangeLog entry.

TIA, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-10 20:35       ` Matt Bisson
@ 2019-09-16 20:00         ` Glenn Morris
  2019-09-16 20:14           ` Matt Bisson
  0 siblings, 1 reply; 15+ messages in thread
From: Glenn Morris @ 2019-09-16 20:00 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359


Not related to your report in any way, but the Motif version of Emacs is
very rarely used. Could you say why you use it?






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-16 20:00         ` Glenn Morris
@ 2019-09-16 20:14           ` Matt Bisson
  2019-09-17  1:13             ` Glenn Morris
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Bisson @ 2019-09-16 20:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 37359

A few reasons:
1) I like it. :)
2) I'm warded away from GTK because of the very long-standing bug in the toolkit that results in core files when I use --daemon.
3) I've been doing some work on CDE, which of course tightly integrates with Motif.

Cheers,
-Matt

PS: I'm still waiting to hear back from the copyright-assign mailing list about my filing, so it will be a little bit longer yet.

----- Original Message -----
From: "Glenn Morris" <rgm@gnu.org>
To: "mbisson" <mbisson@ccs.neu.edu>
Cc: "martin rudalics" <rudalics@gmx.at>, 37359@debbugs.gnu.org
Sent: Monday, September 16, 2019 4:00:28 PM
Subject: Re: bug#37359: [PATCH] Fix ignored Motif scrollbar resources.

Not related to your report in any way, but the Motif version of Emacs is
very rarely used. Could you say why you use it?





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-16 20:14           ` Matt Bisson
@ 2019-09-17  1:13             ` Glenn Morris
  0 siblings, 0 replies; 15+ messages in thread
From: Glenn Morris @ 2019-09-17  1:13 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359

Matt Bisson wrote:

> 2) I'm warded away from GTK because of the very long-standing bug in
> the toolkit that results in core files when I use --daemon.

(FWIW, the more common solution for this is the Lucid/Athena toolkit version.)

> 3) I've been doing some work on CDE, which of course tightly
> integrates with Motif.

Thanks, I might try out CDE to see if it looks like I remember from back
in the day! :)





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-10 20:25     ` martin rudalics
  2019-09-10 20:35       ` Matt Bisson
@ 2019-09-17 15:41       ` Matt Bisson
  2019-09-17 15:55         ` Eli Zaretskii
                           ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Matt Bisson @ 2019-09-17 15:41 UTC (permalink / raw)
  To: martin rudalics; +Cc: 37359

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

I have filed the legal copyright transfer paperwork, but this takes time, and I was told to go ahead and update the patches without it, so I've updated the patch (mostly the commit description), and I'm attaching a ChangeLog file here as requested.

Would it be possible to back-port this into an earlier version of Emacs than ToT (my patch was done against the emacs-26 branch)?  Just curious.

Cheers,
-Matt

----- Original Message -----
From: "martin rudalics" <rudalics@gmx.at>
To: "mbisson" <mbisson@ccs.neu.edu>
Cc: 37359@debbugs.gnu.org
Sent: Tuesday, September 10, 2019 4:25:18 PM
Subject: Re: bug#37359: [PATCH] Fix ignored Motif scrollbar resources.

> If you prefer, I can go through that process as well.  Whatever is easier.

I obviously prefer that you go through that process so we can accept
your future changes (resolving the "*XmScrollBar*troughColor" issue,
for instance).  But it's not necessary for the change at hand.

 > When you say "install" do you mean you are going to test it, and I
 > should push to the repo (which I am completely willing to do), or do
 > you mean you are going to commit the patch when ready?  (The patch
 > is against the emacs-26 branch, btw.)

I have tested it on current master (Motif 2.3.4) and will commit it
there.  It would be nice though if you provided a ChangeLog entry.

TIA, martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ChangeLog --]
[-- Type: text/x-changelog; name=ChangeLog, Size: 498 bytes --]

2019-09-17  Matt Bisson  <mbisson@mbisson-devd1>

	Fix ignored Motif scrollbar resources

	* src/xterm.c (x_create_toolkit_scroll_bar): On Motif scrollbars,
	"foreground" has no meaning, while "background" means the truck and
	arrow colors, and "trough" means the background of the entire widget
	(bug#37359) 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.

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

From 6168bbca7e471447f84e3de1a9fa6fbabcc9a962 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

* src/xterm.c (x_create_toolkit_scroll_bar): On Motif scrollbars,
"foreground" has no meaning, while "background" means the truck and
arrow colors, and "trough" means the background of the entire widget
(bug#37359) 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  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
  2 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2019-09-17 15:55 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359

> Date: Tue, 17 Sep 2019 11:41:56 -0400 (EDT)
> From: Matt Bisson <mbisson@ccs.neu.edu>
> Cc: 37359@debbugs.gnu.org
> 
> Would it be possible to back-port this into an earlier version of Emacs than ToT (my patch was done against the emacs-26 branch)?  Just curious.

We could back-port it, but it makes little sense, since we don't plan
to have any further releases from the emacs-26 branch.

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  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
  2 siblings, 0 replies; 15+ messages in thread
From: martin rudalics @ 2019-09-18  7:46 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359

 > I have filed the legal copyright transfer paperwork, but this takes
 > time, and I was told to go ahead and update the patches without it,
 > so I've updated the patch (mostly the commit description), and I'm
 > attaching a ChangeLog file here as requested.

Thanks.  I'll install this as soon as I'm able to build Emacs again.

martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  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
  2 siblings, 1 reply; 15+ messages in thread
From: martin rudalics @ 2019-09-19  8:16 UTC (permalink / raw)
  To: Matt Bisson; +Cc: 37359

 > I have filed the legal copyright transfer paperwork, but this takes
 > time, and I was told to go ahead and update the patches without it,
 > so I've updated the patch (mostly the commit description), and I'm
 > attaching a ChangeLog file here as requested.

Installed.  Just that I completely missed the fact that a similar
change would be now required for horizontal scroll bars as well.  Can
you please provide one.

Thanks, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-09-19  8:16         ` martin rudalics
@ 2019-10-07  4:54           ` Lars Ingebrigtsen
  2019-10-07  9:26             ` martin rudalics
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-07  4:54 UTC (permalink / raw)
  To: martin rudalics; +Cc: 37359, Matt Bisson

martin rudalics <rudalics@gmx.at> writes:

> Installed.  Just that I completely missed the fact that a similar
> change would be now required for horizontal scroll bars as well.  Can
> you please provide one.

That was a couple of weeks ago, so I just cargo-culted the vertical
scroll bar changes to the horizontal ones, and it seems to work fine.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-10-07  4:54           ` Lars Ingebrigtsen
@ 2019-10-07  9:26             ` martin rudalics
  2019-10-07 13:27               ` Matt Bisson
  0 siblings, 1 reply; 15+ messages in thread
From: martin rudalics @ 2019-10-07  9:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37359, Matt Bisson

> That was a couple of weeks ago, so I just cargo-culted the vertical
> scroll bar changes to the horizontal ones, and it seems to work fine.

Thanks, martin







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#37359: [PATCH] Fix ignored Motif scrollbar resources.
  2019-10-07  9:26             ` martin rudalics
@ 2019-10-07 13:27               ` Matt Bisson
  0 siblings, 0 replies; 15+ messages in thread
From: Matt Bisson @ 2019-10-07 13:27 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lars Ingebrigtsen, 37359

Sorry, I didn't get back to this in time -- work has been hectic of late!  Thanks for fixing this.

----- Original Message -----
From: "martin rudalics" <rudalics@gmx.at>
To: "Lars Ingebrigtsen" <larsi@gnus.org>
Cc: "mbisson" <mbisson@ccs.neu.edu>, 37359@debbugs.gnu.org
Sent: Monday, October 7, 2019 5:26:29 AM
Subject: Re: bug#37359: [PATCH] Fix ignored Motif scrollbar resources.

> That was a couple of weeks ago, so I just cargo-culted the vertical
> scroll bar changes to the horizontal ones, and it seems to work fine.

Thanks, martin





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-10-07 13:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 18:27 bug#37359: [PATCH] Fix ignored Motif scrollbar resources Matt Bisson
2019-09-10  7:56 ` 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

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).