Compare commits

..

193 Commits

Author SHA1 Message Date
Matthias Clasen
ad2c2592c1 inspector: Update the logging tab
Make the logging-related checkboxes match the flags we have.
2024-01-05 20:54:14 -05:00
Matthias Clasen
d6cfe2365b inspector: Show renderer information
Show the max texture size for the GL renderer, and the optimization
flags (ie what is set with GSK_GPU_SKIP) for the gpu renderers.
2024-01-05 20:41:16 -05:00
Matthias Clasen
2883e527ec gpu: Add a private getter for opt flags
We want to show these flags in the inspector, so make them
available.
2024-01-05 20:40:38 -05:00
Matthias Clasen
b4ea4087c3 inspector: Show more Vulkan information
Use GskVulkanDevice for the Vulkan information, and also show
numeric limits and which Vulkan features are enabled.
2024-01-05 20:09:30 -05:00
Matthias Clasen
0554d44d9e inspector: Don't check for nonexisting types
GskVkOldRenderer does not exist anymore.
2024-01-05 19:41:27 -05:00
Matthias Clasen
cfc0cb1553 Update docs
Update the docs for environment variables that we parse to include
GDK_VULKAN_SKIP and GSK_GPU_SKIP.
2024-01-05 19:36:34 -05:00
Matthias Clasen
7543584492 gpu: Cosmetics
Tweak debug value descriptions.
2024-01-05 19:36:34 -05:00
Matthias Clasen
0e9ff94d3e gpu: Whitespace fixes 2024-01-05 19:36:34 -05:00
Benjamin Otte
3fd8ddc38b gpu: Setup attribute locations
Make the generator generate calls for the correct glBindAttribLocation()
calls.

Usually this was done correctly, but we can't rely on it. So do it
explicitly.
2024-01-04 14:54:29 +01:00
Benjamin Otte
b175acbdf5 gl: Don't initialize texture storage in wrong format
We're calling glTexImage2D() right after with the correct format.

So add the special format "0" to avoid intializing the texture memory.
2024-01-04 14:54:29 +01:00
Benjamin Otte
b67d2018ad testsuite: Add a test for a recent mipmap generation bug
Tests the fix in ab1fba6fdc.

Related: #6298
Related: !6704
2024-01-04 14:54:28 +01:00
Benjamin Otte
d56d1eda4a gpu: Add GSK_GPU_SKIP=blit
This allows bypassing all blit operations using gsk_gpu_blit_op()
in favor of shaders.
2024-01-04 14:54:28 +01:00
Benjamin Otte
7047cb6553 gpu: Add more assertions to blitop
The blitop is nasty, so we should make sure we have supported images
when using it.
2024-01-04 14:54:28 +01:00
Benjamin Otte
36b0df8e74 FIXME: Disable ubershader in NGL CI
Gets around the ubershader compile taking multiple minutes and causing
each test to timeout.
2024-01-04 14:54:28 +01:00
Matthias Clasen
7c426add4f testsuite: Add NGL and Vulkan renderer to compare tests
Add a testsuite called gsk-compare-vulkan to run
the gsk renderer tests with the Vulkan renderer and
gsk-compare-ngl to run them with the NGL renderer.

To run the tests locally, you can do:

meson test -C_build --suite gsk-compare-vulkan
2024-01-04 14:54:28 +01:00
Benjamin Otte
afd2ed5101 gpu: Generate mipmap by default when downscaling too much
When downscaling more than 2x in either dimension, force mipmap use for
the texture in a texture node.
It improves the quality of textures but takes extra work.

The GL renderer does this, too (for textures that aren't in the icon cache).

This can be disabled via GSK_GPU_SKIP=mipmap.

Fixes the big-checkerboard-scaled-down2 test.
2024-01-04 14:54:28 +01:00
Benjamin Otte
f971b1bb15 gpu: Add supersampling for gradients
Unless GSK_GPU_SKIP=gradients is given, we sample every point 4x instead
of 1x. That makes the shader run slower (by roughly a factor of 2.5x)
but it improves quality quite a bit.
2024-01-04 14:54:28 +01:00
Benjamin Otte
bcb927d1d7 gpu: Add a blend mode shader
I'm a bit unsure about using the zero rect in the fallback situtation
where one image doesn't exist, but it seems to work.

This removes the last pattern-only rendernode and with that the last
fallback usage with disabled ubershader.
2024-01-04 14:54:28 +01:00
Benjamin Otte
c1ba79f0f7 gpu: Use variations in the blur shader
Have one variation for colorizing to a shadow color and another
variation that just blurs.
2024-01-04 14:54:28 +01:00
Benjamin Otte
b0a3976337 gpu: Use variations in the straight-alpha shader
This way we can toggle opacity handling on/off.

THe shader slowly turns into a fancy texture op - but I don't want to
rename it to "fancytexture" just yet.
2024-01-04 14:54:28 +01:00
Benjamin Otte
7a6377d1ff gpu: Use variations for radial gradients 2024-01-04 14:54:27 +01:00
Benjamin Otte
4100436c50 gpu: Use variations for the mask mode 2024-01-04 14:54:27 +01:00
Benjamin Otte
2ce60f1260 gpu: Make linear gradients use variations 2024-01-04 14:54:27 +01:00
Benjamin Otte
88e5b6ba8d gpu: Make box shadow shader use variations
Use it do differentiate between inset and outset shadows.
2024-01-04 14:54:27 +01:00
Benjamin Otte
0268248d9e gpu: Introduce the concept of "variation"
A variation is a #define/specialization constant that every shader can
use to specialize itself as it sees fit.

This commit adds the infrastrcture, future commits will add
implementations.
2024-01-04 14:54:27 +01:00
Benjamin Otte
3976f88fed png: Don't set a size limit when saving
gdk_texture_save_to_png_bytes() cannot fail, so ensure that it doesn't.

Testsuite has been updated to check for this case.

Note that we do not load the PNG file that we generate here.
Loading is a lot more scary than saving after all.
If people want to load oversized PNG files, they should use a real PNG
loader.
2024-01-04 14:54:27 +01:00
Benjamin Otte
5bf21e264e gpu: Add a cross-fade shader 2024-01-04 14:54:27 +01:00
Benjamin Otte
407d08ff0d gpu: Handle a clipping cornercase properly
If we enter the situation where we need to redirect the clipping to an
offscreen, make sure that:

* the ubershader gets only used when beneficial

* we size the offscreen properly and don't let it grow infinitely.

Fixes the clip-intersection-fail-opacity test
2024-01-04 14:54:27 +01:00
Benjamin Otte
2cb7433065 gpu: Handle opacity in the Cairo path
Fixes random calls to add_fallback_node() from code that wants to handle
opacity.

Also makes Cairo nodes work with opacity, of course.
2024-01-04 14:54:27 +01:00
Benjamin Otte
d08e5f7d82 gpu: Handle alpha in image_op() wrapper
There are various places where the alpha is implicitly assumed to be
handled, so just handle it.

As a bonus, this simplifies a bunch of code and makes the texture node
rendering work with alpha.
2024-01-04 14:54:27 +01:00
Benjamin Otte
a21fcd9ca6 gpu: Optimize box-shadow shader
Like in the border shader, don't draw the (potentially large for the
window's shadow) inside part that is transparent.
2024-01-04 14:54:26 +01:00
Benjamin Otte
f8b0c95894 gpu: Replace a fallback with offscreens
Use an offscreen and mask it if the clips get too complicated.

Technically, the code could be improved to set the rounded clip on the
offscreen instead of rendering it as a mask, but that would require more
sophisticated tracking of clip regions by respecting the scissor, and
the current clip handling can't do that yet.

This removes one of the last places where the GPU renderer was still
using Cairo fallbacks.
2024-01-04 14:54:26 +01:00
Benjamin Otte
c46ab19f76 gpu: Add gsk_gpu_node_processor_add_images()
This is for generating descriptors for more than 1 image. The arguments
for this function are very awkward, but I couldn't come up with better
ones and the function isn't that important.

And the calling places still look a lot nicer now.
2024-01-04 14:54:26 +01:00
Benjamin Otte
11232b2611 gpu: Add gsk_gpu_node_processor_init_draw/finish_draw()
These initialize/finish an offscreen and start drawing to it.

It simplifies the process of using offscreens quite a bit that way.
2024-01-04 14:54:26 +01:00
Benjamin Otte
caa898103f gpu: Add stroke support
Same as for fill nodes, we render the stroke to a mask and then run a
mask shader.

The color node child optimization is included already.
2024-01-04 14:54:26 +01:00
Benjamin Otte
2692cb9a6e gpu: Optimize solid color fills 2024-01-04 14:54:26 +01:00
Benjamin Otte
9ba8c95b8b gpu: Add fill node support
For now this uses Cairo to generate a mask and then runs a mask op.

This is different from just using fallback in that the child is rendered
with the GPU and not via fallback.
2024-01-04 14:54:26 +01:00
Benjamin Otte
58953432d3 gpu: Add a radial gradient shader
This is mainly copy/paste, so now this almost identical gradient code
exists 3 times.
That's kinda suboptimal.
2024-01-04 14:54:26 +01:00
Benjamin Otte
ac6d854a3a gpu: Add a conic gradient shader 2024-01-04 14:54:26 +01:00
Benjamin Otte
89b65ec9b9 gpu: Split linear gradient shader into 2 parts
A generic part that can be shared by all gradient shaders that does the
color stop handling and a gradient-specific part that needs to be
implemented individually by each gradient implementation.
2024-01-04 14:54:25 +01:00
Benjamin Otte
0ed32f4d2d gpu: Change the cairo upload op prototype
Make it take a draw function instead of a node.

This way, we can draw more fancy stuff with Cairo.
2024-01-04 14:54:25 +01:00
Benjamin Otte
6cabaad562 gpu: Handle >7 color stops
If there are more than 7 color stops, we can split the gradient into
multiple gradients with color stops like so:
  0, 1, 2, 3, 4, 5, transparent
  transparent, 6, 7, 8, 9, 10, transparent
  ...
  transparent, n-2, n-1, n
and use the new BLEND_ADD to draw them on top of each other.

Adapt the testcae that tests this to use colors that work with the fancy
algorithm we use now, so that BLEND_ADD and transitions to transparent
do not cause issues.
2024-01-04 14:54:25 +01:00
Benjamin Otte
801225c3d3 gpu: Make the ubershader use the correct coordinates
Instead of scaled coordinates, use the unscaled ones.

This ensure that gradients get computed correctly as they are not safe
against nonorthogonal transforms - like scales with different scale
factors.
2024-01-04 14:54:25 +01:00
Benjamin Otte
66b783cc7e gpu: Make blend modes configurable
For now, we only have OVER and ADD blend modes. This commit doesn't use
ADD, it just sets up all the machinery and refactors things.
2024-01-04 14:54:25 +01:00
Benjamin Otte
136d3d9439 gpu: Add a linear-gradient shader
The shader can only deal with up to 7 color stops - but that's good
enough for the real world.

Plus, we have the uber shader.

And if that fails, we can still fall back to Cairo.

The code also doesn't handle repeating linear gradients yet.
2024-01-04 14:54:25 +01:00
Benjamin Otte
ec5aa5e736 gpu: Add a mask shader
This shader can take over from the ubershader. And it can be used
instead of launching the ubershader when no offscreens are necessary.

Also includes an optimization that uses the colorize shader when
appropriate.
2024-01-04 14:54:25 +01:00
Benjamin Otte
f862f66e4a rgba: Add a few macros
... and use them.

Those macros hopefully make code more readable.
2024-01-04 14:54:25 +01:00
Benjamin Otte
73143dc7ab gpu: Use ubershader for repeat nodes when possible 2024-01-04 14:54:25 +01:00
Benjamin Otte
ee54f5a50a gpu: Add a repeat node renderer
The ubershader has some corner cases where it can't be used, in
particular when the child is massively larger than the repeat node and
the repeat node is used to clip lots of the source.
2024-01-04 14:54:25 +01:00
Benjamin Otte
db93fd6b7b renderer: Add Vulkan renderer to the list of renderers
It's better than the Cairo renderer, so use it instead.

It's still only picked once GL fails, so it will probably only ever be
picked when people use GDK_DEBUG=gl-disable, but at least it will be
picked.
2024-01-04 14:54:24 +01:00
Benjamin Otte
fb6ee45064 renderer: Split function
per-backend renderers and GL renderers are a different thing, so treat
them as such.

Also, try the GL renderer unconditionally. The renderer initialization
code will take care of GL not being available.
2024-01-04 14:54:24 +01:00
Benjamin Otte
f6f43cd374 vulkan: Add a Vulkan downloader
This is using the Vulkan renderer.

It also allows claiming support for all the formats that only Vulkan
supports, but that neither GL nor native mmap can handle.
2024-01-04 14:54:24 +01:00
Benjamin Otte
0473a429ac gpu: Implement a GdkDmabufDownloader 2024-01-04 14:54:24 +01:00
Benjamin Otte
d225f40acd gpu: Add a boolean flag allow_dmabuf to the downloadop
It can be set to force the downloadop to not create dmabuf textures.
2024-01-04 14:54:24 +01:00
Benjamin Otte
2bcee1e69e gpu: Update to memoryformat Vulkan code
The existing code for setting up formats was copied from the old Vulkan
renderer and never updated.
2024-01-04 14:54:24 +01:00
Benjamin Otte
9a81ed9ab1 testsuite: Add new renderers to the scaling test 2024-01-04 14:54:24 +01:00
Benjamin Otte
fb9c4c15be gpu: Reorganize format handling
Add GSK_GPU_IMAGE_RENDERABLE and GSK_GPU_IMAGE_FILTERABLE and make sure
to check formats for this feature.

This requires reorganizing code to actually do this work instead of just
pretending formats are supported.

This fixes GLES upload tests with NGL.
2024-01-04 14:54:24 +01:00
Benjamin Otte
f2ac427035 gpu: Add debug messages
Add FALLBACK debug messages when a texture upload format is not
supported.
2024-01-04 14:54:24 +01:00
Benjamin Otte
95d7c7de3a vulkan: Use vulkan feature flags for incremental present
I did it because it unifies the code.

But it also gains the benefit of being debuggable because it can
now be turned off via GDK_VULKAN_SKIP=incremental-present
2024-01-04 14:54:24 +01:00
Benjamin Otte
80a2cbb447 gpu: sync dmabufs via semaphores
This ensures both that we signal a semaphore for a dmabuf when we export
an image and that we import semaphores for dmabufs and wait on them.

Fixes Vulkan node-editor displaying the Vulkan renderer in the sidebar.
2024-01-04 14:54:23 +01:00
Benjamin Otte
14a1c53358 gpu: Make VulkanRealDescriptor keep the frame
There's too much interaction between the two to warrant not having it
around.
2024-01-04 14:54:23 +01:00
Benjamin Otte
fcb8e920c8 gpu: Add support for blend modes 2024-01-04 14:54:23 +01:00
Benjamin Otte
8003d875ee gpu: Make Vulkan renderer provide dmabuf textures
Make gsk_renderer_render_texture() create a dmabuf texture if that is
possible.

If it isn't (ie if we're not on Linux or if dmabufs are otherwise not
working) fall back to the previous code of creating a memory texture.
2024-01-04 14:54:23 +01:00
Benjamin Otte
ce08750906 gpu: Add gsk_gpu_device_create_download_image()
This way, we can differentiate between regular offscreens and images
that are meant to be used for gsk_renderer_render_texture() or similar.
2024-01-04 14:54:23 +01:00
Benjamin Otte
15c72b32bd gpu: Update the pipeline cache
When a new shader was compiled, queue a save of the pipeline cache.
2024-01-04 14:54:23 +01:00
Benjamin Otte
21841872f4 gpu: Implement support for multiple storage buffers
When using the uber shader a lot, we may overflow the (only 16kB large)
storage buffer.

Stop crashing when that happens and instead just allocate a new one.
2024-01-04 14:54:23 +01:00
Benjamin Otte
9ef440a577 gpu: Handle storage buffers via descriptors
This makes the (currently single) storage buffer handled by
GskGpuDescriptors.
A side effect is that we now have support for multiple buffers in place.
We just have to use it.

Mixed into this commit is a complete rework of the pattern writer.
Instead of writing straight into the buffer (complete with repeatedly
backtracking when we have to do offscreens), write into a temporary
buffer and copy into the storage buffer on committing.
2024-01-04 14:54:23 +01:00
Georges Basile Stavracas Neto
83b922f2ee gpu/renderer: Improve scale detection
The GL branch should eventually call into gdk_gl_context_get_scale(),
which is what checks for GDK_DEBUG=gl-fractional; whereas the Vulkan
branch needs no change.
2024-01-04 14:54:23 +01:00
Benjamin Otte
a6bcc2208a gpu: Rename some descriptors APIs
We want tosupport buffers here, too, so make the names unambiguous.
2024-01-04 14:54:22 +01:00
Benjamin Otte
f7f61fadb3 gpu: Only run uber shaders if beneficial
If we have the choice between running the ubershader or a normal shader
with offscreens, make the choice depend on if the ubershader would
offscreen anyway.
If so, just run the normal shader.

