When porting textlayout to GTK 4 a line display cache was introduced. That
cache creates a situation where you may not create GtkTextLineDisplay in
order from GtkTextLineSegment.
Because of that, we must start the creation of each line display from
fresh line state or we could re-apply the GtkTextAppearance of another
row. However, once you do that, one_style_cache will never have a match
and therefore is pure overhead.
This removes one_style_cache altogether.
Fixes: #7108
The Wayland source was blocking the Wayland display queue between its
check() and prepare() callbacks.
This is a rare event to cause problems because it requires
1. Another source with
2. a higher priority that
3. triggers at the same time as the Wayland source and
4. triggers a roundtrip or other operation that requires reading events
from the display.
Introduced in commit 2893526a48 during GTK 3.21, so this should
probably be fixed in GTK3, too.
Fixes#7091
If we get an error from the message bus (dbus-daemon or dbus-broker),
for example ServiceUnknown if Avahi is not installed or perhaps
SpawnFailed if the service is disabled, it is mapped to a GLib GError.
The errors typically emitted by the message bus belong to the GDBusError
domain, but if nobody has registered the G_DBUS_ERROR domain yet,
then they might be mapped to G_IO_ERROR_DBUS_ERROR instead.
Previously, this code ignored G_IO_ERROR_DBUS_ERROR, but emitted a
warning if the error happens to have been mapped to G_DBUS_ERROR.
This resulted in action-at-a-distance: an unrelated component
triggering registration of the G_DBUS_ERROR domain would make printing
dialogs log the warning. This seems undesirable, and in particular it
can cause test failures, because GLib's test framework makes warnings
fatal by default.
Signed-off-by: Simon McVittie <smcv@debian.org>
If we get a G_IO_ERROR_DBUS_ERROR here, we shouldn't make too much noise
about it by default, but it's still a useful data point for debugging
and diagnosis.
Signed-off-by: Simon McVittie <smcv@debian.org>
When determining the number of selected children, we were properly
counting only items, but in the rest, we were confused by row headers.
Because the GtkListItemBase methods did not throw a warning on inappropriate
pointer type passed, we happily passed the row headers, got some private
data object as the wrong type, and then returned nonsense, for example, 2
for gtk_list_item_base_get_selected.
With the swapchain maintenance extension, we have a way to release
the acquired swapchain image before recreating the swapchain, in
the VK_SUBOPTIMAL_KHR case. Use it.
Tested by toggling fullscreen in the bloatpad example, which causes
mesa to return VK_SUBOPTIMAL_KHR (since dmabuf modifiers change).
If vkAcquireNextImageKHR returns VK_SUBOPTIMAL_KHR, the semaphore
is in use, but vkDeviceWaitIdle will not wait for it, since it is
not associated with a queue. Make sure that is the case, so we don't
run into a validation error when we try vkAcquireNextImageKHR with
the same semaphore, after recreating the swap chain.
See https://github.com/KhronosGroup/Vulkan-Docs/issues/1059 for
some related discussion.
Fixes: #7079
The `gdk_color_finish()` calls are currently after the `return`,
so they are never executed. Move the `return` below the cleanup
code to avoid that.
Fixes: bd3d1f7715 ("gsk: Add private border node api")
The default implementation for get_default_attributes() returns NULL for
both names and values yet the code which iterates them is assuming they
will never be NULL.
Since the interface implies that if the values are set, they will return
valid strings, make the default implementation do that.
Fixes: #7069
(cherry picked from commit ab1c85830c)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
It seems that NVidia sets PFD_SWAP_EXCHANGE / WGL_SWAP_EXCHANGE_ARB
on pixel formats but doesn't guarantee that the backbuffer age is
constantly 2. My guess is that they use swap exchange only to signal
usage of a flip present method.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/7019
When changing the code to do the resize only when the size changed, I
forgot to queue a draw when the size did not change.
Fixes: 5031f30f28
Related: !7786
The warning gets triggered by rounding errors.
In particular when using fractional scales, the final tile may end up
not accurately matching the computed final value (in the example I was
debugging it was computing 1 vs 1.00000036 for the final tile index,
but that result computed a 0px wide tile size.
And for that tile size we hit that exit condition.
Add a uses-gl property to our sink implementation, and use
it in the paintable code. This avoids juggling a second gl
context, with the risk of leaking it.
Calling gtk_media_stream_realize is not mandatory, but we can
still try to make dmabufs happen. Tested by removing the realize
call from GtkVideo and using GDK_DISABLE=gl.
We only need a display to negotiate dmabuf formats. Pass that
directly, instead of getting the display of the GL context as
we did so far.
With this,
GSK_RENDERER=vulkan GL_DISABLE=gl gtk4-demo --run video_player
still uses dmabufs.
Related: #7048
The original intent was to only realize parents recursively for
non-widget accessible objects. The implementation, however, always
try to realize parents. In the case of GtkStackPage, which is a
non-widget accessible with a widget accessible child, this breaks.
Only realize non-widget accessible parents recursively if the
current accessible is not a widget as well.
Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/7058
Fixes 6074a18e3e
(cherry picked from commit 06f08ea804)
It is useful to track down mysterious crashes in ci, but it causes
sporadic test failures, so disable it for now, until we have another
mysterious crash.
When setting a new paintable, we don't need to queue_resize() when it's
the same size as the old paintable.
This is especially useful when pictures are used in a listview or
gridview and different rows display images of the same size.
It is possible that the window gets unrealized while a handle to its
surface is exported. This, naturally, invalidates the handle, so there
is nothing left to unexport. We should just note that and do nothing,
rather than crashing.
Fixes a crash when a portal-backed file dialog parented to a window is
closed after the window it was parented to.
Reported-by: Ivan Molodetskikh <yalterz@gmail.com>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
The last part of logic in gtk_scrolled_window_measure () that accounted
for scrollbars was handling the hscrollbar first, and vscrollbar second.
For each of them, it looked at the orientation we're being measured in,
and either added or MAX'ed scrollbar's size request into ours (or not,
depending on scrollbar policy and whether overlay scrolling is used).
In case of GTK_ORIENTATION_HORIZONTAL, this resulted in
// MAX in hscrollbar width.
minimum_req = MAX (minimum_req, min_scrollbar_width + sborder.left + sborder.right);
// Add in vscrollbar width.
minimum_req += min_scrollbar_width;
whereas for GTK_ORIENTATION_VERTICAL, it was
// Add in hscrollbar height.
minimum_req += min_scrollbar_height;
// MAX in vscrollbar height.
minimum_req = MAX (minimum_req, min_scrollbar_height + sborder.top + sborder.bottom);
The former is correct and the latter is wrong: we should be adding the
size requests of the scrollbars together, and MAX'ing them with the
content size request.
Fix this by refactoring the logic to first handle the MAX'ing, and then
the addition.
This fixes the following criticals:
Gtk-CRITICAL **: 17:26:51.406: Allocation height too small. Tried to allocate 15x31, but GtkScrollbar 0x2a00fac0 needs at least 15x46.
that were happening when all of:
- scrollbar policy was set to ALWAYS,
- overlay scrolling was disabled,
- the scrollable child was really small.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>