Commit Graph

79111 Commits

Author SHA1 Message Date
António Fernandes
b05000d8bd listitemmanager: Remove section when adding at its end
We are failing to go from this:

    [ BLUE ] [ RED ]

...to this:

    [ BLUE GREEN YELLOW ] [ RED ]

...where '[' and ']' represent section header and footer.

Instead, the result is...

    [ BLUE ] [ GREEN YELLOW ] [ RED ]

... despite the first 3 items belonging to the same section according
to the section model. This leaves the view in an inconsistent state
and, ultimately, to crashes the non-removed footer.

Indeed, when receiving items-changed(1,0,2), we call `append_items()`
which inserts a new tile before the tile at `1` (which was RED), and
then notices there is a HEADER right befo-re it, so it flags both it
and the corresponding FOOTER as unmatched:

    [ BLUE ] ( GREEN-YELLOW RED )

... where '(' and ')' represent unmatched header and footer.

Problem is subsequent code in `release_items()` doesn't even touch
the section boundary footer-header pair ('] ('), because they are
belong in the tracked interval (visible items). And `ensure_items()`
proceeds to match the header with a new footer, producing the result
described above.

To handle this correctly, `append_items()` must delete the section
boundary, and flag as unmatched both the HEADER of the section before
and the FOOTER of section after (whose respective footer and header
has been marked for removal):

    ( BLUE . . GREEN-YELLOW RED )

... where '.' represents tiles marked for removal.

This way, `release_items()` will release the removed footer-header
section boundary, and `ensure_items()` is going to reinstate new
section remove the section boundary at the correct place, resulting
in the expected behavior:

    [ BLUE GREEN YELLOW ] [ RED ]
2024-01-25 17:22:32 +00:00
António Fernandes
4b45adaf39 testsuite: Test inserting items at sections
We are not catching bugs when inserting if we're right at a boundary.

This because we never add or remove items from a section. We only ever
add or remove whole sections.

Introduce a test which inserts items at a random position inside of a
section.
2024-01-25 17:16:00 +00:00
Maximiliano Sandoval
6f2d33369b
docs: Add favicons
Requires gi-docgen main.
2024-01-25 17:06:24 +01:00
Matthias Clasen
e08727fa47 Merge branch 'gpu-cache-stats' into 'main'
gpu: cache eviction

Closes #6346

See merge request GNOME/gtk!6784
2024-01-25 15:08:36 +00:00
Matthias Clasen
7624e6621a gpu: Add profiler marks around cache gc 2024-01-25 09:41:49 -05:00
Matthias Clasen
cdddb6cb96 gpu: Print more detailed cache statistics
Print out stale glyphs and dead pixel ratios.
2024-01-25 09:41:49 -05:00
Matthias Clasen
f6c01a7674 gpu: Fix ordering problem in clear_cache()
We must free the glyphs before their atlases, since we now maintain
the dead pixel count of the atlas when glyphs are freed.
2024-01-25 09:41:49 -05:00
Matthias Clasen
ffa5bf1b7d gpu: Fix atlas freeing
We need to unset current_atlas if we free that one.
2024-01-25 09:41:49 -05:00
Matthias Clasen
4c6e623ec5 gpu: Keep track of atlas use
Count how many dead pixels we have, and free the atlas if more than
half of its pixels are dead.

As part of this, change when glyphs are freed. We now keep them
in the hash table until their atlas is freed and we only do dead
pixel accounting when should_collect is called. This keeps the
glyphs available for use from the cache as long as are in the atlas.

If a stale glyph is sused, we 'revive' it by removing its pixels
from the dead.

This matches more closely what the gl renderer does.
2024-01-25 09:41:48 -05:00
Matthias Clasen
621ef0703a gpu: Make atlas freeing more robust
Currently, we don't free an atlas before all its glyphs are gone,
but we might revisit that in the future, so be prepared for it.
2024-01-25 09:40:58 -05:00
Matthias Clasen
f514caadb0 gpu: Evict stale glyphs from the cache
Same story as for textures: if it hasn't been used for 4 seconds,
it is stale and can go.
2024-01-25 09:40:58 -05:00
Matthias Clasen
4d92093c67 gpu: Fix texture eviction
If we gc a cached texture for which the GdkTexture is still alive,
the cached texture object will remain accessible via the render
data, so need to make sure not to leave a dangling pointer behind
here.
2024-01-25 09:40:58 -05:00
Matthias Clasen
bd9ea05ebb gpu: Evict stale textures from the cache
This is straightforward. If a texture hasn't been used for 4 seconds,
we consider it stale, and drop it the next time gc comes around.