This really gets rid of all ubershader invocations in Adwaita
widget-factory.
2024-01-04 14:54:22 +01:00
Benjamin Otte
8bb3cca512 gpu: Add a color matrix shader
This allows avoiding the uber shader in 2 important cases:

1. opacity - and Adwaita uses that a lot
2. color-matrix - it's used for symbolic icons
2024-01-04 14:54:22 +01:00
Benjamin Otte
6dc9736b37 gpu: Add support for subsurfaces 2024-01-04 14:54:22 +01:00
Benjamin Otte
cd054a6e6d gpu: Rework caching layer
Instead of using an enum, use a usual custom class struct like we use
for GskGpuOp.

As a side effect of that refactoring, the display gained a hash table
for textures where we can't use the render data because the texture is
used in multiple renderers.
The goal here is that a texture is always cached and we can ensure that
there is a 1:1 relation between textures and their GskGpuImage. This is
important in particular for external textures - like dmabufs - where we
absolutely don't want 2 images with 2 device memories, and where we use
toggle references to keep them alive.
2024-01-04 14:54:22 +01:00
Benjamin Otte
2e11cf754c gpu: Handle opacity in a bunch of nodes 2024-01-04 14:54:22 +01:00
Benjamin Otte
880aaab037 gpu: Add optimization for opacity nodes
Track the global opacity and allow nodes to handle it themselves.

If the nodes don't, fall back to what we did previously: Use the
ubershader.
2024-01-04 14:54:22 +01:00
Benjamin Otte
a295d59db8 gpu: Make the uber shader handle affine transforms
Fixes the last (non-blur) Nautilus offscreens in Nautilus.
2024-01-04 14:54:22 +01:00
Benjamin Otte
13e6ecb330 gpu: Replace clip node fallback with uber or offscreen
We don't need to use a fallback here anymore, we have enough code by now
to do this smarter.
2024-01-04 14:54:22 +01:00
Benjamin Otte
88c25199ce gpu: Split out a function
We want to use it elsewhere.
2024-01-04 14:54:22 +01:00
Benjamin Otte
743dfc276a gpu: Replace fallback with offscreen
We don't need to fallback with transform nodes when the clip is
too complex. We can redirect to an offscreen instead, which doesn't have
a clip.
2024-01-04 14:54:21 +01:00
Benjamin Otte
134d809a7d gpu: Split out a function
I want to use it in more places.
2024-01-04 14:54:21 +01:00
Benjamin Otte
3936e7ee7d gpu: Be stricter about texture units
Reserve 3 texture units per immutable sampler (because that's the
maximum per YUV sampler).
Ensure that the max-sampler calculations always include the immutable
samplers, too.
2024-01-04 14:54:21 +01:00
Benjamin Otte
a5c7339920 gpu: Improve memory handling on Vulkan
We now handle the case where memory is not HOST_CACHED.

We also track the memory type now so we can avoid mapping image memory
that is not HOST_CACHED and use buffer transfers instead.
2024-01-04 14:54:21 +01:00
Benjamin Otte
e8fb0e71c9 gpu: Make the texture ladder handle 32 textures
So now we can put more textures in one descriptor set even if dynamic
indexing isn't supported.
2024-01-04 14:54:21 +01:00
Benjamin Otte
9d0b15273d gpu: Require Vulkan 1.2 shaders for dynamic indexing
Shader compilers struggle with compiling code that indexes texture
arrays by indexes, so keep the fallback shaders simple and don't do that
there.

There's not much of a performance difference anyway between those two
methods.
2024-01-04 14:54:21 +01:00
Benjamin Otte
168be35bed gpu: Add back single descriptors set usage with descriptor indexing 2024-01-04 14:54:21 +01:00
Benjamin Otte
9777188ae4 gpu: Make descriptor-indexing optional
Do extra work if it's not available.
2024-01-04 14:54:21 +01:00
Benjamin Otte
21f52cacf9 gpu: Remove UPDATE_AFTER_BIND flag
We don't update after binding.
2024-01-04 14:54:21 +01:00
Benjamin Otte
5ed293e3df gpu: Handle multiple image descriptors
In the case where descriptor indexing is not enabled and the number of
max images is small (or we use extensive amounts of immutable samplers),
we need to be able to switch descriptors.

This patch makes that possible.
2024-01-04 14:54:21 +01:00
Benjamin Otte
c51c3b2660 gpu: Cache GL state
That way we don't need to setup the textures and program for every
command.
2024-01-04 14:54:20 +01:00
Benjamin Otte
5dc455f011 gpu: Add a CommandState struct to the command vfuncs
This way, we can make it writable and track things like the active
textures and the current program.

We don't do that yet, but we can.
2024-01-04 14:54:20 +01:00
Benjamin Otte
fbd972498f gpu: Handle missing support nor nonuniform texture accesses
We compile custom shaders for Vulkan 1.0 that don't require the
extension.

We  also ensure that our accesses are uniform by only executing one
shader at a time.
2024-01-04 14:54:20 +01:00
Benjamin Otte
b87d82de7e gpu: Change the meson code for how SPIR-V is built
This does the same thing, but in a way that's a bit more flexible.
And it prepares the next commit...
2024-01-04 14:54:20 +01:00
Benjamin Otte
c165b9d47c gpu: Add GDK_VULKAN_SKIP env var
The variable forces skipping of optional Vulkan features. This is useful
for testing.

Also debug-print the features in use.
2024-01-04 14:54:20 +01:00
Benjamin Otte
37d4e29c44 gpu: Set max samplers/buffers based on features
If we run older code, we don't have enough samplers and buffers
available. So make sure to reflect that.
2024-01-04 14:54:20 +01:00
Benjamin Otte
1923cad9f7 gpu: Add Vulkan feature flags for more advanced features
Code continues if those features aren't available, buit is probably
broken.
2024-01-04 14:54:20 +01:00
Benjamin Otte
9349ba8330 gpu: Update shader code for different buffer/sampler sizes
Use specialization constants for that.
2024-01-04 14:54:20 +01:00
Benjamin Otte
0c72233a9d gpu: Make PipelineLayout objects do more things
Let the objects track the number of samplers or buffers needed.

This is a required step for making Vulkan work with less featureful
(read: mobile) implementations.
2024-01-04 14:54:20 +01:00
Benjamin Otte
9733b8d4e1 gpu: Track position fwidth explicitly
This is relevant went encountering repeat nodes, where the repeat cutoff
will make the fwidth of the position go wild otherwise.

Gradients require more work now, because we need to compute offsets
twice - once for the pixel, once for the offst.
2024-01-04 14:54:20 +01:00
Benjamin Otte
4d9ff5e46a gpu: Add support for dmabuf import to GL 2024-01-04 14:54:19 +01:00
Benjamin Otte
9cf776d02e gpu: Prepare GL rendering for samplerExternalEOS
Carry an n_external_textures variable around when selecting programs and
compile different programs for different amounts of external textures.

For now, this code is unused, but dmabufs will need it.
2024-01-04 14:54:19 +01:00
Benjamin Otte
55dbbabd0c gpu: Add importing of GL textures to the GL renderer
syncing with the GLsync is kind of a hack (because we just do it on
import), but it works.
2024-01-04 14:54:19 +01:00
Benjamin Otte
46baaa9337 gpu: Add support for texture-scale nodes
This adds GSK_GPU_IMAGE_CAN_MIPMAP and GSK_GPU_IMAGE_MIPMAP flags and
support to ensure_image() and image creation functions for creating a
mipmapped image.

Mipmaps are created using the new mipmap op that uses
glGenerateMipmap() on GL and equivalent blit ops on Vulkan.

This is then used to ensure the image is mipmapped when rendering it
with a texture-scale node.
2024-01-04 14:54:19 +01:00
Benjamin Otte
697f2b8e95 gpu: Add blitting support
Add GSK_GPU_IMAGE_NO_BLIT flag for textures that can't be blitted from.

Use a blit op to do image copies otherwise.
2024-01-04 14:54:19 +01:00
Benjamin Otte
9af809a7ff testsuite: Add a test to check scaling behavior
Various GL texture formats do not support linear scaling or mipmap
generation.

Add a test that checks this.
2024-01-04 14:54:19 +01:00
Benjamin Otte
2e25936383 testsuite: Update memorytexture text to use new renderers
1. Refactor checks for GL support

2. Add NGL and Vulkan
2024-01-04 01:36:13 +01:00
Benjamin Otte
7652dbcacf gpu: Add straight alpha support
Add a GSK_GPU_IMAGE_STRAIGHT_ALPHA and use it for images that have
straight alpha.
Make sure those images get passed through a premultiplying pass with
the new straight alpha shader.

Also remove the old Postprocess flags from the Vulkan image that were a
leftover from copying that code from the old Vulkan renderer.
2024-01-04 01:36:13 +01:00
Benjamin Otte
8df8e1283f gpu: Work around Ycbcr not working with dynamically uniform indices
There's a well hidden line in the spec that says in
https://registry.khronos.org/vulkan/specs/1.3/html/chap15.html#interfaces-resources-descset

  If the combined image sampler enables sampler Y′CBCR conversion,
  it **must** be indexed only by constant integral expressions when
  aggregated into arrays in shader code, irrespective of the
  shaderSampledImageArrayDynamicIndexing feature.

So we'll use the same trick that we use for old GL here and do an
if dance that gives us dynamically uniform expressions.
2024-01-04 01:36:13 +01:00
Benjamin Otte
2199822d5f gpu: Add dmabuf import for Vulkan
This now uses all the previously added features to allow displaying YUV
images.

Also add a utility function that turns an image into a toggle ref for a
texture. This makes sure that reffing the image also refs the texture
and that ensures that textures stay alive as long as the image is in
use.
2024-01-04 01:36:13 +01:00
Benjamin Otte
16a3a04405 vulkan: Add support for enumerating dmabuf formats
This code does not add a downloader, so we do not claim support for all
the new formats.

It just queries the formats. But this can be used to import dmabufs
directly into the Vulkaan renderer.
2024-01-04 01:36:13 +01:00
Benjamin Otte
f21938cae6 gpu: Handle flags for images
For now, the flags are just there because, and nobody uses them yet.
The only flag is EXTERNAL, which for now I'm using for YUV buffers,
though it's a bit undefined what that means.
2024-01-04 01:36:12 +01:00
Benjamin Otte
2cb06f212b gpu: Add a mipmap sampler
It's not used yet, but the sampler infrastructure needs to be expanded,
so I decided to split this out to easier find regressions.
2024-01-04 01:36:12 +01:00
Benjamin Otte
18e39f86b6 gpu: Add support for immutable samplers to Vulkan
Images can now have samplers - meaning they must be rendered with that
sampler. It also means that sampler must be handled as an immutable
sampler in descriptorsets.
These samplers can be created with a samplerYcbcrConversion, so code has
been added to pass that conversion when creating the imageview.

Also add code to GskVulkanFrame to track immutable samplers.

Nobody is making use of this yet.
2024-01-04 01:36:12 +01:00
Benjamin Otte
f13f70a448 gpu: Hook up immutable samplers to shaders
Define an array with a compile-time-constant variable size for the
immutable samplers.

A bunch of work is necessary to ensure that at least one element is in
the sampler array, because the GLSL code
  sampler2D immutable_textures[0];
is invalid.
2024-01-04 01:36:12 +01:00
Benjamin Otte
faf24c4bfe gpu: Add GskVulkanPipelineLayout
This allows having different layouts sothat we can support immutable
samplers, whcih are required for multiplane and YUV formats.

We don't use them yet.
2024-01-04 01:36:12 +01:00
Benjamin Otte
894db4d96e gpu: Add a cache for YcbcrConversions
We index them only by VkFormat for now because we don't have another
differentiator.

It's unused so far.
2024-01-04 01:36:12 +01:00
Benjamin Otte
d6593f3a3b gpu: Add an "external" allocator to Vulkan
The allocator is supposed to be used with externally allocated vkMemory
objects that are meant to be freed normally - in particular dmabufs.
2024-01-04 01:36:12 +01:00
Benjamin Otte
3f42d92eaf gpu: Add GdkDisplay::vulkan_features
use it to collect the optional features we are interested in and turn
them on only if available.

For now we add the dmabuf features, but we don't use them yet.
2024-01-04 01:36:12 +01:00
Benjamin Otte
33d531b417 gpu: Create Vulkan samplers on-demand 2024-01-04 01:36:12 +01:00
Benjamin Otte
89b1a0a10b gpu: Make Vulkan image formats check use newer functions
This is just an update of all vkGetFoo() calls to use vkGetFoo2().
2024-01-04 01:36:12 +01:00
Benjamin Otte
6e76e8b56e gpu: Move caching to the upload_texture() function
So when uploading a texture, we will automatically put it into the cache
now.
2024-01-04 01:36:11 +01:00
Benjamin Otte
f4879a0f2e gpu: Factor out uploading textures into a vfunc
This way GL and Vulkan can run custom code to import GL textures and
dmabufs.

This function also decides if and how to cache the textures it creates.
2024-01-04 01:36:11 +01:00
Benjamin Otte
cfb2a31382 gpu: Apply clip to ubershader bounds
Fixes excessive bounds when using the ubershader for huge nodes
contained inside clip nodes.
2024-01-04 01:36:11 +01:00
Benjamin Otte
40797e146d gpu: Fail to create images that are too big
It's up to the renderers to handle the NULL return value.
2024-01-04 01:36:11 +01:00
Benjamin Otte
5e6517a43f gpu: Allow texture uploads to fail
The main reason here is that we want to not fail when the texture size
is larger than the supported GpuImage size.

When that happens, for now we just fallback slowly - ulitmately to
drawing with Cairo, which is going to be clipped.
2024-01-04 01:36:11 +01:00
Benjamin Otte
095b798e8c gpu: Add render_texture() fallback impl for huge sizes
This copies over the GLRenderer approach of step-by-step filling a
memorytexture.

It just adds some extra niceties by respecting the best format.
2024-01-04 01:36:11 +01:00
Benjamin Otte
d259b5a8cc gpu: Add gsk_gpu_device_get_max_image_size()
... and initialize it properly.
2024-01-04 01:36:11 +01:00
Benjamin Otte
3c11c703e6 gpu: Handle overlapping rounded rect corners
Have a fallback in place for the most egregious abuses of rounded
corners, like
  0 0 50 50 / 50 0
and the like.

Fixes obscure border colors.
2024-01-04 01:36:11 +01:00
Benjamin Otte
78113ac63c gpu: Add a box shadow shader
Code was inspired mainly by
  https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/
and
  https://pcwalton.github.io/_posts/2015-12-21-drawing-css-box-shadows-in-webrender.html

So far the results aren't cached, that's the task of future commits.
2024-01-04 01:36:11 +01:00
Benjamin Otte
e9f5328010 gpu: Add a rounded color shader
There's multiple uses I want it for:

1. Generating the box-shadow area for blurring
2. Generating masks for rounded-rect masking
3. Optimizing the common use case of rounded-clip + color

