Subject: Re: bug#32002: 24.4; Scroll bar start, end not correct

From: martin rudalics <[email-masked]>
Date: Mon, 09 Jul 2018 10:34:35 +0200

> To clarify: this was after I managed to get the steppers to appear and I
 > clicked on the up-stepper.

Does the slider of a one-line window's scroll bar also expand into the
other window's scroll bar when you remove the steppers?

 > If I click in the whitespace that I mentioned (no steppers, no slider),
 > nothing happens (the breakpoint is not triggered).
 >> M-: (setq window-min-height 1) RET
 >> C-x 2
 >> M-: (window-resize nil (- 2 (window-height))) RET
 >>
 >> This should get you a one-line window on top of the frame.  Here this
 >> window has just two small stepper buttons and no slider.  Hopefully,
 >> yours is the same.
 >
 > Unfortunately, not.  I initially get whitespace where the scrollbar
 > should be.

Hmmm...  yes.  With GTK the scroll bar is not drawn when the minimum
slider height exceeds the window height.

 > If I change the theme a few times, I eventually get stepper
 > buttons, but the slider is included, and it all extends down into the
 > second window (see attached).  (This is with the emacs-26 branch, built
 > July 4.)

Good catch!  Apparently, our default value for the minimum height of
windows usually prevents people from seeing this.  Obviously

xg_update_scrollbar_pos (struct frame *f,
                          ptrdiff_t scrollbar_id,
                          int top,
                          int left,
                          int width,
                          int height)
[...]			
       gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL);
       bool hidden = height < msl;

is not TRT because we do not account for the sizes of the steppers
when deciding whether 'hidden' should be set.  So we would have to ask
how many steppers are present for the scroll bar in the current theme,
guess their sizes (how?) and fix the test accordingly - maybe applying
scaling as well.  I doubt it's worth the trouble because apparently
GTK intends to remove or completely rework the style stuff sooner or
later anyway.

 > Let me know if I messed something up or there is additional data you
 > need.

You did it all right.  Unfortunately, the experiment failed to find
out why you get GTK_SCROLL_JUMP events when hitting a stepper.

Is scaling at work?  When debugging xg_update_scrollbar_pos what is
the value of 'scale' after doing

       int scale = xg_get_scale (f);

One more question: Can you get a GTK_SCROLL_STEP event when the slider
is in the middle of the scroll bar such that there remains some space
between slider and the stepper buttons.  Might be the sensitivity type
of stepper arrows hurts us here.

Thanks for the experiments, martin