Matthias Clasen
297de981c4
css: Update docs slightly
...
Add more details about units and calc(), mention new color
syntax and deprecations.
2024-05-21 17:11:30 -04:00
Matthias Clasen
53beb054b6
Merge branch 'wip/alice/colors' into 'main'
...
csscolorvalue: Actually discard invalid rgb() colors
See merge request GNOME/gtk!7282
2024-05-21 19:31:31 +00:00
Matthias Clasen
0431492284
Merge branch 'wip/alice/spinner' into 'main'
...
spinner: Only set :checked state when mapped
See merge request GNOME/gtk!7280
2024-05-21 18:54:17 +00:00
Alice Mikhaylenko
aed9cc1874
csscolorvalue: Actually discard invalid rgb() colors
2024-05-21 22:25:20 +04:00
Alice Mikhaylenko
c15804d124
spinner: Only set :checked state when mapped
...
Avoid doing the animation while it's invisible.
See https://gitlab.gnome.org/GNOME/gtk/-/issues/1025
2024-05-21 19:33:52 +04:00
Matthias Clasen
1bd208d937
Merge branch 'wip/alice/colors' into 'main'
...
Add modern rgb() and hsl() syntax
See merge request GNOME/gtk!7278
2024-05-21 14:50:08 +00:00
Alice Mikhaylenko
b70bcd6bfe
csscolorvalue: Add modern rgb() and hsl() syntax
...
Make calc() work in colors too, since we need to support degrees for hsl()
hue anyway and it goes through the same machinery. Make that work for
legacy syntax too, matching the spec.
Ignore missing components/none for now.
Ignore gdk_rgba_parser_parse(), that's also used outside css.
2024-05-21 16:32:52 +04:00
Alice Mikhaylenko
74a1d45238
cssnumbervalue: Add get_canonical()
...
We'll need it to get angle values in degrees for color parsing.
2024-05-21 16:31:26 +04:00
Alice Mikhaylenko
3ada35460d
doc: Mention the rad unit
...
It was missing.
2024-05-21 16:31:26 +04:00
Matthias Clasen
1f133c3d64
Merge branch 'css-color-deprecations' into 'main'
...
Add gtk_css_parser_warn_deprecated
See merge request GNOME/gtk!7270
2024-05-21 10:57:12 +00:00
Matthias Clasen
4440ce874e
Merge branch 'nieldsg/font-filter' into 'main'
...
gtk: Introduce private GtkFontFilter helper
See merge request GNOME/gtk!7262
2024-05-21 01:22:38 +00:00
Matthias Clasen
db302df82a
Merge branch 'fix-a-css-crash' into 'main'
...
Fix an oversight
See merge request GNOME/gtk!7276
2024-05-21 00:58:02 +00:00
Matthias Clasen
b550b58e8f
Merge branch 'css-var-speedup' into 'main'
...
css: Speed up checking for var()
See merge request GNOME/gtk!7274
2024-05-21 00:57:47 +00:00
Matthias Clasen
ed889b951b
css: Deprecate named colors
...
Warn for uses of @name colors, since these should be replaced with
CSS variables and custom properties. We don't issue deprecation
warnings for @define-color uses, since we may want to keep these
around in theme CSS for a while, for backwards compatibility.
Update all affected tests.
2024-05-20 16:19:30 -04:00
Matthias Clasen
b603479fe2
Add a debug flag for CSS deprecations
...
It seems better not to spam everybody with this all the time.
2024-05-20 16:02:38 -04:00
Matthias Clasen
7c39b2cea3
Add gtk_css_parser_warn_deprecated
...
This will come in handy when we start deprecating our homegrown
CSS extensions.
2024-05-20 16:02:38 -04:00
Matthias Clasen
b1bce7a62b
Fix an oversight
...
GtkCssVariableValues are not GtkCssValues. Oops.
2024-05-20 16:02:38 -04:00
Matthias Clasen
fa73e17fba
Fix an oversight
...
GtkCssVariableValues are not GtkCssValues. Oops.
2024-05-20 15:56:40 -04:00
Matthias Clasen
dee2150a04
css: Speed up checking for var()
...
gtk_css_parser_has_references is meant to be a quick check for
whether a property value contains a variable reference, it just
returns a boolean and doesn't need to report any errors, so lets
not parse the property value any more than we need to.
2024-05-20 13:56:52 -04:00
Matthias Clasen
f647fc3fe2
Merge branch 'css-animation-optimization' into 'main'
...
css: Avoid more recomputation during animation
See merge request GNOME/gtk!7273
2024-05-20 17:06:10 +00:00
Matthias Clasen
6bae80c331
css: Avoid more recomputation during animation
...
Don't trigger recomputation if the values didn't change. We only
do this for custom values, since those are animated with a flip
at 50%, so it is likely that we see no-change updates.
2024-05-20 11:59:46 -04:00
Matthias Clasen
2aeb80f490
Merge branch 'ccs-math' into 'main'
...
css: Implement math functions
See merge request GNOME/gtk!7249
2024-05-20 14:40:48 +00:00
Matthias Clasen
8a2f434443
Merge branch 'css-animation-optimization' into 'main'
...
css: Less recomputation in animation
See merge request GNOME/gtk!7263
2024-05-20 14:26:18 +00:00
Matthias Clasen
d4134430fc
Merge branch 'matthiasc/for-main' into 'main'
...
css: Avoid a possible memory leak
See merge request GNOME/gtk!7272
2024-05-20 13:49:53 +00:00
Matthias Clasen
73f64971c8
css: Avoid a possible memory leak
...
Currently, style->variables is always NULL when we get here, but
better to be safe than sorry, and clear the fields before we
overwrite it.
2024-05-20 08:57:28 -04:00
Matthias Clasen
ecc2c953e5
css: Avoid more recomputation
...
Pass a reason into gtk_css_animated_style_recompute, and avoid
recomputing properties that aren't affected. The possible reasons
for now are that variables of color changes. Better tracking
for currentColor in properties will allow us to improve this
later.
2024-05-20 08:48:20 -04:00
Matthias Clasen
e353117937
css: Make animation recomputation more efficient
...
Use the same shorthand-keeping trick we do when computing
static styles.
2024-05-20 08:27:47 -04:00
Matthias Clasen
492ae6df35
css: Less recomputation in animation
...
Only recompute the animated style once all the custom variables
have been updated.
2024-05-20 08:27:47 -04:00
Matthias Clasen
a19d0471e9
Merge branch 'css-var-syntax-errors' into 'main'
...
css: Report some var() syntax errors
See merge request GNOME/gtk!7264
2024-05-20 12:21:18 +00:00
Matthias Clasen
5b5ba36999
Merge branch 'matthiasc/for-main' into 'main'
...
css: Add some more variables tests
See merge request GNOME/gtk!7268
2024-05-20 10:21:21 +00:00
Balázs Úr
89b64cbf47
Update Hungarian translation
2024-05-19 23:47:50 +00:00
Matthias Clasen
e65d1f2122
Cosmetics
2024-05-19 18:57:24 -04:00
Matthias Clasen
2756496d47
css: Cosmetics
...
Don't set the same field twice.
2024-05-19 18:04:20 -04:00
Matthias Clasen
8b653f21cc
Drop more underscores
...
Drop the remaining _'s from css number value apis.
2024-05-19 17:27:37 -04:00
Matthias Clasen
4e6759a126
css: Implement math functions
...
Implement the functions described in the "Mathematical
Expressions" section of the "CSS Values and Units Module
Level 4" spec, https://www.w3.org/TR/css-values-4/ .
Beyond calc(), which we already had, this includes
min(), max(), clamp(),
round(), rem(), mod(),
sin(), cos(), tan(), asin(), acos(), atan(), atan2(),
pow(), sqrt(), hypot(), log(), exp(),
abs(), sign(),
e, pi, infinity and NaN.
Some tests included.
2024-05-19 17:27:37 -04:00
Matthias Clasen
d20e0b0370
Merge branch 'gtk-4-macos-dock-quit' into 'main'
...
[GTK 4] macOS: Dock "Quit" invokes "app.quit" action
See merge request GNOME/gtk!7265
2024-05-19 21:06:11 +00:00
Mat
ed8255993f
gdkmacossurface: Set surface before accessing it
...
Silences the following critial:
_gdk_macos_surface_update_fullscreen_state: assertion
'GDK_IS_MACOS_SURFACE (self)' failed
2024-05-19 23:58:35 +03:00
Matthias Clasen
f5d69fa0c5
css: Add some more variables tests
...
Add a test mixing color expressions with variables, and
empty fallback values.
2024-05-19 16:39:02 -04:00
Mat
e1431f31c1
macos: Take shadows into account when positioning popups
...
Otherwise popups will be misaligned. This becomes noticeable when larger
shadows are used, like in libadwaita.
Regression in 08216dcee9
2024-05-19 23:35:18 +03:00
Thomas Holder
f191fc0047
macOS: Dock "Quit" invokes "app.quit" action
...
Allows the application to handle "Dock icon > Quit" the same as
"Application menu > Quit".
Requires GtkApplication's `register-session` property.
Suitable replacement for gtk-mac-integration's
`NSApplicationBlockTermination` signal.
2024-05-19 23:10:31 +03:00
Matthias Clasen
b60c60f03b
css: Report some var() syntax errors
...
Detect cases such as var(), var(-), var("a") or var(21) early
and report them as syntax errors.
Test included.
Related: #6715
2024-05-19 15:56:26 -04:00
Matthias Clasen
af0c277bba
Merge branch 'matthiasc/for-main' into 'main'
...
css: Lose more underscores
See merge request GNOME/gtk!7261
2024-05-19 05:14:05 +00:00
Niels De Graef
88203fbf4d
gtk: Introduce private GtkFontFilter helper
...
Extract the "user filter" code from the `GtkFontChooserWidget`, for a
couple of reasons:
* If we want to expand the filter in the future (e.g. to filter on
variable fonts, or check for multiple languages), we have a nice place
to put this.
* It simplifies the font chooser widget a tiny bit, as it's a pretty big
file which can be hard to follow.
* With a custom `GtkFilter` subclass, we can actually avoid doing a bit
of work when initially showing the widget, as we can return
`GTK_FILTER_MATCH_ALL` when nothing is selected yet (which is not
possible with a `GtkCustomFilter'). It's not much, but it's still nice
2024-05-18 15:34:13 +02:00
Matthias Clasen
970c9eef63
css: Use an anonymous union for color values
...
We already do this for number values, and it looks less messy.
2024-05-18 09:23:40 -04:00
Matthias Clasen
2439876bd3
css: Simplify color resolving a bit
...
We know the initial value of the color property, no need to
resolve it again.
2024-05-18 09:09:21 -04:00
Matthias Clasen
97582ae9ad
css: Simplify color resolving
...
The cycle argument is purely a detail of the internal implementation,
no need to have it in the api.
2024-05-18 09:03:57 -04:00
Matthias Clasen
a5b85f0dc5
css: Lose more underscores
...
Drop the _ from the color value apis. Update all callers.
2024-05-18 08:59:24 -04:00
Matthias Clasen
aefb16510b
Merge branch 'css-fiddling' into 'main'
...
css: Lose some underscores
See merge request GNOME/gtk!7255
2024-05-16 01:49:52 +00:00
Benjamin Otte
4360d433b5
Merge branch 'wip/otte/for-main' into 'main'
...
columnview: Actually check the listview in return_if_fail()
See merge request GNOME/gtk!7254
2024-05-16 01:30:20 +00:00
Matthias Clasen
5927319589
css: Inline a few functions
...
These are just operating on the value base and can easily be inlined.
2024-05-15 20:54:45 -04:00