Compare commits

..

1 Commits

Author SHA1 Message Date
Ting-Wei Lan
af0478ae1e xwayland: Don't use abstract socket on non-Linux systems
Abstract socket is a Linux-only feature. On operating systems other than
Linux, we can only use the normal UNIX socket.

This patch allows mutter to run as a nested Wayland compositor under
Xorg on FreeBSD.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/954
2020-05-05 21:36:53 +08:00
1448 changed files with 107628 additions and 141208 deletions

5
.gitignore vendored
View File

@@ -52,8 +52,12 @@ src/meta-dbus-idle-monitor.[ch]
src/meta-dbus-login1.[ch]
src/meta-dbus-remote-desktop.[ch]
src/meta-dbus-screen-cast.[ch]
src/gtk-primary-selection-protocol.c
src/gtk-primary-selection-server-protocol.h
src/gtk-shell-protocol.c
src/gtk-shell-server-protocol.h
src/xdg-shell-unstable-v*-protocol.c
src/xdg-shell-unstable-v*-server-protocol.h
src/pointer-gestures-unstable-v*-protocol.c
src/pointer-gestures-unstable-v*-server-protocol.h
src/relative-pointer-unstable-v*-protocol.c
@@ -99,4 +103,3 @@ doc/reference/meta.types
.dirstamp
**/tags.*
build/
subprojects/sysprof/

View File

@@ -1,531 +1,93 @@
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/fedora.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
stages:
- review
- prepare
- code-review
- build
- test
- analyze
- docs
- deploy
variables:
FDO_UPSTREAM_REPO: GNOME/mutter
.mutter.fedora@common:
variables:
FDO_DISTRIBUTION_VERSION: 36
BASE_TAG: '2022-09-01.0'
FDO_DISTRIBUTION_PACKAGES:
asciidoc
clang
gcovr
gdm
gnome-shell
mozjs91-devel
python3-dbusmock
sassc
uncrustify
xorg-x11-server-Xvfb
mesa-dri-drivers
xorg-x11-proto-devel
qemu-system-x86-core
busybox
gi-docgen
pkgconfig(libgcrypt)
pkgconfig(colord)
pkgconfig(lcms2)
FDO_DISTRIBUTION_EXEC: |
dnf install -y 'dnf-command(builddep)' &&
dnf builddep -y mutter --setopt=install_weak_deps=False &&
dnf builddep -y gnome-shell --setopt=install_weak_deps=False &&
dnf builddep -y wayland --setopt=install_weak_deps=False &&
dnf builddep -y wayland-protocols --setopt=install_weak_deps=False &&
dnf builddep -y kernel --setopt=install_weak_deps=False &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/GNOME/gjs.git \
1.73.1 . &&
./.gitlab-ci/install-meson-project.sh \
-Dvapi=false \
-Dgtk3=false \
-Dgtk4=false \
-Dgtk_doc=false \
-Dssh_agent=false \
-Dsystemd=disabled \
https://gitlab.gnome.org/GNOME/gcr.git \
3.90.0 . &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.freedesktop.org/wayland/wayland.git \
1.21.0 . &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.freedesktop.org/wayland/wayland-protocols.git \
1.26 . &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/jadahl/catch.git \
main . 29ad36e2b1d28ac9d8b2bc44af46296cb1db5d66 &&
rpm -e --nodeps gnome-bluetooth-libs-devel \
mutter mutter-devel \
gnome-shell &&
dnf clean all &&
if [[ x"$(uname -m )" = "xx86_64" ]] ; then
meson build -Dkvm_tests=true &&
ninja -C build src/tests/kvm/bzImage &&
mkdir -p /opt/mutter &&
cp build/src/tests/kvm/bzImage /opt/mutter/bzImage &&
dnf install -y python3-pyelftools &&
git clone https://github.com/jadahl/virtme.git &&
cd virtme &&
git checkout 87bcebe63f61e2a3ccd418b0903eab90113a47ae &&
./setup.py install --prefix=/usr &&
cd .. &&
rm -rf virtme
fi
retry:
max: 2
when:
- 'always'
default:
# Cancel jobs if newer commits are pushed to the branch
interruptible: true
# Auto-retry jobs in case of infra failures
retry:
max: 1
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
.mutter.fedora@x86_64:
extends: .mutter.fedora@common
variables:
FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
.mutter.fedora@aarch64:
extends: .mutter.fedora@common
variables:
FDO_DISTRIBUTION_TAG: "aarch64-${BASE_TAG}"
tags:
- aarch64
workflow:
rules:
# Allow to switch from branch pipelines to MR pipelines seamlessly
# https://docs.gitlab.com/ee/ci/jobs/job_control.html#avoid-duplicate-pipelines
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Don't trigger a branch pipeline if there is an open MR
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: '$CI_COMMIT_BRANCH'
- if: '$CI_COMMIT_TAG'
.pipeline-guard:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/'
# Avoid catchall `when: manual` rule which might
# cause duplicate pipelines to be triggered.
# https://docs.gitlab.com/ee/ci/jobs/job_control.html#avoid-duplicate-pipelines
#
# Also make it so pipelines without MR need to be started
# manually, since their state will most likely be WIP
- if: '$CI_COMMIT_BRANCH'
when: 'manual'
check-commit-log:
extends:
- .fdo.ci-fairy
stage: review
variables:
GIT_DEPTH: "100"
script:
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml ;
else
echo "Not a merge request" ;
fi
artifacts:
expire_in: 1 week
paths:
- commit-message-junit-report.xml
reports:
junit: commit-message-junit-report.xml
rules:
- !reference [.pipeline-guard, rules]
- ./.gitlab-ci/check-commit-log.sh
only:
- merge_requests
check-merge-request:
extends:
- .fdo.ci-fairy
stage: review
variables:
GIT_STRATEGY: none
script:
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request-report.xml ;
else
echo "Not a merge request" ;
fi
artifacts:
expire_in: 1 week
paths:
- check-merge-request-report.xml
reports:
junit: check-merge-request-report.xml
rules:
- !reference [.pipeline-guard, rules]
build-fedora-container@x86_64:
extends:
- .fdo.container-build@fedora@x86_64
- .mutter.fedora@x86_64
stage: prepare
needs:
- check-commit-log
- check-merge-request
variables:
GIT_STRATEGY: none
build-fedora-container@aarch64:
extends:
- .fdo.container-build@fedora@aarch64
- .mutter.fedora@aarch64
stage: prepare
needs:
- check-commit-log
- check-merge-request
variables:
GIT_STRATEGY: none
check-code-style:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
stage: code-review
needs:
- build-fedora-container@x86_64
script:
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
git remote add target $CI_MERGE_REQUEST_PROJECT_URL.git ;
git fetch target $CI_MERGE_REQUEST_TARGET_BRANCH_NAME ;
export common_parent_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "target/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME") <(git rev-list --first-parent HEAD) | head -1) ;
python3 -u ./check-style.py --dry-run --sha $common_parent_sha ;
else
echo "Not a merge request" ;
fi
allow_failure: true
.build-mutter-base:
variables:
BASE_MESON_OPTIONS:
-Degl_device=true
-Dwayland_eglstream=true
-Dcatch=true
.build-mutter:
extends:
- .fdo.distribution-image@fedora
- .build-mutter-base
build-mutter:
stage: build
script:
- meson . build
--prefix /usr
--werror
--fatal-meson-warnings
--warnlevel 2
-Dbuildtype=debugoptimized
-Db_coverage=true
$BASE_MESON_OPTIONS
$EXTRA_MESON_OPTIONS
- meson compile -C build
- meson install -C build
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
build-mutter@x86_64:
variables:
EXTRA_MESON_OPTIONS:
-Dkvm_tests=true
-Dkvm_kernel_image=/opt/mutter/bzImage
extends:
- .build-mutter
- .mutter.fedora@x86_64
needs:
- build-fedora-container@x86_64
build-mutter@aarch64:
extends:
- .build-mutter
- .mutter.fedora@aarch64
needs:
- build-fedora-container@aarch64
build-without-opengl-and-glx@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
build-without-opengl-and-glx:
stage: build
needs:
- build-fedora-container@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
-Dopengl=false
-Dglx=false
-Degl_device=true
-Dwayland_eglstream=true
- meson compile -C build
- meson install -C build
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build/meson-logs
- build
only:
- merge_requests
- /^.*$/
build-without-native-backend-and-wayland@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
build-without-native-backend-and-wayland:
stage: build
needs:
- build-fedora-container@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
-Dnative_backend=false
-Dudev=false
-Dwayland=false
-Dcore_tests=false
-Dnative_tests=false
- meson compile -C build
- meson install -C build
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build/meson-logs
- build
only:
- merge_requests
- /^.*$/
.test-setup: &test-setup
test-mutter:
stage: test
dependencies:
- build-mutter
variables:
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
MUTTER_DEBUG_DUMMY_MODE_SPECS: "800x600@10.0"
PIPEWIRE_DEBUG: 2
PIPEWIRE_LOG: "$CI_PROJECT_DIR/build/meson-logs/pipewire.log"
XVFB_SERVER_ARGS: "+iglx -noreset"
G_SLICE: "always-malloc"
MALLOC_CHECK_: "3"
NO_AT_BRIDGE: "1"
before_script:
# Disable e.g. audio support to not dead lock screen cast tests
MALLOC_PERTURB_: "123"
script:
- dconf update
- mkdir -m 700 $XDG_RUNTIME_DIR
- pipewire & sleep 2
.test-mutter-base:
extends:
- .fdo.distribution-image@fedora
<<: *test-setup
stage: test
after_script:
- pushd build
- gcovr --root=..
--filter='\.\./src/' --filter='\.\./clutter/' --filter='\.\./cogl/'
--exclude='\.\./build/.*\.[ch]$' --exclude='.*/tests/.*\.[ch]$'
--json --output=../coverage-${CI_JOB_NAME}.json
- popd
artifacts:
expire_in: 1 day
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- build
- coverage-*.json
.test-mutter:
extends:
- .fdo.distribution-image@fedora
- .test-mutter-base
script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh test -C build
--no-suite 'mutter/kvm'
--no-rebuild
--timeout-multiplier 10
artifacts:
reports:
junit: "build/meson-logs/testlog.junit.xml"
- >
dbus-run-session -- xvfb-run -s '+iglx -noreset'
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
only:
- merge_requests
- /^.*$/
test-mutter@x86_64:
extends:
- .test-mutter
- .mutter.fedora@x86_64
tags:
- asan
needs:
- build-mutter@x86_64
test-mutter-kvm@x86_64:
extends:
- .test-mutter-base
- .mutter.fedora@x86_64
tags:
- kvm
script:
meson test -C build
--no-rebuild
--timeout-multiplier 10
--setup plain
--suite 'mutter/kvm'
needs:
- build-mutter@x86_64
artifacts:
reports:
junit: "build/meson-logs/testlog-plain.junit.xml"
test-mutter@aarch64:
extends:
- .test-mutter
- .mutter.fedora@aarch64
tags:
- asan-aarch64
needs:
- build-mutter@aarch64
coverage:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
stage: analyze
script:
- mkdir coveragereport
- gcovr --add-tracefile 'coverage-*.json'
--html-details --print-summary --output coveragereport/index.html
artifacts:
paths:
- coveragereport
coverage: '/^lines: (\d+\.\d+\%)/'
needs:
- test-mutter@x86_64
- test-mutter@aarch64
- test-mutter-kvm@x86_64
can-build-gnome-shell@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
can-build-gnome-shell:
stage: test
needs:
- build-mutter@x86_64
dependencies:
- build-mutter
before_script:
- meson install --no-rebuild -C build
script:
- .gitlab-ci/checkout-gnome-shell.sh
- meson gnome-shell gnome-shell/build --prefix /usr -Dman=false
- meson install -C gnome-shell/build
test-mutter-coverity:
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" && $MUTTER_SCHEDULED_JOB == "coverity"'
when: always
- if: '$CI_COMMIT_BRANCH'
when: 'manual'
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
needs:
- build-fedora-container@x86_64
stage: analyze
allow_failure: true
script:
- .gitlab-ci/download-coverity-tarball.sh
- CC=clang meson coverity-build -Dprofiler=false
- ./coverity/cov-analysis-linux64-*/bin/cov-build --dir cov-int meson compile -C coverity-build
- tar czf cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=mutter
--form token=$COVERITY_TOKEN --form email=carlosg@gnome.org
--form file=@cov-int.tar.gz --form version="`git describe --tags`"
--form description="GitLab CI build"
cache:
key: coverity-tarball
paths:
- coverity
dist-mutter:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
- .build-mutter-base
<<: *test-setup
stage: deploy
needs:
- build-fedora-container@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh dist -C build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- "**/meson.build"
- meson/*
dist-mutter-tarball:
extends: dist-mutter
artifacts:
expose_as: 'Get tarball here'
paths:
- build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz
rules:
- if: '$CI_COMMIT_TAG'
reference:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora@x86_64
stage: docs
needs:
- job: build-fedora-container@x86_64
artifacts: false
script:
- meson . build --werror -Ddocs=true -Dtests=false
- ninja -C build
- mkdir references
- mv build/doc/reference/{cally/cally,clutter/clutter,cogl/cogl,cogl-pango/cogl-pango,meta/meta} references/
artifacts:
expire_in: 1 week
paths:
- references
pages:
stage: deploy
needs: ['reference']
script:
- mv references public/
artifacts:
paths:
- public
rules:
- if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "GNOME")
- ninja -C gnome-shell/build install
only:
- merge_requests
- /^.*$/

27
.gitlab-ci/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v4 .
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v4
#
FROM fedora:32
RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y jadahl/mutter-ci && \
dnf builddep -y mutter --setopt=install_weak_deps=False && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center \
--setopt=install_weak_deps=False && \
# GNOME Shell
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
dnf remove -y gnome-bluetooth-libs-devel && \
dnf remove -y --noautoremove mutter mutter-devel && \
dnf clean all

60
.gitlab-ci/check-commit-log.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
echo Cannot review non-merge request
exit 1
fi
git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
branch_point=$(git merge-base HEAD FETCH_HEAD)
commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
if [ -z "$commits" ]; then
echo Commit range empty
exit 1
fi
function commit_message_has_url() {
commit=$1
commit_message=$(git show -s --format='format:%b' $commit)
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
return $?
}
function commit_message_subject_is_compliant() {
commit=$1
commit_message_subject=$(git show -s --format='format:%s' $commit)
if echo "$commit_message_subject" | grep -qe "\(^meta-\|^Meta\)"; then
echo " - message subject should not be prefixed with 'meta-' or 'Meta'"
return 1
fi
if echo "$commit_message_subject" | grep -qe "\.[ch]:"; then
echo " - message subject prefix should not include .c, .h, etc."
return 1
fi
return 0
}
RET=0
for commit in $commits; do
commit_short=$(echo $commit | cut -c -8)
if ! commit_message_has_url $commit; then
echo "Commit $commit_short needs a merge request or issue URL"
exit 1
fi
errors=$(commit_message_subject_is_compliant $commit)
if [ $? != 0 ]; then
echo "Commit message for $commit_short is not compliant:"
echo "$errors"
RET=1
fi
done
exit $RET

View File

@@ -1,19 +1,11 @@
#!/usr/bin/bash
fetch() {
local remote=$1
local ref=$2
git fetch --quiet --depth=1 $remote $ref 2>/dev/null
}
gnome_shell_target=
echo -n Cloning into gnome-shell ...
if git clone --quiet --depth=1 https://gitlab.gnome.org/GNOME/gnome-shell.git; then
echo \ done
else
echo \ failed
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
if [ $? -ne 0 ]; then
echo Checkout failed
exit 1
fi
@@ -23,33 +15,19 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell}
merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
echo -n Looking for $merge_request_branch on remote ...
if fetch $merge_request_remote $merge_request_branch; then
echo \ found
echo Looking for $merge_request_branch on remote ...
if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
gnome_shell_target=FETCH_HEAD
else
echo \ not found
echo -n Looking for $CI_MERGE_REQUEST_TARGET_BRANCH_NAME instead ...
if fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME; then
echo \ found
gnome_shell_target=FETCH_HEAD
else
echo \ not found
fi
fi
fi
if [ -z "$gnome_shell_target" ]; then
echo -n Looking for $CI_COMMIT_REF_NAME on remote ...
if fetch origin $CI_COMMIT_REF_NAME; then
echo \ found
gnome_shell_target=FETCH_HEAD
else
echo \ not found
gnome_shell_target=HEAD
gnome_shell_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
echo Using $gnome_shell_target instead
fi
fi
if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead
fi
git checkout -q $gnome_shell_target

View File

@@ -1,19 +0,0 @@
patterns:
deny:
- regex: '^$CI_MERGE_REQUEST_PROJECT_URL/(-/)?merge_requests/$CI_MERGE_REQUEST_IID$'
message: Commit message must not contain a link to its own merge request
- regex: '^(meta-|Meta)'
message: Commit message subject should not be prefixed with 'meta-' or 'Meta'
where: subject
- regex: '^(clutter-|Clutter)'
message: Commit message subject should not be prefixed with 'clutter-' or 'Clutter', use 'clutter/' instead
where: subject
- regex: '^(cogl-|Cogl)'
message: Commit message subject should not be prefixed with 'cogl-' or 'Cogl', use 'cogl/' instead
where: subject
- regex: '^[^:]+: [a-z]'
message: "Commit message subject should be properly Capitalized. E.g. 'window: Marginalize extradicity'"
where: subject
- regex: '^\S*\.[ch]:'
message: Commit message subject prefix should not include .c, .h, etc.
where: subject

View File

@@ -1,38 +0,0 @@
#!/usr/bin/bash
# We need a coverity token to fetch the tarball
if [ -x $COVERITY_TOKEN ]
then
echo "No coverity token. Run this job from a protected branch."
exit -1
fi
mkdir -p coverity
# Download and check MD5 first
curl https://scan.coverity.com/download/linux64 \
--data "token=$COVERITY_TOKEN&project=mutter&md5=1" \
--output /tmp/coverity_tool.md5
diff /tmp/coverity_tool.md5 coverity/coverity_tool.md5 >/dev/null 2>&1
if [ $? -eq 0 -a -d coverity/cov-analysis* ]
then
echo "Coverity tarball is up-to-date"
exit 0
fi
# Download and extract coverity tarball
curl https://scan.coverity.com/download/linux64 \
--data "token=$COVERITY_TOKEN&project=mutter" \
--output /tmp/coverity_tool.tgz
rm -rf ./coverity/cov-analysis*
tar zxf /tmp/coverity_tool.tgz -C coverity/
if [ $? -eq 0 ]
then
mv /tmp/coverity_tool.md5 coverity/
fi
rm /tmp/coverity_tool.tgz

View File

@@ -1,39 +0,0 @@
#!/bin/bash
set -e
if [[ $# -lt 3 ]]; then
echo Usage: $0 [options] [repo-url] [commit] [subdir]
echo Options:
echo -Dkey=val
exit 1
fi
MESON_OPTIONS=()
while [[ $1 =~ ^-D ]]; do
MESON_OPTIONS+=( "$1" )
shift
done
REPO_URL="$1"
TAG_OR_BRANCH="$2"
SUBDIR="$3"
COMMIT="$4"
REPO_DIR="$(basename ${REPO_URL%.git})"
git clone --depth 1 "$REPO_URL" -b "$TAG_OR_BRANCH"
pushd "$REPO_DIR"
pushd "$SUBDIR"
if [ ! -z "$COMMIT" ]; then
git fetch origin "$COMMIT"
git checkout "$COMMIT"
fi
meson --prefix=/usr _build "${MESON_OPTIONS[@]}"
meson install -C _build
popd
popd
rm -rf "$REPO_DIR"

View File

@@ -1,8 +0,0 @@
#!/usr/bin/bash
set -e
wireplumber &
sleep 1
meson "$@"

View File

@@ -1,286 +0,0 @@
# Style
The coding style used is primarily the GNU flavor of the [GNOME coding
style][gnome-coding-style], with some additions described below.
## General
* Use this code style on new code. When changing old code with a different
code style, feel free to also adjust it to use this code style.
* Use regular C types and `stdint.h` types instead of GLib fundamental
types, except for `gboolean`, and `guint`/`gulong` for GSource IDs and
signal handler IDs. That means e.g. `uint64_t` instead of `guint64`, `int`
instead of `gint`, `unsigned int` instead of `guint` if unsignedness
is of importance, `uint8_t` instead of `guchar`, and so on.
* Try to to limit line length to 80 characters, although it's not a
strict limit.
* Usage of `g_autofree` and `g_autoptr` is encouraged. The style to use is
```c
g_autofree char *text = NULL;
g_autoptr (MetaSomeThing) thing = NULL;
text = g_strdup_printf ("The text: %d", a_number);
thing = g_object_new (META_TYPE_SOME_THING,
"text", text,
NULL);
thinger_use_thing (rocket, thing);
```
* Declare variables at the top of the block they are used, but avoid
non-trivial logic among variable declarations. Non-trivial logic can be
getting a pointer that may be `NULL`, any kind of math, or anything
that may have side effects.
* Instead of boolean arguments in functions, prefer enums or flags when
they're more expressive. The naming convention for flags is
```c
typedef _MetaSomeThingFlags
{
META_SOME_THING_FLAG_NONE = 0,
META_SOME_THING_FLAG_ALTER_REALITY = 1 << 0,
META_SOME_THING_FLAG_MANIPULATE_PERCEPTION = 1 << 1,
} MetaSomeThingFlags;
```
* Use `g_new0 ()` etc. instead of `g_slice_new0 ()`.
* Initialize and assign floating point variables (i.e. `float` or
`double`) using the form `floating_point = 3.14159` or `ratio = 2.0`.
## Header (.h) files
* The return type and `*` are separated by a space.
* Function name starts one space after the last `*`.
* Parenthesis comes one space after the function name.
As an example, this is how functions in a header file should look like:
```c
gboolean meta_udev_is_drm_device (MetaUdev *udev,
GUdevDevice *device);
GList * meta_udev_list_drm_devices (MetaUdev *udev,
GError **error);
MetaUdev * meta_udev_new (MetaBackendNative *backend_native);
```
## Source code
Keep functions in the following order in source files:
1. GPL header
2. Enums
3. Structures
4. Function prototypes
5. `G_DEFINE_TYPE()`
6. Static variables
7. Auxiliary functions
8. Callbacks
9. Interface implementations
10. Parent vfunc overrides
11. class_init and init
12. Public API
### Structures
Each structure field has a space after their type name. Structure fields aren't
aligned. For example:
```c
struct _MetaFooBar
{
MetaFoo parent;
MetaBar *bar;
MetaSomething *something;
};
```
### Function Prototypes
Function prototypes must be formatted just like in header files.
### Overrides
When overriding parent class vfuncs, or implementing an interface, vfunc
overrides should be named as a composition of the current class prefix,
followed by the vfunc name. For example:
```c
static void
meta_bar_spawn_unicorn (MetaParent *parent)
{
/* ... */
}
static void
meta_bar_dispose (GObject *object)
{
/* ... */
}
static void
meta_bar_finalize (GObject *object)
{
/* ... */
}
static void
meta_bar_class_init (MetaBarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaParentClass *parent_class = META_PARENT_CLASS (klass);
object_class->dispose = meta_bar_dispose;
object_class->finalize = meta_bar_finalize;
parent_class->spawn_unicorn = meta_bar_spawn_unicorn;
}
```
### Interface Implementations
When implementing interfaces, two groups of functions are involved: the init
function, and the overrides.
The interface init function is named after the interface type in snake case,
followed by the `_iface_init` suffix. For example:
```c
static void meta_foo_iface_init (MetaFooInterface *foo_iface);
G_DEFINE_TYPE_WITH_CODE (MetaBar, meta_bar, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (META_TYPE_FOO,
meta_foo_iface_init));
```
Then, when implementing each vfunc of the interface, follow the same pattern
of the [Overrides](###Overrides) section. Here's an example:
```c
static void
meta_bar_do_something (MetaFoo *foo)
{
/* ... */
}
static void
meta_foo_iface_init (MetaFooInterface *foo_iface)
{
foo_iface->do_something = meta_bar_do_something;
}
```
### Auxiliary Functions
Auxiliary functions are above every other functions to minimize the number of
function prototypes in the file. These functions often grow when factoring out
the same code between two or more functions:
```c
static void
do_something_on_data (Foo *data,
Bar *bar)
{
/* ... */
}
static void
random_function (Foo *foo)
{
do_something_on_data (foo, bar);
}
static void
another_random_function (Foo *foo)
{
do_something_on_data (foo, bar);
}
```
Sometimes, however, auxiliary functions are created to break down otherwise
large functions - in this case, it is appropriate to keep these auxiliary
functions close to the function they are tightly related to.
Auxiliary function names must have a verb in the imperative form, and should
always perform an action over something. They usually don't have the class
prefix (`meta_`, `clutter_`, or `cogl_`). For example:
```c
static void
do_something_on_data (Foo *data,
Bar *bar)
{
/* ... */
}
```
Exceptionally, when converting between types, auxiliary function names may
have the class prefix to this rule. For example:
```c
static MetaFoo *
meta_foo_from_bar (Bar *bar)
{
/* ... */
}
```
### Callback Functions
Callback function names should have the name of the action in imperative
form. They don't have any prefix, but have a `_func` suffix. For example:
```c
static void
filter_something_func (Foo *foo,
Bar *bar,
gpointer user_data)
{
/* ... */
}
```
### Signal Callbacks
Signal callbacks generally have the signal name. They should be prefixed with
`on_`, or suffixed with `_cb`, but not both. For example:
```c
static void
on_realize (ClutterActor *actor,
gpointer user_data)
{
/* ... */
}
static void
destroy_cb (ClutterActor *actor,
gpointer user_data)
{
/* ... */
}
```
When the callback is named after the object that generated it, and the signal,
then passive voice is used. For example:
```c
static void
click_action_clicked_cb (ClutterClickAction *click_action,
ClutterActor *actor,
gpointer user_data)
{
/* ... */
}
```
[gnome-coding-style]: https://developer.gnome.org/documentation/guidelines/programming/coding-style.html

850
NEWS
View File

@@ -1,827 +1,3 @@
43.0
====
* Fix stuttering in Xorg session [Daniel; !2625]
* Make MetaBarrier type derivable again [Jonas; !2626]
* Fixes crash [Jonas; !2622]
Contributors:
Daniel van Vugt, Jonas Ådahl
Translators:
Aleksandr Melman [ru], Fran Dieguez [gl], Daniel Mustieles [es],
Aurimas Černius [lt], Matej Urbančič [sl], Leônidas Araújo [pt_BR],
Kukuh Syafaat [id], Sveinn í Felli [is], Zurab Kargareteli [ka],
Rūdolfs Mazurs [lv], Yosef Or Boczko [he], Alexander Shopov [bg],
Alan Mortensen [da]
43.rc
=====
* Remember monitor scale when switching configurations [Jonas Å.; !2479]
* Embed wayland output name into screencast streams [Salman; !2540]
* Limit precision of stored refresh rates [Daniel; !2465, !2602]
* Add support for the "max bpc" connector property [Daniel; !2412]
* Fix focus-tracking corner case [Jonas D.; !2329]
* Add detail to ::event signal [Jonas D.; !2431]
* Improve heuristics for adding fallback monitor modes [Mario; !2586]
* Take over color management from gnome-settings-daemon
[Jonas Å.; !2141, !2164, !2165, !2166, !2568]
* Allow scanout for offscreen rotated views [Robert; !2468]
* Fix hot corner regression on X11 [Jonas Å.; !2604]
* Fix losing IM focus in some circumstances [Carlos; !2585]
* Avoid swapping redundant portions of buffers onscreen [Erico; !2241]
* Animate windows moving between monitors [Alessandro; !2558]
* Make NVIDIA + gbm use atomic mode setting [Jonas Å.; !2578]
* Fixed crashes [Jonas Å., Steev, Carlos, Simon; !2554, !2577, !2592, !2182,
!2609, !2612]
* Plugged memory leak [Alessandro; !2608]
* Misc. bug fixes and cleanups [Florian, Carlos, Jordan, Simon, Jonas Å.,
Jonas D., Daniel, Sebastian K., Alberts, Bilal, Dor, Sebastian W.; !2566,
!2573, !2576, !2534, !2581, !2430, !2561, !2584, !2588, !2551, !2552, !2594,
!2596, !2598, !2601, !2603, !2589, !2587, !2375, !2486, !2606, !1354, !2605,
!2611]
Contributors:
Dor Askayo, Alessandro Bono, Jonas Dreßler, Bilal Elmoussaoui,
Carlos Garnacho, Sebastian Keller, Steev Klimaszewski, Mario Limonciello,
Robert Mader, Salman Malik, Simon McVittie, Alberts Muktupāvels,
Florian Müllner, Erico Nunes, Jordan Petridis, Daniel van Vugt,
Sebastian Wick, Jonas Ådahl
Translators:
Nart Tlisha [ab], Jiri Grönroos [fi], Goran Vidović [hr],
Yuri Chornoivan [uk], Jordi Mas [ca], Marek Černocký [cs], Balázs Úr [hu],
Emin Tufan Çetin [tr], Danial Behzadi [fa], Piotr Drąg [pl],
Rūdolfs Mazurs [lv], Hugo Carvalho [pt], Anders Jonsson [sv],
Boyuan Yang [zh_CN], Asier Sarasua Garmendia [eu]
43.beta
=======
* Fix glitches in apps using subsurfaces [Robert; !2501, !2530]
* Reduce client work when entering overview [Robert; !2502]
* Support direct scanout on GPUs without modifiers support [Dor; !2510]
* screencast: Set correct stride when using dmabufs [Pascal; !2513]
* High-resolution scroll wheel support [José, Carlos; !1962]
* screencast: Use flag to signal failed recording [columbarius; !2516]
* Fix cursor visibility on X11 with only tablets as input [Carlos; !2518]
* Notify about privacy screen changes via predictions [Jonas Å.; !2340, !2531]
* Highlight actors becoming reactive under the pointer [Carlos; !2532]
* Replace MetaTextureTower with native GL mipmapping [Daniel, Neil; !2506]
* Add tool to pretty print display configuration [Jonas Å., Marco; !2448]
* Remove mipmap framerate limiting [Daniel; !2538]
* Fall back to ARGB if XRGB is not supported [Daniel; !2519]
* Add basic color-scheme support for server-side decorations [Florian; !2541]
* Don't skip frames after skipped KMS updates [Michel; !2498]
* Add support for multi-monitor direct scanout [Dor; !2526]
* Continue gi-docgen migration [Bilal; !2441]
* Always send modifiers to clients if supported [Jonas Å.; !2546]
* Defer and accumulate redraw-clip on scanout [Robert; !2480]
* Add single pixel buffer support [Robert, Jonas Å.; !2246]
* Report actual monitor transform [Robert; !344]
* Better integrate cogl tests with existing infrastructure [Jonas Å.; !2555]
* Fix registering as X11 window manager if GDK_BACKEND is set [Michel; !2496]
* Don't skip vblank sync on missing presentation timestamp [Dor; !2481]
* Fix cursor showing on Xilinx [Daniel; !2520]
* Plugged leaks [Michel, Daniel; !2527, !2562]
* Fixed crashes [Robert, Jonas Å.; !2459, !2553]
* Misc. bug fixes and cleanups [columbarius, Daniel, Carlos, Michel, Jonas Å.,
Florian, Jonas D., Julia, Corentin; !2323, !2074, !2517, !2525, !2524, !2442,
!2523, !2535, !2348, !2537, !2456, !2542, !2547, !2556, !2559, !2564, !2511]
Contributors:
Marco Trevisan (Treviño), Dor Askayo, Jonas Dreßler, Michel Dänzer,
Bilal Elmoussaoui, José Expósito, Carlos Garnacho, Julia Johannesen,
Robert Mader, Neil Moore, Florian Müllner, Pascal Nowack, Corentin Noël,
Nart Tlisha, Daniel van Vugt, columbarius, Jonas Ådahl
Translators:
Nart Tlisha [ab]
43.alpha
========
* Drop zenity dependency [Bilal; !2370]
* Fix initialization of privacy mode in displays that support it [Marco; !2372]
* Add NightLightSupported property to DisplayConfig [Jonas; !2310]
* Don't use direct scanout for transparent windows [Sebastian K.; !2409]
* Improve picking a window for direct scanout [Sebastian K.; !2413]
* Drop support for obsolete wayland protocols [Fernando; !2207, !2184]
* Fix --replace again [Jonas; !2432]
* Do not allow windows to steal focus when the shell has a grab [Carlos; !2433]
* Fix night light without GAMM_LUT property [Jonas; !2435]
* Expose Cogl's Snippet API to introspection [Simon; !2422]
* wayland: Fix rotation transform [Robert; !1055]
* Build and deploy API documentation [Bilal; !2427]
* Attach color state information to actors [Naveen; !2443]
* Fix pointer confinement on HiDPI setups [Jonas; !2460]
* Fix dma-bufu screencast regression [Jonas; !2462]
* Fix monitor mirroring in some cases [Jonas; !2492]
* Parse HDR and Colorimetry CTA-861 EDID extension blocks [Sebastian W.; !2351]
* Fix cursor tracking during screencasts on X11 [George; !2474]
* Fixed crashes [Jonas, Florian; !2415, !2364, !2491]
* Plugged leaks [Michel, Sebastian K.; !2469, !2497]
* Misc. bug fixes and cleanups [Kazuki, Dor, Jonas, Bilal, Sebastian K.,
Christian, Florian, Georges,, Sebastian W., Olivier; !2405, !2406, !2403,
!2416, !2398, !2414, !2425, !2354, !2436, !2447, !2446, !2355, !2429, !2417,
!2434, !2439, !2015, !2444, !2458, !2379, !2455, !2463, !2484, !2485, !2488,
!2499]
Contributors:
Marco Trevisan (Treviño), Dor Askayo, George Barrett, Michel Dänzer,
Bilal Elmoussaoui, Olivier Fourdan, Carlos Garnacho, Kazuki Hashimoto,
Sebastian Keller, Naveen Kumar, Robert Mader, Fernando Monteiro,
Florian Müllner, Georges Basile Stavracas Neto, Christian Rauch,
Simon Schneegans, Sebastian Wick, Jonas Ådahl
Translators:
Zurab Kargareteli [ka], Pawan Chitrakar [ne]
42.1
====
* Send correct LEAVE events when entering windows [Jonas D.; !2321]
* Be more forgiving with wrongly sized clients [Robert; !2335]
* Add ClutterInputCapabilities enum and device property [Carlos; !2331]
* Fall back if COPY_MODE_SECONDARY_GPU fails to init [Daniel; !2341]
* Fix missing root window properties after XWayland start [Olivier; !2336]
* wayland/shm: Add support for ABGR8888 and XBGR8888 formats [Jonas Å.; !2352]
* Keep actors dirty if a redraw was queued up during paint() [Carlos; !2353]
* Fix overview painting of shaped texture with layer snippets [Jonas Å.; !2278]
* Survive missing GAMMA_LUT KMS property [Daniel; !2360]
* Record current event when going through event filters [Jonas D.; !2327]
* Pass events to pointer a11y before going through filters [Jonas D.; !2332]
* Update cursor when scaled or transformed [Sebastian W.; !2363]
* Fix screen cast when DMA buffer fails or can't be used [Jonas Å.; !2383]
* Repick when pointer actor goes unmapped [Jonas D.; !2333]
* Improve IM support [Carlos; !2365, !2384]
* Allow using dumb buffers for cursor sprites [Jonas Å.; !2275]
* wayland/dma-buf: Only advertise supported formats [Robert; !2386]
* Fix screen cast cursor metadata with unthrottled input [Jonas Å.; !2393]
* Fixed crashes [Olivier Daniel, Łukasz, Jonas D.; !2339, !2359, !2347, !2299]
* Plugged memory leak [Sebastian K.; !2345]
* Misc. bug fixes and cleanups [Christian, Jonas Å., Bartłomiej, Carlos, Daniel,
Sebastian W., Corentin, Jonas D., Sebastian K.; !2316, !2152, !2334, !2349,
!2325, !2357, !2362, !2373, !2374, !2361, !2366, !2350, !2377, !2382, !2391,
!2395, !2387, !2400, !2397, !2378]
Contributors:
Jonas Dreßler, Bilal Elmoussaoui, Olivier Fourdan, Carlos Garnacho,
Christian Hergert, Sebastian Keller, Robert Mader, Florian Müllner,
Corentin Noël, Bartłomiej Piotrowski, Łukasz Spintzyk, Daniel van Vugt,
Sebastian Wick, Jonas Ådahl
Translators:
Balázs Úr [hu], Charles Monzat [fr], Milo Casagrande [it], Марко Костић [sr],
Nathan Follens [nl], Jordi Mas [ca], Ngọc Quân Trần [vi]
42.0
====
Translators:
Fabio Tomat [fur], Alexander Shopov [bg]
42.rc
=====
* Fix X11 → wayland drops ending up in the wrong wayland client [Olivier; !2305]
* Make xdg-activation interoperate with other startup sequences [Carlos; !2314]
* Fix stuck grab feedback actor during compositor grabs [Jonas D.; !2308]
* Make gnome-desktop dependency optional [Bilal; !2317]
* Provide better profiling information [Ivan; !1928]
* Drop ClutterEvent "source" field [Carlos; !2311]
* Add support for xdg_toplevel.configure_bounds() [Jonas Å.; !2167]
* Add support for wl_surface.offset [Jonas Å.; !1905]
* Fix resizing of virtual monitors [Jonas Å.; !2270]
* Include size in configure events of maximized clients [Sebastian K.; !2238]
* Only allow direct scanouts for surfaces that aren't cropped, scaled or rotated
[Robert; !2276]
* Fix pipewire screencasts [Ivan; !2322]
* Plugged memory leak [Robert; !2297]
* Fixed crash [Jonas; !2318]
* Misc. bug fixes and cleanups [Bilal, Jonas Å., Florian, Dor, Alfonso,
Sebastian W., Carlos, Jonas D.; !2306, !2300, !2301, !2303, !2307, !2315,
!2319, !2298, !2320, !2324]
Contributors:
Dor Askayo, Jonas Dreßler, Bilal Elmoussaoui, Olivier Fourdan,
Carlos Garnacho, Sebastian Keller, Robert Mader, Ivan Molodetskikh,
Florian Müllner, Alfonso Sánchez-Beato, Sebastian Wick, Jonas Ådahl
Translators:
Emin Tufan Çetin [tr], Yosef Or Boczko [he], Quentin PAGÈS [oc],
Christian Kirbach [de], Aurimas Černius [lt], Danial Behzadi [fa],
Daniel Mustieles [es], Alan Mortensen [da], Goran Vidović [hr],
Tim Sabsch [de], Anders Jonsson [sv], Gwan-gyeong Mun [ko],
Daniel Șerbănescu [ro], Piotr Drąg [pl]
42.beta
=======
* Implement a new Clutter grab API [Carlos; !2068, !2099, !2100]
* Support KMS testing via QEMU [Jonas Å.; !2151]
* Generate API references with gi-docgen [Andy; !2248]
* Improve support for running from toolbx [Sebastian; !2254, !2261]
* Add support for privacy screen [Marco; !1952]
* Allow changing monitor configuration policy [Jonas Å.; !2030]
* Add support for XFixes ClientDisconnectMode [Olivier; !1794]
* Fix possible missed clicks on menus [Carlos; !2257]
* Place popups on the same monitor as the anchor rect [Jonas Å.; !2252]
* Announce DMA-BUF support via pipewire [columbarius; !1939]
* Raise the file descriptor limit of the wayland compositor [Olivier; !2235]
* Fix resetting idle time on lid open [Carlos; !2272]
* Don't limit DMA buffer screen casting only to Intel [Jonas Å.; !2086]
* Keep a single cursor sprite visible with tablets [Carlos; !285]
* Sync keyboard LEDs after layout changes [Konstantin; !2279]
* Honor window input area in picking [Carlos; !2283]
* Handle mixture of keycombo/no action in pad rings/strips [Carlos; !2001]
* Fixed crashes [Carlos, Jonas Å., Daniel; !2237, !2280, !2282, !2251]
* Misc. bug fixes and cleanups [Björn, Jonas Å., Daniel, Michel, Robert,
Pascal, Florian, Olivier, Pabel, Carlos, Jonas D.; !2236, !2014, !2240,
!2230, !2232, !2255, !2245, !2242, !2159, !2253, !2258, !2263, !2266,
!2271, !2256, !2264, !2262, !2281, !2287, !2284]
Contributors:
Marco Trevisan (Treviño), Björn Daase, Jonas Dreßler, Michel Dänzer,
Olivier Fourdan, Carlos Garnacho, Pablo Correa Gómez, Andy Holmes,
Konstantin Kharlamov, Robert Mader, Florian Müllner, Pascal Nowack,
Daniel van Vugt, Sebastian Wick, columbarius, Jonas Ådahl
Translators:
Yaron Shahrabani [he], Boyuan Yang [zh_CN], Marek Černocký [cs],
Aurimas Černius [lt], Kukuh Syafaat [id], Daniel Mustieles [es],
Yuri Chornoivan [uk], Hugo Carvalho [pt], Yosef Or Boczko [he],
Fran Dieguez [gl], Matheus Barbosa [pt_BR], Aleksandr Melman [ru],
sicklylife [ja], Luming Zh [zh_CN], Matej Urbančič [sl],
Leônidas Araújo [pt_BR], Asier Sarasua Garmendia [eu],
Jordi Mas i Hernandez [ca]
42.alpha
========
* Fix monitor screencast scanouts [Michel; !1914]
* dma-buf: Use alpha-less pixel formats where appropriate [Robert; !1810]
* wayland: Allow clients to maximize windows regardless of constraints
[Christian; !1997]
* Handle hotplug events without relevant changes more effectively [Marco; !1964]
* Improve error reporting when startup fails [Jonas; !1994]
* dma-buf: Add support for ABGR and XBGR formats [Erfan; !1999]
* Fix X11 middle button emulation setting [José; !2000]
* Include server-side shadows in window screenshots [Robert; !1996]
* Don't change workspaces of unmanaged windows [Sebastian; !2003]
* Reset idletime when unplugging the power cable [Bastien; !2029]
* xwayland: Avoid unnecessary _NET_WM_STATE events [Dor; !2032]
* Fix videos in Firefox stuttering in overview [Robert; !2034]
* Don't use atomic mode setting for virtio_gpu driver [Jonas; !2040]
* Improve on-screen keyboard on X11 [Sebastian, Ray; !1955, !2039]
* Fix text glitches after size changes [Sebastian; !2006]
* Fix reporting output rotation to xwayland [Olivier; !2050]
* wayland: Accept final preference of drop destination [Robert; !2043]
* Only add paint volumes of mapped actors to stage clip [Robert; !2035]
* Fix negative paint volume offscreen effect [Sebastian; !2031]
* Introduce MetaRenderDevice [Jonas; !1854]
* Prefer GBM over EGLStream where possible [Jonas; !2051, !2052]
* Fix erratic scrolling in GTK apps [Carlos; !2059]
* Use rtkit to get realtime priority [Carlos; !2060]
* Turn experimental features into flags [Robert; !1961]
* Add support for EGL_KHR_partial_update [Erico; !2023]
* Use b/w unicode for tablet mode OSD [Carlos; !2064]
* Fix tilt direction of pen/tablet inputs [Quytelda; !2065]
* Sanitize event handling at gestures [Carlos; !2024]
* Fix mapping tablet input to correct monitor [Jason; !1934]
* Optionally run (and exit) with a command [Mark; !1982]
* Fix key repeat of on-screen keyboard for 2nd-level keysyms [Ray; !2045]
* Copy damage rectangles to secondary GPU [Piotr; !2033]
* Fix window size after returning from fullscreen [Sebastian, Jonas; !2066]
* Fix blank screen when unplugging docking station [Jonas; !2097]
* Ensure constraints after client resize [Sebastian; !2103]
* Improve anti-aliasing of background corners [Daniel; !2102]
* Fix unredirected Xwayland windows not getting updated [Michel; !2112]
* Fix DND between X11 and wayland clients [Carlos; !2124]
* Add hold gestures [José; !1830]
* Always snoop key events for a11y [Carlos; !1328]
* Improve Wacom tablet mapping [Carlos; !2107]
* Allow adding more streams to a screen cast session [Jonas; !2131]
* Do not throttle input in wayland event delivery [Carlos; !1915]
* Allow forcing EGLStream backend [Jonas; !2132]
* Check keyboard serials for activation [Carlos; !2148]
* Rebind the EGLimage when handling damage [Neil; !2062]
* Do not pass events to windows with modal transients [Florian; !2123]
* Fix mixed up refresh rates in multi-monitor setups [Robert; !2169]
* Fix orientation changes on devices with 90° [Hans, Marco; !2090]
* Allow disabling HW cursors [Olivier; !2150]
* Improve damage handling [Robert; !2168]
* Consider xrandr flags for advertised modes [Robert; !2190]
* Improve KMS fallback modes [Robert; !2189]
* window-group: Disable culling when rendinging clone to offscreen buffer
[Sebastian; !2080]
* Support DMA buffer feedback [Jonas, Robert; !2202, !1959]
* Advance timelines according to presentation time [Daniel; !2161]
* Drop deprecated wl-shell and text-input-v3 support [Fernando; !2183, !2185]
* Fix workspace switch animation in default plugin [Mark, Erik; !2076, !2120]
* Fix unfullscreening of window that were mapped fullscreen [Jonas; !2210]
* Consider wayland subsurfaces for scanout [Robert; !2211]
* Fix DMA-BUF screencasts with unredirected fullscreen windows [Georges; !2186]
* Fixed crashes [Carlos, Jonas, Daniel; !2063, !2025, !2081, !2104, !1991,
!2111, !2127, !2147, !2181, !2216]
* Plugged leaks [Sebastian, Jonas; !2193, !2192, !2225]
* Misc. bug fixes and cleanups [Daniel, Jonas, Corentin, Robert, Georges,
Sebastian, Simon, Carlos, Pascal, Fernando, Joan, José, Florian, Alexander,
Ievgen; !1992, !2007, !2008, !2026, !2044, !2057, !2002, !2028, !2049, !2061,
!1796, !2079, !2084, !2088, !2093, !2009, !2094, !2108, !2125, !2133, !2128,
!2138, !2058, !2130, !2140, !2122, !2095, !2126, !2139, !2145, !2149, !2157,
!1966, !2163, !2158, !2134, !1993, !2142, !2162, !2173, !2187, !2199, !2203,
!2204, !2205, !2146, !1812, !2214, !2215, !2188, !2206]
Contributors:
Marco Trevisan (Treviño), Erfan Abdi, Dor Askayo, Michel Dänzer,
José Expósito, Olivier Fourdan, Carlos Garnacho, Jason Gerecke, Hans de Goede,
JoseExposito, Quytelda Kahja, Sebastian Keller, Robert Mader, Mark,
Erik Massop, Simon McVittie, Alexander Mikhaylenko, Fernando Monteiro,
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Pascal Nowack,
Corentin Noël, Erico Nunes, Ievgen Popovych, Christian Rauch, Neil Roberts,
Ray Strode, Joan Torres, Daniel van Vugt, Jonas Ådahl, Piotr Łopatka
Translators:
eshagh shahidani [fa], Danial Behzadi [fa], Марко Костић [sr],
Zander Brown [en_GB], Ngọc Quân Trần [vi], Rūdolfs Mazurs [lv],
Yuri Chornoivan [uk], Fabio Tomat [fur], Hugo Carvalho [pt],
Milo Casagrande [it], Quentin PAGÈS [oc], Goran Vidović [hr],
Yaron Shahrabani [he], Daniel Mustieles [es], Aleksandr Melman [ru],
Aurimas Černius [lt], Sveinn í Felli [is], Kukuh Syafaat [id],
Asier Sarasua Garmendia [eu]
41.0
====
* Avoid race in wl_seat capabilities [Olivier; !77]
* Expose option groups/entries to introspection [Corentin; !1976]
Contributors:
Olivier Fourdan, Corentin Noël
Translators:
Daniel Șerbănescu [ro], Goran Vidović [hr], Luna Jernberg [sv],
eshagh shahidani [fa], Gwan-gyeong Mun [ko], Emin Tufan Çetin [tr],
Philipp Kiemle [de], Balázs Úr [hu], Piotr Drąg [pl], Nathan Follens [nl],
Jordi Mas [ca], Ask Hjorth Larsen [da]
41.rc
=====
* Add clutter_stage_paint_to_content() [Ivan; !1899]
* Add meta_cursor_tracker_get_scale() [Ivan; !1967]
* wayland: Make each wl_output correspond to one monitor [Jonas; !1712]
* Expose 'inactive-since' timestamp to uresourced [Nishal; !1960]
* Pass dirty rects to secondary GPU [Piotr; !1879]
* Support commiting preedit string on focus loss [Carlos; !1940]
* Improve auto-rotation support [Marco; !1233]
* Add meta_window_actor_paint_to_content() [Robert; !1893]
* Fixed crashes [Jonas, Ray, Robert; !1947, !1979, !1965, !1958]
* Misc. bug fixes and cleanups [Florian, Carlos, Robert, Daniel, Erico, Dor;
!1957, !1924, !1970, !1971, !1972, !1973, !1974, !1977, !1978, !1975, !1886,
!1983, !1990, !1980]
Contributors:
Marco Trevisan (Treviño), Dor Askayo, Carlos Garnacho, Nishal Kulkarni,
Piotr Lopatka, Robert Mader, Ivan Molodetskikh, Florian Müllner, Erico Nunes,
Ray Strode, Daniel van Vugt, Jonas Ådahl
Translators:
Asier Sarasua Garmendia [eu], Claude Paroz [fr], Jiri Grönroos [fi],
Baurzhan Muftakhidinov [kk], Aurimas Černius [lt]
41.beta
=======
* Fix mouse position in remote desktop with fractional scaling [Pascal; !1867]
* Manage idle monitors via MetaIdleManager [Jonas Å.; !1859]
* Disable KMS modifiers on radeon driver [Carlos; !1872]
* Fix fd leak [Carlos; !1870]
* Fix adding virtual monitor to physical session [Jonas Å.; !1891]
* Unbreak press-drag-release to pop up and select right click menus
[Carlos; !1885]
* Fix VKMS detection [Jonas Å.; !1892]
* Fix swipe cancellation [JoseExposito; !1857]
* Add ClutterTextureContent [Robert; !1888]
* Fix mapping tablet to monitor [Christoph; !1887]
* Fix area screencasts when window is unredirected [Michel; !1902]
* Don't require a newly attached buffer to apply state [Christian, Jonas; !1795]
* Close unused mode setting and rendering devices [Jonas Å.; !1828]
* Only support super+scroll on wayland [Florian; !1922]
* Implement the xdg-activation protocol [Carlos; !1845]
* Reduce input latency by computing max render time heuristically [Ivan; !1762]
* Apply dithering to dispatch time when needed [Daniel; !1826]
* Introduce MetaContext [Jonas Å.; !1861]
* x11: Compute monitor scale per output [Marco; !336]
* Shrink and optimize the rounded-background-clip shader [Daniel; !1860]
* remote-desktop: Handle non-responding selection owners [Pascal; !1874]
* Improve sysprof support [Jonas Å.; !1700]
* Allow clients to delegate titlebar gestures to the compositor [Florian; !1944]
* Fix upside-down Xshape surface with EGLstream [Robert; !1937]
* Fix 'kms-modifiers' experimental setting [Robert; !1953]
* Make default focus window on each workspace appear focused [Alexander; !850]
* Plugged memory leaks [Jonas Å.; !1869]
* Fixed crashes crash [Daniel, Jonas Å., Florian; !1883, !1895,
!1910, !1925, !1956]
* Misc. bug fixes and cleanups [Jonas Å., Marco, Daniel, Florian, Georges,
Zander, Carlos, Robert; !1833, !1863, !1876, !1873, !1884, !1890, !1900,
!1912, !1916, !1911, !1920, !1865, !1927, !1923, !1929, !1100, !1932, !1931,
!1862, !1933, !1930, !1935, !1936, !1878, !1938, !1942, !1951, !522, !1941]
Contributors:
Marco Trevisan (Treviño), Zander Brown, Piotr Drąg, Michel Dänzer,
Carlos Garnacho, JoseExposito, Robert Mader, Alexander Mikhaylenko,
Ivan Molodetskikh, Florian Müllner, Georges Basile Stavracas Neto,
Pascal Nowack, Christian Rauch, Christoph Trassl, Daniel van Vugt, Jonas Ådahl
Translators:
Pawan Chitrakar [ne], Charles Monzat [fr], Dušan Kazik [sk],
Quentin PAGÈS [oc], Alexey Rubtsov [ru], Alexander Shopov [bg],
Florentina Mușat [ro], Chao-Hsiung Liao [zh_TW], Yuri Chornoivan [uk],
Fran Dieguez [gl], Hugo Carvalho [pt], Rafael Fontenelle [pt_BR],
Fabio Tomat [fur], Kukuh Syafaat [id], Yaron Shahrabani [he],
Marek Černocký [cs], Matej Urbančič [sl], Boyuan Yang [zh_CN],
Daniel Mustieles [es]
40.1
====
* Prevent clients from pasting old selection data [Carlos; !1772]
* Fix forward_key IM functionality on wayland [Takao; !1802]
* Ensure valid window texture size after viewport changes [Robert; !1799]
* Only update cached paint volumes when necessary [Jonas D.; !1773, !1829]
* Only disable KMS modifiers for drivers with known problems [Jonas Å; !1792]
* Fix X11 client resize during moves [Olivier; !1777]
* Fix performance drop during night light transition with Nvidia [Aaron; !1816]
* kms: Don't add common modes that exceed the max bandwidth [Jonas Å.; !1834]
* Create virtual input devices on demand [Jonas Å; !1800, !1858]
* Fix wrong night light gamma when leaving power saving [Jonas Å.; !1835]
* Fix picking edge case [Sebastian; !1842]
* Properly tear down things when shutting down [Jonas Å.; !1822, !1856, !1853]
* Fix monitor screencasting with fractional scaling [kirbykevinson; !1855]
* Fixed crash [Carlos; !1849]
* Plugged memory leak [Carlos; !1839]
* Misc. bug fixes and cleanups [Carlos, Daniel, Jonas D., Jonas Å., Robert,
Aleksandr, Florian, Michel, Sebastian, Olivier; !1785, !1798, !1784,
!1791, !1801, !1807, !1786, !1793, !1804, !1820, !1824, !1819, !1803,
!1821, !1806, !1814, !1831, !1832, !1836, !1843, !1740, !1841, !1827,
!1844, !1852, !1850, !1851]
Contributors:
Jonas Ådahl, Michel Dänzer, Jonas Dreßler, Olivier Fourdan, Takao Fujiwara,
Carlos Garnacho, Sebastian Keller, kirbykevinson, Robert Mader,
Aleksandr Mezin, Florian Müllner, Aaron Plattner, Daniel van Vugt
Translators:
Bruce Cowan [en_GB], Ngọc Quân Trần [vi], Marek Černocký [cs],
Dz Chen [zh_CN], Yosef Or Boczko [he], Nathan Follens [nl],
Yuri Chornoivan [uk], Jordi Mas [ca], Piotr Drąg [pl], Tim Sabsch [de],
Luna Jernberg [sv], Hugo Carvalho [pt], Rafael Fontenelle [pt_BR],
Asier Sarasua Garmendia [eu], Quentin PAGÈS [oc], Matej Urbančič [sl]
40.0
====
* xwayland: Check permissions on /tmp/.X11-unix [Olivier; !1787]
Contributors:
Olivier Fourdan
Translators:
Hugo Carvalho [pt], Tim Sabsch [de], Daniel Mustieles [es],
Matej Urbančič [sl], Марко Костић [sr], Fran Dieguez [gl]
40.rc
=====
* Fix keyboard input from remote desktop in Xorg session [Pascal; !1732]
* Fix restoring focus to windows using globally active input [Olivier; !1716]
* Expose unaccalerated touchpad gesture deltas [Alexander; !1353]
* Avoid relayout on text attribute changes when possible [Jonas D.; !1750]
* Add remote desktop caps- and num-lock state properties [Jonas Å.; !1739]
* Improve refresh rate calculation [Akihiko; !1737]
* Implement presentation-time protocol [Ivan; !1484]
* Disable double-buffered shadow buffering [Jonas Å.; !1724]
* Fix missing cursor on tablet devices [Jonas D.; !1758]
* Fix frame timings causing X11 clients to get stuck [Jonas Å.; !1754]
* Fix applying input settings on X11 [Marco, Suryashankar; !1769, !1767]
* Add headless native backend [Jonas Å.; !1698]
* Fix high latency and stalls with proprietary nvidia driver [Daniel; !1726]
* Fix maximized windows not reacting to strut changes [Aleksandr; !1755]
* Only start XWayland on demand when running under systemd [Benjamin; !1771]
* Sync LEDs when a new input device is added [Olivier; !1662]
* Fix order in which subsurface placement operations are handled [Robert; !1768]
* Fixed crashes [Jonas Å., Sebastian; !1745, !1747, !1759, !1748, !1776, !1775]
* Plugged leaks [Philip, Sebastian; !1738, !1728]
* Misc. bug fixes and cleanups [Jonas Å., Jonas D., Ivan, Florian, Marco,
Robert; !1688, !1744, !1736, !1749, !1752, !1753, !427, !1757, !1751, !1760,
!1765, !1770, !1763, !1774, !1780, !1779, !1783]
Contributors:
Jonas Ådahl, Benjamin Berg, Suryashankar Das, Jonas Dreßler, Olivier Fourdan,
Sebastian Keller, Robert Mader, Aleksandr Mezin, Alexander Mikhaylenko,
Ivan Molodetskikh, Florian Müllner, Pascal Nowack, Akihiko Odaki,
Marco Trevisan (Treviño), Daniel van Vugt, Philip Withnall
Translators:
Fran Dieguez [gl], Asier Sarasua Garmendia [eu], Claude Paroz [fr],
Piotr Drąg [pl], Hugo Carvalho [pt], Jordi Mas [ca], Fabio Tomat [fur],
Yuri Chornoivan [uk], Enrico Nicoletto [pt_BR], Emin Tufan Çetin [tr],
Daniel Șerbănescu [ro], Marek Černocký [cs], Balázs Úr [hu],
Aurimas Černius [lt], Kukuh Syafaat [id], A S Alam [pa], Anders Jonsson [sv],
Milo Casagrande [it], Gwan-gyeong Mun [ko]
40.beta
=======
* Consider clients without mapped windows for xwayland auto-shutdown
[Olivier; !1671]
* Let compositor to handle super+scroll events [Florian; !1674, !1695]
* Default to starting Xwayland on demand [Olivier; !1673]
* xwayland: Restore abstract socket support [James, Olivier; !1669]
* Add support for atomic mode setting [Jonas Å.; !1488]
* Fix clip region glitches when using fractional scaling [Daniel; !1554]
* Default to horizontal workspace layout [Georges, Florian; !1684, !1706]
* Do not ping unmanaging windows [Florian; gnome-shell#2467]
* Handle monitor changes during screencasts [Jonas Å.; !1691]
* Fix unexpected jumps after restoring misbehaving clients [Jonas Å.; !1445]
* Fix newly opened X11 windows being invisible in overview [Olivier; !1678]
* Fix viewport of offscreen effects [Daniel; !1053]
* Fix drag cancel animation when using geometry scaling [Robert; !1683]
* Improve touch-mode heuristics [Carlos; !1710]
* Integrate clipboard with remote desktop sessions [Jonas Å.; !1552]
* Fix stuck icon in DND operation between X11 and wayland [Carlos; !1720]
* Automatically synchronize pointer position after modal grabs [Carlos; !1659]
* Reimplement support for CLUTTER_SHOW_FPS [Daniel; !154]
* Only pick on events that may move the pointer [Jonas D.; !1729, !1733]
* Emit discrete scroll events for accumulated smooth events in virtual
X11 devices [Pascal; !1727]
* Add support for rounded clipping when drawing background [Jonas D.; !1717]
* Plugged memory leaks [Sebastian; !1307, !1699]
* Fixed crashes [Carlos, Thomas, Jonas Å., Olivier; !1677, !1685, !1692,
!1719, !1718, !1735]
* Misc. bug fixes and cleanups [Jonas Å., Carlos, Olivier, Sebastian, Björn,
Jonas D., Ivan, Georges, Dor, Michel, Robert; !1670, !1679, !1680, !1682,
!1681, !1661, !1689, !1690, !1693, !1514, !1696, !1697, !1708, !1709, !1707,
!1701, !1702, !1715, !1725, !1734, !1512]
Contributors:
Jonas Ådahl, Dor Askayo, Björn Daase, Michel Dänzer, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, James Henstridge, Sebastian Keller,
Robert Mader, Ivan Molodetskikh, Thomas Mühlbacher, Florian Müllner,
Georges Basile Stavracas Neto, Pascal Nowack, Daniel van Vugt
Translators:
Марко Костић [sr], Jordi Mas [ca], Yuri Chornoivan [uk],
Daniel Șerbănescu [ro], Hugo Carvalho [pt], Fran Dieguez [gl],
Matej Urbančič [sl], Marek Černocký [cs], Rafael Fontenelle [pt_BR],
Philipp Kiemle [de], A S Alam [pa], Balázs Úr [hu], Anders Jonsson [sv],
Daniel Mustieles [es], Emin Tufan Çetin [tr], Kukuh Syafaat [id],
Aurimas Černius [lt]
40.alpha.1.1
============
* Adapt to settings moving to gsettings-desktop-schemas [Carlos; !1416]
* Misc. bug fixes and cleanups [Georges; !1667]
Contributors:
Carlos Garnacho, Georges Basile Stavracas Neto
40.alpha.1
==========
* Base ClutterEffects on ClutterPaintNodes [Georges; !1340, !1355]
* xwayland: Set xrandr primary output [Aleksandr; !1558]
* Add paint node based blur support [Georges; !1627, !1646]
* Disable CRTCs if there is no monitor [Kai-Heng; !1561]
* Fix updates of mipmapped animated backgrounds [Daniel; !1664]
* Allow remote desktop clients to specify scroll source [Pascal; !1636]
* Support the color transform matrix RandR property on X11 [Aaron; !1048]
* Plugged memory leaks [Jonas D.; !1632]
* Fixed crashes [Jonas Å., Olivier, Carlos; !1557, !1648, !1643, !1654, !1663]
* Misc. bug fixes and cleanups [Olivier, Niels, Carlos, Jonas Å., Florian,
Jonas D., Daniel, Georges, Michel, Sebastian, Marc-Antoine; !1621, !1622,
!1624, !1623, !1625, !1626, !1630, !1631, !1576, !1635, !1640, !1642,
!1639, !1644, !1637, !1615, !1647, !1633, !1634, !1651, !1652, !1657,
!1660, !1658, !1665, !1649, !1668, !1655]
Contributors:
Jonas Ådahl, Michel Dänzer, Jonas Dreßler, Kai-Heng Feng, Olivier Fourdan,
Carlos Garnacho, Niels De Graef, Sebastian Keller, Aleksandr Mezin,
Florian Müllner, Georges Basile Stavracas Neto, Pascal Nowack,
Marc-Antoine Perennou, Aaron Plattner, Daniel van Vugt
Translators:
Kjartan Maraas [nb], Juliano de Souza Camargo [pt], Florentina Mușat [ro],
Daniel Mustieles [es], Jordi Mas i Hernandez [ca], Fabio Tomat [fur],
Philipp Kiemle [de], Asier Sarasua Garmendia [eu], Aurimas Černius [lt],
Fran Dieguez [gl], Hugo Carvalho [pt], Matej Urbančič [sl]
40.alpha
========
* Replace CoglMatrix with graphene_matrix [Georges; !1439]
* Allow to specify debug topics in MUTTER_DEBUG [Jonas Å.; !1465]
* Fix unwanted position changes on window resize
[Jonas Å., Olivier, Robert; !1477, !1495]
* Do not disable the X Security extension by default [Olivier; !1485]
* Fix _NET_WM_FRAME_DRAWN timestamps [Jonas Å.; !1494]
* Fix tiling to the correct monitor [Florian; #1389]
* Only snap to window edges when CTRL is pressed [Florian; #679609]
* Add support for scroll button locking [Peter; !1432]
* Clip Frustra [Georges; !1489]
* Improve tablet-mode-switch support [Hans; !1506]
* Fix missed redraws of newly-mapped actors [Jonas D.; !1366, #1494]
* Gracefully handle Xwayland crashes [Carlos; !1447]
* wayland: Provide previous window dimensions on restore [Christian; !801]
* Remove the ClutterActor::paint signal [Jonas; !1522]
* Fix background artifacts in magnifier [Daniel; #1480]
* Use raycasting for picking [Georges; !1509]
* Fix monitor tiling support on X11 [Jonas Å.; #1524]
* Fix xwayland grabs for override-redirect windows [Olivier; !1254]
* Fix device configuration not being picked up on X11 [Carlos; !1553]
* Support tagging devices as primary GPU via udev [Jonas Å.; !1562]
* Fix size hints with CSD [Olivier; !1594]
* Fix unresponsive input after screen blank [Simon; !1601]
* Cull actors when picking [Georges; !1520]
* Handle input in a thread [Carlos; !1403]
* Improve freezes when switching workspace [Jonas Å.; !1616]
* Plugged memory leaks [Ray; !1225]
* Fixed crashes [Christian, Olivier, Daniel, Robert, Jonas Å., Florian Z.,
Simon, Carlos; #1481, !1529, !1519, !1534, #1521, !1563, !1604, !1605,
!1607, !1612]
* Misc. bug fixes and cleanups [Florian, Carlos, Olivier, Georges, Björn,
Jonas Å., Julius, Corentin, Bastien, Robert, Daniel, Niels, Jonas D., Uday,
Ian, Jordan, Piotr; !1473, !1472, !1438, #1449, !1475, !1474, !1481, !1466,
!1483, !1427, !1413, !1103, !1467, !1339, !1297, #1384, !1491, !528, !1496,
!1510, !1507, !1387, !1498, !1515, !1516, !1517, !1486, !1524, !1527, !1528,
!1531, !1532, !1521, !1535, #1490, !1545, !1555, !1564, !1549, !1567, !1565,
!1572, !1569, !1573, !1566, !1525, !1468, !1578, !1583, !1584, !1585, !1571,
!1327, !1586, !1590, !1588, !1050, !1596, !1592, !1587, !1599, !1577, !1511,
!1591, !1603, !1611, !1593, !1617, !1619]
Contributors:
Björn Daase, Jonas Dreßler, Piotr Drąg, Olivier Fourdan, Carlos Garnacho,
Hans de Goede, Niels De Graef, Peter Hutterer, Julius Lehmann, Robert Mader,
Simon McVittie, Florian Müllner, Georges Basile Stavracas Neto,
Bastien Nocera, Corentin Noël, Jordan Petridis, Uday Kiran Pichika,
Christian Rauch, Ian Douglas Scott, Ray Strode, Daniel van Vugt,
Florian Zwoch, Jonas Ådahl
Translators:
Juliano de Souza Camargo [pt], Ask Hjorth Larsen [da], Yuri Chornoivan [uk]
3.38.1
======
* Fix Night Light updates after DPMS [Jonas, Benjamin; #1392]
* Fix button scrolling on X11 [Peter; !1431]
* Always use correct font-dpi setting on X11 [Marco; !1444]
* Improve handling of scanout failures [Jonas; #1410]
* Fix middle/right button mixup in scroll button assignment [Peter; !1433]
* Fix resizing of attached modal dialogs on wayland [Jonas; !1446]
* Enable KMS modifiers on devices that need them [Karol; !1443]
* Fix IM handling on X11 [Carlos; #1413]
* Fix glitches in "undefined" screencast areas [Jonas; !1459]
* Fix visual glitches on background with fractional scaling [Daniel; !1464]
* Fix using correct refresh rate [Jonas; #1430]
* Misc. bug fixes and cleanups [Daniel, Carlos, Robert, Simon, Sergio; !1362,
!1448, !1452, !1273, !1454, !1429, !1460, !1458, !1463, !1462]
* Plugged memory leaks [Ray; !1449, !1451]
Contributors:
Marco Trevisan (Treviño), Benjamin Berg, Sergio Costas, Carlos Garnacho,
Karol Herbst, Peter Hutterer, Robert Mader, Simon McVittie, Ray Strode,
Daniel van Vugt, Jonas Ådahl
Translators:
Juliano de Souza Camargo [pt], Rafael Fontenelle [pt_BR],
Yosef Or Boczko [he], Jordi Mas [ca]
3.38.0
======
* screencast: Only use DMA buffers for i915 [Jonas; !1442]
* Fixed crashes [Jonas, Simon; !1430, #1414]
Contributors:
Simon McVittie, Jonas Ådahl
Translators:
Anders Jonsson [sv], Gil Forcada [ca], Balázs Meskó [hu], Tim Sabsch [de],
Milo Casagrande [it], Bruce Cowan [en_GB], Rūdolfs Mazurs [lv]
3.37.92
=======
* Fix stale cursor positions in remote desktop sessions [Georges; !1417]
* xwayland: Add a setting to disable selected X extensions [Olivier; !1405]
* Fix screencasting when using QXL [Jonas Å., Grey; !1318]
* Cull actors that don't intersect with the redraw clip [Daniel; !1359]
* Optimize painting of backgrounds when culling is unavailable [Daniel; !1363]
* Improve support for Hangul input method [Carlos; !1286]
* Support debug paint overlay for opaque regions [Robert; !1372]
* Fix launching flatpak applications when autostarting Xwayland [Carlos; !1424]
* Add support for capture scanouts in screencasts [Georges; !1421]
* Allow integrated tablet devices to cycle outputs [Carlos; !1201]
* Improve mapping input devices to the most relevant output [Carlos; !1202]
* Only enable auto-rotation in touch mode [Carlos; !1311]
* Fixed crashes [Pascal, Robert, Carlos, Benjamin, Marco; !1414, !1409, !1408,
!1415, #1395, !1392, !1371, #1345]
* Misc. bug fixes and cleanups [Björn, Jonas D., Florian; !1410, !1358, !1425]
Contributors:
Marco Trevisan (Treviño), Benjamin Berg, Grey Christoforo, Björn Daase,
Jonas Dreßler, Olivier Fourdan, Carlos Garnacho, Robert Mader,
Florian Müllner, Georges Basile Stavracas Neto, Pascal Nowack,
Daniel van Vugt, Jonas Ådahl
Translators:
Marek Černocký [cs], Aurimas Černius [lt], Asier Sarasua Garmendia [eu],
Gwan-gyeong Mun [ko], Yuri Chornoivan [uk], Boyuan Yang [zh_CN],
Kukuh Syafaat [id], Piotr Drąg [pl], Rafael Fontenelle [pt_BR],
Марко Костић [sr], Matej Urbančič [sl], Fabio Tomat [fur],
Daniel Mustieles [es], Fran Dieguez [gl], Goran Vidović [hr],
Claude Paroz [fr], Andre Klapper [or, ug, te], Emin Tufan Çetin [tr]
3.37.91
=======
* Fix initial state of display mode OSD [Jian-Hong; #1362]
* Fixed crashes [Jonas Å., Robert; !1407, !1411]
* Misc. bug fixes and cleanups [Jonas Å., Christian; !1404, !1364, #1331]
Contributors:
Jonas Ådahl, Robert Mader, Jian-Hong Pan, Christian Rauch
Translators:
Fran Dieguez [gl], Daniel Mustieles [es], Florentina Mușat [ro],
Kukuh Syafaat [id], Piotr Drąg [pl], Emin Tufan Çetin [tr], Марко Костић [sr],
Akarshan Biswas [bn_IN], Matej Urbančič [sl], Boyuan Yang [zh_CN],
Goran Vidović [hr], Rafael Fontenelle [pt_BR]
3.37.90
=======
* Fix using NEAREST filter for backgrounds on scaled monitors [Daniel V.; !1346]
* Screencast fixes and improvements [Jonas; !1361, !1377, !1391]
* Support tap-button-map and tap-drag-lock touchpad settings [Giusy; !1319]
* Fix wine copy & paste [Sebastian; !1369]
* Fix shadows of server-side decorated XWayland windows [Olivier; #1358]
* Replace some loaded terms with more descriptive ones [Olivier; !1396]
* Add API to launch trusted wayland clients [Sergio; #741]
* Skip displays with 'non-desktop' property set [Philipp; !1393]
* Invalidate offscreen effect cache on video memory purge [Daniel V.; !1374]
* Add wl_shm support for 10 bpc and 16 bpc half float formats [Jonas; !804]
* Fixed crashes [Jonas, Erik, Martin; !1365, !1375, #1343]
* Misc. bug fixes and cleanups [Daniel V., Carlos, Olivier, Christian,
Daniel * G., Jonas, Florian; !1370, !1376, !1385, !1352, !1386, !1390,
!1388, !1397, !1398, !1401]
Contributors:
Jonas Ådahl, Sergio Costas, Olivier Fourdan, Carlos Garnacho,
Christian Hergert, Sebastian Keller, Erik Kurzinger, Giusy Margarita,
Daniel García Moreno, Florian Müllner, Daniel van Vugt, Martin Whitaker,
Philipp Zabel
Translators:
Fabio Tomat [fur], Rafael Fontenelle [pt_BR], Jordi Mas [ca],
Yuri Chornoivan [uk], Alexandre Franke [fr]
3.37.3
======
* Support custom keyboard layouts in $XDG_CONFIG_HOME/xkb [Peter; !936]
* Optimize resource scale computation [Jonas D.; !1196, !1276, !1343]
* Allow animating ClutterActor's content property [Georges; !1301]
* Implement backgrounds as ClutterContent [Georges; !1302]
* Add ClutterAlignContraint:pivot-point property [Jonas D.; !737]
* Fix crash on area screenshots with fractional scaling [Sebastian; !1320]
* Do not paint textures of fully obscured windows [Robert; !1326]
* Use a more appropriate combine function on opaque areas [Daniel; !1331]
* Fix remote desktop being broken without screencast session [Olivier; #1307]
* Remove more long-deprecated Clutter APIs [Adam, Georges; !1194, !1332]
* Drive each monitor by its own frame clock [Jonas Å.; !1285]
* Fix copy/paste failures on X11 [Carlos; !1350]
* Mipmap background texture rendering [Daniel; !1347]
* Plugged memory leaks [Sebastian, Jonas D.; !1293, !1281, !1304]
* Misc. bug fixes and cleanups [Jonas Å., Jonas D., Daniel, Corentin, Carlos,
Sebastian, Michel, Robert, Florian; !1288, !1289, !1291, !1296, !1292, !1298,
!1300, !1303, !1290, !1287, !1306, !1305, !1308, !1313, !1250, !1314, !1267,
!1275, !1317, !1270, !1322, !1181, !1282, !1325, !1323, !1240, !1295, !1329,
!1333, !1334, !1336, !1341, #1312, !1345, !1349, !1356, #873, !1310, !1357]
Contributors:
Jonas Dreßler, Michel Dänzer, Olivier Fourdan, Carlos Garnacho,
Peter Hutterer, Adam Jackson, Sebastian Keller, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Corentin Noël, Daniel van Vugt, Jonas Ådahl
3.37.2
======
* Fix move-to-center keybinding with multiple monitors [Sergey; #1073]
* Fix stuck buttons when a virtual device is destroyed [Carlos; !1239]
* Use workarea when centering new windows [Akatsuki; #964]
* Limit mipmap levels when rendering background [Daniel; !1003]
* Broadcast clipboard/primary offers [Carlos; !1253]
* Support primary-selection protocol from wayland-protocols [Carlos; !1255]
* Fix monitor screen cast on X11 [Jonas Å.; !1251]
* Support a "blank" cursor type [Florian; !1244]
* Improve stage view damage tracking [Jonas Å.; !1237]
* Implement touch-mode detecation for the X11 backend [Carlos; !1278]
* Drop external keyboard detection from touch-mode heuristics [Carlos; !1277]
* Optimize actor allocations [Jonas D.; !1247]
* Fixed crashes [Daniel, Carlos, Jonas Å., Jonas D.; !1256, !1258, !1217, !1280]
* Misc. bug fixes and cleanups [Christian, Jonas D., Olivier, Ting-Wei,
Jonas Å., Marco, Corentin, Daniel, Robert, Niels, Florian, Simon; !1231,
!1228, !1238, !1229, !1192, !1236, !1171, !1134, #1126, !1234, !1230, !1210,
!1242, !1243, !1252, !1113, !1232, !1259, !1245, !1265, !1180, !1261, !788,
!1264, !1235, !1218, !1150, !1274, !1271, !1279, !1283, !1272]
Contributors:
Marco Trevisan (Treviño), Akatsuki, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Niels De Graef, Ting-Wei Lan, Robert Mader, Simon McVittie,
Florian Müllner, Corentin Noël, Christian Rauch, Daniel van Vugt,
Sergey Zigachev, Jonas Ådahl
3.37.1
======
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
@@ -1300,7 +476,7 @@ Contributors:
3.31.92
=======
* Fix flicker of apps that use multiple SHM buffers [Jonas Å.; #199]
* Don't disable page flips after temporary failures [Jonas Å.; #460]
* Don't disable page flips after temporary failues [Jonas Å.; #460]
* Improve redraw performance [Carlos; !196]
* Add cursor-mode support to window screencasting [Jonas Å.; !413]
* Add back support for system-wide monitor configurations [Jonas Å.; !253]
@@ -1712,7 +888,7 @@ Translations:
=======
* Reduce memory use of suspended instances [Jonas; #786299]
* Make supported scales determination saner [Rui; #786474]
* Fix crash on inhibit-shortcuts dialog response [Jonas; #786385]
* Fix crash on inhibit-shortcuts dialog reponse [Jonas; #786385]
* Support libinput's tag-and-drag setting [freeroot; #775755]
* Avoid overlapping keybindings with multiple layouts [Jonas; #786408]
* Fix non-transformed cursor on rotated monitors [Jonas; #786023]
@@ -2031,7 +1207,7 @@ Translations:
* Consider XDG_SESSION_TYPE when determining session type [Jouke; #759388]
* Re-add support for edge scrolling on some touchpads [Bastien; #768245]
* Support mouse and trackball acceleration profile [Jonas; #769179]
* Draw monitor content to individual framebuffer [Jonas; #768976]
* Draw monitor contentn to individual framebuffer [Jonas; #768976]
* Support virtual input devices [Jonas, Carlos; #765009]
* Set correct output scale on hotplug [Jonas; #769505]
* Misc. bug fixes and cleanups [Florian, Jonas, Thomas, Bastien, Carlos;
@@ -2856,7 +2032,7 @@ Translations:
* Ignore skip-taskbar hints on parentless dialogs [Giovanni; #673399]
* Don't save pixbuf data in user data [Tim; #706777]
* Don't queue redraws for obscured regions [Adel; #703332]
* Support the opaque region hints for wayland clients [Jasper; #707019]
* Suppor the opaque region hints for wayland clients [Jasper; #707019]
* Turn blending off when drawing entirely opaque regions [Jasper; #707019]
* Check event timestamps before reconfiguring [Giovanni; #706735]
* Merge the DBus API for display configuration in the wayland branch [Giovanni]
@@ -3341,7 +2517,7 @@ Translations:
======
* Automaximize large windows on map [Adel; #671677]
* When unmaximizing windows, make sure the unminimized size
is significantly less than the maximized size [Adel; #671677]
is signficantly less than the maximized size [Adel; #671677]
* Don't offer maximize option for windows larger than the screen
[Jasper; #643606]
* Always focus the window immediately underneath without restacking
@@ -3441,7 +2617,7 @@ Translations:
* Move from GConf to GSettings for preferences [Florian; #635378]
* Add meta_display_add_keybinding()/meta_display_remove_keybinding()
to allow creating new keybindings at runtime [Florian; #663428]
* Add support for new _NET_WM_STATE_FOCUSED atom in _NET_WM_STATE
* Add suport for new _NET_WM_STATE_FOCUSED atom in _NET_WM_STATE
to allow applications to draw unfocused windows differently
[Rui; #661427]
* Add meta_window_move_resize_frame() to allow specifying the
@@ -3553,7 +2729,7 @@ Contributors:
for easy resizing with thin borders. (New draggable_border_width GConf key
controls the total width of visible and invisible borders.)
[Jasper; #644930]
* Draw rounded window corners with antialiasing [Jasper; #628195]
* Draw rounded window corners with antialising [Jasper; #628195]
* Unredirect override-redirect fullscreen windows, such as full-screen
3D games to avoid any performance impact [Adel; #597014]
* Add :resizable and :above properties to MetaWindow. [Tim; #653858]
@@ -3646,7 +2822,7 @@ Translations:
3.0.2.1
=======
* When saving the session, use the "program name" rather than
hardcoding mutter, fixing session saving for gnome-shell [Matthias]
harcoding mutter, fixing session saving for gnome-shell [Matthias]
https://bugzilla.gnome.org/show_bug.cgi?id=648828
Contributors:
@@ -3964,7 +3140,7 @@ Bugs fixed:
634779 MetaWindowGroup: further optimize paints by using current scissor
634833 Draw the root window background
592382 improve shadow effect
628199 Add antialiasing to arc and line drawing operations
628199 Add antialising to arc and line drawing operations
633002 meta-actor-window: Use G_UNLIKELY for TFP check
634771 MetaStackTracker: Avoid queueing resync for obvious no-ops
635421 Fix crash in check_needs_shadow
@@ -4161,7 +3337,7 @@ Fixed Bugs:
- Allow a theme to turn on title ellipsization
* Performance enhancements:
- Stream raw damage updates to ClutterX11TexturePixmap
to enable partial stage updates when windows change [Robert]
to enable partial stage updates when windos change [Robert]
- Don't trap XErrors in meta_compositor_process_event [Adel]
* Add meta_prefs_override_preference_location(); this allows
a plugin like GNOME Shell to redirect preferences to a
@@ -4206,7 +3382,7 @@ Fixed Bugs:
613136 - remove over-restrictive assert from meta_prefs_get_workspace_name()
613398 - Don't trap XErrors in meta_compositor_process_event
615586 - Allow redirecting preferences to a different GConf key
615672 - can't compile mutter error: dereferencing pointer p does break
615672 - cant' compile mutter error: dereferencing pointer p does break
strict-aliasing rules
616050 - alt-tab infrastructure patches
616274 - mutter from git fails with gcc 4.5 (on new warning)
@@ -5152,7 +4328,7 @@ Arthur Taylor, Elijah Newren, Josselin Mouette, Havoc Pennington,
Benjamin Berg, and Carlo Wood for improvements in this release.
- new icon for the force-quit dialog (Jaap) [#396655]
- add configurable mouse click action abilities, and clean up lots of
- add configureable mouse click action abilities, and clean up lots of
related code (Linus) [#408899, #408902, others]
- add schemeas for middle and right click titlebar actions (Charlie)
[#408903]
@@ -5706,7 +4882,7 @@ this release.
running with --disable-gconf. Make --disable-gconf actually work.
(Elijah) [#326661]
- fix some reading-from-free'd-data errors (Søren) [#327575]
- fix an uninitialized value problem when in raise-on-click mode
- fix an unitialized value problem when in raise-on-click mode
(Søren) [#327572]
- avoid flashing original-sized window when closing a maximized
window (Elijah) [#317254]

View File

@@ -14,7 +14,7 @@ window compositing, focus tracking, workspace management, keybindings and
monitor configuration.
Internally it uses a fork of Cogl, a hardware acceleration abstraction library
used to simplify usage of OpenGL pipelines, as well as a fork of Clutter, a
used to simplify usage of OpenGL pipelines, as well as a fork af Clutter, a
scene graph and user interface toolkit.
Mutter is used by, for example, GNOME Shell, the GNOME core user interface, and
@@ -26,41 +26,15 @@ debugging purposes.
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
It can be useful to look at the documentation available at the
[Wiki](https://gitlab.gnome.org/GNOME/mutter/-/wikis/home).
The API documentation is available at:
- Meta: <https://gnome.pages.gitlab.gnome.org/mutter/meta/>
- Clutter: <https://gnome.pages.gitlab.gnome.org/mutter/clutter/>
- Cally: <https://gnome.pages.gitlab.gnome.org/mutter/cally/>
- Cogl: <https://gnome.pages.gitlab.gnome.org/mutter/cogl/>
- CoglPango: <https://gnome.pages.gitlab.gnome.org/mutter/cogl-pango/>
## Coding style and conventions
See [HACKING.md](./HACKING.md).
## Git messages
The coding style used is primarily the GNU flavor of the [GNOME coding
style](https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en)
with some minor additions such as preferring `stdint.h` types over GLib
fundamental types, and a soft 80 character line limit. However, in general,
look at the file you're editing for inspiration.
Commit messages should follow the [GNOME commit message
guidelines](https://wiki.gnome.org/Git/CommitMessages). We require an URL
to either an issue or a merge request in each commit. Try to always prefix
commit subjects with a relevant topic, such as `compositor:` or
`clutter/actor:`, and it's always better to write too much in the commit
message body than too little.
## Default branch
The default development branch is `main`. If you still have a local
checkout under the old name, use:
```sh
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
```
to either an issue or a merge request in each commit.
## License

View File

@@ -1,138 +0,0 @@
#!/bin/env python3
import argparse
import os
import re
import subprocess
import sys
import tempfile
# Path relative to this script
uncrustify_cfg = 'tools/uncrustify.cfg'
def run_diff(sha):
proc = subprocess.Popen(["git", "diff", "-U0", "--function-context", sha, "HEAD"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
files = proc.stdout.read().strip().decode('utf-8')
return files.split('\n')
def find_chunks(diff):
file_entry_re = re.compile('^\+\+\+ b/(.*)$')
diff_chunk_re = re.compile('^@@ -\d+,\d+ \+(\d+),(\d+)')
file = None
chunks = []
for line in diff:
match = file_entry_re.match(line)
if match:
file = match.group(1)
match = diff_chunk_re.match(line)
if match:
start = int(match.group(1))
len = int(match.group(2))
end = start + len
if len > 0 and (file.endswith('.c') or file.endswith('.h') or file.endswith('.vala')):
chunks.append({ 'file': file, 'start': start, 'end': end })
return chunks
def reformat_chunks(chunks, rewrite):
# Creates temp file with INDENT-ON/OFF comments
def create_temp_file(file, start, end):
with open(file) as f:
tmp = tempfile.NamedTemporaryFile()
tmp.write(b'/** *INDENT-OFF* **/\n')
for i, line in enumerate(f):
if i == start - 2:
tmp.write(b'/** *INDENT-ON* **/\n')
tmp.write(bytes(line, 'utf-8'))
if i == end - 2:
tmp.write(b'/** *INDENT-OFF* **/\n')
tmp.seek(0)
return tmp
# Removes uncrustify INDENT-ON/OFF helper comments
def remove_indent_comments(output):
tmp = tempfile.NamedTemporaryFile()
for line in output:
if line != b'/** *INDENT-OFF* **/\n' and line != b'/** *INDENT-ON* **/\n':
tmp.write(line)
tmp.seek(0)
return tmp
changed = None
for chunk in chunks:
# Add INDENT-ON/OFF comments
tmp = create_temp_file(chunk['file'], chunk['start'], chunk['end'])
# uncrustify chunk
proc = subprocess.Popen(["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name], stdout=subprocess.PIPE)
reindented = proc.stdout.readlines()
proc.wait()
if proc.returncode != 0:
continue
tmp.close()
# Remove INDENT-ON/OFF comments
formatted = remove_indent_comments(reindented)
if dry_run is True:
# Show changes
proc = subprocess.Popen(["diff", "-up", "--color=always", chunk['file'], formatted.name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
diff = proc.stdout.read().decode('utf-8')
if diff != '':
output = re.sub('\t', '\t', diff)
print(output)
changed = True
else:
# Apply changes
diff = subprocess.Popen(["diff", "-up", chunk['file'], formatted.name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
patch = subprocess.Popen(["patch", chunk['file']], stdin=diff.stdout)
diff.stdout.close()
patch.communicate()
formatted.close()
return changed
parser = argparse.ArgumentParser(description='Check code style.')
parser.add_argument('--sha', metavar='SHA', type=str,
help='SHA for the commit to compare HEAD with')
parser.add_argument('--dry-run', '-d', type=bool,
action=argparse.BooleanOptionalAction,
help='Only print changes to stdout, do not change code')
parser.add_argument('--rewrite', '-r', type=bool,
action=argparse.BooleanOptionalAction,
help='Whether to amend the result to the last commit (e.g. \'git rebase --exec "%(prog)s -r"\')')
# Change CWD to script location, necessary for always locating the configuration file
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
args = parser.parse_args()
sha = args.sha or 'HEAD^'
rewrite = args.rewrite
dry_run = args.dry_run
diff = run_diff(sha)
chunks = find_chunks(diff)
changed = reformat_chunks(chunks, rewrite)
if dry_run is not True and rewrite is True:
proc = subprocess.Popen(["git", "commit", "--all", "--amend", "-C", "HEAD"], stdout=subprocess.DEVNULL)
os._exit(0)
elif dry_run is True and changed is True:
print ("\nIssue the following command in your local tree to apply the suggested changes (needs uncrustify installed):\n\n $ git rebase origin/main --exec \"./check-style.py -r\" \n")
os._exit(-1)
os._exit(0)

View File

@@ -28,7 +28,7 @@
#include "cally-actor.h"
/*
* Auxiliary define, in order to get the clutter actor from the AtkObject using
* Auxiliar define, in order to get the clutter actor from the AtkObject using
* AtkGObject methods
*
*/

View File

@@ -23,11 +23,12 @@
*/
/**
* CallyActor:
*
* Implementation of the ATK interfaces for [class@Clutter.Actor]
* SECTION:cally-actor
* @Title: CallyActor
* @short_description: Implementation of the ATK interfaces for #ClutterActor
* @see_also: #ClutterActor
*
* #CallyActor implements the required ATK interfaces of [class@Clutter.Actor]
* #CallyActor implements the required ATK interfaces of #ClutterActor
* exposing the common elements on each actor (position, extents, etc).
*/
@@ -71,7 +72,9 @@
#include <glib.h>
#include <clutter/clutter.h>
#include "clutter/clutter-actor-private.h"
#ifdef CLUTTER_WINDOWING_X11
#include <clutter/x11/clutter-x11.h>
#endif
#include <math.h>
@@ -193,6 +196,8 @@ G_DEFINE_TYPE_WITH_CODE (CallyActor,
* Creates a new #CallyActor for the given @actor
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject *
cally_actor_new (ClutterActor *actor)
@@ -762,11 +767,10 @@ static gboolean
cally_actor_action_do_action (AtkAction *action,
gint index)
{
CallyActor *cally_actor = NULL;
AtkStateSet *set = NULL;
CallyActorPrivate *priv = NULL;
CallyActorActionInfo *info = NULL;
gboolean did_action = FALSE;
CallyActor *cally_actor = NULL;
AtkStateSet *set = NULL;
CallyActorPrivate *priv = NULL;
CallyActorActionInfo *info = NULL;
cally_actor = CALLY_ACTOR (action);
priv = cally_actor->priv;
@@ -774,19 +778,21 @@ cally_actor_action_do_action (AtkAction *action,
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
goto out;
return FALSE;
if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
!atk_state_set_contains_state (set, ATK_STATE_SHOWING))
goto out;
return FALSE;
g_object_unref (set);
info = _cally_actor_get_action_info (cally_actor, index);
if (info == NULL)
goto out;
return FALSE;
if (info->do_action_func == NULL)
goto out;
return FALSE;
if (!priv->action_queue)
priv->action_queue = g_queue_new ();
@@ -796,12 +802,7 @@ cally_actor_action_do_action (AtkAction *action,
if (!priv->action_idle_handler)
priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
did_action = TRUE;
out:
g_clear_object (&set);
return did_action;
return TRUE;
}
static gboolean
@@ -967,7 +968,7 @@ cally_actor_real_notify_clutter (GObject *obj,
* paint it; we don't want this to generate an ATK
* state change
*/
if (clutter_actor_is_painting_unmapped (actor))
if (clutter_actor_is_in_clone_paint (actor))
return;
state = ATK_STATE_SHOWING;
@@ -1032,6 +1033,8 @@ _cally_actor_get_action_info (CallyActor *cally_actor,
* Adds a new action to be accessed with the #AtkAction interface.
*
* Return value: added action id, or -1 if failure
*
* Since: 1.4
*/
guint
cally_actor_add_action (CallyActor *cally_actor,
@@ -1061,6 +1064,8 @@ cally_actor_add_action (CallyActor *cally_actor,
* Adds a new action to be accessed with the #AtkAction interface.
*
* Return value: added action id, or -1 if failure
*
* Since: 1.6
*/
guint
cally_actor_add_action_full (CallyActor *cally_actor,
@@ -1079,7 +1084,7 @@ cally_actor_add_action_full (CallyActor *cally_actor,
priv = cally_actor->priv;
info = g_new0 (CallyActorActionInfo, 1);
info = g_slice_new (CallyActorActionInfo);
info->name = g_strdup (action_name);
info->description = g_strdup (action_description);
info->keybinding = g_strdup (action_keybinding);
@@ -1097,9 +1102,11 @@ cally_actor_add_action_full (CallyActor *cally_actor,
* @cally_actor: a #CallyActor
* @action_id: the action id
*
* Removes a action, using the @action_id returned by [method@Actor.add_action]
* Removes a action, using the @action_id returned by cally_actor_add_action()
*
* Return value: %TRUE if the operation was successful, %FALSE otherwise
* Return value: %TRUE if the operation was succesful, %FALSE otherwise
*
* Since: 1.4
*/
gboolean
cally_actor_remove_action (CallyActor *cally_actor,
@@ -1129,9 +1136,11 @@ cally_actor_remove_action (CallyActor *cally_actor,
* @action_name: the name of the action to remove
*
* Removes an action, using the @action_name used when the action was added
* with [method@Actor.add_action]
* with cally_actor_add_action()
*
* Return value: %TRUE if the operation was successful, %FALSE otherwise
* Return value: %TRUE if the operation was succesful, %FALSE otherwise
*
* Since: 1.4
*/
gboolean
cally_actor_remove_action_by_name (CallyActor *cally_actor,
@@ -1180,5 +1189,5 @@ _cally_actor_destroy_action_info (gpointer action_info,
if (info->notify)
info->notify (info->user_data);
g_free (info);
g_slice_free (CallyActorActionInfo, info);
}

View File

@@ -51,6 +51,8 @@ typedef struct _CallyActorPrivate CallyActorPrivate;
*
* Action function, to be used on #AtkAction implementations as a individual
* action
*
* Since: 1.4
*/
typedef void (* CallyActionFunc) (CallyActor *cally_actor);
@@ -60,14 +62,22 @@ typedef void (* CallyActionFunc) (CallyActor *cally_actor);
* @user_data: user data passed to the function
*
* Action function, to be used on #AtkAction implementations as
* an individual action.
*
* Unlike #CallyActionFunc, this function uses the @user_data
* argument passed to [method@Actor.add_action_full].
* an individual action. Unlike #CallyActionFunc, this function
* uses the @user_data argument passed to cally_actor_add_action_full().
*
* Since: 1.6
*/
typedef void (* CallyActionCallback) (CallyActor *cally_actor,
gpointer user_data);
/**
* CallyActor:
*
* The <structname>CallyActor</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyActor
{
/*< private >*/
@@ -79,6 +89,8 @@ struct _CallyActor
/**
* CallyActorClass:
* @notify_clutter: Signal handler for notify signal on Clutter actor
* @focus_clutter: Signal handler for key-focus-in and key-focus-out
* signal on Clutter actor. This virtual functions is deprecated.
* @add_actor: Signal handler for actor-added signal on
* ClutterContainer interface
* @remove_actor: Signal handler for actor-added signal on
@@ -86,6 +98,8 @@ struct _CallyActor
*
* The <structname>CallyActorClass</structname> structure contains
* only private data
*
* Since: 1.4
*/
struct _CallyActorClass
{
@@ -96,6 +110,9 @@ struct _CallyActorClass
void (*notify_clutter) (GObject *object,
GParamSpec *pspec);
gboolean (*focus_clutter) (ClutterActor *actor,
gpointer data);
gint (*add_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);

View File

@@ -21,11 +21,12 @@
*/
/**
* CallyClone:
*
* Implementation of the ATK interfaces for a #ClutterClone
* SECTION:cally-clone
* @Title: CallyClone
* @short_description: Implementation of the ATK interfaces for a #ClutterClone
* @see_also: #ClutterClone
*
* #CallyClone implements the required ATK interfaces of [class@Clutter.Clone]
* #CallyClone implements the required ATK interfaces of #ClutterClone
*
* In particular it sets a proper role for the clone, as just a image,
* as it is the sanest and simplest approach.
@@ -99,9 +100,11 @@ cally_clone_init (CallyClone *clone)
* @actor: a #ClutterActor
*
* Creates a new #CallyClone for the given @actor. @actor must be a
* [class@Clutter.Clone].
* #ClutterClone.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_clone_new (ClutterActor *actor)

View File

@@ -41,6 +41,14 @@ typedef struct _CallyClone CallyClone;
typedef struct _CallyCloneClass CallyCloneClass;
typedef struct _CallyClonePrivate CallyClonePrivate;
/**
* CallyClone:
*
* The <structname>CallyClone</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyClone
{
/*< private >*/
@@ -54,6 +62,8 @@ struct _CallyClone
*
* The <structname>CallyCloneClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyCloneClass
{

View File

@@ -42,6 +42,8 @@
* It assumes that the accessibility object provides a
* @opt_create_accessible method in order to create the accessibility
* object. It returns a @type GType object.
*
* Since: 1.4
*/
#define CALLY_ACCESSIBLE_FACTORY(type, type_as_function, opt_create_accessible) \
\
@@ -104,6 +106,8 @@ type_as_function ## _factory_get_type (void) \
*
* Sets the #AtkObjectFactory to be used in order to instantiate
* accessibility objects for the actor which GType is @widget_type.
*
* Since: 1.4
*/
#define CALLY_ACTOR_SET_FACTORY(widget_type, type_as_function) \
atk_registry_set_factory_type (atk_get_default_registry (), \

View File

@@ -0,0 +1,147 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on GailContainer from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:cally-group
* @Title: CallyGroup
* @short_description: Implementation of the ATK interfaces for a #ClutterGroup
* @see_also: #ClutterGroup
*
* #CallyGroup implements the required ATK interfaces of #ClutterGroup
* In particular it exposes each of the Clutter actors contained in the
* group.
*/
#include "clutter-build-config.h"
#include "cally-group.h"
#include "cally-actor-private.h"
static gint cally_group_get_n_children (AtkObject *obj);
static AtkObject* cally_group_ref_child (AtkObject *obj,
gint i);
static void cally_group_real_initialize (AtkObject *obj,
gpointer data);
G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR)
static void
cally_group_class_init (CallyGroupClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->get_n_children = cally_group_get_n_children;
class->ref_child = cally_group_ref_child;
class->initialize = cally_group_real_initialize;
}
static void
cally_group_init (CallyGroup *group)
{
/* nothing to do yet */
}
/**
* cally_group_new:
* @actor: a #ClutterGroup
*
* Creates a #CallyGroup for @actor
*
* Return value: the newly created #CallyGroup
*
* Since: 1.4
*/
AtkObject *
cally_group_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL);
object = g_object_new (CALLY_TYPE_GROUP, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static gint
cally_group_get_n_children (AtkObject *obj)
{
ClutterActor *actor = NULL;
gint count = 0;
g_return_val_if_fail (CALLY_IS_GROUP (obj), count);
actor = CALLY_GET_CLUTTER_ACTOR (obj);
if (actor == NULL) /* defunct */
return 0;
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count);
count = clutter_actor_get_n_children (actor);
return count;
}
static AtkObject*
cally_group_ref_child (AtkObject *obj,
gint i)
{
AtkObject *accessible = NULL;
ClutterActor *actor = NULL;
ClutterActor *child = NULL;
g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL);
g_return_val_if_fail ((i >= 0), NULL);
actor = CALLY_GET_CLUTTER_ACTOR (obj);
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL);
child = clutter_actor_get_child_at_index (actor, i);
if (!child)
return NULL;
accessible = clutter_actor_get_accessible (child);
if (accessible != NULL)
g_object_ref (accessible);
return accessible;
}
static void
cally_group_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_PANEL;
}

View File

@@ -0,0 +1,87 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on GailContainer from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CALLY_GROUP_H__
#define __CALLY_GROUP_H__
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#include <cally/cally-actor.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define CALLY_TYPE_GROUP (cally_group_get_type ())
#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup))
#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass))
#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP))
#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP))
#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass))
typedef struct _CallyGroup CallyGroup;
typedef struct _CallyGroupClass CallyGroupClass;
typedef struct _CallyGroupPrivate CallyGroupPrivate;
/**
* CallyGroup:
*
* The <structname>CallyGroup</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyGroup
{
/*< private >*/
CallyActor parent;
CallyGroupPrivate *priv;
};
/**
* CallyGroupClass:
*
* The <structname>CallyGroupClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyGroupClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
CLUTTER_EXPORT
GType cally_group_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
AtkObject* cally_group_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_GROUP_H__ */

View File

@@ -0,0 +1,98 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:cally-rectangle
* @short_description: Implementation of the ATK interfaces for a #ClutterRectangle
* @see_also: #ClutterRectangle
*
* #CallyRectangle implements the required ATK interfaces of #ClutterRectangle
*
* In particular it sets a proper role for the rectangle.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "cally-rectangle.h"
#include "cally-actor-private.h"
#include "clutter-color.h"
#include "deprecated/clutter-rectangle.h"
/* AtkObject */
static void cally_rectangle_real_initialize (AtkObject *obj,
gpointer data);
G_DEFINE_TYPE (CallyRectangle, cally_rectangle, CALLY_TYPE_ACTOR)
static void
cally_rectangle_class_init (CallyRectangleClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = cally_rectangle_real_initialize;
}
static void
cally_rectangle_init (CallyRectangle *rectangle)
{
/* nothing to do yet */
}
/**
* cally_rectangle_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyRectangle for the given @actor. @actor must be
* a #ClutterRectangle.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_rectangle_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (actor), NULL);
object = g_object_new (CALLY_TYPE_RECTANGLE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static void
cally_rectangle_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_rectangle_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_IMAGE;
}

View File

@@ -0,0 +1,84 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CALLY_RECTANGLE_H__
#define __CALLY_RECTANGLE_H__
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#include <cally/cally-actor.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define CALLY_TYPE_RECTANGLE (cally_rectangle_get_type ())
#define CALLY_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_RECTANGLE, CallyRectangle))
#define CALLY_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
#define CALLY_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_RECTANGLE))
#define CALLY_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_RECTANGLE))
#define CALLY_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
typedef struct _CallyRectangle CallyRectangle;
typedef struct _CallyRectangleClass CallyRectangleClass;
typedef struct _CallyRectanglePrivate CallyRectanglePrivate;
/**
* CallyRectangle:
*
* The <structname>CallyRectangle</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyRectangle
{
/*< private >*/
CallyActor parent;
CallyRectanglePrivate *priv;
};
/**
* CallyRectangleClass:
*
* The <structname>CallyRectangleClass</structname> structure contains
* only private data
*
* Since: 1.4
*/
struct _CallyRectangleClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
CLUTTER_EXPORT
GType cally_rectangle_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
AtkObject* cally_rectangle_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_RECTANGLE_H__ */

View File

@@ -21,18 +21,18 @@
*/
/**
* CallyRoot:
*
* Root object for the Cally toolkit
* SECTION:cally-root
* @short_description: Root object for the Cally toolkit
* @see_also: #ClutterStage
*
* #CallyRoot is the root object of the accessibility tree-like
* hierarchy, exposing the application level.
*
* Somewhat equivalent to #GailTopLevel. We consider that this class
* expose the a11y information of the [class@Clutter.StageManager], as the
* children of this object are the different [class@Clutter.Stage] managed (so
* the [class@GObject.Object] used in the atk_object_initialize() is the
* [class@Clutter.StageManager]).
* expose the a11y information of the #ClutterStageManager, as the
* children of this object are the different ClutterStage managed (so
* the #GObject used in the atk_object_initialize() is the
* #ClutterStageManager).
*/
#include "clutter-build-config.h"
@@ -113,6 +113,8 @@ cally_root_init (CallyRoot *root)
* Creates a new #CallyRoot object.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_root_new (void)

View File

@@ -41,6 +41,14 @@ typedef struct _CallyRoot CallyRoot;
typedef struct _CallyRootClass CallyRootClass;
typedef struct _CallyRootPrivate CallyRootPrivate;
/**
* CallyRoot:
*
* The <structname>CallyRoot</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyRoot
{
/*< private >*/
@@ -54,6 +62,8 @@ struct _CallyRoot
*
* The <structname>CallyRootClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyRootClass
{

View File

@@ -21,17 +21,18 @@
*/
/**
* CallyStage:
*
* Implementation of the ATK interfaces for a #ClutterStage
* SECTION:cally-stage
* @Title: CallyStage
* @short_description: Implementation of the ATK interfaces for a #ClutterStage
* @see_also: #ClutterStage
*
* #CallyStage implements the required ATK interfaces for [class@Clutter.Stage]
* #CallyStage implements the required ATK interfaces for #ClutterStage
*
* Some implementation details: at this moment #CallyStage is used as
* the most similar Window object in this toolkit (ie: emitting window
* related signals), although the real purpose of [class@Clutter.Stage] is
* related signals), although the real purpose of #ClutterStage is
* being a canvas. Anyway, this is required for applications using
* just clutter, or directly [class@Clutter.Stage]
* just clutter, or directly #ClutterStage
*/
#include "clutter-build-config.h"
@@ -46,7 +47,7 @@ static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj);
/* AtkWindow */
static void cally_stage_window_interface_init (AtkWindowIface *iface);
/* Auxiliary */
/* Auxiliar */
static void cally_stage_activate_cb (ClutterStage *stage,
gpointer data);
static void cally_stage_deactivate_cb (ClutterStage *stage,
@@ -62,7 +63,7 @@ struct _CallyStagePrivate
G_DEFINE_TYPE_WITH_CODE (CallyStage,
cally_stage,
CALLY_TYPE_ACTOR,
CALLY_TYPE_GROUP,
G_ADD_PRIVATE (CallyStage)
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init));
@@ -92,9 +93,11 @@ cally_stage_init (CallyStage *cally_stage)
* @actor: a #ClutterActor
*
* Creates a new #CallyStage for the given @actor. @actor should be a
* [class@Clutter.Stage].
* #ClutterStage.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_stage_new (ClutterActor *actor)
@@ -131,11 +134,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
if (self->priv->key_focus != NULL)
{
if (self->priv->key_focus != CLUTTER_ACTOR (stage))
{
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
(gpointer *) &self->priv->key_focus);
}
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
(gpointer *) &self->priv->key_focus);
old = clutter_actor_get_accessible (self->priv->key_focus);
}
else
@@ -160,11 +160,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
*
* we remove the weak pointer above.
*/
if (key_focus != CLUTTER_ACTOR (stage))
{
g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
(gpointer *) &self->priv->key_focus);
}
g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
(gpointer *) &self->priv->key_focus);
new = clutter_actor_get_accessible (key_focus);
}
@@ -225,7 +222,7 @@ cally_stage_window_interface_init (AtkWindowIface *iface)
/* At this moment AtkWindow is just about signals */
}
/* Auxiliary */
/* Auxiliar */
static void
cally_stage_activate_cb (ClutterStage *stage,
gpointer data)

View File

@@ -25,7 +25,7 @@
#error "Only <cally/cally.h> can be included directly."
#endif
#include <cally/cally-actor.h>
#include <cally/cally-group.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
@@ -41,10 +41,18 @@ typedef struct _CallyStage CallyStage;
typedef struct _CallyStageClass CallyStageClass;
typedef struct _CallyStagePrivate CallyStagePrivate;
/**
* CallyStage:
*
* The <structname>CallyStage</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyStage
{
/*< private >*/
CallyActor parent;
CallyGroup parent;
CallyStagePrivate *priv;
};
@@ -54,11 +62,13 @@ struct _CallyStage
*
* The <structname>CallyStageClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyStageClass
{
/*< private >*/
CallyActorClass parent_class;
CallyGroupClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[16];

View File

@@ -29,12 +29,14 @@
*/
/**
* CallyText:
*
* Implementation of the ATK interfaces for a [class@Clutter.Text]
* SECTION:cally-text
* @short_description: Implementation of the ATK interfaces for a #ClutterText
* @see_also: #ClutterText
*
* #CallyText implements the required ATK interfaces of
* [class@Clutter.Text], #AtkText and #AtkEditableText
* #ClutterText, #AtkText and #AtkEditableText
*
*
*/
#include "clutter-build-config.h"
@@ -255,9 +257,11 @@ cally_text_finalize (GObject *obj)
* @actor: a #ClutterActor
*
* Creates a new #CallyText for the given @actor. @actor must be a
* [class@Clutter.Text].
* #ClutterText.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_text_new (ClutterActor *actor)
@@ -1509,7 +1513,7 @@ cally_text_get_offset_at_point (AtkText *text,
}
/******** Auxiliary private methods ******/
/******** Auxiliar private methods ******/
/* ClutterText only maintains the current cursor position and a extra selection
bound, but this could be before or after the cursor. This method returns
@@ -1548,7 +1552,7 @@ _cally_text_delete_text_cb (ClutterText *clutter_text,
g_return_if_fail (CALLY_IS_TEXT (data));
/* Ignore zero length deletions */
/* Ignore zero lengh deletions */
if (end_pos - start_pos == 0)
return;
@@ -1649,7 +1653,7 @@ cally_text_insert_text (AtkEditableText *text,
clutter_text_insert_text (CLUTTER_TEXT (actor),
string, *position);
/* we suppose that the text insertion will be successful,
/* we suppose that the text insertion will be succesful,
clutter-text doesn't warn about it. A option would be search for
the text, but it seems not really required */
*position += length;
@@ -1862,7 +1866,7 @@ static gint
_cally_atk_attribute_lookup_func (gconstpointer data,
gconstpointer user_data)
{
AtkTextAttribute attr = (AtkTextAttribute) GPOINTER_TO_INT (user_data);
AtkTextAttribute attr = (AtkTextAttribute) user_data;
AtkAttribute *at = (AtkAttribute *) data;
if (!g_strcmp0 (at->name, atk_text_attribute_get_name (attr)))
return 0;

View File

@@ -41,6 +41,14 @@ typedef struct _CallyText CallyText;
typedef struct _CallyTextClass CallyTextClass;
typedef struct _CallyTextPrivate CallyTextPrivate;
/**
* CallyText:
*
* The <structname>CallyText</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyText
{
/*< private >*/
@@ -54,6 +62,8 @@ struct _CallyText
*
* The <structname>CallyTextClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyTextClass
{

View File

@@ -24,9 +24,10 @@
*/
/**
* CallyUtil:
*
* #AtkUtil implementation
* SECTION:cally-util
* @Title: CallyUtil
* @short_description: #AtkUtil implementation
* @see_also: #ClutterActor
*
* #CallyUtil implements #AtkUtil abstract methods. Although it
* includes the name "Util" it is in fact one of the most important
@@ -59,6 +60,17 @@ static const gchar * cally_util_get_toolkit_name (void);
static const gchar * cally_util_get_toolkit_version (void);
/* private */
static void cally_util_simulate_snooper_install (void);
static void cally_util_simulate_snooper_remove (void);
static gboolean cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data);
static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static gboolean notify_hf (gpointer key,
gpointer value,
gpointer data);
@@ -141,8 +153,12 @@ cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
CallyKeyEventInfo *event_info = NULL;
if (!key_listener_list)
{
key_listener_list = g_hash_table_new_full (NULL, NULL, NULL, g_free);
cally_util_simulate_snooper_install ();
}
event_info = g_new (CallyKeyEventInfo, 1);
event_info->listener = listener;
event_info->func_data = data;
@@ -163,11 +179,75 @@ cally_util_remove_key_event_listener (guint remove_listener)
{
g_hash_table_destroy (key_listener_list);
key_listener_list = NULL;
cally_util_simulate_snooper_remove ();
}
}
/* ------------------------------ PRIVATE FUNCTIONS ------------------------- */
/* Trying to emulate gtk_key_snooper install (a kind of wrapper). This
could be implemented without it, but I will maintain it in this
way, so if in the future clutter implements it natively it would be
easier the transition */
static void
cally_util_simulate_snooper_install (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
g_signal_connect (G_OBJECT (stage), "captured-event",
G_CALLBACK (cally_key_snooper), NULL);
}
g_signal_connect (G_OBJECT (stage_manager), "stage-added",
G_CALLBACK (cally_util_stage_added_cb), cally_key_snooper);
g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
G_CALLBACK (cally_util_stage_removed_cb), cally_key_snooper);
g_slist_free (stage_list);
}
static void
cally_util_simulate_snooper_remove (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
gint num = 0;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
num += g_signal_handlers_disconnect_by_func (stage, cally_key_snooper, NULL);
}
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_added_cb),
cally_key_snooper);
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_removed_cb),
cally_key_snooper);
#ifdef CALLY_DEBUG
g_print ("Number of snooper callbacks disconnected: %i\n", num);
#endif
}
static AtkKeyEventStruct *
atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
gunichar password_char)
@@ -281,11 +361,8 @@ insert_hf (gpointer key, gpointer value, gpointer data)
static gunichar
check_key_visibility (ClutterEvent *event)
{
AtkObject *accessible;
ClutterActor *focus;
focus = clutter_stage_get_key_focus (clutter_event_get_stage (event));
accessible = clutter_actor_get_accessible (focus);
ClutterKeyEvent *key_event = (ClutterKeyEvent *)event;
AtkObject *accessible = clutter_actor_get_accessible (key_event->source);
g_return_val_if_fail (accessible != NULL, 0);
@@ -301,40 +378,65 @@ check_key_visibility (ClutterEvent *event)
still better fill this with a default unichar that the original
one */
if (CLUTTER_IS_TEXT (focus))
return clutter_text_get_password_char (CLUTTER_TEXT (focus));
if (CLUTTER_IS_TEXT (key_event->source))
return clutter_text_get_password_char (CLUTTER_TEXT (key_event->source));
else
return DEFAULT_PASSWORD_CHAR;
}
gboolean
cally_snoop_key_event (ClutterKeyEvent *key)
static gboolean
cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterEvent *event = (ClutterEvent *) key;
AtkKeyEventStruct *key_event = NULL;
gboolean consumed = FALSE;
gint consumed = 0;
gunichar password_char = 0;
/* filter key events */
if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE))
return FALSE;
{
return FALSE;
}
password_char = check_key_visibility (event);
if (key_listener_list)
{
GHashTable *new_hash = g_hash_table_new (NULL, NULL);
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
password_char = check_key_visibility (event);
key_event = atk_key_event_from_clutter_event_key (key, password_char);
key_event = atk_key_event_from_clutter_event_key ((ClutterKeyEvent *)event,
password_char);
/* func data is inside the hash table */
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event) > 0;
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event);
g_hash_table_destroy (new_hash);
g_free (key_event->string);
g_free (key_event);
}
return consumed;
return (consumed ? 1 : 0);
}
static void
cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
g_signal_connect (G_OBJECT (stage), "captured-event", cally_key_snooper_cb, NULL);
}
static void
cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
}
void

View File

@@ -41,6 +41,14 @@ typedef struct _CallyUtil CallyUtil;
typedef struct _CallyUtilClass CallyUtilClass;
typedef struct _CallyUtilPrivate CallyUtilPrivate;
/**
* CallyUtil:
*
* The <structname>CallyUtil</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyUtil
{
/*< private >*/
@@ -54,6 +62,8 @@ struct _CallyUtil
*
* The <structname>CallyUtilClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyUtilClass
{
@@ -69,8 +79,6 @@ GType cally_util_get_type (void) G_GNUC_CONST;
void _cally_util_override_atk_util (void);
gboolean cally_snoop_key_event (ClutterKeyEvent *key);
G_END_DECLS
#endif /* __CALLY_UTIL_H__ */

View File

@@ -36,8 +36,10 @@
#include "cally.h"
#include "cally-actor.h"
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
#include "cally-factory.h"
@@ -50,8 +52,10 @@
/* factories initialization*/
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
/**
@@ -61,14 +65,18 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean
cally_accessibility_init (void)
{
/* setting the factories */
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
/* Initialize the CallyUtility class */
@@ -86,6 +94,8 @@ cally_accessibility_init (void)
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean cally_get_cally_initialized (void)
{

View File

@@ -26,7 +26,9 @@
#include "cally-actor.h"
#include "cally-clone.h"
#include "cally-factory.h"
#include "cally-group.h"
#include "cally-main.h"
#include "cally-rectangle.h"
#include "cally-root.h"
#include "cally-stage.h"
#include "cally-text.h"

View File

@@ -23,81 +23,39 @@
*/
/**
* ClutterAction:
*
* Abstract class for event-related logic
* SECTION:clutter-action
* @Title: ClutterAction
* @Short_Description: Abstract class for event-related logic
* @See_Also: #ClutterConstraint
*
* #ClutterAction is an abstract base class for event-related actions that
* modify the user interaction of a [class@Actor], just like
* [class@Constraint] is an abstract class for modifiers of an actor's
* modify the user interaction of a #ClutterActor, just like
* #ClutterConstraint is an abstract class for modifiers of an actor's
* position or size.
*
* Implementations of #ClutterAction are associated to an actor and can
* provide behavioral changes when dealing with user input - for instance
* drag and drop capabilities, or scrolling, or panning - by using the
* various event-related signals provided by [class@Actor] itself.
* various event-related signals provided by #ClutterActor itself.
*
* #ClutterAction is available since Clutter 1.4
*/
#include "clutter-build-config.h"
#include "clutter-action.h"
#include "clutter-action-private.h"
#include "clutter-debug.h"
#include "clutter-private.h"
typedef struct _ClutterActionPrivate ClutterActionPrivate;
struct _ClutterActionPrivate
{
ClutterEventPhase phase;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterAction, clutter_action,
CLUTTER_TYPE_ACTOR_META)
static gboolean
clutter_action_handle_event_default (ClutterAction *action,
const ClutterEvent *event)
{
return FALSE;
}
G_DEFINE_ABSTRACT_TYPE (ClutterAction, clutter_action, CLUTTER_TYPE_ACTOR_META);
static void
clutter_action_class_init (ClutterActionClass *klass)
{
klass->handle_event = clutter_action_handle_event_default;
}
static void
clutter_action_init (ClutterAction *self)
{
}
void
clutter_action_set_phase (ClutterAction *action,
ClutterEventPhase phase)
{
ClutterActionPrivate *priv;
priv = clutter_action_get_instance_private (action);
priv->phase = phase;
}
ClutterEventPhase
clutter_action_get_phase (ClutterAction *action)
{
ClutterActionPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTION (action), CLUTTER_PHASE_CAPTURE);
priv = clutter_action_get_instance_private (action);
return priv->phase;
}
gboolean
clutter_action_handle_event (ClutterAction *action,
const ClutterEvent *event)
{
return CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
}

View File

@@ -33,25 +33,41 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
#define CLUTTER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTION, ClutterAction))
#define CLUTTER_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTION))
#define CLUTTER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTION, ClutterActionClass))
#define CLUTTER_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTION))
#define CLUTTER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTION, ClutterActionClass))
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
CLUTTER, ACTION, ClutterActorMeta);
typedef struct _ClutterActionClass ClutterActionClass;
/**
* ClutterAction:
*
* The #ClutterAction structure contains only private data and
* should be accessed using the provided API.
*
* Since: 1.4
*/
struct _ClutterAction
{
/*< private >*/
ClutterActorMeta parent_instance;
};
/**
* ClutterActionClass:
*
* The ClutterActionClass structure contains only private data
*
* Since: 1.4
*/
struct _ClutterActionClass
{
/*< private >*/
ClutterActorMetaClass parent_class;
gboolean (* handle_event) (ClutterAction *action,
const ClutterEvent *event);
void (* _clutter_action1) (void);
void (* _clutter_action2) (void);
void (* _clutter_action3) (void);
@@ -62,6 +78,9 @@ struct _ClutterActionClass
void (* _clutter_action8) (void);
};
CLUTTER_EXPORT
GType clutter_action_get_type (void) G_GNUC_CONST;
/* ClutterActor API */
CLUTTER_EXPORT
void clutter_actor_add_action (ClutterActor *self,
@@ -71,11 +90,6 @@ void clutter_actor_add_action_with_name (ClutterActor *self,
const gchar *name,
ClutterAction *action);
CLUTTER_EXPORT
void clutter_actor_add_action_full (ClutterActor *self,
const char *name,
ClutterEventPhase phase,
ClutterAction *action);
CLUTTER_EXPORT
void clutter_actor_remove_action (ClutterActor *self,
ClutterAction *action);
CLUTTER_EXPORT
@@ -92,8 +106,6 @@ void clutter_actor_clear_actions (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_has_actions (ClutterActor *self);
ClutterEventPhase clutter_action_get_phase (ClutterAction *action);
G_END_DECLS
#endif /* __CLUTTER_ACTION_H__ */

View File

@@ -14,19 +14,21 @@
* @x_2: X coordinate of the bottom right point
* @y_2: Y coordinate of the bottom right point
*
* Allocates a new [struct@ActorBox] using the passed coordinates
* Allocates a new #ClutterActorBox using the passed coordinates
* for the top left and bottom right points.
*
* This function is the logical equivalent of:
*
* ```c
* |[
* clutter_actor_box_init (clutter_actor_box_alloc (),
* x_1, y_1,
* x_2, y_2);
* ```
* ]|
*
* Return value: (transfer full): the newly allocated #ClutterActorBox.
* Use [method@ActorBox.free] to free the resources
* Use clutter_actor_box_free() to free the resources
*
* Since: 1.0
*/
ClutterActorBox *
clutter_actor_box_new (gfloat x_1,
@@ -42,15 +44,17 @@ clutter_actor_box_new (gfloat x_1,
/**
* clutter_actor_box_alloc:
*
* Allocates a new [struct@ActorBox].
* Allocates a new #ClutterActorBox.
*
* Return value: (transfer full): the newly allocated #ClutterActorBox.
* Use [method@ActorBox.free] to free its resources
* Use clutter_actor_box_free() to free its resources
*
* Since: 1.12
*/
ClutterActorBox *
clutter_actor_box_alloc (void)
{
return g_new0 (ClutterActorBox, 1);
return g_slice_new0 (ClutterActorBox);
}
/**
@@ -64,6 +68,8 @@ clutter_actor_box_alloc (void)
* Initializes @box with the given coordinates.
*
* Return value: (transfer none): the initialized #ClutterActorBox
*
* Since: 1.10
*/
ClutterActorBox *
clutter_actor_box_init (ClutterActorBox *box,
@@ -91,6 +97,8 @@ clutter_actor_box_init (ClutterActorBox *box,
* @height: height of the box
*
* Initializes @box with the given origin and size.
*
* Since: 1.10
*/
void
clutter_actor_box_init_rect (ClutterActorBox *box,
@@ -114,13 +122,15 @@ clutter_actor_box_init_rect (ClutterActorBox *box,
* Copies @box
*
* Return value: a newly allocated copy of #ClutterActorBox. Use
* [method@ActorBox.free] to free the allocated resources
* clutter_actor_box_free() to free the allocated resources
*
* Since: 1.0
*/
ClutterActorBox *
clutter_actor_box_copy (const ClutterActorBox *box)
{
if (G_LIKELY (box != NULL))
return g_memdup2 (box, sizeof (ClutterActorBox));
return g_slice_dup (ClutterActorBox, box);
return NULL;
}
@@ -129,14 +139,16 @@ clutter_actor_box_copy (const ClutterActorBox *box)
* clutter_actor_box_free:
* @box: a #ClutterActorBox
*
* Frees a #ClutterActorBox allocated using [ctor@ActorBox.new]
* or [method@ActorBox.copy].
* Frees a #ClutterActorBox allocated using clutter_actor_box_new()
* or clutter_actor_box_copy()
*
* Since: 1.0
*/
void
clutter_actor_box_free (ClutterActorBox *box)
{
if (G_LIKELY (box != NULL))
g_free (box);
g_slice_free (ClutterActorBox, box);
}
/**
@@ -147,6 +159,8 @@ clutter_actor_box_free (ClutterActorBox *box)
* Checks @box_a and @box_b for equality
*
* Return value: %TRUE if the passed #ClutterActorBox are equal
*
* Since: 1.0
*/
gboolean
clutter_actor_box_equal (const ClutterActorBox *box_a,
@@ -168,6 +182,8 @@ clutter_actor_box_equal (const ClutterActorBox *box_a,
* Retrieves the X coordinate of the origin of @box
*
* Return value: the X coordinate of the origin
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_x (const ClutterActorBox *box)
@@ -184,6 +200,8 @@ clutter_actor_box_get_x (const ClutterActorBox *box)
* Retrieves the Y coordinate of the origin of @box
*
* Return value: the Y coordinate of the origin
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_y (const ClutterActorBox *box)
@@ -200,6 +218,8 @@ clutter_actor_box_get_y (const ClutterActorBox *box)
* Retrieves the width of the @box
*
* Return value: the width of the box
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_width (const ClutterActorBox *box)
@@ -216,6 +236,8 @@ clutter_actor_box_get_width (const ClutterActorBox *box)
* Retrieves the height of the @box
*
* Return value: the height of the box
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_height (const ClutterActorBox *box)
@@ -232,6 +254,8 @@ clutter_actor_box_get_height (const ClutterActorBox *box)
* @y: (out) (allow-none): return location for the Y coordinate, or %NULL
*
* Retrieves the origin of @box
*
* Since: 1.0
*/
void
clutter_actor_box_get_origin (const ClutterActorBox *box,
@@ -254,6 +278,8 @@ clutter_actor_box_get_origin (const ClutterActorBox *box,
* @height: (out) (allow-none): return location for the height, or %NULL
*
* Retrieves the size of @box
*
* Since: 1.0
*/
void
clutter_actor_box_get_size (const ClutterActorBox *box,
@@ -276,6 +302,8 @@ clutter_actor_box_get_size (const ClutterActorBox *box,
* Retrieves the area of @box
*
* Return value: the area of a #ClutterActorBox, in pixels
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_area (const ClutterActorBox *box)
@@ -292,9 +320,11 @@ clutter_actor_box_get_area (const ClutterActorBox *box)
* @y: Y coordinate of the point
*
* Checks whether a point with @x, @y coordinates is contained
* within @box
* withing @box
*
* Return value: %TRUE if the point is contained by the #ClutterActorBox
*
* Since: 1.0
*/
gboolean
clutter_actor_box_contains (const ClutterActorBox *box,
@@ -313,7 +343,9 @@ clutter_actor_box_contains (const ClutterActorBox *box,
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
*
* Calculates the bounding box represented by the four vertices; for details
* of the vertex array see [method@Actor.get_abs_allocation_vertices].
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
*
* Since: 1.0
*/
void
clutter_actor_box_from_vertices (ClutterActorBox *box,
@@ -380,8 +412,10 @@ clutter_actor_box_from_vertices (ClutterActorBox *box,
* @progress: the interpolation progress
* @result: (out): return location for the interpolation
*
* Interpolates between @initial and @final `ClutterActorBox`es
* Interpolates between @initial and @final #ClutterActorBox<!-- -->es
* using @progress
*
* Since: 1.2
*/
void
clutter_actor_box_interpolate (const ClutterActorBox *initial,
@@ -404,6 +438,8 @@ clutter_actor_box_interpolate (const ClutterActorBox *initial,
* @box: (inout): the #ClutterActorBox to clamp
*
* Clamps the components of @box to the nearest integer
*
* Since: 1.2
*/
void
clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
@@ -424,6 +460,8 @@ clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
* of @a and @b
*
* Unions the two boxes @a and @b and stores the result in @result.
*
* Since: 1.4
*/
void
clutter_actor_box_union (const ClutterActorBox *a,
@@ -466,6 +504,8 @@ clutter_actor_box_progress (const GValue *a,
* @y: the Y coordinate of the new origin
*
* Changes the origin of @box, maintaining the size of the #ClutterActorBox.
*
* Since: 1.6
*/
void
clutter_actor_box_set_origin (ClutterActorBox *box,
@@ -489,6 +529,8 @@ clutter_actor_box_set_origin (ClutterActorBox *box,
* @height: the new height
*
* Sets the size of @box, maintaining the origin of the #ClutterActorBox.
*
* Since: 1.6
*/
void
clutter_actor_box_set_size (ClutterActorBox *box,
@@ -512,7 +554,7 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
*
* The reason this is important is because effects will use this
* API to determine the size of offscreen framebuffers and so for
* a fixed-size object that may be animated across the screen we
* a fixed-size object that may be animated accross the screen we
* want to make sure that the stage paint-box has an equally stable
* size so that effects aren't made to continuously re-allocate
* a corresponding fbo.
@@ -541,7 +583,7 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
* size of the box will be stable and not dependent on the box's
* size of the box will be stable and not dependant on the box's
* position.
*
* Adding 3px to the width/height will ensure we cover the maximum of
@@ -558,6 +600,8 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
* @scale: scale factor for resizing this box
*
* Rescale the @box by provided @scale factor.
*
* Since: 1.6
*/
void
clutter_actor_box_scale (ClutterActorBox *box,
@@ -571,32 +615,6 @@ clutter_actor_box_scale (ClutterActorBox *box,
box->y2 *= scale;
}
/**
* clutter_actor_box_is_initialized:
* @box: a #ClutterActorBox
*
* Checks if @box has been initialized, a #ClutterActorBox is uninitialized
* if it has a size of -1 at an origin of 0, 0.
*
* Returns: %TRUE if the box is uninitialized, %FALSE if it isn't
*/
gboolean
clutter_actor_box_is_initialized (ClutterActorBox *box)
{
gboolean x1_uninitialized, x2_uninitialized;
gboolean y1_uninitialized, y2_uninitialized;
g_return_val_if_fail (box != NULL, TRUE);
x1_uninitialized = isinf (box->x1);
x2_uninitialized = isinf (box->x2) && signbit (box->x2);
y1_uninitialized = isinf (box->y1);
y2_uninitialized = isinf (box->y2) && signbit (box->y2);
return !x1_uninitialized || !x2_uninitialized ||
!y1_uninitialized || !y2_uninitialized;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
clutter_actor_box_copy,
clutter_actor_box_free,

View File

@@ -23,19 +23,22 @@
*/
/**
* ClutterActorMeta:
*
* Base class of actor modifiers
* SECTION:clutter-actor-meta
* @Title: ClutterActorMeta
* @Short_Description: Base class of actor modifiers
* @See_Also: #ClutterAction, #ClutterConstraint
*
* #ClutterActorMeta is an abstract class providing a common API for
* modifiers of [class@Actor] behaviour, appearance or layout.
* modifiers of #ClutterActor behaviour, appearance or layout.
*
* A #ClutterActorMeta can only be owned by a single [class@Actor] at
* A #ClutterActorMeta can only be owned by a single #ClutterActor at
* any time.
*
* Every sub-class of #ClutterActorMeta should check if the
* [property@ActorMeta:enabled] property is set to %TRUE before applying
* #ClutterActorMeta:enabled property is set to %TRUE before applying
* any kind of modification.
*
* #ClutterActorMeta is available since Clutter 1.4
*/
#include "clutter-build-config.h"
@@ -78,49 +81,38 @@ static void
on_actor_destroy (ClutterActor *actor,
ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
priv->actor = NULL;
meta->priv->actor = NULL;
}
static void
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
ClutterActor *actor)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
g_warn_if_fail (!priv->actor ||
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
g_warn_if_fail (!meta->priv->actor ||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
if (priv->actor == actor)
if (meta->priv->actor == actor)
return;
g_clear_signal_handler (&priv->destroy_id, priv->actor);
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
priv->actor = actor;
meta->priv->actor = actor;
if (priv->actor != NULL)
priv->destroy_id = g_signal_connect (priv->actor, "destroy",
G_CALLBACK (on_actor_destroy),
meta);
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ACTOR]);
if (meta->priv->actor != NULL)
meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy",
G_CALLBACK (on_actor_destroy),
meta);
}
static void
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
gboolean is_enabled)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
g_warn_if_fail (!meta->priv->actor ||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
g_warn_if_fail (!priv->actor ||
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
priv->is_enabled = is_enabled;
meta->priv->is_enabled = is_enabled;
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
}
@@ -155,21 +147,20 @@ clutter_actor_meta_get_property (GObject *gobject,
GValue *value,
GParamSpec *pspec)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
switch (prop_id)
{
case PROP_ACTOR:
g_value_set_object (value, priv->actor);
g_value_set_object (value, meta->priv->actor);
break;
case PROP_NAME:
g_value_set_string (value, priv->name);
g_value_set_string (value, meta->priv->name);
break;
case PROP_ENABLED:
g_value_set_boolean (value, priv->is_enabled);
g_value_set_boolean (value, meta->priv->is_enabled);
break;
default:
@@ -181,8 +172,7 @@ clutter_actor_meta_get_property (GObject *gobject,
static void
clutter_actor_meta_finalize (GObject *gobject)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
if (priv->actor != NULL)
g_clear_signal_handler (&priv->destroy_id, priv->actor);
@@ -204,19 +194,22 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
* ClutterActorMeta:actor:
*
* The #ClutterActor attached to the #ClutterActorMeta instance
*
* Since: 1.4
*/
obj_props[PROP_ACTOR] =
g_param_spec_object ("actor",
P_("Actor"),
P_("The actor attached to the meta"),
CLUTTER_TYPE_ACTOR,
CLUTTER_PARAM_READABLE |
G_PARAM_EXPLICIT_NOTIFY);
CLUTTER_PARAM_READABLE);
/**
* ClutterActorMeta:name:
*
* The unique name to access the #ClutterActorMeta
*
* Since: 1.4
*/
obj_props[PROP_NAME] =
g_param_spec_string ("name",
@@ -229,6 +222,8 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
* ClutterActorMeta:enabled:
*
* Whether or not the #ClutterActorMeta is enabled
*
* Since: 1.4
*/
obj_props[PROP_ENABLED] =
g_param_spec_boolean ("enabled",
@@ -248,11 +243,9 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
void
clutter_actor_meta_init (ClutterActorMeta *self)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (self);
priv->is_enabled = TRUE;
priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
self->priv = clutter_actor_meta_get_instance_private (self);
self->priv->is_enabled = TRUE;
self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
}
/**
@@ -263,22 +256,20 @@ clutter_actor_meta_init (ClutterActorMeta *self)
* Sets the name of @meta
*
* The name can be used to identify the #ClutterActorMeta instance
*
* Since: 1.4
*/
void
clutter_actor_meta_set_name (ClutterActorMeta *meta,
const gchar *name)
{
ClutterActorMetaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
priv = clutter_actor_meta_get_instance_private (meta);
if (g_strcmp0 (priv->name, name) == 0)
if (g_strcmp0 (meta->priv->name, name) == 0)
return;
g_free (priv->name);
priv->name = g_strdup (name);
g_free (meta->priv->name);
meta->priv->name = g_strdup (name);
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
}
@@ -287,23 +278,21 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta,
* clutter_actor_meta_get_name:
* @meta: a #ClutterActorMeta
*
* Retrieves the name set using [method@ActorMeta.set_name]
* Retrieves the name set using clutter_actor_meta_set_name()
*
* Return value: (transfer none): the name of the #ClutterActorMeta
* instance, or %NULL if none was set. The returned string is owned
* by the #ClutterActorMeta instance and it should not be modified
* or freed
*
* Since: 1.4
*/
const gchar *
clutter_actor_meta_get_name (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
priv = clutter_actor_meta_get_instance_private (meta);
return priv->name;
return meta->priv->name;
}
/**
@@ -312,19 +301,18 @@ clutter_actor_meta_get_name (ClutterActorMeta *meta)
* @is_enabled: whether @meta is enabled
*
* Sets whether @meta should be enabled or not
*
* Since: 1.4
*/
void
clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
gboolean is_enabled)
{
ClutterActorMetaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
priv = clutter_actor_meta_get_instance_private (meta);
is_enabled = !!is_enabled;
if (priv->is_enabled == is_enabled)
if (meta->priv->is_enabled == is_enabled)
return;
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
@@ -337,17 +325,15 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
* Retrieves whether @meta is enabled
*
* Return value: %TRUE if the #ClutterActorMeta instance is enabled
*
* Since: 1.4
*/
gboolean
clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
priv = clutter_actor_meta_get_instance_private (meta);
return priv->is_enabled;
return meta->priv->is_enabled;
}
/*
@@ -357,6 +343,8 @@ clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
*
* Sets or unsets a back pointer to the #ClutterActor that owns
* the @meta
*
* Since: 1.4
*/
void
_clutter_actor_meta_set_actor (ClutterActorMeta *meta,
@@ -372,61 +360,49 @@ _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
* clutter_actor_meta_get_actor:
* @meta: a #ClutterActorMeta
*
* Retrieves a pointer to the [class@Actor] that owns @meta
* Retrieves a pointer to the #ClutterActor that owns @meta
*
* Return value: (transfer none): a pointer to a #ClutterActor or %NULL
*
* Since: 1.4
*/
ClutterActor *
clutter_actor_meta_get_actor (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
priv = clutter_actor_meta_get_instance_private (meta);
return priv->actor;
return meta->priv->actor;
}
void
_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
gint priority)
{
ClutterActorMetaPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
priv = clutter_actor_meta_get_instance_private (meta);
/* This property shouldn't be modified after the actor meta is in
use because ClutterMetaGroup doesn't resort the list when it
changes. If we made the priority public then we could either make
the priority a construct-only property or listen for
notifications on the property from the ClutterMetaGroup and
resort. */
g_return_if_fail (priv->actor == NULL);
g_return_if_fail (meta->priv->actor == NULL);
priv->priority = priority;
meta->priv->priority = priority;
}
gint
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
priv = clutter_actor_meta_get_instance_private (meta);
return priv->priority;
return meta->priv->priority;
}
gboolean
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
gint priority = priv->priority;
gint priority = meta->priv->priority;
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
@@ -473,21 +449,19 @@ void
_clutter_meta_group_add_meta (ClutterMetaGroup *group,
ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
GList *prev = NULL, *l;
if (priv->actor != NULL)
if (meta->priv->actor != NULL)
{
g_warning ("The meta of type '%s' with name '%s' is "
"already attached to actor '%s'",
G_OBJECT_TYPE_NAME (meta),
priv->name != NULL
? priv->name
meta->priv->name != NULL
? meta->priv->name
: "<unknown>",
clutter_actor_get_name (priv->actor) != NULL
? clutter_actor_get_name (priv->actor)
: G_OBJECT_TYPE_NAME (priv->actor));
clutter_actor_get_name (meta->priv->actor) != NULL
? clutter_actor_get_name (meta->priv->actor)
: G_OBJECT_TYPE_NAME (meta->priv->actor));
return;
}
@@ -523,16 +497,13 @@ void
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
if (priv->actor != group->actor)
if (meta->priv->actor != group->actor)
{
g_warning ("The meta of type '%s' with name '%s' is not "
"attached to the actor '%s'",
G_OBJECT_TYPE_NAME (meta),
priv->name != NULL
? priv->name
meta->priv->name != NULL
? meta->priv->name
: "<unknown>",
clutter_actor_get_name (group->actor) != NULL
? clutter_actor_get_name (group->actor)
@@ -675,10 +646,8 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
for (l = group->meta; l != NULL; l = l->next)
{
ClutterActorMeta *meta = l->data;
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
if (g_strcmp0 (priv->name, name) == 0)
if (g_strcmp0 (meta->priv->name, name) == 0)
return meta;
}
@@ -698,8 +667,6 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
const gchar *
_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
{
ClutterActorMetaPrivate *priv =
clutter_actor_meta_get_instance_private (meta);
return priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (meta);
return meta->priv->name != NULL ? meta->priv->name
: G_OBJECT_TYPE_NAME (meta);
}

View File

@@ -33,13 +33,31 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
#define CLUTTER_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMeta))
#define CLUTTER_IS_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_META))
#define CLUTTER_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
#define CLUTTER_IS_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR_META))
#define CLUTTER_ACTOR_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta,
CLUTTER, ACTOR_META, GInitiallyUnowned);
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
typedef struct _ClutterActorMetaClass ClutterActorMetaClass;
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
/**
* ClutterActorMeta:
*
* The #ClutterActorMeta structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterActorMeta
{
/*< private >*/
GInitiallyUnowned parent_instance;
ClutterActorMetaPrivate *priv;
};
/**
* ClutterActorMetaClass:
@@ -48,6 +66,8 @@ typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
*
* The #ClutterActorMetaClass structure contains
* only private data
*
* Since: 1.4
*/
struct _ClutterActorMetaClass
{
@@ -79,6 +99,9 @@ struct _ClutterActorMetaClass
void (* _clutter_meta6) (void);
};
CLUTTER_EXPORT
GType clutter_actor_meta_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
const gchar *name);

View File

@@ -23,10 +23,26 @@
#define __CLUTTER_ACTOR_PRIVATE_H__
#include <clutter/clutter-actor.h>
#include <clutter/clutter-grab.h>
G_BEGIN_DECLS
/*< private >
* ClutterRedrawFlags:
* @CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION: Tells clutter the maximum
* extents of what needs to be redrawn lies within the actors
* current allocation. (Only use this for 2D actors though because
* any actor with depth may be projected outside of its allocation)
*
* Flags passed to the clutter_actor_queue_redraw_with_clip ()
* function
*
* Since: 1.6
*/
typedef enum
{
CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION = 1 << 0
} ClutterRedrawFlags;
/*< private >
* ClutterActorTraverseFlags:
* CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
@@ -94,12 +110,35 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor
typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
gpointer user_data);
typedef struct _AnchorCoord AnchorCoord;
typedef struct _SizeRequest SizeRequest;
typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
typedef struct _ClutterTransformInfo ClutterTransformInfo;
typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
/* Internal helper struct to represent a point that can be stored in
either direct pixel coordinates or as a fraction of the actor's
size. It is used for the anchor point, scale center and rotation
centers. */
struct _AnchorCoord
{
gboolean is_fractional;
union
{
/* Used when is_fractional == TRUE */
struct
{
gdouble x;
gdouble y;
} fraction;
/* Use when is_fractional == FALSE */
graphene_point3d_t units;
} v;
};
struct _SizeRequest
{
guint age;
@@ -144,15 +183,24 @@ ClutterLayoutInfo * _clutter_actor_peek_layout_info
struct _ClutterTransformInfo
{
/* rotation */
/* rotation (angle and center) */
gdouble rx_angle;
AnchorCoord rx_center;
gdouble ry_angle;
AnchorCoord ry_center;
gdouble rz_angle;
AnchorCoord rz_center;
/* scaling */
gdouble scale_x;
gdouble scale_y;
gdouble scale_z;
AnchorCoord scale_center;
/* anchor point */
AnchorCoord anchor;
/* translation */
graphene_point3d_t translation;
@@ -164,10 +212,10 @@ struct _ClutterTransformInfo
graphene_point_t pivot;
gfloat pivot_z;
graphene_matrix_t transform;
CoglMatrix transform;
guint transform_set : 1;
graphene_matrix_t child_transform;
CoglMatrix child_transform;
guint child_transform_set : 1;
};
@@ -204,11 +252,11 @@ void _clutter_actor_traverse
gpointer user_data);
ClutterActor * _clutter_actor_get_stage_internal (ClutterActor *actor);
void _clutter_actor_apply_modelview_transform (ClutterActor *self,
graphene_matrix_t *matrix);
void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor,
graphene_matrix_t *matrix);
void _clutter_actor_apply_modelview_transform (ClutterActor *self,
CoglMatrix *matrix);
void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor,
CoglMatrix *matrix);
void _clutter_actor_rerealize (ClutterActor *self,
ClutterCallback callback,
@@ -229,55 +277,50 @@ void _clutter_actor_set_has_pointer
void _clutter_actor_set_has_key_focus (ClutterActor *self,
gboolean has_key_focus);
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *clip_volume);
void _clutter_actor_queue_redraw_full (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *volume,
ClutterEffect *effect);
void _clutter_actor_finish_queue_redraw (ClutterActor *self);
void _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip);
gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self,
GType check_gtype,
ClutterPaintVolume *volume);
const char * _clutter_actor_get_debug_name (ClutterActor *self);
const gchar * _clutter_actor_get_debug_name (ClutterActor *self);
void _clutter_actor_push_clone_paint (void);
void _clutter_actor_pop_clone_paint (void);
void _clutter_actor_shader_pre_paint (ClutterActor *actor,
gboolean repeat);
void _clutter_actor_shader_post_paint (ClutterActor *actor);
ClutterActorAlign _clutter_actor_get_effective_x_align (ClutterActor *self);
void _clutter_actor_handle_event (ClutterActor *actor,
ClutterActor *root,
const ClutterEvent *event);
void _clutter_actor_attach_clone (ClutterActor *actor,
ClutterActor *clone);
void _clutter_actor_detach_clone (ClutterActor *actor,
ClutterActor *clone);
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor);
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
float clutter_actor_get_real_resource_scale (ClutterActor *actor);
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
float *resource_scale);
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
CoglTexture *texture);
void clutter_actor_finish_layout (ClutterActor *self,
int phase);
void clutter_actor_queue_immediate_relayout (ClutterActor *self);
gboolean clutter_actor_is_painting_unmapped (ClutterActor *self);
gboolean clutter_actor_get_redraw_clip (ClutterActor *self,
ClutterPaintVolume *dst_old_pv,
ClutterPaintVolume *dst_new_pv);
void clutter_actor_attach_grab (ClutterActor *actor,
ClutterGrab *grab);
void clutter_actor_detach_grab (ClutterActor *actor,
ClutterGrab *grab);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -118,7 +118,12 @@ typedef void (*ClutterCallback) (ClutterActor *actor,
*/
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
/**
* ClutterActor:
* @flags: #ClutterActorFlags
*
* Base class for actors.
*/
struct _ClutterActor
{
/*< private >*/
@@ -137,6 +142,11 @@ struct _ClutterActor
* ClutterActorClass:
* @show: signal class handler for #ClutterActor::show; it must chain
* up to the parent's implementation
* @show_all: virtual function for containers and composite actors, to
* determine which children should be shown when calling
* clutter_actor_show_all() on the actor. Defaults to calling
* clutter_actor_show(). This virtual function is deprecated and it
* should not be overridden.
* @hide: signal class handler for #ClutterActor::hide; it must chain
* up to the parent's implementation
* @hide_all: virtual function for containers and composite actors, to
@@ -165,23 +175,18 @@ struct _ClutterActor
* @get_preferred_height: virtual function, used when querying the minimum
* and natural heights of an actor for a given width; it is used by
* clutter_actor_get_preferred_height()
* @allocate: virtual function, used when setting the coordinates of an
* actor; it is used by clutter_actor_allocate(); when overriding this
* function without chaining up, clutter_actor_set_allocation() must be
* called and children must be allocated by the implementation, when
* chaining up though, those things will be done by the parent's
* implementation.
* @allocate: virtual function, used when settings the coordinates of an
* actor; it is used by clutter_actor_allocate(); it must chain up to
* the parent's implementation, or call clutter_actor_set_allocation()
* @apply_transform: virtual function, used when applying the transformations
* to an actor before painting it or when transforming coordinates or
* the allocation; if the transformation calculated by this function may
* have changed, the cached transformation must be invalidated by calling
* clutter_actor_invalidate_transform(); it must chain up to the parent's
* implementation
* the allocation; it must chain up to the parent's implementation
* @parent_set: signal class handler for the #ClutterActor::parent-set
* @destroy: signal class handler for #ClutterActor::destroy. It must
* chain up to the parent's implementation
* @pick: virtual function, used to draw an outline of the actor with
* the given color
* @queue_redraw: class handler for #ClutterActor::queue-redraw
* @event: class handler for #ClutterActor::event
* @button_press_event: class handler for #ClutterActor::button-press-event
* @button_release_event: class handler for
@@ -218,6 +223,7 @@ struct _ClutterActorClass
/*< public >*/
void (* show) (ClutterActor *self);
void (* show_all) (ClutterActor *self);
void (* hide) (ClutterActor *self);
void (* hide_all) (ClutterActor *self);
void (* realize) (ClutterActor *self);
@@ -233,6 +239,10 @@ struct _ClutterActorClass
void (* pick) (ClutterActor *actor,
ClutterPickContext *pick_context);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
ClutterPaintVolume *paint_volume);
/* size negotiation */
void (* get_preferred_width) (ClutterActor *self,
gfloat for_height,
@@ -243,11 +253,12 @@ struct _ClutterActorClass
gfloat *min_height_p,
gfloat *natural_height_p);
void (* allocate) (ClutterActor *self,
const ClutterActorBox *box);
const ClutterActorBox *box,
ClutterAllocationFlags flags);
/* transformations */
void (* apply_transform) (ClutterActor *actor,
graphene_matrix_t *matrix);
ClutterMatrix *matrix);
/* event signals */
gboolean (* event) (ClutterActor *actor,
@@ -289,9 +300,6 @@ struct _ClutterActorClass
gboolean (* touch_event) (ClutterActor *self,
ClutterTouchEvent *event);
gboolean (* has_accessible) (ClutterActor *self);
void (* resource_scale_changed) (ClutterActor *self);
float (* calculate_resource_scale) (ClutterActor *self,
int phase);
/*< private >*/
/* padding for future expansion */
@@ -306,6 +314,8 @@ struct _ClutterActorClass
*
* The contents of the #ClutterActorIter structure
* are private and should only be accessed using the provided API.
*
* Since: 1.10
*/
struct _ClutterActorIter
{
@@ -405,31 +415,38 @@ void clutter_actor_get_preferred_size
gfloat *natural_height_p);
CLUTTER_EXPORT
void clutter_actor_allocate (ClutterActor *self,
const ClutterActorBox *box);
const ClutterActorBox *box,
ClutterAllocationFlags flags);
CLUTTER_EXPORT
void clutter_actor_allocate_preferred_size (ClutterActor *self,
float x,
float y);
ClutterAllocationFlags flags);
CLUTTER_EXPORT
void clutter_actor_allocate_available_size (ClutterActor *self,
gfloat x,
gfloat y,
gfloat available_width,
gfloat available_height);
gfloat available_height,
ClutterAllocationFlags flags);
CLUTTER_EXPORT
void clutter_actor_allocate_align_fill (ClutterActor *self,
const ClutterActorBox *box,
gdouble x_align,
gdouble y_align,
gboolean x_fill,
gboolean y_fill);
gboolean y_fill,
ClutterAllocationFlags flags);
CLUTTER_EXPORT
void clutter_actor_set_allocation (ClutterActor *self,
const ClutterActorBox *box);
const ClutterActorBox *box,
ClutterAllocationFlags flags);
CLUTTER_EXPORT
void clutter_actor_get_allocation_box (ClutterActor *self,
ClutterActorBox *box);
CLUTTER_EXPORT
void clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
graphene_point3d_t *verts);
CLUTTER_EXPORT
gboolean clutter_actor_has_allocation (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_set_size (ClutterActor *self,
@@ -444,10 +461,6 @@ void clutter_actor_set_position
gfloat x,
gfloat y);
CLUTTER_EXPORT
gboolean clutter_actor_get_fixed_position (ClutterActor *self,
float *x,
float *y);
CLUTTER_EXPORT
void clutter_actor_get_position (ClutterActor *self,
gfloat *x,
gfloat *y);
@@ -579,8 +592,7 @@ void clutter_actor_set_offscreen_redirect
CLUTTER_EXPORT
ClutterOffscreenRedirect clutter_actor_get_offscreen_redirect (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_should_pick (ClutterActor *self,
ClutterPickContext *pick_context);
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_is_in_clone_paint (ClutterActor *self);
CLUTTER_EXPORT
@@ -588,7 +600,8 @@ gboolean clutter_actor_get_paint_box
ClutterActorBox *box);
CLUTTER_EXPORT
float clutter_actor_get_resource_scale (ClutterActor *self);
gboolean clutter_actor_get_resource_scale (ClutterActor *self,
gfloat *resource_scale);
CLUTTER_EXPORT
gboolean clutter_actor_has_overlaps (ClutterActor *self);
@@ -617,13 +630,6 @@ void clutter_actor_set_content_repeat
ClutterContentRepeat repeat);
CLUTTER_EXPORT
ClutterContentRepeat clutter_actor_get_content_repeat (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_set_color_state (ClutterActor *self,
ClutterColorState *color_state);
CLUTTER_EXPORT
ClutterColorState *clutter_actor_get_color_state (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_get_content_box (ClutterActor *self,
ClutterActorBox *box);
@@ -799,21 +805,16 @@ void clutter_actor_get_translation
gfloat *translate_z);
CLUTTER_EXPORT
void clutter_actor_set_transform (ClutterActor *self,
const graphene_matrix_t *transform);
const ClutterMatrix *transform);
CLUTTER_EXPORT
void clutter_actor_get_transform (ClutterActor *self,
graphene_matrix_t *transform);
ClutterMatrix *transform);
CLUTTER_EXPORT
void clutter_actor_set_child_transform (ClutterActor *self,
const graphene_matrix_t *transform);
const ClutterMatrix *transform);
CLUTTER_EXPORT
void clutter_actor_get_child_transform (ClutterActor *self,
graphene_matrix_t *transform);
CLUTTER_EXPORT
void clutter_actor_get_transformed_extents (ClutterActor *self,
graphene_rect_t *rect);
ClutterMatrix *transform);
CLUTTER_EXPORT
void clutter_actor_get_transformed_position (ClutterActor *self,
gfloat *x,
@@ -900,7 +901,9 @@ void clutter_actor_uninhibit_culling
* of interest, using g_object_bind_property(). This way, when the @item
* in the #GListModel changes, the #ClutterActor changes as well.
*
* Returns: (transfer full): The newly created child #ClutterActor4
* Returns: (transfer full): The newly created child #ClutterActor
*
* Since: 1.24
*/
typedef ClutterActor * (* ClutterActorCreateChildFunc) (gpointer item,
gpointer user_data);
@@ -923,15 +926,6 @@ void clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box);
CLUTTER_EXPORT
GList * clutter_actor_peek_stage_views (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_invalidate_transform (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_invalidate_paint_volume (ClutterActor *self);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */

View File

@@ -23,13 +23,15 @@
*/
/**
* ClutterAlignConstraint:
*
* A constraint aligning the position of an actor
* SECTION:clutter-align-constraint
* @Title: ClutterAlignConstraint
* @Short_Description: A constraint aligning the position of an actor
*
* #ClutterAlignConstraint is a [class@Constraint] that aligns the position
* of the [class@Actor] to which it is applied to the size of another
* [class@Actor] using an alignment factor
* #ClutterAlignConstraint is a #ClutterConstraint that aligns the position
* of the #ClutterActor to which it is applied to the size of another
* #ClutterActor using an alignment factor
*
* #ClutterAlignConstraint is available since Clutter 1.4
*/
#include "clutter-build-config.h"
@@ -56,7 +58,6 @@ struct _ClutterAlignConstraint
ClutterActor *actor;
ClutterActor *source;
ClutterAlignAxis align_axis;
graphene_point_t pivot;
gfloat factor;
};
@@ -71,7 +72,6 @@ enum
PROP_SOURCE,
PROP_ALIGN_AXIS,
PROP_PIVOT_POINT,
PROP_FACTOR,
PROP_LAST
@@ -84,11 +84,13 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
CLUTTER_TYPE_CONSTRAINT);
static void
source_queue_relayout (ClutterActor *actor,
ClutterAlignConstraint *align)
source_position_changed (ClutterActor *actor,
const ClutterActorBox *allocation,
ClutterAllocationFlags flags,
ClutterAlignConstraint *align)
{
if (align->actor != NULL)
_clutter_actor_queue_only_relayout (align->actor);
clutter_actor_queue_relayout (align->actor);
}
static void
@@ -133,41 +135,35 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint);
gfloat source_width, source_height;
gfloat actor_width, actor_height;
gfloat offset_x_start, offset_y_start;
gfloat pivot_x, pivot_y;
gfloat source_x, source_y;
if (align->source == NULL)
return;
clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
clutter_actor_get_position (align->source, &source_x, &source_y);
clutter_actor_get_size (align->source, &source_width, &source_height);
pivot_x = align->pivot.x == -1.f
? align->factor
: align->pivot.x;
pivot_y = align->pivot.y == -1.f
? align->factor
: align->pivot.y;
offset_x_start = pivot_x * -actor_width;
offset_y_start = pivot_y * -actor_height;
switch (align->align_axis)
{
case CLUTTER_ALIGN_X_AXIS:
allocation->x1 += offset_x_start + (source_width * align->factor);
allocation->x1 = ((source_width - actor_width) * align->factor)
+ source_x;
allocation->x2 = allocation->x1 + actor_width;
break;
case CLUTTER_ALIGN_Y_AXIS:
allocation->y1 += offset_y_start + (source_height * align->factor);
allocation->y1 = ((source_height - actor_height) * align->factor)
+ source_y;
allocation->y2 = allocation->y1 + actor_height;
break;
case CLUTTER_ALIGN_BOTH:
allocation->x1 += offset_x_start + (source_width * align->factor);
allocation->y1 += offset_y_start + (source_height * align->factor);
allocation->x1 = ((source_width - actor_width) * align->factor)
+ source_x;
allocation->y1 = ((source_height - actor_height) * align->factor)
+ source_y;
allocation->x2 = allocation->x1 + actor_width;
allocation->y2 = allocation->y1 + actor_height;
break;
@@ -191,7 +187,7 @@ clutter_align_constraint_dispose (GObject *gobject)
G_CALLBACK (source_destroyed),
align);
g_signal_handlers_disconnect_by_func (align->source,
G_CALLBACK (source_queue_relayout),
G_CALLBACK (source_position_changed),
align);
align->source = NULL;
}
@@ -217,10 +213,6 @@ clutter_align_constraint_set_property (GObject *gobject,
clutter_align_constraint_set_align_axis (align, g_value_get_enum (value));
break;
case PROP_PIVOT_POINT:
clutter_align_constraint_set_pivot_point (align, g_value_get_boxed (value));
break;
case PROP_FACTOR:
clutter_align_constraint_set_factor (align, g_value_get_float (value));
break;
@@ -249,16 +241,6 @@ clutter_align_constraint_get_property (GObject *gobject,
g_value_set_enum (value, align->align_axis);
break;
case PROP_PIVOT_POINT:
{
graphene_point_t point;
clutter_align_constraint_get_pivot_point (align, &point);
g_value_set_boxed (value, &point);
}
break;
case PROP_FACTOR:
g_value_set_float (value, align->factor);
break;
@@ -287,6 +269,8 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
*
* The #ClutterActor must not be a child or a grandchild of the actor
* using the constraint.
*
* Since: 1.4
*/
obj_props[PROP_SOURCE] =
g_param_spec_object ("source",
@@ -299,6 +283,8 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
* ClutterAlignConstraint:align-axis:
*
* The axis to be used to compute the alignment
*
* Since: 1.4
*/
obj_props[PROP_ALIGN_AXIS] =
g_param_spec_enum ("align-axis",
@@ -308,30 +294,6 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
CLUTTER_ALIGN_X_AXIS,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
/**
* ClutterAlignConstraint:pivot-point:
*
* The pivot point used by the constraint. The pivot point is the
* point in the constraint actor around which the aligning is applied,
* with (0, 0) being the top left corner of the actor and (1, 1) the
* bottom right corner of the actor.
*
* For example, setting the pivot point to (0.5, 0.5) and using a factor
* of 1 for both axes will align the actors horizontal and vertical
* center point with the bottom right corner of the source actor.
*
* By default, the pivot point is set to (-1, -1), which means it's not
* used and the constrained actor will be aligned to always stay inside
* the source actor.
*/
obj_props[PROP_PIVOT_POINT] =
g_param_spec_boxed ("pivot-point",
P_("Pivot point"),
P_("The pivot point"),
GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* ClutterAlignConstraint:factor:
*
@@ -341,6 +303,8 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
* with an align-axis value of %CLUTTER_ALIGN_X_AXIS, 0.0 means left and
* 1.0 means right; with a value of %CLUTTER_ALIGN_Y_AXIS, 0.0 means top
* and 1.0 means bottom.
*
* Since: 1.4
*/
obj_props[PROP_FACTOR] =
g_param_spec_float ("factor",
@@ -362,8 +326,6 @@ clutter_align_constraint_init (ClutterAlignConstraint *self)
self->actor = NULL;
self->source = NULL;
self->align_axis = CLUTTER_ALIGN_X_AXIS;
self->pivot.x = -1.f;
self->pivot.y = -1.f;
self->factor = 0.0f;
}
@@ -379,6 +341,8 @@ clutter_align_constraint_init (ClutterAlignConstraint *self)
* alignment @factor
*
* Return value: the newly created #ClutterAlignConstraint
*
* Since: 1.4
*/
ClutterConstraint *
clutter_align_constraint_new (ClutterActor *source,
@@ -400,6 +364,8 @@ clutter_align_constraint_new (ClutterActor *source,
* @source: (allow-none): a #ClutterActor, or %NULL to unset the source
*
* Sets the source of the alignment constraint
*
* Since: 1.4
*/
void
clutter_align_constraint_set_source (ClutterAlignConstraint *align,
@@ -437,15 +403,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
G_CALLBACK (source_destroyed),
align);
g_signal_handlers_disconnect_by_func (old_source,
G_CALLBACK (source_queue_relayout),
G_CALLBACK (source_position_changed),
align);
}
align->source = source;
if (align->source != NULL)
{
g_signal_connect (align->source, "queue-relayout",
G_CALLBACK (source_queue_relayout),
g_signal_connect (align->source, "allocation-changed",
G_CALLBACK (source_position_changed),
align);
g_signal_connect (align->source, "destroy",
G_CALLBACK (source_destroyed),
@@ -466,6 +432,8 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
*
* Return value: (transfer none): the #ClutterActor used as the source
* of the alignment
*
* Since: 1.4
*/
ClutterActor *
clutter_align_constraint_get_source (ClutterAlignConstraint *align)
@@ -481,6 +449,8 @@ clutter_align_constraint_get_source (ClutterAlignConstraint *align)
* @axis: the axis to which the alignment refers to
*
* Sets the axis to which the alignment refers to
*
* Since: 1.4
*/
void
clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
@@ -506,6 +476,8 @@ clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
* Retrieves the value set using clutter_align_constraint_set_align_axis()
*
* Return value: the alignment axis
*
* Since: 1.4
*/
ClutterAlignAxis
clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
@@ -516,60 +488,6 @@ clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
return align->align_axis;
}
/**
* clutter_align_constraint_set_pivot_point:
* @align: a #ClutterAlignConstraint
* @pivot_point: A #GraphenePoint
*
* Sets the pivot point used by the constraint, the pivot point is the
* point in the constraint actor around which the aligning is applied,
* with (0, 0) being the top left corner of the actor and (1, 1) the
* bottom right corner of the actor.
*
* If -1 is used, the pivot point is unset and the constrained actor
* will be aligned to always stay inside the source actor.
*/
void
clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
const graphene_point_t *pivot_point)
{
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
g_return_if_fail (pivot_point != NULL);
g_return_if_fail (pivot_point->x == -1.f ||
(pivot_point->x >= 0.f && pivot_point->x <= 1.f));
g_return_if_fail (pivot_point->y == -1.f ||
(pivot_point->y >= 0.f && pivot_point->y <= 1.f));
if (graphene_point_equal (&align->pivot, pivot_point))
return;
align->pivot = *pivot_point;
if (align->actor != NULL)
clutter_actor_queue_relayout (align->actor);
g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_PIVOT_POINT]);
}
/**
* clutter_align_constraint_get_pivot_point
* @align: a #ClutterAlignConstraint
* @pivot_point: (out caller-allocates): return location for a #GraphenePoint
*
* Gets the pivot point used by the constraint set with
* clutter_align_constraint_set_pivot_point(). If no custom pivot
* point is set, -1 is set.
*/
void
clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
graphene_point_t *pivot_point)
{
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
g_return_if_fail (pivot_point != NULL);
*pivot_point = align->pivot;
}
/**
* clutter_align_constraint_set_factor:
* @align: a #ClutterAlignConstraint
@@ -586,6 +504,8 @@ clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
* meaning bottom, when #ClutterAlignConstraint:align-axis is set to
* %CLUTTER_ALIGN_Y_AXIS). A value of 0.5 aligns in the middle in either
* cases
*
* Since: 1.4
*/
void
clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
@@ -608,6 +528,8 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
* Retrieves the factor set using clutter_align_constraint_set_factor()
*
* Return value: the alignment factor
*
* Since: 1.4
*/
gfloat
clutter_align_constraint_get_factor (ClutterAlignConstraint *align)

View File

@@ -37,6 +37,14 @@ G_BEGIN_DECLS
#define CLUTTER_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraint))
#define CLUTTER_IS_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT))
/**
* ClutterAlignConstraint:
*
* #ClutterAlignConstraint is an opaque structure
* whose members cannot be directly accesses
*
* Since: 1.4
*/
typedef struct _ClutterAlignConstraint ClutterAlignConstraint;
typedef struct _ClutterAlignConstraintClass ClutterAlignConstraintClass;
@@ -59,12 +67,6 @@ void clutter_align_constraint_set_align_axis (ClutterAlignConstrai
CLUTTER_EXPORT
ClutterAlignAxis clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align);
CLUTTER_EXPORT
void clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
const graphene_point_t *pivot_point);
CLUTTER_EXPORT
void clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
graphene_point_t *pivot_point);
CLUTTER_EXPORT
void clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
gfloat factor);
CLUTTER_EXPORT

View File

@@ -23,26 +23,39 @@
*/
/**
* ClutterAnimatable:
*
* Interface for animatable classes
* SECTION:clutter-animatable
* @short_description: Interface for animatable classes
*
* #ClutterAnimatable is an interface that allows a [class@GObject.Object] class
* to control how an actor will animate a property.
* #ClutterAnimatable is an interface that allows a #GObject class
* to control how a #ClutterAnimation will animate a property.
*
* Each #ClutterAnimatable should implement the
* [vfunc@Animatable.interpolate_value] virtual function of the
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
* interface to compute the animation state between two values of an interval
* depending on a progress factor, expressed as a floating point value.
*
* If a #ClutterAnimatable is animated by a #ClutterAnimation
* instance, the #ClutterAnimation will call
* clutter_animatable_interpolate_property() passing the name of the
* currently animated property; the values interval; and the progress factor.
* The #ClutterAnimatable implementation should return the computed value for
* the animated
* property.
*
* #ClutterAnimatable is available since Clutter 1.0
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-animatable.h"
#include "clutter-interval.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "deprecated/clutter-animation.h"
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
static void
@@ -55,10 +68,12 @@ clutter_animatable_default_init (ClutterAnimatableInterface *iface)
* @animatable: a #ClutterAnimatable
* @property_name: the name of the animatable property to find
*
* Finds the [class@GObject.ParamSpec] for @property_name
* Finds the #GParamSpec for @property_name
*
* Return value: (transfer none): The #GParamSpec for the given property
* or %NULL
*
* Since: 1.4
*/
GParamSpec *
clutter_animatable_find_property (ClutterAnimatable *animatable,
@@ -86,6 +101,8 @@ clutter_animatable_find_property (ClutterAnimatable *animatable,
* @value: a #GValue initialized to the type of the property to retrieve
*
* Retrieves the current state of @property_name and sets @value with it
*
* Since: 1.4
*/
void
clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
@@ -113,6 +130,8 @@ clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
* @value: the value of the animatable property to set
*
* Sets the current state of @property_name to @value
*
* Since: 1.4
*/
void
clutter_animatable_set_final_state (ClutterAnimatable *animatable,
@@ -149,12 +168,14 @@ clutter_animatable_set_final_state (ClutterAnimatable *animatable,
* value, and store the result inside @value.
*
* This function should be used for every property animation
* involving `ClutterAnimatable`s.
* involving #ClutterAnimatable<!-- -->s.
*
* This function replaces clutter_animatable_animate_property().
*
* Return value: %TRUE if the interpolation was successful,
* and %FALSE otherwise
*
* Since: 1.8
*/
gboolean
clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
@@ -185,25 +206,3 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
else
return clutter_interval_compute_value (interval, progress, value);
}
/**
* clutter_animatable_get_actor:
* @animatable: a #ClutterAnimatable
*
* Get animated actor.
*
* Return value: (transfer none): a #ClutterActor
*/
ClutterActor *
clutter_animatable_get_actor (ClutterAnimatable *animatable)
{
ClutterAnimatableInterface *iface;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
g_return_val_if_fail (iface->get_actor, NULL);
return iface->get_actor (animatable);
}

View File

@@ -42,6 +42,8 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
/**
* ClutterAnimatableInterface:
* @animate_property: virtual function for custom interpolation of a
* property. This virtual function is deprecated
* @find_property: virtual function for retrieving the #GParamSpec of
* an animatable property
* @get_initial_state: virtual function for retrieving the initial
@@ -50,7 +52,11 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
* animatable property
* @interpolate_value: virtual function for interpolating the progress
* of a property
* @get_actor: virtual function for getting associated actor
*
* Base interface for #GObject<!-- -->s that can be animated by a
* a #ClutterAnimation.
*
* Since: 1.0
*/
struct _ClutterAnimatableInterface
{
@@ -58,6 +64,13 @@ struct _ClutterAnimatableInterface
GTypeInterface parent_iface;
/*< public >*/
gboolean (* animate_property) (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
const GValue *initial_value,
const GValue *final_value,
gdouble progress,
GValue *value);
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
const gchar *property_name);
void (* get_initial_state) (ClutterAnimatable *animatable,
@@ -71,7 +84,6 @@ struct _ClutterAnimatableInterface
ClutterInterval *interval,
gdouble progress,
GValue *value);
ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
};
CLUTTER_EXPORT
@@ -92,9 +104,6 @@ gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
gdouble progress,
GValue *value);
CLUTTER_EXPORT
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
G_END_DECLS
#endif /* __CLUTTER_ANIMATABLE_H__ */

View File

@@ -30,7 +30,9 @@
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
@@ -41,6 +43,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClickAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
@@ -50,7 +53,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGestureAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
@@ -82,6 +87,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterZoomAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)

View File

@@ -53,8 +53,6 @@ struct _ClutterBackend
gfloat units_per_em;
gint32 units_serial;
float fallback_resource_scale;
ClutterStageWindow *stage_window;
ClutterInputMethod *input_method;
@@ -66,11 +64,18 @@ struct _ClutterBackendClass
GObjectClass parent_class;
/* vfuncs */
gboolean (* finish_init) (ClutterBackend *backend,
gboolean (* pre_parse) (ClutterBackend *backend,
GError **error);
gboolean (* post_parse) (ClutterBackend *backend,
GError **error);
ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void (* init_events) (ClutterBackend *backend);
void (* init_features) (ClutterBackend *backend);
void (* add_options) (ClutterBackend *backend,
GOptionGroup *group);
ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
GError **error);
CoglDisplay * (* get_display) (ClutterBackend *backend,
@@ -86,28 +91,40 @@ struct _ClutterBackendClass
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
gboolean (* is_display_server) (ClutterBackend *backend);
/* signals */
void (* resolution_changed) (ClutterBackend *backend);
void (* font_changed) (ClutterBackend *backend);
void (* settings_changed) (ClutterBackend *backend);
};
ClutterBackend * _clutter_create_backend (void);
ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
gboolean _clutter_backend_create_context (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_finish_init (ClutterBackend *backend,
void _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
void _clutter_backend_init_events (ClutterBackend *backend);
void _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
@@ -117,17 +134,6 @@ void clutter_set_allowed_drivers (const c
CLUTTER_EXPORT
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
CLUTTER_EXPORT
void clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
float fallback_resource_scale);
float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend);
gboolean clutter_backend_is_display_server (ClutterBackend *backend);
CLUTTER_EXPORT
void clutter_backend_destroy (ClutterBackend *backend);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */

View File

@@ -25,9 +25,8 @@
*/
/**
* ClutterBackend:
*
* Backend abstraction
* SECTION:clutter-backend
* @short_description: Backend abstraction
*
* Clutter can be compiled against different backends. Each backend
* has to implement a set of functions, in order to be used by Clutter.
@@ -35,10 +34,14 @@
* #ClutterBackend is the base class abstracting the various implementation;
* it provides a basic API to query the backend for generic information
* and settings.
*
* #ClutterBackend is available since Clutter 0.4
*/
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-backend-private.h"
#include "clutter-debug.h"
#include "clutter-event-private.h"
@@ -49,8 +52,25 @@
#include "clutter-stage-private.h"
#include "clutter-stage-window.h"
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include "wayland/clutter-wayland-compositor.h"
#endif
#include <cogl/cogl.h>
#ifdef CLUTTER_INPUT_X11
#include "x11/clutter-backend-x11.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include <cogl/cogl-wayland-server.h>
#include <wayland-server.h>
#include "wayland/clutter-wayland-compositor.h"
#endif
#define DEFAULT_FONT_NAME "Sans 10"
enum
@@ -66,6 +86,12 @@ G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT)
static guint backend_signals[LAST_SIGNAL] = { 0, };
/* Global for being able to specify a compositor side wayland display
* pointer before clutter initialization */
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
static struct wl_display *_wayland_compositor_display;
#endif
static void
clutter_backend_dispose (GObject *gobject)
{
@@ -74,20 +100,28 @@ clutter_backend_dispose (GObject *gobject)
/* clear the events still in the queue of the main context */
_clutter_clear_events_queue ();
g_clear_object (&backend->dummy_onscreen);
g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref);
if (backend->stage_window)
{
g_object_remove_weak_pointer (G_OBJECT (backend->stage_window),
(gpointer *) &backend->stage_window);
backend->stage_window = NULL;
}
g_clear_pointer (&backend->cogl_source, g_source_destroy);
g_clear_pointer (&backend->font_name, g_free);
g_clear_pointer (&backend->font_options, cairo_font_options_destroy);
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
}
static void
clutter_backend_finalize (GObject *gobject)
{
ClutterBackend *backend = CLUTTER_BACKEND (gobject);
g_source_destroy (backend->cogl_source);
g_free (backend->font_name);
clutter_backend_set_font_options (backend, NULL);
g_clear_object (&backend->input_method);
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
G_OBJECT_CLASS (clutter_backend_parent_class)->finalize (gobject);
}
static gfloat
@@ -188,20 +222,22 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
{
ClutterBackendClass *klass;
CoglSwapChain *swap_chain;
GError *internal_error;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
swap_chain = NULL;
internal_error = NULL;
CLUTTER_NOTE (BACKEND, "Creating Cogl renderer");
backend->cogl_renderer = klass->get_renderer (backend, error);
backend->cogl_renderer = klass->get_renderer (backend, &internal_error);
if (backend->cogl_renderer == NULL)
goto error;
CLUTTER_NOTE (BACKEND, "Connecting the renderer");
cogl_renderer_set_driver (backend->cogl_renderer, driver_id);
if (!cogl_renderer_connect (backend->cogl_renderer, error))
if (!cogl_renderer_connect (backend->cogl_renderer, &internal_error))
goto error;
CLUTTER_NOTE (BACKEND, "Creating Cogl swap chain");
@@ -213,7 +249,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
backend->cogl_display = klass->get_display (backend,
backend->cogl_renderer,
swap_chain,
error);
&internal_error);
}
else
{
@@ -229,7 +265,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
*/
res = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
tmpl,
error);
&internal_error);
if (!res)
goto error;
@@ -243,12 +279,17 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
if (backend->cogl_display == NULL)
goto error;
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
cogl_wayland_display_set_compositor_display (backend->cogl_display,
_wayland_compositor_display);
#endif
CLUTTER_NOTE (BACKEND, "Setting up the display");
if (!cogl_display_setup (backend->cogl_display, error))
if (!cogl_display_setup (backend->cogl_display, &internal_error))
goto error;
CLUTTER_NOTE (BACKEND, "Creating the Cogl context");
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
backend->cogl_context = cogl_context_new (backend->cogl_display, &internal_error);
if (backend->cogl_context == NULL)
goto error;
@@ -352,7 +393,8 @@ clutter_backend_real_create_context (ClutterBackend *backend,
if (internal_error != NULL)
g_propagate_error (error, internal_error);
else
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
g_set_error_literal (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
"Unable to initialize the Clutter backend: no available drivers found.");
return FALSE;
@@ -364,19 +406,143 @@ clutter_backend_real_create_context (ClutterBackend *backend,
return TRUE;
}
static ClutterFeatureFlags
clutter_backend_real_get_features (ClutterBackend *backend)
{
ClutterFeatureFlags flags = 0;
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
{
CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
}
else
{
CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer");
flags |= CLUTTER_FEATURE_STAGE_STATIC;
}
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
{
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
flags |= CLUTTER_FEATURE_SWAP_THROTTLE;
}
else
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
{
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
}
return flags;
}
static const char *allowed_backends;
static ClutterBackend * (* custom_backend_func) (void);
static const struct {
const char *name;
ClutterBackend * (* create_backend) (void);
} available_backends[] = {
#ifdef CLUTTER_WINDOWING_X11
{ CLUTTER_WINDOWING_X11, clutter_backend_x11_new },
#endif
#ifdef CLUTTER_WINDOWING_EGL
{ CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new },
#endif
{ NULL, NULL },
};
void
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
{
custom_backend_func = func;
}
ClutterBackend *
_clutter_create_backend (void)
{
const char *backends_list;
ClutterBackend *retval;
gboolean allow_any;
char **backends;
int i;
if (custom_backend_func)
{
retval = custom_backend_func ();
if (!retval)
g_error ("Failed to create custom backend.");
return retval;
}
if (allowed_backends == NULL)
allowed_backends = "*";
allow_any = strstr (allowed_backends, "*") != NULL;
backends_list = g_getenv ("CLUTTER_BACKEND");
if (backends_list == NULL)
backends_list = allowed_backends;
backends = g_strsplit (backends_list, ",", 0);
retval = NULL;
for (i = 0; retval == NULL && backends[i] != NULL; i++)
{
const char *backend = backends[i];
gboolean is_any = g_str_equal (backend, "*");
int j;
for (j = 0; available_backends[j].name != NULL; j++)
{
if ((is_any && allow_any) ||
(is_any && strstr (allowed_backends, available_backends[j].name)) ||
g_str_equal (backend, available_backends[j].name))
{
retval = available_backends[j].create_backend ();
if (retval != NULL)
break;
}
}
}
g_strfreev (backends);
if (retval == NULL)
g_error ("No default Clutter backend found.");
return retval;
}
static void
clutter_backend_real_init_events (ClutterBackend *backend)
{
g_error ("Unknown input backend");
}
static void
clutter_backend_class_init (ClutterBackendClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = clutter_backend_dispose;
gobject_class->finalize = clutter_backend_finalize;
/**
* ClutterBackend::resolution-changed:
* @backend: the #ClutterBackend that emitted the signal
*
* The signal is emitted each time the font
* The ::resolution-changed signal is emitted each time the font
* resolutions has been changed through #ClutterSettings.
*
* Since: 1.0
*/
backend_signals[RESOLUTION_CHANGED] =
g_signal_new (I_("resolution-changed"),
@@ -390,8 +556,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
* ClutterBackend::font-changed:
* @backend: the #ClutterBackend that emitted the signal
*
* The signal is emitted each time the font options
* The ::font-changed signal is emitted each time the font options
* have been changed through #ClutterSettings.
*
* Since: 1.0
*/
backend_signals[FONT_CHANGED] =
g_signal_new (I_("font-changed"),
@@ -405,8 +573,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
* ClutterBackend::settings-changed:
* @backend: the #ClutterBackend that emitted the signal
*
* The signal is emitted each time the #ClutterSettings
* The ::settings-changed signal is emitted each time the #ClutterSettings
* properties have been changed.
*
* Since: 1.4
*/
backend_signals[SETTINGS_CHANGED] =
g_signal_new (I_("settings-changed"),
@@ -419,7 +589,9 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->resolution_changed = clutter_backend_real_resolution_changed;
klass->font_changed = clutter_backend_real_font_changed;
klass->init_events = clutter_backend_real_init_events;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
}
static void
@@ -429,21 +601,47 @@ clutter_backend_init (ClutterBackend *self)
self->units_serial = 1;
self->dummy_onscreen = NULL;
self->fallback_resource_scale = 1.f;
}
gboolean
_clutter_backend_finish_init (ClutterBackend *backend,
GError **error)
void
_clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->finish_init)
return klass->finish_init (backend, error);
if (klass->add_options)
klass->add_options (backend, group);
}
gboolean
_clutter_backend_pre_parse (ClutterBackend *backend,
GError **error)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->pre_parse)
return klass->pre_parse (backend, error);
return TRUE;
}
gboolean
_clutter_backend_post_parse (ClutterBackend *backend,
GError **error)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->post_parse)
return klass->post_parse (backend, error);
return TRUE;
}
@@ -488,6 +686,57 @@ _clutter_backend_create_context (ClutterBackend *backend,
return klass->create_context (backend, error);
}
ClutterFeatureFlags
_clutter_backend_get_features (ClutterBackend *backend)
{
ClutterBackendClass *klass;
GError *error;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
/* we need to have a context here; so we create the
* GL context first and the ask for features. if the
* context already exists this should be a no-op
*/
error = NULL;
if (klass->create_context != NULL)
{
gboolean res;
res = klass->create_context (backend, &error);
if (!res)
{
if (error)
{
g_critical ("Unable to create a context: %s", error->message);
g_error_free (error);
}
else
g_critical ("Unable to create a context: unknown error");
return 0;
}
}
if (klass->get_features)
return klass->get_features (backend);
return 0;
}
void
_clutter_backend_init_events (ClutterBackend *backend)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
klass->init_events (backend);
}
gfloat
_clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc)
@@ -502,6 +751,31 @@ _clutter_backend_get_units_per_em (ClutterBackend *backend,
return backend->units_per_em;
}
void
_clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
ClutterSeatClass *seat_class;
ClutterSeat *seat;
seat = clutter_backend_get_default_seat (backend);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
seat_class->copy_event_data (seat, src, dest);
}
void
_clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
ClutterSeatClass *seat_class;
ClutterSeat *seat;
seat = clutter_backend_get_default_seat (backend);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
seat_class->free_event_data (seat, event);
}
/**
* clutter_get_default_backend:
*
@@ -511,6 +785,8 @@ _clutter_backend_get_units_per_em (ClutterBackend *backend,
* Return value: (transfer none): the default backend. You should
* not ref or unref the returned object. Applications should rarely
* need to use this.
*
* Since: 0.4
*/
ClutterBackend *
clutter_get_default_backend (void)
@@ -539,6 +815,8 @@ clutter_get_default_backend (void)
*
* Return value: the current resolution, or -1 if no resolution
* has been set.
*
* Since: 0.4
*/
gdouble
clutter_backend_get_resolution (ClutterBackend *backend)
@@ -571,6 +849,8 @@ clutter_backend_get_resolution (ClutterBackend *backend)
*
* This function is intended for actors creating a Pango layout
* using the PangoCairo API.
*
* Since: 0.8
*/
void
clutter_backend_set_font_options (ClutterBackend *backend,
@@ -601,6 +881,8 @@ clutter_backend_set_font_options (ClutterBackend *backend,
* Return value: (transfer none): the font options of the #ClutterBackend.
* The returned #cairo_font_options_t is owned by the backend and should
* not be modified or freed
*
* Since: 0.8
*/
const cairo_font_options_t *
clutter_backend_get_font_options (ClutterBackend *backend)
@@ -638,7 +920,7 @@ _clutter_backend_translate_event (ClutterBackend *backend,
}
/**
* clutter_backend_get_cogl_context:
* clutter_backend_get_cogl_context: (skip)
* @backend: a #ClutterBackend
*
* Retrieves the #CoglContext associated with the given clutter
@@ -653,6 +935,8 @@ _clutter_backend_translate_event (ClutterBackend *backend,
* explicitly create a CoglContext.
*
* Return value: (transfer none): The #CoglContext associated with @backend.
*
* Since: 1.8
* Stability: unstable
*/
CoglContext *
@@ -661,6 +945,31 @@ clutter_backend_get_cogl_context (ClutterBackend *backend)
return backend->cogl_context;
}
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
/**
* clutter_wayland_set_compositor_display:
* @display: A compositor side struct wl_display pointer
*
* This informs Clutter of your compositor side Wayland display
* object. This must be called before calling clutter_init().
*
* Since: 1.8
* Stability: unstable
*/
void
clutter_wayland_set_compositor_display (void *display)
{
if (_clutter_context_is_initialized ())
{
g_warning ("%s() can only be used before calling clutter_init()",
G_STRFUNC);
return;
}
_wayland_compositor_display = display;
}
#endif
void
clutter_set_allowed_drivers (const char *drivers)
{
@@ -722,29 +1031,3 @@ clutter_backend_get_default_seat (ClutterBackend *backend)
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
}
void
clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
float fallback_resource_scale)
{
backend->fallback_resource_scale = fallback_resource_scale;
}
float
clutter_backend_get_fallback_resource_scale (ClutterBackend *backend)
{
return backend->fallback_resource_scale;
}
gboolean
clutter_backend_is_display_server (ClutterBackend *backend)
{
return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend);
}
void
clutter_backend_destroy (ClutterBackend *backend)
{
g_object_run_dispose (G_OBJECT (backend));
g_object_unref (backend);
}

View File

@@ -33,6 +33,7 @@
#include <cogl/cogl.h>
#include <clutter/clutter-config.h>
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-seat.h>
@@ -43,6 +44,14 @@ G_BEGIN_DECLS
#define CLUTTER_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND, ClutterBackend))
#define CLUTTER_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND))
/**
* ClutterBackend:
*
* #ClutterBackend is an opaque structure whose
* members cannot be directly accessed.
*
* Since: 0.4
*/
typedef struct _ClutterBackend ClutterBackend;
typedef struct _ClutterBackendClass ClutterBackendClass;

View File

@@ -39,6 +39,8 @@
#define FLOAT_EPSILON (1e-15)
/*
* ClutterMargin
*/
@@ -51,11 +53,13 @@
* Return value: (transfer full): a newly allocated #ClutterMargin. Use
* clutter_margin_free() to free the resources associated with it when
* done.
*
* Since: 1.10
*/
ClutterMargin *
clutter_margin_new (void)
{
return g_new0 (ClutterMargin, 1);
return g_slice_new0 (ClutterMargin);
}
/**
@@ -66,12 +70,14 @@ clutter_margin_new (void)
* the newly created structure.
*
* Return value: (transfer full): a copy of the #ClutterMargin.
*
* Since: 1.10
*/
ClutterMargin *
clutter_margin_copy (const ClutterMargin *margin_)
{
if (G_LIKELY (margin_ != NULL))
return g_memdup2 (margin_, sizeof (ClutterMargin));
return g_slice_dup (ClutterMargin, margin_);
return NULL;
}
@@ -82,14 +88,205 @@ clutter_margin_copy (const ClutterMargin *margin_)
*
* Frees the resources allocated by clutter_margin_new() and
* clutter_margin_copy().
*
* Since: 1.10
*/
void
clutter_margin_free (ClutterMargin *margin_)
{
if (G_LIKELY (margin_ != NULL))
g_free (margin_);
g_slice_free (ClutterMargin, margin_);
}
G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
clutter_margin_copy,
clutter_margin_free)
/**
* ClutterMatrix:
*
* A type representing a 4x4 matrix.
*
* It is identicaly to #CoglMatrix.
*
* Since: 1.12
*/
static gpointer
clutter_matrix_copy (gpointer data)
{
return cogl_matrix_copy (data);
}
static gboolean
clutter_matrix_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterMatrix *matrix1 = g_value_get_boxed (a);
const ClutterMatrix *matrix2 = g_value_get_boxed (b);
graphene_point3d_t scale1 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear1[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear2[3] = { 0.f, 0.f, 0.f };
graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
float shear_res = 0.f;
graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
ClutterMatrix res;
clutter_matrix_init_identity (&res);
_clutter_util_matrix_decompose (matrix1,
&scale1, shear1, &rotate1, &translate1,
&perspective1);
_clutter_util_matrix_decompose (matrix2,
&scale2, shear2, &rotate2, &translate2,
&perspective2);
/* perspective */
_clutter_util_vertex4_interpolate (&perspective1, &perspective2, progress, &perspective_res);
res.wx = perspective_res.x;
res.wy = perspective_res.y;
res.wz = perspective_res.z;
res.ww = perspective_res.w;
/* translation */
graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);
cogl_matrix_translate (&res, translate_res.x, translate_res.y, translate_res.z);
/* rotation */
graphene_point3d_interpolate (&rotate1, &rotate2, progress, &rotate_res);
cogl_matrix_rotate (&res, rotate_res.x, 1.0f, 0.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.y, 0.0f, 1.0f, 0.0f);
cogl_matrix_rotate (&res, rotate_res.z, 0.0f, 0.0f, 1.0f);
/* skew */
shear_res = shear1[2] + (shear2[2] - shear1[2]) * progress; /* YZ */
if (shear_res != 0.f)
_clutter_util_matrix_skew_yz (&res, shear_res);
shear_res = shear1[1] + (shear2[1] - shear1[1]) * progress; /* XZ */
if (shear_res != 0.f)
_clutter_util_matrix_skew_xz (&res, shear_res);
shear_res = shear1[0] + (shear2[0] - shear1[0]) * progress; /* XY */
if (shear_res != 0.f)
_clutter_util_matrix_skew_xy (&res, shear_res);
/* scale */
graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res);
cogl_matrix_scale (&res, scale_res.x, scale_res.y, scale_res.z);
g_value_set_boxed (retval, &res);
return TRUE;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterMatrix, clutter_matrix,
clutter_matrix_copy,
clutter_matrix_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_matrix_progress))
/**
* clutter_matrix_alloc:
*
* Allocates enough memory to hold a #ClutterMatrix.
*
* Return value: (transfer full): the newly allocated #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_alloc (void)
{
return g_new0 (ClutterMatrix, 1);
}
/**
* clutter_matrix_free:
* @matrix: (allow-none): a #ClutterMatrix
*
* Frees the memory allocated by clutter_matrix_alloc().
*
* Since: 1.12
*/
void
clutter_matrix_free (ClutterMatrix *matrix)
{
cogl_matrix_free (matrix);
}
/**
* clutter_matrix_init_identity:
* @matrix: a #ClutterMatrix
*
* Initializes @matrix with the identity matrix, i.e.:
*
* |[
* .xx = 1.0, .xy = 0.0, .xz = 0.0, .xw = 0.0
* .yx = 0.0, .yy = 1.0, .yz = 0.0, .yw = 0.0
* .zx = 0.0, .zy = 0.0, .zz = 1.0, .zw = 0.0
* .wx = 0.0, .wy = 0.0, .wz = 0.0, .ww = 1.0
* ]|
*
* Return value: (transfer none): the initialized #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_identity (ClutterMatrix *matrix)
{
cogl_matrix_init_identity (matrix);
return matrix;
}
/**
* clutter_matrix_init_from_array:
* @matrix: a #ClutterMatrix
* @values: (array fixed-size=16): a C array of 16 floating point values,
* representing a 4x4 matrix, with column-major order
*
* Initializes @matrix with the contents of a C array of floating point
* values.
*
* Return value: (transfer none): the initialzed #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_from_array (ClutterMatrix *matrix,
const float values[16])
{
cogl_matrix_init_from_array (matrix, values);
return matrix;
}
/**
* clutter_matrix_init_from_matrix:
* @a: the #ClutterMatrix to initialize
* @b: the #ClutterMatrix to copy
*
* Initializes the #ClutterMatrix @a with the contents of the
* #ClutterMatrix @b.
*
* Return value: (transfer none): the initialized #ClutterMatrix
*
* Since: 1.12
*/
ClutterMatrix *
clutter_matrix_init_from_matrix (ClutterMatrix *a,
const ClutterMatrix *b)
{
return memcpy (a, b, sizeof (ClutterMatrix));
}

View File

@@ -35,7 +35,7 @@
#undef CBZ_L2T_INTERPOLATION
/****************************************************************************
* ClutterBezier -- representation of a cubic bezier curve *
* ClutterBezier -- represenation of a cubic bezier curve *
* (private; a building block for the public bspline object) *
****************************************************************************/
@@ -104,7 +104,7 @@ struct _ClutterBezier
ClutterBezier *
_clutter_bezier_new (void)
{
return g_new0 (ClutterBezier, 1);
return g_slice_new0 (ClutterBezier);
}
void
@@ -112,7 +112,7 @@ _clutter_bezier_free (ClutterBezier * b)
{
if (G_LIKELY (b))
{
g_free (b);
g_slice_free (ClutterBezier, b);
}
}
@@ -213,7 +213,7 @@ sqrti (int number)
* algorithm does not calculate the square root, but its reciprocal ('y'
* below), which is only at the end turned to the inverse value. In order
* for the algorithm to produce satisfactory results, the reciprocal value
* must be represented with sufficient precision; the 16.16 we use
* must be represented with sufficient precission; the 16.16 we use
* elsewhere in clutter is not good enough, and 10.22 is used instead.
*/
_FixedT x;
@@ -236,7 +236,7 @@ sqrti (int number)
/* Now, we convert the float to 10.22 fixed. We exploit the mechanism
* described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf.
*
* We want 22 bit fraction; a single precision float uses 23 bit
* We want 22 bit fraction; a single precission float uses 23 bit
* mantisa, so we only need to add 2^(23-22) (no need for the 1.5
* multiplier as we are only dealing with positive numbers).
*
@@ -256,7 +256,7 @@ sqrti (int number)
flt2.i = (flt2.i >> 11) * (y_1 >> 11);
/* If the original argument is less than 342, we do another
* iteration to improve precision (for arguments >= 342, the single
* iteration to improve precission (for arguments >= 342, the single
* iteration produces generally better results).
*/
if (x < 171)

View File

@@ -23,9 +23,8 @@
*/
/**
* ClutterBinLayout:
*
* A simple layout manager
* SECTION:clutter-bin-layout
* @short_description: A simple layout manager
*
* #ClutterBinLayout is a layout manager which implements the following
* policy:
@@ -40,6 +39,8 @@
*
* The [bin-layout example](https://git.gnome.org/browse/clutter/tree/examples/bin-layout.c?h=clutter-1.18)
* shows how to pack actors inside a #ClutterBinLayout.
*
* #ClutterBinLayout is available since Clutter 1.2
*/
#include "clutter-build-config.h"
@@ -405,7 +406,8 @@ get_actor_align_factor (ClutterActorAlign alignment)
static void
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
const ClutterActorBox *allocation)
const ClutterActorBox *allocation,
ClutterAllocationFlags flags)
{
gfloat allocation_x, allocation_y;
gfloat available_w, available_h;
@@ -513,7 +515,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
clutter_actor_allocate_align_fill (child, &child_alloc,
x_align, y_align,
x_fill, y_fill);
x_fill, y_fill,
flags);
}
}
@@ -618,6 +621,8 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
* The default horizontal alignment policy for actors managed
* by the #ClutterBinLayout
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:x-expand and the
* #ClutterActor:x-align properties on #ClutterActor instead.
*/
@@ -636,6 +641,8 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
* The default vertical alignment policy for actors managed
* by the #ClutterBinLayout
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:y-expand and the
* #ClutterActor:y-align properties on #ClutterActor instead.
*/
@@ -679,6 +686,8 @@ clutter_bin_layout_init (ClutterBinLayout *self)
* Creates a new #ClutterBinLayout layout manager
*
* Return value: the newly created layout manager
*
* Since: 1.2
*/
ClutterLayoutManager *
clutter_bin_layout_new (ClutterBinAlignment x_align,

View File

@@ -44,6 +44,14 @@ typedef struct _ClutterBinLayout ClutterBinLayout;
typedef struct _ClutterBinLayoutPrivate ClutterBinLayoutPrivate;
typedef struct _ClutterBinLayoutClass ClutterBinLayoutClass;
/**
* ClutterBinLayout:
*
* The #ClutterBinLayout structure contains only private data
* and should be accessed using the provided API
*
* Since: 1.2
*/
struct _ClutterBinLayout
{
/*< private >*/
@@ -57,6 +65,8 @@ struct _ClutterBinLayout
*
* The #ClutterBinLayoutClass structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.2
*/
struct _ClutterBinLayoutClass
{

View File

@@ -23,29 +23,27 @@
*/
/**
* ClutterBindConstraint:
*
* A constraint binding the position or size of an actor
* SECTION:clutter-bind-constraint
* @Title: ClutterBindConstraint
* @Short_Description: A constraint binding the position or size of an actor
*
* #ClutterBindConstraint is a [class@Constraint] that binds the
* position or the size of the [class@Actor] to which it is applied
* to the the position or the size of another [class@Actor], or
* #ClutterBindConstraint is a #ClutterConstraint that binds the
* position or the size of the #ClutterActor to which it is applied
* to the the position or the size of another #ClutterActor, or
* "source".
*
* An offset can be applied to the constraint, to avoid overlapping. The offset
* can also be animated. For instance, the following code will set up three
* actors to be bound to the same origin:
*
* ```c
* |[<!-- language="C" -->
* // source
* rect[0] = clutter_actor_new ();
* clutter_actor_set_background_color (rect[0], &red_color);
* rect[0] = clutter_rectangle_new_with_color (&red_color);
* clutter_actor_set_position (rect[0], x_pos, y_pos);
* clutter_actor_set_size (rect[0], 100, 100);
*
* // second rectangle
* rect[1] = clutter_actor_new ();
* clutter_actor_set_background_color (rect[1], &green_color);
* rect[1] = clutter_rectangle_new_with_color (&green_color);
* clutter_actor_set_size (rect[1], 100, 100);
* clutter_actor_set_opacity (rect[1], 0);
*
@@ -55,8 +53,7 @@
* clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);
*
* // third rectangle
* rect[2] = clutter_actor_new ();
* clutter_actor_set_background_color (rect[2], &blue_color);
* rect[2] = clutter_rectangle_new_with_color (&blue_color);
* clutter_actor_set_size (rect[2], 100, 100);
* clutter_actor_set_opacity (rect[2], 0);
*
@@ -64,12 +61,12 @@
* clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint);
* constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
* clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint);
* ```
* ]|
*
* The following code animates the second and third rectangles to "expand"
* them horizontally from underneath the first rectangle:
*
* ```c
* |[<!-- language="C" -->
* clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250,
* "@constraints.green-x.offset", 100.0,
* "opacity", 255,
@@ -78,7 +75,9 @@
* "@constraints.blue-x.offset", 200.0,
* "opacity", 255,
* NULL);
* ```
* ]|
*
* #ClutterBindConstraint is available since Clutter 1.4
*/
#include "clutter-build-config.h"
@@ -166,9 +165,6 @@ clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
bind->coordinate == CLUTTER_BIND_ALL))
return;
if (clutter_actor_contains (bind->source, actor))
return;
switch (direction)
{
case CLUTTER_ORIENTATION_HORIZONTAL:
@@ -390,6 +386,8 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
*
* The #ClutterActor must not be contained inside the actor associated
* to the constraint.
*
* Since: 1.4
*/
obj_props[PROP_SOURCE] =
g_param_spec_object ("source",
@@ -402,6 +400,8 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
* ClutterBindConstraint:coordinate:
*
* The coordinate to be bound
*
* Since: 1.4
*/
obj_props[PROP_COORDINATE] =
g_param_spec_enum ("coordinate",
@@ -415,6 +415,8 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
* ClutterBindConstraint:offset:
*
* The offset, in pixels, to be applied to the binding
*
* Since: 1.4
*/
obj_props[PROP_OFFSET] =
g_param_spec_float ("offset",
@@ -449,6 +451,8 @@ clutter_bind_constraint_init (ClutterBindConstraint *self)
* the given @coordinate of the position of @source
*
* Return value: the newly created #ClutterBindConstraint
*
* Since: 1.4
*/
ClutterConstraint *
clutter_bind_constraint_new (ClutterActor *source,
@@ -470,6 +474,8 @@ clutter_bind_constraint_new (ClutterActor *source,
* @source: (allow-none): a #ClutterActor, or %NULL to unset the source
*
* Sets the source #ClutterActor for the constraint
*
* Since: 1.4
*/
void
clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
@@ -535,6 +541,8 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
* Retrieves the #ClutterActor set using clutter_bind_constraint_set_source()
*
* Return value: (transfer none): a pointer to the source actor
*
* Since: 1.4
*/
ClutterActor *
clutter_bind_constraint_get_source (ClutterBindConstraint *constraint)
@@ -550,6 +558,8 @@ clutter_bind_constraint_get_source (ClutterBindConstraint *constraint)
* @coordinate: the coordinate to bind
*
* Sets the coordinate to bind in the constraint
*
* Since: 1.4
*/
void
clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
@@ -575,6 +585,8 @@ clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
* Retrieves the bound coordinate of the constraint
*
* Return value: the bound coordinate
*
* Since: 1.4
*/
ClutterBindCoordinate
clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint)
@@ -591,6 +603,8 @@ clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint)
* @offset: the offset to apply, in pixels
*
* Sets the offset to be applied to the constraint
*
* Since: 1.4
*/
void
clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
@@ -616,6 +630,8 @@ clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
* Retrieves the offset set using clutter_bind_constraint_set_offset()
*
* Return value: the offset, in pixels
*
* Since: 1.4
*/
gfloat
clutter_bind_constraint_get_offset (ClutterBindConstraint *bind)

View File

@@ -37,6 +37,14 @@ G_BEGIN_DECLS
#define CLUTTER_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraint))
#define CLUTTER_IS_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIND_CONSTRAINT))
/**
* ClutterBindConstraint:
*
* #ClutterBindConstraint is an opaque structure
* whose members cannot be directly accessed
*
* Since: 1.4
*/
typedef struct _ClutterBindConstraint ClutterBindConstraint;
typedef struct _ClutterBindConstraintClass ClutterBindConstraintClass;

View File

@@ -22,9 +22,8 @@
*/
/**
* ClutterBindingPool
*
* Pool for key bindings
* SECTION:clutter-binding-pool
* @short_description: Pool for key bindings
*
* #ClutterBindingPool is a data structure holding a set of key bindings.
* Each key binding associates a key symbol (eventually with modifiers)
@@ -39,7 +38,7 @@
* inside their class initialization function and then install actions
* like this:
*
* ```c
* |[<!-- language="C" -->
* static void
* foo_class_init (FooClass *klass)
* {
@@ -56,23 +55,23 @@
* G_CALLBACK (foo_action_move_up),
* NULL, NULL);
* }
* ```
* ]|
*
* The callback has a signature of:
*
* ```c
* |[<!-- language="C" -->
* gboolean (* callback) (GObject *instance,
* const gchar *action_name,
* guint key_val,
* ClutterModifierType modifiers,
* gpointer user_data);
* ```
* ]|
*
* The actor should then override the [signal@Actor::key-press-event] and
* use [method@BindingPool.activate] to match a [struct@KeyEvent] structure
* The actor should then override the #ClutterActor::key-press-event and
* use clutter_binding_pool_activate() to match a #ClutterKeyEvent structure
* to one of the actions:
*
* ```c
* |[<!-- language="C" -->
* ClutterBindingPool *pool;
*
* // retrieve the binding pool for the type of the actor
@@ -85,12 +84,14 @@
* key_event->keyval,
* key_event->modifier_state,
* G_OBJECT (actor));
* ```
* ]|
*
* The [method@BindingPool.activate] function will return %FALSE if
* The clutter_binding_pool_activate() function will return %FALSE if
* no action for the given key binding was found, if the action was
* blocked (using [method@BindingPool.block_action]) or if the
* blocked (using clutter_binding_pool_block_action()) or if the
* key binding handler returned %FALSE.
*
* #ClutterBindingPool is available since Clutter 1.0
*/
#include "clutter-build-config.h"
@@ -188,7 +189,7 @@ binding_entry_new (const gchar *name,
modifiers = modifiers & BINDING_MOD_MASK;
entry = g_new0 (ClutterBindingEntry, 1);
entry = g_slice_new (ClutterBindingEntry);
entry->key_val = key_val;
entry->modifiers = modifiers;
entry->name = (gchar *) g_intern_string (name);
@@ -220,7 +221,7 @@ binding_entry_free (gpointer data)
g_closure_unref (entry->closure);
g_free (entry);
g_slice_free (ClutterBindingEntry, entry);
}
}
@@ -306,6 +307,8 @@ clutter_binding_pool_class_init (ClutterBindingPoolClass *klass)
* ClutterBindingPool:name:
*
* The unique name of the #ClutterBindingPool.
*
* Since: 1.0
*/
obj_props[PROP_NAME] =
g_param_spec_string ("name",
@@ -342,6 +345,8 @@ clutter_binding_pool_init (ClutterBindingPool *pool)
*
* Return value: the newly created binding pool with the given
* name. Use g_object_unref() when done.
*
* Since: 1.0
*/
ClutterBindingPool *
clutter_binding_pool_new (const gchar *name)
@@ -377,13 +382,15 @@ clutter_binding_pool_new (const gchar *name)
* A binding pool for a class can also be retrieved using
* clutter_binding_pool_find() with the class type name:
*
* ```
* |[
* pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance));
* ```
* ]|
*
* Return value: (transfer none): the binding pool for the given class.
* The returned #ClutterBindingPool is owned by Clutter and should not
* be freed directly
*
* Since: 1.0
*/
ClutterBindingPool *
clutter_binding_pool_get_for_class (gpointer klass)
@@ -414,6 +421,8 @@ clutter_binding_pool_get_for_class (gpointer klass)
* Finds the #ClutterBindingPool with @name.
*
* Return value: (transfer none): a pointer to the #ClutterBindingPool, or %NULL
*
* Since: 1.0
*/
ClutterBindingPool *
clutter_binding_pool_find (const gchar *name)
@@ -456,6 +465,8 @@ clutter_binding_pool_find (const gchar *name)
*
* Actions can be blocked with clutter_binding_pool_block_action()
* and then unblocked using clutter_binding_pool_unblock_action().
*
* Since: 1.0
*/
void
clutter_binding_pool_install_action (ClutterBindingPool *pool,
@@ -524,6 +535,8 @@ clutter_binding_pool_install_action (ClutterBindingPool *pool,
*
* Actions can be blocked with clutter_binding_pool_block_action()
* and then unblocked using clutter_binding_pool_unblock_action().
*
* Since: 1.0
*/
void
clutter_binding_pool_install_closure (ClutterBindingPool *pool,
@@ -585,6 +598,8 @@ clutter_binding_pool_install_closure (ClutterBindingPool *pool,
*
* Actions can be blocked with clutter_binding_pool_block_action()
* and then unblocked using clutter_binding_pool_unblock_action().
*
* Since: 1.0
*/
void
clutter_binding_pool_override_action (ClutterBindingPool *pool,
@@ -647,6 +662,8 @@ clutter_binding_pool_override_action (ClutterBindingPool *pool,
*
* Actions can be blocked with clutter_binding_pool_block_action()
* and then unblocked using clutter_binding_pool_unblock_action().
*
* Since: 1.0
*/
void
clutter_binding_pool_override_closure (ClutterBindingPool *pool,
@@ -700,6 +717,8 @@ clutter_binding_pool_override_closure (ClutterBindingPool *pool,
* Return value: the name of the action, if found, or %NULL. The
* returned string is owned by the binding pool and should never
* be modified or freed
*
* Since: 1.0
*/
const gchar *
clutter_binding_pool_find_action (ClutterBindingPool *pool,
@@ -726,6 +745,8 @@ clutter_binding_pool_find_action (ClutterBindingPool *pool,
*
* Removes the action matching the given @key_val, @modifiers pair,
* if any exists.
*
* Since: 1.0
*/
void
clutter_binding_pool_remove_action (ClutterBindingPool *pool,
@@ -811,13 +832,13 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry,
*
* The callback has the following signature:
*
* ```
* |[
* void (* callback) (GObject *gobject,
* const gchar *action_name,
* guint key_val,
* ClutterModifierType modifiers,
* gpointer user_data);
* ```
* ]|
*
* Where the #GObject instance is @gobject and the user data
* is the one passed when installing the action with
@@ -828,6 +849,8 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry,
* will not be invoked, and this function will return %FALSE.
*
* Return value: %TRUE if an action was found and was activated
*
* Since: 1.0
*/
gboolean
clutter_binding_pool_activate (ClutterBindingPool *pool,
@@ -859,6 +882,8 @@ clutter_binding_pool_activate (ClutterBindingPool *pool,
* @action_name: an action name
*
* Blocks all the actions with name @action_name inside @pool.
*
* Since: 1.0
*/
void
clutter_binding_pool_block_action (ClutterBindingPool *pool,
@@ -888,6 +913,8 @@ clutter_binding_pool_block_action (ClutterBindingPool *pool,
* Unblocking an action does not cause the callback bound to it to
* be invoked in case clutter_binding_pool_activate() was called on
* an action previously blocked with clutter_binding_pool_block_action().
*
* Since: 1.0
*/
void
clutter_binding_pool_unblock_action (ClutterBindingPool *pool,

View File

@@ -37,6 +37,14 @@ G_BEGIN_DECLS
#define CLUTTER_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPool))
#define CLUTTER_IS_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BINDING_POOL))
/**
* ClutterBindingPool:
*
* Container of key bindings. The #ClutterBindingPool struct is
* private.
*
* Since: 1.0
*/
typedef struct _ClutterBindingPool ClutterBindingPool;
typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
@@ -54,6 +62,8 @@ typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
*
* Return value: the function should return %TRUE if the key
* binding has been handled, and return %FALSE otherwise
*
* Since: 1.0
*/
typedef gboolean (* ClutterBindingActionFunc) (GObject *gobject,
const gchar *action_name,

View File

@@ -23,12 +23,14 @@
*/
/**
* ClutterBlurEffect:
*
* A blur effect
* SECTION:clutter-blur-effect
* @short_description: A blur effect
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
*
* #ClutterBlurEffect is a sub-class of #ClutterEffect that allows blurring a
* actor and its contents.
*
* #ClutterBlurEffect is available since Clutter 1.4
*/
#define CLUTTER_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
@@ -37,6 +39,8 @@
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-blur-effect.h"
#include "cogl/cogl.h"
@@ -77,6 +81,9 @@ struct _ClutterBlurEffect
gint pixel_step_uniform;
gint tex_width;
gint tex_height;
CoglPipeline *pipeline;
};
@@ -91,33 +98,86 @@ G_DEFINE_TYPE (ClutterBlurEffect,
clutter_blur_effect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static CoglPipeline *
clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect,
CoglTexture *texture)
static gboolean
clutter_blur_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBlurEffect *blur_effect = CLUTTER_BLUR_EFFECT (effect);
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
ClutterEffectClass *parent_class;
if (blur_effect->pixel_step_uniform > -1)
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
self->actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
if (self->actor == NULL)
return FALSE;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
float pixel_step[2];
int tex_width, tex_height;
tex_width = cogl_texture_get_width (texture);
tex_height = cogl_texture_get_height (texture);
pixel_step[0] = 1.0f / tex_width;
pixel_step[1] = 1.0f / tex_height;
cogl_pipeline_set_uniform_float (blur_effect->pipeline,
blur_effect->pixel_step_uniform,
2, /* n_components */
1, /* count */
pixel_step);
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
"or the current GL driver does not implement support "
"for the GLSL shading language.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
cogl_pipeline_set_layer_texture (blur_effect->pipeline, 0, texture);
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
CoglHandle texture;
return cogl_object_ref (blur_effect->pipeline);
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
self->tex_width = cogl_texture_get_width (texture);
self->tex_height = cogl_texture_get_height (texture);
if (self->pixel_step_uniform > -1)
{
gfloat pixel_step[2];
pixel_step[0] = 1.0f / self->tex_width;
pixel_step[1] = 1.0f / self->tex_height;
cogl_pipeline_set_uniform_float (self->pipeline,
self->pixel_step_uniform,
2, /* n_components */
1, /* count */
pixel_step);
}
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
return TRUE;
}
else
return FALSE;
}
static void
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
cogl_pipeline_set_color4ub (self->pipeline,
paint_opacity,
paint_opacity,
paint_opacity,
paint_opacity);
cogl_framebuffer_draw_rectangle (framebuffer,
self->pipeline,
0, 0,
self->tex_width, self->tex_height);
}
static gboolean
@@ -165,10 +225,11 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
gobject_class->dispose = clutter_blur_effect_dispose;
effect_class->pre_paint = clutter_blur_effect_pre_paint;
effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->create_pipeline = clutter_blur_effect_create_pipeline;
offscreen_class->paint_target = clutter_blur_effect_paint_target;
}
static void
@@ -207,6 +268,8 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
* clutter_actor_add_effect()
*
* Return value: the newly created #ClutterBlurEffect or %NULL
*
* Since: 1.4
*/
ClutterEffect *
clutter_blur_effect_new (void)

View File

@@ -37,6 +37,14 @@ G_BEGIN_DECLS
#define CLUTTER_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffect))
#define CLUTTER_IS_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BLUR_EFFECT))
/**
* ClutterBlurEffect:
*
* #ClutterBlurEffect is an opaque structure
* whose members cannot be accessed directly
*
* Since: 1.4
*/
typedef struct _ClutterBlurEffect ClutterBlurEffect;
typedef struct _ClutterBlurEffectClass ClutterBlurEffectClass;

View File

@@ -1,431 +0,0 @@
/*
* Copyright (C) 2020 Endless OS Foundation, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-blur-private.h"
#include "clutter-backend.h"
/**
* SECTION:clutter-blur
* @short_description: Blur textures
*
* #ClutterBlur is a moderately fast gaussian blur implementation.
*
* # Optimizations
*
* There are a number of optimizations in place to make this blur implementation
* real-time. All in all, the implementation performs best when using large
* blur-radii that allow downscaling the texture to smaller sizes, at small
* radii where no downscaling is possible this can easily halve the framerate.
*
* ## Multipass
*
* It is implemented in 2 passes: vertical and horizontal.
*
* ## Downscaling
*
* #ClutterBlur uses dynamic downscaling to speed up blurring. Downscaling
* happens in factors of 2 (the image is downscaled either by 2, 4, 8, 16, …)
* and depends on the blur radius, the texture size, among others.
*
* The texture is drawn into a downscaled framebuffer; the blur passes are
* applied on the downscaled texture contents; and finally, the blurred
* contents are drawn
* upscaled again.
*
* ## Hardware Interpolation
*
* This blur implementation cuts down the number of sampling operations by
* exploiting the hardware interpolation that is performed when sampling between
* pixel boundaries. This technique is described at:
*
* http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
*
* ## Incremental gauss-factor calculation
*
* The kernel values for the gaussian kernel are computed incrementally instead
* of running the expensive calculations multiple times inside the blur shader.
* The implementation is based on the algorithm presented by K. Turkowski in
* GPU Gems 3, chapter 40:
*
* https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html
*
*/
static const char *gaussian_blur_glsl_declarations =
"uniform float sigma; \n"
"uniform float pixel_step; \n"
"uniform vec2 direction; \n";
static const char *gaussian_blur_glsl =
" vec2 uv = vec2 (cogl_tex_coord.st); \n"
" \n"
" vec3 gauss_coefficient; \n"
" gauss_coefficient.x = 1.0 / (sqrt (2.0 * 3.14159265) * sigma); \n"
" gauss_coefficient.y = exp (-0.5 / (sigma * sigma)); \n"
" gauss_coefficient.z = gauss_coefficient.y * gauss_coefficient.y; \n"
" \n"
" float gauss_coefficient_total = gauss_coefficient.x; \n"
" \n"
" vec4 ret = texture2D (cogl_sampler, uv) * gauss_coefficient.x; \n"
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
" \n"
" int n_steps = int (ceil (1.5 * sigma)) * 2; \n"
" \n"
" for (int i = 1; i <= n_steps; i += 2) { \n"
" float coefficient_subtotal = gauss_coefficient.x; \n"
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
" coefficient_subtotal += gauss_coefficient.x; \n"
" \n"
" float gauss_ratio = gauss_coefficient.x / coefficient_subtotal; \n"
" \n"
" float foffset = float (i) + gauss_ratio; \n"
" vec2 offset = direction * foffset * pixel_step; \n"
" \n"
" ret += texture2D (cogl_sampler, uv + offset) * coefficient_subtotal; \n"
" ret += texture2D (cogl_sampler, uv - offset) * coefficient_subtotal; \n"
" \n"
" gauss_coefficient_total += 2.0 * coefficient_subtotal; \n"
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
" } \n"
" \n"
" cogl_texel = ret / gauss_coefficient_total; \n";
#define MIN_DOWNSCALE_SIZE 256.f
#define MAX_SIGMA 6.f
enum
{
VERTICAL,
HORIZONTAL,
};
typedef struct
{
CoglFramebuffer *framebuffer;
CoglPipeline *pipeline;
CoglTexture *texture;
int orientation;
} BlurPass;
struct _ClutterBlur
{
CoglTexture *source_texture;
float sigma;
float downscale_factor;
BlurPass pass[2];
};
static CoglPipeline*
create_blur_pipeline (void)
{
static CoglPipelineKey blur_pipeline_key = "clutter-blur-pipeline-private";
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglPipeline *blur_pipeline;
blur_pipeline =
cogl_context_get_named_pipeline (ctx, &blur_pipeline_key);
if (G_UNLIKELY (blur_pipeline == NULL))
{
CoglSnippet *snippet;
blur_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (blur_pipeline, 0);
cogl_pipeline_set_layer_filters (blur_pipeline,
0,
COGL_PIPELINE_FILTER_LINEAR,
COGL_PIPELINE_FILTER_LINEAR);
cogl_pipeline_set_layer_wrap_mode (blur_pipeline,
0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
gaussian_blur_glsl_declarations,
NULL);
cogl_snippet_set_replace (snippet, gaussian_blur_glsl);
cogl_pipeline_add_layer_snippet (blur_pipeline, 0, snippet);
cogl_object_unref (snippet);
cogl_context_set_named_pipeline (ctx, &blur_pipeline_key, blur_pipeline);
}
return cogl_pipeline_copy (blur_pipeline);
}
static void
update_blur_uniforms (ClutterBlur *blur,
BlurPass *pass)
{
gboolean vertical = pass->orientation == VERTICAL;
int sigma_uniform;
int pixel_step_uniform;
int direction_uniform;
pixel_step_uniform =
cogl_pipeline_get_uniform_location (pass->pipeline, "pixel_step");
if (pixel_step_uniform > -1)
{
float pixel_step;
if (vertical)
pixel_step = 1.f / cogl_texture_get_height (pass->texture);
else
pixel_step = 1.f / cogl_texture_get_width (pass->texture);
cogl_pipeline_set_uniform_1f (pass->pipeline,
pixel_step_uniform,
pixel_step);
}
sigma_uniform = cogl_pipeline_get_uniform_location (pass->pipeline, "sigma");
if (sigma_uniform > -1)
{
cogl_pipeline_set_uniform_1f (pass->pipeline,
sigma_uniform,
blur->sigma / blur->downscale_factor);
}
direction_uniform =
cogl_pipeline_get_uniform_location (pass->pipeline, "direction");
if (direction_uniform > -1)
{
gboolean horizontal = !vertical;
float direction[2] = {
horizontal,
vertical,
};
cogl_pipeline_set_uniform_float (pass->pipeline,
direction_uniform,
2, 1,
direction);
}
}
static gboolean
create_fbo (ClutterBlur *blur,
BlurPass *pass)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
float scaled_height;
float scaled_width;
float height;
float width;
g_clear_pointer (&pass->texture, cogl_object_unref);
g_clear_object (&pass->framebuffer);
width = cogl_texture_get_width (blur->source_texture);
height = cogl_texture_get_height (blur->source_texture);
scaled_width = floorf (width / blur->downscale_factor);
scaled_height = floorf (height / blur->downscale_factor);
pass->texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
scaled_width,
scaled_height));
if (!pass->texture)
return FALSE;
pass->framebuffer =
COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (pass->texture));
if (!pass->framebuffer)
{
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
return FALSE;
}
cogl_framebuffer_orthographic (pass->framebuffer,
0.0, 0.0,
scaled_width,
scaled_height,
0.0, 1.0);
return TRUE;
}
static gboolean
setup_blur_pass (ClutterBlur *blur,
BlurPass *pass,
int orientation,
CoglTexture *texture)
{
pass->orientation = orientation;
pass->pipeline = create_blur_pipeline ();
cogl_pipeline_set_layer_texture (pass->pipeline, 0, texture);
if (!create_fbo (blur, pass))
return FALSE;
update_blur_uniforms (blur, pass);
return TRUE;
}
static float
calculate_downscale_factor (float width,
float height,
float sigma)
{
float downscale_factor = 1.f;
float scaled_width = width;
float scaled_height = height;
float scaled_sigma = sigma;
/* This is the algorithm used by Firefox; keep downscaling until either the
* blur radius is lower than the threshold, or the downscaled texture is too
* small.
*/
while (scaled_sigma > MAX_SIGMA &&
scaled_width > MIN_DOWNSCALE_SIZE &&
scaled_height > MIN_DOWNSCALE_SIZE)
{
downscale_factor *= 2.f;
scaled_width = width / downscale_factor;
scaled_height = height / downscale_factor;
scaled_sigma = sigma / downscale_factor;
}
return downscale_factor;
}
static void
apply_blur_pass (BlurPass *pass)
{
CoglColor transparent;
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_framebuffer_clear (pass->framebuffer,
COGL_BUFFER_BIT_COLOR,
&transparent);
cogl_framebuffer_draw_rectangle (pass->framebuffer,
pass->pipeline,
0, 0,
cogl_texture_get_width (pass->texture),
cogl_texture_get_height (pass->texture));
}
static void
clear_blur_pass (BlurPass *pass)
{
g_clear_pointer (&pass->pipeline, cogl_object_unref);
g_clear_pointer (&pass->texture, cogl_object_unref);
g_clear_object (&pass->framebuffer);
}
/**
* clutter_blur_new:
* @texture: a #CoglTexture
* @sigma: blur sigma
*
* Creates a new #ClutterBlur.
*
* Returns: (transfer full) (nullable): A newly created #ClutterBlur
*/
ClutterBlur *
clutter_blur_new (CoglTexture *texture,
float sigma)
{
ClutterBlur *blur;
unsigned int height;
unsigned int width;
BlurPass *hpass;
BlurPass *vpass;
g_return_val_if_fail (texture != NULL, NULL);
g_return_val_if_fail (sigma >= 0.0, NULL);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
blur = g_new0 (ClutterBlur, 1);
blur->sigma = sigma;
blur->source_texture = cogl_object_ref (texture);
blur->downscale_factor = calculate_downscale_factor (width, height, sigma);
if (G_APPROX_VALUE (sigma, 0.0, FLT_EPSILON))
goto out;
vpass = &blur->pass[VERTICAL];
hpass = &blur->pass[HORIZONTAL];
if (!setup_blur_pass (blur, vpass, VERTICAL, texture) ||
!setup_blur_pass (blur, hpass, HORIZONTAL, vpass->texture))
{
clutter_blur_free (blur);
return NULL;
}
out:
return g_steal_pointer (&blur);
}
/**
* clutter_blur_apply:
* @blur: a #ClutterBlur
*
* Applies the blur. The resulting texture can be retrieved by
* clutter_blur_get_texture().
*/
void
clutter_blur_apply (ClutterBlur *blur)
{
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
return;
apply_blur_pass (&blur->pass[VERTICAL]);
apply_blur_pass (&blur->pass[HORIZONTAL]);
}
/**
* clutter_blur_get_texture:
* @blur: a #ClutterBlur
*
* Retrieves the texture where the blurred contents are stored. The
* contents are undefined until clutter_blur_apply() is called.
*
* Returns: (transfer none): a #CoglTexture
*/
CoglTexture *
clutter_blur_get_texture (ClutterBlur *blur)
{
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
return blur->source_texture;
else
return blur->pass[HORIZONTAL].texture;
}
/**
* clutter_blur_free:
* @blur: A #ClutterBlur
*
* Frees @blur.
*/
void
clutter_blur_free (ClutterBlur *blur)
{
g_assert (blur);
clear_blur_pass (&blur->pass[VERTICAL]);
clear_blur_pass (&blur->pass[HORIZONTAL]);
cogl_clear_object (&blur->source_texture);
g_free (blur);
}

File diff suppressed because it is too large Load Diff

View File

@@ -47,6 +47,14 @@ typedef struct _ClutterBoxLayout ClutterBoxLayout;
typedef struct _ClutterBoxLayoutPrivate ClutterBoxLayoutPrivate;
typedef struct _ClutterBoxLayoutClass ClutterBoxLayoutClass;
/**
* ClutterBoxLayout:
*
* The #ClutterBoxLayout structure contains only private data
* and should be accessed using the provided API
*
* Since: 1.2
*/
struct _ClutterBoxLayout
{
/*< private >*/
@@ -60,6 +68,8 @@ struct _ClutterBoxLayout
*
* The #ClutterBoxLayoutClass structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.2
*/
struct _ClutterBoxLayoutClass
{
@@ -89,6 +99,69 @@ void clutter_box_layout_set_homogeneous (ClutterBoxLayou
gboolean homogeneous);
CLUTTER_EXPORT
gboolean clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout);
CLUTTER_EXPORT
void clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
gboolean pack_start);
CLUTTER_EXPORT
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
CLUTTER_DEPRECATED_FOR(clutter_box_layout_set_orientation)
void clutter_box_layout_set_vertical (ClutterBoxLayout *layout,
gboolean vertical);
CLUTTER_DEPRECATED_FOR(clutter_box_layout_get_orientation)
gboolean clutter_box_layout_get_vertical (ClutterBoxLayout *layout);
CLUTTER_EXPORT
void clutter_box_layout_pack (ClutterBoxLayout *layout,
ClutterActor *actor,
gboolean expand,
gboolean x_fill,
gboolean y_fill,
ClutterBoxAlignment x_align,
ClutterBoxAlignment y_align);
CLUTTER_DEPRECATED
void clutter_box_layout_set_alignment (ClutterBoxLayout *layout,
ClutterActor *actor,
ClutterBoxAlignment x_align,
ClutterBoxAlignment y_align);
CLUTTER_DEPRECATED
void clutter_box_layout_get_alignment (ClutterBoxLayout *layout,
ClutterActor *actor,
ClutterBoxAlignment *x_align,
ClutterBoxAlignment *y_align);
CLUTTER_DEPRECATED
void clutter_box_layout_set_fill (ClutterBoxLayout *layout,
ClutterActor *actor,
gboolean x_fill,
gboolean y_fill);
CLUTTER_DEPRECATED
void clutter_box_layout_get_fill (ClutterBoxLayout *layout,
ClutterActor *actor,
gboolean *x_fill,
gboolean *y_fill);
CLUTTER_DEPRECATED
void clutter_box_layout_set_expand (ClutterBoxLayout *layout,
ClutterActor *actor,
gboolean expand);
CLUTTER_DEPRECATED
gboolean clutter_box_layout_get_expand (ClutterBoxLayout *layout,
ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_box_layout_set_use_animations (ClutterBoxLayout *layout,
gboolean animate);
CLUTTER_DEPRECATED
gboolean clutter_box_layout_get_use_animations (ClutterBoxLayout *layout);
CLUTTER_DEPRECATED
void clutter_box_layout_set_easing_mode (ClutterBoxLayout *layout,
gulong mode);
CLUTTER_DEPRECATED
gulong clutter_box_layout_get_easing_mode (ClutterBoxLayout *layout);
CLUTTER_DEPRECATED
void clutter_box_layout_set_easing_duration (ClutterBoxLayout *layout,
guint msecs);
CLUTTER_DEPRECATED
guint clutter_box_layout_get_easing_duration (ClutterBoxLayout *layout);
G_END_DECLS

View File

@@ -23,12 +23,14 @@
*/
/**
* ClutterBrightnessContrastEffect:
*
* Increase/decrease brightness and/or contrast of actor.
* SECTION:clutter-brightness-contrast-effect
* @short_description: Increase/decrease brightness and/or contrast of actor.
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
*
* #ClutterBrightnessContrastEffect is a sub-class of #ClutterEffect that
* changes the overall brightness of a #ClutterActor.
*
* #ClutterBrightnessContrastEffect is available since Clutter 1.10
*/
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
@@ -39,6 +41,8 @@
#include <math.h>
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-brightness-contrast-effect.h"
#include <cogl/cogl.h>
@@ -65,6 +69,9 @@ struct _ClutterBrightnessContrastEffect
gint brightness_offset_uniform;
gint contrast_uniform;
gint tex_width;
gint tex_height;
CoglPipeline *pipeline;
};
@@ -122,33 +129,75 @@ will_have_no_effect (ClutterBrightnessContrastEffect *self)
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
}
static CoglPipeline *
clutter_brightness_contrast_effect_create_pipeline (ClutterOffscreenEffect *effect,
CoglTexture *texture)
{
ClutterBrightnessContrastEffect *self =
CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
return cogl_object_ref (self->pipeline);
}
static gboolean
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
ClutterEffectClass *parent_class;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
if (will_have_no_effect (self))
return FALSE;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ClutterBrightnessContrastEffect: the "
"graphics hardware or the current GL driver does not "
"implement support for the GLSL shading language. The "
"effect will be disabled.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
parent_class =
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
CoglHandle texture;
return parent_class->pre_paint (effect, node, paint_context);
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
self->tex_width = cogl_texture_get_width (texture);
self->tex_height = cogl_texture_get_height (texture);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
return TRUE;
}
else
return FALSE;
}
static void
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
paint_opacity = clutter_actor_get_paint_opacity (actor);
cogl_pipeline_set_color4ub (self->pipeline,
paint_opacity,
paint_opacity,
paint_opacity,
paint_opacity);
cogl_framebuffer_draw_rectangle (framebuffer,
self->pipeline,
0, 0,
self->tex_width, self->tex_height);
}
static void
@@ -248,7 +297,7 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
ClutterOffscreenEffectClass *offscreen_class;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->create_pipeline = clutter_brightness_contrast_effect_create_pipeline;
offscreen_class->paint_target = clutter_brightness_contrast_effect_paint_target;
effect_class->pre_paint = clutter_brightness_contrast_effect_pre_paint;
@@ -266,6 +315,8 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
* to indicate no change; values smaller than 127 indicate a decrease
* in brightness, and values larger than 127 indicate an increase in
* brightness.
*
* Since: 1.10
*/
obj_props[PROP_BRIGHTNESS] =
clutter_param_spec_color ("brightness",
@@ -284,6 +335,8 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
* to indicate no change; values smaller than 127 indicate a decrease
* in contrast, and values larger than 127 indicate an increase in
* contrast.
*
* Since: 1.10
*/
obj_props[PROP_CONTRAST] =
clutter_param_spec_color ("contrast",
@@ -414,6 +467,8 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
* Return value: (transfer full): the newly created
* #ClutterBrightnessContrastEffect or %NULL. Use g_object_unref() when
* done.
*
* Since: 1.10
*/
ClutterEffect *
clutter_brightness_contrast_effect_new (void)
@@ -431,6 +486,8 @@ clutter_brightness_contrast_effect_new (void)
* The range for each component is [-1.0, 1.0] where 0.0 designates no change,
* values below 0.0 mean a decrease in brightness, and values above indicate
* an increase.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect,
@@ -467,6 +524,8 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
* change in brightness
*
* Retrieves the change in brightness used by @effect.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffect *effect,
@@ -494,6 +553,8 @@ clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffe
* The range of @brightness is [-1.0, 1.0], where 0.0 designates no change;
* a value below 0.0 indicates a decrease in brightness; and a value
* above 0.0 indicates an increase of brightness.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffect *effect,
@@ -515,6 +576,8 @@ clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffe
* The range for each component is [-1.0, 1.0] where 0.0 designates no change,
* values below 0.0 mean a decrease in contrast, and values above indicate
* an increase.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect,
@@ -551,6 +614,8 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
* change in contrast
*
* Retrieves the contrast value used by @effect.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect *effect,
@@ -578,6 +643,8 @@ clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect
* The range for @contrast is [-1.0, 1.0], where 0.0 designates no change;
* a value below 0.0 indicates a decrease in contrast; and a value above
* 0.0 indicates an increase.
*
* Since: 1.10
*/
void
clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect,

View File

@@ -38,6 +38,14 @@ G_BEGIN_DECLS
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffect))
#define CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT))
/**
* ClutterBrightnessContrastEffect:
*
* #ClutterBrightnessContrastEffect is an opaque structure
* whose members cannot be directly accessed
*
* Since: 1.10
*/
typedef struct _ClutterBrightnessContrastEffect ClutterBrightnessContrastEffect;
typedef struct _ClutterBrightnessContrastEffectClass ClutterBrightnessContrastEffectClass;

View File

@@ -4,5 +4,11 @@
/* List of Cogl drivers */
#mesondefine CLUTTER_DRIVERS
/* Have evdev support for input handling */
#mesondefine HAVE_EVDEV
/* Building with libwacom for advanced tablet management */
#mesondefine HAVE_LIBWACOM
/* Supports PangoFt2 */
#mesondefine HAVE_PANGO_FT2

View File

@@ -40,13 +40,15 @@
* Utility function for setting the source color of @cr using
* a #ClutterColor. This function is the equivalent of:
*
* ```c
* |[
* cairo_set_source_rgba (cr,
* color->red / 255.0,
* color->green / 255.0,
* color->blue / 255.0,
* color->alpha / 255.0);
* ```
* ]|
*
* Since: 1.0
*/
void
clutter_cairo_set_source_color (cairo_t *cr,
@@ -73,6 +75,8 @@ clutter_cairo_set_source_color (cairo_t *cr,
* @cr: a Cairo context
*
* Utility function to clear a Cairo context.
*
* Since: 1.12
*/
void
clutter_cairo_clear (cairo_t *cr)

View File

@@ -36,6 +36,8 @@ G_BEGIN_DECLS
* The #CoglPixelFormat to be used when uploading image data from
* and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and
* %CAIRO_FORMAT_RGB24 as #cairo_format_t.
*
* Since: 1.8
*/
/* Cairo stores the data in native byte order as ARGB but Cogl's pixel

View File

@@ -23,9 +23,10 @@
*/
/**
* ClutterCanvas:
*
* Content for 2D painting
* SECTION:clutter-canvas
* @Title: ClutterCanvas
* @Short_Description: Content for 2D painting
* @See_Also: #ClutterContent
*
* The #ClutterCanvas class is a #ClutterContent implementation that allows
* drawing using the Cairo API on a 2D surface.
@@ -36,7 +37,9 @@
* signal when invalidated using clutter_content_invalidate().
*
* See [canvas.c](https://git.gnome.org/browse/clutter/tree/examples/canvas.c?h=clutter-1.18)
* for an example of how to use #ClutterCanvas..
* for an example of how to use #ClutterCanvas.
*
* #ClutterCanvas is available since Clutter 1.10.
*/
#include "clutter-build-config.h"
@@ -47,6 +50,8 @@
#include "clutter-canvas.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-actor-private.h"
#include "clutter-backend.h"
#include "clutter-cairo.h"
@@ -232,6 +237,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
* ClutterCanvas:width:
*
* The width of the canvas.
*
* Since: 1.10
*/
obj_props[PROP_WIDTH] =
g_param_spec_int ("width",
@@ -246,6 +253,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
* ClutterCanvas:height:
*
* The height of the canvas.
*
* Since: 1.10
*/
obj_props[PROP_HEIGHT] =
g_param_spec_int ("height",
@@ -286,6 +295,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
*
* Return value: %TRUE if the signal emission should stop, and
* %FALSE otherwise
*
* Since: 1.10
*/
canvas_signals[DRAW] =
g_signal_new (I_("draw"),
@@ -333,7 +344,9 @@ clutter_canvas_paint_content (ClutterContent *content,
g_clear_pointer (&priv->texture, cogl_object_unref);
if (priv->texture == NULL)
priv->texture = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (priv->buffer));
priv->texture = cogl_texture_new_from_bitmap (priv->buffer,
COGL_TEXTURE_NO_SLICING,
CLUTTER_CAIRO_FORMAT_ARGB32);
if (priv->texture == NULL)
return;
@@ -502,6 +515,8 @@ clutter_content_iface_init (ClutterContentInterface *iface)
*
* Return value: (transfer full): The newly allocated instance of
* #ClutterCanvas. Use g_object_unref() when done.
*
* Since: 1.10
*/
ClutterContent *
clutter_canvas_new (void)
@@ -564,13 +579,15 @@ clutter_canvas_invalidate_internal (ClutterCanvas *canvas,
* the size, you can use the return value of the function to conditionally
* call clutter_content_invalidate():
*
* ```c
* |[
* if (!clutter_canvas_set_size (canvas, width, height))
* clutter_content_invalidate (CLUTTER_CONTENT (canvas));
* ```
* ]|
*
* Return value: this function returns %TRUE if the size change
* caused a content invalidation, and %FALSE otherwise
*
* Since: 1.10
*/
gboolean
clutter_canvas_set_size (ClutterCanvas *canvas,

View File

@@ -44,6 +44,15 @@ typedef struct _ClutterCanvas ClutterCanvas;
typedef struct _ClutterCanvasPrivate ClutterCanvasPrivate;
typedef struct _ClutterCanvasClass ClutterCanvasClass;
/**
* ClutterCanvas:
*
* The #ClutterCanvas structure contains
* private data and should only be accessed using the provided
* API.
*
* Since: 1.10
*/
struct _ClutterCanvas
{
/*< private >*/
@@ -58,6 +67,8 @@ struct _ClutterCanvas
*
* The #ClutterCanvasClass structure contains
* private data.
*
* Since: 1.10
*/
struct _ClutterCanvasClass
{

View File

@@ -25,43 +25,16 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* ClutterChildMeta:
*
* Base interface for container specific state for child actors.
*
* A child data is meant to be used when you need to keep track
* of information about each individual child added to a container.
* SECTION:clutter-child-meta
* @short_description: Wrapper for actors inside a container
*
* In order to use it you should create your own subclass of
* #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
* interface member to your subclass type, like:
* #ClutterChildMeta is a wrapper object created by #ClutterContainer
* implementations in order to store child-specific data and properties.
*
* ```c
* static void
* my_container_iface_init (ClutterContainerIface *iface)
* {
* // set the rest of the #ClutterContainer vtable
* A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer.
*
* container_iface->child_meta_type = MY_TYPE_CHILD_META;
* }
* ```
*
* This will automatically create a #ClutterChildMeta of type
* `MY_TYPE_CHILD_META` for every actor that is added to the container.
*
* The child data for an actor can be retrieved using the
* clutter_container_get_child_meta() function.
*
* The properties of the data and your subclass can be manipulated with
* clutter_container_child_set() and clutter_container_child_get() which
* act like g_object_set() and g_object_get().
*
* You can provide hooks for your own storage as well as control the
* instantiation by overriding the #ClutterContainerIface virtual functions
* #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
* and #ClutterContainerIface.get_child_meta().
* #ClutterChildMeta is available since Clutter 0.8
*/
#include "clutter-build-config.h"
@@ -145,6 +118,8 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass)
* ClutterChildMeta:container:
*
* The #ClutterContainer that created this #ClutterChildMeta.
*
* Since: 0.8
*/
obj_props[PROP_CONTAINER] =
g_param_spec_object ("container",
@@ -158,6 +133,8 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass)
* ClutterChildMeta:actor:
*
* The #ClutterActor being wrapped by this #ClutterChildMeta
*
* Since: 0.8
*/
obj_props[PROP_ACTOR] =
g_param_spec_object ("actor",
@@ -184,6 +161,8 @@ clutter_child_meta_init (ClutterChildMeta *self)
* Retrieves the container using @data
*
* Return value: (transfer none): a #ClutterContainer
*
* Since: 0.8
*/
ClutterContainer *
clutter_child_meta_get_container (ClutterChildMeta *data)
@@ -200,6 +179,8 @@ clutter_child_meta_get_container (ClutterChildMeta *data)
* Retrieves the actor wrapped by @data
*
* Return value: (transfer none): a #ClutterActor
*
* Since: 0.8
*/
ClutterActor *
clutter_child_meta_get_actor (ClutterChildMeta *data)

View File

@@ -46,6 +46,46 @@ G_BEGIN_DECLS
typedef struct _ClutterChildMetaClass ClutterChildMetaClass;
/**
* ClutterChildMeta:
* @container: the container handling this data
* @actor: the actor wrapped by this data
*
* Base interface for container specific state for child actors. A child
* data is meant to be used when you need to keep track of information
* about each individual child added to a container.
*
* In order to use it you should create your own subclass of
* #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
* interface member to your subclass type, like:
*
* |[
* static void
* my_container_iface_init (ClutterContainerIface *iface)
* {
* // set the rest of the #ClutterContainer vtable
*
* container_iface->child_meta_type = MY_TYPE_CHILD_META;
* }
* ]|
*
* This will automatically create a #ClutterChildMeta of type
* `MY_TYPE_CHILD_META` for every actor that is added to the container.
*
* The child data for an actor can be retrieved using the
* clutter_container_get_child_meta() function.
*
* The properties of the data and your subclass can be manipulated with
* clutter_container_child_set() and clutter_container_child_get() which
* act like g_object_set() and g_object_get().
*
* You can provide hooks for your own storage as well as control the
* instantiation by overriding the #ClutterContainerIface virtual functions
* #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
* and #ClutterContainerIface.get_child_meta().
*
* Since: 0.8
*/
struct _ClutterChildMeta
{
/*< private >*/
@@ -60,6 +100,8 @@ struct _ClutterChildMeta
* ClutterChildMetaClass:
*
* The #ClutterChildMetaClass contains only private data
*
* Since: 0.8
*/
struct _ClutterChildMetaClass
{

View File

@@ -23,39 +23,39 @@
*/
/**
* ClutterClickAction:
*
* Action for clickable actors
* SECTION:clutter-click-action
* @Title: ClutterClickAction
* @Short_Description: Action for clickable actors
*
* #ClutterClickAction is a sub-class of [class@Action] that implements
* #ClutterClickAction is a sub-class of #ClutterAction that implements
* the logic for clickable actors, by using the low level events of
* [class@Actor], such as [signal@Actor::button-press-event] and
* [signal@Actor::button-release-event], to synthesize the high level
* [signal@ClickAction::clicked] signal.
* #ClutterActor, such as #ClutterActor::button-press-event and
* #ClutterActor::button-release-event, to synthesize the high level
* #ClutterClickAction::clicked signal.
*
* To use #ClutterClickAction you just need to apply it to a [class@Actor]
* using [method@Actor.add_action] and connect to the
* [signal@ClickAction::clicked] signal:
* To use #ClutterClickAction you just need to apply it to a #ClutterActor
* using clutter_actor_add_action() and connect to the
* #ClutterClickAction::clicked signal:
*
* ```c
* |[
* ClutterAction *action = clutter_click_action_new ();
*
* clutter_actor_add_action (actor, action);
*
* g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL);
* ```
* ]|
*
* #ClutterClickAction also supports long press gestures: a long press is
* activated if the pointer remains pressed within a certain threshold (as
* defined by the [property@ClickAction:long-press-threshold] property) for a
* defined by the #ClutterClickAction:long-press-threshold property) for a
* minimum amount of time (as the defined by the
* [property@ClickAction:long-press-duration] property).
* The [signal@ClickAction::long-press] signal is emitted multiple times,
* using different [enum@LongPressState] values; to handle long presses
* you should connect to the [signal@ClickAction::long-press] signal and
* #ClutterClickAction:long-press-duration property).
* The #ClutterClickAction::long-press signal is emitted multiple times,
* using different #ClutterLongPressState values; to handle long presses
* you should connect to the #ClutterClickAction::long-press signal and
* handle the different states:
*
* ```c
* |[
* static gboolean
* on_long_press (ClutterClickAction *action,
* ClutterActor *actor,
@@ -64,27 +64,32 @@
* switch (state)
* {
* case CLUTTER_LONG_PRESS_QUERY:
* // return TRUE if the actor should support long press
* // gestures, and FALSE otherwise; this state will be
* // emitted on button presses
* /&ast; return TRUE if the actor should support long press
* &ast; gestures, and FALSE otherwise; this state will be
* &ast; emitted on button presses
* &ast;/
* return TRUE;
*
* case CLUTTER_LONG_PRESS_ACTIVATE:
* // this state is emitted if the minimum duration has
* // been reached without the gesture being cancelled.
* // the return value is not used
* /&ast; this state is emitted if the minimum duration has
* &ast; been reached without the gesture being cancelled.
* &ast; the return value is not used
* &ast;/
* return TRUE;
*
* case CLUTTER_LONG_PRESS_CANCEL:
* // this state is emitted if the long press was cancelled;
* // for instance, the pointer went outside the actor or the
* // allowed threshold, or the button was released before
* // the minimum duration was reached. the return value is
* // not used
* /&ast; this state is emitted if the long press was cancelled;
* &ast; for instance, the pointer went outside the actor or the
* &ast; allowed threshold, or the button was released before
* &ast; the minimum duration was reached. the return value is
* &ast; not used
* &ast;/
* return FALSE;
* }
* }
* ```
* ]|
*
* #ClutterClickAction is available since Clutter 1.4
*/
#include "clutter-build-config.h"
@@ -100,6 +105,8 @@ struct _ClutterClickActionPrivate
{
ClutterActor *stage;
gulong event_id;
gulong capture_id;
guint long_press_id;
gint long_press_threshold;
@@ -107,7 +114,7 @@ struct _ClutterClickActionPrivate
gint drag_threshold;
guint press_button;
ClutterInputDevice *press_device;
gint press_device_id;
ClutterEventSequence *press_sequence;
ClutterModifierType modifier_state;
gfloat press_x;
@@ -143,12 +150,16 @@ static guint click_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION)
/* forward declaration */
static gboolean on_captured_event (ClutterActor *stage,
ClutterEvent *event,
ClutterClickAction *action);
static inline void
click_action_set_pressed (ClutterClickAction *action,
gboolean is_pressed)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
is_pressed = !!is_pressed;
@@ -163,8 +174,7 @@ static inline void
click_action_set_held (ClutterClickAction *action,
gboolean is_held)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
is_held = !!is_held;
@@ -179,8 +189,7 @@ static gboolean
click_action_emit_long_press (gpointer data)
{
ClutterClickAction *action = data;
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
ClutterActor *actor;
gboolean result;
@@ -193,6 +202,8 @@ click_action_emit_long_press (gpointer data)
CLUTTER_LONG_PRESS_ACTIVATE,
&result);
g_clear_signal_handler (&priv->capture_id, priv->stage);
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@@ -202,8 +213,7 @@ click_action_emit_long_press (gpointer data)
static inline void
click_action_query_long_press (ClutterClickAction *action)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
ClutterActor *actor;
gboolean result = FALSE;
gint timeout;
@@ -239,8 +249,7 @@ click_action_query_long_press (ClutterClickAction *action)
static inline void
click_action_cancel_long_press (ClutterClickAction *action)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
if (priv->long_press_id != 0)
{
@@ -258,66 +267,33 @@ click_action_cancel_long_press (ClutterClickAction *action)
}
}
static inline gboolean
event_within_drag_threshold (ClutterClickAction *click_action,
const ClutterEvent *event)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (click_action);
float motion_x, motion_y;
float delta_x, delta_y;
clutter_event_get_coords (event, &motion_x, &motion_y);
delta_x = ABS (motion_x - priv->press_x);
delta_y = ABS (motion_y - priv->press_y);
return delta_x <= priv->drag_threshold && delta_y <= priv->drag_threshold;
}
static gboolean
clutter_click_action_handle_event (ClutterAction *action,
const ClutterEvent *event)
on_event (ClutterActor *actor,
ClutterEvent *event,
ClutterClickAction *action)
{
ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (action);
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (click_action);
ClutterActor *actor =
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
ClutterClickActionPrivate *priv = action->priv;
gboolean has_button = TRUE;
ClutterModifierType modifier_state;
ClutterActor *target;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
return CLUTTER_EVENT_PROPAGATE;
if (priv->press_sequence != NULL &&
clutter_event_get_event_sequence (event) != priv->press_sequence)
{
click_action_set_held (click_action, FALSE);
click_action_cancel_long_press (click_action);
return CLUTTER_EVENT_PROPAGATE;
}
switch (clutter_event_type (event))
{
case CLUTTER_TOUCH_BEGIN:
has_button = FALSE;
G_GNUC_FALLTHROUGH;
case CLUTTER_BUTTON_PRESS:
if (has_button && clutter_event_get_click_count (event) != 1)
return CLUTTER_EVENT_PROPAGATE;
if (priv->is_held)
return CLUTTER_EVENT_STOP;
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));
if (!clutter_actor_contains (actor, target))
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
priv->press_button = has_button ? clutter_event_get_button (event) : 0;
priv->press_device = clutter_event_get_device (event);
priv->press_device_id = clutter_event_get_device_id (event);
priv->press_sequence = clutter_event_get_event_sequence (event);
priv->modifier_state = clutter_event_get_state (event);
clutter_event_get_coords (event, &priv->press_x, &priv->press_y);
@@ -336,47 +312,70 @@ clutter_click_action_handle_event (ClutterAction *action,
if (priv->stage == NULL)
priv->stage = clutter_actor_get_stage (actor);
click_action_set_pressed (click_action, TRUE);
click_action_set_held (click_action, TRUE);
click_action_query_long_press (click_action);
priv->capture_id = g_signal_connect_after (priv->stage, "captured-event",
G_CALLBACK (on_captured_event),
action);
click_action_set_pressed (action, TRUE);
click_action_set_held (action, TRUE);
click_action_query_long_press (action);
break;
case CLUTTER_ENTER:
click_action_set_pressed (click_action, priv->is_held);
click_action_set_pressed (action, priv->is_held);
break;
case CLUTTER_LEAVE:
click_action_set_pressed (click_action, FALSE);
click_action_cancel_long_press (click_action);
click_action_set_pressed (action, priv->is_held);
click_action_cancel_long_press (action);
break;
default:
break;
}
return CLUTTER_EVENT_PROPAGATE;
}
static gboolean
on_captured_event (ClutterActor *stage,
ClutterEvent *event,
ClutterClickAction *action)
{
ClutterClickActionPrivate *priv = action->priv;
ClutterActor *actor;
ClutterModifierType modifier_state;
gboolean has_button = TRUE;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
switch (clutter_event_type (event))
{
case CLUTTER_TOUCH_CANCEL:
clutter_click_action_release (click_action);
clutter_click_action_release (action);
break;
case CLUTTER_TOUCH_END:
has_button = FALSE;
G_GNUC_FALLTHROUGH;
case CLUTTER_BUTTON_RELEASE:
if (!priv->is_held)
return CLUTTER_EVENT_PROPAGATE;
return CLUTTER_EVENT_STOP;
if ((has_button && clutter_event_get_button (event) != priv->press_button) ||
clutter_event_get_device (event) != priv->press_device ||
(has_button && clutter_event_get_click_count (event) != 1) ||
clutter_event_get_device_id (event) != priv->press_device_id ||
clutter_event_get_event_sequence (event) != priv->press_sequence)
return CLUTTER_EVENT_PROPAGATE;
click_action_set_held (click_action, FALSE);
click_action_cancel_long_press (click_action);
click_action_set_held (action, FALSE);
click_action_cancel_long_press (action);
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_clear_handle_id (&priv->long_press_id, g_source_remove);
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));
if (!clutter_actor_contains (actor, target))
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
/* exclude any button-mask so that we can compare
@@ -395,24 +394,31 @@ clutter_click_action_handle_event (ClutterAction *action,
if (modifier_state != priv->modifier_state)
priv->modifier_state = 0;
click_action_set_pressed (click_action, FALSE);
if (event_within_drag_threshold (click_action, event))
g_signal_emit (click_action, click_signals[CLICKED], 0, actor);
click_action_set_pressed (action, FALSE);
g_signal_emit (action, click_signals[CLICKED], 0, actor);
break;
case CLUTTER_MOTION:
case CLUTTER_TOUCH_UPDATE:
{
if (clutter_event_get_device (event) != priv->press_device ||
gfloat motion_x, motion_y;
gfloat delta_x, delta_y;
if (clutter_event_get_device_id (event) != priv->press_device_id ||
clutter_event_get_event_sequence (event) != priv->press_sequence)
return CLUTTER_EVENT_PROPAGATE;
if (!priv->is_held)
return CLUTTER_EVENT_PROPAGATE;
if (!event_within_drag_threshold (click_action, event))
clutter_click_action_release (click_action);
clutter_event_get_coords (event, &motion_x, &motion_y);
delta_x = ABS (motion_x - priv->press_x);
delta_y = ABS (motion_y - priv->press_y);
if (delta_x > priv->drag_threshold ||
delta_y > priv->drag_threshold)
click_action_cancel_long_press (action);
}
break;
@@ -420,7 +426,7 @@ clutter_click_action_handle_event (ClutterAction *action,
break;
}
return priv->is_held ? CLUTTER_EVENT_STOP : CLUTTER_EVENT_PROPAGATE;
return CLUTTER_EVENT_STOP;
}
static void
@@ -428,14 +434,37 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
ClutterActor *actor)
{
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterClickActionPrivate *priv = action->priv;
if (priv->event_id != 0)
{
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->event_id, old_actor);
priv->event_id = 0;
}
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
priv->capture_id = 0;
priv->stage = NULL;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
if (actor != NULL)
priv->event_id = g_signal_connect (actor, "event",
G_CALLBACK (on_event),
action);
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
}
@@ -459,8 +488,7 @@ clutter_click_action_set_property (GObject *gobject,
const GValue *value,
GParamSpec *pspec)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
switch (prop_id)
{
@@ -484,8 +512,7 @@ clutter_click_action_get_property (GObject *gobject,
GValue *value,
GParamSpec *pspec)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
switch (prop_id)
{
@@ -514,22 +541,24 @@ clutter_click_action_get_property (GObject *gobject,
static void
clutter_click_action_dispose (GObject *gobject)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
g_clear_signal_handler (&priv->event_id,
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_clear_handle_id (&priv->long_press_id, g_source_remove);
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
}
static void
clutter_click_action_class_init (ClutterClickActionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
ClutterActionClass *action_class = CLUTTER_ACTION_CLASS (klass);
action_class->handle_event = clutter_click_action_handle_event;
meta_class->set_actor = clutter_click_action_set_actor;
meta_class->set_enabled = clutter_click_action_set_enabled;
@@ -542,6 +571,8 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* ClutterClickAction:pressed:
*
* Whether the clickable actor should be in "pressed" state
*
* Since: 1.4
*/
obj_props[PROP_PRESSED] =
g_param_spec_boolean ("pressed",
@@ -554,6 +585,8 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* ClutterClickAction:held:
*
* Whether the clickable actor has the pointer grabbed
*
* Since: 1.4
*/
obj_props[PROP_HELD] =
g_param_spec_boolean ("held",
@@ -569,7 +602,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* press gesture, in milliseconds.
*
* A value of -1 will make the #ClutterClickAction use the value of
* the [property@Settings:long-press-duration] property.
* the #ClutterSettings:long-press-duration property.
*
* Since: 1.8
*/
obj_props[PROP_LONG_PRESS_DURATION] =
g_param_spec_int ("long-press-duration",
@@ -586,7 +621,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* a long press gesture is cancelled, in pixels.
*
* A value of -1 will make the #ClutterClickAction use the value of
* the [property@Settings:dnd-drag-threshold] property.
* the #ClutterSettings:dnd-drag-threshold property.
*
* Since: 1.8
*/
obj_props[PROP_LONG_PRESS_THRESHOLD] =
g_param_spec_int ("long-press-threshold",
@@ -605,9 +642,11 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* @action: the #ClutterClickAction that emitted the signal
* @actor: the #ClutterActor attached to the @action
*
* The signal is emitted when the [class@Actor] to which
* The ::clicked signal is emitted when the #ClutterActor to which
* a #ClutterClickAction has been applied should respond to a
* pointer button press and release events
*
* Since: 1.4
*/
click_signals[CLICKED] =
g_signal_new (I_("clicked"),
@@ -624,7 +663,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* @actor: the #ClutterActor attached to the @action
* @state: the long press state
*
* The signal is emitted during the long press gesture
* The ::long-press signal is emitted during the long press gesture
* handling.
*
* This signal can be emitted multiple times with different states.
@@ -638,10 +677,12 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
* %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled.
*
* It is possible to forcibly cancel a long press detection using
* [method@ClickAction.release].
* clutter_click_action_release().
*
* Return value: Only the %CLUTTER_LONG_PRESS_QUERY state uses the
* returned value of the handler; other states will ignore it
*
* Since: 1.8
*/
click_signals[LONG_PRESS] =
g_signal_new (I_("long-press"),
@@ -658,11 +699,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
static void
clutter_click_action_init (ClutterClickAction *self)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (self);
priv->long_press_threshold = -1;
priv->long_press_duration = -1;
self->priv = clutter_click_action_get_instance_private (self);
self->priv->long_press_threshold = -1;
self->priv->long_press_duration = -1;
}
/**
@@ -671,6 +710,8 @@ clutter_click_action_init (ClutterClickAction *self)
* Creates a new #ClutterClickAction instance
*
* Return value: the newly created #ClutterClickAction
*
* Since: 1.4
*/
ClutterAction *
clutter_click_action_new (void)
@@ -683,13 +724,15 @@ clutter_click_action_new (void)
* @action: a #ClutterClickAction
*
* Emulates a release of the pointer button, which ungrabs the pointer
* and unsets the [property@ClickAction:pressed] state.
* and unsets the #ClutterClickAction:pressed state.
*
* This function will also cancel the long press gesture if one was
* initiated.
*
* This function is useful to break a grab, for instance after a certain
* amount of time has passed.
*
* Since: 1.4
*/
void
clutter_click_action_release (ClutterClickAction *action)
@@ -698,11 +741,14 @@ clutter_click_action_release (ClutterClickAction *action)
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
priv = clutter_click_action_get_instance_private (action);
priv = action->priv;
if (!priv->is_held)
return;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
click_action_cancel_long_press (action);
click_action_set_held (action, FALSE);
click_action_set_pressed (action, FALSE);
@@ -715,17 +761,15 @@ clutter_click_action_release (ClutterClickAction *action)
* Retrieves the button that was pressed.
*
* Return value: the button value
*
* Since: 1.4
*/
guint
clutter_click_action_get_button (ClutterClickAction *action)
{
ClutterClickActionPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
priv = clutter_click_action_get_instance_private (action);
return priv->press_button;
return action->priv->press_button;
}
/**
@@ -735,17 +779,15 @@ clutter_click_action_get_button (ClutterClickAction *action)
* Retrieves the modifier state of the click action.
*
* Return value: the modifier state parameter, or 0
*
* Since: 1.6
*/
ClutterModifierType
clutter_click_action_get_state (ClutterClickAction *action)
{
ClutterClickActionPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
priv = clutter_click_action_get_instance_private (action);
return priv->modifier_state;
return action->priv->modifier_state;
}
/**
@@ -755,21 +797,19 @@ clutter_click_action_get_state (ClutterClickAction *action)
* @press_y: (out): return location for the Y coordinate, or %NULL
*
* Retrieves the screen coordinates of the button press.
*
* Since: 1.8
*/
void
clutter_click_action_get_coords (ClutterClickAction *action,
gfloat *press_x,
gfloat *press_y)
{
ClutterClickActionPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTION (action));
priv = clutter_click_action_get_instance_private (action);
if (press_x != NULL)
*press_x = priv->press_x;
*press_x = action->priv->press_x;
if (press_y != NULL)
*press_y = priv->press_y;
*press_y = action->priv->press_y;
}

View File

@@ -37,13 +37,32 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
#define CLUTTER_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickAction))
#define CLUTTER_IS_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLICK_ACTION))
#define CLUTTER_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
#define CLUTTER_IS_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLICK_ACTION))
#define CLUTTER_CLICK_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action,
CLUTTER, CLICK_ACTION, ClutterAction);
typedef struct _ClutterClickAction ClutterClickAction;
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
typedef struct _ClutterClickActionClass ClutterClickActionClass;
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
/**
* ClutterClickAction:
*
* The #ClutterClickAction structure contains
* only private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterClickAction
{
/*< private >*/
ClutterAction parent_instance;
ClutterClickActionPrivate *priv;
};
/**
* ClutterClickActionClass:
@@ -52,6 +71,8 @@ typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
*
* The #ClutterClickActionClass structure
* contains only private data
*
* Since: 1.4
*/
struct _ClutterClickActionClass
{
@@ -76,6 +97,9 @@ struct _ClutterClickActionClass
void (* _clutter_click_action7) (void);
};
CLUTTER_EXPORT
GType clutter_click_action_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterAction * clutter_click_action_new (void);

View File

@@ -22,9 +22,8 @@
*/
/**
* ClutterClone:
*
* An actor that displays a clone of a source actor
* SECTION:clutter-clone
* @short_description: An actor that displays a clone of a source actor
*
* #ClutterClone is a #ClutterActor which draws with the paint
* function of another actor, scaled to fit its own allocation.
@@ -34,10 +33,13 @@
* Unlike clutter_texture_new_from_actor(), #ClutterClone does not require
* the presence of support for FBOs in the underlying GL or GLES
* implementation.
*
* #ClutterClone is available since Clutter 1.0
*/
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-actor-private.h"
#include "clutter-clone.h"
#include "clutter-debug.h"
@@ -50,8 +52,6 @@
struct _ClutterClonePrivate
{
ClutterActor *clone_source;
float x_scale, y_scale;
gulong source_destroy_id;
};
@@ -119,17 +119,36 @@ clutter_clone_get_preferred_height (ClutterActor *self,
}
static void
clutter_clone_apply_transform (ClutterActor *self,
graphene_matrix_t *matrix)
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
{
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
ClutterActorBox box, source_box;
gfloat x_scale, y_scale;
if (priv->clone_source)
graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
/* First chain up and apply all the standard ClutterActor
* transformations... */
CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self,
matrix);
/* if we don't have a source, nothing else to do */
if (priv->clone_source == NULL)
return;
/* get our allocated size */
clutter_actor_get_allocation_box (self, &box);
/* and get the allocated size of the source */
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
/* We need to scale what the clone-source actor paints to fill our own
* allocation...
*/
x_scale = clutter_actor_box_get_width (&box)
/ clutter_actor_box_get_width (&source_box);
y_scale = clutter_actor_box_get_height (&box)
/ clutter_actor_box_get_height (&source_box);
cogl_matrix_scale (matrix, x_scale, y_scale, x_scale);
}
static void
@@ -194,7 +213,7 @@ clutter_clone_get_paint_volume (ClutterActor *actor,
if (priv->clone_source == NULL)
return TRUE;
/* query the volume of the source actor and simply masquerade it as
/* query the volume of the source actor and simply masquarade it as
* the clones volume... */
source_volume = clutter_actor_get_paint_volume (priv->clone_source);
if (source_volume == NULL)
@@ -221,16 +240,15 @@ clutter_clone_has_overlaps (ClutterActor *actor)
static void
clutter_clone_allocate (ClutterActor *self,
const ClutterActorBox *box)
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
ClutterActorClass *parent_class;
ClutterActorBox source_box;
float x_scale, y_scale;
/* chain up */
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
parent_class->allocate (self, box);
parent_class->allocate (self, box, flags);
if (priv->clone_source == NULL)
return;
@@ -240,31 +258,7 @@ clutter_clone_allocate (ClutterActor *self,
*/
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
!clutter_actor_has_allocation (priv->clone_source))
{
float x = 0.f;
float y = 0.f;
clutter_actor_get_fixed_position (priv->clone_source, &x, &y);
clutter_actor_allocate_preferred_size (priv->clone_source, x, y);
}
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
/* We need to scale what the clone-source actor paints to fill our own
* allocation...
*/
x_scale = clutter_actor_box_get_width (box)
/ clutter_actor_box_get_width (&source_box);
y_scale = clutter_actor_box_get_height (box)
/ clutter_actor_box_get_height (&source_box);
if (!G_APPROX_VALUE (priv->x_scale, x_scale, FLT_EPSILON) ||
!G_APPROX_VALUE (priv->y_scale, y_scale, FLT_EPSILON))
{
priv->x_scale = x_scale;
priv->y_scale = y_scale;
clutter_actor_invalidate_transform (CLUTTER_ACTOR (self));
}
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
#if 0
/* XXX - this is wrong: ClutterClone cannot clone unparented
@@ -279,7 +273,7 @@ clutter_clone_allocate (ClutterActor *self,
* paint cycle, we can safely give it as much size as it requires
*/
if (clutter_actor_get_parent (priv->clone_source) == NULL)
clutter_actor_allocate_preferred_size (priv->clone_source);
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
#endif
}
@@ -353,6 +347,8 @@ clutter_clone_class_init (ClutterCloneClass *klass)
* ClutterClone:source:
*
* This property specifies the source actor being cloned.
*
* Since: 1.0
*/
obj_props[PROP_SOURCE] =
g_param_spec_object ("source",
@@ -369,9 +365,6 @@ static void
clutter_clone_init (ClutterClone *self)
{
self->priv = clutter_clone_get_instance_private (self);
self->priv->x_scale = 1.f;
self->priv->y_scale = 1.f;
}
/**
@@ -381,6 +374,8 @@ clutter_clone_init (ClutterClone *self)
* Creates a new #ClutterActor which clones @source/
*
* Return value: the newly created #ClutterClone
*
* Since: 1.0
*/
ClutterActor *
clutter_clone_new (ClutterActor *source)
@@ -431,6 +426,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
* @source: (allow-none): a #ClutterActor, or %NULL
*
* Sets @source as the source actor to be cloned by @self.
*
* Since: 1.0
*/
void
clutter_clone_set_source (ClutterClone *self,
@@ -450,6 +447,8 @@ clutter_clone_set_source (ClutterClone *self,
* Retrieves the source #ClutterActor being cloned by @self.
*
* Return value: (transfer none): the actor source for the clone
*
* Since: 1.0
*/
ClutterActor *
clutter_clone_get_source (ClutterClone *self)

View File

@@ -43,6 +43,14 @@ typedef struct _ClutterClone ClutterClone;
typedef struct _ClutterCloneClass ClutterCloneClass;
typedef struct _ClutterClonePrivate ClutterClonePrivate;
/**
* ClutterClone:
*
* The #ClutterClone structure contains only private data
* and should be accessed using the provided API
*
* Since: 1.0
*/
struct _ClutterClone
{
/*< private >*/
@@ -55,6 +63,8 @@ struct _ClutterClone
* ClutterCloneClass:
*
* The #ClutterCloneClass structure contains only private data
*
* Since: 1.0
*/
struct _ClutterCloneClass
{

View File

@@ -1,182 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2022 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Naveen Kumar <naveen1.kumar@intel.com>
*/
/**
* ClutterColorState:
*
* Color state of each ClutterActor
*
* The #ClutterColorState class contains the colorspace of each color
* states (e.g. sRGB colorspace).
*
* Each [class@Actor] would own such an object.
*
* A single #ClutterColorState object can be shared by multiple [class@Actor]
* or maybe a separate color state for each [class@Actor] (depending on whether
* #ClutterColorState would be statefull or stateless).
*
* #ClutterColorState, if not set during construction, it will default to sRGB
* color state
*
* The #ClutterColorState would have API to get the colorspace, whether the
* actor content is in pq or not, and things like that
*/
#include "clutter-build-config.h"
#include "clutter-color-state.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-private.h"
enum
{
PROP_0,
PROP_COLORSPACE,
N_PROPS
};
static GParamSpec *obj_props[N_PROPS];
typedef struct _ClutterColorStatePrivate ClutterColorStatePrivate;
struct _ClutterColorState
{
GObject parent_instance;
};
struct _ClutterColorStatePrivate
{
ClutterColorspace colorspace;
};
G_DEFINE_TYPE_WITH_PRIVATE (ClutterColorState,
clutter_color_state,
G_TYPE_OBJECT)
ClutterColorspace
clutter_color_state_get_colorspace (ClutterColorState *color_state)
{
ClutterColorStatePrivate *priv;
g_return_val_if_fail (CLUTTER_IS_COLOR_STATE (color_state),
CLUTTER_COLORSPACE_UNKNOWN);
priv = clutter_color_state_get_instance_private (color_state);
return priv->colorspace;
}
static void
clutter_color_state_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterColorState *color_state = CLUTTER_COLOR_STATE (object);
ClutterColorStatePrivate *priv;
priv = clutter_color_state_get_instance_private (color_state);
switch (prop_id)
{
case PROP_COLORSPACE:
priv->colorspace = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_color_state_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterColorState *color_state = CLUTTER_COLOR_STATE (object);
switch (prop_id)
{
case PROP_COLORSPACE:
g_value_set_enum (value,
clutter_color_state_get_colorspace (color_state));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_color_state_class_init (ClutterColorStateClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = clutter_color_state_set_property;
gobject_class->get_property = clutter_color_state_get_property;
/**
* ClutterColorState:colorspace:
*
* Colorspace information of the each color state,
* defaults to sRGB colorspace
*/
obj_props[PROP_COLORSPACE] =
g_param_spec_enum ("colorspace",
P_("Colorspace"),
P_("Colorspace information of the color state"),
CLUTTER_TYPE_COLORSPACE,
CLUTTER_COLORSPACE_SRGB,
CLUTTER_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
}
static void
clutter_color_state_init (ClutterColorState *color_state)
{
}
/**
* clutter_color_state_new:
*
* Create a new ClutterColorState object.
*
* Return value: A new ClutterColorState object.
**/
ClutterColorState*
clutter_color_state_new (ClutterColorspace colorspace)
{
return g_object_new (CLUTTER_TYPE_COLOR_STATE,
"colorspace", colorspace,
NULL);
}

View File

@@ -1,50 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2022 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Naveen Kumar <naveen1.kumar@intel.com>
*/
#ifndef CLUTTER_COLOR_STATE_H
#define CLUTTER_COLOR_STATE_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_COLOR_STATE (clutter_color_state_get_type ())
CLUTTER_EXPORT
G_DECLARE_FINAL_TYPE (ClutterColorState, clutter_color_state,
CLUTTER, COLOR_STATE,
GObject)
CLUTTER_EXPORT
ClutterColorState * clutter_color_state_new (ClutterColorspace colorspace);
CLUTTER_EXPORT
ClutterColorspace clutter_color_state_get_colorspace (ClutterColorState *color_state);
G_END_DECLS
#endif /* CLUTTER_COLOR_STATE_H */

View File

@@ -21,6 +21,18 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-color
* @short_description: Color management and manipulation.
*
* #ClutterColor is a simple type for representing colors in Clutter.
*
* A #ClutterColor is expressed as a 4-tuple of values ranging from
* zero to 255, one for each color channel plus one for the alpha.
*
* The alpha channel is fully opaque at 255 and fully transparent at 0.
*/
#include "clutter-build-config.h"
#include <math.h>
@@ -98,6 +110,8 @@ static const ClutterColor static_colors[] = {
*
* Return value: a pointer to a static color; the returned pointer
* is owned by Clutter and it should never be modified or freed
*
* Since: 1.6
*/
const ClutterColor *
clutter_color_get_static (ClutterStaticColor color)
@@ -597,7 +611,7 @@ parse_hsla (ClutterColor *color,
/**
* clutter_color_from_string:
* @color: (out caller-allocates): return location for a #ClutterColor
* @str: a string specifying a color
* @str: a string specifiying a color
*
* Parses a string definition of a color, filling the #ClutterColor.red,
* #ClutterColor.green, #ClutterColor.blue and #ClutterColor.alpha fields
@@ -635,6 +649,8 @@ parse_hsla (ClutterColor *color,
* be fully opaque.
*
* Return value: %TRUE if parsing succeeded, and %FALSE otherwise
*
* Since: 1.0
*/
gboolean
clutter_color_from_string (ClutterColor *color,
@@ -767,6 +783,8 @@ clutter_color_from_string (ClutterColor *color,
* respectively.
*
* Return value: (transfer full): a newly-allocated text string
*
* Since: 0.2
*/
gchar *
clutter_color_to_string (const ClutterColor *color)
@@ -785,12 +803,14 @@ clutter_color_to_string (const ClutterColor *color)
* @v1: (type Clutter.Color): a #ClutterColor
* @v2: (type Clutter.Color): a #ClutterColor
*
* Compares two `ClutterColor`s and checks if they are the same.
* Compares two #ClutterColor<!-- -->s and checks if they are the same.
*
* This function can be passed to g_hash_table_new() as the @key_equal_func
* parameter, when using `ClutterColor`s as keys in a #GHashTable.
* parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
*
* Return value: %TRUE if the two colors are the same.
*
* Since: 0.2
*/
gboolean
clutter_color_equal (gconstpointer v1,
@@ -820,9 +840,11 @@ clutter_color_equal (gconstpointer v1,
* Converts a #ClutterColor to a hash value.
*
* This function can be passed to g_hash_table_new() as the @hash_func
* parameter, when using `ClutterColor`s as keys in a #GHashTable.
* parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
*
* Return value: a hash value corresponding to the color
*
* Since: 1.0
*/
guint
clutter_color_hash (gconstpointer v)
@@ -837,8 +859,10 @@ clutter_color_hash (gconstpointer v)
* @progress: the interpolation progress
* @result: (out): return location for the interpolation
*
* Interpolates between @initial and @final `ClutterColor`s
* Interpolates between @initial and @final #ClutterColor<!-- -->s
* using @progress
*
* Since: 1.6
*/
void
clutter_color_interpolate (const ClutterColor *initial,
@@ -880,12 +904,14 @@ clutter_color_progress (const GValue *a,
* freed using clutter_color_free().
*
* Return value: (transfer full): an allocated copy of @color.
*
* Since: 0.2
*/
ClutterColor *
clutter_color_copy (const ClutterColor *color)
{
if (G_LIKELY (color != NULL))
return g_memdup2 (color, sizeof (ClutterColor));
return g_slice_dup (ClutterColor, color);
return NULL;
}
@@ -895,12 +921,14 @@ clutter_color_copy (const ClutterColor *color)
* @color: a #ClutterColor
*
* Frees a color structure created with clutter_color_copy().
*
* Since: 0.2
*/
void
clutter_color_free (ClutterColor *color)
{
if (G_LIKELY (color != NULL))
g_free (color);
g_slice_free (ClutterColor, color);
}
/**
@@ -914,12 +942,14 @@ clutter_color_free (ClutterColor *color)
*
* This function is the equivalent of:
*
* ```c
* |[
* clutter_color_init (clutter_color_alloc (), red, green, blue, alpha);
* ```
* ]|
*
* Return value: (transfer full): the newly allocated color.
* Use clutter_color_free() when done
*
* Since: 0.8
*/
ClutterColor *
clutter_color_new (guint8 red,
@@ -941,11 +971,13 @@ clutter_color_new (guint8 red,
*
* Return value: (transfer full): the newly allocated #ClutterColor; use
* clutter_color_free() to free its resources
*
* Since: 1.12
*/
ClutterColor *
clutter_color_alloc (void)
{
return g_new0 (ClutterColor, 1);
return g_slice_new0 (ClutterColor);
}
/**
@@ -959,6 +991,8 @@ clutter_color_alloc (void)
* Initializes @color with the given values.
*
* Return value: (transfer none): the initialized #ClutterColor
*
* Since: 1.12
*/
ClutterColor *
clutter_color_init (ClutterColor *color,
@@ -1024,6 +1058,8 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterColor, clutter_color,
* @color: the color to set
*
* Sets @value to @color.
*
* Since: 0.8
*/
void
clutter_value_set_color (GValue *value,
@@ -1041,6 +1077,8 @@ clutter_value_set_color (GValue *value,
* Gets the #ClutterColor contained in @value.
*
* Return value: (transfer none): the color inside the passed #GValue
*
* Since: 0.8
*/
const ClutterColor *
clutter_value_get_color (const GValue *value)
@@ -1134,6 +1172,8 @@ clutter_param_color_get_type (void)
* Creates a #GParamSpec for properties using #ClutterColor.
*
* Return value: the newly created #GParamSpec
*
* Since: 0.8
*/
GParamSpec *
clutter_param_spec_color (const gchar *name,

View File

@@ -43,12 +43,7 @@ G_BEGIN_DECLS
* @blue: blue component, between 0 and 255
* @alpha: alpha component, between 0 and 255
*
* A simple type for representing colors.
*
* A #ClutterColor is expressed as a 4-tuple of values ranging from
* zero to 255, one for each color channel plus one for the alpha.
*
* The alpha channel is fully opaque at 255 and fully transparent at 0.
* Color representation.
*/
struct _ClutterColor
{
@@ -68,6 +63,8 @@ struct _ClutterColor
* @a: value for the alpha channel, between 0 and 255
*
* A macro that initializes a #ClutterColor, to be used when declaring it.
*
* Since: 1.12
*/
#define CLUTTER_COLOR_INIT(r,g,b,a) { (r), (g), (b), (a) }
@@ -154,7 +151,9 @@ void clutter_color_interpolate (const ClutterColor *initial,
* CLUTTER_VALUE_HOLDS_COLOR:
* @x: a #GValue
*
* Evaluates to %TRUE if @x holds a `ClutterColor`.
* Evaluates to %TRUE if @x holds a #ClutterColor<!-- -->.
*
* Since: 1.0
*/
#define CLUTTER_VALUE_HOLDS_COLOR(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_COLOR))
@@ -166,6 +165,8 @@ typedef struct _ClutterParamSpecColor ClutterParamSpecColor;
*
* A #GParamSpec subclass for defining properties holding
* a #ClutterColor.
*
* Since: 1.0
*/
struct _ClutterParamSpecColor
{

View File

@@ -23,12 +23,14 @@
*/
/**
* ClutterColorizeEffect:
*
* A colorization effect
* SECTION:clutter-colorize-effect
* @short_description: A colorization effect
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
*
* #ClutterColorizeEffect is a sub-class of #ClutterEffect that
* colorizes an actor with the given tint.
*
* #ClutterColorizeEffect is available since Clutter 1.4
*/
#define CLUTTER_COLORIZE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffectClass))
@@ -37,6 +39,8 @@
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-colorize-effect.h"
#include "cogl/cogl.h"
@@ -55,6 +59,9 @@ struct _ClutterColorizeEffect
gint tint_uniform;
gint tex_width;
gint tex_height;
CoglPipeline *pipeline;
};
@@ -97,15 +104,70 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
clutter_colorize_effect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static CoglPipeline *
clutter_colorize_effect_create_pipeline (ClutterOffscreenEffect *effect,
CoglTexture *texture)
static gboolean
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterColorizeEffect *colorize_effect = CLUTTER_COLORIZE_EFFECT (effect);
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
ClutterEffectClass *parent_class;
cogl_pipeline_set_layer_texture (colorize_effect->pipeline, 0, texture);
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
return cogl_object_ref (colorize_effect->pipeline);
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
"or the current GL driver does not implement support "
"for the GLSL shading language.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
CoglHandle texture;
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
self->tex_width = cogl_texture_get_width (texture);
self->tex_height = cogl_texture_get_height (texture);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
return TRUE;
}
else
return FALSE;
}
static void
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
paint_opacity = clutter_actor_get_paint_opacity (actor);
cogl_pipeline_set_color4ub (self->pipeline,
paint_opacity,
paint_opacity,
paint_opacity,
paint_opacity);
cogl_framebuffer_draw_rectangle (framebuffer,
self->pipeline,
0, 0,
self->tex_width, self->tex_height);
}
static void
@@ -166,11 +228,14 @@ clutter_colorize_effect_get_property (GObject *gobject,
static void
clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
{
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterOffscreenEffectClass *offscreen_class;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->create_pipeline = clutter_colorize_effect_create_pipeline;
offscreen_class->paint_target = clutter_colorize_effect_paint_target;
effect_class->pre_paint = clutter_colorize_effect_pre_paint;
gobject_class->set_property = clutter_colorize_effect_set_property;
gobject_class->get_property = clutter_colorize_effect_get_property;
@@ -180,6 +245,8 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
* ClutterColorizeEffect:tint:
*
* The tint to apply to the actor
*
* Since: 1.4
*/
obj_props[PROP_TINT] =
clutter_param_spec_color ("tint",
@@ -250,6 +317,8 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
* clutter_actor_add_effect()
*
* Return value: the newly created #ClutterColorizeEffect or %NULL
*
* Since: 1.4
*/
ClutterEffect *
clutter_colorize_effect_new (const ClutterColor *tint)
@@ -265,6 +334,8 @@ clutter_colorize_effect_new (const ClutterColor *tint)
* @tint: the color to be used
*
* Sets the tint to be used when colorizing
*
* Since: 1.4
*/
void
clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
@@ -287,6 +358,8 @@ clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
* @tint: (out caller-allocates): return location for the color used
*
* Retrieves the tint used by @effect
*
* Since: 1.4
*/
void
clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,

View File

@@ -38,6 +38,14 @@ G_BEGIN_DECLS
#define CLUTTER_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffect))
#define CLUTTER_IS_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_COLORIZE_EFFECT))
/**
* ClutterColorizeEffect:
*
* #ClutterColorizeEffect is an opaque structure
* whose members cannot be directly accessed
*
* Since: 1.4
*/
typedef struct _ClutterColorizeEffect ClutterColorizeEffect;
typedef struct _ClutterColorizeEffectClass ClutterColorizeEffectClass;

View File

@@ -0,0 +1,22 @@
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_CONFIG_H__
#define __CLUTTER_CONFIG_H__
#include <glib.h>
G_BEGIN_DECLS
#mesondefine CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#mesondefine CLUTTER_WINDOWING_X11
#mesondefine CLUTTER_INPUT_X11
#mesondefine CLUTTER_WINDOWING_GLX
#mesondefine CLUTTER_WINDOWING_EGL
#mesondefine CLUTTER_INPUT_EVDEV
#mesondefine CLUTTER_INPUT_NULL
G_END_DECLS
#endif /* __CLUTTER_CONFIG_H__ */

View File

@@ -23,9 +23,10 @@
*/
/**
* ClutterConstraint:
*
* Abstract class for constraints on position or size
* SECTION:clutter-constraint
* @Title: ClutterConstraint
* @Short_Description: Abstract class for constraints on position or size
* @See_Also: #ClutterAction
*
* #ClutterConstraint is a base abstract class for modifiers of a #ClutterActor
* position or size.
@@ -36,6 +37,8 @@
* allocation of the actor to which they are applied by overriding the
* #ClutterConstraintClass.update_allocation() virtual function.
*
* #ClutterConstraint is available since Clutter 1.4
*
* ## Using Constraints
*
* Constraints can be used with fixed layout managers, like

View File

@@ -42,6 +42,14 @@ G_BEGIN_DECLS
typedef struct _ClutterConstraintClass ClutterConstraintClass;
/**
* ClutterConstraint:
*
* The #ClutterConstraint structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterConstraint
{
/*< private >*/
@@ -58,6 +66,8 @@ struct _ClutterConstraint
*
* The #ClutterConstraintClass structure contains
* only private data
*
* Since: 1.4
*/
struct _ClutterConstraintClass
{

View File

@@ -63,14 +63,20 @@
} G_STMT_END
/**
* ClutterContainer:
*
* An interface for container actors
* SECTION:clutter-container
* @short_description: An interface for container actors
*
* #ClutterContainer is an interface implemented by [class@Actor], and
* #ClutterContainer is an interface implemented by #ClutterActor, and
* it provides some common API for notifying when a child actor is added
* or removed, as well as the infrastructure for accessing child properties
* through [class@ChildMeta].
* through #ClutterChildMeta.
*
* Until Clutter 1.10, the #ClutterContainer interface was also the public
* API for implementing container actors; this part of the interface has
* been deprecated: #ClutterContainer has a default implementation which
* defers to #ClutterActor the child addition and removal, as well as the
* iteration. See the documentation of #ClutterContainerIface for the list
* of virtual functions that should be overridden.
*/
enum
@@ -113,6 +119,31 @@ container_real_remove (ClutterContainer *container,
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
}
static void
container_real_raise (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
clutter_actor_set_child_above_sibling (self, child, sibling);
}
static void
container_real_lower (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
clutter_actor_set_child_below_sibling (self, child, sibling);
}
static void
container_real_sort_depth_order (ClutterContainer *container)
{
}
static void
clutter_container_default_init (ClutterContainerInterface *iface)
{
@@ -126,8 +157,10 @@ clutter_container_default_init (ClutterContainerInterface *iface)
* @container: the actor which received the signal
* @actor: the new child that has been added to @container
*
* The signal is emitted each time an actor
* The ::actor-added signal is emitted each time an actor
* has been added to @container.
*
* Since: 0.4
*/
container_signals[ACTOR_ADDED] =
g_signal_new (I_("actor-added"),
@@ -142,8 +175,10 @@ clutter_container_default_init (ClutterContainerInterface *iface)
* @container: the actor which received the signal
* @actor: the child that has been removed from @container
*
* The signal is emitted each time an actor
* The ::actor-removed signal is emitted each time an actor
* is removed from @container.
*
* Since: 0.4
*/
container_signals[ACTOR_REMOVED] =
g_signal_new (I_("actor-removed"),
@@ -160,9 +195,11 @@ clutter_container_default_init (ClutterContainerInterface *iface)
* @actor: the child that has had a property set
* @pspec: (type GParamSpec): the #GParamSpec of the property set
*
* The signal is emitted each time a property is
* The ::child-notify signal is emitted each time a property is
* being set through the clutter_container_child_set() and
* clutter_container_child_set_property() calls.
*
* Since: 0.8
*/
container_signals[CHILD_NOTIFY] =
g_signal_new (I_("child-notify"),
@@ -176,6 +213,9 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface->add = container_real_add;
iface->remove = container_real_remove;
iface->raise = container_real_raise;
iface->lower = container_real_lower;
iface->sort_depth_order = container_real_sort_depth_order;
iface->child_meta_type = G_TYPE_INVALID;
iface->create_child_meta = create_child_meta;
@@ -289,7 +329,7 @@ container_remove_valist (ClutterContainer *container,
* @first_actor: the first #ClutterActor to add
* @...: %NULL terminated list of actors to add
*
* Adds a list of `ClutterActor`s to @container. Each time and
* Adds a list of #ClutterActor<!-- -->s to @container. Each time and
* actor is added, the "actor-added" signal is emitted. Each actor should
* be parented to @container, which takes a reference on the actor. You
* cannot add a #ClutterActor to more than one #ClutterContainer.
@@ -298,6 +338,8 @@ container_remove_valist (ClutterContainer *container,
* deprecated virtual function. The default implementation will
* call clutter_actor_add_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
@@ -329,6 +371,8 @@ clutter_container_add (ClutterContainer *container,
* deprecated virtual function. The default implementation will
* call clutter_actor_add_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
@@ -347,7 +391,7 @@ clutter_container_add_actor (ClutterContainer *container,
* @first_actor: first #ClutterActor to remove
* @...: a %NULL-terminated list of actors to remove
*
* Removes a %NULL terminated list of `ClutterActor`s from
* Removes a %NULL terminated list of #ClutterActor<!-- -->s from
* @container. Each actor should be unparented, so if you want to keep it
* around you must hold a reference to it yourself, using g_object_ref().
* Each time an actor is removed, the "actor-removed" signal is
@@ -357,6 +401,8 @@ clutter_container_add_actor (ClutterContainer *container,
* deprecated virtual function. The default implementation will call
* clutter_actor_remove_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
*/
void
@@ -388,6 +434,8 @@ clutter_container_remove (ClutterContainer *container,
* deprecated virtual function. The default implementation will call
* clutter_actor_remove_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
*/
void
@@ -400,6 +448,202 @@ clutter_container_remove_actor (ClutterContainer *container,
container_remove_actor (container, actor);
}
/**
* clutter_container_get_children:
* @container: a #ClutterContainer
*
* Retrieves all the children of @container.
*
* Return value: (element-type Clutter.Actor) (transfer container): a list
* of #ClutterActor<!-- -->s. Use g_list_free() on the returned
* list when done.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_children() instead.
*/
GList *
clutter_container_get_children (ClutterContainer *container)
{
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
return clutter_actor_get_children (CLUTTER_ACTOR (container));
}
/**
* clutter_container_raise_child: (virtual raise)
* @container: a #ClutterContainer
* @actor: the actor to raise
* @sibling: (allow-none): the sibling to raise to, or %NULL to raise
* to the top
*
* Raises @actor to @sibling level, in the depth ordering.
*
* This function calls the #ClutterContainerIface.raise() virtual function,
* which has been deprecated. The default implementation will call
* clutter_actor_set_child_above_sibling().
*
* Since: 0.6
*
* Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() instead.
*/
void
clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterContainerIface *iface;
ClutterActor *self;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
if (actor == sibling)
return;
self = CLUTTER_ACTOR (container);
if (clutter_actor_get_parent (actor) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (actor)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
if (sibling != NULL &&
clutter_actor_get_parent (sibling) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (sibling)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->raise != container_real_raise)
_clutter_diagnostic_message ("The ClutterContainer::raise() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->raise (container, actor, sibling);
}
/**
* clutter_container_lower_child: (virtual lower)
* @container: a #ClutterContainer
* @actor: the actor to raise
* @sibling: (allow-none): the sibling to lower to, or %NULL to lower
* to the bottom
*
* Lowers @actor to @sibling level, in the depth ordering.
*
* This function calls the #ClutterContainerIface.lower() virtual function,
* which has been deprecated. The default implementation will call
* clutter_actor_set_child_below_sibling().
*
* Since: 0.6
*
* Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead.
*/
void
clutter_container_lower_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterContainerIface *iface;
ClutterActor *self;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
if (actor == sibling)
return;
self = CLUTTER_ACTOR (container);
if (clutter_actor_get_parent (actor) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (actor)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
if (sibling != NULL&&
clutter_actor_get_parent (sibling) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (sibling)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->lower != container_real_lower)
_clutter_diagnostic_message ("The ClutterContainer::lower() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->lower (container, actor, sibling);
}
/**
* clutter_container_sort_depth_order:
* @container: a #ClutterContainer
*
* Sorts a container's children using their depth. This function should not
* be normally used by applications.
*
* Since: 0.6
*
* Deprecated: 1.10: The #ClutterContainerIface.sort_depth_order() virtual
* function should not be used any more; the default implementation in
* #ClutterContainer does not do anything.
*/
void
clutter_container_sort_depth_order (ClutterContainer *container)
{
ClutterContainerIface *iface;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->sort_depth_order != container_real_sort_depth_order)
_clutter_diagnostic_message ("The ClutterContainer::sort_depth_order() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->sort_depth_order (container);
}
/**
* clutter_container_find_child_by_name:
* @container: a #ClutterContainer
@@ -410,6 +654,8 @@ clutter_container_remove_actor (ClutterContainer *container,
*
* Return value: (transfer none): The child actor with the requested name,
* or %NULL if no actor with that name was found.
*
* Since: 0.6
*/
ClutterActor *
clutter_container_find_child_by_name (ClutterContainer *container,
@@ -422,7 +668,7 @@ clutter_container_find_child_by_name (ClutterContainer *container,
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
g_return_val_if_fail (child_name != NULL, NULL);
children = clutter_actor_get_children (CLUTTER_ACTOR (container));
children = clutter_container_get_children (container);
for (iter = children; iter; iter = g_list_next (iter))
{
@@ -519,7 +765,9 @@ destroy_child_meta (ClutterContainer *container,
*
* Return value: (transfer none): the #ClutterChildMeta for the @actor child
* of @container or %NULL if the specifiec actor does not exist or the
* container is not configured to provide `ClutterChildMeta`s
* container is not configured to provide #ClutterChildMeta<!-- -->s
*
* Since: 0.8
*/
ClutterChildMeta *
clutter_container_get_child_meta (ClutterContainer *container,
@@ -550,6 +798,8 @@ clutter_container_get_child_meta (ClutterContainer *container,
* #ClutterContainer::add() virtual function implementation.
*
* Applications should not call this function.
*
* Since: 1.2
*/
void
clutter_container_create_child_meta (ClutterContainer *container,
@@ -584,6 +834,8 @@ clutter_container_create_child_meta (ClutterContainer *container,
* #ClutterContainer::add() virtual function implementation.
*
* Applications should not call this function.
*
* Since: 1.2
*/
void
clutter_container_destroy_child_meta (ClutterContainer *container,
@@ -612,6 +864,8 @@ clutter_container_destroy_child_meta (ClutterContainer *container,
*
* Return value: (transfer none): The #GParamSpec for the property or %NULL
* if no such property exist.
*
* Since: 0.8
*/
GParamSpec *
clutter_container_class_find_child_property (GObjectClass *klass,
@@ -648,7 +902,9 @@ clutter_container_class_find_child_property (GObjectClass *klass,
* Returns an array of #GParamSpec for all child properties.
*
* Return value: (array length=n_properties) (transfer full): an array
* of `GParamSpec`s which should be freed after use.
* of #GParamSpec<!-- -->s which should be freed after use.
*
* Since: 0.8
*/
GParamSpec **
clutter_container_class_list_child_properties (GObjectClass *klass,
@@ -709,6 +965,8 @@ container_set_child_property (ClutterContainer *container,
* @value: the value.
*
* Sets a container-specific property on a child of @container.
*
* Since: 0.8
*/
void
clutter_container_child_set_property (ClutterContainer *container,
@@ -755,6 +1013,8 @@ clutter_container_child_set_property (ClutterContainer *container,
* pairs terminated with NULL.
*
* Sets container specific properties on the child of a container.
*
* Since: 0.8
*/
void
clutter_container_child_set (ClutterContainer *container,
@@ -848,6 +1108,8 @@ container_get_child_property (ClutterContainer *container,
* Note that clutter_container_child_set_property() is really intended for
* language bindings, clutter_container_child_set() is much more convenient
* for C programming.
*
* Since: 0.8
*/
void
clutter_container_child_get_property (ClutterContainer *container,
@@ -899,6 +1161,8 @@ clutter_container_child_get_property (ClutterContainer *container,
* In general, a copy is made of the property contents and the caller is
* responsible for freeing the memory in the appropriate manner for the type, for
* instance by calling g_free() or g_object_unref().
*
* Since: 0.8
*/
void
clutter_container_child_get (ClutterContainer *container,
@@ -969,6 +1233,8 @@ clutter_container_child_get (ClutterContainer *container,
* Calls the #ClutterContainerIface.child_notify() virtual function
* of #ClutterContainer. The default implementation will emit the
* #ClutterContainer::child-notify signal.
*
* Since: 1.6
*/
void
clutter_container_child_notify (ClutterContainer *container,

View File

@@ -44,12 +44,28 @@ G_BEGIN_DECLS
typedef struct _ClutterContainerIface ClutterContainerIface;
/**
* ClutterContainer:
*
* #ClutterContainer is an opaque structure whose members cannot be directly
* accessed
*
* Since: 0.4
*/
/**
* ClutterContainerIface:
* @add: virtual function for adding an actor to the container. This virtual
* function is deprecated, and it should not be overridden.
* @remove: virtual function for removing an actor from the container. This
* virtual function is deprecated, and it should not be overridden.
* @raise: virtual function for raising a child. This virtual function is
* deprecated and it should not be overridden.
* @lower: virtual function for lowering a child. This virtual function is
* deprecated and it should not be overridden.
* @sort_depth_order: virtual function for sorting the children of a
* container depending on their depth. This virtual function is deprecated
* and it should not be overridden.
* @child_meta_type: The GType used for storing auxiliary information about
* each of the containers children.
* @create_child_meta: virtual function that gets called for each added
@@ -58,7 +74,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* fields in the instance and add the record to a data structure for
* subsequent access for #ClutterContainerIface::get_child_meta
* @destroy_child_meta: virtual function that gets called when a child is
* removed; it should release all resources held by the record
* removed; it shuld release all resources held by the record
* @get_child_meta: return the record for a container child
* @actor_added: class handler for #ClutterContainer::actor-added
* @actor_removed: class handler for #ClutterContainer::actor-removed
@@ -67,6 +83,8 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* Base interface for container actors. The @add and @remove
* virtual functions must be provided by any implementation; the other
* virtual functions are optional.
*
* Since: 0.4
*/
struct _ClutterContainerIface
{
@@ -79,6 +97,15 @@ struct _ClutterContainerIface
void (* remove) (ClutterContainer *container,
ClutterActor *actor);
/* child stacking */
void (* raise) (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
void (* lower) (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
void (* sort_depth_order) (ClutterContainer *container);
/* ClutterChildMeta management */
GType child_meta_type;
void (* create_child_meta) (ClutterContainer *container,

View File

@@ -23,15 +23,17 @@
*/
/**
* ClutterContent:
*
* Delegate for painting the content of an actor
* SECTION:clutter-content
* @Title: ClutterContent
* @Short_Description: Delegate for painting the content of an actor
*
* #ClutterContent is an interface to implement types responsible for
* painting the content of a [class@Actor].
* painting the content of a #ClutterActor.
*
* Multiple actors can use the same #ClutterContent instance, in order
* to share the resources associated with painting the same content..
* to share the resources associated with painting the same content.
*
* #ClutterContent is available since Clutter 1.10.
*/
#include "clutter-build-config.h"
@@ -120,6 +122,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
*
* This signal is emitted each time a #ClutterContent implementation is
* assigned to a #ClutterActor.
*
* Since: 1.10
*/
content_signals[ATTACHED] =
g_signal_new (I_("attached"),
@@ -137,6 +141,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
*
* This signal is emitted each time a #ClutterContent implementation is
* removed from a #ClutterActor.
*
* Since: 1.10
*/
content_signals[DETACHED] =
g_signal_new (I_("detached"),
@@ -157,6 +163,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
* This function should be called by #ClutterContent implementations when
* they change the way a the content should be painted regardless of the
* actor state.
*
* Since: 1.10
*/
void
clutter_content_invalidate (ClutterContent *content)
@@ -314,8 +322,8 @@ _clutter_content_paint_content (ClutterContent *content,
/**
* clutter_content_get_preferred_size:
* @content: a #ClutterContent
* @width: (out) (optional): return location for the natural width of the content
* @height: (out) (optional): return location for the natural height of the content
* @width: (out): return location for the natural width of the content
* @height: (out): return location for the natural height of the content
*
* Retrieves the natural size of the @content, if any.
*
@@ -325,6 +333,8 @@ _clutter_content_paint_content (ClutterContent *content,
*
* Return value: %TRUE if the content has a preferred size, and %FALSE
* otherwise
*
* Since: 1.10
*/
gboolean
clutter_content_get_preferred_size (ClutterContent *content,

View File

@@ -53,6 +53,8 @@ G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
*
* The #ClutterContentInterface structure contains only
* private data.
*
* Since: 1.10
*/
struct _ClutterContentInterface
{

View File

@@ -1,92 +0,0 @@
/*
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
* Copyright (C) 2020 Red Hat Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter-damage-history.h"
#define DAMAGE_HISTORY_LENGTH 0x10
struct _ClutterDamageHistory
{
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
int index;
};
ClutterDamageHistory *
clutter_damage_history_new (void)
{
ClutterDamageHistory *history;
history = g_new0 (ClutterDamageHistory, 1);
return history;
}
void
clutter_damage_history_free (ClutterDamageHistory *history)
{
int i;
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
g_clear_pointer (&history->damages[i], cairo_region_destroy);
g_free (history);
}
gboolean
clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
int age)
{
if (age >= DAMAGE_HISTORY_LENGTH ||
age < 1)
return FALSE;
if (!clutter_damage_history_lookup (history, age))
return FALSE;
return TRUE;
}
void
clutter_damage_history_record (ClutterDamageHistory *history,
const cairo_region_t *damage)
{
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
history->damages[history->index] = cairo_region_copy (damage);
}
static inline int
step_damage_index (int current,
int diff)
{
return (current + diff) & (DAMAGE_HISTORY_LENGTH - 1);
}
void
clutter_damage_history_step (ClutterDamageHistory *history)
{
history->index = step_damage_index (history->index, 1);
}
const cairo_region_t *
clutter_damage_history_lookup (ClutterDamageHistory *history,
int age)
{
return history->damages[step_damage_index (history->index, -age)];
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
* Copyright (C) 2020 Red Hat Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_DAMAGE_HISTORY_H
#define CLUTTER_DAMAGE_HISTORY_H
#include <cairo.h>
#include <glib.h>
#include "clutter-macros.h"
typedef struct _ClutterDamageHistory ClutterDamageHistory;
CLUTTER_EXPORT
ClutterDamageHistory * clutter_damage_history_new (void);
CLUTTER_EXPORT
void clutter_damage_history_free (ClutterDamageHistory *history);
CLUTTER_EXPORT
gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
int age);
CLUTTER_EXPORT
void clutter_damage_history_record (ClutterDamageHistory *history,
const cairo_region_t *damage);
CLUTTER_EXPORT
void clutter_damage_history_step (ClutterDamageHistory *history);
CLUTTER_EXPORT
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
int age);
#endif /* CLUTTER_DAMAGE_HISTORY_H */

View File

@@ -15,7 +15,7 @@ G_BEGIN_DECLS
/* Try the GCC extension for valists in macros */
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
_clutter_debug_message ("[" #type "]: " x, ##a); \
_clutter_debug_message ("[" #type "]:" G_STRLOC ": " x, ##a); \
} } G_STMT_END
#else /* !__GNUC__ */
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
#define CLUTTER_NOTE(type,...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
gchar *_fmt = g_strdup_printf (__VA_ARGS__); \
_clutter_debug_message ("[" #type "]: %s", _fmt); \
_clutter_debug_message ("[" #type "]:" G_STRLOC ": %s", _fmt); \
g_free (_fmt); \
} } G_STMT_END
#endif
@@ -41,7 +41,6 @@ G_BEGIN_DECLS
extern guint clutter_debug_flags;
extern guint clutter_pick_debug_flags;
extern guint clutter_paint_debug_flags;
extern int clutter_max_render_time_constant_us;
void _clutter_debug_messagev (const char *format,
va_list var_args) G_GNUC_PRINTF (1, 0);

View File

@@ -26,9 +26,10 @@
*/
/**
* ClutterDeformEffect:
*
* A base class for effects deforming the geometry of an actor
* SECTION:clutter-deform-effect
* @Title: ClutterDeformEffect
* @Short_Description: A base class for effects deforming the geometry
* of an actor
*
* #ClutterDeformEffect is an abstract class providing all the plumbing
* for creating effects that result in the deformation of an actor's
@@ -38,6 +39,8 @@
* a #ClutterActor and then the Cogl vertex buffers API to submit the
* geometry to the GPU.
*
* #ClutterDeformEffect is available since Clutter 1.4
*
* ## Implementing ClutterDeformEffect
*
* Sub-classes of #ClutterDeformEffect should override the
@@ -50,16 +53,14 @@
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include "clutter-deform-effect.h"
#include <cogl/cogl.h>
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
#include "clutter-offscreen-effect-private.h"
#include "clutter-paint-node.h"
#include "clutter-paint-nodes.h"
#include "clutter-private.h"
#define DEFAULT_N_TILES 32
@@ -127,9 +128,10 @@ clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
}
static void
vbo_invalidate (ClutterActor *actor,
GParamSpec *pspec,
ClutterDeformEffect *effect)
vbo_invalidate (ClutterActor *actor,
const ClutterActorBox *allocation,
ClutterAllocationFlags flags,
ClutterDeformEffect *effect)
{
effect->priv->is_dirty = TRUE;
}
@@ -154,7 +156,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
* changes
*/
if (actor != NULL)
priv->allocation_id = g_signal_connect (actor, "notify::allocation",
priv->allocation_id = g_signal_connect (actor, "allocation-changed",
G_CALLBACK (vbo_invalidate),
meta);
@@ -165,16 +167,19 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
static void
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv;
CoglHandle material;
CoglPipeline *pipeline;
CoglDepthState depth_state;
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
if (priv->is_dirty)
{
graphene_rect_t rect;
gboolean mapped_buffer;
CoglVertexP3T2C4 *verts;
ClutterActor *actor;
@@ -188,7 +193,12 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
/* if we don't have a target size, fall back to the actor's
* allocation, though wrong it might be
*/
if (!clutter_offscreen_effect_get_target_size (effect, &width, &height))
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
{
width = graphene_rect_get_width (&rect);
height = graphene_rect_get_height (&rect);
}
else
clutter_actor_get_size (actor, &width, &height);
/* XXX ideally, the sub-classes should tell us what they
@@ -268,7 +278,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
priv->is_dirty = FALSE;
}
pipeline = clutter_offscreen_effect_get_pipeline (effect);
material = clutter_offscreen_effect_get_target (effect);
pipeline = COGL_PIPELINE (material);
/* enable depth testing */
cogl_depth_state_init (&depth_state);
@@ -282,22 +293,12 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
COGL_PIPELINE_CULL_FACE_MODE_BACK);
/* draw the front */
if (pipeline != NULL)
{
ClutterPaintNode *front_node;
front_node = clutter_pipeline_node_new (pipeline);
clutter_paint_node_set_static_name (front_node,
"ClutterDeformEffect (front)");
clutter_paint_node_add_child (node, front_node);
clutter_paint_node_add_primitive (front_node, priv->primitive);
clutter_paint_node_unref (front_node);
}
if (material != NULL)
cogl_framebuffer_draw_primitive (fb, pipeline, priv->primitive);
/* draw the back */
if (priv->back_pipeline != NULL)
{
ClutterPaintNode *back_node;
CoglPipeline *back_pipeline;
/* We probably shouldn't be modifying the user's material so
@@ -307,30 +308,20 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
cogl_pipeline_set_cull_face_mode (back_pipeline,
COGL_PIPELINE_CULL_FACE_MODE_FRONT);
cogl_framebuffer_draw_primitive (fb, back_pipeline, priv->primitive);
back_node = clutter_pipeline_node_new (back_pipeline);
clutter_paint_node_set_static_name (back_node,
"ClutterDeformEffect (back)");
clutter_paint_node_add_child (node, back_node);
clutter_paint_node_add_primitive (back_node, priv->primitive);
clutter_paint_node_unref (back_node);
cogl_object_unref (back_pipeline);
}
if (G_UNLIKELY (priv->lines_primitive != NULL))
{
const ClutterColor *red;
ClutterPaintNode *lines_node;
red = clutter_color_get_static (CLUTTER_COLOR_RED);
lines_node = clutter_color_node_new (red);
clutter_paint_node_set_static_name (lines_node,
"ClutterDeformEffect (lines)");
clutter_paint_node_add_child (node, lines_node);
clutter_paint_node_add_primitive (lines_node, priv->lines_primitive);
clutter_paint_node_unref (lines_node);
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglPipeline *lines_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color4f (lines_pipeline, 1.0, 0, 0, 1.0);
cogl_framebuffer_draw_primitive (fb, lines_pipeline,
priv->lines_primitive);
cogl_object_unref (lines_pipeline);
}
}
@@ -593,6 +584,8 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
*
* The number of horizontal tiles. The bigger the number, the
* smaller the tiles
*
* Since: 1.4
*/
obj_props[PROP_X_TILES] =
g_param_spec_uint ("x-tiles",
@@ -607,6 +600,8 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
*
* The number of vertical tiles. The bigger the number, the
* smaller the tiles
*
* Since: 1.4
*/
obj_props[PROP_Y_TILES] =
g_param_spec_uint ("y-tiles",
@@ -623,6 +618,8 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
* to which this effect has been applied
*
* By default, no material will be used
*
* Since: 1.4
*/
obj_props[PROP_BACK_MATERIAL] =
g_param_spec_boxed ("back-material",
@@ -663,6 +660,8 @@ clutter_deform_effect_init (ClutterDeformEffect *self)
*
* The #ClutterDeformEffect will take a reference on the material's
* handle
*
* Since: 1.4
*/
void
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
@@ -694,6 +693,8 @@ clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
* Return value: (transfer none): a handle for the material, or %NULL.
* The returned material is owned by the #ClutterDeformEffect and it
* should not be freed directly
*
* Since: 1.4
*/
CoglHandle
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
@@ -714,6 +715,8 @@ clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
*
* More tiles allow a finer grained deformation at the expenses
* of computation
*
* Since: 1.4
*/
void
clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
@@ -767,6 +770,8 @@ clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
*
* Retrieves the number of horizontal and vertical tiles used to sub-divide
* the actor's geometry during the effect
*
* Since: 1.4
*/
void
clutter_deform_effect_get_n_tiles (ClutterDeformEffect *effect,
@@ -786,8 +791,10 @@ clutter_deform_effect_get_n_tiles (ClutterDeformEffect *effect,
* clutter_deform_effect_invalidate:
* @effect: a #ClutterDeformEffect
*
* Invalidates the `effect`'s vertices and, if it is associated
* Invalidates the @effect<!-- -->'s vertices and, if it is associated
* to an actor, it will queue a redraw
*
* Since: 1.4
*/
void
clutter_deform_effect_invalidate (ClutterDeformEffect *effect)

View File

@@ -45,6 +45,14 @@ typedef struct _ClutterDeformEffect ClutterDeformEffect;
typedef struct _ClutterDeformEffectPrivate ClutterDeformEffectPrivate;
typedef struct _ClutterDeformEffectClass ClutterDeformEffectClass;
/**
* ClutterDeformEffect:
*
* The #ClutterDeformEffect structure contains
* only private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterDeformEffect
{
/*< private >*/
@@ -60,6 +68,8 @@ struct _ClutterDeformEffect
*
* The #ClutterDeformEffectClass structure contains
* only private data
*
* Since: 1.4
*/
struct _ClutterDeformEffectClass
{

View File

@@ -3,8 +3,16 @@
#define __CLUTTER_DEPRECATED_H_INSIDE__
#include "deprecated/clutter-box-layout.h"
#include "deprecated/clutter-actor.h"
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animation.h"
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h"
#include "deprecated/clutter-timeline.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

View File

@@ -23,14 +23,16 @@
*/
/**
* ClutterDesaturateEffect:
*
* A desaturation effect
* SECTION:clutter-desaturate-effect
* @short_description: A desaturation effect
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
*
* #ClutterDesaturateEffect is a sub-class of #ClutterEffect that
* desaturates the color of an actor and its contents. The strength
* desaturates the color of an actor and its contents. The strenght
* of the desaturation effect is controllable and animatable through
* the #ClutterDesaturateEffect:factor property.
*
* #ClutterDesaturateEffect is available since Clutter 1.4
*/
#define CLUTTER_DESATURATE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DESATURATE_EFFECT, ClutterDesaturateEffectClass))
@@ -39,6 +41,8 @@
#include "clutter-build-config.h"
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include <math.h>
#include "clutter-desaturate-effect.h"
@@ -107,16 +111,75 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
clutter_desaturate_effect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static CoglPipeline *
clutter_desaturate_effect_create_pipeline (ClutterOffscreenEffect *effect,
CoglTexture *texture)
static gboolean
clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDesaturateEffect *desaturate_effect =
CLUTTER_DESATURATE_EFFECT (effect);
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
ClutterEffectClass *parent_class;
cogl_pipeline_set_layer_texture (desaturate_effect->pipeline, 0, texture);
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
return cogl_object_ref (desaturate_effect->pipeline);
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
"or the current GL driver does not implement support "
"for the GLSL shading language.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
CoglHandle texture;
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
self->tex_width = cogl_texture_get_width (texture);
self->tex_height = cogl_texture_get_height (texture);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
return TRUE;
}
else
return FALSE;
}
static void
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
CoglHandle texture;
guint8 paint_opacity;
texture = clutter_offscreen_effect_get_texture (effect);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
paint_opacity = clutter_actor_get_paint_opacity (actor);
cogl_pipeline_set_color4ub (self->pipeline,
paint_opacity,
paint_opacity,
paint_opacity,
paint_opacity);
cogl_framebuffer_draw_rectangle (framebuffer,
self->pipeline,
0, 0,
cogl_texture_get_width (texture),
cogl_texture_get_height (texture));
}
static void
@@ -186,17 +249,22 @@ update_factor_uniform (ClutterDesaturateEffect *self)
static void
clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass)
{
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterOffscreenEffectClass *offscreen_class;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->create_pipeline = clutter_desaturate_effect_create_pipeline;
offscreen_class->paint_target = clutter_desaturate_effect_paint_target;
effect_class->pre_paint = clutter_desaturate_effect_pre_paint;
/**
* ClutterDesaturateEffect:factor:
*
* The desaturation factor, between 0.0 (no desaturation) and 1.0 (full
* desaturation).
*
* Since: 1.4
*/
obj_props[PROP_FACTOR] =
g_param_spec_double ("factor",
@@ -253,6 +321,8 @@ clutter_desaturate_effect_init (ClutterDesaturateEffect *self)
* clutter_actor_add_effect()
*
* Return value: the newly created #ClutterDesaturateEffect or %NULL
*
* Since: 1.4
*/
ClutterEffect *
clutter_desaturate_effect_new (gdouble factor)
@@ -271,15 +341,17 @@ clutter_desaturate_effect_new (gdouble factor)
*
* Sets the desaturation factor for @effect, with 0.0 being "do not desaturate"
* and 1.0 being "fully desaturate"
*
* Since: 1.4
*/
void
clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect,
double factor)
gdouble factor)
{
g_return_if_fail (CLUTTER_IS_DESATURATE_EFFECT (effect));
g_return_if_fail (factor >= 0.0 && factor <= 1.0);
if (fabs (effect->factor - factor) >= 0.00001)
if (fabsf (effect->factor - factor) >= 0.00001)
{
effect->factor = factor;
update_factor_uniform (effect);
@@ -297,6 +369,8 @@ clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect,
* Retrieves the desaturation factor of @effect
*
* Return value: the desaturation factor
*
* Since: 1.4
*/
gdouble
clutter_desaturate_effect_get_factor (ClutterDesaturateEffect *effect)

View File

@@ -37,6 +37,14 @@ G_BEGIN_DECLS
#define CLUTTER_DESATURATE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DESATURATE_EFFECT, ClutterDesaturateEffect))
#define CLUTTER_IS_DESATURATE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DESATURATE_EFFECT))
/**
* ClutterDesaturateEffect:
*
* #ClutterDesaturateEffect is an opaque structure
* whose members cannot be directly accessed
*
* Since: 1.4
*/
typedef struct _ClutterDesaturateEffect ClutterDesaturateEffect;
typedef struct _ClutterDesaturateEffectClass ClutterDesaturateEffectClass;

View File

@@ -5,11 +5,14 @@
G_BEGIN_DECLS
gboolean _clutter_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context);
void _clutter_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context);
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect,

View File

@@ -23,9 +23,8 @@
*/
/**
* ClutterEffect:
*
* Base class for actor effects
* SECTION:clutter-effect
* @short_description: Base class for actor effects
*
* The #ClutterEffect class provides a default type and API for creating
* effects for generic actors.
@@ -43,7 +42,7 @@
* #ClutterEffectClass.paint() method. The implementation of the function should look
* something like this:
*
* ```c
* |[
* void effect_paint (ClutterEffect *effect, ClutterEffectPaintFlags flags)
* {
* // Set up initialisation of the paint such as binding a
@@ -59,7 +58,7 @@
*
* // perform any cleanup of state, such as popping the CoglOffscreen
* }
* ```
* ]|
*
* The effect can optionally avoid calling clutter_actor_continue_paint() to skip any
* further stages of the paint sequence. This is useful for example if the effect
@@ -80,7 +79,7 @@
* will paint the first material using cogl_rectangle(), before continuing and then it
* will paint paint the second material after.
*
* ```c
* |[
* typedef struct {
* ClutterEffect parent_instance;
*
@@ -156,7 +155,9 @@
*
* klass->paint = my_effect_paint;
* }
* ```
* ]|
*
* #ClutterEffect is available since Clutter 1.4
*/
#include "clutter-build-config.h"
@@ -168,8 +169,6 @@
#include "clutter-effect-private.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-paint-node-private.h"
#include "clutter-paint-nodes.h"
#include "clutter-private.h"
#include "clutter-actor-private.h"
@@ -179,7 +178,6 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
static gboolean
clutter_effect_real_pre_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
return TRUE;
@@ -187,7 +185,6 @@ clutter_effect_real_pre_paint (ClutterEffect *effect,
static void
clutter_effect_real_post_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
}
@@ -199,54 +196,26 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
return TRUE;
}
static void
add_actor_node (ClutterEffect *effect,
ClutterPaintNode *node)
{
ClutterPaintNode *actor_node;
ClutterActor *actor;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
actor_node = clutter_actor_node_new (actor, -1);
clutter_paint_node_add_child (node, actor_node);
clutter_paint_node_unref (actor_node);
}
static void
clutter_effect_real_paint_node (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
add_actor_node (effect, node);
}
static void
clutter_effect_real_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
ClutterActor *actor;
gboolean pre_paint_succeeded;
/* The default implementation provides a compatibility wrapper for
effects that haven't migrated to use the 'paint' virtual yet. This
just calls the old pre and post virtuals before chaining on */
pre_paint_succeeded = effect_class->pre_paint (effect, node,paint_context);
pre_paint_succeeded = _clutter_effect_pre_paint (effect, paint_context);
actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_paint (actor, paint_context);
if (pre_paint_succeeded)
{
effect_class->paint_node (effect, node, paint_context, flags);
effect_class->post_paint (effect, node, paint_context);
}
else
{
/* Just paint the actor as fallback */
add_actor_node (effect, node);
}
_clutter_effect_post_paint (effect, paint_context);
}
static void
@@ -286,7 +255,6 @@ clutter_effect_class_init (ClutterEffectClass *klass)
klass->post_paint = clutter_effect_real_post_paint;
klass->modify_paint_volume = clutter_effect_real_modify_paint_volume;
klass->paint = clutter_effect_real_paint;
klass->paint_node = clutter_effect_real_paint_node;
klass->pick = clutter_effect_real_pick;
}
@@ -295,18 +263,32 @@ clutter_effect_init (ClutterEffect *self)
{
}
gboolean
_clutter_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context);
}
void
_clutter_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context);
}
void
_clutter_effect_paint (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect,
node,
paint_context,
flags);
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags);
}
void
@@ -367,7 +349,7 @@ _clutter_effect_has_custom_paint_volume (ClutterEffect *effect)
* the actor itself so the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY would still
* not be set. The effect can detect this case by keeping track of the
* last modelview matrix that was used to render the actor and
* verifying that it remains the same in the next paint.
* veryifying that it remains the same in the next paint.
*
* Any other effects that are layered on top of the passed in effect
* will still be passed the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY flag. If
@@ -376,6 +358,8 @@ _clutter_effect_has_custom_paint_volume (ClutterEffect *effect)
* one then that will override this call. In that case this effect
* will instead be called with the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY
* flag set.
*
* Since: 1.8
*/
void
clutter_effect_queue_repaint (ClutterEffect *effect)
@@ -389,6 +373,7 @@ clutter_effect_queue_repaint (ClutterEffect *effect)
/* If the effect has no actor then nothing needs to be done */
if (actor != NULL)
_clutter_actor_queue_redraw_full (actor,
0, /* flags */
NULL, /* clip volume */
effect /* effect */);
}

View File

@@ -44,6 +44,14 @@ G_BEGIN_DECLS
typedef struct _ClutterEffectClass ClutterEffectClass;
/**
* ClutterEffect:
*
* The #ClutterEffect structure contains only private data and should
* be accessed using the provided API
*
* Since: 1.4
*/
struct _ClutterEffect
{
/*< private >*/
@@ -59,6 +67,8 @@ struct _ClutterEffect
* @pick: virtual function
*
* The #ClutterEffectClass structure contains only private data
*
* Since: 1.4
*/
struct _ClutterEffectClass
{
@@ -67,21 +77,14 @@ struct _ClutterEffectClass
/*< public >*/
gboolean (* pre_paint) (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* post_paint) (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context);
gboolean (* modify_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
void (* paint) (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags);
void (* paint_node) (ClutterEffect *effect,
ClutterPaintNode *node,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,

View File

@@ -14,9 +14,9 @@
GType
@enum_name@_get_type (void)
{
static size_t g_enum_type_id = 0;
static volatile gsize g_enum_type_id__volatile = 0;
if (g_once_init_enter (&g_enum_type_id))
if (g_once_init_enter (&g_enum_type_id__volatile))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
@@ -28,13 +28,14 @@ GType
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType id;
GType g_enum_type_id;
id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_enum_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_enum_type_id, id);
g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id);
}
return g_enum_type_id;
return g_enum_type_id__volatile;
}
/*** END value-tail ***/

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