Subject: bug#32975: Emacs 26.1; GTK Warnings

From: Robert Pluim <[email-masked]>
Date: Thu, 11 Oct 2018 14:26:38 +0200

martin rudalics <[email-masked]> writes:

>> There is only one call to xg_set_background_color, from xfns.c, which looks
>> like this with my patch applied:
>>
>> #ifdef USE_TOOLKIT_SCROLL_BARS
>> # ifdef USE_GTK
>>        xg_set_background_color (f, bg);
>> # endif
>> #else
>>
>> So it will only ever happen when the scrollbars are GTK widgets.
>
> But this effectively throws out the baby - painting the background of
> the frame widget proper via
>
>       xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f));
>
> with the bathwater - painting the background of non-existent scroll
> bar widgets via
>
>           xg_set_widget_bg (f, webox, FRAME_BACKGROUND_PIXEL (f));
>
> for GTK builds with native Emacs scroll bars.

Iʼm being particularly dense today: youʼre right. How about moving the
check for USE_TOOLKIT_SCROLL_BARS down into xg_set_background_color
like so (which I think was your original suggestion):

diff --git i/src/gtkutil.c w/src/gtkutil.c
index 6b72671da9..5879ab683e 100644
--- i/src/gtkutil.c
+++ w/src/gtkutil.c
@@ -1498,6 +1498,7 @@ xg_set_background_color (struct frame *f, unsigned long bg)
       block_input ();
       xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f));
 
+#ifdef USE_TOOLKIT_SCROLL_BARS
       Lisp_Object bar;
       for (bar = FRAME_SCROLL_BARS (f);
            !NILP (bar);
@@ -1508,7 +1509,7 @@ xg_set_background_color (struct frame *f, unsigned long bg)
           GtkWidget *webox = gtk_widget_get_parent (scrollbar);
           xg_set_widget_bg (f, webox, FRAME_BACKGROUND_PIXEL (f));
         }
-
+#endif
       unblock_input ();
     }
 }