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

From: "Jan D." <[email-masked]>
Date: Tue, 24 Mar 2015 22:38:13 +0100

Hi.

> 24 mar 2015 kl. 21:39 skrev N. Jackson <[email-masked]>:
> 
> 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.)

You have added an assert that is dependent on how non-Emacs code behaves. That is wrong in all possible ways.

> 
> I don't have a GTK2 system to test on, though.

If you are adding asserts, you should be sure that all Gtk+ 2 versions behaves like this, which includes all patched versions that are used by distributions. 

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