80037 Commits

Author SHA1 Message Date
Matthias Clasen
320f27a202 4.14.5 4.14.5 2024-08-16 10:56:14 -04:00
Mikael Forsberg
cdb12e0e21 docs: Fix popover docs typo 2024-08-16 10:27:42 -04:00
Matthias Clasen
eb1d2a5b4d icon helper: Fix an argument order mishap
It seems that for a long time, no compiler saw it fit to warn
about this, even though they argument types are not the same.
2024-08-16 10:27:31 -04:00
Kjell Ahlstedt
f6c18cd031 docs: Improve gtk_window_set_interactive_debugging() docs
This function is recommended only if you override the default
key shortcuts for the Inspector.
2024-08-16 10:26:57 -04:00
Kjell Ahlstedt
ea97e89d81 docs: Improve gtk_window_set_interactive_debugging() docs
This function is recommended only if you override the default
key shortcuts for the inspector.
2024-08-16 10:26:51 -04:00
Matthias Clasen
1e99f00b77 widget: Fail properly in compute_transform
We don't currently support computing transforms across native
boundaries. This could be added by using gdk_popup_get_position_x/y.
For now, just fail in this case.

Related: #6355
2024-08-16 10:26:22 -04:00
Scrambled 777
2054dc9620 Update Hindi translation 2024-08-13 18:42:31 +00:00
Daniel Șerbănescu
cfbfaeae01 Update Romanian translation 2024-08-11 11:14:31 +00:00
Matthias Clasen
a4ccf4d7d4 Merge branch 'plug-gtask-leaks-gtk-4-14' into 'gtk-4-14'
[GTK 4.14] Plug GTask leaks

See merge request GNOME/gtk!7578
2024-08-08 01:29:14 +00:00
Sergey Bugaev
d0864b141f Plug GTask leaks
The error-prone pattern seems to be:

  GTask *task = g_task_new (...);

  if (condition)
    {
      g_task_return_... (task, ...);
      /* need g_object_unref (task) here! */
      return;
    }

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-08-07 20:39:40 +03:00
Emmanuele Bassi
5a13e2a183 Merge branch 'wip/dont-leak-egl-surface-14' into 'gtk-4-14'
[14] gdk/surface: Don't leak the EGLSurface

See merge request GNOME/gtk!7572
2024-08-07 16:20:51 +00:00
Matthias Clasen
d84c322f2a Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[GTK 4.14] Various backports (part 2)

See merge request GNOME/gtk!7553
2024-08-07 14:49:06 +00:00
Jonas Ådahl
6e10ea07fb gdk/surface: Don't leak the EGLSurface
Each time we create a new window, we create a new EGLSurface. Each time
we destroy a window, we failed to destroy the EGLSurface, due to passing
a GdkDisplay instead of a EGLDisplay to eglDestroySurface().

This effectively leaked not only the EGL surface metadata, but also the
associated DMA buffers. For applications where one opens and closes many
windows over the lifetime of the application, and where the application
runs for a long time; for example a terminal emulator server, this
causes a significant memory leak, as the memory will only ever be freed
once once the application process itself exits, if ever.

Fix this passing an actual EGLDisplay instead of an GdkDisplay, to
eglDestroySurface().
2024-08-07 16:03:59 +02:00
Jonas Ådahl
069b37cde9 gdk/surface: Don't leak the EGLSurface
Each time we create a new window, we create a new EGLSurface. Each time
we destroy a window, we failed to destroy the EGLSurface, due to passing
a GdkDisplay instead of a EGLDisplay to eglDestroySurface().

This effectively leaked not only the EGL surface metadata, but also the
associated DMA buffers. For applications where one opens and closes many
windows over the lifetime of the application, and where the application
runs for a long time; for example a terminal emulator server, this
causes a significant memory leak, as the memory will only ever be freed
once once the application process itself exits, if ever.

Fix this passing an actual EGLDisplay instead of an GdkDisplay, to
eglDestroySurface().
2024-08-07 15:07:16 +03:00
Benjamin Otte
7f2df18a10 iconhelper: Size no longer depends on scale
This is a leftover from GTK3 when iconhelper sizes depended on the
texture size.

Now we only need to queue a redraw with the new icon.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-05 17:17:08 +03:00
Benjamin Otte
861aaa5baa windowcontrols: No need to listen to scale factor changes
This is a GTK3 leftover where the icons were manually drawn and sized.
Now that they're managed by actual widgets that enforce a correct size
that is independent of scale factor, this is no longer necessary.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-05 17:16:49 +03:00
Arjan Molenaar
bf8b0ac8d4 macos: fix window transparency
Revert window decoration changes from
a6ce506714.
2024-08-05 17:16:23 +03:00
Matthias Clasen
71307b1b29 dmabuf: Fix the disjointness check
We were checking the wrong fds here.

