When porting textlayout to GTK 4 a line display cache was introduced. That
cache creates a situation where you may not create GtkTextLineDisplay in
order from GtkTextLineSegment.
Because of that, we must start the creation of each line display from
fresh line state or we could re-apply the GtkTextAppearance of another
row. However, once you do that, one_style_cache will never have a match
and therefore is pure overhead.
This removes one_style_cache altogether.
Fixes: #7108
We create the GtkKineticScrolling with the known overshoot_width but then
fail to use it (and instead a hardcoded value) during tick calculation.
This fixes that, which will also be necessary if we enable scrolled
overshooting.
Instead of accumulating a series of doubles, use the actual computed frame
time for duration tracking. While there is extremely low chance of
aliasing with animations under a few seconds, this just ensures we're
using the same clocking inside and outside of GtkKineticScrolling.
Call gdk_ensure_initialized() directly in gdk_display_open_default(),
gdk_display_open(), gdk_x11_display_open() and gdk_display_get_default(),
so we get the right function name in the error message. These functions
are likely candidates that people might call without ensuring that GDK is
initialized.
Don't allow to create displays before gdk has been initialized.
Note that this error triggers in nautilus 47.0, but we consider
what it is doing unsupported and broken.
Related: #7035
Check if GTK has been initialized before trying to get a display
in a class_init function. The introspection property dumper code
will instantiate all types and run into the new introduced errors
if we try to get a display in class_init.
... and simplify what's actually going on.
ABS (n_rows - n) < ABS ((n_rows - height) - (n + height))
Those values are all unsigned, so this is equivalent to
n_rows - n < (n_rows - height) - (n + height)
The math on the right is confusing but can be rearranged:
n_rows - n < n_rows - n - 2 * height
With x = n_rows - n, this simplifies to:
x < x - 2 * height
Which is only true if it underflows, ie if
x < 2 * height
Resubstituting the old values gives:
n_rows - n < 2 * height
Which is the value I used.
for reverse-element lookup.
Because our indices are always unsigned, we need to take special care
to not trigger compiler warnings when doing negative array indexing.
And yes, for now "0 - x" is good enough.
Both numbers are unsigned, so the result is always unsigned.
(Which also means ABS() doing a < 0 check doesn't work.)
And that in particular means that end - begin overflows to a very
large number when begin > end.