Commit Graph

80230 Commits

Author SHA1 Message Date
Matthias Clasen
8846f85874 css provider: Set bytes on sections
Pass the bytes we're parsing to the sections, and keep a pointer
to them around, so we can compare them in the has_section
implementation.

This commit also corrects some of the location information that
we add into the section for variables to be more accurate.
2024-05-10 18:29:47 +04:00
Matthias Clasen
fc1c6cfb1a css parser: Add gtk_css_parser_get_bytes
Gets the bytes that the parser is operating on.
2024-05-10 18:29:47 +04:00
Matthias Clasen
77028362ab css provider: Set sections on all variable values
We were doing it in one case, but forgetting it in another.
These sections are necessary to report meaningful error locations
when parsing property values at compute time.
2024-05-10 18:29:47 +04:00
Matthias Clasen
496aee5b02 style cascade: Propagate errors
When we compute values, the provider we use ends up being the
style cascade. If we hit a parser error when parsing variable-bearing
property values at compute time, we emit the error on that provider.

By making the cascade propagate the error back to the proper css
provider that contains the section in question, we get it reported
back to the css editor in the inspector.
2024-05-10 18:29:47 +04:00
Matthias Clasen
b2fb624496 style provider: Add a has_section api
Add gtk_style_provider_has_section and implement it for
GtkCssProvider. This will be used later to direct error
emissions to the right provider.
2024-05-10 18:29:47 +04:00
Matthias Clasen
f2ef5d85ea css parser: Add bytes to sections
We will use this later to link sections back to the providers
they come from.
2024-05-10 18:29:47 +04:00
Matthias Clasen
7eca32edf0 css parser: Add gtk_css_parser_skip_whitespace
Does what it says.
2024-05-10 18:29:47 +04:00
Matthias Clasen
7775bcf2fb css: Don't accept junk
Check that there is no junk at the end of the property value
when parsing variable-bearing properties at compute time.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
ed35f6f8b8 css: Condense compute parameters into GtkCssComputeContext
That list is getting out of hand, let's make it a struct.
2024-05-10 18:29:47 +04:00
Matthias Clasen
307942e1f7 css: Only compute shorthand values once
When computing a style, only compute the shorthand value once.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
92b7231168 csskeyframes: Support variables 2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
14d7eb97d2 cssanimation: Recompute values while playing
This will be necessary for supporting variables in animations.

For this we need to pass all the gtk_css_value_compute() parameters into
GtkCssAnimatedStyle: parent style and provider.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
fed1c3d3fc cssstaticstyle: Split property lists into a separate header
We'll need to use them in GtkCssAnimatedStyle too.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
e1ac97a185 cssvalue: Pass an extra GtkCssVariableSet to compute()
We'll need this to support variables in @keyframes, since styles will
need to combine their own variables and the ones from the keyframes.

See the next commit, this one is split out to avoid a huge diff.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
08a48dd97e Implement basic support for CSS variables 2024-05-10 18:29:47 +04:00
Matthias Clasen
50df3ebb46 css: Give shorthand properties an ID
This will be used in future commits.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
df77f22740 cssvalue: Add contains_variables()
We'll need this to know which values to recompute for animations.

It will be used in the next commit, it's separate to avoid the diff
being too large.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
2437a551ec csstokenizer: Add save() and restore()
We'll need that to check if property values contain variables.
2024-05-10 18:29:47 +04:00
Alice Mikhaylenko
46ab71fc8a cssprovider: Copy bytes when loading
We'll need to keep accessing them later to compute values with variables,
so we can't avoid this anymore.
2024-05-10 18:29:47 +04:00
Matthias Clasen
f922ff8597 Merge branch 'speed-up-cairo-icons' into 'main'
gsk: Speed up mask nodes with cairo

Closes #6700

See merge request GNOME/gtk!7243
2024-05-10 14:10:18 +00:00
Matthias Clasen
690c06109e gsk: Speed up mask nodes with cairo
Switch symbolc icon drawing from color-matrix to mask nodes
make the performance of the iconscroll demo crater (from 60fps
to 10fps).

Apply the same optimization we already have for color-matrix
nodes when drawing mask nodes. This gets us back to 60fps.

Fixes: #6700
2024-05-10 07:24:25 -04:00
Matthias Clasen
94505987fe Merge branch 'matthiasc/for-main' into 'main'
css parser: Fix a typo

See merge request GNOME/gtk!7241
2024-05-10 04:11:08 +00:00
Matthias Clasen
c6d7b704cb css parser: Fix a typo
Due to an ARAY vs ARRAY mishap, we weren't actually preallocating
any blocks. Fix that, and reduce the number of preallocated blocks
to 12. That seems sufficient, since parsing the Default theme never
needs more than 5 blocks.
2024-05-09 23:26:55 -04:00
Hugo Carvalho
349509c332 Update Portuguese translation
(cherry picked from commit 40e99590e7)
2024-05-09 16:01:52 +00:00
Matthias Clasen
84fd420271 Merge branch '6674_fix_flickering_tooltip' into 'main'
tooltip: query tooltip on widget under pointer only

Closes #6674

See merge request GNOME/gtk!7237
2024-05-08 00:43:05 +00:00
Matthias Clasen
0c40defaf1 Merge branch 'realize_accessible_before_add_event_emission' into 'main'
a11y: Realize the AT context before firing a children added event for it

See merge request GNOME/gtk!7229
2024-05-08 00:42:33 +00:00
Matthias Clasen
cda1733fc7 Merge branch 'css-parser-block-array' into 'main'
css parser: Use a GdkArray for blocks

