Subject: Re: bug#28605: 26.0.60; Part of leftmost character hidden

From: Ola Nilsson <[email-masked]>
Date: Tue, 3 Oct 2017 14:12:26 +0200

On Tue, Oct 3, 2017 at 11:15 AM, martin rudalics <[email-masked]> wrote:
>> If the frame contains three side-by-side windows and scroll bars on
>> the right I expect to see (from left to right):
>>
>> frame border
>> left fringe for window one
>> window one
>> right fringe for window one
>> scroll bar for window one
>> right fringe for window two
>> window two
>> left fringe for window two
>> scroll bar for window two
>> right fringe for window three
>> window three
>> left fringe  for window three
>> scroll bar for window three
>> frame border
>>
>> Of all the fringes, only the left fringe of window one is visible.
>> Using scroll bars on the left, only the right fringe of window three
>> is visible.
>> In both cases, characters that are next to non-visible/hidden fringes
>> are partially hidden.
>> I'm attaching two screenshots that should show this.
>
> Thanks for the details.  From your initial screenshot it was not clear
> to me that the effect is really that bad.
>
>> I bit the bullet and did a git bisect:
>>
>> 36cf0791ba75ee16dfbedfe437567ec6dd945b8a is the first bad commit
>> commit 36cf0791ba75ee16dfbedfe437567ec6dd945b8a
>> Author: Lars Ingebrigtsen <[email-masked]>
>> Date:   Sun Jul 16 16:50:57 2017 +0200
>>      Remove usage of the GDK_SCALE variable
>>
>>      * src/gtkutil.c (xg_get_gdk_scale): Remove.
>>      (xg_get_default_scrollbar_height)
>>      (xg_get_default_scrollbar_width): Pass in a frame to check for
>>      scaling.
>>      (xg_frame_set_char_size): Use the API for querying scale
>>      instead of looking at the GDK_SCALE variable.
>>      (xg_get_default_scrollbar_width): Ditto.
>>      (xg_get_default_scrollbar_height): Ditto.
>>      (xg_update_scrollbar_pos): Ditto.
>>
>>      * src/xfns.c (x_set_scroll_bar_default_height): Pass in the
>>      frame to get the width.
>
> Great.  Lars, how should we proceed from here?
>
> (1) Revert that commit.
>
> (2) Revert the call of gtk_widget_get_scale_factor only.
>
> (3) Try to fix the build with your change in place.
>
> (4) Provide some option so that users can either use your approach or
>     Jan's.  The default should prefer Jan's setup to avoid that users
>     like Ola have to go through this again.
>
>> I also played with the dividers and horizontal scroll bars.
>>
>> The horizontal scroll bars are not visibla at all with scaling on.
>
> Apparently, the horizontal scroll bar code does not handle scaling.  If
> we fix the current problem, maybe you could help me fix that one too.
>
>> Dividers on the right fixed the hidden character problem but not the
>> hidden fringes,
>
> Yes.  IMHO it's because the scroll bar clearing code hides the dividers
> instead of the text.  If you customize dividers to a sufficiently large
> width you should be able to make the entire text visible and even parts
> of the dividers (on the left side of a window, only - the right sides
> will remain obscured as before).
>
>> I attach some screenshots of this as well.
>
> Very informative, thanks.  One thing that stupefies me about these
> screenshots is that the menu and toolbar items are smaller in
> horizontal-scrollbars-no-dividers.png than in with-hidpi-scaling.png.
>
>> This is with emacs -Q --no-x-resources, dividers off, horizontal
>> scrollbars off.
>>
>> frame pixel: 2034 x 466   cols/lines: 226 x 25   units: 9 x 18
> [...]
>> height header-line: 0  mode-line: 0  divider: 0
>
> All these values are completely as expected so the problem must be
> confined to this x_clear_area call in xg_update_scrollbar_pos in
> gtkutil.c
>
>           /* Clear under old scroll bar position.  */
>           oldw += (scale - 1) * oldw;
>           oldx -= (scale - 1) * oldw;
>           x_clear_area (f, oldx, oldy, oldw, oldh);
>
> where the value of scale is now obtained via
>
>       int scale = xg_get_scale (f);
>
> If you replace the latter by the old
>
>       int scale = xg_get_gdk_scale ();
>
> does your problem go away?  If so, then it would be interesting how the
> values returned by xg_get_scale differ with gtk_widget_get_scale_factor
> and xg_get_gdk_scale called.

Made no difference what I can see, except a lot of messages :

(emacs:2302): Gtk-CRITICAL **: gtk_distribute_natural_allocation:
assertion 'extra_space >= 0' failed

I tested with dividers and horizontal scrollbars with the same results
as before.

-- 
Ola Nilsson