Subject: Re: bug#32975: Emacs 26.1; GTK Warnings

From: Robert Pluim <[email-masked]>
Date: Thu, 11 Oct 2018 09:35:57 +0200

Robert Pluim <[email-masked]> writes:

> Tjernlund <[email-masked]> writes:
>
>> X11
>>
>> I now did some more test and found that (require 'ecb) is also needed.
>
> With that I can reproduce it. '--without-toolkit-scroll-bars' is
> required, which narrows down the potential source a lot.
>

So I donʼt think we should be calling GTK functions on scrollbars that
are not GTK widgets (Iʼm stunned we've never seen this before). This
fixes it for me. Martin?

diff --git a/src/xfns.c b/src/xfns.c
index 1381fee57e..4fad01a68e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1085,12 +1085,13 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
       XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg);
       XSetForeground (dpy, x->cursor_gc, bg);
 
-#ifdef USE_GTK
+#ifdef USE_TOOLKIT_SCROLL_BARS
+# ifdef USE_GTK
       xg_set_background_color (f, bg);
-#endif
-
-#ifndef USE_TOOLKIT_SCROLL_BARS /* Turns out to be annoying with
-				   toolkit scroll bars.  */
+# endif
+#else
+/* Turns out to be annoying with toolkit scroll bars, so only set the
+   background for non-toolkit.  */
       {
 	Lisp_Object bar;
 	for (bar = FRAME_SCROLL_BARS (f);