Commit Graph

77459 Commits

Author SHA1 Message Date
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
Benjamin Otte
3942590e7f treeview: Fix crash in assertion
The fix in commit a267dfac5d is wrong.
The function can return FALSE in normal operation.

Instead do a check for node == NULL that gracefully returns FALSE instead.

Fixes: #6114
2023-09-27 20:42:44 -04:00
Matthias Clasen
9fb934b9fc Improve FOO_DEBUG=help output
Explain the all value a bit better.
2023-09-27 20:42:44 -04:00
Alice Mikhaylenko
60d0213ce0 dialog: Check header bar type before calling track_default_decoration()
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6116
2023-09-27 20:42:44 -04:00
Alice Mikhaylenko
88013bbdab header-bar: Add a precondition to track_default_decoration() 2023-09-27 20:42:44 -04:00
Matthias Clasen
3ab67d852b gtk-demo: Fix a refcounting mishap
gtk_font_dialog_button_new's argument is
transfer full.

Fixes: #6113
2023-09-27 20:42:44 -04:00
Emmanuele Bassi
f3daa0ee08 docs: Mention for what GtkStringObject:string is useful 2023-09-27 20:42:44 -04:00
Emmanuele Bassi
60560e5277 docs: Link GtkStringObject from GtkStringList
A frequently asked question is: "what is the object type inside a
GtkStringList", so let's make the answer more obvious.
2023-09-27 20:42:44 -04:00
Emmanuele Bassi
8cb6b9b385 docs: Add a link to the DropDown:selected property
The main description is a bit too coy, and some newcomers don't
understand the concept of properties and notification.
2023-09-27 20:42:44 -04:00
Jürgen Benvenuti
cfd9cb3e9f Update German translation 2023-09-26 20:37:59 +00:00
Aurimas Černius
61276e9a76 Update Lithuanian translation 2023-09-25 19:58:03 +00:00
Rafael Fontenelle
90b8dcdf33 Update Brazilian Portuguese translation 2023-09-25 12:58:37 +00:00
Piotr Drąg
38bd0b07f3 Update Polish translation 2023-09-24 14:16:38 +02:00
Kristjan SCHMIDT
ecc42c506b Update Esperanto translation 2023-09-23 16:41:34 +00:00
Danial Behzadi
052c2c1d16 Update Persian translation 2023-09-23 15:15:29 +00:00
Balázs Úr
28099aa1b5 Update Hungarian translation 2023-09-22 22:25:30 +00:00
Asier Sarasua Garmendia
dea3324217 Update Basque translation 2023-09-21 17:28:05 +00:00
Yuri Chornoivan
8e090a8a0c Update Ukrainian translation 2023-09-21 16:21:33 +00:00
Baurzhan Muftakhidinov
f6d4b7b04b Update Kazakh translation 2023-09-21 15:28:54 +00:00
Luca Bacci
b4c7d1d065 Merge branch 'fix-issue-6080-gtk-4-12' into 'gtk-4-12'
GdkWin32: Unref GdkMonitor after calling gdk_monitor_invalidate () [4.12]

See merge request GNOME/gtk!6412
2023-09-21 12:42:02 +00:00
Daniel Rusek
b440ba8e8c Update Czech translation 2023-09-21 12:40:07 +00:00
Fran Dieguez
9be96c8f5d Update Galician translation 2023-09-21 10:14:55 +00:00
Daniel Mustieles
f6488b83cc Updated Spanish translation 2023-09-21 11:33:07 +02:00
Daniel Mustieles
5e17b56135 Updated Spanish translation 2023-09-21 11:32:58 +02:00
Ekaterine Papava
0c3d86865b Update Georgian translation 2023-09-21 03:44:05 +00:00