Only the last one is implemented in this commit.
2024-01-04 01:36:11 +01:00
Benjamin Otte
463cd55395 gpu: Turn globals into macros
This way, we can be more flexible in refactoring how we handle globals
(guess what we're gonna do next).
2024-01-04 01:36:10 +01:00
Benjamin Otte
ebf291eb2d gpu: Don't try to be smart
Don't try to use all those fancy GL features like glMapBuffer() and
such. Just malloc() some buffer memory and glBufferSubData() it later.

That works everywhere and is faster than (almost?) any combination of
fancy new buffer APIs. And yes I'm frustrated because I played with
those flags and none of them were better than this.

Doubles the framerate on my discrete AMD GPU.
2024-01-04 01:36:10 +01:00
Benjamin Otte
e54ff3110b gpu: Use GL_STREAM_DRAW for the push constants buffer
This seems to hit a bunch of optimizations and makes push constants
slightly faster.
2024-01-04 01:36:10 +01:00
Benjamin Otte
84505db614 gpu: Merge ops on GL, too
Just like on Vulkan, try to minimize the glDrawArrays() calls by merging
adjacent ops.
2024-01-04 01:36:10 +01:00
Benjamin Otte
5e95af0c4c gpu: Refactor image handling
Introduce a new GskGpuImageDescriptors object that tracks descriptors
for a set of images that can be managed by the GPU.
Then have each GskGpuShaderOp just reference the descriptors object they are
using, so that the coe can set things up properly.

To reference an image, the ops now just reference their descriptor -
which is the uint32 we've been sending to the shaders since forever.
2024-01-04 01:36:10 +01:00
Benjamin Otte
ee89451a78 gpu: Add atlas support
... and use it for glyphs.
2024-01-04 01:36:10 +01:00
Benjamin Otte
998ede9e87 gpu: Add a GL optimization
Use glDrawArraysInstancedBaseInstance() to draw. (Yay for GL naming.)
That allows setting up the offset in the vertex array without having to
glVertexAttribPointer() everything again.

However, this is only supported since GL 4.2 and not at all in stock GLES,
so we need to have code that can work without it.
Fortunately, it is mandatory in Vulkan, so every recent GPU supports it.
And if that GPU has a proper driver, it will also expose the GL extension
for it.
(Hint: You can check https://opengles.gpuinfo.org/listextensions.php for
how many proper drivers exist outside of Mesa.)
2024-01-04 01:36:10 +01:00
Benjamin Otte
9fe0eab943 gpu: Make border shader usable for inset/outset
... and use it for those when unblurred.
2024-01-04 01:36:10 +01:00
Benjamin Otte
f0835717b9 gpu: Add GSK_GPU_SKIP env var
The env var allows skipping various optimizations in the GPU shader.

This is useful for testing during development when trying to figure
out how to make a renderer as fast as possible.

We could also use it to enable/disable optimizations depending on GL
version or so, but I didn't think about that too much yet.
2024-01-04 01:36:10 +01:00
Benjamin Otte
33f02a6365 gpu: Copy the clear trick from the Vulkan shader
When drawing opaque color regions that are large enough, use
vkCmdClearAttachments()/glClear() instead of a shader. This speeds up
background rendering on particular on older GPUs.

See the commit messages of
  bb2cd7225e
  ce042f7ba1
  0edd7547c1
for a further discussion of performance impacts.
2024-01-04 01:36:09 +01:00
Benjamin Otte
0d39299337 gpu: Add a color shader
We don't want to use the pattern shader for simple colors, slow GPUs do
not like this at all.
2024-01-04 01:36:09 +01:00
Benjamin Otte
144303afe6 gpu: Implement blur nodes
With the work already done with shadow nodes, this one was easy.
2024-01-04 01:36:09 +01:00
Benjamin Otte
3e2a93352f gpu: Implement shadow nodes 2024-01-04 01:36:09 +01:00
Benjamin Otte
4f3c3a05c9 gpu: Change sorting for ops
The previous algorithm would reverse the order of subpasses, whcih leads
to unexpected behavior if dependent subpasses are not added as children
of a subpass, but just as a previous subpass - like when a subpass is
used multiple times later.

An example for this is a shadow node with multiple shadows - the source
of the shadow is used by the multiple shadows.

So ensure that adjacent subpasses stay in the same order.
2024-01-04 01:36:09 +01:00
Benjamin Otte
733f936350 gpu: Add a "transparent" sampler
This is using the equivalent of EXTEND_NONE, but I wasn't sure what to
call it.

It's unused atm.
2024-01-04 01:36:09 +01:00
Benjamin Otte
cee93a5dc8 gpu: Turn off optimizing in glslc
The code generated by glslc -O is optimized worse by Mesa than
code generated unoptimized.

So generate unoptimized code until somebody figures out what's going
wrong here.
2024-01-04 01:36:09 +01:00
Benjamin Otte
c5dac3298f gpu: Add support for mask patterns 2024-01-04 01:36:09 +01:00
Benjamin Otte
7917b08320 gpu: Add support for cross-fades 2024-01-04 01:36:09 +01:00
Benjamin Otte
83a411890f gpu: Add repeat nodes
They're done using the pattern shader.

The pattern shader now gained a stack where vec4's can be pushed and
popped back later, which allows storing the position before computing
the new position inside the repeat node's child.
2024-01-04 01:36:09 +01:00
Benjamin Otte
4473f5d439 gpu: Introduce gsk_texture() shader function/macro
Due to GLES and old GL not allowing non-constant texture array
lookups,we need to turn the array lookup into a big switch statementin
those versions, and that requires putting the texture() call into that
switch.

But with that trick, we can use texture IDs in GLSL.
2024-01-04 01:36:08 +01:00
Benjamin Otte
da29dd3fbb gpu: Add colorize shader
... and use it for glyphs.

The name is a slight variation of the "coloring" name from the GL
renderer.
The functionality is exactly what the "glyph" shader from the Vulkan
renderer does.
2024-01-04 01:36:08 +01:00
Benjamin Otte
655dcba6ae gpu: Improve conic gradient rendering
1. Compute the fwidth() twice with offset offsets
   That way, we avoid glitches at the boundary between 0.0 and 1.0,
   because by offsetting it by 0.5, that boundary goes away.
   Then we take the min() of both which gives us the one we care about.

2. Set the gradient to repeating
   By doing that, we don't get values at the 0.0/1.0 boundary clamped,
   but things smoothly transition.
   This smoothes the line at that boundary and makes it look just like
   every other line.
2024-01-04 01:36:08 +01:00
Benjamin Otte
c459184b64 gpu: Round offscreens to pixel boundaries
Instead of strictly rounding to the given clip rectangle, increase the
rectangle to the next pixel boundary.

Also add docs that the clip_bounds do not influence the actual size of
the returned image.
2024-01-04 01:36:08 +01:00
Benjamin Otte
275aa1b549 gpu: Add GskGpuPatternWriter
It's just an object that encapsulates everything needed to create (the
data for) a pattern op.

It also clarifies which code does what, because now the NodeProcessor
and the PatternWriter are 2 different things.
2024-01-04 01:36:08 +01:00
Benjamin Otte
1fa8ce7226 gpu: Make shader image access a vfunc
That allows shaders to handle textures differently.

In particularly, it will allow the pattern shader to take a huge amount
of textures.
2024-01-04 01:36:08 +01:00
Benjamin Otte
c94f900946 gpu: Add clip pattern
So now we can clip inside an opacity node without needing fallback.
2024-01-04 01:36:08 +01:00
Benjamin Otte
41a6237799 gpu: Passthrough subsurface nodes
We don't support subsurfaces for now, so we can just ignore the nodes.
2024-01-04 01:36:08 +01:00
Benjamin Otte
5d73d7073c gpu: Add support for debug nodes
Passthrough is always easy.
2024-01-04 01:36:08 +01:00
Benjamin Otte
b06610e614 gpu: Add a border shader
Pretty much a copy of the Vulkan border shader.

A notable change is that the input arguments are changed, because GL
gets confused if you put a mat4 at the end.
2024-01-04 01:36:08 +01:00
Benjamin Otte
1757934582 gpu: Handle nested buffer writes
when doing get_node_as_image(), that may spawn a new buffer writer that
writes into the samme buffer when rendering an offscreen with patterns.

So as a more or less hacky workaround, we now abort the current buffer
write and restart it once we've created the image.
2024-01-04 01:36:07 +01:00
Benjamin Otte
c34b2df412 gpu: Implement conic gradients 2024-01-04 01:36:07 +01:00
Benjamin Otte
59ad96bc30 gpu: Add radial gradients 2024-01-04 01:36:07 +01:00
Benjamin Otte
248a24aa63 gpu: Add linear gradients to pattern shader
This copy/pastes the gist of the Vulkan gradient renderer.
2024-01-04 01:36:07 +01:00
Benjamin Otte
5d5e63eb1d gpu: Add glyphs support
This is very rudimentary, but it's a step in the direction of getting
text going.

There's lots of things missing still.
2024-01-04 01:36:07 +01:00
Benjamin Otte
14081c2c59 gpu: Add a utility function for colors in patterns
... and use it.
2024-01-04 01:36:07 +01:00
Benjamin Otte
3744cf5b8b gpu: Add color-matrix handling to pattern shader 2024-01-04 01:36:07 +01:00
Benjamin Otte
3ba82ab8aa gpu: Make pattern creation always succeed
If creation fails, create an offscreen image instead and draw that as a
texture.

Because offscreens basically always succeed, we can pretty much assume
success everywhere - apart from pattern creation functions that also
create images, because they can run out of shader space.
2024-01-04 01:36:07 +01:00
Benjamin Otte
4b024a8a9e gpu: Have a get_node_as_pattern() function
... and use it to replace all the individual parts of code that get the
node as a pattern.
2024-01-04 01:36:07 +01:00
Benjamin Otte
a354fadd32 gpu: Add a texture pattern
Needs a lot of infrastructure for handling images, but we're handling
images now.
2024-01-04 01:36:06 +01:00
Benjamin Otte
71d064c68e gpu: Move the pattern code into the nodeprocessor
We need the nodeprocessor infrastructure to create patterns, so keeping
it in a different source file would just cause header headaches.
2024-01-04 01:36:06 +01:00
Benjamin Otte
98e52eea50 gpu: Add a texture cache
... and use it when drawing textures.

We'll need it in other places later, but for now that's what we have.
2024-01-04 01:36:06 +01:00
Benjamin Otte
312423eab1 gpu: Make frames carry a timestamp
Frames now carry a timestamp for when they are used.

This is mainly intended to attach timestamps to cached items (textures
or glyphs), but it could in theory also be used when profiling.

We use wallclock time here, not server time, because it's cheaper and
because we're more intereseted in the local machine we're rendering on.
2024-01-04 01:36:06 +01:00
Benjamin Otte
658a68b112 gpu: Make patterns do opacity nodes
Of course, for now this only works for opacity nodes that contain color
nodes, but we're still building up to ore useful stuff here.
2024-01-04 01:36:06 +01:00
Benjamin Otte
b0e26fe13c gpu: Move pattern code into its own file
Now we can extend the pattern creation easily - and we can add new
patterns quickly later.

Plus, we need to keep this file in sync with pattern.glsl and it's neat
when those 2 files reference only each other.
2024-01-04 01:36:06 +01:00
Benjamin Otte
a34fd1c318 gpu: Add float array to shaders and add an ubershader
... and use it for a naive color node implementation using both
so I can test it actually works.
2024-01-04 01:36:06 +01:00
Benjamin Otte
78fd547fd4 gpu: Clip fallback nodes to current clip
Avoids uploading parts of the node that aren't visible.
2024-01-04 01:36:06 +01:00
Benjamin Otte
9cebb8f395 gpu: Set scissor rect before clearing
The render area that restricts clearing on Vulkan needs to be respected
by the GL renderer, too.
2024-01-04 01:36:06 +01:00
Benjamin Otte
bbf162f8e5 gpu: Move global syncing out
This is necessary so that fallback code can properly sync itself,
instead of just add_node().

