Commit Graph

77483 Commits

Author SHA1 Message Date
Lukáš Tyrychtr
d4b0d395a1 Adjust tests 2023-11-17 14:54:30 -05:00
Lukáš Tyrychtr
e660e922fe a11y: When using rule 2.E for computing accessible name, use it only if appropriate
We were using it in all cases, so, we were using it to compute descriptions,
and also for non-embedded controls. That was overriding descriptions
set, for example, in Gnome settings, and was causing the value of spinboxes
to be read multiple times.
2023-11-17 14:54:21 -05:00
Chun-wei Fan
287436a26d builds: Require -Zc:preprocessor for Visual Studio debug builds
This flag is actually required for the debugging code to successfully build,
so check that it is really there for debug-enabled Visual Studio builds.
2023-11-17 14:54:13 -05:00
Chun-wei Fan
cb644a6d23 MSVC Builds: Don't enable -utf-8 explicitly
We already require a Meson release that enables -utf-8 by default, so we don't
really need to explicitly enable it here.
2023-11-17 14:54:06 -05:00
Chun-wei Fan
8d92e0fb6f build: Add msvc_recommended_pragmas.h
We really always want to force-include msvc_recommended_pragmas.h to check for
things at compile time so that we can avoid stuff like missing includes or
attempting to return a value in a function that is supposed to have a
void-return-type.

The current problem is that, as indicated in the Visual Studio CI job, that we
couldn't locate msvc_recommended_pragmas.h during the build if GLib is built
as a subproject, and/or when msvc_recommended_pragmas.h is not in the paths
indicated by %INCLUDE%, meaning that the aforementioned issues would not be
caught by CI, which will then break builds on Visual Studio for people when
msvc_recommended_pragmas.h is found during their builds.

It would also be nice to be quiet from the warnings that we can really
disregard anyways.

So, add a copy of msvc_recommended_pragmas.h from GLib and update the build
files to look for it in build-aux/msvc, so that it can always be used during
the build, especially by the CI.
2023-11-17 14:53:54 -05:00
Matthias Clasen
0bf68f1372 Fix swizzle values for some memory formats
For opaque formats with 3 channels, we should use the default
GL_ALPHA, but for opaque formats with an ignored 4th channel,
we must use GL_ONE.
2023-11-17 14:53:41 -05:00
sudip
722953737d translated bn.po and hi.po
Resolves:https://gitlab.gnome.org/GNOME/gtk/-/issues/6164
2023-11-17 14:53:17 -05:00
Benjamin Otte
d17eca052d gl: Remove optimization that does the wrong thing
Drawing a texture-scale node like a texture node when the filter is set
to "linear" doesn't work, because the texture node switches to
trilinear when mipmaps are available.
2023-11-17 14:52:07 -05:00
Benjamin Otte
101296ac0e gl: Make sure render_texture() sets the right format for high depth
Setting the format got lost when converting this coe to the texture
builder, because that codepaths avods the texture sniffing and always
uses RGBA8.
2023-11-17 14:51:56 -05:00
Benjamin Otte
7c9ef05c7c gdk: Make float32 report its true depth
I have no idea how this is the only value that is wrong.
2023-11-17 14:51:37 -05:00
Artur S0
1afad435a7 Update Russian translation 2023-11-04 02:05:59 +00:00
Luca Bacci
e935b25a57 Merge branch 'invalid-client-rects-4-12' into 'gtk-4-12'
[4.12] GdkWin32: ignore invalid client rects

See merge request GNOME/gtk!6545
2023-11-03 21:23:50 +00:00
G.Willems
c69e19c9c5 GdkWin32: ignore invalid client rects
Gdk-Win32 uses GetClientRect() internally to query the surfaces coordinates,
but this API may fail in some transient contexts (observed when iconifying
a maximized window).
Check if the rect area is null, and don't update the surface position in
that case. This will keep the current surface size, until Win32 notifies
the new valid window state later.
This prevents using a nulled next_layout for toplevel size computation,
which would break widgets allocation once notified on gtk side.

Fixes #5724
Closes #5724
2023-11-03 22:51:47 +02:00
Matthias Clasen
fe9abc78c0 Merge branch 'wip/chergert/for-4-12' into 'gtk-4-12'
cherry-pick bgra/vertex-array checks to 4.12

