Compare commits

..

175 Commits

Author SHA1 Message Date
Matthias Clasen 1050ca63a6 widget: Keep separate nodes for css
Keep separate render nodes for CSS background, border, content
and outline, and only recreate them when needed.
2024-06-02 16:05:58 -04:00
Matthias Clasen 1080822ffa Merge branch 'matthiasc/css-deprecation-warning' into 'main'
css: Emit deprecation warnings only under debug

See merge request GNOME/gtk!7330
2024-06-02 15:33:32 +00:00
Matthias Clasen 3fef45683c css: Emit deprecation warnings only under debug 2024-06-02 15:33:32 +00:00
Matthias Clasen cfcc5c5c0b Merge branch 'docs-add-missing-returns-args' into 'main'
docs: Add missing returns and parameter annotations

See merge request GNOME/gtk!7325
2024-06-02 15:26:50 +00:00
Matthias Clasen 856f1808de Merge branch 'matthiasc/for-main' into 'main'
Fix a bug in color conversion

See merge request GNOME/gtk!7328
2024-06-02 15:24:09 +00:00
Matthias Clasen 4341344545 css: Add a utility for color space coords 2024-06-02 11:08:35 -04:00
Matthias Clasen 20392e8840 Cosmetics 2024-06-02 10:48:21 -04:00
Matthias Clasen 426fefff81 Merge branch 'bilelmoussaoui/gi-constructor' into 'main'
gtk: Mark DragIcon.get_for_drag as constructor

See merge request GNOME/gtk!7329
2024-06-02 14:43:29 +00:00
Bilal Elmoussaoui 13013053f7 gtk: Mark DragIcon.get_for_drag as constructor
Fixes downstream issue: https://github.com/gtk-rs/gtk4-rs/issues/1748
2024-06-02 16:54:17 +03:00
Matthias Clasen 62b9a4af75 Drop an unused static 2024-06-02 09:19:22 -04:00
Matthias Clasen 76caf2c812 color value: Organize the code
Add some sections, so I can find my way around.
2024-06-02 08:46:56 -04:00
Matthias Clasen 3d5fce1b9f Fix a bug in color conversion
The linear space corresponding to oklab is oklab, not srgb-linear.
2024-06-02 08:46:33 -04:00
Matthias Clasen bfe8adbee4 Merge branch 'fix-obvious-doc-issues' into 'main'
Fix obvious docstring issues

See merge request GNOME/gtk!7320
2024-06-02 12:02:06 +00:00
Matthias Clasen 827642303c Merge branch 'fix-getter-for-dropdown' into 'main'
gtkdropdown: Use proper attribute

See merge request GNOME/gtk!7327
2024-06-02 11:56:53 +00:00
Maximiliano Sandoval 6b6a0e1257 docs: Fix {g,s}et_property attributes annotations
Do not use set_property on getters and vice versa.
2024-06-02 13:49:45 +02:00
Martin 7a98176a02 Update Slovenian translation 2024-06-01 08:53:47 +00:00
Maximiliano Sandoval a93a986ef2 gtkiconview: docs: Add missing return annotation 2024-06-01 10:01:20 +02:00
Maximiliano Sandoval 39dbc5ea87 gtkcombobox: Document popdown signal return value 2024-06-01 10:01:20 +02:00
Maximiliano Sandoval cf4d13bee3 gdkevents: gdk_event_get_position return value 2024-06-01 10:01:20 +02:00
Maximiliano Sandoval 0bacde8e0a gskpathbuilder: Document add_cairo_path path arg 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval 949cd45bb7 gskstroke: Add missing return annotations 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval 2e9e216641 gtkicontheme: Document lockup_icon arguments 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval 1ab8ffaceb gtktextchild: Document new_with_replacement arg 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval 3cc1726856 gtkstringlist: Document strings property 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval 30eaa2c3cc gtk: Add missing return annotations 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval ba5993195a filedialog: Document get_accept_label 2024-06-01 10:01:19 +02:00
Maximiliano Sandoval bf42351ebf cellrendererspinner: Fix active signal docs 2024-06-01 09:04:01 +02:00
Maximiliano Sandoval ee277f4d92 gtksectionmodel: Fix typo in sections-changed link 2024-06-01 09:04:01 +02:00
Maximiliano Sandoval 00acc7957f gdkcursor: Fix typo in GdkCursorGetTestureCallback 2024-06-01 09:04:00 +02:00
Maximiliano Sandoval a931335f24 gskglshader: Correct typo in source property 2024-06-01 09:04:00 +02:00
Maximiliano Sandoval 1ef320a9ec gsktransform: Document constructor 2024-06-01 09:04:00 +02:00
Maximiliano Sandoval 411b7f12b5 gtkicontheme: Fix typo in return annotation 2024-06-01 09:03:59 +02:00
Maximiliano Sandoval 611fcfb1c7 gtkgraphicsoffload: Fix typo in prop name 2024-06-01 09:03:59 +02:00
Maximiliano Sandoval 6257a51f4f gtkflowbox: Fix typos in annotations 2024-06-01 09:03:58 +02:00
Maximiliano Sandoval e24630bd18 gtkenums: Correctly document AnnouncementPriority 2024-06-01 09:03:58 +02:00
Maximiliano Sandoval 6b0b3a4db7 gtkprintsettings: Delete extra whitespace 2024-06-01 09:03:58 +02:00
Maximiliano Sandoval fd19c7c2ab gtkscrolledwindow: Fix typo in docstring 2024-06-01 09:03:57 +02:00
Maximiliano Sandoval 4aa2206699 gtktextview: Fix typo Textview in docstrings 2024-06-01 09:03:57 +02:00
Maximiliano Sandoval eae23ebf69 gtkbuilderscope: Correct the argument values
These should match the function arguments.
2024-06-01 09:03:56 +02:00
Maximiliano Sandoval ecd27f6c3c entry: Fix typos in tabs and show-emoji-icon 2024-06-01 09:03:56 +02:00
Maximiliano Sandoval 01f3c72338 sectionsmodel: Fix typo in docstring 2024-06-01 09:03:55 +02:00
Matthias Clasen 87be414c05 Merge branch 'color-fixes' into 'main'
Fix oklch conversion

See merge request GNOME/gtk!7324
2024-06-01 01:42:45 +00:00
Matthias Clasen f6d676cc8a inspector: Use gdk_rgba_print when suitable 2024-05-31 21:39:32 -04:00
Matthias Clasen 4961241f26 gsk: Use gdk_rgba_print when suitable 2024-05-31 21:39:04 -04:00
Matthias Clasen 60c944bb94 Add tests for color conversion and interpolation
Add some tests for gtk_css_color_convert and
gtk_css_color_interpolate, mostly based on examples
in the spec.
2024-05-31 21:29:49 -04:00
Matthias Clasen 740c10282f Add gtk_css_color_print and gtk_css_color_to_string
These are useful for testing and debugging.
2024-05-31 21:29:49 -04:00
Matthias Clasen 3a4c69f370 gdk: Add gdk_rgba_print 2024-05-31 21:29:49 -04:00
Matthias Clasen c3083572fb css: Small api fix
This should have been const.
2024-05-31 21:29:49 -04:00
Matthias Clasen 8ecb00be66 css: Export some color value api for tests
Export enough api to test color conversion and interpolation.
2024-05-31 21:29:49 -04:00
Matthias Clasen 48e707aceb css: Color interpolation fixes
Some minor gotchas and oversights.
2024-05-31 21:29:49 -04:00
Matthias Clasen e2f9ff2304 Fix oklch conversion
The pseudo-code in the spec is broken.
2024-05-31 21:27:22 -04:00
Matthias Clasen fa3a72c8f6 Fix oklch conversion
We want to normalize angles to be in [0, 360).
2024-05-31 21:25:54 -04:00
Matthias Clasen fc45d90834 css: Fix oklab parsing 2024-05-31 19:33:56 -04:00
Matthias Clasen fcd95cd5c6 css: Fix oklab conversion 2024-05-31 19:33:22 -04:00
Matthias Clasen b8c1ac41d2 Merge branch 'css-color-missing-components' into 'main'
css: Add GtkCssColor

See merge request GNOME/gtk!7323
2024-05-31 21:05:24 +00:00
Matthias Clasen 90e1ce0906 Merge branch 'new-docstrings' into 'main'
Add missing docstrings

See merge request GNOME/gtk!7321
2024-05-31 19:57:53 +00:00
Matthias Clasen d121fd5b7d css: Tweak compute for color values
Make color values carry their srgb equivalent and don't turn them
into literals at compute time. This is necessary so we can use their
original color space values in interpolation.

This makes color values a bit larger, but they still fit into one
cacheline.

We don't change handling of named colors and our color expressions.
They still get turned into literal colors.
2024-05-31 15:51:02 -04:00
Matthias Clasen 4d88fcc1db css: Use gtk_css_color_convert
Use gtk_css_color_convert for going to srgb and stop relying on
GdkRGBA for printing.
2024-05-31 15:51:02 -04:00
Matthias Clasen 85fcda178e css: Implement color interpolation
Implement gtk_css_color_convert, which is an attempt to implement
most of https://www.w3.org/TR/css-color-4/#interpolation for the
color spaces we support.
2024-05-31 15:51:02 -04:00
Matthias Clasen ecc678454b css: Implement color conversion
Implement gtk_css_color_convert, which is an attempt to
implement https://www.w3.org/TR/css-color-4/#color-conversion
for the color spaces we support.

Missing:
- white point adaptation
- gamut mapping
2024-05-31 15:51:02 -04:00
Matthias Clasen 5a85bc691e css: Split off GtkCssColor
Break out a GtkCssColor struct.
2024-05-31 15:51:02 -04:00
Matthias Clasen d506a5eea8 colorutils: Add some more utils
Add oklab<>srgb-linear and rgb<>hls conversions.
2024-05-31 15:51:02 -04:00
Matthias Clasen aefa79413b css: Implement missing components in colors
Add support for parsing none for color components, and preserve
that information for serialization. We currently don't use it
for other things, but we should.
2024-05-31 15:51:02 -04:00
Matthias Clasen 73e4eb7552 css: gtk_css_color_value_new_literal static too
This function is only used inside gtkcsscolorvalue.c as well.
2024-05-31 15:50:43 -04:00
Matthias Clasen dff340530a Merge branch 'matthiasc/for-main' into 'main'
css: Make some color value functions static

See merge request GNOME/gtk!7319
2024-05-31 16:40:33 +00:00
Matthias Clasen f6ea3e1684 inspector: Make css deprecations opt-in
Add a button to show deprecation warnings (since those will
unfortunately be common for while, due to backwards compat).
2024-05-31 11:25:11 -04:00
Matthias Clasen f790441505 colorutils: Add some more utils
Add oklab<>srgb-linear and hsl<>rgb conversions.
2024-05-31 10:13:35 -04:00
Matthias Clasen 0c307f7563 css: Make some color value functions static
These aren't used outside of gtkcsscolorvalue.c, so don't export
them.
2024-05-31 10:13:35 -04:00
Matthias Clasen f89dc9644c Cosmetics 2024-05-31 10:12:28 -04:00
Matthias Clasen 735455b523 Merge branch 'memoryfix' into 'main'
Changes to fix the memorytexture regression

Closes #6260

See merge request GNOME/gtk!7111
2024-05-31 10:35:39 +00:00
Maximiliano Sandoval d037cfaf44 Add docstrings for deprecated classes 2024-05-31 11:48:24 +02:00
Maximiliano Sandoval 293d63425a gtkiconview: Add missing docstrings 2024-05-31 11:48:24 +02:00
Maximiliano Sandoval 38f9bb87bc gtkentrycompletion: Document missing properties 2024-05-31 11:48:24 +02:00
Maximiliano Sandoval 64abadb370 gtkcolorchooserdialog: Document show-editor 2024-05-31 11:48:23 +02:00
Maximiliano Sandoval 6f85827fcb gtkfilechooserwidget: Document missing props 2024-05-31 11:48:23 +02:00
Maximiliano Sandoval b0e321cfb8 gtkstylecontext: Document display property 2024-05-31 11:48:23 +02:00
Maximiliano Sandoval 46d0569365 gtktypes: Document GtkCssStyleChange
This is used in the css_changed virtual function of GtkWidget.
2024-05-31 11:48:19 +02:00
Maximiliano Sandoval 2eea911a0f gdktoplevel: Document TitlebarGesture 2024-05-31 11:47:30 +02:00
Maximiliano Sandoval ee4a817121 gdk: docs: Document error quarks 2024-05-31 11:47:30 +02:00
Maximiliano Sandoval 3d1f914271 gskglrenderer: Document GL renderers 2024-05-31 11:47:30 +02:00
Maximiliano Sandoval 7bb0639a75 gskrendernode: Document serialization error quark 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval f8f38aab63 gskpathpoint: Document copy and free 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval 75c2bd53aa gtkcsslocation: Document struct 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval 83921750ae gtknotebook: Document signals 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval 413512eba7 gtkheaderbar: Document title-widget property 2024-05-31 11:47:29 +02:00
Maximiliano Sandoval e824764dc3 gtktexttag: Document properties 2024-05-31 11:47:28 +02:00
Maximiliano Sandoval 61b12abdab gtkshortcutssection: Document change-current-page 2024-05-31 11:47:28 +02:00
Maximiliano Sandoval 07bd5c7b05 gtkscale: Document FormatValueFunc 2024-05-31 11:47:28 +02:00
Maximiliano Sandoval 1dc20eda28 gtk: Document constants 2024-05-31 11:47:28 +02:00
Maximiliano Sandoval 5a9299f626 gtklistbox: Document signals
The docs of move-cursor is taken from FlowBox's.
2024-05-31 11:47:28 +02:00
Maximiliano Sandoval 9c86c67f06 gtkpadcontroller: Document properties 2024-05-31 11:47:27 +02:00
Maximiliano Sandoval e6ca7668be gtkdebug: Document DEBUG_CHECK 2024-05-31 11:47:27 +02:00
Maximiliano Sandoval 0b540b9ad1 gtkactionable: Document properties 2024-05-31 11:47:25 +02:00
Maximiliano Sandoval 514cdf7398 gtk: Document PrintSettingsFunc 2024-05-31 10:22:44 +02:00
Maximiliano Sandoval 2ab52d73ab gtkprintsettings: Document constants
The docstring is taken form existing constants and their getters
docstring.
2024-05-31 10:22:38 +02:00
Maximiliano Sandoval b3ae172c1e gtk: Document error quark functions 2024-05-31 10:22:23 +02:00
Maximiliano Sandoval a6d1df66ec messagedialog: Document buttons property 2024-05-31 10:22:05 +02:00
gayathri.berli@ibm.com ba92ce342e Merge branch 'main' into memoryfix 2024-05-30 18:21:06 +05:30
Matthias Clasen 9f4c715516 Merge branch 'css-color-minor' into 'main'
css: Simplify color values

See merge request GNOME/gtk!7316
2024-05-30 03:57:31 +00:00
Matthias Clasen 5aa47b6e45 Merge branch 'ebassi/doc-overview-link' into 'main'
docs: Fix link to the Pango reference

See merge request GNOME/gtk!7315
2024-05-30 03:45:13 +00:00
Matthias Clasen 3b40d95581 css: Fix currentcolor serialization
According to css specs, the serialization is supposed to be
all lowercase.
2024-05-29 21:45:10 -04:00
Matthias Clasen 3ad2d91e1c Cosmetics
Fix minor style issues in gtkcsscolorvalue.c.
2024-05-29 21:44:47 -04:00
Matthias Clasen d4c586e882 css: Simplify color values
Drop the last_value. We don't do that for any other types of
values, so lets not do it here either.
2024-05-29 21:36:10 -04:00
Emmanuele Bassi 612c547ed3 docs: Fix link to the Pango reference
Reported at: https://discourse.gnome.org/t/broken-link-https-docs-gtk-org-gtk4-overview-html/21223
2024-05-30 02:10:48 +01:00
Matthias Clasen 1a777ce7f3 Merge branch 'online-man-pages' into 'main'
docs: Install man pages as html

See merge request GNOME/gtk!7314
2024-05-30 00:18:01 +00:00
Matthias Clasen 7ec4f6e297 Merge branch 'wip/xdg-dialog' into 'main'
gdk/wayland: Implement support for xdg-dialog Wayland protocol

See merge request GNOME/gtk!6837
2024-05-29 23:40:39 +00:00
Matthias Clasen afaa0f3afd docs: Install man pages as html
This will let us link to them from the docs.
2024-05-29 19:30:09 -04:00
Matthias Clasen 8841a002ed Merge branch 'build-with-unicode' into 'main'
Windows: Build with UNICODE