Fixes a bunch of glitches when fallbacks would be used.
2024-01-04 01:36:06 +01:00
Benjamin Otte
e0d411d13f gpu: Add a flip_y argument to shader execution
Because GL flips its shit sometimes (ie when it's the framebuffer),
pass the height of the target as the flip variable, so commands
that need to operate on the pixels can flip the y axis around this value.
2024-01-04 01:36:05 +01:00
Benjamin Otte
108fb83723 gpu: Add handling for (rounded) clip node(s)
This is again mostly a copy of the Vulkan renderer.

It's a bit awkward codewise with the new invalidation framework,
because we need to cache the previous values individually now,
but it's a lot more finegrained, and we don't emit globals multiple
times when clips are nested.
2024-01-04 01:36:05 +01:00
Benjamin Otte
6cc21122dc gpu: Add scissor operation
Nothing is using it yet (we don't do clipping) apart from initializing
the scissor rect at startup.
2024-01-04 01:36:05 +01:00
Benjamin Otte
737f04f6fe gpu: Add support for transform nodes
This essentially copies the Vulkan renderer machinery, but adapts it to
the new handling with pending globals.
2024-01-04 01:36:05 +01:00
Benjamin Otte
9a6c55566d gpu: Document the coordinate systems we use 2024-01-04 01:36:05 +01:00
Benjamin Otte
d767d56284 gpu: Add gsk_gpu_image_get_projection_matrix()
... and use it to initialize the "proper" projection matrix to use in
shaders.

The resulting viewport will go from top left (0,0) to bottom right
(width, height) and the z clipping plane will go from -10000 to 10000.
2024-01-04 01:36:05 +01:00
Benjamin Otte
0b029fe497 gpu: Handle container nodes
Now everything is slower because we upload every other node
individually!
2024-01-04 01:36:05 +01:00
Benjamin Otte
9e6fad7727 gpu: Add ability to run shaders
This heaves over an inital chunk of code from the Vulkan renderer to
execute shaders.

The only shader that exists for now is a shader that draws a single
texture.
We use that to replace the blit op we were doing before.
2024-01-04 01:36:05 +01:00
Benjamin Otte
df985a53ea inspector: Learn about new renderers 2024-01-04 01:36:05 +01:00
Benjamin Otte
971cbc6478 gsk: Add new renderers to the GSK_RENDERER env var
Use:
  "ngl" for the new GL renderer
  "vulkan" for the new Vulkan renderer
2024-01-04 01:36:05 +01:00
Benjamin Otte
ffb247e975 node-editor: Add the new renderer(s) 2024-01-04 01:36:04 +01:00
Benjamin Otte
05ec9949dc gl: Undeprecate the NGL renderer for now
It's used for the new GPU renderer.
2024-01-04 01:36:04 +01:00
Benjamin Otte
5cf8b66244 gpu: Use gdk_draw_context_empty_frame() when appropriate
It's a new function, so make use of it.
2024-01-04 01:36:04 +01:00
Benjamin Otte
e7890b98a3 gpu: Add outline of new GPU renderer
For now, it just renders using cairo, uploads the result to the GPU,
blits it onto the framebuffer and then is happy.

But it can do that using Vulkan and using GL (no idea which version).

The most important thing still missing is shaders.

It also has a bunch of copy/paste from the Vulkan renderer that isn't
used yet.
But I didn't want to rip it out and then try to copy it back later
2024-01-04 01:36:04 +01:00
Benjamin Otte
28214e3b46 vulkan: Turn Vulkan instances into init/ref/unref
This is not yet used.
2024-01-04 01:36:04 +01:00
Benjamin Otte
c69a0ebc2b vulkan: Remove GskVulkanRenderer
We want to introduce a new one next.

Technically, this breaks API, because gsk_vulkan_renderer_new() is going
away, but practically, we're gonna bring it back once we introduce that
renderer in a few commits.
2024-01-04 01:36:04 +01:00
1442 changed files with 49855 additions and 118439 deletions

View File

@@ -1,4 +1,4 @@
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
BasedOnStyle: GNU
AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBinaryOperators: None

View File

@@ -78,7 +78,6 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.node"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
@@ -117,11 +116,10 @@ release-build:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- mkdir _install
- export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
- .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
- export PATH="$HOME/.local/bin:$PATH"
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
- meson setup
--prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS}
@@ -211,54 +209,51 @@ msys2-mingw64:
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
macos-x86_64:
rules:
# Do not run in forks as the runner is not available there.
# (except for dehesselle who maintains the runner)
- if: $CI_PROJECT_NAMESPACE != "GNOME" && $CI_PROJECT_NAMESPACE != "dehesselle"
when: never
- if: $RUNNER == "macosintel"
variables:
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
when: manual
allow_failure: true
- if: $RUNNER == "macosarm"
variables:
SDKROOT: /opt/sdks/MacOSX11.3.sdk
NINJA_PKG: ninja==1.11.1.1
- if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
parallel:
matrix:
- RUNNER: [ "macosintel", "macosarm" ]
tags:
- ${RUNNER}
- macosintel
needs: []
variables:
EXTRA_MESON_FLAGS: ""
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
MESON_FORCE_BACKTRACKE: 1
TMPDIR: /Users/Shared/work/tmp
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
PIP_CACHE_DIR: /Users/Shared/build/cache
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
EXTRA_MESON_FLAGS: "-Dgobject-introspection:werror=false"
before_script:
- .gitlab-ci/show-info-macos.sh
- python3 -m venv .venv
# Building the introspection feature requires pkg-config and bison.
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
# Not using ccache on purpose as it accelerates the build so much that it
# can trigger race conditions in the gobject-introspection subproject.
- bash .gitlab-ci/show-info-osx.sh
- /opt/macports/bin/python3.10 -m venv .venv
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
- ln -s /opt/pkg-config/bin/pkg-config .venv/bin
- ln -s /opt/bison/bin/bison .venv/bin
- source .venv/bin/activate
- pip3 install meson==1.3.2 $NINJA_PKG
# We're not setting up ccache here on purpose as it accelerates the build
# so much that it triggers race conditions in the gobject-introspection
# subproject.
- pip3 install meson==1.2.0
- pip3 install ninja==1.11.1
- pip3 install /Users/Shared/build/pkgs/PyGObject-3.44.0-cp310-cp310-macosx_10_13_x86_64.whl
/Users/Shared/build/pkgs/pycairo-1.23.0-cp310-cp310-macosx_10_13_x86_64.whl
script:
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=enabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
artifacts:
@@ -433,6 +428,13 @@ asan-build:
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland gtk
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
reference:
image: $FEDORA_IMAGE
@@ -446,10 +448,10 @@ reference:
--force-fallback-for=gdk-pixbuf,pango
-Dintrospection=enabled
-Ddocumentation=true
-Dman-pages=true
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:documentation=true
-Dbuild-demos=true
-Dpango:gtk_doc=true
-Dbuild-demos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false
@@ -461,7 +463,6 @@ reference:
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
- mv _build/docs/reference/gtk/*.html _reference/gtk4/
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
@@ -483,4 +484,3 @@ publish-docs:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
rules:
- if: $CI_COMMIT_REF_NAME == "main"

Binary file not shown.

View File

@@ -2,6 +2,8 @@ FROM fedora:39
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
@@ -16,6 +18,7 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \

View File

@@ -24,10 +24,10 @@ flatpak build ${builddir} meson \
-Dbuild-examples=false \
-Dintrospection=disabled \
-Dbuild-demos=true \
-Dprofile=devel \
-Ddemo-profile=devel \
_flatpak_build
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
flatpak build ${builddir} ninja -C _flatpak_build install
flatpak-builder \
--user --disable-rofiles-fuse \

View File

@@ -1,91 +0,0 @@
#!/bin/bash
set -e
usage() {
cat <<-EOF
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
Check out and install a meson project
Options:
-Dkey=val Option to pass on to meson
--prefix Prefix to install to
--subdir Build subdirectory instead of whole project
--prepare Script to run before build
-h, --help Display this help
EOF
}
TEMP=$(getopt \
--name=$(basename $0) \
--options='D:h' \
--longoptions='prefix:' \
--longoptions='subdir:' \
--longoptions='prepare:' \
--longoptions='help' \
-- "$@")
eval set -- "$TEMP"
unset TEMP
MESON_OPTIONS=()
PREFIX=/usr
SUBDIR=.
PREPARE=:
while true; do
case "$1" in
-D)
MESON_OPTIONS+=( -D$2 )
shift 2
;;
--prefix)
PREFIX=$2
shift 2
;;
--subdir)
SUBDIR=$2
shift 2
;;
--prepare)
PREPARE=$2
shift 2
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
esac
done
if [[ $# -lt 2 ]]; then
usage
exit 1
fi
REPO_URL="$1"
COMMIT="$2"
CHECKOUT_DIR=$(mktemp --directory)
trap "rm -rf $CHECKOUT_DIR" EXIT
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
pushd "$CHECKOUT_DIR/$SUBDIR"
sh -c "$PREPARE"
meson setup --prefix "$PREFIX" _build "${MESON_OPTIONS[@]}"
meson compile -C _build
meson install -C _build
popd

View File

@@ -3,11 +3,6 @@
set -eux -o pipefail
xcodebuild -version || :
if [ -z "$SDKROOT" ]; then
xcodebuild -showsdks || :
else
echo "SDKROOT = $SDKROOT"
fi
xcodebuild -showsdks || :
system_profiler SPSoftwareDataType || :

View File

@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled _build || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

View File

@@ -33,9 +33,7 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad-libs \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject \
mingw-w64-$MSYS2_ARCH-shaderc \
mingw-w64-$MSYS2_ARCH-vulkan \
mingw-w64-$MSYS2_ARCH-vulkan-headers
mingw-w64-$MSYS2_ARCH-shaderc
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
@@ -45,10 +43,11 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
meson setup \
meson \
-Dx11-backend=false \
-Dwayland-backend=false \
-Dwin32-backend=true \
-Dvulkan=disabled \
-Dintrospection=enabled \
-Dgtk:werror=true \
_build

View File

@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
You should not open a new issue for security related questions.
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
When in doubt, follow [security](https://security.gnome.org/).
### Bug reports
@@ -100,16 +100,14 @@ development tools appropriate for your operating system, including:
- Meson
- Ninja
- Gettext (19.7 or newer)
- a [C99 compatible compiler][glib-toolchain-reqs]
- a [C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
Up-to-date instructions about developing GNOME applications and libraries
can be found on [the GNOME Developer Center](https://developer.gnome.org).
The GTK project uses GitLab for code hosting and for tracking issues. More
information about using GitLab can be found on [the GNOME handbook][handbook].
[glib-toolchain-reqs]: https://gitlab.gnome.org/GNOME/glib/-/blob/main/docs/toolchain-requirements.md
[handbook]: https://handbook.gnome.org/infrastructure/gitlab.html
information about using GitLab can be found [on the GNOME
wiki](https://wiki.gnome.org/GitLab).
### Dependencies
@@ -133,7 +131,7 @@ GTK will attempt to download and build some of these dependencies if it
cannot find them on your system.
Additionally, you may want to look at projects that create a development
environment for you, like [jhbuild](https://gitlab.gnome.org/GNOME/jhbuild)
environment for you, like [jhbuild](https://wiki.gnome.org/HowDoI/Jhbuild)
and [gvsbuild](https://github.com/wingtk/gvsbuild).
### Getting started
@@ -146,28 +144,33 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
$ cd gtk
```
**Note**: if you plan to push changes to back to the main repository and
have a GNOME account, you can skip the fork, and use the following instead:
```sh
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
$ cd gtk
```
To compile the Git version of GTK on your system, you will need to
configure your build using Meson:
```sh
$ meson setup _builddir .
$ meson compile -C _builddir
$ meson _builddir .
$ cd _builddir
$ ninja
```
Typically, you should work on your own branch:
```sh
$ git switch -C your-branch
$ git checkout -b your-branch
```
Once you've finished working on the bug fix or feature, push the branch
to the Git repository and open a new merge request, to let the GTK
maintainers review your contribution.
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
Patches cannot be reviewed, and do not not go through the CI pipeline. If
you wish to submit your changes to GTK, always use a merge request.
### Code reviews
Each contribution is reviewed by the core developers of the GTK project.
@@ -210,7 +213,7 @@ Closes #1234
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- If your commit is addressing an issue, use the
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
to automatically close the issue when merging the commit with the upstream
repository:
@@ -259,4 +262,4 @@ people committing to GTK to follow a few rules:
If you have been contributing to GTK for a while and you don't have commit
access to the repository, you may ask to obtain it following the [GNOME account
process](https://handbook.gnome.org/infrastructure/developer-access.html).
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).

734
NEWS
View File

@@ -1,730 +1,6 @@
Overview of Changes in 4.15.5, xx-xx-xxxx
Overview of Changes in 4.13.5, xx-xx-xxxx
=========================================
Overview of Changes in 4.15.4, 30-07-2024
=========================================
* GtkPopover:
- Fix size allocation with wrapping labels
* GtkColumnView:
- Check column visibility when measuring
* CSS:
- Fix fallout from recent changes
- Make implementation of currentcolor inheritance match browsers
* Gdk:
- Introduce GdkColorState for encoding color space information
Currently, we support srgb, srgb-linear, rec2100-pq and rec2100-linear
- Add color states to GdkTexture, as well as to the texture builder
and downloader objects, and convert as necessary
- Add GdkMemoryTextureBuilder
- Attach color states when loading or saving textures
- Add GdkCicpParams to create color state objects for cicp tuples
- Drop GDK_DEBUG=vulkan-validate
Use VK_INSTEANCE_LAYERS=VK_LAYER_KHRONOS_validation instead
* Gsk:
- Improve caching of glyphs and textures
- Remove the uber shader
- Numerous bug fixes
- Fix corner cases in offload handling
- Implement occlusion culling for opaque content
- Allow offloading (some) transformed textures
- Take colorstate into account when compositing
- Add GDK_DEBUG=linear to opt into linear compositing
- Implement tiling for large textures
- Stop using descriptors and go back to simpler texture
management that should work better with older GL
- Use correct shader clip mode for glyphs
- Improve shadow rendering
* Media:
- Attach color states to textures obtained from gstreamer
* Wayland:
- Allow offloading GL textures via dmabuf export
- Suppot the xx-color-management-v4 protocol
* Deprecations:
- GskGLShader and the render node
* Tools:
- Improve the rendernode tool extract command
- Add an image tool that is about manipulating textures
* Build:
- GTK now requires a C11 compiler
* Translation updates
Georgian
Hebrew
Hindi
Occitan
Slovenian
Overview of Changes in 4.15.3, 29-06-2024
=========================================
* Accessibility:
- Only emit notifications when cursor positions change in GtkText
- Fix handling of help text properties
* CSS:
- Fix some crashes introduced in recent currentcolor changes
* DND:
- Avoid a critical
* Documentation:
- Fix many oversights and missing docs
* maxOS:
- Add native keyboard shortcuts
Overview of Changes in 4.15.2, 28-06-2024
=========================================
* GtkFileChooserWidget:
- Plug some memory leaks
- Make Ctrl-Shift-N create a new folder
* GtkPopover:
- Handle resizing and position changes better
* CSS:
- Support color(), oklab(), etc (https://www.w3.org/TR/css-color-4/)
- Support color-mix() (https://www.w3.org/TR/css-color-5/)
- Support relative colors (https://www.w3.org/TR/css-color-5/)
- Support more colorspaces in color()
- Allow percentages for opacity
- Handle currentcolor more correctly
* Accessibility:
- Avoid markup when reading labels
* GSK:
- Subset fonts when serializing node trees
- Make ngl export render_texture results as dmabufs
* Wayland:
- Use xdg-dialog protocol for attached dialogs
* Windows:
- Build with UNICODE
* macOS:
- Implement fullscreen-on-monitor
* Documentation:
- Widget shortcuts and actions are now described in the docs
* Debugging:
- Add GTK_DEBUG=css for warning about deprecated css syntax
* Tools:
- rendernode-tool: Add an extract command for data urls
* Deprecations:
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
* Translation updates:
Czech
Hebrew
Serbian
Overview of Changes in 4.15.1, 21-05-2024
=========================================
* GtkGraphicsOffload:
- Don't crash without a child
* GtkSpinner:
- Don't animate when unmapped
* CSS:
- Support the :root selector
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
- Implement math functions (https://www.w3.org/TR/css-values-4/)
- Support modern syntax and calc in rgb() and hsl()
* Icontheme:
- Make symbolic svg loading more efficient
- Handle color-free symbolics more efficiently
* Accessibility:
- Make the gtk-demo sidebar search more accessible
- Stop emitting focus events
- Realize child contexts when necessary
* GDK:
- Support XDG_ACTIVATION_TOKEN
- dmabuf: Be more defensive when importing unknown formats to GL
- dmabuf: Use narrow range for YUV
- vulkan: Recreate swapchains when necessary or beneficial
* GSK:
- Improve logging for GDK_DEBUG=offload
- Improve logging for GSK_DEBUG=renderer
- gpu: Warn about inefficient texture import
- gpu: Handle tiny offscreens correctly
- vulkan: Add profiler marks in various places
- vulkan: Fix a problem with imported dmabufs showing up black
- cairo: Speed up mask nodes, since we use them for symbolic icons
* Wayland:
- Use wl_compositor version 6
* X11:
- Implement a missing method
* Build:
- Fix many ubsan warnings
* Debugging:
- Show more texture details in the recorder
- Use GTK_DEBUG=css to see CSS deprecations
* macOS:
- Fix problems with events handed back to the OS
- Respect GDK_DEBUG=default-settings
- Allow applictions to handle Dock > Quit
* Deprecations:
- Use of @name colors in CSS
* Translation updates:
Catalan
Georgian
Hungarian
Korean
Portuguese
Turkish
Overview of Changes in 4.15.0, 21-04-2024
=========================================
This release changes the default GSK renderer to be Vulkan, on
Wayland. Other platforms still use ngl.
The intent of this change is to get wider testing and verify that
Vulkan drivers are good enough for us to rely on. If significant
problems show up, we will revert this change for 4.16.
You can still override the renderer choice using the GSK_RENDERER
environment variable.
---
This release also changes font rendering settings by introducing
a new high-level gtk-font-rendering settings which gives GTK more
freedom to decide on font rendering.
You can still use the low-level font-related settings by changing
the new property to 'manual'.
---
* GtkColumnView:
- Fix infinite loops in dispose
- Fix problems with weak ref cycles in GtkExpression
* GtkListView:
* GtkShortcutManager:
- Track the propagation phase of added controllers
* GtkGLArea:
- Produce dmabuf textures, so graphics offload is possible
* GtkTextView:
- Support text shadows
* GtkGraphicsOffload:
- Add a black-background property
* Settings:
- Add a new gtk-font-rendering setting
* Accessibility:
- Add support for GetRangeExtents to GtkAccessibleText
- Add support for GetOffsetAtPoint to GtkAccessibleText
- Implement GtkAccessibleRange for scrollbars
* GDK:
- Add a callback-based cursor API
* GSK:
- Use the Vulkan renderer by default
- Avoid an infinite recursion with offscreens in some cases
- Optimize graphics offload to make it more likely that compositors
can use direct scanout
* X11:
- Fix some confusing debug messages
- Drop a no-longer-relevant optimization that was interfering with
getting the current window manager capabilities
* macOS:
- Implement the color picker for macOS 10.15+
* Debugging:
- Snow monitor resolution in the inspector
* Demos:
- Use graphics offload in the shadertoy demo
- Show more reliable fps numbers in the fishbowl demo
* Tools:
- Support generating pdf in gtk4-rendernode-tool
* Build:
- Require pango 1.52
- Require cairo 1.18
- Add a missing dependency that was causing build failures
- Drop deprecated build options:
gtk_doc -> documentation
update_screenshots -> screenshots
demo-profile -> profile
demos -> build-demos
* Deprecations:
- gdk_widget_set/get_font_options
- gdk_wayland/x11_display_set_cursor_theme
* Translation updates:
Basque
Brazilian Portuguese
British English
Chinese (China)
Hebrew
Kabyle
Persian
Polish
Russian
Slovenian
Swedish
Turkish
Overview of Changes in 4.14.2, 03-04-2024
=========================================
* GtkScale:
- Improve positioning of values in some cases
* Theme:
- Make progress in entries visible
* Accessibility:
- Fix text insertion handling
* GDK:
- dnd: Use the default cursor durion motion
- dnd: Use a better cursor for indicating the move action
* GSK:
- gl: Handle offloads in offscreen context better
- Fix text rendering problems with some fonts
* Wayland:
- Tighten up some protocol version checks
- Use the presentation time protocol
- Fix a crash with subsurfaces
- Improve settings portal handling
* macOS:
- Fix up the app menu support
* Windows:
- Fix problems with minimization
- Fix build without fontconfig
* Debugging:
- Add font settings in the inspector
* Demos:
- Clean up the application demo
- Update cursor images for the cursor demo
* Translation updates:
Catalan
Czech
French
Georgian
Hebrew
Persian
Slovenian
Turkish
Ukrainian
Overview of Changes in 4.14.1, 16-03-2024
=========================================
* GtkTextView:
- Fix a mixup of cursor and anchor when retrieving surrounding text
in input methods
* Printing:
- Avoid accessing freed printers
* Accessibility:
- Fix memory leaks
* GDK:
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
- Add a GDK_GL_DISABLE environment variable
* GSK:
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
- Speed up handling of repeated ops, which should help for text
- Speed up the inner loop of text node conversion
- Drop the glyph-align optimization flag
- ngl: Avoid reusing frames while they are in use
- Fix flickering thumbnails in nautilus
- Speed up buffer handling in both ngl and Vulkan
* Demos:
- Skip demos using gl shaders when we're not using the gl renderer
* Build:
- Fix some ubsan warnings
- Avoid zink in ci since it spams stderr
* Translation updates:
Czech
German
Korean
Russian
Overview of Changes in 4.14.0, 12-03-2024
=========================================
Note: The new renderers and dmabuf support are using graphics drivers
in different ways than the old gl renderer, and trigger new driver bugs,
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
recommended to use the latest mesa release (24.x) with the new renderers.
* GtkTextView:
- Don't snapshot children twice
- Don't blink the cursor when hidden
* GtkEmojiChooser:
- Fix presentation selector handling
* GtkSnapshot:
- Fix wrong nodes with transformed shadows
* GtkIMContext:
- Make gtk_im_context_activate_osk public
* Accessibility:
- Implement get_contents_at for all our text widgets
- Add GtkAccessibleText.get_default_attributes
* GSK:
- Don't fall back to cairo for software rendering. gl+llvmpipe is better
- Round vertical glyph position to a device pixel position if the font is hinted
- Fix problems with clip handling
- Make vulkan and ngl match their font handling
- Fix some corner-cases with offloading and clips
- Fix problem with rendering of missing glyphs in hinted fonts
* MacOs:
- Implement cursor-from-texture
* Translation updates:
Basque
British English
French
Indonesian
Kazakh
Latvian
Lithuanian
Norwegian Bokmål
Slovenian
Spanish
Turkish
Overview of Changes in 4.13.9, 02-03-2024
=========================================
* GtkEditable:
- Fix preconditions to be not too strict
* GtkEmojiChooser:
- Support search in the locale as well as in English
* GtkIconTheme:
- Make gtk_icon_paintable_new_for_file support symbolics
* GtkVideo:
- Fix a problem with cursor handling that could lead to crashes
* Accessibility:
- Fix GetCharacterAtOffset implementation
- Add a Terminal role
- Make TextCaretMoved match gtk3
- Support multiple levels of GtkEditable delegates
* GSK:
- Make the node parser more flexible for text nodes
- Change the way font scaling is handled to avoid clipping
- Fix handling of missing glyphs in the new renderers
* X11:
- Don't claim to support shadows without a compositor
* Wayland:
- Fix handling of output scales
* Tools:
- Add a compare command to gtk4-rendernode-tool
* Build:
- Fix some ubsan complaints
* Translation updates:
Basque
British English
Catalan
Finnish
Galician
Georgian
Hebrew
Indonesian
Kazakh
Latvian
Lithuanian
Persian
Polish
Russian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in 4.13.8, 20-02-2024
=========================================
* Accessibility:
- Add a GtkAccessibleText interface for allowing 3rd party
text widgets (notably vte) to be accessible
- Avoid duplicate accessible descriptions
- Fix GetAccessibleAtPoint
* GSK:
- Avoid offscreens for disjoint containers
- Don't use the gpu renderers with llvmpipe
- Fix various rendering issues found by tests
- Allow unnormalized node bounds again
- Fix a broken case of rounded-rect intersection
- Fix handling of external textures in gpu renderers
- Make gpu renderers work with WGL on Windows
* build:
- Allow building without dmabuf support on (old) Linux
* X11:
- Fix monitor enter/leave signals
* Translation updates:
Basque
Brazilian Portuguese
Catalan
Czech
Galician
Georgian
Hebrew
Lithuanian
Persian
Russian
Turkish
Ukrainian
Overview of Changes in 4.13.7, 11-02-2024
=========================================
* GtkFileChooser:
- Speed up opening
* GtkCalendar:
- Add some missing setters and getters
* Accessibility:
- Add socket support for webkit accessibility
- Implement AT-SPI text for GtkText
- Implement AT-SPI component generically
- Add an announce API
* GSK:
- Make the ngl renderer work on macOS
- Fix a crash in the vulkan renderer
- Make nodeparser allow aliases for fonts again
- Implement cache eviction for glyph and texture caches
- Fix ngl shaders to work on GL < 4.0
- Require GL 3.3 for the ngl renderer
- Fix problems with scaled shadows
- Fix problems with holes for underlaid subsurfaces
- Improve handling of scales and glyph cache efficiency
* Media:
- Support dmabufs in the gstreamer backend. This allows
zero-copy video playback on Wayland when paired with
hardware video decoding
- Drop the experimental ffmpeg backend. It hasn't been
building for a year
* Wayland:
- Commit empty frames if and double-buffered state is pending
- Fix monitor size information when using mutter without
the scale-monitor-framebuffer setting
- Clear the current tablet on tab leave, fixing a crash
* macOS:
- Propagate unhandled input events back to the OS
* Tools:
- Make the crash handling in gtk4-node-editor more robust
* Translation updates
Galician
Georgian
Occitan
Turkish
Overview of Changes in 4.13.6, 25-01-2024
=========================================
This release changes the ngl renderer to be the default renderer.
The intent of this change is to get wider testing and verify that
the new renderers are production-ready. If significant problems
show up, we will revert this change for 4.14.
You can still override the renderer choice using the GSK_RENDERER
environment variable.
Since ngl can handle fractional scaling much better than the old gl
renderer, we allow fractional scaling by default with gl now. If you
are using the old gl renderer (e.g. because your system is limited to
GLES2), you can disable fractional scaling by setting the GDK_DEBUG
environment variable to include the gl-no-fractional key.
* GtkColumnView:
- Fix infinite loops in dispose
- Fix problems with weak ref cycles in GtkExpression
* GtkListView:
- Fix some corner cases with sections during insertions and deletions
- Don't double-recycle widgets
* GtkStack:
- Add automatic cleanup for GtkStackPage
* GDK:
- Use standard cursor names for drag cursors
- Enable fractional scaling with gl by default
* GSK:
- Many fixes and improvements to the unified renderers:
- Fix text rendering with the uber shader
- Fix rounding issues with fractional scales
- Fix some memory leaks
- Many text rendering fixes
- Implement subpixel positioning for glyphs
- Support custom fonts in node files
- Add tests for font rendering
- Fix drawing of repeat nodes
- Implement subpixels positioning
- Evict stale textures, glyphs and atlases from the cache
- Some fixes and improvements to the GL renderer:
- Fix problems with GLES on Nvidia
- Avoid a crash in the mask demo
- Respect opacity of the first child node in containers
- Some fixes and improvements to the fallback renderer:
- Fix drawing of repeat nodes
- Make ngl the default renderer
* Wayland:
- Fix problems with tablet cursors
- Fix problems without seats
* Accessibility:
- Respect a separate "show-status-shapes setting
- Fix change notification for accessible names on some widgets
* Inspector:
- Show the git commit in devel builds
* Tools:
- Make gtk4-node-editor autosave its contents
- Add a benchmark command to gtk4-rendernode-tool
* Translation updates:
French
Galician
Georgian
Occitan
Persian
Russian
Vietnamese
Overview of Changes in 4.13.5, 07-01-2024
=========================================
This release adds two new GSK renderers called vulkan and ngl,
that are built from the same sources. The new renderers can
handle many corner cases correctly that the current gl renderer
does not handle, and they offer advantages such as antialiasing
and supersampled gradients.
The new renderers are still considered experimental, and GTK
will only use them if they are explicitly selected using the
GSK_RENDERER environment variable.
As part of this work, the GSK include files have been rearranged.
It is no longer necessary to include renderer-specific headers for
ngl and vulkan (and doing so will trigger deprecation warnings),
and their constructors are always available.
The previously available experimental GdkVulkanContext APIs and
the old Vulkan renderer have been removed.
Vulkan is now enabled by default, and Linux distributions should
build GTK with Vulkan support. This requires the glslc shader
compiler as a new dependency.
Vulkan is now also used for dmabuf support.
* GtkDropdown:
- Fix display of initial selection
* GtkShortcutsWindow:
- Make the window adapt to smaller screen widths
* GtkTextView:
- Fix a possible NULL dereference in history
* GDK:
- Make the png loader safer against overflows
* GL:
- Fix some errors in handling of texture formats and mipmaps
Overview of Changes in 4.13.4, 30-12-2023
=========================================
@@ -1203,7 +479,7 @@ Overview of Changes in 4.11.4, 03-07-2023
- Center newly created transient windows
* Vulkan:
- Add antialiasing for gradients
- Add antialising for gradients
- Do less work on clipped away nodes
- Redo image uploading
- Support different image depths and formats
@@ -2187,7 +1463,7 @@ Overview of Changes in 4.7.0, 07-05-2022
- Event handling fixes
- Fix keyboard input on popovers
- Support OpenGL-based video playback
- Support fullscreen
- Suport fullscreen
- Improve native filechoooser size allocation
- Use CALayer and IOSurface for rendering
- Use a per-monitor CVDisplayLink
@@ -2584,7 +1860,7 @@ Overview of Changes in 4.4.0
- Activate when moving focus
* GtkLabel:
- Properly ignore double underscores for mnemonics
- Propertly ignore double underscores for mnemonics
* GtkPopoverMenu:
- Fix focus cycling
@@ -3131,7 +2407,7 @@ Overview of Changes in 4.1.0
- Set sort arrows in CSS
- Set menu button arrows in CSS
- Make scrollbars larger
- Support circular menubuttons
- Supprt circular menubuttons
* CSS:
- Implement transform-origin

View File

@@ -39,21 +39,18 @@ Nightly documentation can be found at
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk4/
Nightly flatpaks of our demos can be installed from the
[GNOME Nightly](https://nightly.gnome.org/) repository:
```sh
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak install gnome-nightly org.gtk.Demo4
flatpak install gnome-nightly org.gtk.WidgetFactory4
flatpak install gnome-nightly org.gtk.IconBrowser4
```
[GNOME Nightly](https://wiki.gnome.org/Apps/Nightly) repository:
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
- `flatpak install gnome-nightly org.gtk.Demo4`
- `flatpak install gnome-nightly org.gtk.WidgetFactory4`
- `flatpak install gnome-nightly org.gtk.IconBrowser4`
Building and installing
-----------------------
In order to build GTK you will need:
- [a C11 compatible compiler](https://gitlab.gnome.org/GNOME/glib/-/blob/main/docs/toolchain-requirements.md)
- [a C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
- [Python 3](https://www.python.org/)
- [Meson](http://mesonbuild.com)
- [Ninja](https://ninja-build.org)
@@ -128,7 +125,7 @@ version, for example `gtk-4-10`.
How to report bugs
------------------
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
In the bug report please include:

View File

@@ -185,8 +185,9 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -114,8 +114,9 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -114,8 +114,9 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{
@@ -130,6 +131,7 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

View File

@@ -114,8 +114,9 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{
@@ -130,6 +131,7 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -15,54 +15,12 @@ on_destroy (gpointer data)
window = NULL;
}
static GdkTexture *
cursor_callback (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data)
{
GdkPixbuf *pixbuf;
GdkTexture *texture;
GError *error = NULL;
int scaled_size;
scaled_size = ceil (cursor_size * scale);
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
scaled_size, scaled_size,
TRUE,
&error);
if (!pixbuf)
{
g_print ("%s\n", error->message);
g_error_free (error);
return NULL;
}
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
*width = cursor_size;
*height = cursor_size;
*hotspot_x = 18 * cursor_size / 32.0;
*hotspot_y = 2 * cursor_size / 32.0;
return texture;
}
GtkWidget *
do_cursors (GtkWidget *do_widget)
{
if (!window)
{
GtkBuilder *builder;
GtkWidget *logo_callback;
GdkCursor *cursor;
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
gtk_widget_set_cursor (logo_callback, cursor);
g_object_unref (cursor);
g_object_unref (builder);
}

File diff suppressed because it is too large Load Diff

View File

@@ -116,7 +116,6 @@
<file>w_resize_cursor.png</file>
<file>zoom_in_cursor.png</file>
<file>zoom_out_cursor.png</file>
<file>gtk-logo.svg</file>
</gresource>
<gresource prefix="/dnd">
<file>dnd.css</file>

View File

@@ -170,7 +170,6 @@ update_paintable (GtkWidget *widget,
static GtkWidget *
create_cogs (void)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkWidget *picture;
static GskGLShader *cog_shader = NULL;
GdkPaintable *paintable;
@@ -183,13 +182,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
return picture;
G_GNUC_END_IGNORE_DEPRECATIONS
}
static gboolean
check_cogs (GtkFishbowl *fb)
{
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
}
static void
@@ -226,41 +218,36 @@ create_graph (void)
static const struct {
const char *name;
GtkWidget * (* create_func) (void);
gboolean (* check) (GtkFishbowl *fb);
GtkWidget * (*create_func) (void);
} widget_types[] = {
{ "Icon", create_icon, NULL },
{ "Button", create_button, NULL },
{ "Blurbutton", create_blurred_button, NULL },
{ "Fontbutton", create_font_button, NULL },
{ "Levelbar", create_level_bar, NULL },
{ "Label", create_label, NULL },
{ "Spinner", create_spinner, NULL },
{ "Spinbutton", create_spinbutton, NULL },
{ "Video", create_video, NULL },
{ "Gears", create_gears, NULL },
{ "Switch", create_switch, NULL },
{ "Menubutton", create_menu_button, NULL },
{ "Shader", create_cogs, check_cogs },
{ "Tiger", create_tiger, NULL },
{ "Graph", create_graph, NULL },
{ "Icon", create_icon },
{ "Button", create_button },
{ "Blurbutton", create_blurred_button },
{ "Fontbutton", create_font_button },
{ "Levelbar", create_level_bar },
{ "Label", create_label },
{ "Spinner", create_spinner },
{ "Spinbutton", create_spinbutton },
{ "Video", create_video },
{ "Gears", create_gears },
{ "Switch", create_switch },
{ "Menubutton", create_menu_button },
{ "Shader", create_cogs },
{ "Tiger", create_tiger },
{ "Graph", create_graph },
};
static int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
static gboolean
static void
set_widget_type (GtkFishbowl *fishbowl,
int widget_type_index)
{
GtkWidget *window;
if (widget_type_index == selected_widget_type)
return TRUE;
if (widget_types[widget_type_index].check != NULL &&
!widget_types[widget_type_index].check (fishbowl))
return FALSE;
return;
selected_widget_type = widget_type_index;
@@ -270,8 +257,6 @@ set_widget_type (GtkFishbowl *fishbowl,
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
gtk_window_set_title (GTK_WINDOW (window),
widget_types[selected_widget_type].name);
return TRUE;
}
G_MODULE_EXPORT void
@@ -279,17 +264,14 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index = selected_widget_type;
int new_index;
do
{
if (new_index + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = new_index + 1;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected_widget_type + 1;
}
while (!set_widget_type (fishbowl, new_index));
set_widget_type (fishbowl, new_index);
}
G_MODULE_EXPORT void
@@ -297,18 +279,14 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index = selected_widget_type;
int new_index;
do
{
if (new_index - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = new_index - 1;
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
}
while (!set_widget_type (fishbowl, new_index));
set_widget_type (fishbowl, new_index);
}
G_MODULE_EXPORT void

View File

@@ -600,8 +600,8 @@ update_display (void)
if (s->len > 0)
{
pango_font_description_set_variations (desc, s->str);
g_string_free (s, TRUE);
}
g_string_free (s, TRUE);
font_desc = pango_font_description_to_string (desc);
@@ -1586,7 +1586,7 @@ update_font_variations (void)
}
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
g_signal_connect (combo, "notify::selected", G_CALLBACK (instance_changed), NULL);
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
demo->instance_combo = combo;
}

View File

@@ -363,9 +363,7 @@ insert_markup_idle (gpointer data)
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
guint id;
id = g_idle_add (insert_markup_idle, data);
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
g_idle_add (insert_markup_idle, data);
return G_SOURCE_REMOVE;
}
@@ -400,9 +398,7 @@ parse_markup_idle (gpointer data)
do {
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
guint id;
id = g_idle_add (parse_markup_idle, data);
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
g_idle_add (parse_markup_idle, data);
return G_SOURCE_REMOVE;
}

View File

@@ -20,8 +20,6 @@
#include "gtkshadertoy.h"
#include "gskshaderpaintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *demo_window = NULL;
static void
@@ -362,5 +360,3 @@ do_gltransition (GtkWidget *do_widget)
return demo_window;
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -22,8 +22,6 @@
#include <gtk/gtk.h>
#include "gskshaderpaintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GskShaderPaintable:
*
@@ -334,5 +332,3 @@ gsk_shader_paintable_update_time (GskShaderPaintable *self,
g_bytes_unref (args);
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -22,8 +22,6 @@
#include <gdk/gdk.h>
#include <gsk/gsk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
@@ -43,5 +41,3 @@ void gsk_shader_paintable_update_time (GskShaderPaintable *self
int time_idx,
gint64 frame_time);
G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
id="svg6843"
sodipodi:version="0.32"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
version="1.0"
sodipodi:docname="gtk-logo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
inkscape:export-xdpi="192"
inkscape:export-ydpi="192">
<defs
id="defs6845">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-50 : 600 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="700 : 600 : 1"
inkscape:persp3d-origin="300 : 400 : 1"
id="perspective13" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.8284271"
inkscape:cx="69.874353"
inkscape:cy="64.313526"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:document-units="px"
inkscape:grid-bbox="true"
width="128px"
height="128px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid7947" />
</sodipodi:namedview>
<metadata
id="metadata6848">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:date />
<dc:creator>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:publisher>
<dc:identifier />
<dc:source />
<dc:relation />
<dc:language />
<dc:subject>
<rdf:Bag />
</dc:subject>
<dc:coverage />
<dc:description />
<dc:contributor>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:contributor>
<cc:license
rdf:resource="" />
</cc:Work>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:nodetypes="ccccc"
id="path6976"
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6978"
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6980"
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
sodipodi:nodetypes="ccc"
id="path6982"
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
id="path6984"
d="M 70.434539,17.875593 L 70.434539,66.984877"
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -456,33 +456,43 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GdkFrameClock *frame_clock;
GdkFrameTimings *end;
gint64 end_counter;
double fps, expected_fps;
GdkFrameTimings *start, *end;
gint64 start_counter, end_counter;
gint64 n_frames, expected_frames;
gint64 start_timestamp, end_timestamp;
gint64 interval;
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
if (frame_clock == NULL)
return;
fps = gdk_frame_clock_get_fps (frame_clock);
if (fps <= 0.0)
start_counter = gdk_frame_clock_get_history_start (frame_clock);
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end_counter - start_counter < 4)
return;
priv->framerate = fps;
start_timestamp = gdk_frame_timings_get_presentation_time (start);
end_timestamp = gdk_frame_timings_get_presentation_time (end);
if (start_timestamp == 0 || end_timestamp == 0)
{
start_timestamp = gdk_frame_timings_get_frame_time (start);
end_timestamp = gdk_frame_timings_get_frame_time (end);
}
n_frames = end_counter - start_counter;
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
priv->framerate = ((int)(priv->framerate * 100))/100.0;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
if (!priv->benchmark)
return;
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end == NULL)
return;
interval = gdk_frame_timings_get_refresh_interval (end);
if (interval == 0)
{
@@ -490,16 +500,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
if (interval == 0)
return;
}
expected_fps = (double) G_USEC_PER_SEC / interval;
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
if (fps > (expected_fps - 1))
if (n_frames >= expected_frames)
{
if (priv->last_benchmark_change > 0)
priv->last_benchmark_change *= 2;
else
priv->last_benchmark_change = 1;
}
else if (0.95 * fps < expected_fps)
else if (n_frames + 1 < expected_frames)
{
if (priv->last_benchmark_change < 0)
priv->last_benchmark_change--;

View File

@@ -1,7 +1,5 @@
#include "gtkshaderbin.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct {
GskGLShader *shader;
GtkStateFlags state;
@@ -264,5 +262,3 @@ gtk_shader_bin_new (void)
return GTK_WIDGET (self);
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -2,8 +2,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS
#define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ())
@@ -20,5 +18,3 @@ void gtk_shader_bin_set_child (GtkShaderBin *self,
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -1,7 +1,5 @@
#include "gtkshaderstack.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GtkShaderStack
{
GtkWidget parent_instance;
@@ -361,5 +359,3 @@ gtk_shader_stack_set_active (GtkShaderStack *self,
self->current = MIN (index, self->children->len);
update_child_visible (self);
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -2,8 +2,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS
#define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ())
@@ -20,5 +18,3 @@ void gtk_shader_stack_set_active (GtkShaderStack *self,
int index);
G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -116,9 +116,7 @@ static gboolean gtk_shadertoy_tick (GtkWidget *widget,
GtkWidget *
gtk_shadertoy_new (void)
{
return g_object_new (gtk_shadertoy_get_type (),
"allowed-apis", GDK_GL_API_GL,
NULL);
return g_object_new (gtk_shadertoy_get_type (), NULL);
}
static void

View File

@@ -354,7 +354,6 @@ do_images (GtkWidget *do_widget)
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
g_object_unref (gicon);
gtk_frame_set_child (GTK_FRAME (frame), image);

View File

@@ -40,7 +40,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
{
wchar_t *langname_w = NULL;
wchar_t locale_abbrev_w[9];
gchar *langname, *locale_abbrev, *locale;
gchar *langname, *locale_abbrev, *locale, *p;
gint i;
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
GHashTable *ht_scripts_langs = (GHashTable *) param;
@@ -59,6 +59,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
p = strchr (locale, '-');
lang = pango_language_from_string (locale);
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
g_hash_table_insert (ht_scripts_langs, lang, langname);

View File

@@ -1,5 +1,4 @@
/* Lists/Selections
* #Keywords: suggestion, completion
*
* The GtkDropDown widget is a modern alternative to GtkComboBox.
* It uses list models instead of tree models, and the content is

View File

@@ -20,12 +20,11 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include "demos.h"
#include "fontify.h"
#include "profile_conf.h"
#include "demo_conf.h"
static GtkWidget *info_view;
static GtkWidget *source_view;
@@ -828,25 +827,13 @@ demo_search_changed_cb (GtkSearchEntry *entry,
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static gboolean
demo_can_run (GtkWidget *window,
const char *name)
{
if (name != NULL && strcmp (name, "gltransition") == 0)
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
return TRUE;
}
static GListModel *
create_demo_model (GtkWidget *window)
create_demo_model (void)
{
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
DemoData *demo = gtk_demos;
GtkDemo *d;
gtk_widget_realize (window);
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
d->name = "main";
d->title = "GTK Demo";
@@ -858,20 +845,16 @@ create_demo_model (GtkWidget *window)
while (demo->title)
{
DemoData *children = demo->children;
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
DemoData *children = demo->children;
if (demo_can_run (window, demo->name))
{
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
g_list_store_append (store, d);
}
g_list_store_append (store, d);
if (children)
{
@@ -879,19 +862,15 @@ create_demo_model (GtkWidget *window)
while (children->title)
{
if (demo_can_run (window, children->name))
{
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
g_list_store_append (G_LIST_STORE (d->children_model), child);
}
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
g_list_store_append (G_LIST_STORE (d->children_model), child);
children++;
}
}
@@ -924,34 +903,6 @@ clear_search (GtkSearchBar *bar)
}
}
static void
search_results_update (GObject *filter_model,
GParamSpec *pspec,
GtkEntry *entry)
{
gsize n_items = g_list_model_get_n_items (G_LIST_MODEL (filter_model));
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0)
{
char *text;
if (n_items > 0)
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", (long) n_items), (long) n_items);
else
text = g_strdup (_("No search results"));
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, text,
-1);
g_free (text);
}
else
{
gtk_accessible_reset_property (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
}
}
static void
activate (GApplication *app)
{
@@ -985,7 +936,7 @@ activate (GApplication *app)
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
listmodel = create_demo_model (window);
listmodel = create_demo_model ();
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
FALSE,
TRUE,
@@ -999,7 +950,6 @@ activate (GApplication *app)
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
g_signal_connect (filter_model, "notify::n-items", G_CALLBACK (search_results_update), search_entry);
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);

View File

@@ -2,7 +2,7 @@
<interface>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
<attribute name="label" translatable="yes">_Application</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_New</attribute>
@@ -33,7 +33,7 @@
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="label" translatable="yes">_File</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>

View File

@@ -236,7 +236,7 @@ foreach flag: common_cflags
endif
endforeach
gtkdemo_deps += [ profile_conf_h ]
gtkdemo_deps += [ demo_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -53,9 +53,7 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double rotation)
{
#define RADIUS 0.3
GskPathBuilder *builder;
GskPath *path;
GskStroke *stroke;
cairo_t *cr;
double size;
gtk_snapshot_append_color (snapshot,
@@ -63,29 +61,24 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size));
gdk_cairo_set_source_rgba (cr, foreground);
cairo_translate (cr, width / 2.0, height / 2.0);
cairo_scale (cr, size, size);
cairo_rotate (cr, rotation);
gtk_snapshot_save (snapshot);
cairo_arc (cr, 0, 0, 0.1, - G_PI, G_PI);
cairo_fill (cr);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0));
gtk_snapshot_scale (snapshot, size, size);
gtk_snapshot_rotate (snapshot, rotation);
cairo_set_line_width (cr, RADIUS);
cairo_set_dash (cr, (double[1]) { RADIUS * G_PI / 3 }, 1, 0.0);
cairo_arc (cr, 0, 0, RADIUS, - G_PI, G_PI);
cairo_stroke (cr);
builder = gsk_path_builder_new ();
gsk_path_builder_add_circle (builder, graphene_point_zero (), 0.1);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_append_fill (snapshot, path, GSK_FILL_RULE_WINDING, foreground);
gsk_path_unref (path);
stroke = gsk_stroke_new (RADIUS);
gsk_stroke_set_dash (stroke, (float[1]) { RADIUS * G_PI / 3 }, 1);
builder = gsk_path_builder_new ();
gsk_path_builder_add_circle (builder, graphene_point_zero(), RADIUS);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_append_stroke (snapshot, path, stroke, foreground);
gsk_path_unref (path);
gsk_stroke_free (stroke);
gtk_snapshot_restore (snapshot);
cairo_destroy (cr);
}
/* Here, we implement the functionality required by the GdkPaintable interface */

View File

@@ -70,7 +70,7 @@ gtk_nuclear_animation_snapshot (GdkPaintable *paintable,
? &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 } /* yellow */
: &(GdkRGBA) { 0, 0, 0, 0 }, /* transparent */
width, height,
360 * nuclear->progress / MAX_PROGRESS);
2 * G_PI * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintable *
@@ -85,7 +85,7 @@ gtk_nuclear_animation_get_current_image (GdkPaintable *paintable)
* Luckily we added the rotation property to the nuclear icon
* object previously, so we can just return an instance of that one.
*/
return gtk_nuclear_icon_new (360 * nuclear->progress / MAX_PROGRESS);
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintableFlags

