Commit Graph

80759 Commits

Author SHA1 Message Date
Benjamin Otte
ab37fed974 gpu: vfuncify get_node_as_image()
The switch statement was ugly.

Plus, the code should be close to the add_node() vfunc implementation,
so they can be modified together.

See future commits for an example where this matters.
2024-07-07 12:54:05 +02:00
Benjamin Otte
10a7650411 testsuite: Generate mask correctly
There's a corner case with width/height being exactly 25 pixels.
And of course I was hitting it with one of my tests.
2024-07-07 12:54:05 +02:00
Benjamin Otte
fc4c6525e6 Merge branch 'wip/otte/for-main' into 'main'
gpu: Remove the ubershader

See merge request GNOME/gtk!7419
2024-07-07 10:52:51 +00:00
Benjamin Otte
d7308f2d73 gsk: Rename GSK_DEBUG=glyphcache to GSK_DEBUG=cache
1. I mistype it all the time
2. It's shorter
3. We use it for all caching these days, not just glyphs.
2024-07-07 05:24:45 +02:00
Benjamin Otte
ead566b841 rendernode-tool: Hide window background when --undecorated
We want to only show the node, nothing else. So getting rid of as much
CSS as possible is good.
2024-07-07 05:19:32 +02:00
Benjamin Otte
ecc2e02453 rendernode-tool: Add a GtkWindowHandle
Make the whole window area draggable, like usually the titlebar.

This is especially useful with --undecorated.
In that case we need to make the window non-resizable though, becuase
otherwise it can be accidentally maximized and whatnot.
2024-07-07 05:19:32 +02:00
Benjamin Otte
012c4b9425 gpu: Remove the ubershader
It didn't bring any noticable benefits and it isn't compatible with the
way we intend to do colorstate support.

And nobody seems to want to spend time on it, so let's get rid of it.

We can bring it back later if someone wants to work on it.
2024-07-07 05:19:32 +02:00
Benjamin Otte
be8fef9811 Merge branch 'wip/otte/for-main' into 'main'
rendernode-tool: Show the whole node

See merge request GNOME/gtk!7417
2024-07-05 19:46:39 +00:00
Scrambled 777
2938b48939 Update Hindi translation 2024-07-05 17:11:31 +00:00
Benjamin Otte
16c2e0a642 gl: Use GdkTextureDownloader
Cairo surfaces are so outdated.
2024-07-05 13:55:18 +02:00
Benjamin Otte
c43c0275e3 testsuite: Improve memorytexture printing code
* The variables are const. Keep them const when casting

* Print float16 values

* Print integer values as hex. This is better for detecting
  byteswapping, off by one, and such. Besides, we tend to use values
  that have the same 2 hex digits, so detecting corruption is also easy.
2024-07-05 13:16:56 +02:00
Benjamin Otte
df5d233155 testsuite: Print the right pixel
Typo made us pass the wrong values
2024-07-05 13:16:56 +02:00
Benjamin Otte
a8238c2251 testsuite: Make png file argument optional
Just default to the node file but with a .png extension.
2024-07-05 10:43:28 +02:00
Benjamin Otte
c12d1fe29c rendernode-tool: Show the whole node
When the node had negative coords, those were cut off.

Translate by the node's origin to avoid this.
2024-07-05 05:49:15 +02:00
Benjamin Otte
347cdc63f8 Merge branch 'wip/otte/deprecate-gl-shader' into 'main'
gsk: Deprecate GskGLShader and the rendernode

See merge request GNOME/gtk!7415
2024-07-04 22:04:57 +00:00
Benjamin Otte
32625381fa gsk: Deprecate GskGLShader and the rendernode
The new renderers don't support them due to the required complexity of
integrating them with Vulkan and the assumptions those nodes make about
the renderer (the GL renderer exports its internal APIs into the
GLShader).

There haven't been any complaints that I'm aware of since 4.14 was
released where the default renderer does not support the nodes, so usage
in public seems to be close to nonexistant.

The 2 uses I know of were workarounds about missing features in GTK that
have stopped since GTK now supports them:

1. GStreamer used in to do premultiplication when the old GL renderer
   did not do so in hardware but on the CPU.
2. Adwaita used it for masking before the mask node wa added in 4.10.
2024-07-04 21:28:06 +02:00
Emmanuele Bassi
e6d22fd8df Merge branch 'ebassi/docs-wiki-links' into 'main'
Drop references to the GNOME wiki from the docs