This came up while toying with udmabuf and creating multi-plane
NV12 buffers.
2024-08-05 17:15:47 +03:00
Jeremy Bícha
4d93e39522 ci: avoid another date-dependent failure
Set the day before setting the month to avoid
failure when running the test on the 31st day of a month
2024-08-05 17:15:27 +03:00
Matthias Clasen
325cb8071f subsurface: Avoid a crash
When finalizing a subsurface, we need to make sure it is removed
from the sibling lists in its parent, or bad things will happen.

This should crashes seen in Epiphany nightly.

Fixes: #6891
2024-08-05 17:13:07 +03:00
Simon McVittie
eaa265c924 Avoid calling memcpy with n == 0
Some callers of these functions ask to copy 0 items from a NULL source,
which would be valid if they were copied in a loop (because NULL would
never be dereferenced), but is declared to be undefined behaviour for
Standard C memcpy. Guard the call to memcpy so that we only call it
if we have more than 0 items, and therefore should have a non-NULL
source pointer.

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-08-05 17:08:52 +03:00
Simon McVittie
d3dafb3998 gtktimsort: Avoid undefined behaviour on 32-bit
Shifting a 32-bit type by 32 bits is formally undefined behaviour,
even if it happens in code that is unreachable at runtime. Use a
compile-time check against GLib's GLIB_SIZEOF_SIZE_T, instead of hoping
a runtime check will be optimized away.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-05 17:08:39 +03:00
Simon McVittie
30df7d6082 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-08-05 17:06:10 +03:00
Simon McVittie
96bcf0a961 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-08-05 17:03:20 +03:00
Pablo Correa Gómez
54e9130320 gtkspinbutton: Set number input hint for text field if numeric
The main reason to do this is so that the OSK shows a numeric touchpad
instead of the regular keyboard when the spin button only accepts
numbers
2024-08-05 17:01:07 +03:00
Matthias Clasen
211a00e5e0 Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
Backport 7237 and 7492 into 4.14

See merge request GNOME/gtk!7503
2024-07-27 01:39:42 +00:00
g.willems
66dc220e81 tooltip: query tooltip on widget under pointer only
When changing the tooltip text or markup of widget A, we simulate a
motion event on that widget to update the display.
But if there is an active tooltip on widget B, then the current code
belives we moved the pointer from B to A thus hides/shows the tooltip
of B alternatively.

Instead, simulate the motion event on the widget currently under the pointer.
This will avoid flickering if we keep the pointer over widget B.

Fixes #6674
Closes #6674

(cherry picked from commit d665274eb1)
2024-07-27 02:12:51 +03:00
Arjan Molenaar
15b8380210 macos: Propagate the create-folders option also for Open panels
When opening a folder, it may come in handy to create a folder.

Fixes #6872.

(cherry picked from commit 6bbda619f9)
2024-07-27 02:11:40 +03:00
Matthias Clasen
edb31b0a67 Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[GTK 4.14] Various backports

See merge request GNOME/gtk!7491
2024-07-25 12:35:08 +00:00
Marco Trevisan (Treviño)
0784067c0b gdkdmabufformats: Add autoptr definition 2024-07-25 13:20:19 +03:00
Sergey Bugaev
d6b2c2cb1f urilauncher: Fix use-after-free on GCC < 12
Building GTK with GCC 8 results in the following warning:

  gtk/gtkurilauncher.c: In function ‘gtk_uri_launcher_launch’:
  gtk/gtkurilauncher.c:315:3: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     else
     ^~~~
  gtk/gtkurilauncher.c:317:1: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   ^~~

In the compiled code, gtk_show_uri_full () is invoked whether the portal
branch is taken or not, leading to use-after-free of the task.

It looks like GCC in versions older than 12 treats the _Pragma(s) that
G_GNUC_BEGIN_IGNORE_DEPRECATIONS expands to as C-level statements, and
therefore the pragma takes up the 'else' statement slot.