The choice of 4 seconds is arbitrary.

Fixes: #6346
2024-01-25 09:40:58 -05:00
Matthias Clasen
e8599bd36e gpu: Start doing cache gc
Call the gc function periodically from a timeout to collect
stale cached items.
2024-01-25 09:40:58 -05:00
Matthias Clasen
1accd0c1ba gpu: Print some cache stats
This reuses the GLYPHCACHE debug flag that is used for the same
purpose in the gl renderer.
2024-01-25 09:40:58 -05:00
Matthias Clasen
14488041bc gpu: Add a static assertion
Stating the obvious, maybe.
2024-01-25 09:40:58 -05:00
Emmanuele Bassi
c11b29583e Merge branch 'gbsneto/a11y-cleanups-1' into 'main'
Unassorted a11y cleanups

See merge request GNOME/gtk!6808
2024-01-25 12:58:34 +00:00
Arjan Molenaar
9467243ac3 Properly unset the use_client_shadow flag 2024-01-25 13:11:13 +01:00
Evan Welsh
32f1f7280b gtk: Add AccessibleList to enable relations in bindings
Bindings need a boxed type to "wrap" lists of Gtk.Accessible objects.

Closes #6358
2024-01-25 03:39:49 -08:00
Yosef Or Boczko
ff81104834 Update Hebrew translation 2024-01-25 11:35:41 +00:00
Arjan Molenaar
6e7893d527 Let GdkDisplay decide if shadows should be drawn
Replace the `#ifdef` blocks by a backend call.
2024-01-25 12:09:10 +01:00
Arjan Molenaar
6efe5eefd3 Differentiate between compositing and frame extents support
* If the WM supports compositing, we can use CSD with rounded corners.
* If the WM supports frame extents, we can use client side shadows.
2024-01-24 21:57:44 +01:00
Fran Dieguez
3fd869a8ba Update Galician translation 2024-01-24 00:33:44 +00:00
Georges Basile Stavracas Neto
d337eed643 a11y/atspicontext: Remove empty constructed override
It does nothing.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
296d44159b a11y/atspi/root: Chain up to finalize
The gtk_at_spi_root_finalize() function currently chains up to
dispose(),
which is probably a copy-paste mistake since gtk_at_spi_root_dispose()
exists and also chains up to dispose().

Chain up to finalize().
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
4ce9f9b3ac gtk/atcontext: Cleanup a11y backends list
Declaring a separate entry for Wayland and X11 is not very useful when
both just end up calling the same constructor. Also, in theory, this
can cause the Wayland entry to be picked up on X11 if both backends
are enabled (which is the common case).

Not that it matters, since the 'name' field is unused.

Nonetheless, clean it up to be a single entry
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
9fb37229a1 atcontext: Remove end sentinel from array
This array is iterated using G_N_ELEMENTS(), which means it always
iterates a well known number of times.

Remove the sentinel.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
c8299f5b3e atcontext: Move variable declaration to top
This conforms better to the GTK C coding style.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
f019a325ef atcontext: Use size_t for loop iterator
G_N_ELEMENTS() returns a division of two size_t values, which results
in a size_t value.

This is just a cleanup, no functional change.
2024-01-23 19:09:57 -03:00
Matthias Clasen
0d69b723fc Merge branch 'matthiasc/for-main' into 'main'
Clean up some accidents

See merge request GNOME/gtk!6802
2024-01-23 11:47:52 +00:00
Benjamin Otte
d632258abb Merge branch 'wip/otte/subpixel-positioning' into 'main'
Add subpixel positioning for GPU renderer

See merge request GNOME/gtk!6799
2024-01-23 06:38:32 +00:00
Benjamin Otte
969fc17737 testsuite: Disable test on cairo
With the --repeat version of this test, Cairo needs to draw partially
clipped glyphs. However, there's a bug in Cairo where it doesn't account
for the subpixel positioning when clipping, so the glyphs get cut off at
the edge.