See merge request GNOME/gtk!7413
2024-07-04 12:23:18 +00:00
Ekaterine Papava
8e2de53c3f Update Georgian translation 2024-07-04 11:40:07 +00:00
Emmanuele Bassi
0057af3668 Drop references to the GNOME wiki from the docs
The GNOME wiki is getting decommissioned and archived:

  https://gitlab.gnome.org/Teams/Websites/General/-/issues/311

While the pages will still exist, it's better to direct people to
locations that are actively maintained.
2024-07-04 12:03:19 +01:00
Matthias Clasen
77cf390727 Merge branch 'nullable-widget' into 'main'
eventcontroller: mark get_widget as nullable

See merge request GNOME/gtk!7359
2024-07-04 09:45:42 +00:00
tszymanski
dcadf1422b eventcontroller: mark get_widget as nullable 2024-07-03 21:48:35 -07:00
Matthias Clasen
53ac80d6c8 Merge branch 'matthiasc/for-main' into 'main'
wayland: Add debug spew

See merge request GNOME/gtk!7412
2024-07-04 02:19:54 +00:00
Matthias Clasen
2e9fcdad6e wayland: Add debug spew
Trying to track down ci failures from cursor theme loading.
2024-07-03 21:42:57 -04:00
Benjamin Otte
0f55b3bc18 Merge branch 'wip/otte/for-main' into 'main'
gpu: Split out the cache

See merge request GNOME/gtk!7411
2024-07-03 19:51:10 +00:00
Benjamin Otte
9c249fefc3 gpu: Improve periodic cache debug message
I was watching the log in my terminal and nothing happened.
And I wasn't sure if that was because nothing was printed or because the
same thing was printed every few seconds.