See merge request GNOME/gtk!7230
2024-05-29 23:20:01 +00:00
Matthias Clasen 6da606aaad Merge branch 'issue-6401-legacy' into 'main'
Win32 GL: Also force not to use depth/stencil/accum bits on legacy contexts (for issue #6401)

See merge request GNOME/gtk!7176
2024-05-29 23:18:04 +00:00
Matthias Clasen 51bd155670 Merge branch 'css-error-fixes' into 'main'
css: Propagate errors properly

See merge request GNOME/gtk!7313
2024-05-29 23:13:14 +00:00
Matthias Clasen 8fa16ec1cc Merge branch '6332_fix_scale_highlight_clip' into 'main'
range: fix highlight clipping

Closes #6332

See merge request GNOME/gtk!7297
2024-05-29 21:03:11 +00:00
Matthias Clasen 04e5a0006d Merge branch '6332_fix_progressbar_highlight_clip' into 'main'
progressbar: fix highlight clipping

Closes #6332

See merge request GNOME/gtk!7312
2024-05-29 20:54:04 +00:00
Matthias Clasen a1d2169992 Document GTK_DEBUG_CSS
This was overlooked in b603479fe2.
2024-05-29 15:47:40 -04:00
Matthias Clasen 778976f8da css: Propagate errors properly
We should not change the domain and code when we propagate errors
that happen while parsing variable references.

Pointed out in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7308.
2024-05-29 15:47:40 -04:00
g.willems f81dea58a2 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-05-29 21:16:34 +02:00
g.willems e82606a538 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-05-29 21:14:32 +02:00
Matthias Clasen fe5b28f5b8 Merge branch 'bilelmoussaoui/add-since-annotations' into 'main'
gtk: Add missing docs blob to CssSection

See merge request GNOME/gtk!7296
2024-05-29 19:09:07 +00:00
Matthias Clasen 82fd0d7eef Merge branch 'matthiasc/for-main' into 'main'
css: Fix serialization of oklab() etc

Closes #6748, #6732, and #6735

See merge request GNOME/gtk!7310
2024-05-29 17:08:38 +00:00
Matthias Clasen 16761fcb49 Merge branch 'wip/alice/color-func' into 'main'
csscolorvalue: Add color() support

See merge request GNOME/gtk!7286
2024-05-29 17:02:13 +00:00
Matthias Clasen 4fac5680fb Merge branch 'css-error-docs' into 'main'
css: Clarify docs for GtkCssProvider::parser-error

See merge request GNOME/gtk!7309
2024-05-29 16:41:55 +00:00
Matthias Clasen 4ec4280e51 css: Clarify docs for GtkCssProvider::parser-error
Some of these errors should not be fatal.

Related: #6736
2024-05-29 12:35:14 -04:00
Matthias Clasen 15bb77472d css: Add some parser tests for oklab() etc 2024-05-29 12:05:28 -04:00
Matthias Clasen 5c92d5e081 css: Fix serialization of oklab() etc
The spec requires that oklab() and oklch() are serialized as these
functions, while hwb() is serialized as rgb().

Fixes: #6748
2024-05-29 12:04:20 -04:00
Emmanuele Bassi 1626c5f1e7 css: Create a section if the variable does not have one
In case a variable definition does not have a CSS section associated to
it, we fall back to the previous behaviour of creating a CSS section
with the bounds of the error.

See: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/841
2024-05-29 12:04:20 -04:00
Michael Weghorn 3b5f0ed05e a11y: Use text instead of label for GtkLabel's a11y name
Update the `GTK_ACCESSIBLE_PROPERTY_LABEL` property
in `gtk_label_set_text_internal` using the new text
instead of using the label in
`gtk_label_set_label_internal`.

While the `label` "includes any embedded underlines
indicating mnemonics and Pango markup" [1], the
`text` is the "text is as it appears on screen" [2],
which is more suitable for the accessible name.

With this in place, the text is reported as the
accessible name again after

    commit d5b34aecdd
    Date:   Wed Jan 17 12:49:38 2024 +0100

        a11y: Remove special handling of accessible names for static text widgets

[1] https://docs.gtk.org/gtk4/method.Label.get_label.html
[2] https://docs.gtk.org/gtk4/method.Label.get_text.html

Fixes: #6732
Fixes: #6735
2024-05-29 12:04:20 -04:00
Chun-wei Fan d2298f1c8f gskvulkandevice.c: Put Vk[Pipeline|RenderPass] in structures
This way, we can simply duplicate the keys as separate pointers to store
the corresponding Vulkan handles so that we can safely hash them, as
Vulkan handles may or may not be pointers depending on the target
platform.

This will fix builds on 32-bit Windows at least.
2024-05-29 12:04:20 -04:00
Chun-wei Fan 085062ab89 gdkvulkancontext.c: Use pointers to hash VkShaderModule
VkShaderModule's may or may not be pointers depending on the target
platform, so use pointers to hash those handles to be safe, and retrieve
them from hashes accordingly.

Fixes build on 32-bit Windows at least.
2024-05-29 12:04:20 -04:00
Chun-wei Fan 9741082467 gskvulkanmemory.c: Use VK_NULL_HANDLE for VkDeviceMemory
...rather than NULL, so that things will build fine on non-LLP, non-64-bit
systems.
2024-05-29 12:04:20 -04:00
Benjamin Otte 3db4a05493 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-05-29 12:04:20 -04:00
Georges Basile Stavracas Neto e3b9df2cec 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-05-29 12:04:20 -04:00
Yosef Or Boczko 4a4e445a35 Update Hebrew translation 2024-05-29 12:04:20 -04:00
Chun-wei Fan db0f9b60ac gsk: Call glDeleteSync() directly
This function does not use the standard __cdecl calling convention on
Windows, meaning using g_clear_pointer() on it directly will cause
crashes on 32-bit Windows.  Just call it directly if the GLsync it uses
exists.
2024-05-29 12:04:20 -04:00
Alice Mikhaylenko d51de390ba csscolorvalue: Add color() support
Currently we only have sRGB, so it's a bit redundant, but we'll need this
for color-mix()

Once we have more color spaces, they should be added here (presumably the
enum would be in GDK instead, and instead of GdkRGBA these colors would
have a GdkColor.
2024-05-29 19:28:31 +04:00
Matthias Clasen c14e167a11 Merge branch 'ebassi/css-section-warning' into 'main'
css: Create a section if the variable does not have one

See merge request GNOME/gtk!7306
2024-05-29 14:01:55 +00:00
Emmanuele Bassi 2837a85461 Merge branch 'michaelweghorn/a11y_label_name' into 'main'
a11y: Update label's accessible name on text update

Closes #6732 and #6735

See merge request GNOME/gtk!7293
2024-05-29 12:35:40 +00:00
Benjamin Otte 282510e113 Merge branch 'vulkan-windows-32' into 'main'
Vulkan: Fix build on 32-bit Windows (and likely other non-64-bit LLP platforms)

See merge request GNOME/gtk!7299
2024-05-29 10:34:42 +00:00
Emmanuele Bassi accabe3eee css: Create a section if the variable does not have one
In case a variable definition does not have a CSS section associated to
it, we fall back to the previous behaviour of creating a CSS section
with the bounds of the error.

See: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/841
2024-05-29 11:29:13 +01:00
Chun-wei Fan 9dbdbaca43 gskvulkandevice.c: Put Vk[Pipeline|RenderPass] in structures
This way, we can simply duplicate the keys as separate pointers to store
the corresponding Vulkan handles so that we can safely hash them, as
Vulkan handles may or may not be pointers depending on the target
platform.

This will fix builds on 32-bit Windows at least.
2024-05-29 18:16:22 +08:00
Chun-wei Fan 5935bc95b7 gdkvulkancontext.c: Use pointers to hash VkShaderModule
VkShaderModule's may or may not be pointers depending on the target
platform, so use pointers to hash those handles to be safe, and retrieve
them from hashes accordingly.

Fixes build on 32-bit Windows at least.
2024-05-29 18:03:13 +08:00
Chun-wei Fan 4c677e4dcd gskvulkanmemory.c: Use VK_NULL_HANDLE for VkDeviceMemory
...rather than NULL, so that things will build fine on non-LLP, non-64-bit
systems.
2024-05-29 12:57:07 +08:00
Benjamin Otte d4c25c9ec0 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Shrink maximum texture size in test

See merge request GNOME/gtk!7303
2024-05-28 15:31:08 +00:00
Benjamin Otte b69df2bc4d 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-05-28 16:51:03 +02:00
Luca Bacci 7f9363d471 Windows: Build with UNICODE
Build with UNICODE (and _UNICODE) defined when targeting Windows.
2024-05-28 16:37:48 +02:00
Emmanuele Bassi 01d86eab66 Merge branch 'gbsneto/bitset-filechooser-leaks' into 'main'
filechooserwidget: Plug a bunch of GtkBitset leaks

See merge request GNOME/gtk!7302
2024-05-28 13:16:39 +00:00
Yosef Or Boczko 09e85aa809 Update Hebrew translation 2024-05-28 08:54:43 +00:00
Georges Basile Stavracas Neto d49816d2e6 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-05-28 10:24:27 +02:00
Benjamin Otte 59a00d6768 Merge branch 'ngl-windows-32' into 'main'
Fix using the NGL renderer on 32-bit Windows

See merge request GNOME/gtk!7294
2024-05-28 04:39:43 +00:00
Alice Mikhaylenko 6bd6c6acba colorutils: Add linear srgb conversion functions 2024-05-27 15:50:50 +04:00
Chun-wei Fan be2ff60787 gsk: Call glDeleteSync() directly
This function does not use the standard __cdecl calling convention on
Windows, meaning using g_clear_pointer() on it directly will cause
crashes on 32-bit Windows.  Just call it directly if the GLsync it uses
exists.
2024-05-25 11:07:37 +08:00
Bilal Elmoussaoui 070b9a87b6 gtk: Add missing docs blob to CssSection
For the missing Since annotations mostly.
2024-05-24 12:05:51 +02:00
Emmanuele Bassi ecbe6a421e Merge branch 'bilelmoussaoui/no-async-finish-docs' into 'main'
docs: Drop _finish blobs

See merge request GNOME/gtk!7295
2024-05-24 05:14:56 +00:00
Michael Weghorn 317e68a58c a11y: Use text instead of label for GtkLabel's a11y name
Update the `GTK_ACCESSIBLE_PROPERTY_LABEL` property
in `gtk_label_set_text_internal` using the new text
instead of using the label in
`gtk_label_set_label_internal`.

While the `label` "includes any embedded underlines
indicating mnemonics and Pango markup" [1], the
`text` is the "text is as it appears on screen" [2],
which is more suitable for the accessible name.

With this in place, the text is reported as the
accessible name again after

    commit d5b34aecdd
    Date:   Wed Jan 17 12:49:38 2024 +0100

        a11y: Remove special handling of accessible names for static text widgets

[1] https://docs.gtk.org/gtk4/method.Label.get_label.html
[2] https://docs.gtk.org/gtk4/method.Label.get_text.html

Fixes: #6732
Fixes: #6735
2024-05-24 05:48:22 +02:00
Bilal Elmoussaoui 9b42377347 docs: Drop _finish blobs
As they are generated by gi-docgen thanks to the newly added async annotations.
It allows bindings that don't expose the _finish
functions to propose less-confusing docs
2024-05-23 20:39:50 +02:00
Andre Klapper 7372a845fb Correct GNOME HIG 404 URI 2024-05-23 16:31:20 +02:00
Carlos Garnacho cf8c3be030 gdk/wayland: Implement support for xdg-dialog Wayland protocol
This protocol lifts some functionality from the gtk-shell protocol,
namely the ability to tag dialogs as modal. Ensure to use this
new protocol if available for the task, instead of the gtk-shell
protocol.
2024-05-23 12:40:39 +02:00
Carlos Garnacho 4eb715cf81 build: Support in-tree copies of wayland protocols
Make the info about the required protocols an array of definitions
again (a dict instead of an array this time) and add a field that
may be used for version checks of the wayland-protocols found.

Also, make it possible to have versioned protocols in-tree. Both
of these things will allow us to ship in-tree copies of wayland-protocols
without necessarily having to bump the version we depend on.
2024-05-23 12:40:19 +02:00
Luca Bacci d4899fdf1f Merge branch 'gdk4_win32_fix_dnd_move_cursor' into 'main'
gdk4-win32: Guarantee dnd-move as a cursor name

See merge request GNOME/gtk!7289
2024-05-23 10:16:30 +00:00
Emmanuele Bassi 4142c4d79e Merge branch 'mcatanzaro/#6734' into 'main'
text: fix critical in paste_received

Closes #6734

See merge request GNOME/gtk!7290
2024-05-22 23:17:15 +00:00
Matthias Clasen ca442f8641 Merge branch 'css-color-spaces' into 'main'
gdk: Add support for some color conversions

See merge request GNOME/gtk!7285
2024-05-22 22:32:52 +00:00
Benjamin Otte 3c1491423a Merge branch 'wip/otte/for-main' into 'main'
gsk: use the correct memory type index

See merge request GNOME/gtk!7287
2024-05-22 21:47:44 +00:00
Michael Catanzaro eb4993d3fb text: fix critical in paste_received
Here we calculate the length only in the truncate_multiline condition.
Then we pass pos - 1 to gtk_accessible_text_update_contents() as the end
position, triggering this critical that checks to ensure start <= end.
Fix it by always calculating the length of the string that we insert.

This is the first bug fixed as a result of enabling fatal criticals by
default in Epiphany! 🎉

Fixes #6734
2024-05-22 16:06:09 -05:00
g.willems aa057da1ca win32: Guarantee dnd-move as a cursor name
gdk currently falls back to the default cursor, which may not be
approriate for rendering a DnD move.
2024-05-22 20:55:21 +02:00
Matthias Clasen 1de09d59fb css: Support some color spaces
Support the hwb(), oklab() and oklch() functions for specifying
colors in these color spaces.

See https://bottosson.github.io/posts/oklab/ and
https://www.w3.org/TR/css-color-4/.

Some tests included.
2024-05-22 14:31:56 -04:00
Alejandro Piñeiro 130a6fe0cf gsk: use the correct memory type index
https://gitlab.gnome.org/GNOME/gtk/-/issues/6726
2024-05-22 19:43:03 +02:00
Matthias Clasen e1f7c027d7 Merge branch 'css-color-docs' into 'main'
css: Update docs slightly

See merge request GNOME/gtk!7281
2024-05-22 17:25:47 +00:00
Arjan Molenaar 396ef5ebe5 Merge branch 'macos-popup-shadows' into 'main'
macos: Take shadows into account when positioning popups

See merge request GNOME/gtk!7266
2024-05-22 13:15:34 +00:00
Emmanuele Bassi 840a20db3b Merge branch 'macos-surface-critical' into 'main'
gdkmacossurface: Set surface before accessing it

See merge request GNOME/gtk!7267
2024-05-22 09:10:35 +00:00
Matthias Clasen 8c6f7d1ae9 Merge branch 'matthiasc/for-main' into 'main'
4.15.1

See merge request GNOME/gtk!7283
2024-05-22 00:00:21 +00:00
Matthias Clasen c69fa6221b Post-release version bump 2024-05-21 19:54:53 -04:00
Matthias Clasen 3c92c81705 4.15.1 2024-05-21 19:52:12 -04:00
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
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
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
Chun-wei Fan 54a86a2a7e Win32 GL: Also force not to use depth/stencil/accum bits on legacy contexts
For completeness' sake, also specifiy in the PIXELFORMATDESCRIPTOR to use no
depth, stencil and accum bits to initializing WGL when we can't (yet) use
wglChoosePixelFormatARB(), as we must always fist have a base legacy WGL
context using ChoosePixelFormat() before we can use that to use
wglChoosePixelFormatARB(), or if wglChoosePixelFormatARB() is somehow not
available for us.

Some drivers, however, enforces enabling depth buffers, so if we can't
acquire a pixel format that disables depth buffers, retry acquiring one
with that, which sadly is not optimal but we must make do.

Attempts to complete fix for issue #6401.
2024-04-24 16:23:17 +08:00
gayathri.berli@ibm.com 06351844bb changes to fix the memorytexture regression 2024-04-18 17:13:41 +05:30
214 changed files with 4995 additions and 2673 deletions
+1
View File
@@ -459,6 +459,7 @@ reference:
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
- mv _build/docs/reference/gtk/*.html _reference/gtk4/
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
+18 -2
View File
@@ -1,12 +1,20 @@
Overview of Changes in 4.15.1, xx-xx-xxxx
Overview of Changes in 4.15.2, xx-xx-xxxx
=========================================
Overview of Changes in 4.15.1, 21-05-2024
=========================================
* GtkGraphicsOffload:
- Don't crash without a child
* GtkSpinner:
- Don't animate when unmapped
* CSS:
- Support the :root selector
- Support variables and custom properties
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
- Implement math functions (https://www.w3.org/TR/css-values-4/)
- Support modern syntax and calc in rgb() and hsl()
* Icontheme:
- Make symbolic svg loading more efficient
@@ -43,12 +51,20 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
* Debugging:
- Show more texture details in the recorder
- Use GTK_DEBUG=css to see CSS deprecations
* macOS:
- Fix problems with events handed back to the OS
- Respect GDK_DEBUG=default-settings
- Allow applictions to handle Dock > Quit
* Deprecations:
- Use of @name colors in CSS
* Translation updates:
Catalan
Georgian
Hungarian
Korean
Portuguese
Turkish
+44 -23
View File
@@ -15,16 +15,16 @@ spec.
The following units are supported for basic datatypes:
Length
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
: px, pt, em, ex, rem, pc, in, cm, mm
Percentage
: %, calc()
: %
Angle
: deg, rad, grad, turn, calc()
: deg, rad, grad, turn
Time
: s, ms, calc()
: s, ms
Length values with the em or ex units are resolved using the font
size value, unless they occur in setting the font-size itself, in
@@ -33,11 +33,15 @@ which case they are resolved using the inherited font size value.
The rem unit is resolved using the initial font size value, which is
not quite the same as the CSS definition of rem.
The calc() notation adds considerable expressive power. There are limits
on what types can be combined in such an expression (e.g. it does not make
sense to add a number and a time). For the full details, see the
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
spec.
Length values using physical units (pt, pc, in, cm, mm) are translated
to px using the dpi value specified by the -gtk-dpi property, which is
different from the CSS definition, which uses a fixed dpi of 96.
The calc() notation adds considerable expressive power to all of these
datatypes. There are limits on what types can be combined in such an
expression (e.g. it does not make sense to add a number and a time).
For the full details, see the
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
A common pattern among shorthand properties (called 'four sides') is one
where one to four values can be specified, to determine a value for each
@@ -82,36 +86,53 @@ color: var(--prop, green);
## Colors
### CSS Colors
Colors can be expressed in numerous ways in CSS (see the
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
many (but not all) of these.
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
syntax, and calc() can be used as well in color expressions.
### Non-CSS Colors
GTK extends the CSS syntax with several additional ways to specify colors.
These extensions are deprecated and should be replaced by the equivalent
standard CSS notions.
The first is a reference to a color defined via a @define-color rule in CSS.
The syntax for @define-color rules is as follows:
```
@define-color Name Color
@define-color name color
```
To refer to the color defined by a @define-color rule, prefix the name with @.
The standard CSS mechanisms that should be used instead of @define-color are
custom properties, :root and var().
GTK also supports color expressions, which allow colors to be transformed to
new ones. Color expressions can be nested, providing a rich language to
define colors. Color expressions resemble functions, taking 1 or more colors
and in some cases a number as arguments.
`lighter(Color)`
: produces a brighter variant of Color
`lighter(color)`
: produces a brighter variant of `color`.
`darker(Color)`
: produces a darker variant of Color
`darker(color)`
: produces a darker variant of `color`.
`shade(Color, Number)`
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
`shade(color, number)`
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
`alpha(Color, Number)`
: replaces the alpha value of color with number (between 0 and 1)
`alpha(color, number)`
: multiplies the alpha value of `color` by `number` (between 0 and 1).
`mix(Color1, Color2, Number)`
: interpolates between the two colors
`mix(color1, color2, number)`
: interpolates between the two colors.
## Images
@@ -119,7 +140,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
To load a themed icon, use
```
-gtk-icontheme(Name)
-gtk-icontheme(name)
```
The specified icon name is used to look up a themed icon, while taking into
@@ -148,14 +169,14 @@ and the
syntax makes this available. -gtk-recolor requires a url as first argument.
The remaining arguments specify the color palette to use. If the palette is
not explicitly specified, the current value of the -gtk-icon-palette property
is used.
is used.
GTK supports scaled rendering on hi-resolution displays. This works best if
images can specify normal and hi-resolution variants. From CSS, this can be
done with
```
-gtk-scaled(Image1, Image2)
-gtk-scaled(image1, image2)
```
## GTK CSS Properties
+1
View File
@@ -82,6 +82,7 @@ content_files = [
"wayland.md",
"windows.md",
"x11.md",
"tools.md",
"visual_index.md",
]
content_images = [
+52 -29
View File
@@ -25,7 +25,8 @@ expand_content_md_files = [
'section-tree-widget.md',
'section-list-widget.md',
'question_index.md',
'visual_index.md'
'visual_index.md',
'tools.md',
]
gtk_images = []
@@ -60,39 +61,39 @@ if get_option('documentation')
build_by_default: true,
install: true,
install_dir: docs_dir,
install_tag: 'doc',
)
endif
rst2man = find_program('rst2man', 'rst2man.py', required: false)
if get_option('man-pages') and not rst2man.found()
error('No rst2man found, but man pages were explicitly enabled')
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-rendernode-tool', '1' ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-path-tool', '1', ],
]
if get_option('build-demos')
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-node-editor', '1', ],
]
endif
if get_option('man-pages') and rst2man.found()
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-rendernode-tool', '1' ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-path-tool', '1', ],
]
rst2x_flags = [
'--syntax-highlight=none',
]
if get_option('build-demos')
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-node-editor', '1', ],
]
endif
rst2man_flags = [
'--syntax-highlight=none',
]
if get_option('man-pages')
foreach rst: rst_files
man_name = rst[0]
@@ -103,12 +104,34 @@ if get_option('man-pages') and rst2man.found()
output: '@0@.@1@'.format(man_name, man_section),
command: [
rst2man,
rst2man_flags,
rst2x_flags,
'@INPUT@',
],
capture: true,
install: true,
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
install_tag: 'doc',
)
endforeach
endif
if get_option('documentation')
foreach rst: rst_files
man_name = rst[0]
custom_target(
input: '@0@.rst'.format(man_name),
output: '@0@.html'.format(man_name),
command: [
rst2html5,
rst2x_flags,
'@INPUT@',
],
capture: true,
install: true,
install_dir: docs_dir / 'gtk4',
install_tag: 'doc',
)
endforeach
endif
+1 -1
View File
@@ -64,6 +64,6 @@ GTK is divided into three parts:
[cairo]: https://www.cairographics.org/manual/
[opengl]: https://www.opengl.org/about/
[vulkan]: https://www.vulkan.org/
[pango]: https://docs.gtk.org/pango/
[pango]: https://docs.gtk.org/Pango/
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
[graphene]: https://ebassi.github.io/graphene/
+18
View File
@@ -0,0 +1,18 @@
Title: Tools and Demos
GTK ships with a number of tools and demos that come with their own
documentation in the form of man pages.
- [gtk4-broadwayd](gtk4-broadwayd.html)
- [gtk4-builder-tool](gtk4-builder-tool.html)
- [gtk4-demo](gtk4-demo.html)
- [gtk4-demo-application](gtk4-demo-application.html)
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
- [gtk4-icon-browser](gtk4-icon-browser.html)
- [gtk4-launch](gtk4-launch.html)
- [gtk4-node-editor](gtk4-node-editor.html)
- [gtk4-path-tool](gtk4-path-tool.html)
- [gtk4-query-settings](gtk4-query-settings.html)
- [gtk4-rendernode-tool](gtk4-rendernode-tool.html)
- [gtk4-update-icon-cache](gtk4-update-icon-cache.html)
- [gtk4-widget-factory](gtk4-widget-factory.html)
-14
View File
@@ -522,8 +522,6 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
*
* If the clipboard is not local, this function does nothing but report success.
*
* The @callback must call [method@Gdk.Clipboard.store_finish].
*
* The purpose of this call is to preserve clipboard contents beyond the
* lifetime of an application, so this function is typically called on
* exit. Depending on the platform, the functionality may not be available
@@ -638,9 +636,6 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
* Asynchronously requests an input stream to read the @clipboard's
* contents from.
*
* When the operation is finished @callback will be called. You must then
* call [method@Gdk.Clipboard.read_finish] to get the result of the operation.
*
* The clipboard will choose the most suitable mime type from the given list
* to fulfill the request, preferring the ones listed first.
*/
@@ -834,9 +829,6 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
* Asynchronously request the @clipboard contents converted to the given
* @type.
*
* When the operation is finished @callback will be called. You must then call
* [method@Gdk.Clipboard.read_value_finish] to get the resulting `GValue`.
*
* For local clipboard contents that are available in the given `GType`,
* the value will be copied directly. Otherwise, GDK will try to use
* [func@content_deserialize_async] to convert the clipboard's data.
@@ -895,9 +887,6 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
*
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
*
* When the operation is finished @callback will be called. You must then
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
*
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
* need more control over the operation.
@@ -960,9 +949,6 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
*
* Asynchronously request the @clipboard contents converted to a string.
*
* When the operation is finished @callback will be called. You must then
* call [method@Gdk.Clipboard.read_text_finish] to get the result.
*
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
* need more control over the operation.
-3
View File
@@ -540,9 +540,6 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
*
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
* indicate a higher priority.
*
* When the operation is finished, @callback will be called. You must then
* call [func@Gdk.content_deserialize_finish] to get the result of the operation.
*/
void
gdk_content_deserialize_async (GInputStream *stream,
-4
View File
@@ -279,10 +279,6 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
* Asynchronously writes the contents of @provider to @stream in the given
* @mime_type.
*
* When the operation is finished @callback will be called. You must then call
* [method@Gdk.ContentProvider.write_mime_type_finish] to get the result
* of the operation.
*
* The given mime type does not need to be listed in the formats returned by
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
-3
View File
@@ -546,9 +546,6 @@ serialize_not_found (GdkContentSerializer *serializer)
*
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
* indicate a higher priority.
*
* When the operation is finished, @callback will be called. You must then
* call [func@Gdk.content_serialize_finish] to get the result of the operation.
*/
void
gdk_content_serialize_async (GOutputStream *stream,
+1 -1
View File
@@ -52,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_name (const char *name,
GdkCursor *fallback);
/**
* GdkCursorGetTestureCallback:
* GdkCursorGetTextureCallback:
* @cursor: the `GdkCursor`
* @cursor_size: the nominal cursor size, in application pixels
* @scale: the device scale
+7
View File
@@ -62,6 +62,13 @@ struct _GdkDmabufTextureClass
GdkTextureClass parent_class;
};
/**
* gdk_dmabuf_error_quark:
*
* Registers an error quark for [class@Gdk.DmabufTexture] errors.
*
* Returns: the error quark
**/
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
+2 -6
View File
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
g_object_get (priv->drag, "content", &content, NULL);
content_formats = gdk_content_provider_ref_formats (content);
g_object_unref (content);
g_object_unref (content);
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
GdkContentFormats *formats;
GValue *value;
GTask *task;
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
task = g_task_new (self, cancellable, callback, user_data);
@@ -849,10 +849,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
* Asynchronously request the drag operation's contents converted
* to the given @type.
*
* When the operation is finished @callback will be called. You must
* then call [method@Gdk.Drop.read_value_finish] to get the resulting
* `GValue`.
*
* For local drag-and-drop operations that are available in the given
* `GType`, the value will be copied directly. Otherwise, GDK will
* try to use [func@Gdk.content_deserialize_async] to convert the data.
+2
View File
@@ -1371,6 +1371,8 @@ gdk_event_get_modifier_state (GdkEvent *event)
* Extract the event surface relative x/y coordinates from an event.
*
* This position is in [surface coordinates](coordinates.html).
*
* Returns: whether the positions were set
*/
gboolean
gdk_event_get_position (GdkEvent *event,
+7
View File
@@ -152,6 +152,13 @@ enum {
static GParamSpec *properties[LAST_PROP] = { NULL, };
/**
* gdk_gl_error_quark:
*
* Registers an error quark for [class@Gdk.GLContext] errors.
*
* Returns: the error quark
**/
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
+13 -2
View File
@@ -396,10 +396,18 @@ gboolean
*/
char *
gdk_rgba_to_string (const GdkRGBA *rgba)
{
return g_string_free (gdk_rgba_print (rgba, g_string_new ("")), FALSE);
}
GString *
gdk_rgba_print (const GdkRGBA *rgba,
GString *string)
{
if (rgba->alpha > 0.999)
{
return g_strdup_printf ("rgb(%d,%d,%d)",
g_string_append_printf (string,
"rgb(%d,%d,%d)",
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
@@ -410,12 +418,15 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
g_string_append_printf (string,
"rgba(%d,%d,%d,%s)",
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
alpha);
}
return string;
}
static gboolean
+3
View File
@@ -72,5 +72,8 @@ _gdk_rgba_equal (gconstpointer p1,
rgba1->alpha == rgba2->alpha;
}
GString * gdk_rgba_print (const GdkRGBA *rgba,
GString *string);
G_END_DECLS
+7
View File
@@ -50,6 +50,13 @@
#include "loaders/gdktiffprivate.h"
#include "loaders/gdkjpegprivate.h"
/**
* gdk_texture_error_quark:
*
* Registers an error quark for [class@Gdk.Texture] errors.
*
* Returns: the error quark
**/
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
-3
View File
@@ -767,9 +767,6 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
* This function asynchronously obtains a handle for a toplevel surface
* that can be passed to other processes.
*
* When a handle has been obtained, @callback will be called, and can
* receive the handle via [method@Gdk.Toplevel.export_handle_finish].
*
* It is an error to call this function on a surface that is already
* exported.
*
+6 -3
View File
@@ -118,9 +118,12 @@ typedef enum
/**
* GdkTitlebarGesture:
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK: double click gesture
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK: right click gesture
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK: middle click gesture
*
* The kind of title bar gesture to emit with
* [method@Gdk.Toplevel.titlebar_gesture].
*
* Since: 4.4
*/
+17 -6
View File
@@ -94,6 +94,13 @@ enum {
LAST_SIGNAL
};
/**
* gdk_vulkan_error_quark:
*
* Registers an error quark for [class@Gdk.VulkanContext] errors.
*
* Returns: the error quark
**/
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
static guint signals[LAST_SIGNAL] = { 0 };
@@ -1859,8 +1866,9 @@ gdk_display_unref_vulkan (GdkDisplay *display)
{
g_free (key);
vkDestroyShaderModule (display->vk_device,
value,
*((VkShaderModule *)value),
NULL);
g_free (value);
}
g_hash_table_unref (display->vk_shader_modules);
@@ -1988,13 +1996,13 @@ VkShaderModule
gdk_display_get_vk_shader_module (GdkDisplay *self,
const char *resource_name)
{
VkShaderModule shader;
VkShaderModule *shader;
GError *error = NULL;
GBytes *bytes;
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
if (shader)
return shader;
return *shader;
bytes = g_resources_lookup_data (resource_name, 0, &error);
if (bytes == NULL)
@@ -2004,6 +2012,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
return VK_NULL_HANDLE;
}
shader = g_new0 (VkShaderModule, 1);
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
&(VkShaderModuleCreateInfo) {
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
@@ -2011,18 +2020,20 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
},
NULL,
&shader) == VK_SUCCESS)
shader) == VK_SUCCESS)
{
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
}
else
{
shader = VK_NULL_HANDLE;
g_free (shader);
return VK_NULL_HANDLE;
}
g_bytes_unref (bytes);
return shader;
return *shader;
}
#else /* GDK_RENDERING_VULKAN */
+2 -2
View File
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (self, window);
[window setOpaque:NO];
[window setBackgroundColor:[NSColor clearColor]];
[window setDecorated:NO];
_gdk_macos_surface_set_native (self, window);
frame_clock = _gdk_frame_clock_idle_new ();
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);
+13 -3
View File
@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
GdkRectangle bounds;
GdkRectangle final_rect;
int x, y;
int shadow_left, shadow_right, shadow_top, shadow_bottom;
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
g_assert (layout != NULL);
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
gdk_macos_monitor_get_workarea (monitor, &bounds);
gdk_popup_layout_get_shadow_width (layout,
&shadow_left,
&shadow_right,
&shadow_top,
&shadow_bottom);
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width,
height,
0, 0, 0, 0, /* shadow-left/right/top/bottom */
shadow_left,
shadow_right,
shadow_top,
shadow_bottom,
monitor,
&bounds,
self->layout,
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
[window setOpaque:NO];
[window setBackgroundColor:[NSColor clearColor]];
[window setDecorated:NO];
[window setExcludedFromWindowsMenu:YES];
[window setLevel:NSPopUpMenuWindowLevel];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
GDK_END_MACOS_ALLOC_POOL;
+2 -2
View File
@@ -591,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
/* Allow NSWindow to go fullscreen */
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
frame_clock = _gdk_frame_clock_idle_new ();
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);
+1 -1
View File
@@ -128,8 +128,8 @@ install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
gdk_sources = gdk_public_sources + gdk_deprecated_sources
gdk_private_h_sources = files([
'gdkeventsprivate.h',
'gdkdevicetoolprivate.h',
'gdkeventsprivate.h',
'gdkhslaprivate.h',
'gdkmonitorprivate.h',
'gdkseatdefaultprivate.h',
+8
View File
@@ -97,6 +97,7 @@
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define OUTPUT_VERSION 3
#define XDG_WM_DIALOG_VERSION 1
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
#define XDG_WM_BASE_VERSION 6
@@ -382,6 +383,13 @@ gdk_registry_handle_global (void *data,
{
display_wayland->zxdg_shell_v6_id = id;
}
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
{
display_wayland->xdg_wm_dialog =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_wm_dialog_v1_interface,
MIN (version, XDG_WM_DIALOG_VERSION));
}
else if (strcmp (interface, "gtk_shell1") == 0)
{
display_wayland->gtk_shell =
+2
View File
@@ -41,6 +41,7 @@
#include <gdk/wayland/viewporter-client-protocol.h>
#include <gdk/wayland/presentation-time-client-protocol.h>
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
@@ -102,6 +103,7 @@ struct _GdkWaylandDisplay
DmabufFormatsInfo *dmabuf_formats_info;
struct xdg_wm_base *xdg_wm_base;
struct zxdg_shell_v6 *zxdg_shell_v6;
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
struct gtk_shell1 *gtk_shell;
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
+35 -2
View File
@@ -37,6 +37,7 @@
#include <wayland/presentation-time-client-protocol.h>
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
#include <wayland/xdg-dialog-v1-client-protocol.h>
#include <stdlib.h>
#include <stdio.h>
@@ -84,6 +85,7 @@ struct _GdkWaylandToplevel
struct gtk_surface1 *gtk_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
struct xdg_dialog_v1 *xdg_dialog;
} display_server;
GdkWaylandToplevel *transient_for;
@@ -205,6 +207,7 @@ gdk_wayland_toplevel_clear_saved_size (GdkWaylandToplevel *toplevel)
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
static gboolean maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel);
static void
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
@@ -215,6 +218,7 @@ gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
g_clear_pointer (&toplevel->display_server.xdg_dialog, xdg_dialog_v1_destroy);
if (toplevel->display_server.gtk_surface)
{
@@ -877,7 +881,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
maybe_set_gtk_surface_modal (wayland_toplevel);
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
maybe_set_gtk_surface_modal (wayland_toplevel);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (wayland_surface->display_server.wl_surface);
@@ -1089,12 +1094,40 @@ maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel)
}
static gboolean
maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (wayland_toplevel)));
if (!display_wayland->xdg_wm_dialog)
return FALSE;
if (!is_realized_toplevel (GDK_WAYLAND_SURFACE (wayland_toplevel)))
return FALSE;
if (!wayland_toplevel->display_server.xdg_dialog)
{
wayland_toplevel->display_server.xdg_dialog =
xdg_wm_dialog_v1_get_xdg_dialog (display_wayland->xdg_wm_dialog,
wayland_toplevel->display_server.xdg_toplevel);
}
if (GDK_SURFACE (wayland_toplevel)->modal_hint)
xdg_dialog_v1_set_modal (wayland_toplevel->display_server.xdg_dialog);
else
xdg_dialog_v1_unset_modal (wayland_toplevel->display_server.xdg_dialog);
return TRUE;
}
static void
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
gboolean modal)
{
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
maybe_set_gtk_surface_modal (wayland_toplevel);
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
maybe_set_gtk_surface_modal (wayland_toplevel);
}
void
+121 -24
View File
@@ -48,36 +48,133 @@ gdk_wayland_deps = [
wlegldep,
]
wlmod = import('unstable-wayland')
# Fields:
# - name: protocol name
# - stability: protocol stability ('private', 'stable' or 'unstable')
# - version: protocol version
# - required: wayland_protocols version check
proto_sources = [
'protocol/gtk-shell.xml',
'protocol/server-decoration.xml',
wlmod.find_protocol('primary-selection', state: 'unstable', version: 1),
wlmod.find_protocol('pointer-gestures', state: 'unstable', version: 1),
wlmod.find_protocol('viewporter', state: 'stable'),
wlmod.find_protocol('xdg-shell', state: 'unstable', version: 6),
wlmod.find_protocol('xdg-shell', state: 'stable'),
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 2),
wlmod.find_protocol('tablet', state: 'unstable', version: 2),
wlmod.find_protocol('keyboard-shortcuts-inhibit', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-output', state: 'unstable', version: 1),
wlmod.find_protocol('idle-inhibit', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-activation', state: 'staging', version: 1),
wlmod.find_protocol('fractional-scale', state: 'staging', version: 1),
wlmod.find_protocol('linux-dmabuf', state: 'unstable', version: 1),
wlmod.find_protocol('presentation-time', state: 'stable'),
wlmod.find_protocol('single-pixel-buffer', state: 'staging', version: 1),
{
'name': 'gtk-shell',
'stability': 'private',
},
{
'name': 'primary-selection',
'stability': 'unstable',
'version': 1,
},
{
'name': 'pointer-gestures',
'stability': 'unstable',
'version': 1,
},
{
'name': 'viewporter',
'stability': 'stable',
},
{
'name': 'xdg-shell',
'stability': 'unstable',
'version': 6,
},
{
'name': 'xdg-shell',
'stability': 'stable',
},
{
'name': 'xdg-foreign',
'stability': 'unstable',
'version': 1,
},
{
'name': 'xdg-foreign',
'stability': 'unstable',
'version': 2,
},
{
'name': 'tablet',
'stability': 'unstable',
'version': 2,
},
{
'name': 'keyboard-shortcuts-inhibit',
'stability': 'unstable',
'version': 1,
},
{
'name': 'server-decoration',
'stability': 'private',
},
{
'name': 'xdg-output',
'stability': 'unstable',
'version': 1,
},
{
'name': 'idle-inhibit',
'stability': 'unstable',
'version': 1,
},
{
'name': 'xdg-activation',
'stability': 'staging',
'version': 1,
},
{
'name': 'fractional-scale',
'stability': 'staging',
'version': 1,
},
{
'name': 'linux-dmabuf',
'stability': 'unstable',
'version': 1,
},
{
'name': 'presentation-time',
'stability': 'stable',
'version': 1,
},
{
'name': 'single-pixel-buffer',
'stability': 'staging',
'version': 1,
},
{
'name': 'xdg-dialog',
'stability': 'staging',
'version': 1,
},
]
gdk_wayland_gen_headers = []
wlmod = import('unstable-wayland')
foreach p: proto_sources
# Returns a list [.c, .h]
gen = wlmod.scan_xml(p)
assert(gen.length() == 2)
gdk_wayland_sources += gen[0]
gdk_wayland_gen_headers += gen[1]
if wlprotocolsdep.version().version_compare(p.get('required', '>=0'))
if p.get('stability') == 'private'
if (p.has_key('version'))
proto_file = 'protocol/@0@-v@1@.xml'.format(p.get('name'), p.get('version'))
else
proto_file = 'protocol/@0@.xml'.format(p.get('name'))
endif
elif p.get('stability') == 'stable'
proto_file = wlmod.find_protocol(p.get('name'),
state: p.get('stability'),
)
else
proto_file = wlmod.find_protocol(p.get('name'),
state: p.get('stability'),
version: p.get('version'),
)
endif
# Returns a list [.c, .h]
gen = wlmod.scan_xml(proto_file)
assert(gen.length() == 2)
gdk_wayland_sources += gen[0]
gdk_wayland_gen_headers += gen[1]
endif
endforeach
libgdk_wayland = static_library('gdk-wayland',
+18 -18
View File
@@ -1408,7 +1408,7 @@ register_clipboard_notification ()
WNDCLASS wclass = { 0, };
ATOM klass;
wclass.lpszClassName = "GdkClipboardNotification";
wclass.lpszClassName = L"GdkClipboardNotification";
wclass.lpfnWndProc = _clipboard_window_procedure;
wclass.hInstance = this_module ();
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
@@ -1506,9 +1506,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
GdkWin32ContentFormatPair fmt;
HMODULE user32;
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
user32 = LoadLibrary ("user32.dll");
user32 = LoadLibrary (L"user32.dll");
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
FreeLibrary (user32);
@@ -1557,21 +1557,21 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
* the lead and map the GDK contentformat "image/png" to the clipboard
* format name "PNG" etc.
*/
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormatA ("PNG");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormatA ("JFIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormatA ("GIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormat (L"PNG");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormat (L"JFIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormat (L"GIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormatA ("UniformResourceLocatorW");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormatA ("HTML Format");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormatA ("text/html");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormat (L"UniformResourceLocatorW");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormat (CFSTR_SHELLIDLIST);
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormat (L"HTML Format");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormat (L"text/html");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormatA ("image/png");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormatA ("image/jpeg");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormatA ("image/bmp");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormatA ("image/gif");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormatA ("text/uri-list");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormatA ("text/plain;charset=utf-8");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormat (L"image/png");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormat (L"image/jpeg");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormat (L"image/bmp");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormat (L"image/gif");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormat (L"text/uri-list");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormat (L"text/plain;charset=utf-8");
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
@@ -2364,9 +2364,9 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
* check?
*/
(IsClipboardFormatAvailable
(RegisterClipboardFormatA ("application/x-moz-nativeimage")) ||
(RegisterClipboardFormat (L"application/x-moz-nativeimage")) ||
IsClipboardFormatAvailable
(RegisterClipboardFormatA ("UniformResourceLocatorW"))) &&
(RegisterClipboardFormat (L"UniformResourceLocatorW"))) &&
#endif
TRUE)
{
+36 -35
View File
@@ -31,12 +31,13 @@
static struct {
char *name;
char *id;
const wchar_t *id;
} default_cursors[] = {
/* -- Win32 cursor names: -- */
{ "appstarting", IDC_APPSTARTING },
{ "arrow", IDC_ARROW },
{ "cross", IDC_CROSS },
{ "dnd-move", IDC_ARROW },
{ "hand", IDC_HAND },
{ "help", IDC_HELP },
{ "ibeam", IDC_IBEAM },
@@ -456,32 +457,32 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
result = gdk_win32_hcursor_new (display,
LoadImageA (NULL,
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (NULL,
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
result = gdk_win32_hcursor_new (display,
LoadImageA (GetModuleHandle (NULL),
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (GetModuleHandle (NULL),
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
result = gdk_win32_hcursor_new (display,
LoadImageA (this_module (),
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (this_module (),
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_CREATE:
@@ -498,12 +499,12 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
}
static Win32Cursor *
win32_cursor_new (GdkWin32CursorLoadType load_type,
gpointer resource_name,
int width,
int height,
guint load_flags,
int xcursor_number)
win32_cursor_new (GdkWin32CursorLoadType load_type,
wchar_t *resource_name,
int width,
int height,
guint load_flags,
int xcursor_number)
{
Win32Cursor *result;
@@ -631,9 +632,9 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
/* Prefer W32 cursors */
if (cursors[i].builtin)
shared_hcursor = LoadImageA (NULL, cursors[i].builtin, IMAGE_CURSOR,
size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
shared_hcursor = LoadImage (NULL, cursors[i].builtin, IMAGE_CURSOR,
size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
/* Fall back to X cursors, but only if we've got no theme cursor */
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
@@ -645,7 +646,7 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
DestroyCursor (x_hcursor);
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
(gpointer) cursors[i].builtin,
(wchar_t*) cursors[i].builtin,
size,
size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
@@ -660,14 +661,14 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
if (default_cursors[i].name == NULL)
break;
shared_hcursor = LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
shared_hcursor = LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
if (shared_hcursor == NULL)
continue;
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
(gpointer) default_cursors[i].id,
(wchar_t*) default_cursors[i].id,
size,
size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
@@ -779,8 +780,8 @@ win32hcursor_idc_from_name (GdkWin32Display *display,
continue;
return gdk_win32_hcursor_new (display,
LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE),
LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE),
FALSE);
}
@@ -884,7 +885,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
/* Allow to load named cursor resources linked into the executable.
* Cursors obtained with LoadCursor() cannot be destroyed.
*/
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
return gdk_win32_hcursor_new (display, LoadCursorA (hinstance, name), FALSE);
}
static HICON
+5 -5
View File
@@ -121,7 +121,7 @@ gdk_device_manager_win32_finalize (GObject *object)
#if DEBUG_WINTAB
static void
print_lc(LOGCONTEXT *lc)
print_lc(LOGCONTEXTA *lc)
{
g_print ("lcName = %s\n", lc->lcName);
g_print ("lcOptions =");
@@ -374,13 +374,13 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
wintab_contexts = NULL;
n = GetSystemDirectory (&dummy, 0);
n = GetSystemDirectoryA (&dummy, 0);
if (n <= 0)
return;
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
k = GetSystemDirectory (wintab32_dll_path, n);
k = GetSystemDirectoryA (wintab32_dll_path, n);
if (k == 0 || k > n)
{
@@ -392,7 +392,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
strcat (wintab32_dll_path, WINTAB32_DLL);
if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL)
if ((wintab32 = LoadLibraryA (wintab32_dll_path)) == NULL)
return;
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
@@ -433,7 +433,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
for (devix = 0; devix < ndevices; devix++)
{
LOGCONTEXT lc;
LOGCONTEXTA lc;
/* We open the Wintab device (hmm, what if there are several, or
* can there even be several, probably not?) as a system
+2 -2
View File
@@ -480,7 +480,7 @@ register_display_change_notification (GdkDisplay *display)
WNDCLASS wclass = { 0, };
ATOM klass;
wclass.lpszClassName = "GdkDisplayChange";
wclass.lpszClassName = L"GdkDisplayChange";
wclass.lpfnWndProc = display_change_window_procedure;
wclass.hInstance = this_module ();
wclass.style = CS_OWNDC;
@@ -606,7 +606,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
window_station_name = "WinSta0";
}
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
session_id = 0;
+1
View File
@@ -134,6 +134,7 @@ struct _GdkWin32Display
guint hasWglEXTSwapControl : 1;
guint hasWglOMLSyncControl : 1;
guint hasWglARBPixelFormat : 1;
guint force_enable_depth_bits : 1;
#ifdef HAVE_EGL
guint hasEglKHRCreateContext : 1;
+1 -1
View File
@@ -658,7 +658,7 @@ _gdk_win32_dnd_thread_main (gpointer data)
/* Create a message queue */
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
/* Signal the main thread that we're ready.
* This is the only time the queue works in reverse.
+3 -3
View File
@@ -419,7 +419,7 @@ set_up_low_level_keyboard_hook (void)
else
WIN32_API_FAILED ("SetWindowsHookEx");
aerosnap_message = RegisterWindowMessage ("GDK_WIN32_AEROSNAP_MESSAGE");
aerosnap_message = RegisterWindowMessage (L"GDK_WIN32_AEROSNAP_MESSAGE");
}
void
@@ -470,7 +470,7 @@ _gdk_events_init (GdkDisplay *display)
};
#endif
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
#if 0
/* Check if we have some input locale identifier loaded that uses a
@@ -1685,7 +1685,7 @@ _gdk_win32_surface_fill_min_max_info (GdkSurface *window,
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
nearest_info.cbSize = sizeof (nearest_info);
if (GetMonitorInfoA (nearest_monitor, &nearest_info))
if (GetMonitorInfo (nearest_monitor, &nearest_info))
{
/* MSDN says that we must specify maximized window
* size as if it was located on the primary monitor.
+21 -7
View File
@@ -142,8 +142,7 @@ get_wgl_pfd (HDC hdc,
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
if (display_win32 != NULL &&
display_win32->hasWglARBPixelFormat)
if (display_win32->hasWglARBPixelFormat)
{
UINT num_formats;
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
@@ -176,15 +175,18 @@ get_wgl_pfd (HDC hdc,
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
pixelAttribs[i++] = 8;
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
pixelAttribs[i++] = 0;
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
pixelAttribs[i++] = 0;
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
pixelAttribs[i++] = 0;
if (!display_win32->force_enable_depth_bits)
{
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
pixelAttribs[i++] = 0;
}
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
pixelAttribs[i++] = 0; /* end of pixelAttribs */
@@ -215,8 +217,20 @@ get_wgl_pfd (HDC hdc,
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
pfd->cAlphaBits = 8;
pfd->iLayerType = PFD_MAIN_PLANE;
pfd->cAccumBits = 0;
pfd->cStencilBits = 0;
if (!display_win32->force_enable_depth_bits)
pfd->cDepthBits = 0;
best_pf = ChoosePixelFormat (hdc, pfd);
/* try again if driver enforces depth buffers */
if (best_pf == 0 && !display_win32->force_enable_depth_bits)
{
display_win32->force_enable_depth_bits = TRUE;
get_wgl_pfd (hdc, pfd, display_win32);
}
}
return best_pf;
@@ -234,7 +248,7 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, NULL);
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, display_win32);
if (best_idx != 0)
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
@@ -269,7 +283,7 @@ create_dummy_gl_window (void)
ATOM klass;
HWND hwnd = NULL;
wclass.lpszClassName = "GdkGLDummyWindow";
wclass.lpszClassName = L"GdkGLDummyWindow";
wclass.lpfnWndProc = DefWindowProc;
wclass.hInstance = this_module ();
wclass.style = CS_OWNDC;
+2 -2
View File
@@ -730,7 +730,7 @@ _gdk_win32_key_to_string (LONG lParam)
char buf[100];
char *keyname_utf8;
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
if (GetKeyNameTextA (lParam, buf, sizeof (buf)) &&
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
{
char *retval = static_printf ("%s", keyname_utf8);
@@ -780,7 +780,7 @@ _gdk_win32_cf_to_string (UINT format)
if (format >= CF_PRIVATEFIRST &&
format <= CF_PRIVATELAST)
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
if (GetClipboardFormatName (format, buf, sizeof (buf)))
if (GetClipboardFormatNameA (format, buf, sizeof (buf)))
return static_printf ("'%s'", buf);
else
return static_printf ("unk-%#lx", format);
+1 -1
View File
@@ -197,7 +197,7 @@ typedef struct _Win32Cursor Win32Cursor;
struct _Win32Cursor {
GdkWin32CursorLoadType load_type;
gunichar2 *resource_name;
wchar_t *resource_name;
int width;
int height;
guint load_flags;
+3 -3
View File
@@ -326,7 +326,7 @@ RegisterGdkClass (GType wtype)
static WNDCLASSEXW wcl;
ATOM klass = 0;
wcl.cbSize = sizeof (WNDCLASSEX);
wcl.cbSize = sizeof (WNDCLASSEXW);
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
* on WM_SIZE and WM_MOVE. Flicker, Performance!
*/
@@ -340,7 +340,7 @@ RegisterGdkClass (GType wtype)
/* initialize once! */
if (0 == hAppIcon && 0 == hAppIconSm)
{
char sLoc [MAX_PATH+1];
wchar_t sLoc [MAX_PATH+1];
// try to load first icon of executable program
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
@@ -2064,7 +2064,7 @@ stash_window (GdkSurface *window,
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
hmonitor_info.cbSize = sizeof (hmonitor_info);
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
if (!GetMonitorInfo (hmonitor, &hmonitor_info))
return;
if (impl->snap_stash == NULL)
+1 -1
View File
@@ -1,4 +1,4 @@
static const struct { const char *name; const char *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
static const struct { const char *name; const wchar_t *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
"\125\000\000\125\152\100\001\251\152\220\006\251\152\244\032\251"
"\032\251\152\244\006\252\252\220\001\252\252\100\000\152\251\000"
+2 -2
View File
@@ -127,7 +127,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
@@ -293,7 +293,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
pixel_data = cairo_image_surface_get_data (surface);
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
+1 -1
View File
@@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
pixel_data = surface_data;
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
+9
View File
@@ -41,6 +41,15 @@
#include <gsk/gskroundedrectprivate.h>
#include <gsk/gskrectprivate.h>
/**
* GskGLRenderer:
*
* A GL based renderer.
*
* See [class@Gsk.Renderer].
*
* Since: 4.2
*/
struct _GskGLRendererClass
{
GskRendererClass parent_class;
+4 -1
View File
@@ -70,7 +70,10 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
if (self->sync)
{
glClientWaitSync (self->sync, 0, -1);
g_clear_pointer (&self->sync, glDeleteSync);
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
glDeleteSync (self->sync);
self->sync = NULL;
}
self->next_texture_slot = 0;
+7 -1
View File
@@ -249,7 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data)
gdk_gl_context_make_current (data->context);
g_clear_pointer (&data->sync, glDeleteSync);
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
if (data->sync)
{
glDeleteSync (data->sync);
data->sync = NULL;
}
glDeleteTextures (1, &data->texture_id);
g_object_unref (data->context);
+9
View File
@@ -13,6 +13,15 @@
#include <glib/gi18n-lib.h>
/**
* GskNglRenderer:
*
* A GL based renderer.
*
* See [class@Gsk.Renderer].
*
* Since: 4.2
*/
struct _GskNglRenderer
{
GskGpuRenderer parent_instance;
+24 -11
View File
@@ -81,6 +81,7 @@ struct _PipelineCacheKey
GskGpuShaderClip clip;
GskGpuBlend blend;
VkFormat format;
VkPipeline pipeline;
};
struct _RenderPassCacheKey
@@ -88,6 +89,7 @@ struct _RenderPassCacheKey
VkFormat format;
VkImageLayout from_layout;
VkImageLayout to_layout;
VkRenderPass render_pass;
};
static guint
@@ -297,8 +299,10 @@ gsk_vulkan_pipeline_layout_unref (GskVulkanDevice *self,
g_hash_table_iter_init (&iter, layout->pipeline_cache);
while (g_hash_table_iter_next (&iter, &key, &value))
{
vkDestroyPipeline (display->vk_device,
((PipelineCacheKey *)key)->pipeline,
NULL);
g_free (key);
vkDestroyPipeline (display->vk_device, value, NULL);
}
g_hash_table_unref (layout->pipeline_cache);
@@ -463,8 +467,10 @@ gsk_vulkan_device_finalize (GObject *object)
g_hash_table_iter_init (&iter, self->render_pass_cache);
while (g_hash_table_iter_next (&iter, &key, &value))
{
vkDestroyRenderPass (display->vk_device,
((RenderPassCacheKey *)key)->render_pass,
NULL);
g_free (key);
vkDestroyRenderPass (display->vk_device, value, NULL);
}
g_hash_table_unref (self->render_pass_cache);
@@ -824,6 +830,7 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
VkImageLayout to_layout)
{
RenderPassCacheKey cache_key;
RenderPassCacheKey *cached_result;
VkRenderPass render_pass;
GdkDisplay *display;
@@ -832,9 +839,9 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
.from_layout = from_layout,
.to_layout = to_layout,
};
render_pass = g_hash_table_lookup (self->render_pass_cache, &cache_key);
if (render_pass)
return render_pass;
cached_result = g_hash_table_lookup (self->render_pass_cache, &cache_key);
if (cached_result)
return cached_result->render_pass;
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
@@ -878,7 +885,10 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
NULL,
&render_pass);
g_hash_table_insert (self->render_pass_cache, g_memdup (&cache_key, sizeof (RenderPassCacheKey)), render_pass);
cached_result = g_memdup (&cache_key, sizeof (RenderPassCacheKey));
cached_result->render_pass = render_pass;
g_hash_table_insert (self->render_pass_cache, cached_result, cached_result);
return render_pass;
}
@@ -946,6 +956,7 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
VkRenderPass render_pass)
{
PipelineCacheKey cache_key;
PipelineCacheKey *cached_result;
VkPipeline pipeline;
GdkDisplay *display;
const char *version_string;
@@ -961,9 +972,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
.blend = blend,
.format = format,
};
pipeline = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
if (pipeline)
return pipeline;
cached_result = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
if (cached_result)
return cached_result->pipeline;
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
if (gsk_vulkan_device_has_feature (self, GDK_VULKAN_FEATURE_DYNAMIC_INDEXING) &&
@@ -1153,7 +1164,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
g_free (fragment_shader_name);
g_free (vertex_shader_name);
g_hash_table_insert (layout->pipeline_cache, g_memdup (&cache_key, sizeof (PipelineCacheKey)), pipeline);
cached_result = g_memdup (&cache_key, sizeof (PipelineCacheKey));
cached_result->pipeline = pipeline;
g_hash_table_insert (layout->pipeline_cache, cached_result, cached_result);
gdk_display_vulkan_pipeline_cache_updated (display);
return pipeline;
@@ -1261,7 +1274,7 @@ gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
g_assert (found < properties.memoryTypeCount);
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, i, &properties.memoryTypes[i]));
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, found, &properties.memoryTypes[found]));
}
GskVulkanAllocator *
+2 -2
View File
@@ -178,7 +178,7 @@ gsk_vulkan_buddy_allocator_alloc (GskVulkanAllocator *allocator,
if (self->cache.vk_memory)
{
*alloc = self->cache;
self->cache.vk_memory = NULL;
self->cache.vk_memory = VK_NULL_HANDLE;
}
else
{
@@ -240,7 +240,7 @@ restart:
alloc->size <<= 1;
if (slot == 0)
{
if (self->cache.vk_memory == NULL)
if (self->cache.vk_memory == VK_NULL_HANDLE)
self->cache = *alloc;
else
gsk_vulkan_free (self->allocator, alloc);
+1 -1
View File
@@ -439,7 +439,7 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
object_class->constructed = gsk_gl_shader_constructed;
/**
* GskGLShader:sourcecode: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
* GskGLShader:source: (attributes org.gtk.Property.get=gsk_gl_shader_get_source)
*
* The source code for the shader, as a `GBytes`.
*/
+1
View File
@@ -387,6 +387,7 @@ gsk_path_builder_add_reverse_path (GskPathBuilder *self,
/**
* gsk_path_builder_add_cairo_path:
* @self: a `GskPathBuilder`
* @path: a path
*
* Adds a Cairo path to the builder.
*
+18
View File
@@ -51,6 +51,16 @@ G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
gsk_path_point_copy,
gsk_path_point_free)
/**
* gsk_path_point_copy:
* @point: a path point
*
* Copies a path point.
*
* Returns: the copied point
*
* Since: 4.14
*/
GskPathPoint *
gsk_path_point_copy (GskPathPoint *point)
{
@@ -63,6 +73,14 @@ gsk_path_point_copy (GskPathPoint *point)
return copy;
}
/**
* gsk_path_point_free:
* @point: a path point
*
* Frees a path point copied by [method@Gsk.PathPoint.copy].
*
* Since: 4.14
*/
void
gsk_path_point_free (GskPathPoint *point)
{
+7
View File
@@ -48,6 +48,13 @@
#include <gobject/gvaluecollector.h>
/**
* gsk_serialization_error_quark:
*
* Registers an error quark for [class@Gsk.RenderNode] errors.
*
* Returns: the error quark
**/
G_DEFINE_QUARK (gsk-serialization-error-quark, gsk_serialization_error)
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
+3 -14
View File
@@ -3232,17 +3232,6 @@ append_rounded_rect (GString *str,
}
}
static void
append_rgba (GString *str,
const GdkRGBA *rgba)
{
char *rgba_str = gdk_rgba_to_string (rgba);
g_string_append (str, rgba_str);
g_free (rgba_str);
}
static void
append_point (GString *str,
const graphene_point_t *p)
@@ -3288,7 +3277,7 @@ append_rgba_param (Printer *p,
{
_indent (p);
g_string_append_printf (p->str, "%s: ", param_name);
append_rgba (p->str, value);
gdk_rgba_print (value, p->str);
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
}
@@ -3442,7 +3431,7 @@ append_stops_param (Printer *p,
string_append_double (p->str, stops[i].offset);
g_string_append_c (p->str, ' ');
append_rgba (p->str, &stops[i].color);
gdk_rgba_print (&stops[i].color, p->str);
}
g_string_append (p->str, ";\n");
}
@@ -4068,7 +4057,7 @@ render_node_print (Printer *p,
{
if (i > 0)
g_string_append_c (p->str, ' ');
append_rgba (p->str, &colors[i]);
gdk_rgba_print (&colors[i], p->str);
}
g_string_append (p->str, ";\n");
}
+4
View File
@@ -354,6 +354,8 @@ gsk_stroke_set_miter_limit (GskStroke *self,
*
* Returns the miter limit of a `GskStroke`.
*
* Returns: the miter limit
*
* Since: 4.14
*/
float
@@ -478,6 +480,8 @@ gsk_stroke_set_dash_offset (GskStroke *self,
*
* Returns the dash_offset of a `GskStroke`.
*
* Returns: the dash_offset
*
* Since: 4.14
*/
float
+1 -1
View File
@@ -2023,7 +2023,7 @@ GskTransformCategory
return self->category;
}
/*
/**
* gsk_transform_new: (constructor):
*
* Creates a new identity transform.
+14
View File
@@ -21,12 +21,26 @@
#include "gtkcsserror.h"
/**
* gtk_css_parser_error_quark:
*
* Registers an error quark for CSS parsing errors.
*
* Returns: the error quark
**/
GQuark
gtk_css_parser_error_quark (void)
{
return g_quark_from_static_string ("gtk-css-parser-error-quark");
}
/**
* gtk_css_parser_warning_quark:
*
* Registers an error quark for CSS parsing warnings.
*
* Returns: the warning quark
**/
GQuark
gtk_css_parser_warning_quark (void)
{
+5
View File
@@ -27,6 +27,11 @@ G_BEGIN_DECLS
typedef struct _GtkCssLocation GtkCssLocation;
/**
* GtkCssLocation:
*
* A description of a location inside a CSS stream.
*/
struct _GtkCssLocation
{
gsize bytes;
+23 -16
View File
@@ -26,6 +26,10 @@
#include "gtkcsserror.h"
#include "gtkcsslocationprivate.h"
/* We cannot include gtkdebug.h, so we must keep this in sync */
extern unsigned int gtk_get_debug_flags (void);
#define DEBUG_CHECK_CSS ((gtk_get_debug_flags () & GTK_CSS_PARSER_DEBUG_CSS) != 0)
static void clear_ref (GtkCssVariableValueReference *ref);
#define GDK_ARRAY_NAME gtk_css_parser_references
@@ -626,7 +630,7 @@ void
gtk_css_parser_skip (GtkCssParser *self)
{
const GtkCssToken *token;
token = gtk_css_parser_get_token (self);
if (gtk_css_token_is_preserved (token, NULL))
{
@@ -659,7 +663,7 @@ gtk_css_parser_skip_until (GtkCssParser *self,
GtkCssTokenType token_type)
{
const GtkCssToken *token;
for (token = gtk_css_parser_get_token (self);
!gtk_css_token_is (token, token_type) &&
!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF);
@@ -817,19 +821,22 @@ gtk_css_parser_warn_deprecated (GtkCssParser *self,
const char *format,
...)
{
va_list args;
GError *error;
if (DEBUG_CHECK_CSS)
{
va_list args;
GError *error;
va_start (args, format);
error = g_error_new_valist (GTK_CSS_PARSER_WARNING,
GTK_CSS_PARSER_WARNING_DEPRECATED,
format, args);
gtk_css_parser_emit_error (self,
gtk_css_parser_get_start_location (self),
gtk_css_parser_get_end_location (self),
error);
g_error_free (error);
va_end (args);
va_start (args, format);
error = g_error_new_valist (GTK_CSS_PARSER_WARNING,
GTK_CSS_PARSER_WARNING_DEPRECATED,
format, args);
gtk_css_parser_emit_error (self,
gtk_css_parser_get_start_location (self),
gtk_css_parser_get_end_location (self),
error);
g_error_free (error);
va_end (args);
}
}
gboolean
@@ -1153,7 +1160,7 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
*out_url = gtk_css_parser_consume_string (parser);
if (*out_url == NULL)
return 0;
return 1;
}
@@ -1199,7 +1206,7 @@ gtk_css_parser_consume_url (GtkCssParser *self)
gtk_css_parser_error_syntax (self, "Expected a URL");
return NULL;
}
return url;
}
+4
View File
@@ -172,5 +172,9 @@ void gtk_css_parser_get_expanding_variables (GtkCssParser
char ***names,
gsize *n_variables);
/* We cannot include gtkdebug.h, so we must keep this in sync */
#define GTK_CSS_PARSER_DEBUG_CSS (1 << 20)
G_END_DECLS
+27 -1
View File
@@ -53,6 +53,21 @@ gtk_css_section_new (GFile *file,
return gtk_css_section_new_with_bytes (file, NULL,start, end);
}
/**
* gtk_css_section_new_with_bytes: (constructor)
* @file: (nullable) (transfer none): The file this section refers to
* @bytes: (nullable) (transfer none): The bytes this sections refers to
* @start: The start location
* @end: The end location
*
* Creates a new `GtkCssSection` referring to the section
* in the given `file` or the given `bytes` from the `start` location to the
* `end` location.
*
* Returns: (transfer full): a new `GtkCssSection`
*
* Since: 4.16
**/
GtkCssSection *
gtk_css_section_new_with_bytes (GFile *file,
GBytes *bytes,
@@ -165,6 +180,17 @@ gtk_css_section_get_file (const GtkCssSection *section)
return section->file;
}
/**
* gtk_css_section_get_bytes:
* @section: the section
*
* Gets the bytes that @section was parsed from.
*
* Returns: (transfer none) (nullable): the `GBytes` from which the `section`
* was parsed
*
* Since: 4.16
**/
GBytes *
gtk_css_section_get_bytes (const GtkCssSection *section)
{
@@ -242,7 +268,7 @@ gtk_css_section_print (const GtkCssSection *section,
g_string_append (string, "<data>");
}
g_string_append_printf (string, ":%zu:%zu",
g_string_append_printf (string, ":%zu:%zu",
section->start_location.lines + 1,
section->start_location.line_chars + 1);
if (section->start_location.lines != section->end_location.lines ||
+5
View File
@@ -689,6 +689,11 @@ gtk_cell_renderer_progress_class_init (GtkCellRendererProgressClass *klass)
PROP_ORIENTATION,
"orientation");
/**
* GtkCellRendererProgress:inverted:
*
* Whether progess is inverted.
*/
g_object_class_install_property (object_class,
PROP_INVERTED,
g_param_spec_boolean ("inverted", NULL, NULL,
+2 -1
View File
@@ -175,7 +175,8 @@ gtk_cell_renderer_spinner_class_init (GtkCellRendererSpinnerClass *klass)
cell_class->get_preferred_height = gtk_cell_renderer_spinner_get_preferred_height;
cell_class->snapshot = gtk_cell_renderer_spinner_snapshot;
/* GtkCellRendererSpinner:active:
/**
* GtkCellRendererSpinner:active:
*
* Whether the spinner is active (ie. shown) in the cell
*/
+2
View File
@@ -512,6 +512,8 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
* This is an [keybinding signal](class.SignalAction.html).
*
* The default bindings for this signal are Alt+Up and Escape.
*
* Returns: whether the combo box was popped down
*/
combo_box_signals[POPDOWN] =
g_signal_new_class_handler (I_("popdown"),
+10
View File
@@ -297,11 +297,21 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
NULL,
G_TYPE_NONE, 0);
/**
* GtkEntryCompletion:model:
*
* The model used as data source.
*/
entry_completion_props[PROP_MODEL] =
g_param_spec_object ("model", NULL, NULL,
GTK_TYPE_TREE_MODEL,
GTK_PARAM_READWRITE);
/**
* GtkEntryCompletion:minimum-key-length:
*
* The minimum key length as set for completion.
*/
entry_completion_props[PROP_MINIMUM_KEY_LENGTH] =
g_param_spec_int ("minimum-key-length", NULL, NULL,
0, G_MAXINT, 1,
+15
View File
@@ -410,6 +410,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
-1, G_MAXINT, -1,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkIconView:model:
*
* The model of the icon view.
*/
g_object_class_install_property (gobject_class,
PROP_MODEL,
g_param_spec_object ("model", NULL, NULL,
@@ -516,6 +521,12 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
FALSE,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkIconView:tooltip-column:
*
* The column of the icon view model which is being used for displaying
* tooltips on it's rows.
*/
g_object_class_install_property (gobject_class,
PROP_TOOLTIP_COLUMN,
g_param_spec_int ("tooltip-column", NULL, NULL,
@@ -712,6 +723,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
* programmatically.
*
* The default bindings for this signal are Space, Return and Enter.
*
* Returns: whether the item was activated
*/
icon_view_signals[ACTIVATE_CURSOR_ITEM] =
g_signal_new (I_("activate-cursor-item"),
@@ -747,6 +760,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
* - PageUp/PageDown which move by "pages"
* All of these will extend the selection when combined with
* the Shift modifier.
*
* Returns: whether the cursor was moved
*/
icon_view_signals[MOVE_CURSOR] =
g_signal_new (I_("move-cursor"),
+1 -1
View File
@@ -62,7 +62,7 @@ struct _GtkMessageDialog
*
* > Please note that %GTK_BUTTONS_OK, %GTK_BUTTONS_YES_NO
* > and %GTK_BUTTONS_OK_CANCEL are discouraged by the
* > [GNOME Human Interface Guidelines](http://library.gnome.org/devel/hig-book/stable/).
* > [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/).
*/
typedef enum
{
+2 -3
View File
@@ -99,7 +99,6 @@ window_handle_exported (GtkWindow *window,
* a given uri.
*
* The @callback will be called when the launch is completed.
* It should call gtk_show_uri_full_finish() to obtain the result.
*
* This is the recommended call to be used as it passes information
* necessary for sandbox helpers to parent their dialogs properly.
@@ -153,8 +152,8 @@ gtk_show_uri_full (GtkWindow *parent,
* Returns: %TRUE if the URI was shown successfully.
* Otherwise, %FALSE is returned and @error is set
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] or
* [method@Gtk.UriLauncher.launch_finish] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
* [method@Gtk.UriLauncher.launch] instead
*/
gboolean
gtk_show_uri_full_finish (GtkWindow *parent,
+7 -2
View File
@@ -122,6 +122,11 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
object_class->set_property = gtk_style_context_impl_set_property;
object_class->get_property = gtk_style_context_impl_get_property;
/**
* GtkStyleContext:display:
*
* The display of the style context.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
GDK_TYPE_DISPLAY,
@@ -928,10 +933,10 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
style = gtk_style_context_lookup_style (context);
if (primary_color)
*primary_color = *gtk_css_color_value_get_rgba (style->used->caret_color);
*primary_color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
if (secondary_color)
*secondary_color = *gtk_css_color_value_get_rgba (style->used->secondary_caret_color);
*secondary_color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? style->font->secondary_caret_color : style->core->color);
}
/**
+10
View File
@@ -527,12 +527,22 @@ gtk_tree_model_filter_class_init (GtkTreeModelFilterClass *filter_class)
filter_class->visible = gtk_tree_model_filter_real_visible;
filter_class->modify = gtk_tree_model_filter_real_modify;
/**
* GtkTreeModelFilter:child-model:
*
* The child model of the tree model filter.
*/
g_object_class_install_property (object_class,
PROP_CHILD_MODEL,
g_param_spec_object ("child-model", NULL, NULL,
GTK_TYPE_TREE_MODEL,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* GtkTreeModelFilter:virtual-root:
*
* The virtual root of the tree model filter.
*/
g_object_class_install_property (object_class,
PROP_VIRTUAL_ROOT,
g_param_spec_boxed ("virtual-root", NULL, NULL,
+6
View File
@@ -479,6 +479,12 @@ gtk_tree_model_sort_class_init (GtkTreeModelSortClass *class)
object_class->finalize = gtk_tree_model_sort_finalize;
/* Properties */
/**
* GtkTreeModelSort:model:
*
* The model of the tree model sort.
*/
g_object_class_install_property (object_class,
PROP_MODEL,
g_param_spec_object ("model", NULL, NULL,
+2 -2
View File
@@ -356,7 +356,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
style = gtk_css_node_get_style (node);
fg_rgba = gtk_css_color_value_get_rgba (style->used->color);
fg_rgba = gtk_css_color_value_get_rgba (style->core->color);
}
else if (crenderer->state == GSK_PANGO_RENDERER_CURSOR && gtk_widget_has_focus (crenderer->widget))
{
@@ -365,7 +365,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
node = gtk_widget_get_css_node (crenderer->widget);
style = gtk_css_node_get_style (node);
fg_rgba = gtk_css_color_value_get_rgba (style->used->background_color);
fg_rgba = gtk_css_color_value_get_rgba (style->background->background_color);
}
else
fg_rgba = appearance->fg_rgba;
+10 -11
View File
@@ -1129,7 +1129,7 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
}
/**
* gtk_about_dialog_get_comments: (attributes org.gtk.Method.set_property=comments)
* gtk_about_dialog_get_comments: (attributes org.gtk.Method.get_property=comments)
* @about: a `GtkAboutDialog`
*
* Returns the comments string.
@@ -1696,12 +1696,12 @@ follow_if_link (GtkAboutDialog *about,
if (uri && !g_ptr_array_find_with_equal_func (about->visited_links, uri, (GCompareFunc)strcmp, NULL))
{
const GdkRGBA *visited_link_color;
GdkRGBA visited_link_color;
GtkCssStyle *style;
style = gtk_css_node_get_style (about->visited_link_node);
visited_link_color = gtk_css_color_value_get_rgba (style->used->color);
g_object_set (G_OBJECT (tag), "foreground-rgba", visited_link_color, NULL);
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
g_ptr_array_add (about->visited_links, g_strdup (uri));
}
@@ -1836,18 +1836,17 @@ text_buffer_new (GtkAboutDialog *about,
char **p;
char *q0, *q1, *q2, *r1, *r2;
GtkTextBuffer *buffer;
const GdkRGBA *color;
const GdkRGBA *link_color;
const GdkRGBA *visited_link_color;
GdkRGBA color;
GdkRGBA link_color;
GdkRGBA visited_link_color;
GtkTextIter start_iter, end_iter;
GtkTextTag *tag;
GtkCssStyle *style;
style = gtk_css_node_get_style (about->link_node);
link_color = gtk_css_color_value_get_rgba (style->used->color);
link_color = *gtk_css_color_value_get_rgba (style->core->color);
style = gtk_css_node_get_style (about->visited_link_node);
visited_link_color = gtk_css_color_value_get_rgba (style->used->color);
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
buffer = gtk_text_buffer_new (NULL);
@@ -1908,7 +1907,7 @@ text_buffer_new (GtkAboutDialog *about,
color = link_color;
tag = gtk_text_buffer_create_tag (buffer, NULL,
"foreground-rgba", color,
"foreground-rgba", &color,
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
if (strcmp (link_type, "email") == 0)
+2
View File
@@ -505,6 +505,8 @@ out:
*
* If the parse operation fails, @accelerator_key and @accelerator_mods will
* be set to 0 (zero).
*
* Returns: whether parsing succeeded
*/
gboolean
gtk_accelerator_parse (const char *accelerator,
+11
View File
@@ -56,10 +56,21 @@ G_DEFINE_INTERFACE (GtkActionable, gtk_actionable, GTK_TYPE_WIDGET)
static void
gtk_actionable_default_init (GtkActionableInterface *iface)
{
/**
* GtkActionable:action-name:
*
* The name of the action with which this widget should be associated.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("action-name", NULL, NULL,
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GtkActionable:action-target:
*
* The target value of the actionable widget's action.
*/
g_object_interface_install_property (iface,
g_param_spec_variant ("action-target", NULL, NULL,
G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+1 -6
View File
@@ -33,8 +33,7 @@
* are needed to present a message to the user.
*
* The message is shown with the [method@Gtk.AlertDialog.choose]
* function. This API follows the GIO async pattern, and the result can
* be obtained by calling [method@Gtk.AlertDialog.choose_finish].
* function.
*
* If you don't need to wait for a button to be clicked, you can use
* [method@Gtk.AlertDialog.show].
@@ -687,10 +686,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
*
* This function shows the alert to the user.
*
* The @callback will be called when the alert is dismissed.
* It should call [method@Gtk.AlertDialog.choose_finish]
* to obtain the result.
*
* It is ok to pass `NULL` for the callback if the alert
* does not have more than one button. A simpler API for
* this case is [method@Gtk.AlertDialog.show].
+7
View File
@@ -2953,6 +2953,13 @@ gtk_builder_get_type_from_name (GtkBuilder *builder,
return type;
}
/**
* gtk_builder_error_quark:
*
* Registers an error quark for [class@Gtk.Builder] errors.
*
* Returns: the error quark
**/
GQuark
gtk_builder_error_quark (void)
{
+3 -4
View File
@@ -434,11 +434,10 @@ gtk_builder_cscope_new (void)
/**
* gtk_builder_cscope_add_callback:
* @self: a `GtkBuilderCScope`
* @callback_symbols: (scope async): The callback pointer
* @scope: a `GtkBuilderCScope`
* @callback: (scope async): The callback pointer
*
* Adds the @callback_symbol to the scope of @builder under its
* own name.
* Adds the @callback to the scope of @builder under its own name.
*
* This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol].
*
+8
View File
@@ -232,6 +232,14 @@ gtk_color_chooser_dialog_class_init (GtkColorChooserDialogClass *class)
g_object_class_override_property (object_class, PROP_RGBA, "rgba");
g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");
/**
* GtkColorChooserDialog:show-editor:
*
* Whether the color chooser dialog is showing the single-color editor.
*
* It can be set to switch the color chooser into single-color editing mode.
*/
g_object_class_install_property (object_class, PROP_SHOW_EDITOR,
g_param_spec_boolean ("show-editor", NULL, NULL,
FALSE, GTK_PARAM_READWRITE));
+1 -7
View File
@@ -36,9 +36,7 @@
* should be modal.
*
* The dialog is shown with the [method@Gtk.ColorDialog.choose_rgba]
* function. This API follows the GIO async pattern, and the
* result can be obtained by calling
* [method@Gtk.ColorDialog.choose_rgba_finish].
* function.
*
* See [class@Gtk.ColorDialogButton] for a convenient control
* that uses `GtkColorDialog` and presents the results.
@@ -436,10 +434,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* This function initiates a color choice operation by
* presenting a color chooser dialog to the user.
*
* The @callback will be called when the dialog is dismissed.
* It should call [method@Gtk.ColorDialog.choose_rgba_finish]
* to obtain the result.
*
* Since: 4.10
*/
void
+198 -1
View File
@@ -32,7 +32,9 @@
#include <math.h>
#include <string.h>
#include "gtkcolorutils.h"
#include "gtkcolorutilsprivate.h"
#include "gdkhslaprivate.h"
#include <math.h>
/* Converts from RGB to HSV */
static void
@@ -226,3 +228,198 @@ gtk_rgb_to_hsv (float r, float g, float b,
if (v)
*v = b;
}
void
gtk_rgb_to_hsl (float red, float green, float blue,
float *hue, float *saturation, float *lightness)
{
GdkHSLA hsla;
_gdk_hsla_init_from_rgba (&hsla, &(GdkRGBA) { red, green, blue, 1.0 });
*hue = hsla.hue;
*saturation = hsla.saturation;
*lightness = hsla.lightness;
}
void
gtk_hsl_to_rgb (float hue, float saturation, float lightness,
float *red, float *green, float *blue)
{
GdkRGBA rgba;
_gdk_rgba_init_from_hsla (&rgba, &(GdkHSLA) { hue, saturation, lightness, 1.0 });
*red = rgba.red;
*green = rgba.green;
*blue = rgba.blue;
}
void
gtk_rgb_to_hwb (float red, float green, float blue,
float *hue, float *white, float *black)
{
GdkRGBA rgba = (GdkRGBA) { red, green, blue, 1 };
GdkHSLA hsla;
_gdk_hsla_init_from_rgba (&hsla, &rgba);
*hue = hsla.hue;
*white = MIN (MIN (red, green), blue);
*black = (1 - MAX (MAX (red, green), blue));
}
void
gtk_hwb_to_rgb (float hue, float white, float black,
float *red, float *green, float *blue)
{
GdkHSLA hsla;
GdkRGBA rgba;
if (white + black >= 1)
{
float gray = white / (white + black);
*red = gray;
*green = gray;
*blue = gray;
return;
}
hsla.hue = hue;
hsla.saturation = 1.0;
hsla.lightness = 0.5;
_gdk_rgba_init_from_hsla (&rgba, &hsla);
*red = rgba.red * (1 - white - black) + white;
*green = rgba.green * (1 - white - black) + white;
*blue = rgba.blue * (1 - white - black) + white;
}
#define DEG_TO_RAD(x) ((x) * G_PI / 180)
#define RAD_TO_DEG(x) ((x) * 180 / G_PI)
static inline void
_sincosf (float angle,
float *out_s,
float *out_c)
{
#ifdef HAVE_SINCOSF
sincosf (angle, out_s, out_c);
#else
*out_s = sinf (angle);
*out_c = cosf (angle);
#endif
}
void
gtk_oklab_to_oklch (float L, float a, float b,
float *L2, float *C, float *H)
{
*L2 = L;
*C = hypotf (a, b);
*H = RAD_TO_DEG (atan2 (b, a));
*H = fmod (*H, 360);
if (*H < 0)
*H += 360;
}
void
gtk_oklch_to_oklab (float L, float C, float H,
float *L2, float *a, float *b)
{
*L2 = L;
_sincosf (DEG_TO_RAD (H), b, a);
*a *= C;
*b *= C;
}
static float
apply_gamma (float v)
{
if (v > 0.0031308)
return 1.055 * pow (v, 1/2.4) - 0.055;
else
return 12.92 * v;
}
static float
unapply_gamma (float v)
{
if (v >= 0.04045)
return pow (((v + 0.055)/(1 + 0.055)), 2.4);
else
return v / 12.92;
}
void
gtk_oklab_to_linear_srgb (float L, float a, float b,
float *red, float *green, float *blue)
{
float l = L + 0.3963377774f * a + 0.2158037573f * b;
float m = L - 0.1055613458f * a - 0.0638541728f * b;
float s = L - 0.0894841775f * a - 1.2914855480f * b;
l = powf (l, 3);
m = powf (m, 3);
s = powf (s, 3);
*red = +4.0767416621f * l - 3.3077115913f * m + 0.2309699292f * s;
*green = -1.2684380046f * l + 2.6097574011f * m - 0.3413193965f * s;
*blue = -0.0041960863f * l - 0.7034186147f * m + 1.7076147010f * s;
}
void
gtk_oklab_to_rgb (float L, float a, float b,
float *red, float *green, float *blue)
{
float linear_red, linear_green, linear_blue;
gtk_oklab_to_linear_srgb (L, a, b, &linear_red, &linear_green, &linear_blue);
gtk_linear_srgb_to_rgb (linear_red, linear_green, linear_blue, red, green, blue);
}
void
gtk_linear_srgb_to_oklab (float red, float green, float blue,
float *L, float *a, float *b)
{
float l = 0.4122214708f * red + 0.5363325363f * green + 0.0514459929f * blue;
float m = 0.2119034982f * red + 0.6806995451f * green + 0.1073969566f * blue;
float s = 0.0883024619f * red + 0.2817188376f * green + 0.6299787005f * blue;
l = cbrtf (l);
m = cbrtf (m);
s = cbrtf (s);
*L = 0.2104542553f*l + 0.7936177850f*m - 0.0040720468f*s;
*a = 1.9779984951f*l - 2.4285922050f*m + 0.4505937099f*s;
*b = 0.0259040371f*l + 0.7827717662f*m - 0.8086757660f*s;
}
void
gtk_rgb_to_oklab (float red, float green, float blue,
float *L, float *a, float *b)
{
float linear_red, linear_green, linear_blue;
gtk_rgb_to_linear_srgb (red, green, blue, &linear_red, &linear_green, &linear_blue);
gtk_linear_srgb_to_oklab (linear_red, linear_green, linear_blue, L, a, b);
}
void
gtk_rgb_to_linear_srgb (float red, float green, float blue,
float *linear_red, float *linear_green, float *linear_blue)
{
*linear_red = unapply_gamma (red);
*linear_green = unapply_gamma (green);
*linear_blue = unapply_gamma (blue);
}
void
gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_blue,
float *red, float *green, float *blue)
{
*red = apply_gamma (linear_red);
*green = apply_gamma (linear_green);
*blue = apply_gamma (linear_blue);
}
+55
View File
@@ -0,0 +1,55 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2024 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "gtkcolorutils.h"
G_BEGIN_DECLS
void gtk_rgb_to_hsl (float red, float green, float blue,
float *hue, float *saturation, float *lightness);
void gtk_hsl_to_rgb (float hue, float saturation, float lightness,
float *red, float *green, float *blue);
void gtk_rgb_to_hwb (float red, float green, float blue,
float *hue, float *white, float *black);
void gtk_hwb_to_rgb (float hue, float white, float black,
float *red, float *green, float *blue);
void gtk_oklab_to_oklch (float L, float a, float b,
float *L2, float *C, float *H);
void gtk_oklch_to_oklab (float L, float C, float H,
float *L2, float *a, float *b);
void gtk_oklab_to_linear_srgb (float L, float a, float b,
float *red, float *green, float *blue);
void gtk_linear_srgb_to_oklab (float red, float green, float blue,
float *L, float *a, float *b);
void gtk_oklab_to_rgb (float L, float a, float b,
float *red, float *green, float *blue);
void gtk_rgb_to_oklab (float red, float green, float blue,
float *L, float *a, float *b);
void gtk_rgb_to_linear_srgb (float red, float green, float blue,
float *linear_red, float *linear_green, float *linear_blue);
void gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_blue,
float *red, float *green, float *blue);
G_END_DECLS
+7
View File
@@ -1924,6 +1924,13 @@ attribute_from_name (const char *name)
return GTK_CONSTRAINT_ATTRIBUTE_NONE;
}
/**
* gtk_constraint_vfl_parser_error_quark:
*
* Registers an error quark for VFL error parsing.
*
* Returns: the error quark
**/
GQuark
gtk_constraint_vfl_parser_error_quark (void)
{
-14
View File
@@ -1047,7 +1047,6 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
GtkCssAnimatedStyle *result;
GtkCssStyle *style;
GPtrArray *animations = NULL;
GtkCssComputeContext context = { NULL, };
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL);
gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
@@ -1093,12 +1092,6 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
gtk_css_animated_style_apply_animations (result);
context.provider = provider;
context.style = base_style;
context.parent_style = parent_style;
gtk_css_style_resolve_used_values ((GtkCssStyle *) result, &context);
return GTK_CSS_STYLE (result);
}
@@ -1113,7 +1106,6 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
GtkCssStyle *style;
GPtrArray *animations;
guint i;
GtkCssComputeContext context = { NULL, };
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL);
@@ -1173,12 +1165,6 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
gtk_css_animated_style_apply_animations (result);
context.provider = provider;
context.style = base_style;
context.parent_style = parent_style;
gtk_css_style_resolve_used_values ((GtkCssStyle *) result, &context);
return GTK_CSS_STYLE (result);
}
+3 -3
View File
@@ -161,9 +161,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
gtk_css_value_bg_size_print
};
static GtkCssValue auto_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, FALSE, FALSE, NULL, NULL };
static GtkCssValue cover_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, TRUE, FALSE, NULL, NULL };
static GtkCssValue contain_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, FALSE, TRUE, NULL, NULL };
static GtkCssValue auto_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, FALSE, FALSE, NULL, NULL };
static GtkCssValue cover_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, TRUE, FALSE, NULL, NULL };
static GtkCssValue contain_singleton = { &GTK_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, FALSE, TRUE, NULL, NULL };
GtkCssValue *
_gtk_css_bg_size_value_new (GtkCssValue *x,
+723
View File
@@ -0,0 +1,723 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2024 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcsscolorprivate.h"
#include "gtkcolorutilsprivate.h"
/* {{{ Initialization */
void
gtk_css_color_init (GtkCssColor *color,
GtkCssColorSpace color_space,
const float values[4])
{
gboolean missing[4] = { 0, };
/* look for powerless components */
switch (color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
break;
case GTK_CSS_COLOR_SPACE_HSL:
if (fabs (values[2]) < 0.001)
missing[0] = 1;
break;
case GTK_CSS_COLOR_SPACE_HWB:
if (values[1] + values[2] > 99.999)
missing[0] = 1;
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
if (fabs (values[1]) < 0.001)
missing[2] = 1;
break;
default:
g_assert_not_reached ();
}
gtk_css_color_init_with_missing (color, color_space, values, missing);
}
/* }}} */
/* {{{ Utilities */
static inline void
append_color_component (GString *string,
const GtkCssColor *color,
guint idx)
{
if (gtk_css_color_component_missing (color, idx))
g_string_append (string, "none");
else
g_string_append_printf (string, "%g", gtk_css_color_get_component (color, idx));
}
GString *
gtk_css_color_print (const GtkCssColor *color,
gboolean serialize_as_rgb,
GString *string)
{
switch (color->color_space)
{
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
print_rgb:
{
GtkCssColor tmp;
gtk_css_color_convert (color, GTK_CSS_COLOR_SPACE_SRGB, &tmp);
if (tmp.values[3] > 0.999)
{
g_string_append_printf (string, "rgb(%d,%d,%d)",
(int)(0.5 + CLAMP (tmp.values[0], 0., 1.) * 255.),
(int)(0.5 + CLAMP (tmp.values[1], 0., 1.) * 255.),
(int)(0.5 + CLAMP (tmp.values[2], 0., 1.) * 255.));
}
else
{
char alpha[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (tmp.values[3], 0, 1));
g_string_append_printf (string, "rgba(%d,%d,%d,%s)",
(int)(0.5 + CLAMP (tmp.values[0], 0., 1.) * 255.),
(int)(0.5 + CLAMP (tmp.values[1], 0., 1.) * 255.),
(int)(0.5 + CLAMP (tmp.values[2], 0., 1.) * 255.),
alpha);
}
}
return string;
case GTK_CSS_COLOR_SPACE_SRGB:
if (serialize_as_rgb)
goto print_rgb;
g_string_append (string, "color(srgb ");
break;
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
g_string_append (string, "color(srgb-linear ");
break;
case GTK_CSS_COLOR_SPACE_OKLAB:
g_string_append (string, "oklab(");
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
g_string_append (string, "oklch(");
break;
default:
g_assert_not_reached ();
}
for (guint i = 0; i < 3; i++)
{
if (i > 0)
g_string_append_c (string, ' ');
append_color_component (string, color, i);
}
if (gtk_css_color_component_missing (color, 3) ||
color->values[3] < 0.999)
{
g_string_append (string, " / ");
append_color_component (string, color, 3);
}
g_string_append_c (string, ')');
return string;
}
char *
gtk_css_color_to_string (const GtkCssColor *color)
{
return g_string_free (gtk_css_color_print (color, FALSE, g_string_new ("")), FALSE);
}
const char *
gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
guint coord)
{
if (coord == 3)
return "alpha";
switch (color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
switch (coord)
{
case 0: return "r";
case 1: return "g";
case 2: return "b";
default: g_assert_not_reached ();
}
case GTK_CSS_COLOR_SPACE_HSL:
switch (coord)
{
case 0: return "h";
case 1: return "s";
case 2: return "l";
default: g_assert_not_reached ();
}
case GTK_CSS_COLOR_SPACE_HWB:
switch (coord)
{
case 0: return "h";
case 1: return "w";
case 2: return "b";
default: g_assert_not_reached ();
}
case GTK_CSS_COLOR_SPACE_OKLAB:
switch (coord)
{
case 0: return "l";
case 1: return "a";
case 2: return "b";
default: g_assert_not_reached ();
}
case GTK_CSS_COLOR_SPACE_OKLCH:
switch (coord)
{
case 0: return "l";
case 1: return "c";
case 2: return "h";
default: g_assert_not_reached ();
}
default:
g_assert_not_reached ();
}
}
/* }}} */
/* {{{ Color conversion */
static void
convert_to_rectangular (GtkCssColor *output)
{
float v[4];
gboolean no_missing[4] = { 0, };
switch (output->color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
break;
case GTK_CSS_COLOR_SPACE_HSL:
gtk_hsl_to_rgb (output->values[0],
output->values[1] / 100,
output->values[2] / 100,
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init_with_missing (output, GTK_CSS_COLOR_SPACE_SRGB, v, no_missing);
break;
case GTK_CSS_COLOR_SPACE_HWB:
gtk_hwb_to_rgb (output->values[0],
output->values[1] / 100,
output->values[2] / 100,
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init_with_missing (output, GTK_CSS_COLOR_SPACE_SRGB, v, no_missing);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
gtk_oklch_to_oklab (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init_with_missing (output, GTK_CSS_COLOR_SPACE_OKLAB, v, no_missing);
break;
default:
g_assert_not_reached ();
}
}
static void
convert_to_linear (GtkCssColor *output)
{
float v[4];
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_SRGB ||
output->color_space == GTK_CSS_COLOR_SPACE_SRGB_LINEAR ||
output->color_space == GTK_CSS_COLOR_SPACE_OKLAB);
if (output->color_space == GTK_CSS_COLOR_SPACE_SRGB)
{
gtk_rgb_to_linear_srgb (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB_LINEAR, v);
}
}
static void
convert_from_linear (GtkCssColor *output,
GtkCssColorSpace dest)
{
float v[4];
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_SRGB_LINEAR ||
output->color_space == GTK_CSS_COLOR_SPACE_OKLAB);
switch (dest)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
gtk_linear_srgb_to_rgb (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB, v);
break;
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
case GTK_CSS_COLOR_SPACE_OKLCH:
break;
default:
g_assert_not_reached ();
}
}
static void
convert_from_rectangular (GtkCssColor *output,
GtkCssColorSpace dest)
{
float v[4];
switch (dest)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
g_assert (output->color_space == dest);
break;
case GTK_CSS_COLOR_SPACE_HSL:
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_SRGB);
gtk_rgb_to_hsl (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[1] *= 100;
v[2] *= 100;
v[3] = output->values[3];
gtk_css_color_init (output, dest, v);
break;
case GTK_CSS_COLOR_SPACE_HWB:
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_SRGB);
gtk_rgb_to_hwb (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[1] *= 100;
v[2] *= 100;
v[3] = output->values[3];
gtk_css_color_init (output, dest, v);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_OKLAB);
gtk_oklab_to_oklch (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init (output, dest, v);
break;
default:
g_assert_not_reached ();
}
}
static void
convert_linear_to_linear (GtkCssColor *output,
GtkCssColorSpace dest)
{
GtkCssColorSpace dest_linear;
float v[4];
if (dest == GTK_CSS_COLOR_SPACE_OKLCH ||
dest == GTK_CSS_COLOR_SPACE_OKLAB)
dest_linear = GTK_CSS_COLOR_SPACE_OKLAB;
else
dest_linear = GTK_CSS_COLOR_SPACE_SRGB_LINEAR;
if (dest_linear == GTK_CSS_COLOR_SPACE_SRGB_LINEAR &&
output->color_space == GTK_CSS_COLOR_SPACE_OKLAB)
{
gtk_oklab_to_linear_srgb (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init (output, dest_linear, v);
}
else if (dest_linear == GTK_CSS_COLOR_SPACE_OKLAB &&
output->color_space == GTK_CSS_COLOR_SPACE_SRGB_LINEAR)
{
gtk_linear_srgb_to_oklab (output->values[0],
output->values[1],
output->values[2],
&v[0], &v[1], &v[2]);
v[3] = output->values[3];
gtk_css_color_init (output, dest_linear, v);
}
g_assert (output->color_space == dest_linear);
}
/* See https://www.w3.org/TR/css-color-4/#color-conversion */
void
gtk_css_color_convert (const GtkCssColor *input,
GtkCssColorSpace dest,
GtkCssColor *output)
{
gtk_css_color_init_from_color (output, input);
convert_to_rectangular (output);
convert_to_linear (output);
/* FIXME: White point adaptation goes here */
g_assert (output->color_space == GTK_CSS_COLOR_SPACE_SRGB_LINEAR ||
output->color_space == GTK_CSS_COLOR_SPACE_OKLAB);
convert_linear_to_linear (output, dest);
convert_from_linear (output, dest);
/* FIXME: Gamut mapping goes here */
convert_from_rectangular (output, dest);
}
/* }}} */
/* {{{ Color interpolation */
static void
adjust_hue (float *h1,
float *h2,
GtkCssHueInterpolation interp)
{
switch (interp)
{
case GTK_CSS_HUE_INTERPOLATION_SHORTER:
{
float d = *h2 - *h1;
if (d > 180)
*h1 += 360;
else if (d < -180)
*h2 += 360;
}
break;
case GTK_CSS_HUE_INTERPOLATION_LONGER:
{
float d = *h2 - *h1;
if (0 < d && d < 180)
*h1 += 360;
else if (-180 < d && d <= 0)
*h2 += 360;
}
break;
case GTK_CSS_HUE_INTERPOLATION_INCREASING:
if (*h2 < *h1)
*h2 += 360;
break;
case GTK_CSS_HUE_INTERPOLATION_DECREASING:
if (*h1 < *h2)
*h1 += 360;
break;
default:
g_assert_not_reached ();
}
}
static void
apply_hue_interpolation (GtkCssColor *from,
GtkCssColor *to,
GtkCssColorSpace in,
GtkCssHueInterpolation interp)
{
switch (in)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
break;
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
adjust_hue (&from->values[0], &to->values[0], interp);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
adjust_hue (&from->values[2], &to->values[2], interp);
break;
default:
g_assert_not_reached ();
}
}
static void
normalize_hue_component (float *v)
{
*v = fmod (*v, 360);
if (*v < 0)
*v += 360;
}
static void
normalize_hue (GtkCssColor *color)
{
switch (color->color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
break;
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
normalize_hue_component (&color->values[0]);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
normalize_hue_component (&color->values[2]);
break;
default:
g_assert_not_reached ();
}
}
static inline void
premultiply_component (GtkCssColor *color,
guint i)
{
if ((color->missing & (1 << i)) != 0)
return;
color->values[i] *= color->values[3];
}
static void
premultiply (GtkCssColor *color)
{
if (color->missing & (1 << 3))
return;
switch (color->color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
premultiply_component (color, 0);
premultiply_component (color, 1);
premultiply_component (color, 2);
break;
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
premultiply_component (color, 1);
premultiply_component (color, 2);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
premultiply_component (color, 0);
premultiply_component (color, 1);
break;
default:
g_assert_not_reached ();
}
}
static void
unpremultiply_component (GtkCssColor *color,
guint i)
{
if ((color->missing & (1 << i)) != 0)
return;
color->values[i] /= color->values[3];
}
static void
unpremultiply (GtkCssColor *color)
{
if ((color->missing & (1 << 3)) != 0 || color->values[3] == 0)
return;
switch (color->color_space)
{
case GTK_CSS_COLOR_SPACE_SRGB:
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
case GTK_CSS_COLOR_SPACE_OKLAB:
unpremultiply_component (color, 0);
unpremultiply_component (color, 1);
unpremultiply_component (color, 2);
break;
case GTK_CSS_COLOR_SPACE_HSL:
case GTK_CSS_COLOR_SPACE_HWB:
unpremultiply_component (color, 1);
unpremultiply_component (color, 2);
break;
case GTK_CSS_COLOR_SPACE_OKLCH:
unpremultiply_component (color, 0);
unpremultiply_component (color, 1);
break;
default:
g_assert_not_reached ();
}
}
static void
collect_analogous_missing (const GtkCssColor *color,
GtkCssColorSpace color_space,
gboolean missing[4])
{
/* Coords for red, green, blue, lightness, colorfulness, hue,
* opposite a, opposite b, alpha, for each of our colorspaces,
*/
static int analogous[][9] = {
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* srgb */
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* srgb-linear */
{ -1, -1, -1, 2, 1, 0, -1, -1, 3 }, /* hsl */
{ -1, -1, -1, -1, -1, 0, -1, -1, 3 }, /* hwb */
{ -1, -1, -1, 0, -1, -1, 1, 2, 3 }, /* oklab */
{ -1, -1, -1, 0, 1, 2, -1, -1, 3 }, /* oklch */
};
int *src = analogous[color->color_space];
int *dest = analogous[color_space];
for (guint i = 0; i < 4; i++)
missing[i] = 0;
for (guint i = 0; i < 4; i++)
{
if ((color->missing & (1 << i)) == 0)
continue;
for (guint j = 0; j < 9; j++)
{
if (src[j] == i)
{
int idx = dest[j];
if (idx != -1)
missing[idx] = TRUE;
break;
}
}
}
}
/* See https://www.w3.org/TR/css-color-4/#interpolation */
void
gtk_css_color_interpolate (const GtkCssColor *from,
const GtkCssColor *to,
float progress,
GtkCssColorSpace in,
GtkCssHueInterpolation interp,
GtkCssColor *output)
{
GtkCssColor from1, to1;
gboolean from_missing[4];
gboolean to_missing[4];
gboolean missing[4];
float v[4];
collect_analogous_missing (from, in, from_missing);
collect_analogous_missing (to, in, to_missing);
gtk_css_color_convert (from, in, &from1);
gtk_css_color_convert (to, in, &to1);
for (guint i = 0; i < 4; i++)
{
gboolean m1 = from_missing[i];
gboolean m2 = to_missing[i];
if (m1 && !m2)
from1.values[i] = to1.values[i];
else if (!m1 && m2)
to1.values[i] = from1.values[i];
missing[i] = from_missing[i] && to_missing[i];
}
from1.missing = 0;
to1.missing = 0;
apply_hue_interpolation (&from1, &to1, in, interp);
premultiply (&from1);
premultiply (&to1);
v[0] = from1.values[0] * (1 - progress) + to1.values[0] * progress;
v[1] = from1.values[1] * (1 - progress) + to1.values[1] * progress;
v[2] = from1.values[2] * (1 - progress) + to1.values[2] * progress;
v[3] = from1.values[3] * (1 - progress) + to1.values[3] * progress;
gtk_css_color_init_with_missing (output, in, v, missing);
normalize_hue (output);
unpremultiply (output);
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+115
View File
@@ -0,0 +1,115 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2040 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib.h>
#include <math.h>
G_BEGIN_DECLS
typedef enum {
GTK_CSS_COLOR_SPACE_SRGB,
GTK_CSS_COLOR_SPACE_SRGB_LINEAR,
GTK_CSS_COLOR_SPACE_HSL,
GTK_CSS_COLOR_SPACE_HWB,
GTK_CSS_COLOR_SPACE_OKLAB,
GTK_CSS_COLOR_SPACE_OKLCH,
} GtkCssColorSpace;
typedef struct
{
GtkCssColorSpace color_space;
float values[4];
guint missing;
} GtkCssColor;
static inline gboolean
gtk_css_color_equal (const GtkCssColor *color1,
const GtkCssColor *color2)
{
return color1->color_space == color2->color_space &&
color1->missing == color2->missing &&
memcmp (color1->values, color2->values, sizeof (float) * 4) == 0;
}
static inline gboolean
gtk_css_color_component_missing (const GtkCssColor *color,
guint idx)
{
return (color->missing & (1 << idx)) != 0;
}
static inline float
gtk_css_color_get_component (const GtkCssColor *color,
guint idx)
{
return color->values[idx];
}
static inline void
gtk_css_color_init_with_missing (GtkCssColor *color,
GtkCssColorSpace color_space,
const float values[4],
gboolean missing[4])
{
color->color_space = color_space;
for (guint i = 0; i < 4; i++)
color->values[i] = missing[i] ? 0 : values[i];
color->missing = missing[0] | (missing[1] << 1) | (missing[2] << 2) | (missing[3] << 3);
}
static inline void
gtk_css_color_init_from_color (GtkCssColor *color,
const GtkCssColor *src)
{
memcpy (color, src, sizeof (GtkCssColor));
}
void gtk_css_color_init (GtkCssColor *color,
GtkCssColorSpace color_space,
const float values[4]);
GString * gtk_css_color_print (const GtkCssColor *color,
gboolean serialize_as_rgb,
GString *string);
char * gtk_css_color_to_string (const GtkCssColor *color);
void gtk_css_color_convert (const GtkCssColor *input,
GtkCssColorSpace dest,
GtkCssColor *output);
typedef enum
{
GTK_CSS_HUE_INTERPOLATION_SHORTER,
GTK_CSS_HUE_INTERPOLATION_LONGER,
GTK_CSS_HUE_INTERPOLATION_INCREASING,
GTK_CSS_HUE_INTERPOLATION_DECREASING,
} GtkCssHueInterpolation;
void gtk_css_color_interpolate (const GtkCssColor *from,
const GtkCssColor *to,
float progress,
GtkCssColorSpace in,
GtkCssHueInterpolation interp,
GtkCssColor *output);
const char * gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
guint coord);
G_END_DECLS
+693 -243
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -21,22 +21,14 @@
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtkcsscolorprivate.h"
G_BEGIN_DECLS
GtkCssValue * gtk_css_color_value_new_transparent (void) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_white (void) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_literal (const GdkRGBA *color) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_name (const char *name) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_shade (GtkCssValue *color,
double factor) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_alpha (GtkCssValue *color,
double factor) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_mix (GtkCssValue *color1,
GtkCssValue *color2,
double factor) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_current_color (void) G_GNUC_PURE;
GtkCssValue * gtk_css_color_value_new_name (const char *name) G_GNUC_PURE;
gboolean gtk_css_color_value_can_parse (GtkCssParser *parser);
GtkCssValue * gtk_css_color_value_parse (GtkCssParser *parser);
@@ -46,6 +38,14 @@ GtkCssValue * gtk_css_color_value_resolve (GtkCssValue *color
GtkCssValue *current);
const GdkRGBA * gtk_css_color_value_get_rgba (const GtkCssValue *color) G_GNUC_CONST;
GtkCssValue * gtk_css_color_value_new_color (GtkCssColorSpace color_space,
gboolean serialize_as_rgb,
const float values[4],
gboolean missing[4]) G_GNUC_PURE;
const GtkCssColor *
gtk_css_color_value_get_color (const GtkCssValue *color) G_GNUC_CONST;
G_END_DECLS
+8 -8
View File
@@ -108,14 +108,14 @@ static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
};
static GtkCssValue corner_singletons[] = {
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
{ &GTK_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
};
static inline void
+87 -87
View File
@@ -85,16 +85,16 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
};
static GtkCssValue border_style_values[] = {
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_NONE, "none" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_INSET, "inset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_OUTSET, "outset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_HIDDEN, "hidden" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DOTTED, "dotted" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DASHED, "dashed" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_GROOVE, "groove" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_RIDGE, "ridge" }
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_NONE, "none" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_INSET, "inset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_OUTSET, "outset" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_HIDDEN, "hidden" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DOTTED, "dotted" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DASHED, "dashed" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_GROOVE, "groove" },
{ &GTK_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_RIDGE, "ridge" }
};
GtkCssValue *
@@ -143,22 +143,22 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
};
static GtkCssValue blend_mode_values[] = {
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DEFAULT, "normal" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_MULTIPLY, "multiply" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SCREEN, "screen" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_OVERLAY, "overlay" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DARKEN, "darken" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_LIGHTEN, "lighten" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DIFFERENCE, "difference" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR, "color" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_HUE, "hue" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SATURATION, "saturation" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DEFAULT, "normal" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_MULTIPLY, "multiply" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SCREEN, "screen" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_OVERLAY, "overlay" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DARKEN, "darken" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_LIGHTEN, "lighten" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DIFFERENCE, "difference" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR, "color" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_HUE, "hue" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SATURATION, "saturation" },
{ &GTK_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
};
GtkCssValue *
@@ -296,15 +296,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
};
static GtkCssValue font_size_values[] = {
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_LARGER, "larger" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_SMALL, "small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_LARGE, "large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_LARGER, "larger" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_SMALL, "small" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_LARGE, "large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
{ &GTK_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
};
GtkCssValue *
@@ -353,9 +353,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
};
static GtkCssValue font_style_values[] = {
{ &GTK_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_OBLIQUE, "oblique" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_ITALIC, "italic" }
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_OBLIQUE, "oblique" },
{ &GTK_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_ITALIC, "italic" }
};
GtkCssValue *
@@ -450,8 +450,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
};
static GtkCssValue font_weight_values[] = {
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, 0, 0, 0, BOLDER, "bolder" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, 0, 0, 0, LIGHTER, "lighter" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, FALSE, FALSE, BOLDER, "bolder" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, FALSE, FALSE, LIGHTER, "lighter" },
};
GtkCssValue *
@@ -500,15 +500,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
};
static GtkCssValue font_stretch_values[] = {
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_CONDENSED, "condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXPANDED, "expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_CONDENSED, "condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXPANDED, "expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
{ &GTK_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
};
GtkCssValue *
@@ -557,9 +557,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
};
static GtkCssValue text_decoration_style_values[] = {
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
{ &GTK_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
};
GtkCssValue *
@@ -608,9 +608,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
};
static GtkCssValue area_values[] = {
{ &GTK_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_BORDER_BOX, "border-box" },
{ &GTK_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
{ &GTK_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
{ &GTK_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_BORDER_BOX, "border-box" },
{ &GTK_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
{ &GTK_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
};
GtkCssValue *
@@ -665,10 +665,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
};
static GtkCssValue direction_values[] = {
{ &GTK_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_REVERSE, "reverse" },
{ &GTK_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
{ &GTK_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_REVERSE, "reverse" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
{ &GTK_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
};
GtkCssValue *
@@ -726,8 +726,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
};
static GtkCssValue play_state_values[] = {
{ &GTK_CSS_VALUE_PLAY_STATE, 1, 1, 0, 0, GTK_CSS_PLAY_STATE_RUNNING, "running" },
{ &GTK_CSS_VALUE_PLAY_STATE, 1, 1, 0, 0, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
{ &GTK_CSS_VALUE_PLAY_STATE, 1, TRUE, FALSE, GTK_CSS_PLAY_STATE_RUNNING, "running" },
{ &GTK_CSS_VALUE_PLAY_STATE, 1, TRUE, FALSE, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
};
GtkCssValue *
@@ -782,10 +782,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
};
static GtkCssValue fill_mode_values[] = {
{ &GTK_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_NONE, "none" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_FORWARDS, "forwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_BACKWARDS, "backwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_BOTH, "both" }
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_NONE, "none" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_FORWARDS, "forwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_BACKWARDS, "backwards" },
{ &GTK_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_BOTH, "both" }
};
GtkCssValue *
@@ -840,9 +840,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
};
static GtkCssValue icon_style_values[] = {
{ &GTK_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
{ &GTK_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
};
GtkCssValue *
@@ -897,9 +897,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
};
static GtkCssValue font_kerning_values[] = {
{ &GTK_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_AUTO, "auto" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_NONE, "none" }
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_AUTO, "auto" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_NONE, "none" }
};
GtkCssValue *
@@ -954,9 +954,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
};
static GtkCssValue font_variant_position_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
{ &GTK_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
};
GtkCssValue *
@@ -1011,13 +1011,13 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
};
static GtkCssValue font_variant_caps_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
{ &GTK_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
};
GtkCssValue *
@@ -1072,8 +1072,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
};
static GtkCssValue font_variant_alternate_values[] = {
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
{ &GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
};
GtkCssValue *
@@ -1581,10 +1581,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_TRANSFORM = {
};
static GtkCssValue text_transform_values[] = {
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_NONE, "none" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_LOWERCASE, "lowercase" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_UPPERCASE, "uppercase" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_CAPITALIZE, "capitalize" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_NONE, "none" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_LOWERCASE, "lowercase" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_UPPERCASE, "uppercase" },
{ &GTK_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_CAPITALIZE, "capitalize" },
};
GtkCssValue *
+1 -1
View File
@@ -717,7 +717,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
gtk_css_value_filter_print
};
static GtkCssValue filter_none_singleton = { &GTK_CSS_VALUE_FILTER, 1, 1, 0, 0, 0, { { GTK_CSS_FILTER_NONE } } };
static GtkCssValue filter_none_singleton = { &GTK_CSS_VALUE_FILTER, 1, TRUE, FALSE, 0, { { GTK_CSS_FILTER_NONE } } };
static GtkCssValue *
gtk_css_filter_value_alloc (guint n_filters)
+6 -38
View File
@@ -120,19 +120,6 @@ gtk_css_image_real_is_computed (GtkCssImage *image)
return FALSE;
}
static gboolean
gtk_css_image_real_contains_current_color (GtkCssImage *image)
{
return FALSE;
}
static GtkCssImage *
gtk_css_image_real_resolve (GtkCssImage *image,
GtkCssValue *current_color)
{
return g_object_ref (image);
}
static void
_gtk_css_image_class_init (GtkCssImageClass *klass)
{
@@ -146,8 +133,6 @@ _gtk_css_image_class_init (GtkCssImageClass *klass)
klass->is_dynamic = gtk_css_image_real_is_dynamic;
klass->get_dynamic_image = gtk_css_image_real_get_dynamic_image;
klass->is_computed = gtk_css_image_real_is_computed;
klass->contains_current_color = gtk_css_image_real_contains_current_color;
klass->resolve = gtk_css_image_real_resolve;
}
static void
@@ -254,11 +239,11 @@ _gtk_css_image_equal (GtkCssImage *image1,
return klass->equal (image1, image2);
}
static void
gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,
double width,
double height)
void
_gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,
double width,
double height)
{
GtkSnapshot *snapshot;
GskRenderNode *node;
@@ -512,7 +497,7 @@ _gtk_css_image_get_surface (GtkCssImage *image,
surface_height);
cr = cairo_create (result);
gtk_css_image_draw (image, cr, surface_width, surface_height);
_gtk_css_image_draw (image, cr, surface_width, surface_height);
cairo_destroy (cr);
return result;
@@ -603,20 +588,3 @@ gtk_css_image_is_computed (GtkCssImage *image)
return klass->is_computed (image);
}
gboolean
gtk_css_image_contains_current_color (GtkCssImage *image)
{
GtkCssImageClass *klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->contains_current_color (image);
}
GtkCssImage *
gtk_css_image_resolve (GtkCssImage *image,
GtkCssValue *current_color)
{
GtkCssImageClass *klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->resolve (image, current_color);
}
+1 -50
View File
@@ -327,7 +327,7 @@ gtk_css_image_conic_compute (GtkCssImage *image,
copy->rotation = gtk_css_value_compute (self->rotation, property_id, context);
copy->n_stops = self->n_stops;
copy->color_stops = g_new (GtkCssImageConicColorStop, self->n_stops);
copy->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * copy->n_stops);
for (i = 0; i < self->n_stops; i++)
{
const GtkCssImageConicColorStop *stop = &self->color_stops[i];
@@ -503,53 +503,6 @@ gtk_css_image_conic_is_computed (GtkCssImage *image)
return computed;
}
static gboolean
gtk_css_image_conic_contains_current_color (GtkCssImage *image)
{
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
for (guint i = 0; i < self->n_stops; i ++)
{
const GtkCssImageConicColorStop *stop = &self->color_stops[i];
if (gtk_css_value_contains_current_color (stop->color))
return TRUE;
}
return FALSE;
}
static GtkCssImage *
gtk_css_image_conic_resolve (GtkCssImage *image,
GtkCssValue *current_color)
{
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
GtkCssImageConic *resolved;
if (!gtk_css_image_conic_contains_current_color (image))
return g_object_ref (image);
resolved = g_object_new (GTK_TYPE_CSS_IMAGE_CONIC, NULL);
resolved->center = gtk_css_value_ref (self->center);
resolved->rotation = gtk_css_value_ref (self->rotation);
resolved->n_stops = self->n_stops;
resolved->color_stops = g_new (GtkCssImageConicColorStop, self->n_stops);
for (guint i = 0; i < self->n_stops; i++)
{
if (self->color_stops[i].offset)
resolved->color_stops[i].offset = gtk_css_value_ref (self->color_stops[i].offset);
else
resolved->color_stops[i].offset = NULL;
resolved->color_stops[i].color = gtk_css_color_value_resolve (self->color_stops[i].color, NULL, current_color);
}
return GTK_CSS_IMAGE (resolved);
}
static void
gtk_css_image_conic_class_init (GtkCssImageConicClass *klass)
{
@@ -563,8 +516,6 @@ gtk_css_image_conic_class_init (GtkCssImageConicClass *klass)
image_class->equal = gtk_css_image_conic_equal;
image_class->transition = gtk_css_image_conic_transition;
image_class->is_computed = gtk_css_image_conic_is_computed;
image_class->contains_current_color = gtk_css_image_conic_contains_current_color;
image_class->resolve = gtk_css_image_conic_resolve;
object_class->dispose = gtk_css_image_conic_dispose;
}
+1 -69
View File
@@ -72,10 +72,7 @@ gtk_css_image_fallback_snapshot (GtkCssImage *image,
{
if (fallback->color)
{
const GdkRGBA *color;
color = gtk_css_color_value_get_rgba (fallback->color);
const GdkRGBA *color = gtk_css_color_value_get_rgba (fallback->color);
if (!gdk_rgba_is_clear (color))
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (0, 0, width, height));
@@ -304,69 +301,6 @@ gtk_css_image_fallback_is_computed (GtkCssImage *image)
return TRUE;
}
static gboolean
gtk_css_image_fallback_contains_current_color (GtkCssImage *image)
{
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
if (fallback->used < 0)
{
guint i;
if (fallback->color && !fallback->images)
return gtk_css_value_contains_current_color (fallback->color);
for (i = 0; i < fallback->n_images; i++)
{
if (gtk_css_image_contains_current_color (fallback->images[i]))
return TRUE;
}
}
return FALSE;
}
static GtkCssImage *
gtk_css_image_fallback_resolve (GtkCssImage *image,
GtkCssValue *current_color)
{
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
GtkCssImageFallback *resolved;
int i;
if (fallback->used < 0)
{
GtkCssValue *resolved_color = NULL;
if (fallback->color)
resolved_color = gtk_css_color_value_resolve (fallback->color, NULL, current_color);
/* image($color) that didn't change */
if (resolved_color && !fallback->images && resolved_color == fallback->color)
return g_object_ref (image);
resolved = g_object_new (_gtk_css_image_fallback_get_type (), NULL);
resolved->n_images = fallback->n_images;
resolved->images = g_new (GtkCssImage *, fallback->n_images);
for (i = 0; i < fallback->n_images; i++)
{
resolved->images[i] = g_object_ref (fallback->images[i]);
if (gtk_css_image_is_invalid (resolved->images[i]))
continue;
if (resolved->used < 0)
resolved->used = i;
}
resolved->color = resolved_color;
return GTK_CSS_IMAGE (resolved);
}
else
return GTK_CSS_IMAGE (g_object_ref (image));
}
static void
_gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
{
@@ -382,8 +316,6 @@ _gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
image_class->print = gtk_css_image_fallback_print;
image_class->equal = gtk_css_image_fallback_equal;
image_class->is_computed = gtk_css_image_fallback_is_computed;
image_class->contains_current_color = gtk_css_image_fallback_contains_current_color;
image_class->resolve = gtk_css_image_fallback_resolve;
object_class->dispose = gtk_css_image_fallback_dispose;
}
+3 -64
View File
@@ -29,8 +29,6 @@
#include "gtkstyleproviderprivate.h"
#include "gtksymbolicpaintable.h"
#include "gtkiconthemeprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcsspalettevalueprivate.h"
G_DEFINE_TYPE (GtkCssImageIconTheme, _gtk_css_image_icon_theme, GTK_TYPE_CSS_IMAGE)
@@ -52,7 +50,6 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
double icon_width, icon_height;
int size;
double x, y;
GdkRGBA colors[4];
size = floor (MIN (width, height));
if (size <= 0)
@@ -92,15 +89,11 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
}
for (guint i = 0; i < 4; i++)
colors[i] = *gtk_css_color_value_get_rgba (icon_theme->colors[i]);
gtk_symbolic_paintable_snapshot_symbolic (GTK_SYMBOLIC_PAINTABLE (icon),
snapshot,
icon_width,
icon_height,
colors,
icon_theme->colors,
G_N_ELEMENTS (icon_theme->colors));
if (x != 0 || y != 0)
gtk_snapshot_restore (snapshot);
@@ -153,7 +146,6 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
GtkCssImageIconTheme *copy;
GtkSettings *settings;
GdkDisplay *display;
const char *names[4] = { NULL, "success", "warning", "error" };
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
copy->name = g_strdup (icon_theme->name);
@@ -162,18 +154,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
copy->icon_theme = gtk_icon_theme_get_for_display (display);
copy->serial = gtk_icon_theme_get_serial (copy->icon_theme);
copy->scale = gtk_style_provider_get_scale (context->provider);
for (guint i = 0; i < 4; i++)
{
GtkCssValue *color = NULL;
if (names[i])
color = gtk_css_palette_value_get_color (context->style->core->icon_palette, names[i]);
if (color)
copy->colors[i] = gtk_css_value_ref (color);
else
copy->colors[i] = gtk_css_value_ref (context->style->core->color);
}
gtk_css_style_lookup_symbolic_colors (context->style, copy->colors);
return GTK_CSS_IMAGE (copy);
}
@@ -199,51 +180,10 @@ gtk_css_image_icon_theme_dispose (GObject *object)
icon_theme->name = NULL;
g_clear_object (&icon_theme->cached_icon);
g_clear_pointer (&icon_theme->colors[0], gtk_css_value_unref);
g_clear_pointer (&icon_theme->colors[1], gtk_css_value_unref);
g_clear_pointer (&icon_theme->colors[2], gtk_css_value_unref);
g_clear_pointer (&icon_theme->colors[3], gtk_css_value_unref);
G_OBJECT_CLASS (_gtk_css_image_icon_theme_parent_class)->dispose (object);
}
static gboolean
gtk_css_image_icon_theme_contains_current_color (GtkCssImage *image)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
for (guint i = 0; i < 4; i++)
{
if (!icon_theme->colors[i] ||
gtk_css_value_contains_current_color (icon_theme->colors[i]))
return TRUE;
}
return FALSE;
}
static GtkCssImage *
gtk_css_image_icon_theme_resolve (GtkCssImage *image,
GtkCssValue *current)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
GtkCssImageIconTheme *copy;
if (!gtk_css_image_icon_theme_contains_current_color (image))
return g_object_ref (image);
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
copy->name = g_strdup (icon_theme->name);
copy->icon_theme = icon_theme->icon_theme;
copy->serial = icon_theme->serial;
copy->scale = icon_theme->scale;
for (guint i = 0; i < 4; i++)
copy->colors[i] = gtk_css_color_value_resolve (icon_theme->colors[i], NULL, current);
return GTK_CSS_IMAGE (copy);
}
static void
_gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
{
@@ -256,8 +196,7 @@ _gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
image_class->print = gtk_css_image_icon_theme_print;
image_class->compute = gtk_css_image_icon_theme_compute;
image_class->equal = gtk_css_image_icon_theme_equal;
image_class->contains_current_color = gtk_css_image_icon_theme_contains_current_color;
image_class->resolve = gtk_css_image_icon_theme_resolve;
object_class->dispose = gtk_css_image_icon_theme_dispose;
}
+1 -1
View File
@@ -39,7 +39,7 @@ struct _GtkCssImageIconTheme
GtkCssImage parent;
GtkIconTheme *icon_theme;
GtkCssValue *colors[4];
GdkRGBA colors[4];
int serial;
int scale;
char *name;
+8 -65
View File
@@ -134,10 +134,10 @@ gtk_css_image_linear_compute_start_point (double angle_in_degrees,
}
static void
gtk_css_image_linear_snapshot (GtkCssImage *image,
GtkSnapshot *snapshot,
double width,
double height)
gtk_css_image_linear_snapshot (GtkCssImage *image,
GtkSnapshot *snapshot,
double width,
double height)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GskColorStop *stops;
@@ -188,16 +188,12 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
if (start == end)
{
/* Repeating gradients with all color stops sharing the same offset
* get the color of the last color stop
*/
/* repeating gradients with all color stops sharing the same offset
* get the color of the last color stop */
const GtkCssImageLinearColorStop *stop = &linear->color_stops[linear->n_stops - 1];
const GdkRGBA *color;
color = gtk_css_color_value_get_rgba (stop->color);
gtk_snapshot_append_color (snapshot,
color,
gtk_css_color_value_get_rgba (stop->color),
&GRAPHENE_RECT_INIT (0, 0, width, height));
return;
}
@@ -240,9 +236,8 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
offset += step;
stops[last].color = *gtk_css_color_value_get_rgba (stop->color);
stops[last].offset = (offset - start) / (end - start);
stops[last].color = *gtk_css_color_value_get_rgba (stop->color);
}
offset = pos;
@@ -694,56 +689,6 @@ gtk_css_image_linear_is_computed (GtkCssImage *image)
return computed;
}
static gboolean
gtk_css_image_linear_contains_current_color (GtkCssImage *image)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
for (guint i = 0; i < linear->n_stops; i ++)
{
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
if (gtk_css_value_contains_current_color (stop->color))
return TRUE;
}
return FALSE;
}
static GtkCssImage *
gtk_css_image_linear_resolve (GtkCssImage *image,
GtkCssValue *current_color)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GtkCssImageLinear *copy;
guint i;
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
copy->side = linear->side;
if (linear->angle)
copy->angle = gtk_css_value_ref (linear->angle);
copy->n_stops = linear->n_stops;
copy->color_stops = g_new (GtkCssImageLinearColorStop, copy->n_stops);
for (i = 0; i < linear->n_stops; i++)
{
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
GtkCssImageLinearColorStop *scopy = &copy->color_stops[i];
scopy->color = gtk_css_color_value_resolve (stop->color, NULL, current_color);
if (stop->offset)
scopy->offset = gtk_css_value_ref (stop->offset);
else
scopy->offset = NULL;
}
return GTK_CSS_IMAGE (copy);
}
static void
_gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass)
{
@@ -757,8 +702,6 @@ _gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass)
image_class->equal = gtk_css_image_linear_equal;
image_class->transition = gtk_css_image_linear_transition;
image_class->is_computed = gtk_css_image_linear_is_computed;
image_class->contains_current_color = gtk_css_image_linear_contains_current_color;
image_class->resolve = gtk_css_image_linear_resolve;
object_class->dispose = gtk_css_image_linear_dispose;
}
+4 -7
View File
@@ -91,9 +91,6 @@ struct _GtkCssImageClass
void (* print) (GtkCssImage *image,
GString *string);
gboolean (* is_computed) (GtkCssImage *image);
gboolean (* contains_current_color) (GtkCssImage *image);
GtkCssImage *( * resolve) (GtkCssImage *image,
GtkCssValue *current_color);
};
GType _gtk_css_image_get_type (void) G_GNUC_CONST;
@@ -115,6 +112,10 @@ GtkCssImage * _gtk_css_image_transition (GtkCssImage *
guint property_id,
double progress);
void _gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,
double width,
double height);
void gtk_css_image_snapshot (GtkCssImage *image,
GtkSnapshot *snapshot,
double width,
@@ -141,10 +142,6 @@ cairo_surface_t *
int surface_height);
gboolean gtk_css_image_is_computed (GtkCssImage *image) G_GNUC_PURE;
gboolean gtk_css_image_contains_current_color (GtkCssImage *image) G_GNUC_PURE;
GtkCssImage * gtk_css_image_resolve (GtkCssImage *image,
GtkCssValue *current_color);
G_END_DECLS

Some files were not shown because too many files have changed in this diff Show More