See merge request GNOME/gtk!7236
2024-05-07 23:15:31 +00:00
Matthias Clasen
0ee851c8c7 Merge branch 'matthiasc/for-main' into 'main'
icontheme: Clarify docs a bit

See merge request GNOME/gtk!7234
2024-05-07 18:57:24 +00:00
g.willems
d665274eb1 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
2024-05-07 19:32:15 +02:00
Matthias Clasen
ed3b73871f css parser: Small optimization
Avoid creating a GFile until it is needed.
2024-05-07 12:34:37 -04:00
Matthias Clasen
e570eb4f86 css parser: Use a GdkArray for blocks
This avoids some allocations, and is typesafe.
2024-05-07 12:34:36 -04:00
Lukáš Tyrychtr
81b6251073 a11y: Realize the AT context before firing a children added event for it
This allows, with some other changes, AdwToasts to be read on appearance by Orca.
2024-05-07 15:49:59 +02:00
Matthias Clasen
cfaf619620 icontheme: Clarify docs a bit
Mention that 'desired size' is in application pixels.

Related: !7056
2024-05-06 20:37:34 -04:00
Benjamin Otte
de5b6764bc Merge branch 'wip/otte/for-6694' into 'main'
dmabuf: Ref previous context

Closes #6694

See merge request GNOME/gtk!7232
2024-05-06 22:56:05 +00:00
Benjamin Otte
bc17dfa83d dmabuf: Ref previous context
In case the context's only reference was held by being the current
context, setting the new context would free it.

Resetting it later would then be a use-after-free.

Fixes #6694
2024-05-07 00:34:47 +02:00
Matthias Clasen
84a98f74c1 Merge branch 'fix-test-breakage' into 'main'
Fix recent test breakage

See merge request GNOME/gtk!7233
2024-05-06 21:56:13 +00:00
Matthias Clasen
50facedc47 Fix recent test breakage
I neglected to fix affected tests in 76b0687467, since
ci was down at the time. Sorry about that.
2024-05-06 17:11:44 -04:00
Matthias Clasen
200cacc3ad Merge branch 'matthiasc/for-main' into 'main'
inspector: Show more key event details

See merge request GNOME/gtk!7224
2024-05-05 17:29:29 +00:00
Matthias Clasen
eed3cab29f Merge branch 'list-item-factory-docs' into 'main'
docs: Clarify types for BuilderListItemFactory

See merge request GNOME/gtk!7226
2024-05-05 15:00:49 +00:00
Matthias Clasen
76b0687467 Put newlines before base64 blobs
This makes things look a bit cleaner in the node editor, since
the first line no longer sticks out.
2024-05-05 10:16:01 -04:00
Matthias Clasen
5039dc40f8 Merge branch 'main' into 'main'
vulkan: Don't queue presentation if image acquisition fails

See merge request GNOME/gtk!7204
2024-05-05 04:06:44 +00:00
Doğukan Korkmaztürk
7c3de4a2da vulkan: Recreate swapchain when it is necessary or beneficial
Currently, GTK does not check the result of vkAcquireNextImageKHR() and
assumes that it always succeeds. As a result, the vkQueuePresentKHR() is
unconditionally set to wait for the semaphore passed to
vkAcquireNextImageKHR() earlier.

However, if vkAcquireNextImageKHR() fails for some reason, the semaphore
passed to it does not get signalled. This causes the presentation
command to wait for the semaphore to be signalled indefinitely, which
causes GTK to hang.

This change adds error handling around vkAcquireNextImageKHR() to make
GTK recreate the Vulkan swapchain when it is necessary or beneficial and
helps avoiding situations that could cause indefinite waits.
2024-05-04 22:14:33 -04:00
Matthias Clasen
b486e9b760 inspector: Show more key event details
Consumed modifiers are relevant to understanding why shortcut
do or do not match, so show them.
2024-05-04 21:29:40 -04:00
Matthias Clasen
ce2fd8a0d0 NEWS: Updates 2024-05-04 21:29:40 -04:00
Hugo Carvalho
99b1b26fdb Update Portuguese translation
(cherry picked from commit a249b58094)
2024-05-04 22:23:06 +00:00
James Westman
b7e4bbaf74 docs: Clarify types for BuilderListItemFactory
The docs for GtkBuilderListItemFactory previously stated that the
template must extend GtkListItem. However, this is not always true.
GtkListView has headers which must extend GtkListHeader, and
GtkColumnView has its own types.

Clarified this in the GtkBuilderListItemFactory docs, and specified the
expected types in the GtkColumnView, GtkListView, and GtkGridView docs.
2024-05-04 13:20:41 -05:00
Matthias Clasen
f579b171a9 Merge branch 'gbsneto/more-win32-cleanups' into 'main'
Various cleanups around Win32

See merge request GNOME/gtk!7223
2024-05-03 17:27:05 +00:00
Georges Basile Stavracas Neto
f9929d15eb gtk-demo: Remove set-but-unused variable 2024-05-03 12:30:39 -03:00
Georges Basile Stavracas Neto
c45a6ad52d gsk/gpu: Use G_GSIZE_FORMAT for printing gsizes
On Windows, gsize is a long long unsigned. The compiler complains about
that.

Use G_GSIZE_FORMAT which translates to %llu on Windows, %lu on most
platforms, and sometimes just %u on rare cases.
2024-05-03 12:30:39 -03:00
Matthias Clasen
7233e38aa8 Merge branch 'gbsneto/cleanup-meson-profiler' into 'main'
testsuite: Remove leftover code from meson.build

See merge request GNOME/gtk!7222
2024-05-03 13:44:07 +00:00