View File

@@ -76,7 +76,7 @@ gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
360 * nuclear->progress / DURATION);
2 * G_PI * nuclear->progress / DURATION);
}
static GdkPaintable *
@@ -85,7 +85,7 @@ gtk_nuclear_media_stream_get_current_image (GdkPaintable *paintable)
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (paintable);
/* Same thing as with the animation */
return gtk_nuclear_icon_new (360 * nuclear->progress / DURATION);
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / DURATION);
}
static GdkPaintableFlags

View File

@@ -338,7 +338,7 @@ do_path_maze (GtkWidget *do_widget)
GskPath *path;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), aspect);
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);

View File

@@ -4,7 +4,7 @@
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "profile_conf.h"
#include "demo_conf.h"
struct _IconBrowserApp
{

View File

@@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -1,3 +1,16 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('demo-profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.project_source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
build_always_stale: true,
)
)
# appdata
appdata_config = configuration_data()

View File

@@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources',
executable('gtk4-node-editor',
sources: [node_editor_sources, node_editor_resources],
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
c_args: common_cflags,
win_subsystem: 'windows',

View File

@@ -19,13 +19,11 @@
#include "config.h"
#include <glib/gstdio.h>
#include "node-editor-application.h"
#include "node-editor-window.h"
#include "profile_conf.h"
#include "demo_conf.h"
static const char *css =
"textview.editor {"
@@ -249,63 +247,11 @@ node_editor_application_class_init (NodeEditorApplicationClass *class)
application_class->open = node_editor_application_open;
}
static void
print_version (void)
{
g_print ("gtk4-node-editor %s%s%s\n",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
}
static int
local_options (GApplication *app,
GVariantDict *options,
gpointer data)
{
gboolean version = FALSE;
gboolean reset = FALSE;
g_variant_dict_lookup (options, "version", "b", &version);
if (version)
{
print_version ();
return 0;
}
g_variant_dict_lookup (options, "reset", "b", &reset);
if (reset)
{
char *path;
path = get_autosave_path ("-unsafe");
g_remove (path);
g_free (path);
path = get_autosave_path (NULL);
g_remove (path);
g_free (path);
}
return -1;
}
NodeEditorApplication *
node_editor_application_new (void)
{
NodeEditorApplication *app;
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
"application-id", "org.gtk.gtk4.NodeEditor",
"flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_NON_UNIQUE,
NULL);
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
g_application_add_main_option (G_APPLICATION (app), "reset", 0, 0,G_OPTION_ARG_NONE, "Remove autosave content", NULL);
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
return app;
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
"application-id", "org.gtk.gtk4.NodeEditor",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}