Fix that by printing a timestamp, so that in a few seconds something
else will be printed.
2024-07-03 20:36:56 +02:00
Benjamin Otte
eae7ee6c25 gpu: Track atlas differently
Previously we tracked the dead pixels, but that meant we didn't know the
alive pixels (because there's also unused pixels never accounted for).
And we would free the current atlas randomly due to that.

Now we track if any pixels are alive, and if so, we never gc the current
atlas.
2024-07-03 20:36:56 +02:00
Benjamin Otte
bf7f302ff5 gpu: gc atlas, too
After 60s, we gc the atlas, too. This ensures that after that time, we
free all cache resources, so if an application gets moved to the
background, it will no longer use GPU resources. (Well, at least the
cache won't.)
2024-07-03 19:55:18 +02:00
Benjamin Otte
0d6981bd54 gpu: Make the cache track if it's empty
Only if a non-stale item is in the cache do we consider the cache not
empty.

Once the cache is empty, the device frees it and stops running the
periodic GC.
2024-07-03 19:55:18 +02:00
Benjamin Otte
148d7bcc25 gpu: Don't remove gc timeout unless cache is empty
If the cache isn't empty, we want to rerun the GC.
2024-07-03 19:55:18 +02:00
Benjamin Otte
71161b6352 gpu: Split cache and device
This is for 3 reasons:

1. Separation of concerns
   The device is meant to manage the Vulkan/GL device and check stuff
   like image sizes.
   Caching is not part of that.

2. Refcounting
   Images etc want to reference the device, but the cache wants to
   reference images. If the cache is the device, that's a refcycle.

3. Flexibility
   It's now easier to implement >1 cache, say one per depth or one per
   color state.
2024-07-03 19:55:15 +02:00
Benjamin Otte
dd33a2f280 rendernode: Make sure depth variable has enough bits
This will be relevant when we add new values to it.
2024-07-03 19:55:15 +02:00
Emmanuele Bassi
9d48d684a5 Merge branch 'ebassi/closure-fixes' into 'main'
Use the appropriate annotations for callback closures

See merge request GNOME/gtk!7410
2024-07-03 17:34:48 +00:00
Matthias Clasen
eb252d33a9 Merge branch 'expander-non-child' into 'main'
expander: Don't leave dangling a11y relations

See merge request GNOME/gtk!7409
2024-07-03 17:24:44 +00:00
Emmanuele Bassi
40bdf7e0d4 Use the appropriate annotation for callbacks
All the callback-related annotations must go on the callback parameter:

- scope type
- closure arg-name
- destroy arg-name
2024-07-03 18:04:27 +01:00
Matthias Clasen
6aba047ace expander: Don't leave dangling a11y relations
If we unparent the widget, we should sever a11y relations too.
Otherwise, an a11y implementation might follow them and be surprised
to find a parentless widget (and not in a good way).

Updated tests to not check the relation on an unexpanded expander.
2024-07-03 12:55:15 -04:00
Emmanuele Bassi
554045de6e Use the appropriate annotations for a callback closure
The (closure) annotation with an parameter is meant to be used on the
callback argument, and point to the user data argument.
2024-07-03 17:21:04 +01:00
Emmanuele Bassi
fa42081556 Use the appropriate annotations for callback closures
The unary (closure) annotation is for function pointer types; function
arguments that represent the user data to be passed to the callback are
annotated on the callback argument itself, with (closure arg-name).
2024-07-03 16:57:47 +01:00
Artur S0
54d0bcab71 Update Russian translation 2024-07-03 11:35:15 +00:00
Benjamin Otte
3539128d42 memoryformat: Split out a function
It's used in many places and attaching a name to what it does is useful.
2024-07-03 04:16:56 +02:00
Matthias Clasen
372c68a1c9 Merge branch 'matthiasc/for-main' into 'main'
gsk: Avoid a crash

See merge request GNOME/gtk!7408
2024-07-02 20:19:47 +00:00
Matthias Clasen
f9856d547f gsk: Avoid a crash
The subsurface in subsurface nodes can be NULL, so check before
poking at it.
2024-07-02 15:52:51 -04:00
Matthias Clasen
d0d8f6b5ee Merge branch 'popover-layout-check-fix' into 'main'
popover: Fix invalid width/height check in layout

Closes #6826

See merge request GNOME/gtk!7405
2024-07-02 03:02:18 +00:00
Matthias Clasen
28c91bf767 Merge branch 'ci-catch-segfaults' into 'main'
testsuite: Use catch as testwrapper

See merge request GNOME/gtk!7406
2024-07-02 02:59:46 +00:00
Matthias Clasen
a8bfe4e6f2 Merge branch 'popover-critical-fix' into 'main'
popover: Take shadow size into account in measure

Closes #5782 and #6796

See merge request GNOME/gtk!7403
2024-07-02 02:39:21 +00:00
Matthias Clasen
1f076432db ci: Use catch to capture stacktraces
For now, just try this out for the release build. If it works,
we can add it to the other jobs too.
2024-07-01 22:29:36 -04:00
Matthias Clasen
b6e79a7234 testsuite: Use catch as testwrapper
If we find a binary named catch, use it as test wrapper. This
will be used to capture stacktraces for crashes in ci.
2024-07-01 22:29:36 -04:00
Matthijs Velsink
68b05cadd8 popover: Fix invalid width/height check in layout
Commit a4cc95b2 introduced a check in layout() that closes the popover
if the width or height is smaller than the minimum width or height,
respectively. However, that was using gtk_widget_get_preferred_size(),
which finds out the minimum height for the minimum width and vice versa,
but not the minimum height for the layout width and vice versa. So,
certain popovers were not showing, even though they would not have
generated a critical to begin with.

To fix this, we copy the logic from gtk_widget_allocate() that generates
the criticals, and use that to check if we have a good width/height for
the popover native or not.

Closes #6826
2024-07-02 03:54:08 +02:00
Matthijs Velsink
93c5fb0b31 popover: Take shadow size into account in measure
Commit b9487997 introduced shadows for GtkPopover. These are correctly
subtracted while allocating the child widget, but the child is not
measured with those shadows subtracted (as is correctly done for the
arrow). This can give criticals, for example with some wrapping labels.

To fix this, we subtract the shadow size from the `for_size` before
passing it to the measure() of the child widget.

Closes #5782
Fixes #6796
2024-07-02 02:50:29 +02:00
Benjamin Otte
cfdbf95cb6 Merge branch 'wip/otte/for-main' into 'main'
gdk: Add GDK_N_DEPTHS to the enum

See merge request GNOME/gtk!7402
2024-07-02 00:33:21 +00:00
Benjamin Otte
b80e33b209 testsuite: Add tests for empty mask children
The compare tests use an empty container node, but running them with
--replay ends up with empty nodes in snapshots due to how containers are
replayed.

Related: !7396
Related: #6761
2024-07-02 02:04:06 +02:00