See https://godbolt.org/z/e5zqbaqxo for a simple reproducer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-07-25 13:20:19 +03:00
Jie Liu
63d38c0cc2 Ignore grabbing tablet devices without pads or tools
Signed-off-by: Jie Liu <liujie01@kylinos.cn>
2024-07-25 13:20:19 +03:00
Christian Hergert
9a1eb3eb61 columnview: check column visibility when measuring
We only want to measure visible columns so that they may consume the
maximum width available to the widget. This fixes a situation where hidden
columns would cause less-than the whole width to be allocated. Additionally
that fixes warnings where some widgets expect more horizontal space than
they would ultimately be allocated.
2024-07-25 13:20:19 +03:00
Balló György
bafc36aca6 Add missing icon
The fullcolor 'document-save' icon is used in the print dialog for the
'Print to File' element.
2024-07-25 13:20:19 +03:00
Matthias Clasen
54980e2b45 expander: Don't leave dangling a11y relations
If we unparent the widget, we should sever a11y relations too.
Otherwise, an a11y implementation might follow them and be surprised
to find a parentless widget (and not in a good way).

Updated tests to not check the relation on an unexpanded expander.
2024-07-25 13:20:19 +03:00
Matthias Clasen
f424b6bdf1 gsk: Avoid a crash
The subsurface in subsurface nodes can be NULL, so check before
poking at it.
2024-07-25 13:20:19 +03:00
Matthijs Velsink
90803c52e3 popover: Fix invalid width/height check in layout
Commit a4cc95b2 introduced a check in layout() that closes the popover
if the width or height is smaller than the minimum width or height,
respectively. However, that was using gtk_widget_get_preferred_size(),
which finds out the minimum height for the minimum width and vice versa,
but not the minimum height for the layout width and vice versa. So,
certain popovers were not showing, even though they would not have
generated a critical to begin with.

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

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

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

Closes #5782
Fixes #6796
2024-07-25 13:20:19 +03:00
Matthias Clasen
2e9785db8a snapshot: Don't crash and don't leak
We were trying to handle a NULL mask child, unsuccessfully.

Pointed out by Niels De Graef.
2024-07-25 13:20:19 +03:00
Matthias Clasen
acbddd6634 dnd: Avoid a critical
There is no way for callers of this function to find out if
the drop is still the same, so spewing a critical if it isn't
seems useless. Just quietly do nothing.
2024-07-25 13:20:19 +03:00
Matthias Clasen
aecf2011df popover: Hide if we don't get enough size
If the compositor does not give us our min size, we have to
disappear, or we risk criticals from underallocating widgets.
2024-07-25 13:20:19 +03:00
Fabio Lagalla
ca36537f14 gdk: Implement fullscreen on selected monitor on macos
The feature was apparently missing, as monitors were always fullscreened at the surface best monitor.

Keep using best monitor if the selected monitor is not specified, otherwise move the window to the selected monitor before going fullscreen.
2024-07-25 13:20:19 +03:00
Matthias Clasen
97e3b55712 popover: Recompute shape more often
We want to recompute the shape when the attachment position has
changed, since that might require the arrow to be repositioned.
2024-07-25 13:20:19 +03:00
cameron
ef21b56e30 Fix Harfbuzz subset dependency not found in wrap
Add harfbuzz subset to the harfbuzz wrap file so Meson can find the
dependency.
2024-07-25 13:20:19 +03:00
Matthias Clasen
605b11cdb6 wayland: Add missing listeners
Now that we are using version 6 of the compositor interface,
we need to have preferred scale and bufer transform callbacks
everywhere.
2024-07-25 13:20:19 +03:00
gayathri.berli@ibm.com
4aabd7a402 changes to fix the memorytexture regression 2024-07-25 13:10:30 +03:00
g.willems
ca78d245c7 range: fix highlight clipping
Clipping on padding box prevents the scale highlight to fully paint itself
over the scale trough, including its border.
Use the border box instead.

Fixes #6332
2024-07-25 13:10:30 +03:00
g.willems
f886aa3ac3 progressbar: fix highlight clipping
Clipping using OVERFLOW_HIDDEN relies on widget's padding box.
This prevents the highlight to paint itself over the trough's borders.

Use the border box instead, with a custom snapshot implementation.

Fixes #6332
2024-07-25 13:10:30 +03:00
Benjamin Otte
2746d3386d testsuite: Shrink maximum texture size in test
1MB textures can lead to 20s runtimes - which with asan CI being a lot
slower can be a loooong time and cause timeouts.

Limiting them to 16kB still allows hitting max texture size sometimes
but makes sure the test only runs for 3-4s worst case.
I hope that doesn't trigger timeouts even under asan.
2024-07-25 13:10:30 +03:00
Georges Basile Stavracas Neto
aaba54051f filechooserwidget: Plug a bunch of GtkBitset leaks
gtk_selection_model_get_selection() is transfer full, and the returned
bitset must be freed by the caller. GtkFileChooserWidget freed none of
them.

Unref the bitsets.

Related: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/91
2024-07-25 13:10:30 +03:00