Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e04cdce680 | |||
| 812b30eb54 | |||
| 2b5ec9e879 |
+3
-5
@@ -117,11 +117,10 @@ release-build:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- mkdir _install
|
||||
- export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
|
||||
- .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- meson subprojects download
|
||||
- meson subprojects update --reset
|
||||
- mkdir _install
|
||||
- meson setup
|
||||
--prefix=${CI_PROJECT_DIR}/_install
|
||||
${COMMON_MESON_FLAGS}
|
||||
@@ -446,10 +445,9 @@ reference:
|
||||
--force-fallback-for=gdk-pixbuf,pango
|
||||
-Dintrospection=enabled
|
||||
-Ddocumentation=true
|
||||
-Dman-pages=true
|
||||
-Dgdk-pixbuf:gtk_doc=true
|
||||
-Dpango:documentation=true
|
||||
-Dbuild-demos=true
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-tests=false
|
||||
-Dbuild-testsuite=false
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<-EOF
|
||||
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
|
||||
|
||||
Check out and install a meson project
|
||||
|
||||
Options:
|
||||
-Dkey=val Option to pass on to meson
|
||||
--prefix Prefix to install to
|
||||
--subdir Build subdirectory instead of whole project
|
||||
--prepare Script to run before build
|
||||
|
||||
-h, --help Display this help
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
TEMP=$(getopt \
|
||||
--name=$(basename $0) \
|
||||
--options='D:h' \
|
||||
--longoptions='prefix:' \
|
||||
--longoptions='subdir:' \
|
||||
--longoptions='prepare:' \
|
||||
--longoptions='help' \
|
||||
-- "$@")
|
||||
|
||||
eval set -- "$TEMP"
|
||||
unset TEMP
|
||||
|
||||
MESON_OPTIONS=()
|
||||
PREFIX=/usr
|
||||
SUBDIR=.
|
||||
PREPARE=:
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-D)
|
||||
MESON_OPTIONS+=( -D$2 )
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--prefix)
|
||||
PREFIX=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--subdir)
|
||||
SUBDIR=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--prepare)
|
||||
PREPARE=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_URL="$1"
|
||||
COMMIT="$2"
|
||||
|
||||
CHECKOUT_DIR=$(mktemp --directory)
|
||||
trap "rm -rf $CHECKOUT_DIR" EXIT
|
||||
|
||||
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
|
||||
|
||||
pushd "$CHECKOUT_DIR/$SUBDIR"
|
||||
sh -c "$PREPARE"
|
||||
meson setup --prefix "$PREFIX" _build "${MESON_OPTIONS[@]}"
|
||||
meson compile -C _build
|
||||
meson install -C _build
|
||||
popd
|
||||
@@ -1,50 +1,20 @@
|
||||
Overview of Changes in 4.15.4, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.15.3, 29-06-2024
|
||||
=========================================
|
||||
|
||||
* Accessibility:
|
||||
- Only emit notifications when cursor positions change in GtkText
|
||||
- Fix handling of help text properties
|
||||
|
||||
* CSS:
|
||||
- Fix some crashes introduced in recent currentcolor changes
|
||||
|
||||
* DND:
|
||||
- Avoid a critical
|
||||
|
||||
* Documentation:
|
||||
- Fix many oversights and missing docs
|
||||
|
||||
* maxOS:
|
||||
- Add native keyboard shortcuts
|
||||
|
||||
|
||||
Overview of Changes in 4.15.2, 28-06-2024
|
||||
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
* GtkFileChooserWidget:
|
||||
- Plug some memory leaks
|
||||
- Make Ctrl-Shift-N create a new folder
|
||||
|
||||
* GtkPopover:
|
||||
- Handle resizing and position changes better
|
||||
|
||||
* CSS:
|
||||
- Support color(), oklab(), etc (https://www.w3.org/TR/css-color-4/)
|
||||
- Support color-mix() (https://www.w3.org/TR/css-color-5/)
|
||||
- Support relative colors (https://www.w3.org/TR/css-color-5/)
|
||||
- Support more colorspaces in color()
|
||||
- Allow percentages for opacity
|
||||
- Handle currentcolor more correctly
|
||||
|
||||
* Accessibility:
|
||||
- Avoid markup when reading labels
|
||||
|
||||
* GSK:
|
||||
- Subset fonts when serializing node trees
|
||||
- Make ngl export render_texture results as dmabufs
|
||||
|
||||
* Wayland:
|
||||
- Use xdg-dialog protocol for attached dialogs
|
||||
@@ -52,25 +22,17 @@ Overview of Changes in 4.15.2, 28-06-2024
|
||||
* Windows:
|
||||
- Build with UNICODE
|
||||
|
||||
* macOS:
|
||||
- Implement fullscreen-on-monitor
|
||||
|
||||
* Documentation:
|
||||
- Widget shortcuts and actions are now described in the docs
|
||||
|
||||
* Debugging:
|
||||
- Add GTK_DEBUG=css for warning about deprecated css syntax
|
||||
|
||||
* Tools:
|
||||
- rendernode-tool: Add an extract command for data urls
|
||||
- nodeparser: Add an extract command for data urls
|
||||
|
||||
* Deprecations:
|
||||
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
|
||||
|
||||
* Translation updates:
|
||||
Czech
|
||||
Hebrew
|
||||
Serbian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.1, 21-05-2024
|
||||
|
||||
@@ -299,7 +299,7 @@ node_editor_application_new (void)
|
||||
|
||||
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_NON_UNIQUE,
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
|
||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
|
||||
|
||||
@@ -111,11 +111,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gdk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "DECLARE_INTERNAL_TYPE"
|
||||
hidden = true
|
||||
|
||||
[[object]]
|
||||
pattern = "KEY_*"
|
||||
check_ignore = true
|
||||
|
||||
@@ -29,18 +29,6 @@ if get_option('documentation')
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_gir[0],
|
||||
],
|
||||
depends: gdk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
gdk4x11_toml = configure_file(
|
||||
input: 'gdk4-x11.toml.in',
|
||||
@@ -99,17 +87,5 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk-wayland',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4wayland_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_wayland_gir[0],
|
||||
],
|
||||
depends: gdk_wayland_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -66,7 +66,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gsk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "INCLUDE_WARNING"
|
||||
hidden = true
|
||||
|
||||
@@ -30,16 +30,4 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gsk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gsk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gsk_gir[0],
|
||||
],
|
||||
depends: gsk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -99,15 +99,16 @@ reaches the requested phase. However, in practice most things
|
||||
happen at higher levels:
|
||||
|
||||
- If you are doing an animation, you can use
|
||||
[method@Gtk.Widget.add_tick_callback] which will cause a regular
|
||||
gtk_widget_add_tick_callback() which will cause a regular
|
||||
beating of the clock with a callback in the Update phase
|
||||
until you stop the tick.
|
||||
- If some state changes that causes the size of your widget to
|
||||
change you call [method@Gtk.Widget.queue_resize] which will request
|
||||
change you call gtk_widget_queue_resize() which will request
|
||||
a Layout phase and mark your widget as needing relayout.
|
||||
- If some state changes so you need to redraw your widget you
|
||||
use [method@Gtk.Widget.queue_draw] to request a Paint phase for
|
||||
your widget.
|
||||
- If some state changes so you need to redraw some area of
|
||||
your widget you use the normal gtk_widget_queue_draw()
|
||||
set of functions. These will request a Paint phase and
|
||||
mark the region as needing redraw.
|
||||
|
||||
There are also a lot of implicit triggers of these from the
|
||||
CSS layer (which does animations, resizes and repaints as needed).
|
||||
|
||||
@@ -251,12 +251,3 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "StyleProvider"
|
||||
[[object.signal]]
|
||||
name = "gtk-private-changed"
|
||||
hidden = true
|
||||
|
||||
[check]
|
||||
skip_deprecated = true
|
||||
|
||||
@@ -140,11 +140,6 @@ capture phase, and key bindings locally, during the target phase.
|
||||
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
|
||||
and they are managed by `GtkShortcutController`.
|
||||
|
||||
Note that GTK does not do anything to map the primary shortcut modifier
|
||||
to <kbd>Command</kbd> on macOS. If you want to let your application to follow
|
||||
macOS user experience conventions, you must create macOS-specific keyboard shortcuts.
|
||||
The <kbd>Command</kbd> is named `Meta` (`GDK_META_MASK`) in GTK.
|
||||
|
||||
## Text input
|
||||
|
||||
When actual text input is needed (i.e. not just keyboard shortcuts),
|
||||
|
||||
@@ -64,18 +64,6 @@ if get_option('documentation')
|
||||
install_dir: docs_dir,
|
||||
install_tag: 'doc',
|
||||
)
|
||||
|
||||
test('doc-check-gtk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gtk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gtk_gir[0],
|
||||
],
|
||||
depends: gtk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||
|
||||
@@ -451,11 +451,11 @@ hint about how modifiers are expected to be used. It also promoted
|
||||
the use of `<Primary>` instead of `<Control>` to specify accelerators that
|
||||
adapt to platform conventions.
|
||||
|
||||
In GTK 4, the meaning of modifiers has been fixed, and applications are
|
||||
In GTK 4, the meaning of modifiers has been fixed, and backends are
|
||||
expected to map the platform conventions to the existing modifiers.
|
||||
The expected use of modifiers in GTK 4 is:
|
||||
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
`GDK_CONTROL_MASK`
|
||||
: Primary accelerators
|
||||
|
||||
`GDK_ALT_MASK`
|
||||
@@ -464,7 +464,7 @@ The expected use of modifiers in GTK 4 is:
|
||||
`GDK_SHIFT_MASK`
|
||||
: Extending selections
|
||||
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
`GDK_CONTROL_MASK`
|
||||
: Modifying selections
|
||||
|
||||
`GDK_CONTROL_MASK|GDK_ALT_MASK`
|
||||
@@ -473,15 +473,9 @@ The expected use of modifiers in GTK 4 is:
|
||||
Consequently, `GdkModifierIntent` and related APIs have been removed,
|
||||
and `<Control>` is preferred over `<Primary>` in accelerators.
|
||||
|
||||
In GTK 3 on macOS, the `<Primary>` modifier mapped to the <kbd>Command</kbd> key.
|
||||
In GTK 4, this is no longer the case: `<Primary>` is synonymous to `<Control>`.
|
||||
If you want to make your application to feel native on macOS,
|
||||
you need to add accelerators for macOS that use the `<Meta>` modifier.
|
||||
|
||||
A related change is that GTK 4 no longer supports the use of archaic
|
||||
X11 'real' modifiers with the names Mod1,..., Mod5, and `GDK_MOD1_MASK`
|
||||
has been renamed to `GDK_ALT_MASK` and `GDK_MOD2_MASK` has been renamed to
|
||||
`GDK_META_MASK`.
|
||||
has been renamed to `GDK_ALT_MASK`.
|
||||
|
||||
### Replace `GtkClipboard` with `GdkClipboard`
|
||||
|
||||
|
||||
+3
-3
@@ -98,9 +98,9 @@ typedef enum
|
||||
* @GDK_BUTTON3_MASK: the third mouse button.
|
||||
* @GDK_BUTTON4_MASK: the fourth mouse button.
|
||||
* @GDK_BUTTON5_MASK: the fifth mouse button.
|
||||
* @GDK_SUPER_MASK: the Super modifier.
|
||||
* @GDK_HYPER_MASK: the Hyper modifier.
|
||||
* @GDK_META_MASK: the Meta modifier. Maps to Command on macOS.
|
||||
* @GDK_SUPER_MASK: the Super modifier
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
*
|
||||
* Flags to indicate the state of modifier keys and mouse buttons
|
||||
* in events.
|
||||
|
||||
+2
-1
@@ -471,7 +471,8 @@ gdk_gl_texture_release (GdkGLTexture *self)
|
||||
g_return_if_fail (self->saved == NULL);
|
||||
|
||||
texture = GDK_TEXTURE (self);
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture));
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture,
|
||||
gdk_texture_get_format (texture)));
|
||||
|
||||
drop_gl_resources (self);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,6 @@ ADD_ALPHA_FUNC(r8g8b8_to_a8b8g8r8, 0, 1, 2, 3, 2, 1, 0)
|
||||
|
||||
struct _GdkMemoryFormatDescription
|
||||
{
|
||||
const char *name;
|
||||
GdkMemoryAlpha alpha;
|
||||
GdkMemoryFormat premultiplied;
|
||||
GdkMemoryFormat straight;
|
||||
@@ -367,7 +366,6 @@ struct _GdkMemoryFormatDescription
|
||||
|
||||
static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = {
|
||||
.name = "*BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -396,7 +394,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = {
|
||||
.name = "*ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -425,7 +422,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = {
|
||||
.name = "*RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -453,7 +449,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] = {
|
||||
.name = "*ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -482,7 +477,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8A8] = {
|
||||
.name = "BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -511,7 +505,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8] = {
|
||||
.name = "ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -540,7 +533,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8] = {
|
||||
.name = "RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -568,7 +560,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8] = {
|
||||
.name = "ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -597,7 +588,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8X8] = {
|
||||
.name = "BGRX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8X8,
|
||||
.straight = GDK_MEMORY_B8G8R8X8,
|
||||
@@ -627,7 +617,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8R8G8B8] = {
|
||||
.name = "XRGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8R8G8B8,
|
||||
.straight = GDK_MEMORY_X8R8G8B8,
|
||||
@@ -657,7 +646,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8X8] = {
|
||||
.name = "RGBX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8X8,
|
||||
.straight = GDK_MEMORY_R8G8B8X8,
|
||||
@@ -686,7 +674,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8B8G8R8] = {
|
||||
.name = "XBGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8B8G8R8,
|
||||
.straight = GDK_MEMORY_X8B8G8R8,
|
||||
@@ -716,7 +703,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8] = {
|
||||
.name = "RGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8,
|
||||
.straight = GDK_MEMORY_R8G8B8,
|
||||
@@ -745,7 +731,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8] = {
|
||||
.name = "BGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8,
|
||||
.straight = GDK_MEMORY_B8G8R8,
|
||||
@@ -775,7 +760,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16] = {
|
||||
.name = "RGB16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16,
|
||||
.straight = GDK_MEMORY_R16G16B16,
|
||||
@@ -807,7 +791,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -838,7 +821,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16] = {
|
||||
.name = "RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -869,7 +851,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
.straight = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
@@ -900,7 +881,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -930,7 +910,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -960,7 +939,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = {
|
||||
.name = "RGB32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
.straight = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
@@ -991,7 +969,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -1021,7 +998,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = {
|
||||
.name = "RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -1051,7 +1027,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
|
||||
.name = "*GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1080,7 +1055,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8] = {
|
||||
.name = "GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1109,7 +1083,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8] = {
|
||||
.name = "G8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G8,
|
||||
.straight = GDK_MEMORY_G8,
|
||||
@@ -1138,7 +1111,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
|
||||
.name = "*GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1170,7 +1142,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16] = {
|
||||
.name = "GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1202,7 +1173,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16] = {
|
||||
.name = "G16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G16,
|
||||
.straight = GDK_MEMORY_G16,
|
||||
@@ -1234,7 +1204,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8] = {
|
||||
.name = "A8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8,
|
||||
.straight = GDK_MEMORY_A8,
|
||||
@@ -1263,7 +1232,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16] = {
|
||||
.name = "A16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16,
|
||||
.straight = GDK_MEMORY_A16,
|
||||
@@ -1295,7 +1263,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16_FLOAT] = {
|
||||
.name = "A16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16_FLOAT,
|
||||
.straight = GDK_MEMORY_A16_FLOAT,
|
||||
@@ -1326,7 +1293,6 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A32_FLOAT] = {
|
||||
.name = "A32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A32_FLOAT,
|
||||
.straight = GDK_MEMORY_A32_FLOAT,
|
||||
@@ -1695,12 +1661,6 @@ gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format)
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *
|
||||
gdk_memory_format_get_name (GdkMemoryFormat format)
|
||||
{
|
||||
return memory_formats[format].name;
|
||||
}
|
||||
|
||||
static void
|
||||
premultiply (float *rgba,
|
||||
gsize n)
|
||||
|
||||
@@ -75,7 +75,7 @@ VkFormat gdk_memory_format_vk_rgba_format (GdkMemoryFormat
|
||||
VkComponentMapping *out_swizzle);
|
||||
#endif
|
||||
guint32 gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format);
|
||||
const char * gdk_memory_format_get_name (GdkMemoryFormat format);
|
||||
|
||||
|
||||
void gdk_memory_convert (guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
|
||||
+11
-5
@@ -202,7 +202,8 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
|
||||
}
|
||||
|
||||
GdkMemoryTexture *
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture)
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format)
|
||||
{
|
||||
GdkTexture *result;
|
||||
GBytes *bytes;
|
||||
@@ -212,16 +213,21 @@ gdk_memory_texture_from_texture (GdkTexture *texture)
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
if (GDK_IS_MEMORY_TEXTURE (texture))
|
||||
return g_object_ref (GDK_MEMORY_TEXTURE (texture));
|
||||
{
|
||||
GdkMemoryTexture *memtex = GDK_MEMORY_TEXTURE (texture);
|
||||
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (texture->format);
|
||||
if (gdk_texture_get_format (texture) == format)
|
||||
return g_object_ref (memtex);
|
||||
}
|
||||
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||
data = g_malloc_n (stride, texture->height);
|
||||
|
||||
gdk_texture_do_download (texture, texture->format, data, stride);
|
||||
gdk_texture_do_download (texture, format, data, stride);
|
||||
bytes = g_bytes_new_take (data, stride * texture->height);
|
||||
result = gdk_memory_texture_new (texture->width,
|
||||
texture->height,
|
||||
texture->format,
|
||||
format,
|
||||
bytes,
|
||||
stride);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
@@ -28,7 +28,8 @@ G_BEGIN_DECLS
|
||||
#define GDK_MEMORY_GDK_PIXBUF_OPAQUE GDK_MEMORY_R8G8B8
|
||||
#define GDK_MEMORY_GDK_PIXBUF_ALPHA GDK_MEMORY_R8G8B8A8
|
||||
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture);
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format);
|
||||
GdkTexture * gdk_memory_texture_new_subtexture (GdkMemoryTexture *texture,
|
||||
int x,
|
||||
int y,
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ gdk_popup_default_init (GdkPopupInterface *iface)
|
||||
*
|
||||
* Present @popup after having processed the `GdkPopupLayout` rules.
|
||||
*
|
||||
* If the popup was previously not showing, it will be shown,
|
||||
* If the popup was previously now showing, it will be showed,
|
||||
* otherwise it will change position according to @layout.
|
||||
*
|
||||
* After calling this function, the result should be handled in response
|
||||
|
||||
@@ -745,10 +745,6 @@ gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
* @toplevel: a `GdkToplevel`
|
||||
* @gesture: a `GdkTitlebarGesture`
|
||||
*
|
||||
* Performs a title bar gesture.
|
||||
*
|
||||
* Returns: whether the gesture was performed
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gboolean
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ typedef struct _GdkVulkanContext GdkVulkanContext;
|
||||
typedef struct _GdkDmabufFormats GdkDmabufFormats;
|
||||
typedef struct _GdkDmabufTexture GdkDmabufTexture;
|
||||
|
||||
/*<private>
|
||||
/*
|
||||
* GDK_DECLARE_INTERNAL_TYPE:
|
||||
* @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
|
||||
* @module_obj_name: The name of the new type in lowercase, with words
|
||||
|
||||
+23
-20
@@ -30,7 +30,6 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -73,7 +72,8 @@ struct _GdkVulkanContextPrivate {
|
||||
VkSurfaceFormatKHR vk_format;
|
||||
GdkMemoryFormat gdk_format;
|
||||
} formats[4];
|
||||
GdkMemoryDepth current_depth;
|
||||
GdkMemoryDepth current_format;
|
||||
GdkMemoryFormat offscreen_formats[4];
|
||||
|
||||
VkSwapchainKHR swapchain;
|
||||
VkSemaphore draw_semaphore;
|
||||
@@ -473,8 +473,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
.minImageCount = CLAMP (4,
|
||||
capabilities.minImageCount,
|
||||
capabilities.maxImageCount ? capabilities.maxImageCount : G_MAXUINT32),
|
||||
.imageFormat = priv->formats[priv->current_depth].vk_format.format,
|
||||
.imageColorSpace = priv->formats[priv->current_depth].vk_format.colorSpace,
|
||||
.imageFormat = priv->formats[priv->current_format].vk_format.format,
|
||||
.imageColorSpace = priv->formats[priv->current_format].vk_format.colorSpace,
|
||||
.imageExtent = capabilities.currentExtent,
|
||||
.imageArrayLayers = 1,
|
||||
.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
@@ -643,22 +643,19 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
VkResult acquire_result;
|
||||
guint i;
|
||||
|
||||
if (depth != priv->current_depth)
|
||||
if (depth != priv->current_format)
|
||||
{
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_depth].gdk_format)
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_format].gdk_format)
|
||||
{
|
||||
GdkMemoryDepth old_depth = priv->current_depth;
|
||||
GError *error = NULL;
|
||||
|
||||
priv->current_depth = depth;
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
priv->current_depth = old_depth;
|
||||
return;
|
||||
}
|
||||
}
|
||||
priv->current_format = depth;
|
||||
}
|
||||
for (i = 0; i < priv->n_images; i++)
|
||||
{
|
||||
@@ -827,6 +824,11 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (!priv->vulkan_ref)
|
||||
return FALSE;
|
||||
|
||||
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_U16] = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_FLOAT16] = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_FLOAT32] = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||
|
||||
if (surface == NULL)
|
||||
{
|
||||
for (i = 0; i < G_N_ELEMENTS (priv->formats); i++)
|
||||
@@ -882,6 +884,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
{
|
||||
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
};
|
||||
break;
|
||||
|
||||
@@ -958,6 +961,15 @@ out_surface:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GdkMemoryFormat
|
||||
gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||
GdkMemoryDepth depth)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
return priv->offscreen_formats[depth];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
||||
{
|
||||
@@ -1279,18 +1291,9 @@ gdk_vulkan_context_get_image_format (GdkVulkanContext *context)
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_FORMAT_UNDEFINED);
|
||||
|
||||
return priv->formats[priv->current_depth].vk_format.format;
|
||||
return priv->formats[priv->current_format].vk_format.format;
|
||||
}
|
||||
|
||||
GdkMemoryFormat
|
||||
gdk_vulkan_context_get_memory_format (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), GDK_MEMORY_DEFAULT);
|
||||
|
||||
return priv->formats[priv->current_depth].gdk_format;
|
||||
}
|
||||
/**
|
||||
* gdk_vulkan_context_get_n_images:
|
||||
* @context: a `GdkVulkanContext`
|
||||
|
||||
@@ -94,13 +94,15 @@ VkDevice gdk_vulkan_context_get_device (GdkVulk
|
||||
VkQueue gdk_vulkan_context_get_queue (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context);
|
||||
VkFormat gdk_vulkan_context_get_image_format (GdkVulkanContext *context);
|
||||
GdkMemoryFormat gdk_vulkan_context_get_memory_format (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_n_images (GdkVulkanContext *context);
|
||||
VkImage gdk_vulkan_context_get_image (GdkVulkanContext *context,
|
||||
guint id);
|
||||
uint32_t gdk_vulkan_context_get_draw_index (GdkVulkanContext *context);
|
||||
VkSemaphore gdk_vulkan_context_get_draw_semaphore (GdkVulkanContext *context);
|
||||
|
||||
GdkMemoryFormat gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||
GdkMemoryDepth depth);
|
||||
|
||||
#else /* !GDK_RENDERING_VULKAN */
|
||||
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ void _gdk_macos_display_set_drop (GdkMacosDisp
|
||||
GdkDrop *drop);
|
||||
void _gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *monitor,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "gdk/gdkeventsprivate.h"
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
#define GRIP_WIDTH 15
|
||||
#define GRIP_HEIGHT 15
|
||||
#define GDK_LION_RESIZE 5
|
||||
@@ -174,7 +175,7 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
|
||||
if (nsflags & NSEventModifierFlagOption)
|
||||
modifiers |= GDK_ALT_MASK;
|
||||
if (nsflags & NSEventModifierFlagCommand)
|
||||
modifiers |= GDK_META_MASK;
|
||||
modifiers |= GDK_MOD2_MASK;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
@@ -313,6 +314,13 @@ get_group_from_ns_event (NSEvent *nsevent)
|
||||
return ([nsevent modifierFlags] & NSEventModifierFlagOption) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
add_virtual_modifiers (GdkModifierType *state)
|
||||
{
|
||||
if (*state & GDK_MOD2_MASK)
|
||||
*state |= GDK_META_MASK;
|
||||
}
|
||||
|
||||
static GdkEvent *
|
||||
fill_key_event (GdkMacosDisplay *display,
|
||||
GdkMacosSurface *surface,
|
||||
@@ -359,7 +367,7 @@ fill_key_event (GdkMacosDisplay *display,
|
||||
{
|
||||
case GDK_KEY_Meta_R:
|
||||
case GDK_KEY_Meta_L:
|
||||
mask = GDK_META_MASK;
|
||||
mask = GDK_MOD2_MASK;
|
||||
break;
|
||||
case GDK_KEY_Shift_R:
|
||||
case GDK_KEY_Shift_L:
|
||||
@@ -387,6 +395,7 @@ fill_key_event (GdkMacosDisplay *display,
|
||||
}
|
||||
|
||||
state |= _gdk_macos_display_get_current_mouse_modifiers (display);
|
||||
add_virtual_modifiers (&state);
|
||||
|
||||
translated.keyval = keyval;
|
||||
translated.consumed = consumed;
|
||||
|
||||
@@ -82,7 +82,6 @@ has_surface_at_origin (const GList *surfaces,
|
||||
static void
|
||||
_gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *selected_monitor,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
@@ -96,11 +95,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface));
|
||||
|
||||
mouse = [NSEvent mouseLocation];
|
||||
if (!selected_monitor)
|
||||
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
|
||||
else
|
||||
monitor = selected_monitor;
|
||||
|
||||
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
/* First place at top-left of current monitor */
|
||||
@@ -109,7 +104,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
|
||||
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (selected_monitor ? selected_monitor : surface->best_monitor), &surface_rect);
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
@@ -143,7 +138,6 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
void
|
||||
_gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
GdkMonitor *monitor,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
@@ -157,5 +151,5 @@ _gdk_macos_display_position_surface (GdkMacosDisplay *self,
|
||||
if (transient_for != NULL)
|
||||
_gdk_macos_display_position_toplevel_with_parent (self, surface, GDK_MACOS_SURFACE (transient_for), x, y);
|
||||
else
|
||||
_gdk_macos_display_position_toplevel (self, surface, monitor, x, y);
|
||||
_gdk_macos_display_position_toplevel (self, surface, x, y);
|
||||
}
|
||||
|
||||
@@ -261,30 +261,7 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
{
|
||||
GdkMonitor *fullscreen_monitor =
|
||||
gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||
|
||||
if (fullscreen_monitor)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
|
||||
GDK_MACOS_SURFACE (self),
|
||||
fullscreen_monitor,
|
||||
&x, &y);
|
||||
|
||||
GDK_DEBUG (MISC, "Moving toplevel \"%s\" to %d,%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
x, y);
|
||||
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
|
||||
}
|
||||
|
||||
_gdk_macos_toplevel_surface_fullscreen (self);
|
||||
}
|
||||
_gdk_macos_toplevel_surface_fullscreen (self);
|
||||
else
|
||||
_gdk_macos_toplevel_surface_unfullscreen (self);
|
||||
}
|
||||
@@ -297,7 +274,6 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
|
||||
GDK_MACOS_SURFACE (self),
|
||||
gdk_toplevel_layout_get_fullscreen_monitor (layout),
|
||||
&x, &y);
|
||||
|
||||
GDK_DEBUG (MISC, "Placing new toplevel \"%s\" at %d,%d",
|
||||
@@ -681,7 +657,6 @@ _gdk_macos_toplevel_surface_attach_to_parent (GdkMacosToplevelSurface *self)
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (surface->display),
|
||||
GDK_MACOS_SURFACE (surface),
|
||||
NULL,
|
||||
&x, &y);
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (surface), x, y);
|
||||
}
|
||||
|
||||
@@ -10,13 +10,6 @@
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
/**
|
||||
* GskBroadwayRenderer:
|
||||
*
|
||||
* A Broadway based renderer.
|
||||
*
|
||||
* See [class@Gsk.Renderer].
|
||||
*/
|
||||
struct _GskBroadwayRenderer
|
||||
{
|
||||
GskRenderer parent_instance;
|
||||
|
||||
@@ -972,7 +972,7 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
|
||||
|
||||
if (texture_id == 0)
|
||||
{
|
||||
downloaded_texture = gdk_memory_texture_from_texture (texture);
|
||||
downloaded_texture = gdk_memory_texture_from_texture (texture, gdk_texture_get_format (texture));
|
||||
|
||||
/* The download_texture() call may have switched the GL context. Make sure
|
||||
* the right context is at work again.
|
||||
@@ -1471,7 +1471,8 @@ gsk_gl_driver_add_texture_slices (GskGLDriver *self,
|
||||
}
|
||||
|
||||
slices = g_new0 (GskGLTextureSlice, n_slices);
|
||||
memtex = gdk_memory_texture_from_texture (texture);
|
||||
memtex = gdk_memory_texture_from_texture (texture,
|
||||
gdk_texture_get_format (texture));
|
||||
|
||||
if (ensure_mipmap)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ gsk_gpu_blend_mode_op_print_instance (GskGpuShaderOp *shader,
|
||||
{
|
||||
GskGpuBlendmodeInstance *instance = (GskGpuBlendmodeInstance *) instance_;
|
||||
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
|
||||
@@ -21,7 +21,7 @@ color_equal (const float *color1,
|
||||
const float *color2)
|
||||
{
|
||||
return gdk_rgba_equal (&(GdkRGBA) { color1[0], color1[1], color1[2], color1[3] },
|
||||
&(GdkRGBA) { color2[0], color2[1], color2[2], color2[3] });
|
||||
&(GdkRGBA) { color1[0], color1[1], color1[2], color1[3] });
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+14
-5
@@ -14,7 +14,7 @@ struct _GskGpuClearOp
|
||||
GskGpuOp op;
|
||||
|
||||
cairo_rectangle_int_t rect;
|
||||
float color[4];
|
||||
GdkRGBA color;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -29,14 +29,23 @@ gsk_gpu_clear_op_print (GskGpuOp *op,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuClearOp *self = (GskGpuClearOp *) op;
|
||||
float rgba[4];
|
||||
|
||||
gsk_gpu_print_op (string, indent, "clear");
|
||||
gsk_gpu_print_int_rect (string, &self->rect);
|
||||
gsk_gpu_print_rgba (string, self->color);
|
||||
gsk_gpu_rgba_to_float (&self->color, rgba);
|
||||
gsk_gpu_print_rgba (string, rgba);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
static void
|
||||
gsk_gpu_init_clear_value (VkClearValue *value,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
gsk_gpu_rgba_to_float (rgba, value->color.float32);
|
||||
}
|
||||
|
||||
static GskGpuOp *
|
||||
gsk_gpu_clear_op_vk_command (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
@@ -45,7 +54,7 @@ gsk_gpu_clear_op_vk_command (GskGpuOp *op,
|
||||
GskGpuClearOp *self = (GskGpuClearOp *) op;
|
||||
VkClearValue clear_value;
|
||||
|
||||
memcpy (clear_value.color.float32, self->color, sizeof (float) * 4);
|
||||
gsk_gpu_init_clear_value (&clear_value, &self->color);
|
||||
|
||||
vkCmdClearAttachments (state->vk_command_buffer,
|
||||
1,
|
||||
@@ -83,7 +92,7 @@ gsk_gpu_clear_op_gl_command (GskGpuOp *op,
|
||||
else
|
||||
glScissor (self->rect.x, self->rect.y, self->rect.width, self->rect.height);
|
||||
|
||||
glClearColor (self->color[0], self->color[1], self->color[2], self->color[3]);
|
||||
glClearColor (self->color.red, self->color.green, self->color.blue, self->color.alpha);
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glScissor (scissor[0], scissor[1], scissor[2], scissor[3]);
|
||||
@@ -112,5 +121,5 @@ gsk_gpu_clear_op (GskGpuFrame *frame,
|
||||
self = (GskGpuClearOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_CLEAR_OP_CLASS);
|
||||
|
||||
self->rect = *rect;
|
||||
gsk_gpu_rgba_to_float (color, self->color);
|
||||
self->color = *color;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "gskvulkanimageprivate.h"
|
||||
#endif
|
||||
|
||||
#include "gdk/gdkdmabuftexturebuilderprivate.h"
|
||||
#include "gdk/gdkdmabuftextureprivate.h"
|
||||
#include "gdk/gdkglcontextprivate.h"
|
||||
|
||||
@@ -263,23 +262,6 @@ gsk_gl_texture_data_free (gpointer user_data)
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
typedef struct
|
||||
{
|
||||
GdkDmabuf dmabuf;
|
||||
} Texture;
|
||||
|
||||
static void
|
||||
release_dmabuf_texture (gpointer data)
|
||||
{
|
||||
Texture *texture = data;
|
||||
|
||||
for (unsigned int i = 0; i < texture->dmabuf.n_planes; i++)
|
||||
g_close (texture->dmabuf.planes[i].fd, NULL);
|
||||
g_free (texture);
|
||||
}
|
||||
#endif
|
||||
|
||||
static GskGpuOp *
|
||||
gsk_gpu_download_op_gl_command (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
@@ -289,44 +271,12 @@ gsk_gpu_download_op_gl_command (GskGpuOp *op,
|
||||
GdkGLTextureBuilder *builder;
|
||||
GskGLTextureData *data;
|
||||
GdkGLContext *context;
|
||||
guint texture_id;
|
||||
|
||||
context = GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame));
|
||||
texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
if (self->allow_dmabuf)
|
||||
{
|
||||
Texture *texture;
|
||||
|
||||
texture = g_new0 (Texture, 1);
|
||||
|
||||
if (gdk_gl_context_export_dmabuf (context, texture_id, &texture->dmabuf))
|
||||
{
|
||||
GdkDmabufTextureBuilder *db;
|
||||
|
||||
db = gdk_dmabuf_texture_builder_new ();
|
||||
gdk_dmabuf_texture_builder_set_display (db, gdk_gl_context_get_display (context));
|
||||
gdk_dmabuf_texture_builder_set_dmabuf (db, &texture->dmabuf);
|
||||
gdk_dmabuf_texture_builder_set_premultiplied (db, gdk_memory_format_get_premultiplied (gsk_gpu_image_get_format (self->image)));
|
||||
gdk_dmabuf_texture_builder_set_width (db, gsk_gpu_image_get_width (self->image));
|
||||
gdk_dmabuf_texture_builder_set_height (db, gsk_gpu_image_get_height (self->image));
|
||||
|
||||
self->texture = gdk_dmabuf_texture_builder_build (db, release_dmabuf_texture, texture, NULL);
|
||||
|
||||
g_object_unref (db);
|
||||
|
||||
if (self->texture)
|
||||
return op->next;
|
||||
}
|
||||
|
||||
g_free (texture);
|
||||
}
|
||||
#endif
|
||||
|
||||
data = g_new (GskGLTextureData, 1);
|
||||
data->context = g_object_ref (context);
|
||||
data->texture_id = texture_id;
|
||||
data->texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
|
||||
|
||||
if (gdk_gl_context_has_feature (context, GDK_GL_FEATURE_SYNC))
|
||||
data->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "gskgpuframeprivate.h"
|
||||
#include "gskgpuprintprivate.h"
|
||||
#include "gskrectprivate.h"
|
||||
#include "gskenumtypes.h"
|
||||
|
||||
#include "gpu/shaders/gskgpumaskinstance.h"
|
||||
|
||||
@@ -23,7 +22,6 @@ gsk_gpu_mask_op_print_instance (GskGpuShaderOp *shader,
|
||||
{
|
||||
GskGpuMaskInstance *instance = (GskGpuMaskInstance *) instance_;
|
||||
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_MASK_MODE, shader->variation);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->source_id);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->mask_id);
|
||||
|
||||
@@ -140,10 +140,9 @@ void
|
||||
gsk_gpu_print_image (GString *string,
|
||||
GskGpuImage *image)
|
||||
{
|
||||
g_string_append_printf (string, "%zux%zu %s ",
|
||||
g_string_append_printf (string, "%zux%zu ",
|
||||
gsk_gpu_image_get_width (image),
|
||||
gsk_gpu_image_get_height (image),
|
||||
gdk_memory_format_get_name (gsk_gpu_image_get_format (image)));
|
||||
gsk_gpu_image_get_height (image));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+14
-15
@@ -202,9 +202,6 @@ gsk_vulkan_device_check_format (GskVulkanDevice *device,
|
||||
#define CHECK_FLAGS (GSK_GPU_IMAGE_NO_BLIT | GSK_GPU_IMAGE_FILTERABLE | GSK_GPU_IMAGE_RENDERABLE)
|
||||
GskGpuImageFlags flags;
|
||||
|
||||
if (vk_format == VK_FORMAT_UNDEFINED)
|
||||
return FALSE;
|
||||
|
||||
if (vk_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT &&
|
||||
!gsk_component_mapping_is_framebuffer_compatible (vk_components))
|
||||
return FALSE;
|
||||
@@ -264,13 +261,15 @@ gsk_vulkan_image_new (GskVulkanDevice *device,
|
||||
|
||||
/* First, try the actual format */
|
||||
vk_format = gdk_memory_format_vk_format (format, &vk_components);
|
||||
if (!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
/* Second, try the potential RGBA format */
|
||||
vk_format = gdk_memory_format_vk_rgba_format (format, NULL, &vk_components);
|
||||
if (!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
@@ -282,7 +281,8 @@ gsk_vulkan_image_new (GskVulkanDevice *device,
|
||||
for (i = 0; fallbacks[i] != -1; i++)
|
||||
{
|
||||
vk_format = gdk_memory_format_vk_format (fallbacks[i], &vk_components);
|
||||
if (gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_format (device, vk_format, &vk_components, required_flags,
|
||||
tiling, usage, width, height,
|
||||
&tiling, &flags))
|
||||
{
|
||||
@@ -433,7 +433,6 @@ GskGpuImage *
|
||||
gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
VkImage image,
|
||||
VkFormat format,
|
||||
GdkMemoryFormat memory_format,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
@@ -450,8 +449,8 @@ gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
self->vk_image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
self->vk_access = 0;
|
||||
|
||||
/* FIXME: The flags here are very suboptimal */
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self), 0, memory_format, width, height);
|
||||
/* FIXME: The memory format and flags here are very suboptimal */
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self), 0, GDK_MEMORY_DEFAULT, width, height);
|
||||
|
||||
gsk_vulkan_image_create_view (self,
|
||||
format,
|
||||
@@ -548,9 +547,6 @@ gsk_vulkan_device_check_dmabuf_format (GskVulkanDevice *device,
|
||||
.pNext = &drm_properties
|
||||
};
|
||||
|
||||
if (vk_format == VK_FORMAT_UNDEFINED)
|
||||
return FALSE;
|
||||
|
||||
if (!gsk_component_mapping_is_framebuffer_compatible (vk_components))
|
||||
return FALSE;
|
||||
|
||||
@@ -636,7 +632,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
|
||||
/* First, try the actual format */
|
||||
vk_format = gdk_memory_format_vk_format (format, &vk_components);
|
||||
if (!gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format == VK_FORMAT_UNDEFINED ||
|
||||
!gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
/* Second, try the potential RGBA format, but as a fallback */
|
||||
@@ -644,7 +641,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
vk_format = gdk_memory_format_vk_rgba_format (format, &rgba_format, NULL);
|
||||
if (vk_format != VK_FORMAT_UNDEFINED)
|
||||
vk_format = gdk_memory_format_vk_format (rgba_format, &vk_components);
|
||||
if (gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
format = rgba_format;
|
||||
@@ -659,7 +657,8 @@ gsk_vulkan_image_new_dmabuf (GskVulkanDevice *device,
|
||||
for (i = 0; fallbacks[i] != -1; i++)
|
||||
{
|
||||
vk_format = gdk_memory_format_vk_format (fallbacks[i], &vk_components);
|
||||
if (gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
if (vk_format != VK_FORMAT_UNDEFINED &&
|
||||
gsk_vulkan_device_check_dmabuf_format (device, vk_format, &vk_components, width, height,
|
||||
modifiers, &flags, &n_modifiers))
|
||||
{
|
||||
format = fallbacks[i];
|
||||
|
||||
@@ -14,7 +14,6 @@ G_DECLARE_FINAL_TYPE (GskVulkanImage, gsk_vulkan_image, GSK, VULKAN_IMAGE, GskGp
|
||||
GskGpuImage * gsk_vulkan_image_new_for_swapchain (GskVulkanDevice *device,
|
||||
VkImage image,
|
||||
VkFormat format,
|
||||
GdkMemoryFormat memory_format,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ gsk_vulkan_renderer_update_images_cb (GdkVulkanContext *context,
|
||||
self->targets[i] = gsk_vulkan_image_new_for_swapchain (device,
|
||||
gdk_vulkan_context_get_image (context, i),
|
||||
gdk_vulkan_context_get_image_format (context),
|
||||
gdk_vulkan_context_get_memory_format (context),
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3335,15 +3335,17 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
|
||||
self->children[0] = gsk_render_node_ref (children[0]);
|
||||
node->offscreen_for_opacity = children[0]->offscreen_for_opacity;
|
||||
node->preferred_depth = children[0]->preferred_depth;
|
||||
gsk_rect_init_from_rect (&bounds, &(children[0]->bounds));
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
|
||||
gsk_render_node_get_preferred_depth (children[0]));
|
||||
|
||||
for (guint i = 1; i < n_children; i++)
|
||||
{
|
||||
self->children[i] = gsk_render_node_ref (children[i]);
|
||||
self->disjoint = self->disjoint && !gsk_rect_intersects (&bounds, &(children[i]->bounds));
|
||||
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth, children[i]->preferred_depth);
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
|
||||
gsk_render_node_get_preferred_depth (children[i]));
|
||||
node->offscreen_for_opacity = node->offscreen_for_opacity || children[i]->offscreen_for_opacity;
|
||||
}
|
||||
|
||||
@@ -4767,8 +4769,6 @@ gsk_fill_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_FILL_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
node->preferred_depth = gsk_render_node_get_preferred_depth (child);
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->path = gsk_path_ref (path);
|
||||
@@ -4976,8 +4976,6 @@ gsk_stroke_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_STROKE_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
node->preferred_depth = gsk_render_node_get_preferred_depth (child);
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->path = gsk_path_ref (path);
|
||||
|
||||
@@ -1005,7 +1005,7 @@ ensure_fontmap (Context *context)
|
||||
|
||||
context->fontmap = pango_cairo_font_map_new ();
|
||||
|
||||
config = FcConfigCreate ();
|
||||
config = FcInitLoadConfig ();
|
||||
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (context->fontmap), config);
|
||||
FcConfigDestroy (config);
|
||||
|
||||
@@ -2990,13 +2990,8 @@ printer_init_collect_font_info (Printer *printer,
|
||||
info->face = hb_face_reference (hb_font_get_face (pango_font_get_hb_font (font)));
|
||||
if (!g_object_get_data (G_OBJECT (pango_font_get_font_map (font)), "font-files"))
|
||||
{
|
||||
if (g_strcmp0 (g_getenv ("GSK_SUBSET_FONTS"), "1") == 0)
|
||||
{
|
||||
info->input = hb_subset_input_create_or_fail ();
|
||||
hb_subset_input_set_flags (info->input, HB_SUBSET_FLAGS_RETAIN_GIDS);
|
||||
}
|
||||
else
|
||||
info->serialized = TRUE; /* Don't subset (or serialize) system fonts */
|
||||
info->input = hb_subset_input_create_or_fail ();
|
||||
hb_subset_input_set_flags (info->input, HB_SUBSET_FLAGS_RETAIN_GIDS);
|
||||
}
|
||||
|
||||
g_hash_table_insert (printer->fonts, info->face, info);
|
||||
@@ -3027,11 +3022,11 @@ printer_init_duplicates_for_node (Printer *printer,
|
||||
|
||||
switch (gsk_render_node_get_node_type (node))
|
||||
{
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
printer_init_collect_font_info (printer, node);
|
||||
break;
|
||||
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
@@ -3627,6 +3622,33 @@ append_texture_param (Printer *p,
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
static void
|
||||
print_font (PangoFont *font)
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
char *s;
|
||||
hb_face_t *face;
|
||||
hb_blob_t *blob;
|
||||
const char *data;
|
||||
unsigned int length;
|
||||
char *csum;
|
||||
|
||||
desc = pango_font_describe_with_absolute_size (font);
|
||||
s = pango_font_description_to_string (desc);
|
||||
|
||||
face = hb_font_get_face (pango_font_get_hb_font (font));
|
||||
blob = hb_face_reference_blob (face);
|
||||
|
||||
data = hb_blob_get_data (blob, &length);
|
||||
csum = g_compute_checksum_for_data (G_CHECKSUM_SHA256, (const guchar *)data, length);
|
||||
|
||||
g_print ("%s, face %p, sha %s\n", s, face, csum);
|
||||
|
||||
g_free (csum);
|
||||
hb_blob_destroy (blob);
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_text_node_serialize_font (GskRenderNode *node,
|
||||
Printer *p)
|
||||
@@ -3647,6 +3669,8 @@ gsk_text_node_serialize_font (GskRenderNode *node,
|
||||
g_free (s);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
g_print ("serializing ");
|
||||
print_font (font);
|
||||
info = g_hash_table_lookup (p->fonts, hb_font_get_face (pango_font_get_hb_font (font)));
|
||||
if (info->serialized)
|
||||
return;
|
||||
|
||||
@@ -489,9 +489,6 @@ gsk_transform_matrix_with_category (GskTransform *next,
|
||||
*
|
||||
* Multiplies @next with the given @matrix.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: The new transform
|
||||
**/
|
||||
GskTransform *
|
||||
@@ -646,9 +643,6 @@ static const GskTransformClass GSK_TRANSLATE_TRANSFORM_CLASS =
|
||||
*
|
||||
* Translates @next in 2-dimensional space by @point.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
**/
|
||||
GskTransform *
|
||||
@@ -669,9 +663,6 @@ gsk_transform_translate (GskTransform *next,
|
||||
*
|
||||
* Translates @next by @point.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
**/
|
||||
GskTransform *
|
||||
@@ -889,9 +880,6 @@ normalize_angle (float angle)
|
||||
* Rotates @next @angle degrees in 2D - or in 3D-speak, around the Z axis.
|
||||
* The rotation happens around the origin point of (0, 0).
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
*/
|
||||
GskTransform *
|
||||
@@ -1020,9 +1008,6 @@ static const GskTransformClass GSK_ROTATE3D_TRANSFORM_CLASS =
|
||||
*
|
||||
* For a rotation in 2D space, use [method@Gsk.Transform.rotate]
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
*/
|
||||
GskTransform *
|
||||
@@ -1199,9 +1184,6 @@ static const GskTransformClass GSK_SKEW_TRANSFORM_CLASS =
|
||||
*
|
||||
* Applies a skew transform.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
*
|
||||
* Since: 4.6
|
||||
@@ -1374,9 +1356,6 @@ static const GskTransformClass GSK_SCALE_TRANSFORM_CLASS =
|
||||
*
|
||||
* Use [method@Gsk.Transform.scale_3d] to scale in all 3 dimensions.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
**/
|
||||
GskTransform *
|
||||
@@ -1396,9 +1375,6 @@ gsk_transform_scale (GskTransform *next,
|
||||
*
|
||||
* Scales @next by the given factors.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
**/
|
||||
GskTransform *
|
||||
@@ -1534,9 +1510,6 @@ static const GskTransformClass GSK_PERSPECTIVE_TRANSFORM_CLASS =
|
||||
* those with negative Z values towards the origin. Points
|
||||
* on the z=0 plane are unchanged.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: The new transform
|
||||
*/
|
||||
GskTransform *
|
||||
@@ -1946,9 +1919,6 @@ gsk_transform_to_translate (GskTransform *self,
|
||||
*
|
||||
* Applies all the operations from @other to @next.
|
||||
*
|
||||
* This function consumes @next. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The new transform
|
||||
*/
|
||||
GskTransform *
|
||||
@@ -1985,9 +1955,6 @@ gsk_transform_transform (GskTransform *next,
|
||||
* between those cases, you should check @self is not %NULL
|
||||
* before calling this function.
|
||||
*
|
||||
* This function consumes @self. Use [method@Gsk.Transform.ref] first
|
||||
* if you want to keep it around.
|
||||
*
|
||||
* Returns: (nullable): The inverted transform
|
||||
*/
|
||||
GskTransform *
|
||||
|
||||
+2
-2
@@ -42,8 +42,6 @@ gsk_public_sources = files([
|
||||
'gskstroke.c',
|
||||
'gsktransform.c',
|
||||
'gl/gskglrenderer.c',
|
||||
'gpu/gsknglrenderer.c',
|
||||
'gpu/gskvulkanrenderer.c',
|
||||
])
|
||||
|
||||
gsk_private_sources = files([
|
||||
@@ -110,6 +108,8 @@ gsk_private_sources = files([
|
||||
'gpu/gskgputextureop.c',
|
||||
'gpu/gskgpuuberop.c',
|
||||
'gpu/gskgpuuploadop.c',
|
||||
'gpu/gsknglrenderer.c',
|
||||
'gpu/gskvulkanrenderer.c',
|
||||
])
|
||||
|
||||
gsk_f16c_sources = files([
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
<property name="AccessibleId" type="s" access="read"/>
|
||||
|
||||
<property name="HelpText" type="s" access="read"/>
|
||||
|
||||
<method name="GetChildAtIndex">
|
||||
<arg direction="in" name="index" type="i"/>
|
||||
<arg direction="out" type="(so)"/>
|
||||
|
||||
@@ -729,7 +729,7 @@ handle_accessible_get_property (GDBusConnection *connection,
|
||||
res = get_parent_context_ref (accessible);
|
||||
else if (g_strcmp0 (property_name, "ChildCount") == 0)
|
||||
res = g_variant_new_int32 (gtk_at_spi_context_get_child_count (self));
|
||||
else if (g_strcmp0 (property_name, "HelpText") == 0)
|
||||
else if (g_strcmp0 (property_name, "HelpText"))
|
||||
{
|
||||
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_HELP_TEXT))
|
||||
{
|
||||
|
||||
@@ -780,17 +780,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
_gtk_marshal_BOOLEAN__ENUM_INT_BOOLEAN_BOOLEANv);
|
||||
|
||||
/* Key bindings */
|
||||
|
||||
#ifdef __APPLE__
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_a, GDK_META_MASK,
|
||||
"select-all",
|
||||
NULL);
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_a, GDK_META_MASK | GDK_SHIFT_MASK,
|
||||
"unselect-all",
|
||||
NULL);
|
||||
#else
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_a, GDK_CONTROL_MASK,
|
||||
"select-all",
|
||||
@@ -799,8 +788,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
GDK_KEY_a, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
|
||||
"unselect-all",
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_space, GDK_CONTROL_MASK,
|
||||
"toggle-cursor-item",
|
||||
@@ -2075,11 +2062,7 @@ gtk_icon_view_button_press (GtkGestureClick *gesture,
|
||||
if (button == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
GdkModifierType extend_mod_mask = GDK_SHIFT_MASK;
|
||||
#ifdef __APPLE__
|
||||
GdkModifierType modify_mod_mask = GDK_META_MASK;
|
||||
#else
|
||||
GdkModifierType modify_mod_mask = GDK_CONTROL_MASK;
|
||||
#endif
|
||||
|
||||
state = gdk_event_get_modifier_state (event);
|
||||
|
||||
|
||||
@@ -789,7 +789,10 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
if (gtk_css_node_get_parent (priv->cssnode))
|
||||
ctx.parent_style = gtk_css_node_get_style (gtk_css_node_get_parent (priv->cssnode));
|
||||
|
||||
val = gtk_css_value_resolve (color, &ctx, _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
val = gtk_css_color_value_resolve (color,
|
||||
GTK_CSS_PROPERTY_COLOR,
|
||||
&ctx,
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
if (val == NULL)
|
||||
return FALSE;
|
||||
@@ -937,10 +940,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1472,17 +1472,11 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_space, GDK_CONTROL_MASK, "toggle-cursor-row", NULL);
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Space, GDK_CONTROL_MASK, "toggle-cursor-row", NULL);
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_a, GDK_META_MASK, "select-all", NULL);
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_A, GDK_META_MASK | GDK_SHIFT_MASK, "unselect-all", NULL);
|
||||
#else
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_a, GDK_CONTROL_MASK, "select-all", NULL);
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_slash, GDK_CONTROL_MASK, "select-all", NULL);
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_A, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "unselect-all", NULL);
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_backslash, GDK_CONTROL_MASK, "unselect-all", NULL);
|
||||
#endif
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_space, GDK_SHIFT_MASK, "select-cursor-row", "(b)", TRUE);
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Space, GDK_SHIFT_MASK, "select-cursor-row", "(b)", TRUE);
|
||||
@@ -2718,9 +2712,6 @@ get_current_selection_modifiers (GtkEventController *controller,
|
||||
|
||||
state = gtk_event_controller_get_current_event_state (controller);
|
||||
*modify = (state & GDK_CONTROL_MASK) != 0;
|
||||
#ifdef __APPLE__
|
||||
*modify = *modify | ((state & GDK_META_MASK) != 0);
|
||||
#endif
|
||||
*extend = (state & GDK_SHIFT_MASK) != 0;
|
||||
}
|
||||
|
||||
@@ -4206,20 +4197,20 @@ gtk_tree_view_snapshot_grid_line (GtkTreeView *tree_view,
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2, 1);
|
||||
data = cairo_image_surface_get_data (surface);
|
||||
/* just color the first pixel... */
|
||||
data[0] = round (CLAMP (grid_line_color->blue, 0, 1) * 255);
|
||||
data[1] = round (CLAMP (grid_line_color->green, 0, 1) * 255);
|
||||
data[2] = round (CLAMP (grid_line_color->red, 0, 1) * 255);
|
||||
data[3] = round (CLAMP (grid_line_color->alpha, 0, 1) * 255);
|
||||
data[0] = round (grid_line_color->blue * 255);
|
||||
data[1] = round (grid_line_color->green * 255);
|
||||
data[2] = round (grid_line_color->red * 255);
|
||||
data[3] = round (grid_line_color->alpha * 255);
|
||||
|
||||
priv->horizontal_grid_line_texture = gdk_texture_new_for_surface (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 2);
|
||||
data = cairo_image_surface_get_data (surface);
|
||||
data[0] = round (CLAMP (grid_line_color->blue, 0, 1) * 255);
|
||||
data[1] = round (CLAMP (grid_line_color->green, 0, 1) * 255);
|
||||
data[2] = round (CLAMP (grid_line_color->red, 0, 1) * 255);
|
||||
data[3] = round (CLAMP (grid_line_color->alpha, 0, 1) * 255);
|
||||
data[0] = round (grid_line_color->blue * 255);
|
||||
data[1] = round (grid_line_color->green * 255);
|
||||
data[2] = round (grid_line_color->red * 255);
|
||||
data[3] = round (grid_line_color->alpha * 255);
|
||||
|
||||
priv->vertical_grid_line_texture = gdk_texture_new_for_surface (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
@@ -4281,20 +4272,20 @@ gtk_tree_view_snapshot_tree_line (GtkTreeView *tree_view,
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2, 1);
|
||||
data = cairo_image_surface_get_data (surface);
|
||||
/* just color the first pixel... */
|
||||
data[0] = round (CLAMP (tree_line_color->blue, 0, 1) * 255);
|
||||
data[1] = round (CLAMP (tree_line_color->green, 0, 1) * 255);
|
||||
data[2] = round (CLAMP (tree_line_color->red, 0, 1) * 255);
|
||||
data[3] = round (CLAMP (tree_line_color->alpha, 0, 1) * 255);
|
||||
data[0] = round (tree_line_color->blue * 255);
|
||||
data[1] = round (tree_line_color->green * 255);
|
||||
data[2] = round (tree_line_color->red * 255);
|
||||
data[3] = round (tree_line_color->alpha * 255);
|
||||
|
||||
priv->horizontal_tree_line_texture = gdk_texture_new_for_surface (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 2);
|
||||
data = cairo_image_surface_get_data (surface);
|
||||
data[0] = round (CLAMP (tree_line_color->blue, 0, 1) * 255);
|
||||
data[1] = round (CLAMP (tree_line_color->green, 0, 1) * 255);
|
||||
data[2] = round (CLAMP (tree_line_color->red, 0, 1) * 255);
|
||||
data[3] = round (CLAMP (tree_line_color->alpha, 0, 1) * 255);
|
||||
data[0] = round (tree_line_color->blue * 255);
|
||||
data[1] = round (tree_line_color->green * 255);
|
||||
data[2] = round (tree_line_color->red * 255);
|
||||
data[3] = round (tree_line_color->alpha * 255);
|
||||
|
||||
priv->vertical_tree_line_texture = gdk_texture_new_for_surface (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
@@ -13825,11 +13816,7 @@ gtk_tree_view_search_key_pressed (GtkEventControllerKey *key,
|
||||
{
|
||||
GtkTreeViewPrivate *priv = gtk_tree_view_get_instance_private (tree_view);
|
||||
GtkWidget *widget = priv->search_entry;
|
||||
#ifdef __APPLE__
|
||||
GdkModifierType default_accel = GDK_META_MASK;
|
||||
#else
|
||||
GdkModifierType default_accel = GDK_CONTROL_MASK;
|
||||
#endif
|
||||
GdkModifierType default_accel;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
@@ -13843,6 +13830,8 @@ gtk_tree_view_search_key_pressed (GtkEventControllerKey *key,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default_accel = GDK_CONTROL_MASK;
|
||||
|
||||
/* select previous matching iter */
|
||||
if (keyval == GDK_KEY_Up || keyval == GDK_KEY_KP_Up)
|
||||
{
|
||||
|
||||
+2
-2
@@ -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
-78
@@ -101,12 +101,6 @@
|
||||
* NULL);
|
||||
* ```
|
||||
*
|
||||
* ## Shortcuts and Gestures
|
||||
*
|
||||
* `GtkAboutDialog` supports the following keyboard shortcuts:
|
||||
*
|
||||
* - <kbd>Escape</kbd> closes the window.
|
||||
*
|
||||
* ## CSS nodes
|
||||
*
|
||||
* `GtkAboutDialog` has a single CSS node with the name `window` and style
|
||||
@@ -207,10 +201,6 @@ struct _GtkAboutDialog
|
||||
guint hovering_over_link : 1;
|
||||
guint wrap_license : 1;
|
||||
guint in_child_changed : 1;
|
||||
|
||||
GSList *link_tags;
|
||||
|
||||
guint update_links_cb_id;
|
||||
};
|
||||
|
||||
struct _GtkAboutDialogClass
|
||||
@@ -716,52 +706,6 @@ update_credits_button_visibility (GtkAboutDialog *about)
|
||||
update_stack_switcher_visibility (about);
|
||||
}
|
||||
|
||||
static void
|
||||
update_links_cb (GtkAboutDialog *about)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
GdkRGBA link_color, visited_link_color;
|
||||
GSList *l;
|
||||
|
||||
style = gtk_css_node_get_style (about->link_node);
|
||||
link_color = *gtk_css_color_value_get_rgba (style->used->color);
|
||||
|
||||
style = gtk_css_node_get_style (about->visited_link_node);
|
||||
visited_link_color = *gtk_css_color_value_get_rgba (style->used->color);
|
||||
|
||||
for (l = about->link_tags; l != NULL; l = l->next)
|
||||
{
|
||||
GtkTextTag *tag = l->data;
|
||||
GdkRGBA color;
|
||||
const char *uri = g_object_get_data (G_OBJECT (tag), "uri");
|
||||
|
||||
if (uri && g_ptr_array_find_with_equal_func (about->visited_links, uri, (GCompareFunc)strcmp, NULL))
|
||||
color = visited_link_color;
|
||||
else
|
||||
color = link_color;
|
||||
|
||||
g_object_set (G_OBJECT (tag), "foreground-rgba", &color, NULL);
|
||||
}
|
||||
|
||||
about->update_links_cb_id = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
link_style_changed_cb (GtkCssNode *node,
|
||||
GtkCssStyleChange *change,
|
||||
GtkAboutDialog *about)
|
||||
{
|
||||
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW))
|
||||
{
|
||||
/* If we access the node right here, we'll end up with infinite recursion */
|
||||
if (about->link_tags && !about->update_links_cb_id)
|
||||
{
|
||||
about->update_links_cb_id =
|
||||
g_idle_add_once ((GSourceOnceFunc) update_links_cb, about);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
{
|
||||
@@ -804,16 +748,12 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
gtk_css_node_set_name (about->link_node, g_quark_from_static_string ("link"));
|
||||
gtk_css_node_set_parent (about->link_node, node);
|
||||
gtk_css_node_set_state (about->link_node, state | GTK_STATE_FLAG_LINK);
|
||||
g_signal_connect (about->link_node, "style-changed",
|
||||
G_CALLBACK (link_style_changed_cb), about);
|
||||
g_object_unref (about->link_node);
|
||||
|
||||
about->visited_link_node = gtk_css_node_new ();
|
||||
gtk_css_node_set_name (about->visited_link_node, g_quark_from_static_string ("link"));
|
||||
gtk_css_node_set_parent (about->visited_link_node, node);
|
||||
gtk_css_node_set_state (about->visited_link_node, state | GTK_STATE_FLAG_LINK);
|
||||
g_signal_connect (about->visited_link_node, "style-changed",
|
||||
G_CALLBACK (link_style_changed_cb), about);
|
||||
gtk_css_node_set_state (about->visited_link_node, state | GTK_STATE_FLAG_VISITED);
|
||||
g_object_unref (about->visited_link_node);
|
||||
}
|
||||
|
||||
@@ -848,10 +788,6 @@ gtk_about_dialog_finalize (GObject *object)
|
||||
g_slist_free_full (about->credit_sections, destroy_credit_section);
|
||||
g_ptr_array_unref (about->visited_links);
|
||||
|
||||
g_slist_free (about->link_tags);
|
||||
|
||||
g_clear_handle_id (&about->update_links_cb_id, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -1760,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));
|
||||
}
|
||||
@@ -1900,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);
|
||||
|
||||
@@ -1972,12 +1907,9 @@ 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);
|
||||
|
||||
about->link_tags = g_slist_prepend (about->link_tags, tag);
|
||||
|
||||
if (strcmp (link_type, "email") == 0)
|
||||
{
|
||||
char *escaped;
|
||||
|
||||
@@ -186,10 +186,10 @@ gtk_application_impl_quartz_startup (GtkApplicationImpl *impl,
|
||||
{
|
||||
GtkApplicationImplQuartz *quartz = (GtkApplicationImplQuartz *) impl;
|
||||
GSimpleActionGroup *gtkinternal;
|
||||
const char *pref_accel[] = {"<Meta>comma", NULL};
|
||||
const char *hide_others_accel[] = {"<Meta><Alt>h", NULL};
|
||||
const char *hide_accel[] = {"<Meta>h", NULL};
|
||||
const char *quit_accel[] = {"<Meta>q", NULL};
|
||||
const char *pref_accel[] = {"<Control>comma", NULL};
|
||||
const char *hide_others_accel[] = {"<Control><Alt>h", NULL};
|
||||
const char *hide_accel[] = {"<Control>h", NULL};
|
||||
const char *quit_accel[] = {"<Control>q", NULL};
|
||||
|
||||
if (register_session)
|
||||
{
|
||||
|
||||
@@ -228,11 +228,7 @@ gtk_application_load_resources (GtkApplication *application)
|
||||
path = g_strconcat (base_path, optional_slash, "gtk/help-overlay.ui", NULL);
|
||||
if (g_resources_get_info (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
const char * const accels[] = { "<Meta>question", NULL };
|
||||
#else
|
||||
const char * const accels[] = { "<Control>question", NULL };
|
||||
#endif
|
||||
|
||||
priv->help_overlay_path = path;
|
||||
gtk_application_set_accels_for_action (application, "win.show-help-overlay", accels);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* `GtkAspectFrame` uses a CSS node with name `aspectframe`.
|
||||
* `GtkAspectFrame` uses a CSS node with name `frame`.
|
||||
*
|
||||
* # Accessibility
|
||||
*
|
||||
|
||||
@@ -34,12 +34,6 @@
|
||||
* almost any other standard `GtkWidget`. The most commonly used child is the
|
||||
* `GtkLabel`.
|
||||
*
|
||||
* # Shortcuts and Gestures
|
||||
*
|
||||
* The following signals have default keybindings:
|
||||
*
|
||||
* - [signal@Gtk.Button::activate]
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* `GtkButton` has a single CSS node with name button. The node will get the
|
||||
|
||||
+4
-16
@@ -51,13 +51,6 @@
|
||||
* between 1582 and 1929. Display before these dates is likely to be
|
||||
* historically incorrect.
|
||||
*
|
||||
* # Shortcuts and Gestures
|
||||
*
|
||||
* `GtkCalendar` supports the following gestures:
|
||||
*
|
||||
* - Scrolling up or down will switch to the previous or next month.
|
||||
* - Date strings can be dropped for setting the current day.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* ```
|
||||
@@ -1381,11 +1374,6 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
int old_focus_row;
|
||||
int old_focus_col;
|
||||
int row, col, day;
|
||||
#ifdef __APPLE__
|
||||
GdkModifierType modifier = GDK_META_MASK;
|
||||
#else
|
||||
GdkModifierType modifier = GDK_CONTROL_MASK;
|
||||
#endif
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
@@ -1397,7 +1385,7 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
case GDK_KEY_KP_Left:
|
||||
case GDK_KEY_Left:
|
||||
return_val = TRUE;
|
||||
if (state & modifier)
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
calendar_set_month_prev (calendar);
|
||||
else
|
||||
{
|
||||
@@ -1409,7 +1397,7 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
case GDK_KEY_KP_Right:
|
||||
case GDK_KEY_Right:
|
||||
return_val = TRUE;
|
||||
if (state & modifier)
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
calendar_set_month_next (calendar);
|
||||
else
|
||||
{
|
||||
@@ -1421,7 +1409,7 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
case GDK_KEY_KP_Up:
|
||||
case GDK_KEY_Up:
|
||||
return_val = TRUE;
|
||||
if (state & modifier)
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
calendar_set_year_prev (calendar);
|
||||
else
|
||||
{
|
||||
@@ -1433,7 +1421,7 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
case GDK_KEY_KP_Down:
|
||||
case GDK_KEY_Down:
|
||||
return_val = TRUE;
|
||||
if (state & modifier)
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
calendar_set_year_next (calendar);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -80,12 +80,6 @@
|
||||
* `GAction` with a target for each button. Using the `toggled` signals to keep
|
||||
* track of the group changes and state is discouraged.
|
||||
*
|
||||
* # Shortcuts and Gestures
|
||||
*
|
||||
* `GtkCheckButton` supports the following keyboard shortcuts:
|
||||
*
|
||||
* - <kbd>␣</kbd> or <kbd>Enter</kbd> activates the button.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -61,14 +61,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
* The `GtkColorChooserWidget` is used in the [class@Gtk.ColorChooserDialog]
|
||||
* to provide a dialog for selecting colors.
|
||||
*
|
||||
* # Actions
|
||||
*
|
||||
* `GtkColorChooserWidget` defines a set of built-in actions:
|
||||
*
|
||||
* - `color.customize` activates the color editor for the given color.
|
||||
* - `color.select` emits the [signal@Gtk.ColorChooser::color-activated] signal
|
||||
* for the given color.
|
||||
*
|
||||
* # CSS names
|
||||
*
|
||||
* `GtkColorChooserWidget` has a single CSS node with name colorchooser.
|
||||
|
||||
@@ -423,209 +423,3 @@ gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_bl
|
||||
*green = apply_gamma (linear_green);
|
||||
*blue = apply_gamma (linear_blue);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_linear_srgb_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z)
|
||||
{
|
||||
*x = (506752.0 / 1228815.0) * r + (87881.0 / 245763.0) * g + (12673.0 / 70218.0) * b;
|
||||
*y = (87098.0 / 409605.0) * r + (175762.0 / 245763.0) * g + (12673.0 / 175545.0) * b;
|
||||
*z = ( 7918.0 / 409605.0) * r + (87881.0 / 737289.0) * g + (1001167.0 / 1053270.0) * b;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_xyz_to_linear_srgb (float x, float y, float z,
|
||||
float *r, float *g, float *b)
|
||||
{
|
||||
*r = (12831.0 / 3959.0) * x - (329.0 / 214.0) * y - (1974.0 / 3959.0) * z;
|
||||
*g = - (851781.0 / 878810.0) * x + (1648619.0 / 878810.0) * y + (36519.0 / 878810.0) * z;
|
||||
*b = (705.0 / 12673.0) * x - (2585.0 / 12673.0) * y + (705.0 / 667.0) * z;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_lin_p3_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z)
|
||||
{
|
||||
*x = (608311.0 / 1250200.0) * r + (189793.0 / 714400.0) * g + (198249.0 / 1000160.0) * b;
|
||||
*y = (35783.0 / 156275.0) * r + (247089.0 / 357200.0) * g + (198249.0 / 2500400.0) * b;
|
||||
*z = ( 0 / 1) * r + (32229.0 / 714400.0) * g + (5220557.0 / 5000800.0) * b;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xyz_to_lin_p3 (float x, float y, float z,
|
||||
float *r, float *g, float *b)
|
||||
{
|
||||
*r = (446124.0 / 178915.0) * x - (333277.0 / 357830.0) * y - (72051.0 / 178915.0) * z;
|
||||
*g = - (14852.0 / 17905.0) * x + (63121.0 / 35810.0) * y + (423.0 / 17905.0) * z;
|
||||
*b = (11844.0 / 330415.0) * x - (50337.0 / 660830.0) * y + (316169.0 / 330415.0) * z;
|
||||
}
|
||||
|
||||
void gtk_rgb_to_p3 (float red, float green, float blue,
|
||||
float *pr, float *pg, float *pb)
|
||||
{
|
||||
float r, g, b;
|
||||
float x, y, z;
|
||||
|
||||
gtk_rgb_to_linear_srgb (red, green, blue, &r, &g, &b);
|
||||
gtk_linear_srgb_to_xyz (r, g, b, &x, &y, &z);
|
||||
gtk_xyz_to_lin_p3 (x, y, z, &r, &g, &b);
|
||||
gtk_linear_srgb_to_rgb (r, g, b, pr, pg, pb);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_p3_to_rgb (float pr, float pg, float pb,
|
||||
float *red, float *green, float *blue)
|
||||
{
|
||||
float r, g, b;
|
||||
float x, y, z;
|
||||
|
||||
gtk_rgb_to_linear_srgb (pr, pg, pb, &r, &g, &b);
|
||||
gtk_lin_p3_to_xyz (r, g, b, &x, &y, &z);
|
||||
gtk_xyz_to_linear_srgb (x, y, z, &r, &g, &b);
|
||||
gtk_linear_srgb_to_rgb (r, g, b, red, green, blue);
|
||||
}
|
||||
|
||||
static inline float
|
||||
linearize_one (float val)
|
||||
{
|
||||
float alpha = 1.09929682680944 ;
|
||||
float beta = 0.018053968510807;
|
||||
|
||||
int sign = val < 0 ? -1 : 1;
|
||||
float abs = fabs (val);
|
||||
|
||||
if (abs < beta * 4.5 )
|
||||
return val / 4.5;
|
||||
else
|
||||
return sign * powf ((abs + alpha - 1) / alpha, 1.0 / 0.45);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2020_to_rec2020_linear (float r, float g , float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = linearize_one (r);
|
||||
*gg = linearize_one (g);
|
||||
*bb = linearize_one (b);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2020_linear_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z)
|
||||
{
|
||||
*x = (63426534.0 / 99577255.0) * r + (20160776.0 / 139408157.0) * g + (47086771.0 / 278816314.0) * b;
|
||||
*y = (26158966.0 / 99577255.0) * r + (472592308.0 / 697040785.0) * g + (8267143.0 / 139408157.0) * b;
|
||||
*z = ( 0 / 1) * r + (19567812.0 / 697040785.0) * g + (295819943.0 / 278816314.0) * b;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2020_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z)
|
||||
{
|
||||
gtk_rec2020_to_rec2020_linear (r, g, b, &r, &g, &b);
|
||||
gtk_rec2020_linear_to_xyz (r, g, b, x, y, z);
|
||||
}
|
||||
|
||||
static inline float
|
||||
delinearize_one (float val)
|
||||
{
|
||||
float alpha = 1.09929682680944;
|
||||
float beta = 0.018053968510807;
|
||||
int sign = val < 0 ? -1 : 1;
|
||||
float abs = fabsf (val);
|
||||
|
||||
if (abs > beta)
|
||||
return sign * (alpha * powf (abs, 0.45) - (alpha - 1));
|
||||
else
|
||||
return 4.5 * val;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2020_linear_to_rec2020 (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = delinearize_one (r);
|
||||
*gg = delinearize_one (g);
|
||||
*bb = delinearize_one (b);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_xyz_to_rec2020_linear (float x, float y, float z,
|
||||
float *r, float *g, float *b)
|
||||
{
|
||||
*r = (30757411.0 / 17917100.0) * x - (6372589.0 / 17917100.0) * y - (4539589.0 / 17917100.0) * z;
|
||||
*g = - (19765991.0 / 29648200.0) * x + (47925759.0 / 29648200.0) * y + (467509.0 / 29648200.0) *z;
|
||||
*b = (792561.0 / 44930125.0) * x - (1921689.0 / 44930125.0) * y + (42328811.0 / 44930125.0) * z;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_xyz_to_rec2020 (float x, float y, float z,
|
||||
float *r, float *g, float *b)
|
||||
{
|
||||
gtk_xyz_to_rec2020_linear (x, y, z, r, g, b);
|
||||
gtk_rec2020_linear_to_rec2020 (*r, *g, *b, r, g, b);
|
||||
}
|
||||
|
||||
/* maps [0, 1] to [0, 70] */
|
||||
static inline float
|
||||
pq_to_linear (float v)
|
||||
{
|
||||
float ninv = (1 << 14) / 2610.0;
|
||||
float minv = (1 << 5) / 2523.0;
|
||||
float c1 = 3424.0 / (1 << 12);
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
float x = powf (MAX ((powf (v, minv) - c1), 0) / (c2 - (c3 * (powf (v, minv)))), ninv);
|
||||
return x * 10000 / 203.0;
|
||||
}
|
||||
|
||||
/* maps [0, 70] to [0, 1] */
|
||||
void
|
||||
gtk_rec2100_pq_to_rec2100_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = pq_to_linear (r);
|
||||
*gg = pq_to_linear (g);
|
||||
*bb = pq_to_linear (b);
|
||||
}
|
||||
|
||||
static inline float
|
||||
linear_to_pq (float v)
|
||||
{
|
||||
float x = v * 203.0 / 10000.0;
|
||||
float n = 2610.0 / (1 << 14);
|
||||
float m = 2523.0 / (1 << 5);
|
||||
float c1 = 3424.0 / (1 << 12);
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
return powf (((c1 + (c2 * powf (x, n))) / (1 + (c3 * powf (x, n)))), m);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2100_linear_to_rec2100_pq (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = linear_to_pq (r);
|
||||
*gg = linear_to_pq (g);
|
||||
*bb = linear_to_pq (b);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2100_linear_to_rec2020_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = r;
|
||||
*gg = g;
|
||||
*bb = b;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rec2020_linear_to_rec2100_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb)
|
||||
{
|
||||
*rr = r;
|
||||
*gg = g;
|
||||
*bb = b;
|
||||
}
|
||||
|
||||
@@ -51,39 +51,5 @@ void gtk_rgb_to_linear_srgb (float red, float green, float blue
|
||||
void gtk_linear_srgb_to_rgb (float linear_red, float linear_green, float linear_blue,
|
||||
float *red, float *green, float *blue);
|
||||
|
||||
void gtk_rgb_to_p3 (float red, float green, float blue,
|
||||
float *pr, float *pg, float *pb);
|
||||
void gtk_p3_to_rgb (float pr, float pg, float pb,
|
||||
float *red, float *green, float *blue);
|
||||
|
||||
void gtk_xyz_to_linear_srgb (float x, float y, float z,
|
||||
float *r, float *g, float *b);
|
||||
void gtk_linear_srgb_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z);
|
||||
|
||||
void gtk_rec2020_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z);
|
||||
void gtk_xyz_to_rec2020 (float x, float y, float z,
|
||||
float *r, float *g, float *b);
|
||||
|
||||
void gtk_rec2020_to_rec2020_linear (float r, float g , float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
void gtk_rec2020_linear_to_rec2020 (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
|
||||
void gtk_rec2020_linear_to_xyz (float r, float g, float b,
|
||||
float *x, float *y, float *z);
|
||||
void gtk_xyz_to_rec2020_linear (float x, float y, float z,
|
||||
float *r, float *g, float *b);
|
||||
|
||||
void gtk_rec2100_pq_to_rec2100_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
void gtk_rec2100_linear_to_rec2100_pq (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
|
||||
void gtk_rec2100_linear_to_rec2020_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
void gtk_rec2020_linear_to_rec2100_linear (float r, float g, float b,
|
||||
float *rr, float *gg, float *bb);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+63
-29
@@ -42,32 +42,76 @@
|
||||
|
||||
G_DEFINE_TYPE (GtkCssAnimatedStyle, gtk_css_animated_style, GTK_TYPE_CSS_STYLE)
|
||||
|
||||
static inline gboolean
|
||||
property_has_color (guint id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case GTK_CSS_PROPERTY_COLOR:
|
||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||
case GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR:
|
||||
case GTK_CSS_PROPERTY_TEXT_SHADOW:
|
||||
case GTK_CSS_PROPERTY_BOX_SHADOW:
|
||||
case GTK_CSS_PROPERTY_BORDER_TOP_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_LEFT_COLOR:
|
||||
case GTK_CSS_PROPERTY_OUTLINE_COLOR:
|
||||
case GTK_CSS_PROPERTY_BACKGROUND_IMAGE:
|
||||
case GTK_CSS_PROPERTY_ICON_SOURCE:
|
||||
case GTK_CSS_PROPERTY_ICON_SHADOW:
|
||||
case GTK_CSS_PROPERTY_CARET_COLOR:
|
||||
case GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
|
||||
static inline void \
|
||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||
GtkCssComputeContext *context) \
|
||||
GtkCssComputeContext *context, \
|
||||
GtkCssAnimationChange change) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
||||
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < G_N_ELEMENTS (NAME ## _props); i++) \
|
||||
{ \
|
||||
guint id = NAME ## _props[i]; \
|
||||
GtkCssValue *original, *computed; \
|
||||
gboolean needs_recompute = FALSE; \
|
||||
\
|
||||
if (values[i] == NULL) \
|
||||
continue; \
|
||||
\
|
||||
original = gtk_css_style_get_original_value (style, id); \
|
||||
if (original == NULL) \
|
||||
continue; \
|
||||
\
|
||||
if (!gtk_css_value_contains_variables (original)) \
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_VARIABLES) && \
|
||||
gtk_css_value_contains_variables (original)) \
|
||||
needs_recompute = TRUE; \
|
||||
\
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_COLOR) && \
|
||||
property_has_color (id)) \
|
||||
needs_recompute = TRUE; \
|
||||
\
|
||||
if (!needs_recompute) \
|
||||
continue; \
|
||||
\
|
||||
computed = gtk_css_value_compute (original, id, context); \
|
||||
computed = gtk_css_value_compute (original, \
|
||||
id, \
|
||||
context); \
|
||||
if (computed == NULL) \
|
||||
continue; \
|
||||
\
|
||||
gtk_css_animated_style_set_animated_value (animated, id, computed); \
|
||||
\
|
||||
if (id == GTK_CSS_PROPERTY_COLOR) \
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_COLOR; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -635,28 +679,28 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style)
|
||||
gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||
GtkCssAnimationChange change)
|
||||
{
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||
|
||||
context.provider = style->provider;
|
||||
context.style = (GtkCssStyle *) style;
|
||||
context.style = style->style;
|
||||
context.parent_style = style->parent_style;
|
||||
context.variables = ((GtkCssStyle *) style)->variables;
|
||||
context.shorthands = shorthands;
|
||||
|
||||
gtk_css_core_values_recompute (style, &context);
|
||||
gtk_css_background_values_recompute (style, &context);
|
||||
gtk_css_border_values_recompute (style, &context);
|
||||
gtk_css_icon_values_recompute (style, &context);
|
||||
gtk_css_outline_values_recompute (style, &context);
|
||||
gtk_css_font_values_recompute (style, &context);
|
||||
gtk_css_font_variant_values_recompute (style, &context);
|
||||
gtk_css_animation_values_recompute (style, &context);
|
||||
gtk_css_transition_values_recompute (style, &context);
|
||||
gtk_css_size_values_recompute (style, &context);
|
||||
gtk_css_other_values_recompute (style, &context);
|
||||
gtk_css_core_values_recompute (style, &context, change);
|
||||
gtk_css_background_values_recompute (style, &context, change);
|
||||
gtk_css_border_values_recompute (style, &context, change);
|
||||
gtk_css_icon_values_recompute (style, &context, change);
|
||||
gtk_css_outline_values_recompute (style, &context, change);
|
||||
gtk_css_font_values_recompute (style, &context, change);
|
||||
gtk_css_font_variant_values_recompute (style, &context, change);
|
||||
gtk_css_animation_values_recompute (style, &context, change);
|
||||
gtk_css_transition_values_recompute (style, &context, change);
|
||||
gtk_css_size_values_recompute (style, &context, change);
|
||||
gtk_css_other_values_recompute (style, &context, change);
|
||||
|
||||
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||
{
|
||||
@@ -983,22 +1027,14 @@ gtk_css_animated_style_create_css_animations (GPtrArray *animations,
|
||||
static void
|
||||
gtk_css_animated_style_apply_animations (GtkCssAnimatedStyle *style)
|
||||
{
|
||||
GtkCssComputeContext context;
|
||||
guint i;
|
||||
|
||||
for (guint i = 0; i < style->n_animations; i ++)
|
||||
for (i = 0; i < style->n_animations; i ++)
|
||||
{
|
||||
GtkStyleAnimation *animation = style->animations[i];
|
||||
|
||||
_gtk_style_animation_apply_values (animation, style);
|
||||
}
|
||||
|
||||
context.provider = style->provider;
|
||||
context.style = (GtkCssStyle *) style;
|
||||
context.parent_style = style->parent_style;
|
||||
context.variables = NULL;
|
||||
context.shorthands = NULL;
|
||||
|
||||
gtk_css_style_resolve_used_values ((GtkCssStyle *) style, &context);
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
@@ -1051,7 +1087,6 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
|
||||
style->transition = (GtkCssTransitionValues *)gtk_css_values_ref ((GtkCssValues *)base_style->transition);
|
||||
style->size = (GtkCssSizeValues *)gtk_css_values_ref ((GtkCssValues *)base_style->size);
|
||||
style->other = (GtkCssOtherValues *)gtk_css_values_ref ((GtkCssValues *)base_style->other);
|
||||
style->used = (GtkCssUsedValues *)gtk_css_values_ref ((GtkCssValues *)base_style->used);
|
||||
if (base_style->variables)
|
||||
style->variables = gtk_css_variable_set_ref (base_style->variables);
|
||||
|
||||
@@ -1125,7 +1160,6 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
|
||||
style->transition = (GtkCssTransitionValues *)gtk_css_values_ref ((GtkCssValues *)base_style->transition);
|
||||
style->size = (GtkCssSizeValues *)gtk_css_values_ref ((GtkCssValues *)base_style->size);
|
||||
style->other = (GtkCssOtherValues *)gtk_css_values_ref ((GtkCssValues *)base_style->other);
|
||||
style->used = (GtkCssUsedValues *)gtk_css_values_ref ((GtkCssValues *)base_style->used);
|
||||
if (base_style->variables)
|
||||
style->variables = gtk_css_variable_set_ref (base_style->variables);
|
||||
|
||||
|
||||
@@ -74,7 +74,13 @@ gboolean gtk_css_animated_style_set_animated_custom_value (GtkCss
|
||||
int id,
|
||||
GtkCssVariableValue *value);
|
||||
|
||||
void gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style);
|
||||
typedef enum {
|
||||
GTK_CSS_ANIMATION_CHANGE_VARIABLES = 1 << 0,
|
||||
GTK_CSS_ANIMATION_CHANGE_COLOR = 1 << 1,
|
||||
} GtkCssAnimationChange;
|
||||
|
||||
void gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||
GtkCssAnimationChange change);
|
||||
GtkCssVariableValue * gtk_css_animated_style_get_intrinsic_custom_value (GtkCssAnimatedStyle *style,
|
||||
int id);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
GtkCssKeyframes *resolved_keyframes;
|
||||
double progress;
|
||||
guint i;
|
||||
gboolean needs_recompute = FALSE;
|
||||
GtkCssAnimationChange change = 0;
|
||||
|
||||
if (!gtk_css_animation_is_executing (animation))
|
||||
return;
|
||||
@@ -127,14 +127,11 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
continue;
|
||||
|
||||
if (gtk_css_animated_style_set_animated_custom_value (style, variable_id, value))
|
||||
needs_recompute = TRUE;
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_VARIABLES;
|
||||
|
||||
gtk_css_variable_value_unref (value);
|
||||
}
|
||||
|
||||
if (needs_recompute)
|
||||
gtk_css_animated_style_recompute (style);
|
||||
|
||||
for (i = 0; i < _gtk_css_keyframes_get_n_properties (resolved_keyframes); i++)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
@@ -147,8 +144,14 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
progress,
|
||||
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
||||
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
||||
|
||||
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_COLOR;
|
||||
}
|
||||
|
||||
if (change != 0)
|
||||
gtk_css_animated_style_recompute (style, change);
|
||||
|
||||
_gtk_css_keyframes_unref (resolved_keyframes);
|
||||
}
|
||||
|
||||
|
||||
+11
-56
@@ -48,71 +48,29 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
guint i, j;
|
||||
gboolean contains_current_color = FALSE;;
|
||||
|
||||
result = NULL;
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
i_value = gtk_css_value_compute (value->values[i], property_id, context);
|
||||
contains_current_color |= gtk_css_value_contains_current_color (i_value);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
i_value != value->values[i])
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->values[i] = i_value;
|
||||
result->values[i] = i_value;
|
||||
else
|
||||
gtk_css_value_unref (i_value);
|
||||
gtk_css_value_unref (i_value);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
result->is_computed = TRUE;
|
||||
result->contains_current_color = contains_current_color;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_array_resolve (GtkCssValue *value,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
guint i, j;
|
||||
|
||||
result = NULL;
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
i_value = gtk_css_value_resolve (value->values[i], context, current);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->values[i] = i_value;
|
||||
else
|
||||
gtk_css_value_unref (i_value);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
result->is_computed = TRUE;
|
||||
result->contains_current_color = FALSE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -406,7 +364,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
|
||||
"GtkCssArrayValue",
|
||||
gtk_css_value_array_free,
|
||||
gtk_css_value_array_compute,
|
||||
gtk_css_value_array_resolve,
|
||||
gtk_css_value_array_equal,
|
||||
gtk_css_value_array_transition,
|
||||
gtk_css_value_array_is_dynamic,
|
||||
@@ -441,7 +398,6 @@ _gtk_css_array_value_new_from_array (GtkCssValue **values,
|
||||
|
||||
result->is_computed = TRUE;
|
||||
result->contains_variables = FALSE;
|
||||
result->contains_current_color = FALSE;
|
||||
for (i = 0; i < n_values; i ++)
|
||||
{
|
||||
if (!gtk_css_value_is_computed (values[i]))
|
||||
@@ -450,10 +406,7 @@ _gtk_css_array_value_new_from_array (GtkCssValue **values,
|
||||
if (gtk_css_value_contains_variables (values[i]))
|
||||
result->contains_variables = TRUE;
|
||||
|
||||
if (gtk_css_value_contains_current_color (values[i]))
|
||||
result->contains_current_color = TRUE;
|
||||
|
||||
if (!result->is_computed && result->contains_variables && result->contains_current_color)
|
||||
if (!result->is_computed && result->contains_variables)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -515,3 +468,5 @@ _gtk_css_array_value_get_n_values (const GtkCssValue *value)
|
||||
|
||||
return value->n_values;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,5 +37,6 @@ GtkCssValue * _gtk_css_array_value_get_nth (GtkCssValue *
|
||||
guint i);
|
||||
guint _gtk_css_array_value_get_n_values (const GtkCssValue *value) G_GNUC_PURE;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
|
||||
"GtkCssBgSizeValue",
|
||||
gtk_css_value_bg_size_free,
|
||||
gtk_css_value_bg_size_compute,
|
||||
NULL,
|
||||
gtk_css_value_bg_size_equal,
|
||||
gtk_css_value_bg_size_transition,
|
||||
NULL,
|
||||
@@ -162,9 +161,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
|
||||
gtk_css_value_bg_size_print
|
||||
};
|
||||
|
||||
static GtkCssValue auto_singleton = { >K_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, FALSE, FALSE, NULL, NULL };
|
||||
static GtkCssValue cover_singleton = { >K_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, TRUE, FALSE, NULL, NULL };
|
||||
static GtkCssValue contain_singleton = { >K_CSS_VALUE_BG_SIZE, 1, 1, 0, 0, FALSE, TRUE, NULL, NULL };
|
||||
static GtkCssValue auto_singleton = { >K_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, FALSE, FALSE, NULL, NULL };
|
||||
static GtkCssValue cover_singleton = { >K_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, TRUE, FALSE, NULL, NULL };
|
||||
static GtkCssValue contain_singleton = { >K_CSS_VALUE_BG_SIZE, 1, TRUE, FALSE, FALSE, TRUE, NULL, NULL };
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_bg_size_value_new (GtkCssValue *x,
|
||||
|
||||
@@ -141,7 +141,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
|
||||
"GtkCssBorderValue",
|
||||
gtk_css_value_border_free,
|
||||
gtk_css_value_border_compute,
|
||||
NULL,
|
||||
gtk_css_value_border_equal,
|
||||
gtk_css_value_border_transition,
|
||||
NULL,
|
||||
|
||||
+5
-266
@@ -35,10 +35,6 @@ gtk_css_color_init (GtkCssColor *color,
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
@@ -140,22 +136,6 @@ gtk_css_color_print (const GtkCssColor *color,
|
||||
g_string_append (string, "oklch(");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
g_string_append (string, "color(display-p3 ");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
g_string_append (string, "color(xyz ");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
g_string_append (string, "color(rec2020 ");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
g_string_append (string, "color(rec2100-pq ");
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -201,9 +181,6 @@ gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
|
||||
{
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
switch (coord)
|
||||
{
|
||||
case 0: return "r";
|
||||
@@ -211,14 +188,6 @@ gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
|
||||
case 2: return "b";
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
switch (coord)
|
||||
{
|
||||
case 0: return "x";
|
||||
case 1: return "y";
|
||||
case 2: return "z";
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
switch (coord)
|
||||
{
|
||||
@@ -256,64 +225,6 @@ gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_color_space_get_coord_range (GtkCssColorSpace color_space,
|
||||
gboolean legacy_rgb_scale,
|
||||
guint coord,
|
||||
float *lower,
|
||||
float *upper)
|
||||
{
|
||||
if (coord == 3)
|
||||
{
|
||||
*lower = 0;
|
||||
*upper = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (color_space)
|
||||
{
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
*lower = 0;
|
||||
*upper = legacy_rgb_scale ? 255 : 1;
|
||||
return;
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
*lower = 0;
|
||||
*upper = 1;
|
||||
return;
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
case GTK_CSS_COLOR_SPACE_HWB:
|
||||
switch (coord)
|
||||
{
|
||||
case 0: *lower = *upper = NAN; return;
|
||||
case 1:
|
||||
case 2: *lower = 0; *upper = 100; return;
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
switch (coord)
|
||||
{
|
||||
case 0: *lower = 0; *upper = 1; return;
|
||||
case 1:
|
||||
case 2: *lower = -0.4; *upper = 0.4; return;
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
case GTK_CSS_COLOR_SPACE_OKLCH:
|
||||
switch (coord)
|
||||
{
|
||||
case 0: *lower = 0; *upper = 1; return;
|
||||
case 1: *lower = 0; *upper = 0.4; return;
|
||||
case 2: *lower = *upper = NAN; return;
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
color_space_is_polar (GtkCssColorSpace color_space)
|
||||
{
|
||||
@@ -322,17 +233,11 @@ color_space_is_polar (GtkCssColorSpace color_space)
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
return FALSE;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
case GTK_CSS_COLOR_SPACE_HWB:
|
||||
case GTK_CSS_COLOR_SPACE_OKLCH:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -352,10 +257,6 @@ convert_to_rectangular (GtkCssColor *output)
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
@@ -397,11 +298,7 @@ convert_to_linear (GtkCssColor *output)
|
||||
|
||||
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 ||
|
||||
output->color_space == GTK_CSS_COLOR_SPACE_DISPLAY_P3 ||
|
||||
output->color_space == GTK_CSS_COLOR_SPACE_XYZ ||
|
||||
output->color_space == GTK_CSS_COLOR_SPACE_REC2020 ||
|
||||
output->color_space == GTK_CSS_COLOR_SPACE_REC2100_PQ);
|
||||
output->color_space == GTK_CSS_COLOR_SPACE_OKLAB);
|
||||
|
||||
if (output->color_space == GTK_CSS_COLOR_SPACE_SRGB)
|
||||
{
|
||||
@@ -412,52 +309,6 @@ convert_to_linear (GtkCssColor *output)
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB_LINEAR, v);
|
||||
}
|
||||
else if (output->color_space == GTK_CSS_COLOR_SPACE_DISPLAY_P3)
|
||||
{
|
||||
gtk_p3_to_rgb (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rgb_to_linear_srgb (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB_LINEAR, v);
|
||||
}
|
||||
else if (output->color_space == GTK_CSS_COLOR_SPACE_XYZ)
|
||||
{
|
||||
gtk_xyz_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);
|
||||
}
|
||||
else if (output->color_space == GTK_CSS_COLOR_SPACE_REC2020)
|
||||
{
|
||||
gtk_rec2020_to_xyz (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_xyz_to_linear_srgb (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB_LINEAR, v);
|
||||
}
|
||||
else if (output->color_space == GTK_CSS_COLOR_SPACE_REC2100_PQ)
|
||||
{
|
||||
gtk_rec2100_pq_to_rec2100_linear (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rec2100_linear_to_rec2020_linear (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rec2020_linear_to_xyz (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_xyz_to_linear_srgb (v[0], v[1], v[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
|
||||
@@ -482,52 +333,6 @@ convert_from_linear (GtkCssColor *output,
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_SRGB, v);
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
gtk_linear_srgb_to_rgb (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rgb_to_p3 (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_DISPLAY_P3, v);
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
gtk_linear_srgb_to_xyz (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_XYZ, v);
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
gtk_linear_srgb_to_xyz (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_xyz_to_rec2020 (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_REC2020, v);
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
gtk_linear_srgb_to_xyz (output->values[0],
|
||||
output->values[1],
|
||||
output->values[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_xyz_to_rec2020_linear (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rec2020_linear_to_rec2100_linear (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
gtk_rec2100_linear_to_rec2100_pq (v[0], v[1], v[2],
|
||||
&v[0], &v[1], &v[2]);
|
||||
v[3] = output->values[3];
|
||||
gtk_css_color_init (output, GTK_CSS_COLOR_SPACE_REC2100_PQ, v);
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_OKLCH:
|
||||
@@ -549,10 +354,6 @@ convert_from_rectangular (GtkCssColor *output,
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
g_assert (output->color_space == dest);
|
||||
break;
|
||||
|
||||
@@ -719,10 +520,6 @@ apply_hue_interpolation (GtkCssColor *from,
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
@@ -755,10 +552,6 @@ normalize_hue (GtkCssColor *color)
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
@@ -796,10 +589,6 @@ premultiply (GtkCssColor *color)
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
premultiply_component (color, 0);
|
||||
premultiply_component (color, 1);
|
||||
premultiply_component (color, 2);
|
||||
@@ -842,10 +631,6 @@ unpremultiply (GtkCssColor *color)
|
||||
case GTK_CSS_COLOR_SPACE_SRGB:
|
||||
case GTK_CSS_COLOR_SPACE_SRGB_LINEAR:
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
unpremultiply_component (color, 0);
|
||||
unpremultiply_component (color, 1);
|
||||
unpremultiply_component (color, 2);
|
||||
@@ -882,10 +667,7 @@ collect_analogous_missing (const GtkCssColor *color,
|
||||
{ -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 */
|
||||
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* display-p3 */
|
||||
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* xyz */
|
||||
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* rec2020 */
|
||||
{ 0, 1, 2, -1, -1, -1, -1, -1, 3 }, /* rec2100-pq */
|
||||
|
||||
};
|
||||
|
||||
int *src = analogous[color->color_space];
|
||||
@@ -994,11 +776,6 @@ parse_hue_interpolation (GtkCssParser *parser,
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*interp = GTK_CSS_HUE_INTERPOLATION_DECREASING;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "hue"))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "'hue' goes after the interpolation method");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*interp = GTK_CSS_HUE_INTERPOLATION_SHORTER;
|
||||
@@ -1014,12 +791,6 @@ parse_hue_interpolation (GtkCssParser *parser,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_color_interpolation_method_can_parse (GtkCssParser *parser)
|
||||
{
|
||||
return gtk_css_token_is_ident (gtk_css_parser_get_token (parser), "in");
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_color_interpolation_method_parse (GtkCssParser *parser,
|
||||
GtkCssColorSpace *in,
|
||||
@@ -1055,39 +826,19 @@ gtk_css_color_interpolation_method_parse (GtkCssParser *parser,
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_HWB;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "oklab"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_OKLAB;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "oklch"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_OKLCH;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "display-p3"))
|
||||
else if (gtk_css_token_is_ident (token, "oklab"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_DISPLAY_P3;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "xyz"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_XYZ;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "rec2020"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_REC2020;
|
||||
}
|
||||
else if (gtk_css_token_is_ident (token, "rec2100-pq"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
*in = GTK_CSS_COLOR_SPACE_REC2100_PQ;
|
||||
*in = GTK_CSS_COLOR_SPACE_OKLAB;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Invalid color space: %s", gtk_css_token_to_string (token));
|
||||
gtk_css_parser_error_syntax (parser, "Invalid color space");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1125,18 +876,6 @@ gtk_css_color_interpolation_method_print (GtkCssColorSpace in,
|
||||
case GTK_CSS_COLOR_SPACE_OKLAB:
|
||||
g_string_append (string, "oklab");
|
||||
break;
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
g_string_append (string, "display-p3");
|
||||
break;
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
g_string_append (string, "xyz");
|
||||
break;
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
g_string_append (string, "rec2020");
|
||||
break;
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
g_string_append (string, "rec2100-pq");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@@ -21,10 +21,17 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "gtk/css/gtkcssparserprivate.h"
|
||||
#include "gtkcsstypesprivate.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
|
||||
{
|
||||
@@ -89,6 +96,14 @@ 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,
|
||||
@@ -99,14 +114,6 @@ void gtk_css_color_interpolate (const GtkCssColor *from,
|
||||
const char * gtk_css_color_space_get_coord_name (GtkCssColorSpace color_space,
|
||||
guint coord);
|
||||
|
||||
void gtk_css_color_space_get_coord_range (GtkCssColorSpace color_space,
|
||||
gboolean legacy_rgb_scale,
|
||||
guint coord,
|
||||
float *lower,
|
||||
float *upper);
|
||||
|
||||
gboolean gtk_css_color_interpolation_method_can_parse (GtkCssParser *parser);
|
||||
|
||||
gboolean gtk_css_color_interpolation_method_parse (GtkCssParser *parser,
|
||||
GtkCssColorSpace *in,
|
||||
GtkCssHueInterpolation *interp);
|
||||
|
||||
+223
-243
@@ -32,23 +32,10 @@
|
||||
#include "gtkcolorutilsprivate.h"
|
||||
|
||||
|
||||
static GtkCssValue * gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
GtkCssValue *color2,
|
||||
double factor);
|
||||
static GtkCssValue * gtk_css_color_value_new_alpha (GtkCssValue *color,
|
||||
double factor);
|
||||
static GtkCssValue * gtk_css_color_value_new_shade (GtkCssValue *color,
|
||||
double factor);
|
||||
static GtkCssValue * gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
GtkCssValue *color2,
|
||||
double factor);
|
||||
static GtkCssValue * gtk_css_color_value_new_color_from_rgba (const GdkRGBA *rgba);
|
||||
static GtkCssValue * gtk_css_color_value_new_color_mix (GtkCssColorSpace color_space,
|
||||
GtkCssHueInterpolation hue_interpolation,
|
||||
GtkCssValue *color1,
|
||||
GtkCssValue *color2,
|
||||
float percentage1,
|
||||
float percentage2);
|
||||
static GtkCssValue * gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current);
|
||||
|
||||
typedef enum {
|
||||
COLOR_TYPE_COLOR,
|
||||
@@ -59,6 +46,7 @@ typedef enum {
|
||||
COLOR_TYPE_ALPHA,
|
||||
COLOR_TYPE_MIX,
|
||||
COLOR_TYPE_CURRENT_COLOR,
|
||||
COLOR_TYPE_LIGHT_DARK,
|
||||
} ColorType;
|
||||
|
||||
struct _GtkCssValue
|
||||
@@ -103,6 +91,12 @@ struct _GtkCssValue
|
||||
gboolean legacy_srgb;
|
||||
GtkCssValue *values[1];
|
||||
} relative;
|
||||
|
||||
struct
|
||||
{
|
||||
GtkCssValue *color1;
|
||||
GtkCssValue *color2;
|
||||
} light_dark;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -142,7 +136,11 @@ gtk_css_value_color_free (GtkCssValue *color)
|
||||
if (color->relative.values[i])
|
||||
gtk_css_value_unref (color->relative.values[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_LIGHT_DARK:
|
||||
gtk_css_value_unref (color->light_dark.color1);
|
||||
gtk_css_value_unref (color->light_dark.color2);
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_COLOR:
|
||||
@@ -196,21 +194,38 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *computed;
|
||||
GtkCssValue *resolved;
|
||||
|
||||
computed = gtk_css_color_value_resolve (value, context, NULL);
|
||||
if (computed == NULL)
|
||||
/* The computed value of the ‘currentColor’ keyword is the computed
|
||||
* value of the ‘color’ property. If the ‘currentColor’ keyword is
|
||||
* set on the ‘color’ property itself, it is treated as ‘color: inherit’.
|
||||
*/
|
||||
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
||||
{
|
||||
GtkCssValue *current;
|
||||
|
||||
if (context->parent_style)
|
||||
current = context->parent_style->core->color;
|
||||
else
|
||||
current = NULL;
|
||||
|
||||
resolved = gtk_css_color_value_resolve (value, property_id, context, current);
|
||||
}
|
||||
else if (value->type == COLOR_TYPE_COLOR)
|
||||
{
|
||||
resolved = gtk_css_value_ref (value);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkCssValue *current = context->style->core->color;
|
||||
|
||||
resolved = gtk_css_color_value_resolve (value, property_id, context, current);
|
||||
}
|
||||
|
||||
if (resolved == NULL)
|
||||
return gtk_css_value_color_get_fallback (property_id, context);
|
||||
|
||||
return computed;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_color_resolve (GtkCssValue *value,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current)
|
||||
{
|
||||
return gtk_css_color_value_resolve (value, context, current);
|
||||
return resolved;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -266,6 +281,12 @@ gtk_css_value_color_equal (const GtkCssValue *value1,
|
||||
case COLOR_TYPE_CURRENT_COLOR:
|
||||
return TRUE;
|
||||
|
||||
case COLOR_TYPE_LIGHT_DARK:
|
||||
return gtk_css_value_equal (value1->light_dark.color1,
|
||||
value2->light_dark.color1) &&
|
||||
gtk_css_value_equal (value1->light_dark.color2,
|
||||
value2->light_dark.color2);
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
@@ -353,30 +374,6 @@ gtk_css_value_color_print (const GtkCssValue *value,
|
||||
g_string_append (string, " srgb-linear");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_DISPLAY_P3:
|
||||
g_string_append (string, "color(from ");
|
||||
gtk_css_value_print (value->relative.origin, string);
|
||||
g_string_append (string, " display-p3");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_XYZ:
|
||||
g_string_append (string, "color(from ");
|
||||
gtk_css_value_print (value->relative.origin, string);
|
||||
g_string_append (string, " xyz");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2020:
|
||||
g_string_append (string, "color(from ");
|
||||
gtk_css_value_print (value->relative.origin, string);
|
||||
g_string_append (string, " rec2020");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_REC2100_PQ:
|
||||
g_string_append (string, "color(from ");
|
||||
gtk_css_value_print (value->relative.origin, string);
|
||||
g_string_append (string, " rec2100-pq");
|
||||
break;
|
||||
|
||||
case GTK_CSS_COLOR_SPACE_HSL:
|
||||
g_string_append (string, "hsl(from ");
|
||||
gtk_css_value_print (value->relative.origin, string);
|
||||
@@ -514,6 +511,14 @@ gtk_css_value_color_print (const GtkCssValue *value,
|
||||
g_string_append (string, "currentcolor");
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_LIGHT_DARK:
|
||||
g_string_append (string, "light-dark(");
|
||||
gtk_css_value_print (value->light_dark.color1, string);
|
||||
g_string_append (string, ", ");
|
||||
gtk_css_value_print (value->light_dark.color2, string);
|
||||
g_string_append_c (string, ')');
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -523,7 +528,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
|
||||
"GtkCssColorValue",
|
||||
gtk_css_value_color_free,
|
||||
gtk_css_value_color_compute,
|
||||
gtk_css_value_color_resolve,
|
||||
gtk_css_value_color_equal,
|
||||
gtk_css_value_color_transition,
|
||||
NULL,
|
||||
@@ -614,51 +618,9 @@ apply_color_mix (GtkCssColorSpace in,
|
||||
missing);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
resolve_relative (GtkCssValue *values[4],
|
||||
GtkCssColorSpace color_space,
|
||||
gboolean legacy_rgb_scale)
|
||||
{
|
||||
float v[4];
|
||||
gboolean m[4];
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
if (values[i])
|
||||
{
|
||||
float lower, upper;
|
||||
|
||||
gtk_css_color_space_get_coord_range (color_space, legacy_rgb_scale,
|
||||
i, &lower, &upper);
|
||||
|
||||
m[i] = FALSE;
|
||||
v[i] = gtk_css_number_value_get_canonical (values[i], upper - lower);
|
||||
|
||||
if (gtk_css_number_value_has_percent (values[i]))
|
||||
v[i] += lower;
|
||||
}
|
||||
else
|
||||
{
|
||||
m[i] = TRUE;
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (color_space == GTK_CSS_COLOR_SPACE_SRGB &&
|
||||
legacy_rgb_scale)
|
||||
{
|
||||
v[0] /= 255.;
|
||||
v[1] /= 255.;
|
||||
v[2] /= 255.;
|
||||
}
|
||||
|
||||
v[3] = CLAMP (v[3], 0, 1); /* clamp alpha */
|
||||
|
||||
return gtk_css_color_value_new_color (color_space, FALSE, v, m);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current,
|
||||
GSList *cycle_list)
|
||||
@@ -676,23 +638,39 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
|
||||
case COLOR_TYPE_RELATIVE:
|
||||
{
|
||||
GtkCssValue *vals[4];
|
||||
float v[4];
|
||||
gboolean m[4];
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
if (color->relative.values[i])
|
||||
vals[i] = gtk_css_value_compute (color->relative.values[i], GTK_CSS_PROPERTY_COLOR, context);
|
||||
{
|
||||
GtkCssValue *val;
|
||||
|
||||
m[i] = FALSE;
|
||||
val = gtk_css_value_compute (color->relative.values[i], property_id, context);
|
||||
v[i] = gtk_css_number_value_get_canonical (val, 1);
|
||||
|
||||
gtk_css_value_unref (val);
|
||||
}
|
||||
else
|
||||
vals[i] = NULL;
|
||||
{
|
||||
m[i] = TRUE;
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
value = resolve_relative (vals, color->relative.color_space, color->relative.legacy_srgb);
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
if (color->relative.color_space == GTK_CSS_COLOR_SPACE_SRGB &&
|
||||
color->relative.legacy_srgb)
|
||||
{
|
||||
if (vals[i])
|
||||
gtk_css_value_unref (vals[i]);
|
||||
v[0] /= 255.;
|
||||
v[1] /= 255.;
|
||||
v[2] /= 255.;
|
||||
}
|
||||
|
||||
v[3] = CLAMP (v[3], 0, 1); /* clamp alpha */
|
||||
|
||||
value = gtk_css_color_value_new_color (color->relative.color_space, FALSE, v, m);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -701,11 +679,8 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
GtkCssValue *named;
|
||||
GSList cycle = { color, cycle_list };
|
||||
|
||||
g_assert (provider != NULL);
|
||||
|
||||
/* If color exists in cycle_list, we're currently resolving it.
|
||||
* So we've detected a cycle.
|
||||
*/
|
||||
* So we've detected a cycle. */
|
||||
if (g_slist_find (cycle_list, color))
|
||||
return NULL;
|
||||
|
||||
@@ -713,7 +688,7 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
if (named == NULL)
|
||||
return NULL;
|
||||
|
||||
value = gtk_css_color_value_do_resolve (named, context, current, &cycle);
|
||||
value = gtk_css_color_value_do_resolve (named, property_id, context, current, &cycle);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -721,22 +696,14 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
{
|
||||
GtkCssValue *val1, *val2;
|
||||
|
||||
val1 = gtk_css_color_value_do_resolve (color->color_mix.color1, context, current, cycle_list);
|
||||
if (val1 == NULL)
|
||||
return NULL;
|
||||
val1 = gtk_css_color_value_do_resolve (color->color_mix.color1, property_id, context, current, cycle_list);
|
||||
val2 = gtk_css_color_value_do_resolve (color->color_mix.color2, property_id, context, current, cycle_list);
|
||||
|
||||
val2 = gtk_css_color_value_do_resolve (color->color_mix.color2, context, current, cycle_list);
|
||||
if (val2 == NULL)
|
||||
{
|
||||
gtk_css_value_unref (val1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
value = gtk_css_color_value_new_color_mix (color->color_mix.color_space,
|
||||
color->color_mix.hue_interpolation,
|
||||
val1, val2,
|
||||
color->color_mix.percentage1,
|
||||
color->color_mix.percentage2);
|
||||
value = apply_color_mix (color->color_mix.color_space,
|
||||
color->color_mix.hue_interpolation,
|
||||
val1, val2,
|
||||
color->color_mix.percentage1,
|
||||
color->color_mix.percentage2);
|
||||
|
||||
gtk_css_value_unref (val1);
|
||||
gtk_css_value_unref (val2);
|
||||
@@ -745,112 +712,122 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
|
||||
case COLOR_TYPE_SHADE:
|
||||
{
|
||||
const GdkRGBA *c;
|
||||
GtkCssValue *val;
|
||||
GdkRGBA shade;
|
||||
|
||||
val = gtk_css_color_value_do_resolve (color->shade.color, context, current, cycle_list);
|
||||
val = gtk_css_color_value_do_resolve (color->shade.color, property_id, context, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
value = gtk_css_color_value_new_shade (val, color->shade.factor);
|
||||
c = gtk_css_color_value_get_rgba (val);
|
||||
|
||||
apply_shade (c, &shade, color->shade.factor);
|
||||
|
||||
value = gtk_css_color_value_new_color_from_rgba (&shade);
|
||||
gtk_css_value_unref (val);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_ALPHA:
|
||||
{
|
||||
const GdkRGBA *c;
|
||||
GtkCssValue *val;
|
||||
GdkRGBA alpha;
|
||||
|
||||
val = gtk_css_color_value_do_resolve (color->alpha.color, context, current, cycle_list);
|
||||
val = gtk_css_color_value_do_resolve (color->alpha.color, property_id, context, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
c = gtk_css_color_value_get_rgba (val);
|
||||
|
||||
value = gtk_css_color_value_new_alpha (val, color->alpha.factor);
|
||||
apply_alpha (c, &alpha, color->alpha.factor);
|
||||
|
||||
value = gtk_css_color_value_new_color_from_rgba (&alpha);
|
||||
gtk_css_value_unref (val);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_MIX:
|
||||
{
|
||||
const GdkRGBA *color1, *color2;
|
||||
GtkCssValue *val1, *val2;
|
||||
GdkRGBA res;
|
||||
|
||||
val1 = gtk_css_color_value_do_resolve (color->mix.color1, context, current, cycle_list);
|
||||
val1 = gtk_css_color_value_do_resolve (color->mix.color1, property_id, context, current, cycle_list);
|
||||
if (val1 == NULL)
|
||||
return NULL;
|
||||
color1 = gtk_css_color_value_get_rgba (val1);
|
||||
|
||||
val2 = gtk_css_color_value_do_resolve (color->mix.color2, context, current, cycle_list);
|
||||
val2 = gtk_css_color_value_do_resolve (color->mix.color2, property_id, context, current, cycle_list);
|
||||
if (val2 == NULL)
|
||||
{
|
||||
gtk_css_value_unref (val1);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
color2 = gtk_css_color_value_get_rgba (val2);
|
||||
|
||||
value = gtk_css_color_value_new_mix (val1, val2, color->mix.factor);
|
||||
apply_mix (color1, color2, &res, color->mix.factor);
|
||||
|
||||
value = gtk_css_color_value_new_color_from_rgba (&res);
|
||||
gtk_css_value_unref (val1);
|
||||
gtk_css_value_unref (val2);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_CURRENT_COLOR:
|
||||
if (current)
|
||||
value = gtk_css_value_ref (current);
|
||||
else
|
||||
value = gtk_css_value_ref (color);
|
||||
if (current == NULL)
|
||||
current = _gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
value = gtk_css_value_ref (current);
|
||||
break;
|
||||
|
||||
case COLOR_TYPE_LIGHT_DARK:
|
||||
{
|
||||
GtkSettings *settings = gtk_style_provider_get_settings (provider);
|
||||
int color_scheme;
|
||||
|
||||
g_object_get (settings, "gtk-color-scheme", &color_scheme, NULL);
|
||||
|
||||
switch (color_scheme)
|
||||
{
|
||||
case GTK_COLOR_SCHEME_LIGHT:
|
||||
value = gtk_css_color_value_do_resolve (color->light_dark.color1, property_id, context, current, cycle_list);
|
||||
break;
|
||||
|
||||
case GTK_COLOR_SCHEME_DARK:
|
||||
value = gtk_css_color_value_do_resolve (color->light_dark.color2, property_id, context, current, cycle_list);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
value = NULL;
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/* gtk_css_color_value_resolve() can be called in two ways:
|
||||
* - at compute time, passing current == NULL, to make
|
||||
* currentcolor compute to itself
|
||||
* - at use time, passing the appropriate value for current,
|
||||
* to fully resolve color values that contain currentcolor
|
||||
* references
|
||||
*/
|
||||
static GtkCssValue *
|
||||
GtkCssValue *
|
||||
gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (context != NULL, NULL);
|
||||
|
||||
return gtk_css_color_value_do_resolve (color, context, current, NULL);
|
||||
return gtk_css_color_value_do_resolve (color, property_id, context, current, NULL);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Constructors */
|
||||
|
||||
static GtkCssValue transparent_black_singleton = { .class = >K_CSS_VALUE_COLOR,
|
||||
.ref_count = 1,
|
||||
.is_computed = TRUE,
|
||||
.contains_variables = FALSE,
|
||||
.contains_current_color = FALSE,
|
||||
.serialize_as_rgb = TRUE,
|
||||
.type = COLOR_TYPE_COLOR,
|
||||
static GtkCssValue transparent_black_singleton = { >K_CSS_VALUE_COLOR, 1, TRUE, FALSE, TRUE, COLOR_TYPE_COLOR,
|
||||
.rgba = {0, 0, 0, 0},
|
||||
.color = { GTK_CSS_COLOR_SPACE_SRGB, {0, 0, 0, 0}, 0 } };
|
||||
static GtkCssValue white_singleton = { .class = >K_CSS_VALUE_COLOR,
|
||||
.ref_count = 1,
|
||||
.is_computed = TRUE,
|
||||
.contains_variables = FALSE,
|
||||
.contains_current_color = FALSE,
|
||||
.serialize_as_rgb = TRUE,
|
||||
.type = COLOR_TYPE_COLOR,
|
||||
static GtkCssValue white_singleton = { >K_CSS_VALUE_COLOR, 1, TRUE, FALSE, TRUE, COLOR_TYPE_COLOR,
|
||||
.rgba = {1, 1, 1, 1},
|
||||
.color = { GTK_CSS_COLOR_SPACE_SRGB, {1, 1, 1, 1}, 0 } };
|
||||
|
||||
static GtkCssValue current_color_singleton = { .class = >K_CSS_VALUE_COLOR,
|
||||
.ref_count = 1,
|
||||
.is_computed = FALSE,
|
||||
.contains_variables = FALSE,
|
||||
.contains_current_color = TRUE,
|
||||
.serialize_as_rgb = FALSE,
|
||||
.type = COLOR_TYPE_CURRENT_COLOR,
|
||||
.rgba = {0, 0, 0, 0 },
|
||||
.color = { GTK_CSS_COLOR_SPACE_SRGB, {0, 0, 0, 0}, 0 } };
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_color_value_new_transparent (void)
|
||||
@@ -864,12 +841,6 @@ gtk_css_color_value_new_white (void)
|
||||
return gtk_css_value_ref (&white_singleton);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_color_value_new_current_color (void)
|
||||
{
|
||||
return gtk_css_value_ref (¤t_color_singleton);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_color_value_new_color (GtkCssColorSpace color_space,
|
||||
gboolean serialize_as_rgb,
|
||||
@@ -930,25 +901,6 @@ gtk_css_color_value_new_relative (GtkCssValue *origin,
|
||||
GtkCssValue *values[4])
|
||||
{
|
||||
GtkCssValue *value;
|
||||
gboolean computed = TRUE;
|
||||
|
||||
if (!gtk_css_value_is_computed (origin))
|
||||
computed = FALSE;
|
||||
|
||||
if (!computed)
|
||||
{
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
if (values[i] && !gtk_css_value_is_computed (values[i]))
|
||||
{
|
||||
computed = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (computed)
|
||||
return resolve_relative (values, color_space, legacy_srgb);
|
||||
|
||||
value = gtk_css_value_alloc (>K_CSS_VALUE_COLOR,
|
||||
sizeof (GtkCssValue) + sizeof (GtkCssValue *) * 3);
|
||||
@@ -1001,7 +953,6 @@ gtk_css_color_value_new_shade (GtkCssValue *color,
|
||||
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR);
|
||||
value->type = COLOR_TYPE_SHADE;
|
||||
value->contains_current_color = color->contains_current_color;
|
||||
value->shade.color = gtk_css_value_ref (color);
|
||||
value->shade.factor = factor;
|
||||
|
||||
@@ -1027,7 +978,6 @@ gtk_css_color_value_new_alpha (GtkCssValue *color,
|
||||
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR);
|
||||
value->type = COLOR_TYPE_ALPHA;
|
||||
value->contains_current_color = color->contains_current_color;
|
||||
value->alpha.color = gtk_css_value_ref (color);
|
||||
value->alpha.factor = factor;
|
||||
|
||||
@@ -1058,8 +1008,6 @@ gtk_css_color_value_new_color_mix (GtkCssColorSpace color_space,
|
||||
}
|
||||
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR);
|
||||
value->contains_current_color = color1->contains_current_color ||
|
||||
color2->contains_current_color;
|
||||
value->type = COLOR_TYPE_COLOR_MIX;
|
||||
value->color_mix.color_space = color_space;
|
||||
value->color_mix.hue_interpolation = hue_interpolation;
|
||||
@@ -1093,8 +1041,6 @@ gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR);
|
||||
value->type = COLOR_TYPE_MIX;
|
||||
value->contains_current_color = color1->contains_current_color ||
|
||||
color2->contains_current_color;
|
||||
value->mix.color1 = gtk_css_value_ref (color1);
|
||||
value->mix.color2 = gtk_css_value_ref (color2);
|
||||
value->mix.factor = factor;
|
||||
@@ -1102,6 +1048,28 @@ gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
return value;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_color_value_new_current_color (void)
|
||||
{
|
||||
static GtkCssValue current_color = { >K_CSS_VALUE_COLOR, 1, FALSE, FALSE, FALSE, COLOR_TYPE_CURRENT_COLOR, };
|
||||
|
||||
return gtk_css_value_ref (¤t_color);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_color_value_new_light_dark (GtkCssValue *color1,
|
||||
GtkCssValue *color2)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR);
|
||||
value->type = COLOR_TYPE_LIGHT_DARK;
|
||||
value->light_dark.color1 = gtk_css_value_ref (color1);
|
||||
value->light_dark.color2 = gtk_css_value_ref (color2);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Parsing */
|
||||
|
||||
@@ -1126,7 +1094,8 @@ gtk_css_color_value_can_parse (GtkCssParser *parser)
|
||||
|| gtk_css_parser_has_function (parser, "oklab")
|
||||
|| gtk_css_parser_has_function (parser, "oklch")
|
||||
|| gtk_css_parser_has_function (parser, "color")
|
||||
|| gtk_css_parser_has_function (parser, "color-mix");
|
||||
|| gtk_css_parser_has_function (parser, "color-mix")
|
||||
|| gtk_css_parser_has_function (parser, "light-dark");
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -1274,6 +1243,39 @@ parse_color_number (GtkCssParser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
parse_color_color (GtkCssParser *parser,
|
||||
guint arg,
|
||||
gpointer data_)
|
||||
{
|
||||
ColorFunctionData *data = data_;
|
||||
|
||||
switch (arg)
|
||||
{
|
||||
case 0:
|
||||
data->color = gtk_css_color_value_parse (parser);
|
||||
if (data->color == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
data->color2 = gtk_css_color_value_parse (parser);
|
||||
if (data->color2 == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkRGBA *rgba;
|
||||
gboolean use_percentages;
|
||||
gboolean missing[4];
|
||||
} ParseRGBAData;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COLOR_SYNTAX_DETECTING,
|
||||
@@ -1527,11 +1529,7 @@ parse_ok_ab_value (GtkCssParser *parser,
|
||||
if (data->values[idx] == NULL)
|
||||
return FALSE;
|
||||
|
||||
data->v[idx] = gtk_css_number_value_get_canonical (data->values[idx], 0.8);
|
||||
|
||||
/* gtk_css_number_value_get_canonical() doesn't let us specify what 0% is */
|
||||
if (gtk_css_number_value_has_percent (data->values[idx]))
|
||||
data->v[idx] -= 0.4;
|
||||
data->v[idx] = gtk_css_number_value_get_canonical (data->values[idx], 0.4);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -1676,8 +1674,6 @@ parse_color_color_channel (GtkCssParser *parser,
|
||||
ParseData *data,
|
||||
guint arg)
|
||||
{
|
||||
const GtkCssToken *token;
|
||||
|
||||
switch (arg)
|
||||
{
|
||||
case 0:
|
||||
@@ -1693,35 +1689,7 @@ parse_color_color_channel (GtkCssParser *parser,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "display-p3"))
|
||||
{
|
||||
data->ctx.color_space = GTK_CSS_COLOR_SPACE_DISPLAY_P3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "xyz"))
|
||||
{
|
||||
data->ctx.color_space = GTK_CSS_COLOR_SPACE_XYZ;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "rec2020"))
|
||||
{
|
||||
data->ctx.color_space = GTK_CSS_COLOR_SPACE_REC2020;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "rec2100-pq"))
|
||||
{
|
||||
data->ctx.color_space = GTK_CSS_COLOR_SPACE_REC2100_PQ;
|
||||
return 1;
|
||||
}
|
||||
|
||||
token = gtk_css_parser_get_token (parser);
|
||||
gtk_css_parser_error_syntax (parser,
|
||||
"Invalid color space in color(): %s",
|
||||
gtk_css_token_to_string (token));
|
||||
|
||||
gtk_css_parser_error_syntax (parser, "Invalid color space in color()");
|
||||
return 0;
|
||||
|
||||
case 1:
|
||||
@@ -1768,7 +1736,6 @@ parse_color_function (GtkCssParser *self,
|
||||
{
|
||||
data->ctx.color = gtk_css_color_value_parse (self);
|
||||
data->syntax = COLOR_SYNTAX_MODERN;
|
||||
data->serialize_as_rgb = FALSE;
|
||||
}
|
||||
|
||||
arg = 0;
|
||||
@@ -2046,6 +2013,20 @@ gtk_css_color_value_parse (GtkCssParser *parser)
|
||||
|
||||
g_clear_pointer (&data.color1, gtk_css_value_unref);
|
||||
g_clear_pointer (&data.color2, gtk_css_value_unref);
|
||||
return value;
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "light-dark"))
|
||||
{
|
||||
ColorFunctionData data = { NULL, };
|
||||
|
||||
if (gtk_css_parser_consume_function (parser, 2, 2, parse_color_color, &data))
|
||||
value = gtk_css_color_value_new_light_dark (data.color, data.color2);
|
||||
else
|
||||
value = NULL;
|
||||
|
||||
g_clear_pointer (&data.color, gtk_css_value_unref);
|
||||
g_clear_pointer (&data.color2, gtk_css_value_unref);
|
||||
|
||||
return value;
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "lighter"))
|
||||
@@ -2180,5 +2161,4 @@ gtk_css_color_value_get_coord (const GtkCssValue *color,
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -33,6 +33,11 @@ GtkCssValue * gtk_css_color_value_new_name (const char *name) G
|
||||
gboolean gtk_css_color_value_can_parse (GtkCssParser *parser);
|
||||
GtkCssValue * gtk_css_color_value_parse (GtkCssParser *parser);
|
||||
|
||||
GtkCssValue * gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context,
|
||||
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,
|
||||
|
||||
@@ -100,7 +100,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
||||
"GtkCssCornerValue",
|
||||
gtk_css_value_corner_free,
|
||||
gtk_css_value_corner_compute,
|
||||
NULL,
|
||||
gtk_css_value_corner_equal,
|
||||
gtk_css_value_corner_transition,
|
||||
NULL,
|
||||
@@ -109,14 +108,14 @@ static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
||||
};
|
||||
|
||||
static GtkCssValue corner_singletons[] = {
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, 1, 0, 0, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
{ >K_CSS_VALUE_CORNER, 1, TRUE, FALSE, NULL, NULL },
|
||||
};
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -136,7 +136,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
|
||||
"GtkCssEaseValue",
|
||||
gtk_css_value_ease_free,
|
||||
gtk_css_value_ease_compute,
|
||||
NULL,
|
||||
gtk_css_value_ease_equal,
|
||||
gtk_css_value_ease_transition,
|
||||
NULL,
|
||||
|
||||
+87
-108
@@ -77,7 +77,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
|
||||
"GtkCssBorderStyleValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -86,16 +85,16 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
|
||||
};
|
||||
|
||||
static GtkCssValue border_style_values[] = {
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_NONE, "none" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_SOLID, "solid" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_INSET, "inset" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_OUTSET, "outset" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_HIDDEN, "hidden" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DOTTED, "dotted" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DASHED, "dashed" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_DOUBLE, "double" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_GROOVE, "groove" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, 1, 0, 0, GTK_BORDER_STYLE_RIDGE, "ridge" }
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_NONE, "none" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_SOLID, "solid" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_INSET, "inset" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_OUTSET, "outset" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_HIDDEN, "hidden" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DOTTED, "dotted" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DASHED, "dashed" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_DOUBLE, "double" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_GROOVE, "groove" },
|
||||
{ >K_CSS_VALUE_BORDER_STYLE, 1, TRUE, FALSE, GTK_BORDER_STYLE_RIDGE, "ridge" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -136,7 +135,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
|
||||
"GtkCssBlendModeValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -145,22 +143,22 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
|
||||
};
|
||||
|
||||
static GtkCssValue blend_mode_values[] = {
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DEFAULT, "normal" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_MULTIPLY, "multiply" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SCREEN, "screen" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_OVERLAY, "overlay" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DARKEN, "darken" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_LIGHTEN, "lighten" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_DIFFERENCE, "difference" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_COLOR, "color" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_HUE, "hue" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_SATURATION, "saturation" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, 1, 0, 0, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DEFAULT, "normal" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_MULTIPLY, "multiply" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SCREEN, "screen" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_OVERLAY, "overlay" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DARKEN, "darken" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_LIGHTEN, "lighten" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR_DODGE, "color-dodge" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR_BURN, "color-burn" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_HARD_LIGHT, "hard-light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SOFT_LIGHT, "soft-light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_DIFFERENCE, "difference" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_COLOR, "color" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_HUE, "hue" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_SATURATION, "saturation" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, TRUE, FALSE, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -290,7 +288,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
||||
"GtkCssFontSizeValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_font_size_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -299,15 +296,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_size_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_LARGER, "larger" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_SMALL, "small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_LARGE, "large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, 0, 0, 0, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_LARGER, "larger" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_SMALL, "small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_LARGE, "large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, FALSE, FALSE, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -348,7 +345,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
|
||||
"GtkCssFontStyleValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -357,9 +353,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_style_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_OBLIQUE, "oblique" },
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, 1, 0, 0, PANGO_STYLE_ITALIC, "italic" }
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_OBLIQUE, "oblique" },
|
||||
{ >K_CSS_VALUE_FONT_STYLE, 1, TRUE, FALSE, PANGO_STYLE_ITALIC, "italic" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -446,7 +442,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
||||
"GtkCssFontWeightValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_font_weight_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -455,8 +450,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_weight_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_WEIGHT, 1, 0, 0, 0, BOLDER, "bolder" },
|
||||
{ >K_CSS_VALUE_FONT_WEIGHT, 1, 0, 0, 0, LIGHTER, "lighter" },
|
||||
{ >K_CSS_VALUE_FONT_WEIGHT, 1, FALSE, FALSE, BOLDER, "bolder" },
|
||||
{ >K_CSS_VALUE_FONT_WEIGHT, 1, FALSE, FALSE, LIGHTER, "lighter" },
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -497,7 +492,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
|
||||
"GtkCssFontStretchValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -506,15 +500,15 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_stretch_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_CONDENSED, "condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXPANDED, "expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, 1, 0, 0, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_ULTRA_CONDENSED, "ultra-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXTRA_CONDENSED, "extra-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_CONDENSED, "condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_SEMI_CONDENSED, "semi-condensed" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_SEMI_EXPANDED, "semi-expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXPANDED, "expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_EXTRA_EXPANDED, "extra-expanded" },
|
||||
{ >K_CSS_VALUE_FONT_STRETCH, 1, TRUE, FALSE, PANGO_STRETCH_ULTRA_EXPANDED, "ultra-expanded" },
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -555,7 +549,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
|
||||
"GtkCssTextDecorationStyleValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -564,9 +557,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
|
||||
};
|
||||
|
||||
static GtkCssValue text_decoration_style_values[] = {
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, 1, 0, 0, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_SOLID, "solid" },
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE, "double" },
|
||||
{ >K_CSS_VALUE_TEXT_DECORATION_STYLE, 1, TRUE, FALSE, GTK_CSS_TEXT_DECORATION_STYLE_WAVY, "wavy" },
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -607,7 +600,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
|
||||
"GtkCssAreaValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -616,9 +608,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
|
||||
};
|
||||
|
||||
static GtkCssValue area_values[] = {
|
||||
{ >K_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_BORDER_BOX, "border-box" },
|
||||
{ >K_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
|
||||
{ >K_CSS_VALUE_AREA, 1, 1, 0, 0, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
|
||||
{ >K_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_BORDER_BOX, "border-box" },
|
||||
{ >K_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
|
||||
{ >K_CSS_VALUE_AREA, 1, TRUE, FALSE, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -665,7 +657,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
|
||||
"GtkCssDirectionValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -674,10 +665,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
|
||||
};
|
||||
|
||||
static GtkCssValue direction_values[] = {
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_REVERSE, "reverse" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, 1, 0, 0, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_REVERSE, "reverse" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
|
||||
{ >K_CSS_VALUE_DIRECTION, 1, TRUE, FALSE, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -727,7 +718,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
|
||||
"GtkCssPlayStateValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -736,8 +726,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
|
||||
};
|
||||
|
||||
static GtkCssValue play_state_values[] = {
|
||||
{ >K_CSS_VALUE_PLAY_STATE, 1, 1, 0, 0, GTK_CSS_PLAY_STATE_RUNNING, "running" },
|
||||
{ >K_CSS_VALUE_PLAY_STATE, 1, 1, 0, 0, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
|
||||
{ >K_CSS_VALUE_PLAY_STATE, 1, TRUE, FALSE, GTK_CSS_PLAY_STATE_RUNNING, "running" },
|
||||
{ >K_CSS_VALUE_PLAY_STATE, 1, TRUE, FALSE, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -784,7 +774,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
|
||||
"GtkCssFillModeValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -793,10 +782,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
|
||||
};
|
||||
|
||||
static GtkCssValue fill_mode_values[] = {
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_NONE, "none" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_FORWARDS, "forwards" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_BACKWARDS, "backwards" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, 1, 0, 0, GTK_CSS_FILL_BOTH, "both" }
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_NONE, "none" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_FORWARDS, "forwards" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_BACKWARDS, "backwards" },
|
||||
{ >K_CSS_VALUE_FILL_MODE, 1, TRUE, FALSE, GTK_CSS_FILL_BOTH, "both" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -843,7 +832,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
|
||||
"GtkCssIconStyleValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -852,9 +840,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
|
||||
};
|
||||
|
||||
static GtkCssValue icon_style_values[] = {
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, 1, 0, 0, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_REQUESTED, "requested" },
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_REGULAR, "regular" },
|
||||
{ >K_CSS_VALUE_ICON_STYLE, 1, TRUE, FALSE, GTK_CSS_ICON_STYLE_SYMBOLIC, "symbolic" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -901,7 +889,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
|
||||
"GtkCssFontKerningValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -910,9 +897,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_kerning_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_AUTO, "auto" },
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, 1, 0, 0, GTK_CSS_FONT_KERNING_NONE, "none" }
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_AUTO, "auto" },
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_KERNING, 1, TRUE, FALSE, GTK_CSS_FONT_KERNING_NONE, "none" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -959,7 +946,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
|
||||
"GtkCssFontVariationPositionValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -968,9 +954,9 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_variant_position_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_SUB, "sub" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_POSITION, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_POSITION_SUPER, "super" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -1017,7 +1003,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
|
||||
"GtkCssFontVariantCapsValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1026,13 +1011,13 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_variant_caps_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS, "small-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS, "all-small-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS, "petite-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS, "all-petite-caps" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_UNICASE, "unicase" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_CAPS, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS, "titling-caps" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -1079,7 +1064,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
|
||||
"GtkCssFontVariantAlternateValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1088,8 +1072,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
|
||||
};
|
||||
|
||||
static GtkCssValue font_variant_alternate_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, 1, 0, 0, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_FONT_VARIANT_ALTERNATE, 1, TRUE, FALSE, GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS, "historical-forms" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
@@ -1188,7 +1172,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_LINE = {
|
||||
"GtkCssTextDecorationLine",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_flags_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1288,7 +1271,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_LIGATURE = {
|
||||
"GtkCssFontVariantLigatureValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_flags_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1397,7 +1379,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_NUMERIC = {
|
||||
"GtkCssFontVariantNumbericValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_flags_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1503,7 +1484,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_EAST_ASIAN = {
|
||||
"GtkCssFontVariantEastAsianValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_flags_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1593,7 +1573,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_TRANSFORM = {
|
||||
"GtkCssTextTransformValue",
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
NULL,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
NULL,
|
||||
@@ -1602,10 +1581,10 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_TRANSFORM = {
|
||||
};
|
||||
|
||||
static GtkCssValue text_transform_values[] = {
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_NONE, "none" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_LOWERCASE, "lowercase" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_UPPERCASE, "uppercase" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, 1, 0, 0, GTK_CSS_TEXT_TRANSFORM_CAPITALIZE, "capitalize" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_NONE, "none" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_LOWERCASE, "lowercase" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_UPPERCASE, "uppercase" },
|
||||
{ >K_CSS_VALUE_TEXT_TRANSFORM, 1, TRUE, FALSE, GTK_CSS_TEXT_TRANSFORM_CAPITALIZE, "capitalize" },
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
|
||||
@@ -710,7 +710,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
|
||||
"GtkCssFilterValue",
|
||||
gtk_css_value_filter_free,
|
||||
gtk_css_value_filter_compute,
|
||||
NULL,
|
||||
gtk_css_value_filter_equal,
|
||||
gtk_css_value_filter_transition,
|
||||
NULL,
|
||||
@@ -718,7 +717,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
|
||||
gtk_css_value_filter_print
|
||||
};
|
||||
|
||||
static GtkCssValue filter_none_singleton = { >K_CSS_VALUE_FILTER, 1, 1, 0, 0, 0, { { GTK_CSS_FILTER_NONE } } };
|
||||
static GtkCssValue filter_none_singleton = { >K_CSS_VALUE_FILTER, 1, TRUE, FALSE, 0, { { GTK_CSS_FILTER_NONE } } };
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_filter_value_alloc (guint n_filters)
|
||||
|
||||
@@ -156,7 +156,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_FEATURES = {
|
||||
"GtkCssFontFeaturesValue",
|
||||
gtk_css_value_font_features_free,
|
||||
gtk_css_value_font_features_compute,
|
||||
NULL,
|
||||
gtk_css_value_font_features_equal,
|
||||
gtk_css_value_font_features_transition,
|
||||
NULL,
|
||||
|
||||
@@ -157,7 +157,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIATIONS = {
|
||||
"GtkCssFontVariationsValue",
|
||||
gtk_css_value_font_variations_free,
|
||||
gtk_css_value_font_variations_compute,
|
||||
NULL,
|
||||
gtk_css_value_font_variations_equal,
|
||||
gtk_css_value_font_variations_transition,
|
||||
NULL,
|
||||
|
||||
+6
-40
@@ -120,20 +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,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_css_image_class_init (GtkCssImageClass *klass)
|
||||
{
|
||||
@@ -147,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
|
||||
@@ -255,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;
|
||||
@@ -513,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;
|
||||
@@ -604,21 +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,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageClass *klass = GTK_CSS_IMAGE_GET_CLASS (image);
|
||||
|
||||
return klass->resolve (image, context, current_color);
|
||||
}
|
||||
|
||||
+31
-122
@@ -81,10 +81,7 @@ gtk_css_image_conic_snapshot (GtkCssImage *image,
|
||||
last = i;
|
||||
}
|
||||
|
||||
if (self->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
g_warning_once ("Gradient interpolation color spaces are not supported yet");
|
||||
|
||||
gtk_snapshot_append_conic_gradient (
|
||||
gtk_snapshot_append_conic_gradient (
|
||||
snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (_gtk_css_position_value_get_x (self->center, width),
|
||||
@@ -175,57 +172,37 @@ gtk_css_image_conic_parse_first_arg (GtkCssImageConic *self,
|
||||
GtkCssParser *parser,
|
||||
GArray *stop_array)
|
||||
{
|
||||
gboolean has_rotation = FALSE;
|
||||
gboolean has_center = FALSE;
|
||||
gboolean has_colorspace = FALSE;
|
||||
int retval = 1;
|
||||
gboolean nothing_parsed = TRUE;
|
||||
|
||||
do
|
||||
if (gtk_css_parser_try_ident (parser, "from"))
|
||||
{
|
||||
if (!has_colorspace && gtk_css_color_interpolation_method_can_parse (parser))
|
||||
{
|
||||
if (!gtk_css_color_interpolation_method_parse (parser, &self->color_space, &self->hue_interp))
|
||||
return 0;
|
||||
has_colorspace = TRUE;
|
||||
}
|
||||
else if (!has_rotation && gtk_css_parser_try_ident (parser, "from"))
|
||||
{
|
||||
self->rotation = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (self->rotation == NULL)
|
||||
return 0;
|
||||
has_rotation = TRUE;
|
||||
}
|
||||
else if (!has_center && gtk_css_parser_try_ident (parser, "at"))
|
||||
{
|
||||
self->center = _gtk_css_position_value_parse (parser);
|
||||
if (self->center == NULL)
|
||||
return 0;
|
||||
has_center = TRUE;
|
||||
}
|
||||
else if (gtk_css_token_is (gtk_css_parser_get_token (parser), GTK_CSS_TOKEN_COMMA))
|
||||
{
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_css_image_conic_parse_color_stop (self, parser, stop_array))
|
||||
{
|
||||
retval = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self->rotation = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (self->rotation == NULL)
|
||||
return 0;
|
||||
nothing_parsed = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->rotation = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
}
|
||||
while (!(has_colorspace && has_rotation && has_center));
|
||||
|
||||
if (!has_rotation)
|
||||
self->rotation = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
if (gtk_css_parser_try_ident (parser, "at"))
|
||||
{
|
||||
self->center = _gtk_css_position_value_parse (parser);
|
||||
if (self->center == NULL)
|
||||
return 0;
|
||||
nothing_parsed = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->center = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
}
|
||||
|
||||
if (!has_center)
|
||||
self->center = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
if (!nothing_parsed)
|
||||
return 1;
|
||||
|
||||
return retval;
|
||||
return 1 + gtk_css_image_conic_parse_color_stop (self, parser, stop_array);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -288,7 +265,7 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
gboolean written = FALSE;
|
||||
guint i;
|
||||
|
||||
g_string_append (string, "conic-gradient(");
|
||||
g_string_append (string, "self-gradient(");
|
||||
|
||||
if (self->center)
|
||||
{
|
||||
@@ -297,7 +274,7 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
|
||||
if (!gtk_css_value_equal (self->center, compare))
|
||||
{
|
||||
g_string_append (string, "at ");
|
||||
g_string_append (string, "from ");
|
||||
gtk_css_value_print (self->center, string);
|
||||
written = TRUE;
|
||||
}
|
||||
@@ -309,19 +286,8 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
{
|
||||
if (written)
|
||||
g_string_append_c (string, ' ');
|
||||
g_string_append (string, "from ");
|
||||
g_string_append (string, "at ");
|
||||
gtk_css_value_print (self->rotation, string);
|
||||
written = TRUE;
|
||||
}
|
||||
|
||||
if (self->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
{
|
||||
if (written)
|
||||
g_string_append_c (string, ' ');
|
||||
gtk_css_color_interpolation_method_print (self->color_space,
|
||||
self->hue_interp,
|
||||
string);
|
||||
written = TRUE;
|
||||
}
|
||||
|
||||
if (written)
|
||||
@@ -359,11 +325,9 @@ gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
|
||||
copy->center = gtk_css_value_compute (self->center, property_id, context);
|
||||
copy->rotation = gtk_css_value_compute (self->rotation, property_id, context);
|
||||
copy->color_space = self->color_space;
|
||||
copy->hue_interp = self->hue_interp;
|
||||
|
||||
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];
|
||||
@@ -416,9 +380,6 @@ gtk_css_image_conic_transition (GtkCssImage *start_image,
|
||||
if (result->rotation == NULL)
|
||||
goto fail;
|
||||
|
||||
result->color_space = start->color_space;
|
||||
result->hue_interp = start->hue_interp;
|
||||
|
||||
result->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * start->n_stops);
|
||||
result->n_stops = 0;
|
||||
for (i = 0; i < start->n_stops; i++)
|
||||
@@ -474,9 +435,7 @@ gtk_css_image_conic_equal (GtkCssImage *image1,
|
||||
guint i;
|
||||
|
||||
if (!gtk_css_value_equal (conic1->center, conic2->center) ||
|
||||
!gtk_css_value_equal (conic1->rotation, conic2->rotation) ||
|
||||
conic1->color_space != conic2->color_space ||
|
||||
conic1->hue_interp != conic2->hue_interp)
|
||||
!gtk_css_value_equal (conic1->rotation, conic2->rotation))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < conic1->n_stops; i++)
|
||||
@@ -544,54 +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,
|
||||
GtkCssComputeContext *context,
|
||||
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_value_resolve (self->color_stops[i].color, context, current_color);
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (resolved);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_image_conic_class_init (GtkCssImageConicClass *klass)
|
||||
{
|
||||
@@ -605,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;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,6 @@ struct _GtkCssImageConic
|
||||
GtkCssValue *center;
|
||||
GtkCssValue *rotation;
|
||||
|
||||
GtkCssColorSpace color_space;
|
||||
GtkCssHueInterpolation hue_interp;
|
||||
|
||||
guint n_stops;
|
||||
GtkCssImageConicColorStop *color_stops;
|
||||
};
|
||||
|
||||
@@ -448,49 +448,6 @@ gtk_css_image_cross_fade_is_computed (GtkCssImage *image)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_cross_fade_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
GtkCssImageCrossFade *cross_fade = GTK_CSS_IMAGE_CROSS_FADE (image);
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < cross_fade->images->len; i++)
|
||||
{
|
||||
const CrossFadeEntry *entry = &g_array_index (cross_fade->images, CrossFadeEntry, i);
|
||||
if (gtk_css_image_contains_current_color (entry->image))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_cross_fade_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current)
|
||||
{
|
||||
GtkCssImageCrossFade *self = GTK_CSS_IMAGE_CROSS_FADE (image);
|
||||
GtkCssImageCrossFade *result;
|
||||
guint i;
|
||||
|
||||
if (!gtk_css_image_cross_fade_contains_current_color (image))
|
||||
return g_object_ref (image);
|
||||
|
||||
result = gtk_css_image_cross_fade_new_empty ();
|
||||
|
||||
for (i = 0; i < self->images->len; i++)
|
||||
{
|
||||
CrossFadeEntry *entry = &g_array_index (self->images, CrossFadeEntry, i);
|
||||
|
||||
gtk_css_image_cross_fade_add (result,
|
||||
entry->has_progress,
|
||||
entry->progress,
|
||||
gtk_css_image_resolve (entry->image, context, current));
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (result);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_image_cross_fade_class_init (GtkCssImageCrossFadeClass *klass)
|
||||
{
|
||||
@@ -507,8 +464,6 @@ gtk_css_image_cross_fade_class_init (GtkCssImageCrossFadeClass *klass)
|
||||
image_class->parse = gtk_css_image_cross_fade_parse;
|
||||
image_class->print = gtk_css_image_cross_fade_print;
|
||||
image_class->is_computed = gtk_css_image_cross_fade_is_computed;
|
||||
image_class->contains_current_color = gtk_css_image_cross_fade_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_cross_fade_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_cross_fade_dispose;
|
||||
}
|
||||
|
||||
@@ -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,73 +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 gtk_css_image_contains_current_color (fallback->images[fallback->used]);
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_fallback_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
|
||||
GtkCssImageFallback *resolved;
|
||||
int i;
|
||||
|
||||
if (!gtk_css_image_fallback_contains_current_color (image))
|
||||
return g_object_ref (image);
|
||||
|
||||
if (fallback->used < 0)
|
||||
{
|
||||
GtkCssValue *resolved_color = NULL;
|
||||
|
||||
if (fallback->color)
|
||||
resolved_color = gtk_css_value_resolve (fallback->color, context, 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] = gtk_css_image_resolve (fallback->images[i], context, current_color);
|
||||
|
||||
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_resolve (fallback->images[fallback->used], context, current_color);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
|
||||
{
|
||||
@@ -386,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;
|
||||
}
|
||||
|
||||
@@ -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,52 +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,
|
||||
GtkCssComputeContext *context,
|
||||
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_value_resolve (icon_theme->colors[i], context, current);
|
||||
|
||||
return GTK_CSS_IMAGE (copy);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
|
||||
{
|
||||
@@ -257,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ struct _GtkCssImageIconTheme
|
||||
GtkCssImage parent;
|
||||
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkCssValue *colors[4];
|
||||
GdkRGBA colors[4];
|
||||
int serial;
|
||||
int scale;
|
||||
char *name;
|
||||
|
||||
+64
-178
@@ -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,18 +236,14 @@ 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;
|
||||
last = i;
|
||||
}
|
||||
|
||||
if (linear->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
g_warning_once ("Gradient interpolation color spaces are not supported yet");
|
||||
|
||||
if (linear->repeating)
|
||||
{
|
||||
gtk_snapshot_append_repeating_linear_gradient (
|
||||
@@ -312,102 +304,75 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
|
||||
GArray *stop_array)
|
||||
{
|
||||
guint i;
|
||||
gboolean has_colorspace = FALSE;
|
||||
gboolean has_side_or_angle = FALSE;
|
||||
guint retval = 1;
|
||||
|
||||
do
|
||||
if (gtk_css_parser_try_ident (parser, "to"))
|
||||
{
|
||||
if (!has_colorspace &>k_css_color_interpolation_method_can_parse (parser))
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (!gtk_css_color_interpolation_method_parse (parser, &linear->color_space, &linear->hue_interp))
|
||||
return 0;
|
||||
has_colorspace = TRUE;
|
||||
}
|
||||
else if (!has_side_or_angle && gtk_css_parser_try_ident (parser, "to"))
|
||||
{
|
||||
gtk_css_parser_consume_token (parser);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (gtk_css_parser_try_ident (parser, "left"))
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, "left"))
|
||||
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
|
||||
{
|
||||
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_LEFT);
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
|
||||
return 0;
|
||||
}
|
||||
else if (gtk_css_parser_try_ident (parser, "right"))
|
||||
{
|
||||
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_RIGHT);
|
||||
}
|
||||
else if (gtk_css_parser_try_ident (parser, "top"))
|
||||
{
|
||||
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_TOP);
|
||||
}
|
||||
else if (gtk_css_parser_try_ident (parser, "bottom"))
|
||||
{
|
||||
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_BOTTOM);
|
||||
}
|
||||
else
|
||||
break;
|
||||
linear->side |= (1 << GTK_CSS_LEFT);
|
||||
}
|
||||
|
||||
if (linear->side == 0)
|
||||
else if (gtk_css_parser_try_ident (parser, "right"))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected side that gradient should go to");
|
||||
return 0;
|
||||
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_RIGHT);
|
||||
}
|
||||
|
||||
has_side_or_angle = TRUE;
|
||||
}
|
||||
else if (!has_side_or_angle && gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
linear->angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (linear->angle == NULL)
|
||||
return 0;
|
||||
|
||||
has_side_or_angle = TRUE;
|
||||
}
|
||||
else if (gtk_css_token_is (gtk_css_parser_get_token (parser), GTK_CSS_TOKEN_COMMA))
|
||||
{
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_css_image_linear_parse_color_stop (linear, parser, stop_array))
|
||||
else if (gtk_css_parser_try_ident (parser, "top"))
|
||||
{
|
||||
retval = 2;
|
||||
break;
|
||||
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_TOP);
|
||||
}
|
||||
else if (gtk_css_parser_try_ident (parser, "bottom"))
|
||||
{
|
||||
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
|
||||
return 0;
|
||||
}
|
||||
linear->side |= (1 << GTK_CSS_BOTTOM);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (linear->side == 0)
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected side that gradient should go to");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
while (!(has_colorspace && has_side_or_angle));
|
||||
else if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
linear->angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (linear->angle == NULL)
|
||||
return 0;
|
||||
|
||||
if (linear->angle == NULL && linear->side == 0)
|
||||
linear->side = (1 << GTK_CSS_BOTTOM);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
linear->side = 1 << GTK_CSS_BOTTOM;
|
||||
if (!gtk_css_image_linear_parse_color_stop (linear, parser, stop_array))
|
||||
return 0;
|
||||
|
||||
return retval;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -472,7 +437,6 @@ gtk_css_image_linear_print (GtkCssImage *image,
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
guint i;
|
||||
gboolean has_printed = FALSE;
|
||||
|
||||
if (linear->repeating)
|
||||
g_string_append (string, "repeating-linear-gradient(");
|
||||
@@ -495,29 +459,15 @@ gtk_css_image_linear_print (GtkCssImage *image,
|
||||
else if (linear->side & (1 << GTK_CSS_RIGHT))
|
||||
g_string_append (string, " right");
|
||||
|
||||
has_printed = TRUE;
|
||||
g_string_append (string, ", ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_value_print (linear->angle, string);
|
||||
has_printed = TRUE;
|
||||
g_string_append (string, ", ");
|
||||
}
|
||||
|
||||
if (linear->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
{
|
||||
if (has_printed)
|
||||
g_string_append_c (string, ' ');
|
||||
|
||||
gtk_css_color_interpolation_method_print (linear->color_space,
|
||||
linear->hue_interp,
|
||||
string);
|
||||
has_printed = TRUE;
|
||||
}
|
||||
|
||||
if (has_printed)
|
||||
g_string_append (string, ", ");
|
||||
|
||||
for (i = 0; i < linear->n_stops; i++)
|
||||
{
|
||||
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
|
||||
@@ -549,8 +499,6 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
|
||||
copy->repeating = linear->repeating;
|
||||
copy->side = linear->side;
|
||||
copy->color_space = linear->color_space;
|
||||
copy->hue_interp = linear->hue_interp;
|
||||
|
||||
if (linear->angle)
|
||||
copy->angle = gtk_css_value_compute (linear->angle, property_id, context);
|
||||
@@ -597,15 +545,11 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
|
||||
end = GTK_CSS_IMAGE_LINEAR (end_image);
|
||||
|
||||
if ((start->repeating != end->repeating)
|
||||
|| (start->n_stops != end->n_stops)
|
||||
|| (start->color_space != end->color_space)
|
||||
|| (start->hue_interp != end->hue_interp))
|
||||
|| (start->n_stops != end->n_stops))
|
||||
return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
|
||||
result->repeating = start->repeating;
|
||||
result->color_space = start->color_space;
|
||||
result->hue_interp = start->hue_interp;
|
||||
|
||||
if (start->side != end->side)
|
||||
goto fail;
|
||||
@@ -674,9 +618,7 @@ gtk_css_image_linear_equal (GtkCssImage *image1,
|
||||
if (linear1->repeating != linear2->repeating ||
|
||||
linear1->side != linear2->side ||
|
||||
(linear1->side == 0 && !gtk_css_value_equal (linear1->angle, linear2->angle)) ||
|
||||
linear1->n_stops != linear2->n_stops ||
|
||||
linear1->color_space != linear2->color_space ||
|
||||
linear1->hue_interp != linear2->hue_interp)
|
||||
linear1->n_stops != linear2->n_stops)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < linear1->n_stops; i++)
|
||||
@@ -747,60 +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,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
GtkCssImageLinear *copy;
|
||||
guint i;
|
||||
|
||||
if (!gtk_css_image_linear_contains_current_color (image))
|
||||
return g_object_ref (image);
|
||||
|
||||
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 = ©->color_stops[i];
|
||||
|
||||
scopy->color = gtk_css_value_resolve (stop->color, context, 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)
|
||||
{
|
||||
@@ -814,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;
|
||||
}
|
||||
|
||||
@@ -48,9 +48,6 @@ struct _GtkCssImageLinear
|
||||
guint repeating :1;
|
||||
GtkCssValue *angle;
|
||||
|
||||
GtkCssColorSpace color_space;
|
||||
GtkCssHueInterpolation hue_interp;
|
||||
|
||||
guint n_stops;
|
||||
GtkCssImageLinearColorStop *color_stops;
|
||||
};
|
||||
|
||||
@@ -157,20 +157,6 @@ gtk_css_image_paintable_is_computed (GtkCssImage *image)
|
||||
return (gdk_paintable_get_flags (self->paintable) & GDK_PAINTABLE_IMMUTABLE) == GDK_PAINTABLE_IMMUTABLE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_paintable_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_paintable_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *value)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_image_paintable_class_init (GtkCssImagePaintableClass *klass)
|
||||
{
|
||||
@@ -187,8 +173,6 @@ gtk_css_image_paintable_class_init (GtkCssImagePaintableClass *klass)
|
||||
image_class->is_dynamic = gtk_css_image_paintable_is_dynamic;
|
||||
image_class->is_computed = gtk_css_image_paintable_is_computed;
|
||||
image_class->get_dynamic_image = gtk_css_image_paintable_get_dynamic_image;
|
||||
image_class->contains_current_color = gtk_css_image_paintable_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_paintable_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_paintable_dispose;
|
||||
}
|
||||
|
||||
@@ -91,10 +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,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color);
|
||||
};
|
||||
|
||||
GType _gtk_css_image_get_type (void) G_GNUC_CONST;
|
||||
@@ -116,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,
|
||||
@@ -142,11 +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,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+3
-89
@@ -194,9 +194,6 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
|
||||
last = i;
|
||||
}
|
||||
|
||||
if (radial->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
g_warning_once ("Gradient interpolation color spaces are not supported yet");
|
||||
|
||||
if (radial->repeating)
|
||||
gtk_snapshot_append_repeating_radial_gradient (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
@@ -258,7 +255,6 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
|
||||
{
|
||||
gboolean has_shape = FALSE;
|
||||
gboolean has_size = FALSE;
|
||||
gboolean has_colorspace = FALSE;
|
||||
gboolean found_one = FALSE;
|
||||
guint i;
|
||||
static struct {
|
||||
@@ -274,13 +270,7 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
|
||||
found_one = FALSE;
|
||||
|
||||
do {
|
||||
if (!has_colorspace && gtk_css_color_interpolation_method_can_parse (parser))
|
||||
{
|
||||
if (!gtk_css_color_interpolation_method_parse (parser, &radial->color_space, &radial->hue_interp))
|
||||
return 0;
|
||||
has_colorspace = TRUE;
|
||||
}
|
||||
else if (!has_shape && gtk_css_parser_try_ident (parser, "circle"))
|
||||
if (!has_shape && gtk_css_parser_try_ident (parser, "circle"))
|
||||
{
|
||||
radial->circle = TRUE;
|
||||
found_one = has_shape = TRUE;
|
||||
@@ -477,14 +467,6 @@ gtk_css_image_radial_print (GtkCssImage *image,
|
||||
g_string_append (string, " at ");
|
||||
gtk_css_value_print (radial->position, string);
|
||||
|
||||
if (radial->color_space != GTK_CSS_COLOR_SPACE_SRGB)
|
||||
{
|
||||
g_string_append_c (string, ' ');
|
||||
gtk_css_color_interpolation_method_print (radial->color_space,
|
||||
radial->hue_interp,
|
||||
string);
|
||||
}
|
||||
|
||||
g_string_append (string, ", ");
|
||||
|
||||
for (i = 0; i < radial->n_stops; i++)
|
||||
@@ -519,8 +501,6 @@ gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
copy->repeating = radial->repeating;
|
||||
copy->circle = radial->circle;
|
||||
copy->size = radial->size;
|
||||
copy->color_space = radial->color_space;
|
||||
copy->hue_interp = radial->hue_interp;
|
||||
|
||||
copy->position = gtk_css_value_compute (radial->position, property_id, context);
|
||||
|
||||
@@ -574,9 +554,7 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
|
||||
if (start->repeating != end->repeating ||
|
||||
start->n_stops != end->n_stops ||
|
||||
start->size != end->size ||
|
||||
start->circle != end->circle ||
|
||||
start->color_space != end->color_space ||
|
||||
start->hue_interp != end->hue_interp)
|
||||
start->circle != end->circle)
|
||||
return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_IMAGE_RADIAL, NULL);
|
||||
@@ -667,9 +645,7 @@ gtk_css_image_radial_equal (GtkCssImage *image1,
|
||||
(radial1->sizes[0] && radial2->sizes[0] && !gtk_css_value_equal (radial1->sizes[0], radial2->sizes[0])) ||
|
||||
((radial1->sizes[1] == NULL) != (radial2->sizes[1] == NULL)) ||
|
||||
(radial1->sizes[1] && radial2->sizes[1] && !gtk_css_value_equal (radial1->sizes[1], radial2->sizes[1])) ||
|
||||
radial1->n_stops != radial2->n_stops ||
|
||||
radial1->color_space != radial2->color_space ||
|
||||
radial1->hue_interp != radial2->hue_interp)
|
||||
radial1->n_stops != radial2->n_stops)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < radial1->n_stops; i++)
|
||||
@@ -748,66 +724,6 @@ gtk_css_image_radial_is_computed (GtkCssImage *image)
|
||||
|
||||
return computed;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_radial_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
|
||||
|
||||
for (guint i = 0; i < radial->n_stops; i ++)
|
||||
{
|
||||
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
|
||||
|
||||
if (gtk_css_value_contains_current_color (stop->color))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_radial_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
|
||||
GtkCssImageRadial *copy;
|
||||
|
||||
if (!gtk_css_image_radial_contains_current_color (image))
|
||||
return g_object_ref (image);
|
||||
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_RADIAL, NULL);
|
||||
copy->repeating = radial->repeating;
|
||||
copy->circle = radial->circle;
|
||||
copy->size = radial->size;
|
||||
|
||||
copy->position = gtk_css_value_ref (radial->position);
|
||||
|
||||
if (radial->sizes[0])
|
||||
copy->sizes[0] = gtk_css_value_ref (radial->sizes[0]);
|
||||
|
||||
if (radial->sizes[1])
|
||||
copy->sizes[1] = gtk_css_value_ref (radial->sizes[1]);
|
||||
|
||||
copy->n_stops = radial->n_stops;
|
||||
copy->color_stops = g_new (GtkCssImageRadialColorStop, copy->n_stops);
|
||||
|
||||
for (guint i = 0; i < radial->n_stops; i++)
|
||||
{
|
||||
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
|
||||
GtkCssImageRadialColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = gtk_css_value_resolve (stop->color, context, 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_radial_class_init (GtkCssImageRadialClass *klass)
|
||||
{
|
||||
@@ -821,8 +737,6 @@ _gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
|
||||
image_class->transition = gtk_css_image_radial_transition;
|
||||
image_class->equal = gtk_css_image_radial_equal;
|
||||
image_class->is_computed = gtk_css_image_radial_is_computed;
|
||||
image_class->contains_current_color = gtk_css_image_radial_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_radial_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_radial_dispose;
|
||||
}
|
||||
|
||||
@@ -54,13 +54,8 @@ struct _GtkCssImageRadial
|
||||
|
||||
GtkCssValue *position;
|
||||
GtkCssValue *sizes[2];
|
||||
|
||||
GtkCssColorSpace color_space;
|
||||
GtkCssHueInterpolation hue_interp;
|
||||
|
||||
guint n_stops;
|
||||
GtkCssImageRadialColorStop *color_stops;
|
||||
|
||||
GtkCssRadialSize size;
|
||||
guint circle : 1;
|
||||
guint repeating :1;
|
||||
|
||||
+47
-68
@@ -55,13 +55,43 @@ gtk_css_image_recolor_dispose (GObject *object)
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (object);
|
||||
|
||||
g_clear_pointer (&recolor->palette, gtk_css_value_unref);
|
||||
g_clear_pointer (&recolor->color, gtk_css_value_unref);
|
||||
g_clear_object (&recolor->file);
|
||||
g_clear_object (&recolor->texture);
|
||||
|
||||
G_OBJECT_CLASS (_gtk_css_image_recolor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
lookup_symbolic_colors (GtkCssStyle *style,
|
||||
GtkCssValue *palette,
|
||||
GdkRGBA *color_out,
|
||||
GdkRGBA *success_out,
|
||||
GdkRGBA *warning_out,
|
||||
GdkRGBA *error_out)
|
||||
{
|
||||
const GdkRGBA *lookup;
|
||||
|
||||
*color_out = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
|
||||
lookup = gtk_css_palette_value_get_color (palette, "success");
|
||||
if (lookup)
|
||||
*success_out = *lookup;
|
||||
else
|
||||
*success_out = *color_out;
|
||||
|
||||
lookup = gtk_css_palette_value_get_color (palette, "warning");
|
||||
if (lookup)
|
||||
*warning_out = *lookup;
|
||||
else
|
||||
*warning_out = *color_out;
|
||||
|
||||
lookup = gtk_css_palette_value_get_color (palette, "error");
|
||||
if (lookup)
|
||||
*error_out = *lookup;
|
||||
else
|
||||
*error_out = *color_out;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
GError **error)
|
||||
@@ -97,23 +127,22 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_recolor_load (GtkCssImageRecolor *recolor,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *palette,
|
||||
int scale,
|
||||
GError **gerror)
|
||||
gtk_css_image_recolor_load (GtkCssImageRecolor *recolor,
|
||||
GtkCssStyle *style,
|
||||
GtkCssValue *palette,
|
||||
int scale,
|
||||
GError **gerror)
|
||||
{
|
||||
GError *local_error = NULL;
|
||||
GtkCssImageRecolor *image;
|
||||
|
||||
image = g_object_new (GTK_TYPE_CSS_IMAGE_RECOLOR, NULL);
|
||||
|
||||
image->file = g_object_ref (recolor->file);
|
||||
image->palette = gtk_css_value_ref (palette);
|
||||
image->color = gtk_css_value_ref (context->style->core->color);
|
||||
|
||||
lookup_symbolic_colors (style, palette, &image->color, &image->success, &image->warning, &image->error);
|
||||
gtk_css_image_recolor_load_texture (recolor, &local_error);
|
||||
|
||||
image->file = g_object_ref (recolor->file);
|
||||
|
||||
if (recolor->texture)
|
||||
image->texture = g_object_ref (recolor->texture);
|
||||
else
|
||||
@@ -143,34 +172,16 @@ gtk_css_image_recolor_snapshot (GtkCssImage *image,
|
||||
double height)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
const GdkRGBA *fg, *sc, *wc, *ec;
|
||||
const GtkCssValue *color;
|
||||
const GdkRGBA *fg = &recolor->color;
|
||||
const GdkRGBA *sc = &recolor->success;
|
||||
const GdkRGBA *wc = &recolor->warning;
|
||||
const GdkRGBA *ec = &recolor->error;
|
||||
graphene_matrix_t matrix;
|
||||
graphene_vec4_t offset;
|
||||
|
||||
if (recolor->texture == NULL)
|
||||
return;
|
||||
|
||||
fg = gtk_css_color_value_get_rgba (recolor->color);
|
||||
|
||||
color = gtk_css_palette_value_get_color (recolor->palette, "success");
|
||||
if (color)
|
||||
sc = gtk_css_color_value_get_rgba (color);
|
||||
else
|
||||
sc = fg;
|
||||
|
||||
color = gtk_css_palette_value_get_color (recolor->palette, "warning");
|
||||
if (color)
|
||||
wc = gtk_css_color_value_get_rgba (color);
|
||||
else
|
||||
wc = fg;
|
||||
|
||||
color = gtk_css_palette_value_get_color (recolor->palette, "error");
|
||||
if (color)
|
||||
ec = gtk_css_color_value_get_rgba (color);
|
||||
else
|
||||
ec = fg;
|
||||
|
||||
graphene_matrix_init_from_float (&matrix,
|
||||
(float[16]) {
|
||||
sc->red - fg->red, sc->green - fg->green, sc->blue - fg->blue, 0,
|
||||
@@ -207,7 +218,7 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
else
|
||||
palette = gtk_css_value_ref (context->style->core->icon_palette);
|
||||
|
||||
img = gtk_css_image_recolor_load (recolor, context, palette, scale, &error);
|
||||
img = gtk_css_image_recolor_load (recolor, context->style, palette, scale, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
@@ -256,7 +267,7 @@ gtk_css_image_recolor_parse_arg (GtkCssParser *parser,
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_recolor_parse (GtkCssImage *image,
|
||||
GtkCssParser *parser)
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
if (!gtk_css_parser_has_function (parser, "-gtk-recolor"))
|
||||
{
|
||||
@@ -298,38 +309,8 @@ gtk_css_image_recolor_is_computed (GtkCssImage *image)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
|
||||
return recolor->texture && gtk_css_value_is_computed (recolor->palette);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_recolor_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
|
||||
if (!recolor->palette || !recolor->color)
|
||||
return TRUE;
|
||||
|
||||
return gtk_css_value_contains_current_color (recolor->palette) ||
|
||||
gtk_css_value_contains_current_color (recolor->color);
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_recolor_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
GtkCssImageRecolor *img;
|
||||
|
||||
img = g_object_new (GTK_TYPE_CSS_IMAGE_RECOLOR, NULL);
|
||||
|
||||
img->palette = gtk_css_value_resolve (recolor->palette, context, current_color);
|
||||
img->color = gtk_css_value_resolve (recolor->color, context, current_color);
|
||||
img->file = g_object_ref (recolor->file);
|
||||
if (recolor->texture)
|
||||
img->texture = g_object_ref (recolor->texture);
|
||||
|
||||
return GTK_CSS_IMAGE (img);
|
||||
return recolor->texture &&
|
||||
(!recolor->palette || gtk_css_value_is_computed (recolor->palette));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -345,8 +326,6 @@ _gtk_css_image_recolor_class_init (GtkCssImageRecolorClass *klass)
|
||||
image_class->parse = gtk_css_image_recolor_parse;
|
||||
image_class->print = gtk_css_image_recolor_print;
|
||||
image_class->is_computed = gtk_css_image_recolor_is_computed;
|
||||
image_class->contains_current_color = gtk_css_image_recolor_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_recolor_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_recolor_dispose;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,12 @@ struct _GtkCssImageRecolor
|
||||
GtkCssImage parent;
|
||||
|
||||
GFile *file;
|
||||
GtkCssValue *color;
|
||||
GtkCssValue *palette;
|
||||
GdkTexture *texture;
|
||||
GdkRGBA color;
|
||||
GdkRGBA success;
|
||||
GdkRGBA warning;
|
||||
GdkRGBA error;
|
||||
};
|
||||
|
||||
struct _GtkCssImageRecolorClass
|
||||
|
||||
@@ -208,46 +208,6 @@ gtk_css_image_scaled_is_computed (GtkCssImage *image)
|
||||
gtk_css_image_is_computed (self->images[0]);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_scaled_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
GtkCssImageScaled *self = GTK_CSS_IMAGE_SCALED (image);
|
||||
|
||||
for (guint i = 0; i < self->n_images; i++)
|
||||
{
|
||||
if (gtk_css_image_contains_current_color (self->images[i]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_scaled_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssImageScaled *self = GTK_CSS_IMAGE_SCALED (image);
|
||||
GtkCssImageScaled *res;
|
||||
|
||||
if (!gtk_css_image_scaled_contains_current_color (image))
|
||||
return g_object_ref (image);
|
||||
|
||||
res = g_object_new (GTK_TYPE_CSS_IMAGE_SCALED, NULL);
|
||||
|
||||
res->n_images = self->n_images;
|
||||
res->images = g_new (GtkCssImage *, self->n_images);
|
||||
res->scales = g_new (int, self->n_images);
|
||||
|
||||
for (guint i = 0; i < self->n_images; i++)
|
||||
{
|
||||
res->images[i] = gtk_css_image_resolve (self->images[i], context, current_color);
|
||||
res->scales[i] = self->scales[i];
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (res);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_css_image_scaled_class_init (GtkCssImageScaledClass *klass)
|
||||
{
|
||||
@@ -262,8 +222,6 @@ _gtk_css_image_scaled_class_init (GtkCssImageScaledClass *klass)
|
||||
image_class->compute = gtk_css_image_scaled_compute;
|
||||
image_class->print = gtk_css_image_scaled_print;
|
||||
image_class->is_computed = gtk_css_image_scaled_is_computed;
|
||||
image_class->contains_current_color = gtk_css_image_scaled_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_scaled_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_scaled_dispose;
|
||||
}
|
||||
|
||||
@@ -159,21 +159,6 @@ gtk_css_image_url_is_computed (GtkCssImage *image)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_url_resolve (GtkCssImage *image,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_url_contains_current_color (GtkCssImage *image)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gtk_css_image_url_parse (GtkCssImage *image,
|
||||
GtkCssParser *parser)
|
||||
@@ -268,8 +253,6 @@ _gtk_css_image_url_class_init (GtkCssImageUrlClass *klass)
|
||||
image_class->equal = gtk_css_image_url_equal;
|
||||
image_class->is_invalid = gtk_css_image_url_is_invalid;
|
||||
image_class->is_computed = gtk_css_image_url_is_computed;
|
||||
image_class->contains_current_color = gtk_css_image_url_contains_current_color;
|
||||
image_class->resolve = gtk_css_image_url_resolve;
|
||||
|
||||
object_class->dispose = gtk_css_image_url_dispose;
|
||||
}
|
||||
|
||||
+2
-14
@@ -56,17 +56,6 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
||||
return _gtk_css_image_value_new (computed);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_image_resolve (GtkCssValue *value,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
if (!gtk_css_value_contains_current_color (value))
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
return _gtk_css_image_value_new (gtk_css_image_resolve (_gtk_css_image_value_get_image (value), context, current_color));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_image_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -135,7 +124,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
|
||||
"GtkCssImageValue",
|
||||
gtk_css_value_image_free,
|
||||
gtk_css_value_image_compute,
|
||||
gtk_css_value_image_resolve,
|
||||
gtk_css_value_image_equal,
|
||||
gtk_css_value_image_transition,
|
||||
gtk_css_value_image_is_dynamic,
|
||||
@@ -146,7 +134,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
|
||||
GtkCssValue *
|
||||
_gtk_css_image_value_new (GtkCssImage *image)
|
||||
{
|
||||
static GtkCssValue image_none_singleton = { >K_CSS_VALUE_IMAGE, 1, 1, 0, 0, NULL };
|
||||
static GtkCssValue image_none_singleton = { >K_CSS_VALUE_IMAGE, 1, TRUE, FALSE, NULL };
|
||||
GtkCssValue *value;
|
||||
|
||||
if (image == NULL)
|
||||
@@ -155,7 +143,6 @@ _gtk_css_image_value_new (GtkCssImage *image)
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IMAGE);
|
||||
value->image = image;
|
||||
value->is_computed = gtk_css_image_is_computed (image);
|
||||
value->contains_current_color = gtk_css_image_contains_current_color (image);
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -167,3 +154,4 @@ _gtk_css_image_value_get_image (const GtkCssValue *value)
|
||||
|
||||
return value->image;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
|
||||
"GtkCssInheritValue",
|
||||
gtk_css_value_inherit_free,
|
||||
gtk_css_value_inherit_compute,
|
||||
NULL,
|
||||
gtk_css_value_inherit_equal,
|
||||
gtk_css_value_inherit_transition,
|
||||
NULL,
|
||||
|
||||
@@ -101,7 +101,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
||||
"GtkCssInitialValue",
|
||||
gtk_css_value_initial_free,
|
||||
gtk_css_value_initial_compute,
|
||||
NULL,
|
||||
gtk_css_value_initial_equal,
|
||||
gtk_css_value_initial_transition,
|
||||
NULL,
|
||||
|
||||
@@ -107,7 +107,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_LINE_HEIGHT = {
|
||||
"GtkCssLineHeightValue",
|
||||
gtk_css_value_line_height_free,
|
||||
gtk_css_value_line_height_compute,
|
||||
NULL,
|
||||
gtk_css_value_line_height_equal,
|
||||
gtk_css_value_line_height_transition,
|
||||
NULL,
|
||||
|
||||
+24
-25
@@ -605,7 +605,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
|
||||
"GtkCssNumberValue",
|
||||
gtk_css_value_number_free,
|
||||
gtk_css_value_number_compute,
|
||||
NULL,
|
||||
gtk_css_value_number_equal,
|
||||
gtk_css_value_number_transition,
|
||||
NULL,
|
||||
@@ -638,38 +637,38 @@ gtk_css_dimension_value_new (double value,
|
||||
GtkCssUnit unit)
|
||||
{
|
||||
static GtkCssValue number_singletons[] = {
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 1 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 96 }} }, /* DPI default */
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 1 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_NUMBER, 96 }} }, /* DPI default */
|
||||
};
|
||||
static GtkCssValue px_singletons[] = {
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 1 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 2 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 3 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 4 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 5 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 6 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 7 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 8 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 16 }} }, /* Icon size default */
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 32 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PX, 64 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 1 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 2 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 3 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 4 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 5 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 6 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 7 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 8 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 16 }} }, /* Icon size default */
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 32 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PX, 64 }} },
|
||||
};
|
||||
static GtkCssValue percent_singletons[] = {
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 0, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 50 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 0, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 100 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, FALSE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 50 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, FALSE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_PERCENT, 100 }} },
|
||||
};
|
||||
static GtkCssValue second_singletons[] = {
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_S, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_S, 1 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_S, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_S, 1 }} },
|
||||
};
|
||||
static GtkCssValue deg_singletons[] = {
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_DEG, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_DEG, 90 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_DEG, 180 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, 1, 0, 0, TYPE_DIMENSION, {{ GTK_CSS_DEG, 270 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_DEG, 0 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_DEG, 90 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_DEG, 180 }} },
|
||||
{ >K_CSS_VALUE_NUMBER, 1, TRUE, FALSE, TYPE_DIMENSION, {{ GTK_CSS_DEG, 270 }} },
|
||||
};
|
||||
GtkCssValue *result;
|
||||
|
||||
|
||||
@@ -134,26 +134,6 @@ gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
return result;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_palette_resolve (GtkCssValue *value,
|
||||
GtkCssComputeContext *context,
|
||||
GtkCssValue *current_color)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
if (!gtk_css_value_contains_current_color (value))
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
result = gtk_css_palette_value_new_sized (value->n_colors);
|
||||
for (guint i = 0; i < value->n_colors; i++)
|
||||
{
|
||||
result->color_names[i] = g_strdup (value->color_names[i]);
|
||||
result->color_values[i] = gtk_css_value_resolve (value->color_values[i], context, current_color);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_palette_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -263,7 +243,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_PALETTE = {
|
||||
"GtkCssPaletteValue",
|
||||
gtk_css_value_palette_free,
|
||||
gtk_css_value_palette_compute,
|
||||
gtk_css_value_palette_resolve,
|
||||
gtk_css_value_palette_equal,
|
||||
gtk_css_value_palette_transition,
|
||||
NULL,
|
||||
@@ -344,7 +323,6 @@ gtk_css_palette_value_parse (GtkCssParser *parser)
|
||||
}
|
||||
|
||||
result->is_computed = result->is_computed && gtk_css_value_is_computed (color);
|
||||
result->contains_current_color = result->contains_current_color || gtk_css_value_contains_current_color (color);
|
||||
|
||||
g_ptr_array_add (names, ident);
|
||||
g_ptr_array_add (colors, color);
|
||||
@@ -358,7 +336,7 @@ gtk_css_palette_value_parse (GtkCssParser *parser)
|
||||
return result;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
const GdkRGBA *
|
||||
gtk_css_palette_value_get_color (GtkCssValue *value,
|
||||
const char *name)
|
||||
{
|
||||
@@ -369,7 +347,7 @@ gtk_css_palette_value_get_color (GtkCssValue *value,
|
||||
for (i = 0; i < value->n_colors; i ++)
|
||||
{
|
||||
if (strcmp (value->color_names[i], name) == 0)
|
||||
return value->color_values[i];
|
||||
return gtk_css_color_value_get_rgba (value->color_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -30,7 +30,7 @@ GtkCssValue * gtk_css_palette_value_new_default (void);
|
||||
|
||||
GtkCssValue * gtk_css_palette_value_parse (GtkCssParser *parser);
|
||||
|
||||
GtkCssValue * gtk_css_palette_value_get_color (GtkCssValue *value,
|
||||
const GdkRGBA * gtk_css_palette_value_get_color (GtkCssValue *value,
|
||||
const char *color_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user