Subject: bug#20182: 24.4.91; [GTK3] Vertical scroll bar is "indented" from right edge of frame

From: [email-masked] (N. Jackson)
Date: Tue, 24 Mar 2015 18:06:14 -0300

I forgot to copy Martin on the message below (didn't reply widely
enough I guess). Sorry.

Also, I need to amend one thing I wrote (see below).

At 17:39 -0300 on Tuesday 2015-03-24, N. Jackson wrote:

> At 13:16 -0300 on Tuesday 2015-03-24, Jan D. wrote:
>
>>> 24 mar 2015 kl. 11:51 skrev martin rudalics <[email-masked]>:
>>> 
>>> > 16 was the hardcoded width for Gtk2.
>>> 
>>> Does that mean gtk_widget_style_get is broken for Gtk2?
>>
>> It means that the width it returns is 16.
>>
>>> 
>>> > You can #ifdef it.
>>> 
>>> Like
>>> 
>>> #if (! GTK_CHECK_VERSION (3, 0, 0)
>>>  if (w < 16) w = 16;
>>> #endif
>>> 
>>
>> Yes, or 
>> #ifndef HAVE_GTK3
>> ...
>>
>> 	Jan D.
>
> Of course, if gtk_widget_style_get() only returns 16 when the GDK
> version is not GDK3, then this line
>
>     if (w < 16) w = 16;
>
> in update_theme_scrollbar_width() of gtkutil.c does nothing when the
> GDK version is not GDK3.
>
> Since we don't need this adjustment with GDK3 (with which
> gtk_widget_style_get() returns the correct value from the toolkit), I
> replaced the offending line with
>
>     #ifndef HAVE_GTK3
>         /*  if (w < 16) w = 16; */
>         eassert (w == 16); 
>     #endif 
>
> and this seems to fix the bug for me. (Of course, removing the offending
> line altogether has the same effect.)

It would need to be

        eassert (w >= 16); 
                   ^
because of the

    w += 2*b;

line. [In my opinion it is a terrible idea to have a variable change its
semantics like this in the middle of a function -- it invitably leads to
mistakes.]

> I don't have a GTK2 system to test on, though.
>
> Note: The badness is somehow encoded in my desktop file as well, so to
> see that the fix was working I had to rename my desktop file or run with
> emacs --no-desktop.