View File

@@ -24,11 +24,13 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
#include <glib/gstdio.h>
#ifdef GDK_RENDERING_VULKAN
#include "gsk/vulkan/gskvulkanrenderer.h"
#endif
#include <cairo.h>
#ifdef CAIRO_HAS_SVG_SURFACE
@@ -57,7 +59,6 @@ struct _NodeEditorWindow
GtkWidget *testcase_name_entry;
GtkWidget *testcase_save_button;
GtkWidget *scale_scale;
GtkWidget *crash_warning;
GtkWidget *renderer_listbox;
GListStore *renderers;
@@ -67,10 +68,6 @@ struct _NodeEditorWindow
GFileMonitor *file_monitor;
GArray *errors;
gboolean auto_reload;
gboolean mark_as_safe_pending;
gulong after_paint_handler;
};
struct _NodeEditorWindowClass
@@ -78,13 +75,6 @@ struct _NodeEditorWindowClass
GtkApplicationWindowClass parent_class;
};
enum {
PROP_AUTO_RELOAD = 1,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
static void
@@ -177,121 +167,19 @@ text_iter_skip_whitespace_backward (GtkTextIter *iter)
}
static void
highlight_text (NodeEditorWindow *self)
{
GtkTextIter iter;
GtkTextIter start, end;
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
while (!gtk_text_iter_is_end (&iter))
{
gunichar c = gtk_text_iter_get_char (&iter);
if (c == '{')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename", &word_start, &word_end);
}
else if (c == ':')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname", &word_start, &word_end);
}
else if (c == '"')
{
GtkTextIter string_start = iter;
GtkTextIter string_end = iter;
gtk_text_iter_forward_char (&iter);
while (!gtk_text_iter_is_end (&iter))
{
c = gtk_text_iter_get_char (&iter);
if (c == '"')
{
gtk_text_iter_forward_char (&iter);
string_end = iter;
break;
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string", &string_start, &string_end);
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
}
static void
mark_autosave_as_unsafe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path2, path1);
}
static void
mark_autosave_as_safe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path1, path2);
}
static void
after_paint (GdkFrameClock *clock,
NodeEditorWindow *self)
{
if (self->mark_as_safe_pending)
{
self->mark_as_safe_pending = FALSE;
mark_autosave_as_safe ();
}
}
static void
reload (NodeEditorWindow *self)
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
char *text;
GBytes *bytes;
GtkTextIter iter;
GtkTextIter start, end;
float scale;
GskRenderNode *big_node;
mark_autosave_as_unsafe ();
g_array_remove_range (self->errors, 0, self->errors->len);
text = get_current_text (self->text_buffer);
text_buffer_remove_all_tags (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
g_clear_pointer (&self->node, gsk_render_node_unref);
@@ -353,20 +241,72 @@ reload (NodeEditorWindow *self)
g_clear_pointer (&big_node, gsk_render_node_unref);
self->mark_as_safe_pending = TRUE;
}
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
static void
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
g_array_remove_range (self->errors, 0, self->errors->len);
text_buffer_remove_all_tags (self->text_buffer);
while (!gtk_text_iter_is_end (&iter))
{
gunichar c = gtk_text_iter_get_char (&iter);
if (self->auto_reload)
reload (self);
if (c == '{')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
highlight_text (self);
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename",
&word_start, &word_end);
}
else if (c == ':')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname",
&word_start, &word_end);
}
else if (c == '"')
{
GtkTextIter string_start = iter;
GtkTextIter string_end = iter;
gtk_text_iter_forward_char (&iter);
while (!gtk_text_iter_is_end (&iter))
{
c = gtk_text_iter_get_char (&iter);
if (c == '"')
{
gtk_text_iter_forward_char (&iter);
string_end = iter;
break;
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string",
&string_start, &string_end);
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens",
&start, &end);
}
static void
@@ -854,7 +794,7 @@ create_cairo_texture (NodeEditorWindow *self)
return NULL;
renderer = gsk_cairo_renderer_new ();
gsk_renderer_realize_for_display (renderer, gtk_widget_get_display (GTK_WIDGET (self)), NULL);
gsk_renderer_realize (renderer, NULL, NULL);
texture = gsk_renderer_render_texture (renderer, node, NULL);
gsk_render_node_unref (node);
@@ -926,11 +866,11 @@ export_image_response_cb (GObject *source,
GskRenderer *renderer;
renderer = gsk_gl_renderer_new ();
if (!gsk_renderer_realize_for_display (renderer, gdk_display_get_default (), NULL))
if (!gsk_renderer_realize (renderer, NULL, NULL))
{
g_object_unref (renderer);
renderer = gsk_cairo_renderer_new ();
if (!gsk_renderer_realize_for_display (renderer, gdk_display_get_default (), NULL))
if (!gsk_renderer_realize (renderer, NULL, NULL))
{
g_assert_not_reached ();
}
@@ -1181,11 +1121,8 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
const char *description)
{
GdkPaintable *paintable;
GdkDisplay *display;
display = gtk_widget_get_display (GTK_WIDGET (self));
if (!gsk_renderer_realize_for_display (renderer, display, NULL))
if (!gsk_renderer_realize (renderer, NULL, NULL))
{
GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
@@ -1209,7 +1146,6 @@ static void
node_editor_window_realize (GtkWidget *widget)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GdkFrameClock *frameclock;
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
@@ -1237,24 +1173,14 @@ node_editor_window_realize (GtkWidget *widget)
node_editor_window_add_renderer (self,
gsk_cairo_renderer_new (),
"Cairo");
frameclock = gtk_widget_get_frame_clock (widget);
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
G_CALLBACK (after_paint), self);
}
static void
node_editor_window_unrealize (GtkWidget *widget)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GdkFrameClock *frameclock;
guint i;
frameclock = gtk_widget_get_frame_clock (widget);
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
self->after_paint_handler = 0;
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
{
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
@@ -1615,62 +1541,6 @@ edit_action_cb (GtkWidget *widget,
node_editor_window_edit (self, &start);
}
static void
node_editor_window_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
switch (prop_id)
{
case PROP_AUTO_RELOAD:
{
gboolean auto_reload = g_value_get_boolean (value);
if (self->auto_reload != auto_reload)
{
self->auto_reload = auto_reload;
if (self->auto_reload)
reload (self);
}
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
node_editor_window_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
switch (prop_id)
{
case PROP_AUTO_RELOAD:
g_value_set_boolean (value, self->auto_reload);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
close_crash_warning (GtkButton *button,
NodeEditorWindow *self)
{
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), FALSE);
}
static void
node_editor_window_class_init (NodeEditorWindowClass *class)
{
@@ -1682,8 +1552,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
object_class->dispose = node_editor_window_dispose;
object_class->finalize = node_editor_window_finalize;
object_class->set_property = node_editor_window_set_property;
object_class->get_property = node_editor_window_get_property;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
@@ -1691,12 +1559,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
widget_class->realize = node_editor_window_realize;
widget_class->unrealize = node_editor_window_unrealize;
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
@@ -1706,7 +1568,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, crash_warning);
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
gtk_widget_class_bind_template_callback (widget_class, open_cb);
@@ -1719,7 +1580,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
gtk_widget_class_bind_template_callback (widget_class, close_crash_warning);
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
@@ -1771,98 +1631,11 @@ static GActionEntry win_entries[] = {
{ "open", window_open, NULL, NULL, NULL },
};
char *
get_autosave_path (const char *suffix)
{
char *path;
char *name;
name = g_strconcat ("autosave", suffix, NULL);
path = g_build_filename (g_get_user_cache_dir (), "gtk4-node-editor", name, NULL);
g_free (name);
return path;
}
static void
set_initial_text (NodeEditorWindow *self)
{
char *path, *path1;
char *initial_text;
gsize len;
path = get_autosave_path (NULL);
path1 = get_autosave_path ("-unsafe");
if (g_file_get_contents (path1, &initial_text, &len, NULL))
{
self->auto_reload = FALSE;
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else if (g_file_get_contents (path, &initial_text, &len, NULL))
{
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else
{
/* Default */
gtk_text_buffer_set_text (self->text_buffer,
"shadow {\n"
" child: texture {\n"
" bounds: 0 0 128 128;\n"
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
" }\n"
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
"}\n"
"\n"
"transform {\n"
" child: text {\n"
" color: rgb(46,52,54);\n"
" font: \"Cantarell Bold 11\";\n"
" glyphs: \"GTK Node Editor\";\n"
" offset: 8 14.418;\n"
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
}
g_free (path);
g_free (path1);
}
static void
autosave_contents (NodeEditorWindow *self)
{
char *path = NULL;
char *dir = NULL;
char *contents;
GtkTextIter start, end;
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
contents = gtk_text_buffer_get_text (self->text_buffer, &start, &end, TRUE);
path = get_autosave_path ("-unsafe");
dir = g_path_get_dirname (path);
g_mkdir_with_parents (dir, 0755);
g_file_set_contents (path, contents, -1, NULL);
g_free (dir);
g_free (path);
g_free (contents);
}
static void
node_editor_window_init (NodeEditorWindow *self)
{
GAction *action;
gtk_widget_init_template (GTK_WIDGET (self));
self->auto_reload = TRUE;
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
G_LIST_MODEL (self->renderers),
@@ -1875,10 +1648,6 @@ node_editor_window_init (NodeEditorWindow *self)
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
action = G_ACTION (g_property_action_new ("auto-reload", self, "auto-reload"));
g_action_map_add_action (G_ACTION_MAP (self), action);
g_object_unref (action);
self->tag_table = gtk_text_tag_table_new ();
gtk_text_tag_table_add (self->tag_table,
g_object_new (GTK_TYPE_TEXT_TAG,
@@ -1916,9 +1685,25 @@ node_editor_window_init (NodeEditorWindow *self)
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
set_initial_text (self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
/* Default */
gtk_text_buffer_set_text (self->text_buffer,
"shadow {\n"
" child: texture {\n"
" bounds: 0 0 128 128;\n"
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
" }\n"
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
"}\n"
"\n"
"transform {\n"
" child: text {\n"
" color: rgb(46,52,54);\n"
" font: \"Cantarell Bold 11\";\n"
" glyphs: \"GTK Node Editor\";\n"
" offset: 8 14.418;\n"
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
if (g_getenv ("GSK_RENDERER"))
{

View File

@@ -37,5 +37,3 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
gboolean node_editor_window_load (NodeEditorWindow *self,
GFile *file);
char * get_autosave_path (const char *suffix);

View File

@@ -2,10 +2,6 @@
<interface>
<menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Reload automatically</attribute>
<attribute name="action">win.auto-reload</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
@@ -28,6 +24,7 @@
</item>
</section>
</menu>
<object class="GtkPopover" id="testcase_popover">
<child>
<object class="GtkGrid">
@@ -42,7 +39,7 @@
<object class="GtkEntry" id="testcase_name_entry">
<property name="hexpand">1</property>
<property name="activates-default">1</property>
<signal name="notify::text" handler="testcase_name_entry_changed_cb"/>
<signal name="notify::text" handler="testcase_name_entry_changed_cb" />
</object>
</child>
<child>
@@ -55,6 +52,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="wrap">1</property>
@@ -68,6 +66,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="testcase_error_label">
<property name="wrap">1</property>
@@ -79,6 +78,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="testcase_save_button">
<property name="label">Save</property>
@@ -86,9 +86,9 @@
<property name="halign">end</property>
<property name="receives-default">1</property>
<property name="sensitive">0</property>
<signal name="clicked" handler="testcase_save_clicked_cb"/>
<signal name="clicked" handler="testcase_save_clicked_cb" />
<style>
<class name="suggested-action"/>
<class name="suggested-action" />
</style>
<layout>
<property name="row">4</property>
@@ -100,6 +100,7 @@
</object>
</child>
</object>
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="default-width">1024</property>
@@ -184,129 +185,83 @@
</object>
</child>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer" id="crash_warning">
<property name="transition-type">slide-down</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="child">
<object class="GtkFrame">
<object class="GtkPaned">
<property name="shrink-start-child">false</property>
<property name="shrink-end-child">false</property>
<property name="position">400</property>
<property name="start-child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="app-notification"/>
<class name="editor" />
</style>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<property name="halign">1</property>
<property name="label" translatable="1">The application may have crashed.
As a precaution, auto-loading has been turned off.
You can turn it back on in the menu.
</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="valign">3</property>
<property name="use-underline">1</property>
<property name="label" translatable="1">_Close</property>
<signal name="clicked" handler="close_crash_warning"/>
</object>
</child>
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</property>
</child>
</object>
</property>
</child>
</object>
</child>
<property name="child">
<object class="GtkPaned">
<property name="shrink-start-child">false</property>
<property name="shrink-end-child">false</property>
<property name="position">400</property>
<property name="start-child">
</property>
<property name="end-child">
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="min-content-height">100</property>
<property name="min-content-width">100</property>
<child>
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="editor"/>
</style>
<object class="GtkViewport">
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</child>
</object>
</child>
</object>
</property>
<property name="end-child">
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="min-content-height">100</property>
<property name="min-content-width">100</property>
<child>
<object class="GtkViewport">
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkDropTargetAsync">
<object class="GtkDragSource">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListBox" id="renderer_listbox">
<property name="selection-mode">none</property>
<object class="GtkDropTargetAsync">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</property>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListBox" id="renderer_listbox">
<property name="selection-mode">none</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>

View File

@@ -322,46 +322,27 @@ stroke bounds of the path.
### text
| property | syntax | default | printed |
| ------------ | ------------------- | ------------------- | ----------- |
| color | `<color>` | black | non-default |
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
| glyphs | `<glyphs>` | "Hello" | always |
| offset | `<point>` | 0 0 | non-default |
| hint-style | `<hint style>` | slight | non-default |
| antialias | `<antialias>` | gray | non-default |
| hint-metrics | `<hint metrics>` | off | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| color | `<color>` | black | non-default |
| font | `<string>` | "Cantarell 11" | always |
| glyphs | `<glyphs>` | "Hello" | always |
| offset | `<point>` | 0 0 | non-default |
Creates a node like `gsk_text_node_new()` with the given properties.
If a url is specified for the font, it must point to a font file for the
font that is specified in the string. It can be either a data url containing
a base64-encoded font file, or a regular url that points to a font file.
Glyphs can be specified as an ASCII string, or as a comma-separated list of
their glyph IDs. Optionally, the advance width, x and y offsets and flags can
be specified as well, like this: 40 10 0 0 color.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
Possible values for hint-style are none, slight or full.
Possible value for antialias are none or gray.
Possible value for hint-metrics are on or off.
### texture
| property | syntax | default | printed |
| -------- | ------------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| texture | `<string>`?`<url>`? | *see below* | always |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| texture | `<url>` | *see below* | always |
Creates a node like `gsk_texture_node_new()` with the given properties.
If a string is specified for the texture, it will be used as a name for the text.
Textures can be reused by specifying the name of a previously used texture. In
that case, the url can be omitted.
The default texture is a 10x10 checkerboard with the top left and bottom right
5x5 being in the color #FF00CC and the other part being transparent. A possible
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")

View File

@@ -1,7 +1,7 @@
executable('gtk4-print-editor',
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -4,7 +4,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "profile_conf.h"
#include "demo_conf.h"
static GtkWidget *main_window;
static GFile *filename = NULL;

View File

@@ -66,7 +66,7 @@ endif
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "profile_conf.h"
#include "demo_conf.h"
static void
change_dark_state (GSimpleAction *action,

View File

@@ -69,9 +69,9 @@ Image:
4 CARD32 IMAGE_DATA_OFFSET
ICON_FLAGS
HAS_SUFFIX_XPM 1
HAS_SUFFIX_SVG 2
HAS_SUFFIX_PNG 4
HAS_SUFFIX_PNG 1
HAS_SUFFIX_XPM 2
HAS_SUFFIX_SVG 4
HAS_ICON_FILE 8
ImageData:

View File

@@ -5,11 +5,8 @@ Title: Cairo interaction
[Cairo](http://cairographics.org) is a graphics library that supports vector
graphics and image compositing that can be used with GTK.
GDK does not wrap the Cairo API and it is not possible to use cairo directly
to draw on a [class@Gdk.Surface]. You can either use a
[GtkDrawingArea](../gtk4/class.DrawingArea.html) widget or
[gtk_snapshot_append_cairo](../gtk4/func.Snapshot.append_cairo.html)
for drawing with cairo in a GTK4 application.
GDK does not wrap the Cairo API; instead it allows to create Cairo
drawing contexts which can be used to draw on [class@Gdk.Surface]s.
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]

View File

@@ -25,8 +25,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"

View File

@@ -24,8 +24,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"

View File

@@ -67,8 +67,6 @@ content_files = [
"macos.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
"images/rotated-text.png",
"images/default_cursor.png",
@@ -111,11 +109,3 @@ content_images = [
]
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gdk/"
urlmap_file = "urlmap.js"
[[object]]
name = "DECLARE_INTERNAL_TYPE"
hidden = true
[[object]]
pattern = "KEY_*"
check_ignore = true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -29,18 +29,6 @@ if get_option('documentation')
install_dir: docs_dir,
)
test('doc-check-gdk',
gidocgen,
args: [
'check',
'--config', gdk4_toml,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
gdk_gir[0],
],
depends: gdk_gir[0],
suite: ['docs'],
)
if x11_enabled
gdk4x11_toml = configure_file(
input: 'gdk4-x11.toml.in',
@@ -99,17 +87,5 @@ if get_option('documentation')
install: true,
install_dir: docs_dir,
)
test('doc-check-gdk-wayland',
gidocgen,
args: [
'check',
'--config', gdk4wayland_toml,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
gdk_wayland_gir[0],
],
depends: gdk_wayland_gir[0],
suite: ['docs'],
)
endif
endif

View File

@@ -36,8 +36,6 @@ content_files = [
"paths.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"gtk-logo.svg",
"images/arc-dark.png",
"images/arc-light.png",
@@ -66,7 +64,3 @@ content_images = [
]
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gsk/"
urlmap_file = "urlmap.js"
[[object]]
name = "INCLUDE_WARNING"
hidden = true

View File

@@ -30,16 +30,4 @@ if get_option('documentation')
install: true,
install_dir: docs_dir,
)
test('doc-check-gsk',
gidocgen,
args: [
'check',
'--config', gsk4_toml,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
gsk_gir[0],
],
depends: gsk_gir[0],
suite: ['docs'],
)
endif

View File

@@ -38,13 +38,13 @@ can run the build, using Ninja:
```
cd builddir
meson compile
meson install
ninja
ninja install
```
If you don't have permission to write to the directory you are
installing in, you may have to change to root temporarily before
running `meson install`.
running `ninja install`.
Several environment variables are useful to pass to set before
running *meson*. `CPPFLAGS` contains options to pass to the C
@@ -112,10 +112,10 @@ responsible for controlling the debugging features of GTK with
## Dependencies
Before you can compile GTK, you need to have various other tools and
libraries installed on your system. Dependencies of GTK have their own
build systems, so you will need to refer to their own installation
instructions.
Before you can compile the GTK widget toolkit, you need to have
various other tools and libraries installed on your
system. Dependencies of GTK have their own build systems, so
you will need to refer to their own installation instructions.
A particular important tool used by GTK to find its dependencies
is `pkg-config`.
@@ -140,7 +140,7 @@ Other libraries are maintained separately.
file formats. It is available [here](ttps://download.gnome.org/sources/gdk-pixbuf/).
- [Pango](http://www.pango.org) is a library for internationalized
text handling. It is available [here](https://download.gnome.org/sources/pango/).
- [GObject Introspection](https://gitlab.gnome.org/GNOME/gobject-introspection)
- [GObject Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection)
is a framework for making introspection data available to language
bindings. It is available [here](https://download.gnome.org/sources/gobject-introspection/).
- The [GNU libiconv](https://www.gnu.org/software/libiconv/) library
@@ -156,8 +156,8 @@ Other libraries are maintained separately.
the development environment for these libraries that your
operating system vendor provides.
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
library provides Pango with a standard way of locating fonts and matching
them against font names.
library provides Pango with a standard way of locating
fonts and matching them against font names.
- [Cairo](https://www.cairographics.org) is a graphics library that
supports vector graphics and image compositing. Both Pango and GTK
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
@@ -220,12 +220,13 @@ meson configure builddir
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
Enable specific backends for GDK. If none of these options are given, the
Wayland backend will be enabled by default, if the platform is Linux; the
X11 backend will also be enabled by default, unless the platform is Windows,
in which case the default is win32, or the platform is macOS, in which case
the default is macOS. If any backend is explicitly enabled or disabled, no
other platform will be enabled automatically.
Enable specific backends for GDK. If none of these options
are given, the Wayland backend will be enabled by default,
if the platform is Linux; the X11 backend will also be enabled
by default, unless the platform is Windows, in which case the
default is win32, or the platform is macOS, in which case the
default is macOS. If any backend is explicitly enabled or disabled,
no other platform will be enabled automatically.
### `vulkan`
@@ -233,7 +234,7 @@ By default, GTK will try to build with support for the Vulkan graphics
API in addition to cairo and OpenGL. This option can be used to explicitly
control whether Vulkan should be used.
### `media-gstreamer`
### `media-gstreamer` and `media-ffmpeg`
By default, GTK will try to build the gstreamer backend for
media playback support. These options can be used to explicitly

View File

@@ -1,7 +1,7 @@
Title: CSS in GTK
Slug: css
This chapter describes how GTK uses CSS for styling and layout.
This chapter describes how GTK uses CSS for styling and layout.
It is not meant to be an explanation of CSS from first principles,
but focuses on listing supported CSS features and differences
between Web CSS and GTK.
@@ -74,7 +74,6 @@ in a selector, widget names must be prefixed with a &num; character.
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |

View File

@@ -15,16 +15,16 @@ spec.
The following units are supported for basic datatypes:
Length
: px, pt, em, ex, rem, pc, in, cm, mm
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
Percentage
: %
: %, calc()
Angle
: deg, rad, grad, turn
: deg, grad, turn, calc()
Time
: s, ms
: s, ms, calc()
Length values with the em or ex units are resolved using the font
size value, unless they occur in setting the font-size itself, in
@@ -33,15 +33,11 @@ which case they are resolved using the inherited font size value.
The rem unit is resolved using the initial font size value, which is
not quite the same as the CSS definition of rem.
Length values using physical units (pt, pc, in, cm, mm) are translated
to px using the dpi value specified by the -gtk-dpi property, which is
different from the CSS definition, which uses a fixed dpi of 96.
The calc() notation adds considerable expressive power to all of these
datatypes. There are limits on what types can be combined in such an
expression (e.g. it does not make sense to add a number and a time).
For the full details, see the
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
The calc() notation adds considerable expressive power. There are limits
on what types can be combined in such an expression (e.g. it does not make
sense to add a number and a time). For the full details, see the
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
spec.
A common pattern among shorthand properties (called 'four sides') is one
where one to four values can be specified, to determine a value for each
@@ -60,80 +56,38 @@ follows:
1 value:
: all
## Custom Properties
GTK supports custom properties as defined in the
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1)
spec.
Custom properties are defined as follows:
```css
--prop: red;
```
and used via the `var` keyword:
```css
color: var(--prop);
```
Custom properties can have a fallback for when the referred property is invalid:
```css
color: var(--prop, green);
```
## Colors
### CSS Colors
Colors can be expressed in numerous ways in CSS (see the
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
many (but not all) of these.
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
syntax, and calc() can be used as well in color expressions. hwb(), oklab(),
oklch(), color(), color-mix() and relative colors are supported as well.
### Non-CSS Colors
GTK extends the CSS syntax with several additional ways to specify colors.
These extensions are deprecated and should be replaced by the equivalent
standard CSS notions.
GTK extends the CSS syntax with several additional ways to specify colors.
The first is a reference to a color defined via a @define-color rule in CSS.
The syntax for @define-color rules is as follows:
```
@define-color name color
@define-color Name Color
```
To refer to the color defined by a @define-color rule, prefix the name with @.
The standard CSS mechanisms that should be used instead of @define-color are
custom properties, :root and var().
GTK also supports color expressions, which allow colors to be transformed to
new ones. Color expressions can be nested, providing a rich language to
define colors. Color expressions resemble functions, taking 1 or more colors
and in some cases a number as arguments.
`lighter(color)`
: produces a brighter variant of `color`.
`lighter(Color)`
: produces a brigher variant of Color
`darker(color)`
: produces a darker variant of `color`.
`darker(Color)`
: produces a darker variant of Color
`shade(color, number)`
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
`shade(Color, Number)`
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
`alpha(color, number)`
: multiplies the alpha value of `color` by `number` (between 0 and 1).
`alpha(Color, Number)`
: replaces the alpha value of color with number (between 0 and 1)
`mix(color1, color2, number)`
: interpolates between the two colors.
`mix(Color1, Color2, Number)`
: interpolates between the two colors
## Images
@@ -141,7 +95,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
To load a themed icon, use
```
-gtk-icontheme(name)
-gtk-icontheme(Name)
```
The specified icon name is used to look up a themed icon, while taking into
@@ -170,14 +124,14 @@ and the
syntax makes this available. -gtk-recolor requires a url as first argument.
The remaining arguments specify the color palette to use. If the palette is
not explicitly specified, the current value of the -gtk-icon-palette property
is used.
is used.
GTK supports scaled rendering on hi-resolution displays. This works best if
images can specify normal and hi-resolution variants. From CSS, this can be
done with
```
-gtk-scaled(image1, image2)
-gtk-scaled(Image1, Image2)
```
## GTK CSS Properties

View File

@@ -99,15 +99,16 @@ reaches the requested phase. However, in practice most things
happen at higher levels:
- If you are doing an animation, you can use
[method@Gtk.Widget.add_tick_callback] which will cause a regular
gtk_widget_add_tick_callback() which will cause a regular
beating of the clock with a callback in the Update phase
until you stop the tick.
- If some state changes that causes the size of your widget to
change you call [method@Gtk.Widget.queue_resize] which will request
change you call gtk_widget_queue_resize() which will request
a Layout phase and mark your widget as needing relayout.
- If some state changes so you need to redraw your widget you
use [method@Gtk.Widget.queue_draw] to request a Paint phase for
your widget.
- If some state changes so you need to redraw some area of
your widget you use the normal gtk_widget_queue_draw()
set of functions. These will request a Paint phase and
mark the region as needing redraw.
There are also a lot of implicit triggers of these from the
CSS layer (which does animations, resizes and repaints as needed).

View File

@@ -245,6 +245,9 @@ to connect the "clicked" signal with [method@Gtk.Window.destroy], then the funct
would be called on `button` (which would not go well, since the function expects
a `GtkWindow` as argument).
More information about creating buttons can be found
[here](https://wiki.gnome.org/HowDoI/Buttons).
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
section will elaborate further on how to add several [class@Gtk.Widget]s to your
GTK application.

View File

@@ -8,10 +8,6 @@ gtk4-broadwayd
The Broadway display server
---------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>

View File

@@ -8,10 +8,6 @@ gtk4-builder-tool
GtkBuilder File Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>

View File

@@ -8,9 +8,6 @@ gtk4-demo-application
Demonstrate GtkApplication
--------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-demo
Demonstrate GTK widgets
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-encode-symbolic-svg
Symbolic icon conversion utility
--------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-icon-browser
List themed icons
-----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -1,97 +0,0 @@
.. _gtk4-image-tool(1):
====================
gtk4-image-tool
====================
-----------------------
Image Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-image-tool** <COMMAND> [OPTIONS...] <FILE>...
|
| **gtk4-image-tool** compare [OPTIONS...] <FILE1> <FILE2>
| **gtk4-image-tool** convert [OPTIONS...] <FILE1> <FILE2>
| **gtk4-image-tool** info [OPTIONS...] <FILE>
| **gtk4-image-tool** relabel [OPTIONS...] <FILE1> <FILE2>
| **gtk4-image-tool** show [OPTIONS...] <FILE>...
DESCRIPTION
-----------
``gtk4-image-tool`` can perform various operations on images.
COMMANDS
--------
Information
^^^^^^^^^^^
The ``info`` command shows general information about the image, such
as its format and color state.
Showing
^^^^^^^
The ``show`` command displays one or more images, side-by-side.
``--undecorated``
Removes window decorations. This is meant for rendering of exactly the image
without any titlebar.
Compare
^^^^^^^
The ``compare`` command compares two images. If any differences are found,
the exit code is 1. If the images are identical, it is 0.
``--output=FILE``
Save the differences as a png image in ``FILE``.
``--quiet``
Don't write results to stdout.
Conversion
^^^^^^^^^^
The ``convert`` command converts the image to a different format or color state.
``--format=FORMAT``
Convert to the given format. The supported formats can be listed
with ``--format=list``.
``--color-state=COLORSTATE``
Convert to the given color state. The supported color states can be
listed with ``--format=list``.
``--cicp=CICP``
Convert to a color state that is specified as a cicp tuple. The cicp tuple
must be specified as four numbers, separated by /, e.g. 1/13/6/0.
Relabeling
^^^^^^^^^^
The ``relabel`` command changes the color state of an image without conversion.
This can be useful to produce wrong color renderings for diagnostics.
``--color-state=COLORSTATE``
Relabel to the given color state. The supported color states can be
listed with ``--format=list``.
``--cicp=CICP``
Relabel to a color state that is specified as a cicp tuple. The cicp tuple
must be specified as four numbers, separated by /, e.g. 1/13/6/0.

View File

@@ -8,10 +8,6 @@ gtk4-launch
Launch an application
---------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,24 +8,16 @@ gtk4-node-editor
Editor render nodes
-----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-node-editor** [OPTIONS...] [FILE]
| **gtk4-node-editor** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-node-editor`` is a utility to show and edit render node files.
Such render node files can be obtained e.g. from the GTK inspector or
as part of the testsuite in the GTK sources.
``gtk4-node-editor`` is used by GTK developers for debugging and testing,
and it has built-in support for saving testcases as part of the GTK testsuite.
Such render node files can be obtained e.g. from the GTK inspector.
OPTIONS
-------
@@ -33,21 +25,3 @@ OPTIONS
``-h, --help``
Show the application help.
``--version``
Show the program version.
``--reset``
Don't restore autosaved content and remove autosave files.
ENVIRONMENT
-----------
``GTK_SOURCE_DIR``
can be set to point to the location where the GTK sources reside, so that
testcases can be saved to the right location. If unsed, `gtk4-node-editor``
checks if the current working directory looks like a GTK checkout, and failing
that, saves testcase in the the current working directory.

View File

@@ -8,10 +8,6 @@ gtk4-path-tool
GskPath Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>

View File

@@ -8,10 +8,6 @@ gtk4-query-settings
Print name and value of GTK settings
------------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,20 +8,13 @@ gtk4-rendernode-tool
GskRenderNode Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
| **gtk4-rendernode-tool** extract [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
DESCRIPTION
-----------
@@ -50,65 +43,10 @@ without any titlebar.
Rendering
^^^^^^^^^
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
image or as pdf document. The name of the file to write can be specified as a second
FILE argument.
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
The name of the file to write can be specified as a second FILE argument.
``--renderer=RENDERER``
Use the given renderer. Use ``--renderer=help`` to get a information
about possible values for the ``RENDERER``.
Benchmark
^^^^^^^^^
The ``benchmark`` command benchmarks rendering of a node with the existing renderers
and prints the runtimes.
``--renderer=RENDERER``
Add the given renderer. This argument can be passed multiple times to test multiple
renderers. By default, all major GTK renderers are run.
``--runs=RUNS``
Number of times to render the node on each renderer. By default, this is 3 times.
Keep in mind that the first run is often used to populate caches and might be
significantly slower.
``--no-download``
Do not attempt to download the result. This may cause the measurement to not include
the execution of the commands on the GPU. It can be useful to use this flag to test
command submission performance.
Compare
^^^^^^^
The ``compare`` command compares the rendering of a node with a reference image,
or the renderings of two nodes, or two images. If any differences are found, the
exit code is 1. If the images are identical, it is 0.
``--renderer=RENDERER``
Use the given renderer.
``--output=FILE``
Save the differences as a png image in ``FILE``.
``--quiet``
Don't write results to stdout.
Extract
^^^^^^^
The ``extract`` command saves all the data urls found in a node file to a given
directory. The file names for the extracted files are derived from the mimetype
of the url.
``--dir=DIRECTORY``
Save extracted files in ``DIRECTORY`` (defaults to the current directory).
about poassible values for the ``RENDERER``.

View File

@@ -8,10 +8,6 @@ gtk4-update-icon-cache
Icon theme caching utility
--------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-widget-factory
Showcase GTK widgets and styles
-------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -77,18 +77,14 @@ content_files = [
"section-tree-widget.md",
"migrating-2to4.md",
"migrating-3to4.md",
"migrating-4to5.md",
"broadway.md",
"osx.md",
"wayland.md",
"windows.md",
"x11.md",
"tools.md",
"visual_index.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/aboutdialog.png",
"images/action-bar.png",
"images/appchooserbutton.png",
@@ -251,12 +247,3 @@ content_images = [
]
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/"
urlmap_file = "urlmap.js"
[[object]]
name = "StyleProvider"
[[object.signal]]
name = "gtk-private-changed"
hidden = true
[check]
skip_deprecated = true

View File

@@ -140,11 +140,6 @@ capture phase, and key bindings locally, during the target phase.
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
and they are managed by `GtkShortcutController`.
Note that GTK does not do anything to map the primary shortcut modifier
to <kbd>Command</kbd> on macOS. If you want to let your application to follow
macOS user experience conventions, you must create macOS-specific keyboard shortcuts.
The <kbd>Command</kbd> is named `Meta` (`GDK_META_MASK`) in GTK.
## Text input
When actual text input is needed (i.e. not just keyboard shortcuts),

View File

@@ -14,7 +14,6 @@ expand_content_md_files = [
'running.md',
'migrating-2to4.md',
'migrating-3to4.md',
'migrating-4to5.md',
'actions.md',
'input-handling.md',
'drawing-model.md',
@@ -26,8 +25,7 @@ expand_content_md_files = [
'section-tree-widget.md',
'section-list-widget.md',
'question_index.md',
'visual_index.md',
'tools.md',
'visual_index.md'
]
gtk_images = []
@@ -62,52 +60,39 @@ if get_option('documentation')
build_by_default: true,
install: true,
install_dir: docs_dir,
install_tag: 'doc',
)
test('doc-check-gtk',
gidocgen,
args: [
'check',
'--config', gtk4_toml,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
gtk_gir[0],
],
depends: gtk_gir[0],
suite: ['docs'],
)
endif
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
rst2man = find_program('rst2man', 'rst2man.py', required: false)
if get_option('man-pages') and not rst2man.found()
error('No rst2man found, but man pages were explicitly enabled')
endif
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-image-tool', '1' ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-rendernode-tool', '1' ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-path-tool', '1', ],
]
if get_option('build-demos')
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-node-editor', '1', ],
if get_option('man-pages') and rst2man.found()
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-rendernode-tool', '1' ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-path-tool', '1', ],
]
endif
rst2x_flags = [
'--syntax-highlight=none',
]
if get_option('demos')
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-node-editor', '1', ],
]
endif
if get_option('man-pages')
rst2man_flags = [
'--syntax-highlight=none',
]
foreach rst: rst_files
man_name = rst[0]
@@ -118,34 +103,12 @@ if get_option('man-pages')
output: '@0@.@1@'.format(man_name, man_section),
command: [
rst2man,
rst2x_flags,
rst2man_flags,
'@INPUT@',
],
capture: true,
install: true,
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
install_tag: 'doc',
)
endforeach
endif
if get_option('documentation')
foreach rst: rst_files
man_name = rst[0]
custom_target(
input: '@0@.rst'.format(man_name),
output: '@0@.html'.format(man_name),
command: [
rst2html5,
rst2x_flags,
'@INPUT@',
],
capture: true,
install: true,
install_dir: docs_dir / 'gtk4',
install_tag: 'doc',
)
endforeach
endif

View File

@@ -451,11 +451,11 @@ hint about how modifiers are expected to be used. It also promoted
the use of `<Primary>` instead of `<Control>` to specify accelerators that
adapt to platform conventions.
In GTK 4, the meaning of modifiers has been fixed, and applications are
In GTK 4, the meaning of modifiers has been fixed, and backends are
expected to map the platform conventions to the existing modifiers.
The expected use of modifiers in GTK 4 is:
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
`GDK_CONTROL_MASK`
: Primary accelerators
`GDK_ALT_MASK`
@@ -464,7 +464,7 @@ The expected use of modifiers in GTK 4 is:
`GDK_SHIFT_MASK`
: Extending selections
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
`GDK_CONTROL_MASK`
: Modifying selections
`GDK_CONTROL_MASK|GDK_ALT_MASK`
@@ -473,15 +473,9 @@ The expected use of modifiers in GTK 4 is:
Consequently, `GdkModifierIntent` and related APIs have been removed,
and `<Control>` is preferred over `<Primary>` in accelerators.
In GTK 3 on macOS, the `<Primary>` modifier mapped to the <kbd>Command</kbd> key.
In GTK 4, this is no longer the case: `<Primary>` is synonymous to `<Control>`.
If you want to make your application to feel native on macOS,
you need to add accelerators for macOS that use the `<Meta>` modifier.
A related change is that GTK 4 no longer supports the use of archaic
X11 'real' modifiers with the names Mod1,..., Mod5, and `GDK_MOD1_MASK`
has been renamed to `GDK_ALT_MASK` and `GDK_MOD2_MASK` has been renamed to
`GDK_META_MASK`.
has been renamed to `GDK_ALT_MASK`.
### Replace `GtkClipboard` with `GdkClipboard`

View File

@@ -58,7 +58,7 @@ use a GtkLabel.
If you have a need for custom drawing that fits into the current
(dark or light) theme, e.g. for rendering a graph, you can still
get the current style foreground color, using
[method@Gtk.Widget.get_color].
[method@Gtk.Widget.get_style_color].
## Local stylesheets are going away
@@ -73,103 +73,6 @@ GTK 5 will no longer provide this functionality. The recommendations
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
and rely on style classes to make your CSS apply only where desired.
## Non-standard CSS extensions are going away
GTK's CSS machinery has a some non-standard extensions around colors:
named colors with \@define-color and color functions: lighter(), darker(),
shade(), alpha(), mix().
GTK now implements equivalent functionality from the CSS specs.
### \@define-color is going away
\@define-color should be replaced by custom properties in the :root scope.
Instead of
```
@define-color fg_color #2e3436
...
box {
color: @fg_color;
}
```
use
```
:root {
--fg-color: #2e3436;
}
...
box {
color: var(--fg-color);
}
```
For more information about custom CSS properties and variables, see the
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1/)
spec.
### Color expressions are going away
The color functions can all be replaced by combinations of calc() and color-mix().
ligher(c) and darker(c) are just shade(c, 1.3) or shade(c, 0.7), respectively, and
thus can be handled the same way as shade in the examples below.
Replace
```
a {
color: mix(red, green, 0.8);
}
b {
color: alpha(green, 0.6);
}
c {
color: shade(red, 1.3);
}
d {
color: shade(red, 0.7);
}
```
with
```
a {
color: color-mix(in srgb, red, green 80%);
}
b {
color: rgb(from green, r g b / calc(alpha * 0.6));
}
c {
color: hsl(from red, h calc(s * 1.3) calc(l * 1.3));
}
d {
color: hsl(from red, h calc(s * 0.7) calc(l * 0.7));
}
```
Variations of these replacements are possible.
Note that GTK has historically computed mix() and shade() values in the SRGB and HSL
colorspaces, but using OKLAB instead might yield slightly better results.
For more information about color-mix(), see the
[CSS Color](https://drafts.csswg.org/css-color-5) spec.
## Chooser interfaces are going away
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser

View File

@@ -7,5 +7,5 @@ on top of the Quartz API.
Currently, the macOS port does not use any additional commandline options
or environment variables.
For up-to-date information on building, installation, and bundling, see the
[GTK website](https://www.gtk.org/docs/installations/macos).
For up-to-date information about the current status of this port, see the
[project page](https://wiki.gnome.org/Projects/GTK/OSX).

Some files were not shown because too many files have changed in this diff Show More