See merge request GNOME/gtk!6541
2023-10-31 21:35:51 +00:00
Matthias Clasen
a65dc12392 gsk: Use vertex arrays when we can
Use the new has_vertex_arrays api to determine
whether we can use vertex arrays in GL.`

Fixes: #6173
2023-10-31 13:46:32 -07:00
Matthias Clasen
f725e3f992 glcontext: Add api to check for vertex arrays
Vertex arrays are available in GL and in GLES >= 3.

We don't check for the GLES extension that provided
vertex arrays in older GLES, since that requires
using different API.

This api avoids version checks all over the place.
2023-10-31 13:46:32 -07:00
Matthias Clasen
5ff9316ec2 gsk: Restore bigendian support
Restore the bigendian support that was lost in b0e26873f6,
by just not using GL_BGRA with GLES on bigendian. Should be a
very rare combination, but still.
2023-10-31 13:46:32 -07:00
Matthias Clasen
41dbb7a757 gsk: Use has_bgra in more places
The glyph and icon libaries were also checking for GLES to
decide if data needs to be transformed from BGRA to RGBA.

Use the new has_bgra getter instead.

This will probably break on bigendian, because the
GL_BGRA + GL_UNSIGNED_BYTE combination is not equivalent
to the cairo format on bigendian, but this was already
broken for the gl format information that we get from
gdk_memory_format_gl_format.
2023-10-31 13:46:32 -07:00
Matthias Clasen
9c6a4c3d28 glcontext: Check for GL_EXT_texture_format_BGRA8888
Check for this GLES extension and add a private getter.
2023-10-31 13:46:32 -07:00
Guillaume Bernard
3b8c1189f4 Update French translation 2023-10-23 15:22:24 +00:00
Sabri Ünal
aaea063c96 Update Turkish translation 2023-10-21 09:15:46 +00:00
Matthias Clasen
24670df0f0 Merge branch 'macos_ci' into 'gtk-4-12'
Backport macOS CI to 4-12 to use new runner

See merge request GNOME/gtk!6497
2023-10-19 16:18:53 +00:00
René de Hesselle
9753fc3b82 gdk: Use subpixel_layout on macOS
(cherry picked from commit 9aeb5be8ad)
2023-10-19 17:26:44 +02:00
Jayson Reis
1c58913f6a gdk: Remove a leftover reference to the renamed variable prefers_high_depth
(cherry picked from commit aa888c0b3f)
2023-10-19 17:26:44 +02:00
René de Hesselle
0f8b9c73cd ci: Backport CI yaml from main
This makes the CI yaml identical to the one in main, which changes
two things:
- modernize workflow configuration
- use a new macOS runner for macOS CI
2023-10-19 17:11:35 +02:00
Florentina Mușat
b108e8b91a Update Romanian translation 2023-10-18 18:14:42 +00:00
Daniel Mustieles
06b39de159 Update Spanish translation 2023-10-17 15:09:53 +00:00
Matthias Clasen
761af75b1d Merge branch 'no-emus-in-bitfields-4.12' into 'gtk-4-12'
[4.12] Stop using enums in bitfields

See merge request GNOME/gtk!6491
2023-10-17 10:30:00 +00:00
Sergey Bugaev
3e2ef5037a Stop using enums in bitfields
The C standard does not specify whether the underlying type of an enum
is signed or unsigned, and until C23 there was no way to control this
explicitly. GCC appears to make enums unsigned unless there is a
negative value among cases of the enum, in which case it becomes signed.
MSCV appears to make enums signed by default.

A bitfield of an enum type (which is not specificied in the C standard
either) behaves as if it was an instance of a numeric type with a
reduced value range. Specifically, a 'signed int val : 2;' bitfield will
have the possible values of -2, -1, 0, and 1, with the usual wraparound
behavior for the values that don't fit (although this too is
implementation-defined).

This causes the following issue, if we have:

typedef enum
{
  GTK_ZERO,
  GTK_ONE,
  GTK_TWO
} GtkFoo;

struct _GtkBar
{
  GtkFoo foo : 2;
};

and then assign bar.foo = GTK_TWO and read it back, it will have the
expected value of 2 (aka GTK_TWO) on GCC, but a value of -2 (not
matching any of the enum variants) on MSVC.

There does not seem to be any way to influence signedness of an enum
prior to C23, nor is there a 'unsigned GtkFoo foo : 2;' syntax. The only
remaining options seems to be never using enums in bitfields, which is
what this change implements.

In practice, this fixes GdkPipeIOStream crashing with an assertion when
trying to copy-paste in-app in MSVC builds on GTK.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-17 11:40:51 +03:00
Artur S0
f0448a3708 Update Russian translation 2023-10-16 11:56:09 +00:00
Sabri Ünal
7df8dbc64d Update Turkish translation 2023-10-14 07:06:07 +00:00
Jordi Mas i Hernandez
d6fecef605 Update Catalan translation 2023-10-03 06:55:50 +00:00
Matthias Clasen
02a94c9462 Post-release version bump 2023-09-28 08:23:37 -04:00
Matthias Clasen
11ef4c8f43 4.12.3 4.12.3 2023-09-28 08:03:14 -04:00
Matthias Clasen
03679fe6bf print portal: Report errors properly
The portal printoperation inmplementation
relies on the file printbackend to be available.
If it isn't, we should report a proper error
status insetad of running into assertions deep
inside the printoperation code.
2023-09-27 20:42:45 -04:00
Christian Hergert
0030c572d4 gsk/gl: remove TypeNode conformity checking for renderjob
We don't need to be calling type node conformity checking from the tight
loop of the renderjob. Hoist that into the private header and use that
intead through via the Class pointer.
2023-09-27 20:42:45 -04:00
Christian Hergert
28e97f028a gsk: remove excessive type checking within GSK
Anything that includes gskrendernodeprivate.h will get an alternate form
of ref/unref for render nodes which does not need to do type checking on
the parameter. We can expect that things are correct within GTK itself and
this saves excessive amounts of TypeNode conformities checking.
2023-09-27 20:42:45 -04:00
Michael Catanzaro
6d371f0594 printoperation: fix some strange line spacing 2023-09-27 20:42:45 -04:00
Michael Catanzaro
cbfbaef4cb printoperation: add some assertions
Let's assert that we schedule the idle callback exactly once.

These assertions are not perfect because if the callback executes before
we schedule it, then the assertion itself would be a use-after-free,
since I'm using the PrinterFinder to track whether the callback that
frees it has been scheduled. But in practice when using loupe's print
dialog, I was noticing the callback scheduled twice before it was
executed. The assertion would have caught this problem.
2023-09-27 20:42:45 -04:00
Michael Catanzaro
39560c0914 printoperation: fix another case where operation may complete twice
This is a little tricky. At first, I thought we had a codepath where we
fail to schedule the idle that completes the print operation: if we take
the gtk_print_backend_printer_list_is_done path for each printer
backend, then printer_list_done_cb() is never executed and we never
schedule the idle. But in fact, in this case, then backends == NULL at
the bottom of find_printer(), and we'll schedule the idle there, so it's
OK. Except it's not really OK, because we'll schedule it even if a
printer was already found, resulting in the callback completing twice
and a double free.

Simplify this. Schedule the idle in find_printer() only if there are
*initially* no backends, not also if all backends are immediately ready
and already removed from consideration. Instead, always call
printer_list_done_cb() for every backend in find_printer_init(). After
the previous commit, printer_list_done_cb() will schedule the idle when
appropriate.

printer_list_done_cb() additionally disconnects signals that we did not
connect in this codepath, but it does so using
g_signal_handlers_disconnect_by_func, which is harmless. Otherwise, the
only extra work it's doing is scheduling the idle, and that's exactly
what find_printer_init() is missing.
2023-09-27 20:42:45 -04:00
Michael Catanzaro
29a243e3d7 printoperation: fix case where operation may complete multiple twice
If we are the final backend, then after removing ourselves there is no
backend remaining. We will schedule the idle even if it has already been
scheduled. This idle is required to run exactly once and executing it
twices results in a double free that crashes loupe when printing. It
also causes the user callback to execute twice, which could cause
similar problems.

Fixes #6122
2023-09-27 20:42:45 -04:00
Christian Hergert
d4d0883a92 gsk/gl: use GdkArrayImpl for tracking modelview
Like the previous change, this uses GdkArrayImpl instead of GArray for
tracking modelview changes. This is less important than clip tracking
simple due to being used less, but it keeps the implementation synchronous
with the Clip tracking code.
2023-09-27 20:42:45 -04:00
Christian Hergert
3698cadcd2 gsk/gl: use GdkArrayImpl for Clip tracking
We can end up spending a lot of time in g_array_maybe_expand() through the
use of g_array_set_size() for clip tracking. That is somewhat due to the
simple nature of GArray being size-dynamic. Instead, we can use
GdkArrayImpl and let the compiler do what it does best to elide some
work and hoist other work into the calling function.

This also fixes a potential UAF in gsk_gl_render_job_push_contained_clip().
2023-09-27 20:42:45 -04:00
Christian Hergert
412a12032f gdk: add missing G_END_DECLS to gdkarrayimpl.c 2023-09-27 20:42:45 -04:00
Emmanuele Bassi
9c4edaa5a0 broadway: Do not add an extra reference when caching textures
We just created a GdkTexture, so we don't need to acquire a reference if
we're transferring the ownership to the node cache.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi
098796e0e6 broadway: Plug another leak
When getting a colorized texture we're downloading the texture as a
Cairo surface, and then feeding it to another texture, but we never drop
the reference of the new surface.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi
6938d5aff2 docs: Clarify the behaviour of gdk_texture_new_for_surface()
Cairo surfaces are not GObject instances, so we should be more explicit
in the behaviour of the memory management, to avoid leaks.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi
17c979caf1 broadway: Plug a leak in the GSK renderer
We are leaking the Cairo image surface when creating a new node.

Fixes: #6120
2023-09-27 20:42:45 -04:00
Benjamin Otte
bbe7e8555d array: Compute new size properly
Using "1 << x" means that we are shifting a signed 32bit integer, but we
want a gsize, which is an unsigned 64bit integer.

So now we don't overflow anymore if the array reaches a size of 2GB.
2023-09-27 20:42:45 -04:00
Benjamin Otte
df4f716ea0 gdk: Fix compiler warning
gcc's -Wlto-type-mismatch found the hack, where we copied the wrong
prototype.
2023-09-27 20:42:44 -04:00