This is filed as https://gitlab.freedesktop.org/cairo/cairo/-/issues/821
2024-01-23 07:12:33 +01:00
Benjamin Otte
ada0ea0f68 testsuite: Add subpixel positioning test for hidpi
On hidpi (ie scaled by 2x) we want to align to the pixel grid, not the
unit grid.

The GL renderer currently gets that wrong, so it's disabled here.
2024-01-23 06:17:14 +01:00
Benjamin Otte
fff912efd3 testsuite: Add a test for subpixel positioning
Draw a grid of 21x21 box glyphs.

Each glyph is offset by n/20 pixels in the x and y direction.

The background color is carefully selected to be divisible by 16, so
that when the box glyph is subpixel positioned by 1/4th of a pixel
offset from the pixel grid in either direction, the result will be an
edge pixel whose color value can be computed exactly.

Cairo still rounds this wrong for color values >= 128 which is why we
use a dark gray that guarantees the resulting color values are all <128.
2024-01-23 06:17:14 +01:00
Benjamin Otte
c31b6ff1d5 gpu: Implement subpixel positioning
This makes glyph rendering match the Cairo and GL renderers.
2024-01-23 06:17:14 +01:00
Benjamin Otte
cf4b9dcb4d gpu: Align glyphs to the pixel grid
Add GSK_GPU_SKIP=glyph-align to turn off the glyph aligning.

FIXME: Should this be handled by the renderer at all or should we rely
on higher rendering layers to align glyphs properly?

This is kind of a tricky question just like with texture-scale nodes and
NEAREST filtering, because rendernodes can be embedded in other nodes
that disturb the pixel grid.
2024-01-23 06:17:14 +01:00
Benjamin Otte
549c8aec4a testsuite: Add tests for the recent repeat node fixes
Make sure to test horizontal and vertical versions, because who knows...
2024-01-23 06:17:14 +01:00
Benjamin Otte
b7f7487b53 cairo: Fix wrong offset when tiling repeat nodes 2024-01-23 06:17:14 +01:00
Benjamin Otte
dfc34b7295 gpu: Offset tiles properly
When drawing repeat nodes as tiles, this could result in wrong
renderings when the tiles were clipped wrong.
2024-01-23 06:17:14 +01:00
Matthias Clasen
83230766b2 Avoid a strdup
Not that it matters, but it looks cleaner that way.
2024-01-23 00:08:15 -05:00
Matthias Clasen
3bd1f491d1 node-editor: Remove some dead code
We ended up not needing a map implementation after all.
Remove the vestiges.
2024-01-23 00:07:23 -05:00
Matthias Clasen
2c1562630d Revert an accidental change
This snuck in with some recent cleanups.
2024-01-23 00:07:23 -05:00
Benjamin Otte
3451c2e72c Merge branch 'wip/otte/for-main' into 'main'
gsk: Respect offscreen_for_opacity of first child

Closes #6350

See merge request GNOME/gtk!6800
2024-01-22 17:52:33 +00:00
Benjamin Otte
00be97e741 gsk: Respect offscreen_for_opacity of first child
The container node constructor forgot to initialize that value from the
first child.

Testcase included.

Fixes #6350
2024-01-22 18:22:50 +01:00
Arjan Molenaar
f947aafc2e Reset window transparency and shadow properties
... so that if a window is unrealized and realized again
that you end up in a stable form.
2024-01-22 16:22:56 +01:00
Arjan Molenaar
3e9f2aa4bb Differentiate between transparency and client side shadows
Transparency we need to support rounded corners. Client-side
shadows we need on platforms where the window manager does not
do them (mainly Wayland and X11). On platforms that support shadows
by default (macOS, Windows), we can just use them.
2024-01-22 16:22:56 +01:00
Paul Rouget
a6ce506714 [macos] Use FullSizeContent for CSD 2024-01-22 16:22:36 +01:00
Matthias Clasen
9b9e8b385e Merge branch 'matthiasc/for-main' into 'main'
Tweak profiling strings

See merge request GNOME/gtk!6796
2024-01-22 13:46:52 +00:00
Emmanuele Bassi
d3f30e73d0 Merge branch 'gtypes-doc-fix' into 'main'
droptarget: Fix GType in doc strings

See merge request GNOME/gtk!6798
2024-01-22 12:15:31 +00:00
Alexandre Franke
257706ba0a Update French translation
(cherry picked from commit 92862dfeec)
2024-01-22 12:09:29 +00:00