Commit Graph

81172 Commits

Author SHA1 Message Date
Simon McVittie
24cf5b6df8 README: Officially require C11, matching GLib 2.81.x
Previously GTK required a C99 compiler, but as discussed on
GNOME/gtk!7510 there's at least one anonymous union in public API
(in `GskPathPoint`), and that's a C11 feature.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-07-28 17:47:47 +01:00
Benjamin Otte
76c1ea0449 Merge branch 'wip/smcv/gsize-is-guintptr' into 'main'
gdk: Codify the requirement that gsize is pointer-sized

See merge request GNOME/gtk!7514
2024-07-28 14:12:59 +00:00
Simon McVittie
a97f378d64 gdk: Codify the requirement that gsize is pointer-sized
This is widely assumed, but is not guaranteed by Standard C, and is
known to be false on CHERI architectures (which have 64-bit sizes and
128-bit tagged pointers). Add a static assertion to ensure that GTK
will not build on platforms where this assumption does not hold.

As discussed on GNOME/gtk!7510, if GTK switches from gsize to uintptr_t
as its representation of the underlying bits in a pointer, GTK maintainers
would prefer that to be done project-wide so that it's done consistently,
after which this static assertion could be removed.

At the time of writing, GLib makes the same assumption (GNOME/glib#2842),
but GLib contributors are gradually removing it (mostly by replacing gsize
with uintptr_t where a pointer-sized quantity is needed). Finishing
that work in GLib would be a prerequisite for being able to make GTK
work on the affected platforms.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-07-28 14:31:31 +01:00
Matthias Clasen
ffe82b7641 Merge branch 'wip/smcv/ubsan-half-float' into 'main'
gsk, testsuite: Avoid undefined behaviour converting float <-> fp16

See merge request GNOME/gtk!7509
2024-07-28 02:59:59 +00:00
Matthias Clasen
785709d51c Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!7512
2024-07-28 02:55:57 +00:00
Matthias Clasen
8406c34166 Cosmetics 2024-07-27 22:11:39 -04:00
Matthias Clasen
2ee1f3e8cf Merge branch 'matthiasc/for-main' into 'main'
image-tool: Allow specifying cicp tuples

See merge request GNOME/gtk!7511
2024-07-27 23:45:21 +00:00
Matthias Clasen
1373a7a6f0 Change the matrix implementation
Go from float[3][3] to float[9]. That is easier to manage in
static initialization.
2024-07-27 19:20:14 -04:00
Matthias Clasen
a5aac30843 jpeg: Load grayscale as-is
We can handle grayscale textures just fine nowadays, so no need to
convert them to RGB.
2024-07-27 19:20:14 -04:00
Matthias Clasen
3149493679 jpeg: Set downloader color state explictly
This avoids surprises.
2024-07-27 19:02:59 -04:00
Matthias Clasen
a60cda3daa image-tool: Allow specifying cicp tuples
Accept --cicp=1/13/6/0 and similar to specify color states.
2024-07-27 18:42:39 -04:00
Simon McVittie
660c6c8d6f gsk, testsuite: Avoid undefined behaviour in half_to_float_one()
Similar to the previous commit, to avoid undefined behaviour we need
to avoid evaluating out-of-bounds shifts, even if their result is going
to ignored by being multiplied by 0 later.

Detected by running a subset of the test suite with
-Dsanitize=address,undefined on x86_64.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-07-27 20:22:09 +01:00
Simon McVittie
ad679187d3 gsk, testsuite: Avoid undefined behaviour in float_to_half_one()
If, for example, e == 0, it is undefined behaviour to compute an
expression involving an out-of-range shift by (125 - e), even if the
result is in fact irrelevant because it's going to be multiplied by 0.

This was already fixed for the memorytexture test in
commit 5d1b839 "testsuite: Fix another ubsan warning", so use the
implementation from that test everywhere. It's in the header as an
inline function to keep the linking of the relevant tests simple:
its only caller in production code is fp16.c, so there will be no
duplication outside the test suite.

Detected by running a subset of the test suite with
-Dsanitize=address,undefined on x86_64.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-07-27 20:22:09 +01:00
Benjamin Otte
d301d16aee Merge branch 'wip/otte/for-main' into 'main'
wayland: Redo the image description code

See merge request GNOME/gtk!7505
2024-07-27 06:09:15 +00:00
Benjamin Otte
ec489e673c wayland: Add preferred formats to the hash tables
So we don't look them up all the time.
2024-07-27 07:26:51 +02:00
Benjamin Otte
a904da12b7 wayland: Don't query preferred colorstate if we don't care
If there's no change callback connected, exit early, because all this
lot of work would be for invoking that callback.
2024-07-27 07:26:51 +02:00
Benjamin Otte
91865d172b wayland: Track color information identities
So we don't need to query them all the time.

Or so I thought, because I get different ones for the same colorstate.
Thx Mutter.
2024-07-27 07:26:51 +02:00
Benjamin Otte
adedb89779 wayland: Actually sync the colorstate with the compositor 2024-07-27 07:26:51 +02:00
Benjamin Otte
514dbcacd4 wayland: Actually query the preferred colorstate
We weren't doing that, so everything looked like it wanted SRGB.
2024-07-27 07:26:51 +02:00
Benjamin Otte
25c812fa87 wayland: Redo the image description code
Main changes:

1. Avoid invalid writes by not passing pointers to a GArray that
   realloc()s its data
2. Use a hash table to store image defs, instead of an array. This
   requires a custom hash/equal function
3. Make image desc computation sync, so that setting a cs always
   succeeds or always fails and doesn't depend on timing.
4. Add a few debug messages in failure paths. For lack of a category,
   they ended up in MISC.
2024-07-27 07:26:51 +02:00
Matthias Clasen
45e76c1604 Merge branch 'wip/smcv/a11y-tests' into 'main'
tests: Fix signature of GtkTestATContext::update-selection-bound handlers

Closes #6490

See merge request GNOME/gtk!7504
2024-07-27 04:50:14 +00:00
Matthias Clasen
a9c3163a64 Merge branch 'main' into 'main'
Tests: add GtkPicture builder test

See merge request GNOME/gtk!7486
2024-07-27 03:08:15 +00:00
Simon McVittie
a8bb71383a tests: Fix signature of GtkTestATContext::update-selection-bound handlers
The signal is declared in GtkTestATContext with 0 parameters, but these
handlers were written as if the signal had one `guint` parameter.
On some architectures this accidentally works as intended, but on
others (reproduced on i386 and riscv64) the test tries to use arbitrary
stack contents as the `TestData *` and crashes when it tries to
dereference the resulting non-pointer.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6490
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-07-27 00:59:03 +01:00
Matthias Clasen
3b08f8026e Merge branch 'matthiasc/for-main' into 'main'
jpeg: Port to GdkMemoryTextureBuilder

See merge request GNOME/gtk!7502
2024-07-26 23:09:27 +00:00
Matthias Clasen
2cdc2287a5 Merge branch 'amolenaar/macos-open-panel-create-folders' into 'main'
macos: Propagate the create-folders option also for Open panels

Closes #6872

See merge request GNOME/gtk!7492
2024-07-26 22:35:43 +00:00
Juan Pablo Ugarte
c80c4ee75c Tests: add GtkPicture builder test
Add test for GtkPicture::file GFile property.
2024-07-26 18:30:58 -04:00
Juan Pablo Ugarte
082691ba16 GtkBuilder: add support for paths and relative uris for GFile properties. 2024-07-26 18:30:58 -04:00
Matthias Clasen
d09a610433 Merge branch 'spinbutton-hint' into 'main'
gtkspinbutton: Set number input hint for text field

See merge request GNOME/gtk!7485
2024-07-26 22:05:34 +00:00
Matthias Clasen
ea9f8b2f77 downloader: Add some docs
Mention the default format and color state.
2024-07-26 17:38:27 -04:00
Matthias Clasen
e2d337740f gpu: Don't mess up color states
When uploading textures, we were unintentionally converting to
srgb. Avoid that, so that yuv data survives unmolested.
2024-07-26 17:34:48 -04:00
Matthias Clasen
45c5b250b9 texture: Don't mess up color states
gdk_texture_download_surface was converting twice from the texture
color state to the target color state, with predictably bad results.
2024-07-26 17:27:20 -04:00
Matthias Clasen
f4b35093bd jpeg: Port to GdkMemoryTextureBuilder
This is in preparation for some color state handling.
2024-07-26 16:43:54 -04:00
Matthias Clasen
5e52cefb28 Merge branch 'rtl-label-hickup' into 'main'
label: Clear layout when text direction changes

Closes #6836

See merge request GNOME/gtk!7497
2024-07-26 18:13:28 +00:00
Benjamin Otte
bf43aee690 Merge branch 'wip/otte/for-main' into 'main'
gstreamer: Specify values for unspecified values

See merge request GNOME/gtk!7500
2024-07-26 14:38:01 +00:00
Matthias Clasen
62f359a494 Merge branch 'css-relative-font' into 'main'
css: Fix relative font sizes

Closes #6868

See merge request GNOME/gtk!7498
2024-07-26 14:24:42 +00:00
Benjamin Otte
cbe09373a5 gstreamer: Specify values for unspecified values
When the cicp values coming out of GStreamer are unspecified, replace
them with the default cicp values for YUV video: 1/13/6.

We still may end up with unspecified values inside the params, because
GStreamer returns unspecified for primaries/tfs/matrices that aren't
supported by cicp.

See also https://github.com/AOMediaCodec/libavif/wiki/CICP#unspecified
fora similar discussion.
2024-07-26 15:16:05 +02:00
Matthias Clasen
b3451dda04 css: Fix relative font sizes
This regression was introduced in aeac2b54.

We need percentage values to stay non-computed, since we otherwise
fail to compute relative font sizes properly. But we want percentages
not to stick around in relative colors, so tweak things to be more
aggressive with simplication when creating relative color values.

Update affected tests.

Fixes: #6868
2024-07-26 08:45:58 -04:00
Matthias Clasen
d477bf3d93 Merge branch 'image-tool-side-by-side' into 'main'
image-tool: Allow showing images side-by-side

See merge request GNOME/gtk!7501
2024-07-26 12:08:12 +00:00
Matthias Clasen
12c7f2d4fd Merge branch 'matthiasc/for-main' into 'main'
gpu: More debug spew

See merge request GNOME/gtk!7499
2024-07-26 12:07:55 +00:00
Matthias Clasen
feca09b8a4 image-tool: Allow showing images side-by-side
This is useful for comparisons.
2024-07-26 07:44:31 -04:00
Matthias Clasen
150f57f706 gpu: Fix the cicp conversion
The fragment shader was mixing up pixel and color variables.
And the compilers don't have 'uninitialized variable' warnings :(
2024-07-26 07:24:48 -04:00
Matthias Clasen
33131ad24d gpu: Fix the cicp conversion shader for ngl
The compiler was unhappy with using signed labels with an unsigned
variable in a switch. Talk about being picky.
2024-07-26 07:23:18 -04:00
Matthias Clasen
d53b3f9941 gpu: More debug spew
Print out the direction of the cicp conversion.
2024-07-26 07:22:45 -04:00
Martin
da07f1221f Update Slovenian translation 2024-07-26 09:36:52 +00:00
Matthias Clasen
9aed7ab25f Merge branch 'matthiasc/for-main' into 'main'
Add an image tool

See merge request GNOME/gtk!7496
2024-07-26 03:36:57 +00:00
Matthias Clasen
5ae225fe52 Add an image tool
This is meant to provide a convenient way to produce images in
specific color states and memory formats.
2024-07-25 18:20:59 -06:00
Matthias Clasen
cc8fa39110 tools: Improve localization 2024-07-25 18:20:59 -06:00
Matthias Clasen
c673a0bcc3 label: Clear layout when text direction changes
Otherwise, wrong alignment settings may linger in the layout.

Fixes: #6836
2024-07-25 17:06:58 -06:00
Benjamin Otte
efc6d15dde Merge branch 'wip/otte/for-main' into 'main'
gpu: Don't run long loops in shaders

See merge request GNOME/gtk!7495
2024-07-25 20:42:55 +00:00
Benjamin Otte
50403fbca8 wayland: Actually compare the right values
Wayland primaries/transfer functions aren't cicp values, so we can't
compare them.
2024-07-25 22:06:56 +02:00