Nothing prevents control points from being identical,
and if that happens, some of our constructions involving
tangents and normals break down. Handle these cases in
get_{start,end}_tangent and offset, for the case of
cubics.
Add a way to find the intersections of two curves.
We can handle some curve-line intersections directly,
the general case is handled via bisecting.
This will be used in stroking and path ops.
This is mainly useful for decomposing a conic into
cubics. The criterion here for terminating the
subdivision is very improvised.
But it also allows for other use cases, such as
raising the degree of quadratics to cubics.
An auxiliary API introduced here is gsk_curve_elevate.
This is to make room in the api for quadratic curves.
In detail:
- Replace GSK_PATH_CURVE by _CUBIC
- Rename gsk_path_builder_curve_to to _cubic_to
- Replace GSK_PATH_FOREACH_ALLOW_CURVE with _CUBIC
- Replace GskCurveCurve with GskCubicCurve
If we can't append a circle contour, just
convert to a standard contour. This warning
was occasionally causing tests to fail
(when a suitable random path gets generated).
When looking for discontinuities, there
is no need to check for epsilons. As we
move close to the end of one contour / the
beginning of the next, the path length distance
between the two points will get arbitrarily
small, so we can just check that the distance
between the points is more than twice that.
This makes spurious failures of the /path/get_point
test go away.
Close reading of sources revealed that we
were not actually using the same conditions
as skia here, causing our measurements to
come out slightly different.
With this change, we are in almost perfect
agreement with skia.
Follow the usual implementation more closely,
and drop reporting a separate 'on_edge' bit.
This was wrong in some cases, and we don't
need it. See the testcase in this commit
for a case where 'on_edge' was wrongly
deciding that a point is inside.
It turns out that using strchr() to identify
chars in your string isn't safe since strchr
happily matches the '\0' at the end of the input.
If we are not careful, that makes use walk
off the end of the string.
This issue was found by asan.
g_test_init sabotages tests in release builds,
we have to use (g_test_init) to avoid the sabotage.
At the same time, we have to avoid using g_assert,
since that's a no-op in release builds.
The IFUNC resolvers that we are using here get
run early, before asan had a chance to set up its
plumbing, and therefore things go badly if they
are compiled with asan. Turning it off makes things
work again.
The gcc bug tracking this problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110442
When curves have long straight parts that decompose into a single line,
don't try to split them. Instead, split at a well-known position and a
the part of that long straight line as a line.
This gives way more accurate numbers and is more accurate than 1% for
everything but contours with very small weight and
start_point == end_point, where the error is closer to 1.5%.
When decomposing curves that are too straight, we may emit lines for
long parts of the curve. These lines do not properly map
t => distance
and it is better to treat them as a regular line than a curve.
This reason argument gives that information.
No users so far, that will happen in followup commits.
This is a regular path creation API, so treat it that way.
On top, it is rather awkward if the only constructor for a path that is
immediately visible to people reading the docs is the one that takes a
Cairo path - when we want to deprecate Cairo.
These are just nice apis to have and avoid having to carry
these around as extra arguments in many places.
This was showing up as inconvenience in writing tests
for the measure apis.
The progress is non-uniform, so simple translation of progress doesn't work.
So check if larger and smaller values inch closer towards minimal distance.
Conics are evil in that their parameter skews towards the center, and if
it's a very flat conic (weight almost equal to 0), then we'd approximate
it with a single segment and not subdivide, which would cause the
parameter to be wildly off around 0.25 or 0.75.
And that would cause offset calculations to fail.
GskCurve is an abstraction for path operations. It's essentially a
collection of vfuncs per GskPathOperation.
GskStandardContour has been ported to use it where appropriate.
A gskpathop is a pointer to a graphene_point_t* with the low bits used
to encode the GskPathOperation. It's an easy way to introduce API for
operations.
So far it's just used to replace GskStandardOperation.
This way we can default to the siplest possible foreach() output - like
cairo_copy_path_flat() decomposing everything into lines - and add flags
to get more and more fancy.
This will be useful to have conics automatically decomposed for Cairo
drawing or if we want to add more line types in the future.
Implement this in the obvious way, using the decomposed form
of standard contours. Since the decomposed form is part of the
measure object, this api moves from gsk_path_in_fill to
gsk_path_measure_in_fill.
This test includes an implementation of a gsk_path_equal() func with
a tolerance that is necessary because parsing does not always work
100% exactly due to floating point rounding, so we can't just
compare the to_string() output.
Write out the commands for rects and circles in a special
way, and add code in the parser to recognize this, so we
can successfully round-trip these through the SVG path format.
The special way - for people who want to use it for debugging -
for now is that we use uppercase "Z" to close standard paths, but
lowercase "z" to close our special paths.
A test is included, but the random path serializations should take care
of it, too.
The svg A can not do a full circle, since it is a two point
parametrization - if the start and end point are the same,
it draws nothing. So, use two arcs.
Implement the SVG path syntax to read back the strings
that we generate when serializing paths. The tests for
this code are taken from librsvg.
This includes an elliptical arc implementation according
to the SVG spec. The code is mostly taken from librsvg,
but pretty directly follows the SVG spec implementation
notes. We don't export this, since the parametrization
is inconvenient. We do want an arc_to API, but
these are not the arcs we are looking for.
This is elliptical arc implementation according to the SVG spec.
The code is mostly taken from librsvg, but pretty directly
follows the SVG spec implementation notes.
We don't export this, since the parametrization is inconvenient.
We do want an arc_to API, but these are not the arcs we are
looking for.
It will be used in parsing SVG path syntax.
Add a miter limit to GskStroke. This will be needed to
fully implement line joins.
Also introduce the GSK_LINE_JOIN_MITER_CLIP value,
following SVG 2.0. cairo does not have it, so translate
it to plain miter when using cairo.
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.
Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
With 10% chance, create a "weird" path like the empty one or only
points or things like that.
Otherwise create a bunch of contours, with 2/3 a standard contour,
with 1/3 a predetermined one.
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.
That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
If a node has a higher depth, pick the RGBA format that has that depth
as the texture format we're renderig to with render_texture().
Support for adapting the swapchain is not part of this.
When a GdkMemoryFormat isn't supported, pick close formats that have a
higher chance of being supported.
Make sure this works recursively and the whole loop always ends up at
R8G8B8A8_UNORM because that one is mandatory.
Roughly, follow these rules:
1. Drop the unpremultiplied
2. Expand channels to include all of RGBA
3. pick swizzle that is RGBA
4. pick next largest depth
5. pick R8G8B8A8_UNORM
This way, we unify the code paths for memory access to textures.
We also technically gain the ability to modify images, though I have no
use case for this.
That way, the offscreen can create images of different types.
Its not used in this commit, but will come in handy when we want to
support high bit depth.
Pretty much copy what GL does and just use the default display to create
GPU-related resources without the need for a display.
This also adds gdk_display_create_vulkan_context() but I've
kept it private because the Vulkan API is generally considered in flux,
in particular with our pending attempts to redo how renderers work.
Fixes a bug introduced in d1135f9e3c.
Luckily the buffer was large enough that all my testing didn't catch it
because it took a few minutes to overflow.
The result of calling update_property needs
to be that the property is marked as set
afterward, even if the value we pass happens
to match the default value.
After this change, scrollbars have value-now
show up as zero in the accessiblity page of
the inspector, even when that matches the lower
bound.
Test included.
Fixes: #5886
Replace gdk_memory_format_prefers_high_depth with the more generic
gdk_memory_format_get_depth() that returns the depth of the individual
channels.
Also make the GL renderer use that to pick the generic F16 format
instead of immediately going for F32 when uploading textures.
Special-case nested buttons in our name computation,
since it is hard to reconcile all the a11y attributes
being on the wrapper, but the focus ending up on the
button inside.
This is a pragmatic approach that works. The only
downside is that the wrapper and the button end up
with the same name+description, but at least orca
seems to only read the focus elements' ones.
This reverts commit 343b9d246f.
Unfortunately, this makes it so that the focus ends up on
the 'generic' accessible, not the one with the label, and
orca remains quiet.
This reverts commit 5ec0b07baf.
Unfortunately, this makes it so that the focus ends up on
the 'generic' accessible, not the one with the label, and
orca remains quiet.
Make the internal toggle button generic, so that
the a11y checker doesn't complain about it not
having a label. And mark the icons in the popup
as presentational.
Make the color button itself take the button role,
and make the internal toggle button just be generic.
This solves the problem that labelled-by relations
that are set up in ui files via mnemonics point at
the toplevel, not the toggle button.
Make sure the color of the swatch and the button
are initially in sync. As a side-effect, this
ensures that the swatch has its accessible label
computed at the outset.
Include the needed headers so that we don't break the build with C4013
warnings, which are treated as errors if msvc_recommended_pragmas.h is
found during build configuration.
Complete the API change from commit be1729b316 ("signallistitemfactory:
Update signal prototype").
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
We can not compute the correct value, but that does not mean we should return
basically random values from an unitialized stack space.
Rather than that behavior, return zeros concistently.
Now that we don't use the old environment variables anymore to force
staging buffer/image uploads, we don't need them.
However, we do autodetect the fast path for avoiding a staging buffer
now, and we might want to be able to turn that off for testing.
So add GSK_DEBUG=staging that does exactly that.
This is unused now that all the code uses map/unmap.
The only thing that map/unmap doesn't do that the old code did, was use
a staging image instead as alternative to a staging buffer for image
uploads.
However, that code is not necessary for anything, so I'm sure we can do
without.
If the memory heap that the GPU uses allows CPU access
(which is the case on basically every integrated GPU, including phones),
we can avoid a staging buffer and write directly into the image memory.
Check for this case and do that automatically.
Unfortunately we need to change the image format we use from
VK_IMAGE_TILING_OPTIMAL to VK_IMAGE_TILING_LINEAR, I haven't found a way
around that yet.
Use the new map/unmap image upload method for Cairo node drawing:
1. map() the memory
2. create an image surface or that memory
3. draw to that image surface
4. success
There's no longer a need for Cairo to allocate image memory.
As an alternative to gsk_vulkan_image_new_from_data() that
takes a given data and creates an image from it, add a 3 step process:
gsk_vulkan_image_new_for_upload()
gsk_vulkan_image_map_memory()
/* put data into memory */
gsk_vulkan_image_unmap_memory()
The benefit of this approach is that it potentially avoids a copy;
instead of creating a buffer to pass and writing the data into it before
then memcpy()ing it into the image, the data can be written straight
into image memory.
So far, only the staging buffer upload is implemented.
There are also no users, those come in the next commit(s).
The GDK_SEAT_CAPABILITY_TABLET_PAD stood awkwardly out of the
ALL value. Even though it's not a keyboard, its focus has more
resemblance to it, so it should be part of this group together
with keyboards.
We were creating the pad device on wp_tablet_pad.done, but
at that time we do not know what tablet it is associated with,
thus we cannot get appropriate vid/pid/name properties for it.
To get that, we need to wait for the pad to enter a surface,
at that time we do know what tablet it is associated with, so
we can get better information about the device.
There are pads that may plausibly "change" tablet between
one .enter event and the next (e.g. Wacom Express Key Remote),
but this situation is highly unlikely. The pad devices created
are thus persistent until that situation happens.
Problem is GtkFileLauncher is unable to handle all the types of URIs
that are supported by gtk_show_uri(), e.g. help: URIs. GtkUriLauncher
avoids this problem.
Another problem is that GtkUriLauncher is just generally a better choice
for launching URIs, since you don't have to create a GFile in order to
use it. Porting code is slightly simpler.
The documentation still mentions both GtkFileLauncher and GtkUriLauncher
as options, but most people will use whatever the compiler recommends
when it prints the deprecation warning.
When the pointer leaves the window surface, gtk_window_capture_motion
will not be called anymore, so priv->resize_cursor may remain non-NULL
indefinitely without this.
If update_cursor is later called (via gtk_window_maybe_update_cursor) on
a virtual enter notify event (e.g. because the pointer entered a
descendant surface), it would previously re-set the window surface
cursor to priv->resize_cursor, which could result in the wrong cursor
shape being shown for descendant surfaces.
This affected mutter-x11-frames, see
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1557.
One could also say that if the pointer leaves the window surface, it's
trivially not over any window edge.
Add an overlay that shows a11y issues.
For now, this checks for:
- abstract roles being used
- elements without labels
- required attributes
- required context
The tooltip text should only be considered after
all other means are exhausted. but it can be used
for both the name and the description.
See https://www.w3.org/TR/accname-1.2/
Implement this sentence from the "Accessible Name
and Description Computation 1.2" spec:
If the root node's role prohibits naming,
return the empty string ("").
See https://www.w3.org/TR/accname-1.2/
When nodes are added, nothing was warning us that we need to bump
N_RENDER_NODES.
Make sure that that's no longer necessary by refactoring the code to
remove the define.
This is more expensive, but it finds more cases, and in particular it
catches corner cases like empty nodes or fully clipped nodes that might
otherwise make the kernel throw signals in our direction.
When the GTK_MEDIA env var is set, check at startup that it works, not
only when the first MediaFile is instantiated.
This has the fortunate side effect that it prints help output for
GTK_MEDIA=help at startup, too.
With the current approach, we get duplicate labels
in the accessible name: _Cancel Cancel. Change things
around to always set the labelled-by accessible relation
if we have a label, and not the label accessible property.
We have to be careful to only use GDK_ALIGN_BASELINE_FILL when
permitted by GDK_VERSION_MAX_ALLOWED because gtkenums.h is a
public header.
Fixes: #5875
I don't think we can avoid conditional compilation here, because the old definition is going to cause deprecated declaration warnings unless you define an old GDK_VERSION_MIN_REQUIRED.
When running the tests, only run the random (and potentially large) size
download test once instead of 10 times.
There's no real benefit in doing that, both because it's unlikely to
fail only in the 2nd or 9th run and because the sizes are picked
randomly.
This also speeds up the test massively as the download test was
dominating the runtime.
Instead of picking a few numbers in advance and running them through the
test gauntlet every time, pick the random numbers at runtime.
This both increases the test coverage in that it ultimately tests more
combinations across many runs and it reduces the runtime of individual
runs because every tun only runs the download tests twice (with 1px and
the random size) instead of 5 times.
And that speedup benefits the CI, where the asan runs would cause this
test to timeout sometimes.
If one of the descriptor sets doesn't have any items, don't include it
in the sets passed to vkUpdateDescriptorSets().
This has no effect right now, because we either have both images and
samplers or neither, but it will become relevant once we also support
buffers.
- 25 chars sounds about right for the texts we use
- don't use min width so we allow shrinking the widget (large text or
small mobile devices)
- ellipsize the text instead of clipping it.
There were 3 different random numbers set to determine the sidebar width
and all of them were wrong. Remove them.
Instead, propagate the natural width of the listitems.
Sometimes, GLX can decide to use the previous request serial when faking
XErrors via __glXSendError() (look through the Mesa sources to enjoy).
This can cause the error trap we just installed to not feel responsible
for the error. And that makes GDK decide to immediately abort the
application.
That is not what we or GLX want.
So we use a no-op X Request to bump the request number so that when GLX
does its shenanigans, it uses a serial that our error trap will catch.
Fixes a crash in mutter's CI which apparently manages to drive GLX
without an X server.
In error cases, glXCreateContextAttribsARB() will always return NULL so
it is enough to run the loop until the first non-NULL context is
returned.
And at that point, we can just look at the return value and ignore all
errors.
Respect the matrix in use at time of encountering a repeat node so that
the offscreen uses roughly the same device pixel density as the target.
Fixes the handling of the clipped-repeat test.
Make it use an alpha value that is well defined, ie 0.4 instead of 0.5.
0.4 * 255 = 102
0.5 * 255 = 127.5
This avoids rounding issues where some math may cause the resulting
alpha value to be 127, and some other math ends up with 128.
We want to always reserve space for the clear icon,
but let the text widget use that space when the icon
isn't shown. A plain box layout can't do that, so
do our own size allocation.
Sometimes the GPU is still busy when the next frame starts (like when
no-vsync benchmarking), so we need to keep all those resources alone and
create new ones.
That's what the render object is for, so we just create another one.
However, when we create too many, we'll starve the CPU. So we'll limit
it. Currently, that limit is at 4, but I've never reached it (I've also
not starved the GPU yet), so that number may want to be set lower/higher
in the future.
Note that this is different from the number of outstanding buffers, as
those are not busy on the GPU but on the compositor, and as such a
buffer may have not finished rendering but have been returend from the
compositor (very busy GPU) or have finished rendering but not been
returned from the compositor (very idle GPU).
The idea here is that we can do more complex combinations and use that
to support texture-scale nodes or use fancy texture formats (suc as
YUV).
I'm not sure this is actually necessary, but for now it gives more
flexibility.
For blend and crossfade nodes, one of the children may exist and
influence the rendering, while the other does not.
Previously, we would skip the node, which would cause the required
rendering to not happen. We now send a valid texture id for the
invalid offscreen, thereby actually rendering the required parts.
Fixes the blend-invisible-child compare test
Current state for compare tests:
Ok: 397
Expected Fail: 0
Fail: 26
Unexpected Pass: 0
Skipped: 2
Timeout: 0
Instead of having a descriptor set per operation, we just have one
descriptor set and bind all our images into it.
Then the shaders get to use an index into the large texture array
instead.
Getting this to work - because it's a Vulkan extension that needs to be
manually enabled, even though it's officially part of Vulkan 1.2 - is
insane.
If we have a rectangular clip without transforms, we can use
scissoring. This works particularly well because it allows intersecting
rounded rectangles with regular rectangles in all cases:
Use the scissor rect for the rectangle and the normal clipping code for
the rounded rectangle.
The idea is to use it for clip nodes when they are integer-aligned.
To do that, we need to track the scissor rect in the parse state, so we
do that, too.
Also move the viewport offset out of the projection matrix, as it is
part of the transform between clip and scissor, so it needs to live in
the offset.
We align the data to a multiple of vertex stride, that way we use more
memory, but we could compute an offset into the vertex buffer without
changing the offset.
We can set the vertex offset while counting the data, this gets rid of
the need of passing all the counting machinery into the actual data
collection code.
When attempting a complex transform, check if the clip can be ignored
and do that if possible.
That way we don't cause fallbacks when transforming the clip is too
complex.
The idea is that for a rectangle intersection, each corner of the
result is either entirely part of one original rectangle or it is
an intersection point.
By detecting those 2 cases and treating them differently, we can
simplify the code to compare rounded rectangles.
Instead of emitting the render commands once per rectangle of the clip
region, just emit them once with the region's extents.
This is generally faster because it emits fewer commands to the GPU,
even though it may touch significantly more pixels.
For a proper method, we'd need to record the commands per clip rectangle
instead of emitting all of them all the time.
The border and color shaders - the ones that do AA - now multiply their
coordinates by the scale factor, which gives them better rounding
capabilities.
This in particular improves the case where they are used in fractional
scaling situations, where the scale is defined at the root element.
Previously, we just used the defaultscale factor, but now that we're
having it available in push constants, we can read it back for creating
offscreens and rendering fallbacks.
So do that.
It's a 1:1 replacement for GskVulkanPushConstants, just without the
indirection through a different file.
GskVulkanPushConstants as a struct is gone now.
The file still exists to handle the push_constants operation.
1. Use a graphene_vec2_t
2. Ensure it's always positive
3. Don't break with fallback
The scale value is nothing more than an indication of how many pixels to
assume per unit of a node.
We don't want to render the offscreen trnsformed, we want to render it
as-is.
We lose the correct scale factor, but that requires some separate work,
so for now it gets a bit blurry on hidpi.
This introduces the rect object and adds a rect_distance() and
rect_coverage() function.
_distance() returns the signed distance tp the rectangle.
_coverage() returns the coverage of a pixel centered at that position.
Note that the pixel size is computed using dFdx/dFdy.
When the node bounds were a non-integer size, the texture would get
ceil()ed pixels, but various viewport or scissor computations might
floor() instead, leaving the right/bottom row of pixels untouched.
Make sure those functions ceil(), too.
Instead of trapping errors for the whole loop trying to create GL
contexts, trap them once per GL context.
Apparently GLX does throw an error when a too high version is requested
and doesn't just return NULL and then that error lingers when we try
lower versions.
Fixes#5857
We may try to update the XRR outputs and Crtcs when they're changing in
the server, and so we may get BadRROutput that we're currently not
handling properly.
As per this, use traps and check whether we got errors, and if we did
let's ignore the current output.
It's not required to call init_randr13() again because if we got errors
it's very likely that there's a change coming that will be notified at
next iteration during which we'll repeat the init actions.
When registering an observer, we send a notification and for that we need
to query the action's state and param type. When setting up a muxer parent,
same thing happens, except the action is queried on the parent instead.
This means that the muxer will notify observers about the parent's actions,
but not about its own.
Add a test to verify it works.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5861
This is not the optimal way of doing it: we're
reuploading the texture with client-side conversion.
But it fits nicely into our current handling of mipmaps.
We can do better once we use shaders for colorspace
conversions.
Add some odd-sized texture sizes to the
download tests, to trigger alignment issues
in the various upload code paths. And add
a size that is bigger than the max-texture-size
we force in one of our test setups.
To compensate, reduce the number of
runs per size from 20 to 10.
For non-gles, make it handle unpremultiplied formats,
and everything else, by downloading the texture in its
preferred format and, in most cases, doing a
gdk_memory_convert afterwards.
For gles, keep using glReadPixels, but handle cases
where the gl read format doesn't match the texture
format by doing the necessary swizzling before calling
gdk_memory_convert.
Make the callers of this function check for
straight alpha themselves, and only do the
version compatibility check here. This makes
the function usable in contexts where straight
alpha is acceptable.
Use &__ImageBase for the GTK DLL and GetModuleHandle (NULL)
for the application module. Then remove DllMain as it's not
necessary anymore.
References:
[1] Accessing the current module's HINSTANCE from a static library:
https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
The display xevent signal connection takes the ownership of the stream
until we get a valid event, so it should manage the stream lifetime.
So make this clearer, by automatically removing the stream reference
when we disconnect from the xevent signal handler.
We create a new stream during gdk_x11_selection_input_stream_new_async()
then such stream is referenced when passed to the task via
g_task_return_pointer(), so there's no need to reference it again before
returning it, or we'd end up leaking.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4892
The GL renderers like to premultiply content that isn't, and due to the
data loss with alpha == 0 (transparent white, transparent black and
transparent anything are all represented by (0, 0, 0, 0) when
premultiplied) these values cannot be converted back.
There is no longer a need to use gdk_texture_download() and force
conversion to ARGB8 format. We can download the pixels in the original
format again.
That way we avoid testing the conversion code and avoid having to deal
with differences in representable colors.
However, some formats do do conversions, so we allow pixel comparisons
to be accurate (requires 16bit comparison accuracy) or inaccurate (we
only care about 8bit).
Note that for the default RGBA formats, this is identical and means they
need to be bit-exact the same, no matter what.
But the higher bit depth formats may be more different - floating point
can even have different values with high accuracy (the float mantissa is
23 bit, we only care about 16).
The groups hash table is initialized lazily when inserting
the first GActionGroup (gtk_action_muxer_insert ()). Do as
all surrounding code does and check for NULL before using
groups.
This avoids triggering a warning
When we emit items-changed due to a section
sorter change, don't also emit sections-changed.
Instead make the items-changed signal cover the
whole range.
Tests included.
When the section sorter changes, we need to update
the keys, otherwise the sorter will continue to report
the old sections.
This code is currently a bit suboptimal, since the
creation of sort keys and section sort keys are
muddled together.
Fixes: #5854
When the section sorter changes, we need to update
the keys, otherwise the sorter will continue to report
the old sections.
This code is currently a bit suboptimal, since the
creation of sort keys and section sort keys are
muddled together.
Fixes: #5854
And recreate header and footer tiles as needed.
This commit was tested using a sortlistmodel, changing
the section sorter from sorting only by first char
to sorting by the first two chars, which changes
the number of sections, but leaves the alphabetic
order of items unchanged.
Without this, there are still GdkMonitors present for displays that are
present but disconnected (such as when a laptop disables the internal
display to connect to an external monitor).
XWayland (at least on gnome-shell) does not support SGI_swap_control,
which we were using to unset the swap interval.
It does support EXT_swap_control though, which is the more modern
version of the same thing, so this commit adds support for that.
And now GDK_DEBUG=no-vsync gives me >1000fps instead of just 60fps,
With XWayland and direct scanout it is possible that some apps get into
a situation where more than 2 buffers are in flight and in that case we
want to be able to still track the change regions for those buffers.
Usually 3 buffers are in use, so we go one higher, just to be safe.
Some mice send a value slightly lower than 120 for some detents. The
current approach waits until a value of 120 is reached before sending a
low-resolution scroll event.
For example, the MX Master 3 sends a value of 112 in some detents:
detent detent
| | |
^ ^ ^
112 REL_WHEEL 224
As illustrated, only one event was sent but two were expected. However,
sending the low-resolution scroll event in the middle plus the existing
heuristics to reset the accumulator solve this issue:
detent detent
| | |
^ ^ ^ ^
REL_WHEEL 112 REL_WHEEL 224
Send low-resolution scroll events in the middle of the detent to solve
this problem.
Related to https://gitlab.gnome.org/GNOME/mutter/-/issues/2469
We are using placeholders in the 'check' column
that are put in a size group, so that they all
take the same space once a check or radio is shown.
Unfortunately, for the inline-buttons option, we
were using a GtkBuiltinIcon as placeholder, and those
respect the -gtk-icon-size CSS property and take
a minimum size of 16px. Use a GtkGizmo instead to
get the expected result of no extra padding unless
there's a check or radio.
Fixes: #5839
The non-portal fallback method for launching a file manager to show the
file in its parent directory was incorrectly using the `ShowFolders`
method (open a folder) instead of `ShowItems` (open the parent directory
and show the file).
The `show_item` function (previously `show_folder`) had an unused
`callback` parameter; it has been removed and the type of the parameter
containing the GTask has been renamed and now uses the correct type
instead of gpointer to reduce the amount of casting required.
FixesGNOME/gtk#5842
The want to use the footer tile at the end
to fill leftover space at the bottome right.
So lets assert that we actually dealing with
a footer tile, just in case something changes
in the future that might have us end up with
some other kind of tile.
This reverts commit e121a5ca6f.
The tile that was causing the critical in #5836
(what that commit was about) was a FILLER, and we
are getting rid of FILLER tiles here. Which will
avoid the issue in a more elegant way.
In height-for-width and hscrollbar-policy = never, we can provide
the child with a proper for_size when measuring it. The same is true for
width-for-height and vscrollbar-policy = never.
This allows for accurately measuring the size of eg. wrapping labels.
The cancellation path already clears the GCancellable, if we let it
continue, it causes a later assertion, so just exit early in this case
and hope a new path has been set.
Fixes: #5792
When the command queue is out of batches, there is
no point in doing further work like allocating uniforms.
This helps us avoid assertions in the uniform code
that we would hit when we run out of uniform space
too.
Commit 3090795351 accidentally caused all
CI builds (or at least the ones with -Werror) to no longer build tests,
examples and demos, so none of them had made sure that they compile.
When we start ignoring batches, we must do it everywhere,
or we may run into assertions. This was triggered by an
enormous text node tree produced by tests/rendernode-create.
The documentation says that the model returned by
gtk_notebook_get_pages() implements the GtkSelectionModel interface, but
checking the history confirms this is a lie.
Instead of fixing the documentation, we can easily make it true, and
reduce the differences between GtkNotebook and GtkStack.
Fixes: #5837
If there is a value passed to GSK_RENDERER, display it in the window
title.
This is mostly so that when I show off screenshots, people know what
renderer I'm using.
Vulkan has a different initial coordinate system to GL.
GL:
(-1, 1, -1) +------+.
|`. | `.
| `·--|---·
| : | :
+------+. :
`. : `.:
`·------· (1, -1, 1)
Vulkan:
(-1, -1, 0) +------+.
|`. | `.
| `·--|---·
| : | :
+------+. :
`. : `.:
`·------· (1, 1, 1)
so adjust the near and far plane we pass to
graphene_matrix_init_ortho() to make it end up with the same
projection as the GL renderer.
This one tests a crossfade between two non-overlapping nodes with a clip
region that covers neither of the two nodes.
This tests that renderers can deal with clip regions that doesn't
overlap nodes in a situation where they will most likely want to create
an offscreen.
As offscreens are typically clipped to the clip region, this would cause
an empty offscreen and that can cause failures.
This was an experiment where an offscreen was translated inside an
existing clip.
Because renderers try to limit offscreens to the clip rect, this is
interesting, because they might get the translation wrong.
Using gdk_texture_new_from_resource() is not valid here because we are
not sure if the given resource is valid.
Plus, the previous optimization is no longer relevant, because we are
not using gdk_pixbuf_new_from_resource() anymore - which was what this
optimization was about before it was ported to GdkTexture.
Test attached.
The filesystemmodel tracks changes and additions to child files
through G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED. This event will also
occur if the parent directory is changed. Since the parent directory
doesn't exist in the model, it creates a non-existent item.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4233
Make unexport_handle take the handle, which will
let us deal with multiple exports in the future.
Update all callers to store their handle, and
pass it to unexport_handle.
The actions document ended with a : where there used to be a period,
seemingly a bug in the conversion from XML. Replace that : with a
period, and remove another spurious : inserted during the conversion.
Add some tests for handling of failures.
The test data here is taking from gdk-pixbufs
tests/test-images/fail directory, excluding anything
but png, tiff and jpg images.
Strangely, the document's last sentence ended with a colon,
giving the impression there's missing text that should follow.
There is not.
Even more strange, it's _always_ ended with a colon,
ever since the file was converted from XML
(in commit 10cd539104).
BUT, the XML file it was converted _from_ ended that same sentence
with a period! I have no idea where the colon came from.
gtk_css_provider_load_from_data has turned out
to be problematic for language bindings. Add two
new variants, from_string and from_bytes, to
replace it.
This partially reverts commit 93a875bf20.
Removing this annotation broke bindings, which now treat the
length of the array as a standalone parameter.
This broke Spiel, and probably other non-C apps that rely on
GtkCssProvider through bindings.
gtk and gdk have their own marshallers, for historic
reasons. But there's no reason to duplicate the same
code here.
Eventually, we should just move all marshallers to
the same place.
Make all length values from 0px to 8px available
as static values. This will help with cutting
down on the number of corner values (we have a
lot of 5px corners).
The fedora-x86-64 build does not only build with debug,
it also does the hello build, and it runs the testsuite
multiple times.
Move the hello build to the fedora release build. The idea
is that this lets us do more work in parallel, and spend
less time waiting for the longest-running ci job.
We are ignoring failures here, and nobody is working
on fixing them. And the failures end up at the end
of the log, adding annoyance to finding the actual
failures.
We only have one reference to the surface,
and it is dropped by gdk_surface_destroy.
All the users of surfaces in gtk had the same
bug: they were all stealing an extra reference
to drop - the one that the renderer was leaking
until recently.
This was the intention, but the object data by itself
does not achieve that: We do run dispose on the display
when it is closed, but object data is only cleared in
finalize. So listen to the ::closed signal and remove
the driver ourselves.
Fix up the drivers dispose implementation enough for
that to actually work.
Public headers should mainly include gdktypes.h, which already include
the symbol visibility and versioning macros; we can also modify
gdktypes.h to include the enumerations.
Since the corresponding source files do not include "config.h", and are
not compiled with `GTK_COMPILATION`, they will generate the wrong symbol
exporting under Windows.
Instead of injecting `-fvisibility=hidden` depending on a compiler check
ourselves, let Meson do it for us.
This also avoids us having to filter `-fvisibility=hidden` when reusing
the common compiler flags.
Fix the circular dependency by moving the generated
headers to gdk/version/, and build that directory
first.
Misc other fixes, such as putting the custom targets
as sources, not depedencies, and using the correct
major version in the generator script.
Let's poach the same script used by GLib to avoid having to add all the
version macros by hand every time we increment the GTK version.
This is a work in progress:
- need to rename the GLIB_STATIC_COMPILATION check
- circular dependency: libgtkcss depends on gdkversionmacros.h, but libgdk
depends on libgtkcss
The inertness concept introduced in 62e9d1e470 assumed a listview was
inert when no factory was set. This has 2 problems:
1. columnview uses a listview without factories.
2. header factory being set but factory not being set technically makes
the listiew inert - but should it?
So for now, make inertness only depend on visibility and root.
A side benefit is that this matches columnview semantics.
When ensuring widgets, ensure that their section is known. This will
be relevant when we use section widgets.
Also ensure that sections that don't cover any widget get destroyed.
The get_section() implementation is a slow and steady implementation
that has to be careful to not screw up when an incremental sort is only
partially sorted.
When GDK_DEBUG=no-vsync is on, we might have more than one outstanding
frame. Don't assert when that hapens. Just request a frame callback for
the first and skip the others.
Not all frames get timing info with GDK_DEBUG=no-vsync, so make sure
that even when we render tons of frames, the one frame that does get
timing info is still there when the timing info arrives.
I set it to 128 from 16 now.
This is roughly good enough to go to 5000fps from on a 60Hz monitor.
...when we are using wglChoosePixelFormatARHB(). This ensures that we
hvae a HDC with a pixel format that will really support alpha bits, as
we did for the traditional ChoosePixelFormat().
Thanks to Patrick Zacharias for testing and pointing things out.
We were sending random junk to ChoosePixelFormat().
Also assert that we don't overflow the array. That might be usefu to
know if we carelessly add attributes later.
... for creating the actual WGL contexts, so that we can cut down on the
number of times where we need to create the base, legacy WGL contexts in
order to create the WGL contexts with attributes. We could just use the
dummy context that we have to make it current to create the needed
WGL contexts.
If we are querying the best supported pixel format for our HDC via
wglChoosePixelFormatARB() (i.e. we have the WGL_ARB_pixel_format extension),
it may return a pixel format that is different from the pixel format that we
used for the dummy context that we have setup, in order to, well, run
wglChoosePixelFormatARB(), which sadly requires a WGL context (HGLRC) to be
current in order to use it, which means the dummy HDC already has a pixel
format that has been set (notice that each HDC is only allowed to have its
pixel format to be set *once*). This is notably the case on Intel display
drivers.
Since we are emulating surfaceless GL contexts, we are using the dummy GL
context (and thus dummy HDC that is derived from the notification HWND used in
GdkWin32Display) for doing that, we would get into trouble if th actual HDC
from the GdkWin32Surface has a different pixel format set.
So, as a result, in order to fix this situation, we do the following:
* Create yet another dummy HWND in order to grab the HDC to query for the
capabilities the GL drivers support, and to call wglChoosePixelFormatARB() as
appropriate (or ChoosePixelFormat()) for the final pixel format that we use.
* Ditch the dummy GL context, HDC and HWND after obtaining the pixel format.
* Then set the final pixel format that we obtained onto the HDC that is derived
from the HWND used in GdkWin32Display for notifications, which will become our
new dummy HDC.
* Create a new dummy HGLRC for use with the new dummy HDC to emulate surfaceless
GL support.
We are currently using g_clear_pointer() on the intermediate WGL contexts
(HGLRC)'s that we need to create in the way, which means that we need to ensure
that the correct calling convention for wglDeleteContext() is being applied.
To be absolutely safe about it, use the gdk_win32_private_wglDeleteContext()
calls, which will in turn call wglDeleteContext() directly from opengl32.dll
(using the OpenGL headers from the Windows SDK) instead of going via libepoxy,
which will assure us that the correct calling convention is applied.
Fixes issue #5808.
Our notify tests would fall over if there was
a duplicate enum value (within the first 10 values).
Make it handle that, by skipping the duplicate value.
It turns out that the old behavior of GTK_ALIGN_BASELINE
was actually used in libadwaita, so bring it back, and
introduce a new GtkAlign value for the new behavior.
Allow control-clicks on some fields to bring up
a more specific UI. This functionality is also
available via Ctrl-E and the context menu.
At this point, it can edit colors, fonts and
files in some places, as well as a few enums.
This is failing because I can't figure out
how to make wireplumber and pipewire work
in ci enough to let me add a new monitor :(
As usual, the test works fine locally.
Add some input tests that are using headless
mutter, and python with our in-tree gir files.
So far, test that we can roundtrip key events,
and move the pointer around.
Add some monitor tests that are using headless
mutter, and python with our in-tree gir files.
So far, we test that we get expected signals
when monitors are added and removed.
Transition to the color that is in use instead.
Fixes crashes because currentColor is not an RGBA color and
therefor could not be queried later.
Fixes#5798
Most of the time we want to compute them based on the child node we
render to the offscreen, but not always.
For blend and cross-fade nodes, they need to be computed based on the
node's bounds.
Fixes widget-factory page fade animation weirdly resizing the fading
pages.
We weren't looking in the build dir for generated files.
Actually make sure that we look in the build dir *first*, otherwise
glib-compile-resources will still use the wrong files.
... and use it in rendernodes.
Setting up textures for diffing is done via gdk_texture_set_diff() which
should only be used during texture construction.
Note that the pointers to next/previous are allowed to dangle if one of
the textures is finalized, but that's fine because we always check both
textures' links to each other before we consider the pointer valid.
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
@@ -68,7 +68,7 @@ in a selector, widget names must be prefixed with a # character.
| E:focus-within | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on all ancestors of the focus widget, unlike CSS |
| E:focus-visible | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#focus-within-pseudo) | Set on focus widget and all ancestors, unlike CSS |
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include<gdk/gdkversionmacros.h>
#include<gdk/gdktypes.h>
#include<gdk/gdkdevicetool.h>
#include<gdk/gdkenums.h>
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.