Compare commits
10 Commits
citadel-46
...
citadel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cab502754 | ||
|
|
8de96d3d7c | ||
|
|
ad787c3cf7 | ||
|
|
7f9defb444 | ||
|
|
c33ca49dfc | ||
|
|
fd826632e8 | ||
|
|
2f5c4bfc86 | ||
|
|
42d6013bc5 | ||
|
|
4ccdedfd99 | ||
|
|
3fb3764d27 |
109
.gitignore
vendored
109
.gitignore
vendored
@@ -1,11 +1,106 @@
|
||||
build-aux
|
||||
compile
|
||||
config.h
|
||||
config.h.in
|
||||
ltmain.sh
|
||||
missing
|
||||
50-mutter-navigation.xml
|
||||
50-mutter-system.xml
|
||||
50-mutter-windows.xml
|
||||
mutter.desktop
|
||||
mutter-wayland.desktop
|
||||
*.o
|
||||
*.a
|
||||
*.lo
|
||||
*.la
|
||||
.libs
|
||||
*.swp
|
||||
*.gir
|
||||
*.typelib
|
||||
*.gmo
|
||||
*.make
|
||||
*.log
|
||||
*.trs
|
||||
*~
|
||||
POTFILES
|
||||
Makevars.template
|
||||
po/*.header
|
||||
po/*.pot
|
||||
po/*.sed
|
||||
po/*.sin
|
||||
Rules-quot
|
||||
libmutter.pc
|
||||
mutter
|
||||
mutter-restart-helper
|
||||
mutter-test-client
|
||||
mutter-test-runner
|
||||
mutter-test-unit-tests
|
||||
mutter-test-headless-start-test
|
||||
mutter-all.test
|
||||
org.gnome.mutter.gschema.valid
|
||||
org.gnome.mutter.gschema.xml
|
||||
org.gnome.mutter.wayland.gschema.valid
|
||||
org.gnome.mutter.wayland.gschema.xml
|
||||
testasyncgetprop
|
||||
testboxes
|
||||
testgradient
|
||||
INSTALL
|
||||
meta-enum-types.[ch]
|
||||
src/stamp-meta-enum-types.h
|
||||
src/meta-dbus-display-config.[ch]
|
||||
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
|
||||
src/relative-pointer-unstable-v*-server-protocol.h
|
||||
src/pointer-constraints-unstable-v*-protocol.c
|
||||
src/pointer-constraints-unstable-v*-server-protocol.h
|
||||
src/xdg-foreign-unstable-v*-protocol.c
|
||||
src/xdg-foreign-unstable-v*-server-protocol.h
|
||||
src/xdg-output-unstable-v1-protocol.c
|
||||
src/xdg-output-unstable-v1-server-protocol.h
|
||||
src/xwayland-keyboard-grab-unstable-v1-protocol.c
|
||||
src/xwayland-keyboard-grab-unstable-v1-server-protocol.h
|
||||
src/tablet-unstable-v*-protocol.c
|
||||
src/tablet-unstable-v*-server-protocol.h
|
||||
src/text-input-unstable-v*-protocol.c
|
||||
src/text-input-unstable-v*-server-protocol.h
|
||||
src/keyboard-shortcuts-inhibit-unstable-v*-protocol.c
|
||||
src/keyboard-shortcuts-inhibit-unstable-v*-server-protocol.h
|
||||
src/linux-dmabuf-unstable-v*-protocol.c
|
||||
src/linux-dmabuf-unstable-v*-server-protocol.h
|
||||
src/xdg-shell-protocol.c
|
||||
src/xdg-shell-server-protocol.h
|
||||
src/wayland-eglstream-controller-server-protocol.h
|
||||
src/meta/meta-version.h
|
||||
src/libmutter-*.pc
|
||||
doc/reference/*.args
|
||||
doc/reference/*.bak
|
||||
doc/reference/*.hierarchy
|
||||
doc/reference/*.interfaces
|
||||
doc/reference/*.prerequisites
|
||||
doc/reference/*.signals
|
||||
doc/reference/*.stamp
|
||||
doc/reference/html/
|
||||
doc/reference/xml/
|
||||
doc/reference/meta-decl-list.txt
|
||||
doc/reference/meta-decl.txt
|
||||
doc/reference/meta-overrides.txt
|
||||
doc/reference/meta-undeclared.txt
|
||||
doc/reference/meta-undocumented.txt
|
||||
doc/reference/meta-unused.txt
|
||||
doc/reference/meta-docs.sgml
|
||||
doc/reference/meta.types
|
||||
.dirstamp
|
||||
**/tags.*
|
||||
build/
|
||||
subprojects/sysprof/
|
||||
__pycache__/
|
||||
.buildconfig
|
||||
.vscode
|
||||
runtime-dir
|
||||
build
|
||||
_build
|
||||
builddir
|
||||
565
.gitlab-ci.yml
565
.gitlab-ci.yml
@@ -1,6 +1,6 @@
|
||||
include:
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/145b1bc7ef1702d2bd71584010d7113c6786a506/templates/fedora.yml'
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/bbe5232986c9b98eb1efe62484e07216f7d1a4df/templates/fedora.yml'
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/bbe5232986c9b98eb1efe62484e07216f7d1a4df/templates/ci-fairy.yml'
|
||||
|
||||
stages:
|
||||
- review
|
||||
@@ -9,170 +9,49 @@ stages:
|
||||
- build
|
||||
- test
|
||||
- analyze
|
||||
- docs
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: GNOME/mutter
|
||||
|
||||
.skip-git-clone:
|
||||
.mutter.fedora:34@common:
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
.mutter.git-clone:
|
||||
extends:
|
||||
- .skip-git-clone
|
||||
variables:
|
||||
MUTTER_CLONE_PATH: $CI_BUILDS_DIR/$CI_PROJECT_PATH
|
||||
MUTTER_CLONE_DEPTH: 1
|
||||
before_script: |
|
||||
if [ -n "$MUTTER_CLONE_PATH" ]; then
|
||||
set -x
|
||||
uri="$CI_REPOSITORY_URL"
|
||||
if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then
|
||||
uri="$CI_MERGE_REQUEST_SOURCE_PROJECT_URL.git"
|
||||
branch="$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
|
||||
elif [ -n "$CI_COMMIT_TAG" ]; then
|
||||
branch="$CI_COMMIT_TAG"
|
||||
elif [ -n "$CI_COMMIT_BRANCH" ]; then
|
||||
branch="$CI_COMMIT_BRANCH"
|
||||
else
|
||||
branch="$CI_DEFAULT_BRANCH"
|
||||
fi
|
||||
if [ ! -d "$MUTTER_CLONE_PATH" ] || [ -z "$(ls -A "$MUTTER_CLONE_PATH")" ]; then
|
||||
git clone --depth $MUTTER_CLONE_DEPTH "$uri" "$MUTTER_CLONE_PATH" -b "$branch"
|
||||
elif [ ! -d "$MUTTER_CLONE_PATH/.git" ]; then
|
||||
git clone --bare --depth $MUTTER_CLONE_DEPTH "$uri" "$MUTTER_CLONE_PATH/.git" -b "$branch"
|
||||
if git -C "$MUTTER_CLONE_PATH" config --unset core.bare; then
|
||||
git -C "$MUTTER_CLONE_PATH" checkout
|
||||
else
|
||||
# For some weird reasons sometimes the fast-path could fail with
|
||||
# "fatal: not in a git directory" error, so handle it manually
|
||||
tmpdir=$(mktemp --directory --tmpdir mutter-XXXXXX)
|
||||
mkdir "$tmpdir/repo"
|
||||
mv "$MUTTER_CLONE_PATH/.git" "$tmpdir/repo/"
|
||||
git clone "$tmpdir/repo" "$tmpdir/src"
|
||||
mv "$tmpdir"/src/* "$tmpdir"/src/.* "$MUTTER_CLONE_PATH"
|
||||
rm -r "$tmpdir/repo"
|
||||
rm -rv "$tmpdir"
|
||||
fi
|
||||
fi
|
||||
set +x
|
||||
fi
|
||||
|
||||
.mutter.skip-git-clone:
|
||||
extends:
|
||||
- .skip-git-clone
|
||||
variables:
|
||||
MUTTER_CLONE_PATH: ''
|
||||
|
||||
.mutter.run-as-user:
|
||||
image:
|
||||
name: ${FDO_DISTRIBUTION_IMAGE}
|
||||
entrypoint:
|
||||
- 'runuser'
|
||||
- '-u'
|
||||
- !reference [.mutter.fedora@common, variables, MUTTER_USER]
|
||||
- '--'
|
||||
|
||||
.mutter.distribution-image:
|
||||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.run-as-user
|
||||
|
||||
.mutter.fedora@common:
|
||||
extends:
|
||||
- .skip-git-clone
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: 40
|
||||
BASE_TAG: '2024-02-23.0'
|
||||
MUTTER_USER: 'meta-user'
|
||||
FDO_DISTRIBUTION_VERSION: 34
|
||||
BASE_TAG: '2021-09-04.1'
|
||||
FDO_DISTRIBUTION_PACKAGES:
|
||||
asciidoc
|
||||
clang
|
||||
gcovr
|
||||
gdm
|
||||
gnome-shell
|
||||
python3-dbusmock
|
||||
sassc
|
||||
uncrustify
|
||||
xorg-x11-server-Xvfb
|
||||
mesa-dri-drivers
|
||||
xorg-x11-proto-devel
|
||||
qemu-system-x86-core
|
||||
busybox
|
||||
zenity
|
||||
python3-dbusmock
|
||||
"pkgconfig(libgcrypt)"
|
||||
"pkgconfig(libdisplay-info)"
|
||||
|
||||
FDO_DISTRIBUTION_EXEC: |
|
||||
set -e
|
||||
dnf install -y 'dnf-command(builddep)' &&
|
||||
|
||||
# Create $MUTTER_USER
|
||||
useradd -u 9999 -b /opt/mutter -ms /bin/bash $MUTTER_USER
|
||||
|
||||
# Enable sudo for $MUTTER_USER
|
||||
echo "%$MUTTER_USER ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/99_mutter-user
|
||||
|
||||
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 kernel --setopt=install_weak_deps=False
|
||||
dnf builddep -y gi-docgen --setopt=install_weak_deps=False
|
||||
dnf builddep -y mutter --setopt=install_weak_deps=False &&
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False &&
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.gnome.org/jadahl/catch.git \
|
||||
main
|
||||
https://gitlab.gnome.org/GNOME/glib.git \
|
||||
main . 02742ef957b532789c003eef80ec7f51c370e3d5 &&
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.gnome.org/GNOME/gi-docgen.git \
|
||||
main
|
||||
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git \
|
||||
41.alpha . &&
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.gnome.org/GNOME/gjs.git \
|
||||
1.69.2 . &&
|
||||
|
||||
rpm -e --nodeps gnome-bluetooth-libs-devel \
|
||||
mutter mutter-devel \
|
||||
gnome-shell
|
||||
gnome-shell &&
|
||||
|
||||
# Work-around for podman-push aborting on permission issue
|
||||
# https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1247
|
||||
rm -rf /etc/pki/pesign/
|
||||
chmod -R a+rX /opt/mutter/$MUTTER_USER
|
||||
chmod -R a+rX /var/lib/gdm
|
||||
|
||||
# Ensure that we mark the project clone dir as safe directory
|
||||
git config --system --add safe.directory "$CI_PROJECT_DIR"
|
||||
|
||||
if [[ x"$(uname -m )" = "xx86_64" ]] ; then
|
||||
if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then
|
||||
git clone --depth $MUTTER_CLONE_DEPTH \
|
||||
$CI_MERGE_REQUEST_SOURCE_PROJECT_URL.git mutter-src \
|
||||
-b "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
|
||||
elif [ -n "$CI_COMMIT_BRANCH" ]; then
|
||||
git clone --depth $MUTTER_CLONE_DEPTH \
|
||||
$CI_REPOSITORY_URL mutter-src -b "$CI_COMMIT_BRANCH"
|
||||
else
|
||||
git clone --depth $MUTTER_CLONE_DEPTH $CI_REPOSITORY_URL mutter-src
|
||||
fi
|
||||
meson setup build mutter-src -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-argcomplete
|
||||
|
||||
git clone https://github.com/arighi/virtme-ng.git
|
||||
cd virtme-ng
|
||||
git fetch --tags
|
||||
git checkout v1.8
|
||||
./setup.py install --prefix=/usr
|
||||
cd ..
|
||||
rm -rf virtme-ng
|
||||
rm -rf build mutter-src
|
||||
fi
|
||||
retry:
|
||||
max: 2
|
||||
when:
|
||||
- 'always'
|
||||
dnf clean all
|
||||
|
||||
default:
|
||||
# Cancel jobs if newer commits are pushed to the branch
|
||||
@@ -186,17 +65,13 @@ default:
|
||||
- 'scheduler_failure'
|
||||
- 'api_failure'
|
||||
|
||||
.mutter.fedora@x86_64:
|
||||
extends:
|
||||
- .mutter.fedora@common
|
||||
- .mutter.git-clone
|
||||
.mutter.fedora:34@x86_64:
|
||||
extends: .mutter.fedora:34@common
|
||||
variables:
|
||||
FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
|
||||
|
||||
.mutter.fedora@aarch64:
|
||||
extends:
|
||||
- .mutter.fedora@common
|
||||
- .mutter.git-clone
|
||||
.mutter.fedora:34@aarch64:
|
||||
extends: .mutter.fedora:34@common
|
||||
variables:
|
||||
FDO_DISTRIBUTION_TAG: "aarch64-${BASE_TAG}"
|
||||
tags:
|
||||
@@ -204,38 +79,17 @@ default:
|
||||
|
||||
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_MERGE_REQUEST_IID'
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
.pipeline-guard:
|
||||
.pipline-guard: &pipline-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'
|
||||
|
||||
.only-merge-requests:
|
||||
rules:
|
||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^$/'
|
||||
when: never
|
||||
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
when: on_success
|
||||
- when: 'manual'
|
||||
|
||||
check-commit-log:
|
||||
extends:
|
||||
@@ -244,191 +98,140 @@ check-commit-log:
|
||||
variables:
|
||||
GIT_DEPTH: "100"
|
||||
script:
|
||||
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml
|
||||
- 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 [.only-merge-requests, rules]
|
||||
<<: *pipline-guard
|
||||
|
||||
check-merge-request:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
- .skip-git-clone
|
||||
stage: review
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request-report.xml
|
||||
- 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 [.only-merge-requests, rules]
|
||||
<<: *pipline-guard
|
||||
|
||||
build-fedora-container@x86_64:
|
||||
extends:
|
||||
- .fdo.container-build@fedora@x86_64
|
||||
- .mutter.fedora@x86_64
|
||||
- .mutter.skip-git-clone
|
||||
- .mutter.fedora:34@x86_64
|
||||
stage: prepare
|
||||
rules:
|
||||
- !reference [.pipeline-guard, rules]
|
||||
needs:
|
||||
- check-commit-log
|
||||
- check-merge-request
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
build-fedora-container@aarch64:
|
||||
extends:
|
||||
- .fdo.container-build@fedora@aarch64
|
||||
- .mutter.fedora@aarch64
|
||||
- .mutter.skip-git-clone
|
||||
- .mutter.fedora:34@aarch64
|
||||
stage: prepare
|
||||
rules:
|
||||
- !reference [.pipeline-guard, rules]
|
||||
when: manual
|
||||
needs:
|
||||
- check-commit-log
|
||||
- check-merge-request
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
check-code-style:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
variables:
|
||||
MUTTER_CLONE_DEPTH: 200
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora:34@x86_64
|
||||
stage: code-review
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-fedora-container@x86_64
|
||||
script:
|
||||
git config --global --add safe.directory $CI_PROJECT_DIR ;
|
||||
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 ;
|
||||
- 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
|
||||
rules:
|
||||
- !reference [.only-merge-requests, rules]
|
||||
|
||||
.build-mutter-base:
|
||||
variables:
|
||||
BASE_MESON_OPTIONS:
|
||||
-Degl_device=true
|
||||
-Dwayland_eglstream=true
|
||||
-Dcatch=true
|
||||
-Dlibdisplay_info=enabled
|
||||
|
||||
.build-mutter:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .build-mutter-base
|
||||
- .fdo.distribution-image@fedora
|
||||
stage: build
|
||||
script:
|
||||
- meson setup . build
|
||||
--prefix /usr
|
||||
--werror
|
||||
--fatal-meson-warnings
|
||||
--warnlevel 2
|
||||
-Dbuildtype=debugoptimized
|
||||
-Db_coverage=true
|
||||
$BASE_MESON_OPTIONS
|
||||
$EXTRA_MESON_OPTIONS
|
||||
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- meson compile -C build
|
||||
- sudo meson install --dry-run -C build
|
||||
- meson install -C build
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
|
||||
build-mutter@x86_64:
|
||||
variables:
|
||||
EXTRA_MESON_OPTIONS:
|
||||
-Dkvm_tests=true
|
||||
-Dkvm_kernel_image=/opt/mutter/bzImage
|
||||
extends:
|
||||
- .build-mutter
|
||||
- .mutter.fedora@x86_64
|
||||
- .mutter.fedora:34@x86_64
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-fedora-container@x86_64
|
||||
|
||||
build-mutter@aarch64:
|
||||
extends:
|
||||
- .build-mutter
|
||||
- .mutter.fedora@aarch64
|
||||
- .mutter.fedora:34@aarch64
|
||||
needs:
|
||||
- job: build-fedora-container@aarch64
|
||||
artifacts: false
|
||||
when: manual
|
||||
- build-fedora-container@aarch64
|
||||
|
||||
build-without-opengl-and-glx@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora:34@x86_64
|
||||
stage: build
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-fedora-container@x86_64
|
||||
script:
|
||||
- meson setup . build --werror --prefix /usr
|
||||
-Dbuildtype=debugoptimized
|
||||
-Dopengl=false
|
||||
-Dglx=false
|
||||
-Degl_device=true
|
||||
-Dwayland_eglstream=true
|
||||
-Dintrospection=false
|
||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- meson compile -C build
|
||||
- sudo meson install --no-rebuild -C build
|
||||
- meson install -C build
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
|
||||
build-without-native-backend-and-wayland@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora:34@x86_64
|
||||
stage: build
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-fedora-container@x86_64
|
||||
script:
|
||||
- meson setup . build --werror --prefix /usr
|
||||
-Dbuildtype=debugoptimized
|
||||
-Dnative_backend=false
|
||||
-Dudev=false
|
||||
-Dwayland=false
|
||||
-Dxwayland=false
|
||||
-Dcore_tests=false
|
||||
-Dnative_tests=false
|
||||
-Dintrospection=false
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false -Dnative_tests=false --werror --prefix /usr
|
||||
- meson compile -C build
|
||||
- sudo meson install --no-rebuild -C build
|
||||
- meson install -C build
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
|
||||
build-wayland-only@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
stage: build
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
script:
|
||||
- meson setup . build --werror --prefix /usr
|
||||
-Dbuildtype=debugoptimized
|
||||
-Dwayland=true
|
||||
-Dxwayland=false
|
||||
-Dcore_tests=false
|
||||
-Dnative_tests=false
|
||||
-Dintrospection=false
|
||||
- meson compile -C build
|
||||
- sudo meson install --no-rebuild -C build
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
|
||||
.test-setup:
|
||||
.test-setup: &test-setup
|
||||
variables:
|
||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||
@@ -439,157 +242,99 @@ build-wayland-only@x86_64:
|
||||
G_SLICE: "always-malloc"
|
||||
MALLOC_CHECK_: "3"
|
||||
NO_AT_BRIDGE: "1"
|
||||
GTK_A11Y: "none"
|
||||
before_script:
|
||||
- !reference [.mutter.git-clone, before_script]
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
# Disable e.g. audio support to not dead lock screen cast tests
|
||||
- rm -f /usr/share/pipewire/media-session.d/with-*
|
||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
- pipewire & sleep 2
|
||||
|
||||
.test-mutter-base:
|
||||
.test-mutter:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .test-setup
|
||||
- .fdo.distribution-image@fedora
|
||||
<<: *test-setup
|
||||
stage: test
|
||||
after_script:
|
||||
- pushd build
|
||||
- gcovr --root=..
|
||||
--filter='\.\./src/'
|
||||
--filter='\.\./clutter/'
|
||||
--filter='\.\./cogl/'
|
||||
--filter='\.\./mtk/'
|
||||
--exclude='\.\./build/.*\.[ch]$' --exclude='.*/tests/.*\.[ch]$'
|
||||
--json --output=../coverage-${CI_JOB_NAME}.json
|
||||
- popd
|
||||
script:
|
||||
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
|
||||
catchsegv meson test -C build --no-rebuild -t 10
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
reports:
|
||||
junit: "build/meson-logs/testlog-catchsegv.junit.xml"
|
||||
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||
when: always
|
||||
paths:
|
||||
- build
|
||||
- coverage-*.json
|
||||
|
||||
.test-mutter:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .test-mutter-base
|
||||
script:
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
|
||||
./src/tests/meta-dbus-runner.py
|
||||
--launch=wireplumber
|
||||
meson test
|
||||
-C build
|
||||
--setup plain
|
||||
--no-suite 'mutter/kvm'
|
||||
--no-rebuild
|
||||
--timeout-multiplier 10
|
||||
--print-errorlogs
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "build/meson-logs/testlog-plain.junit.xml"
|
||||
|
||||
test-mutter@x86_64:
|
||||
extends:
|
||||
- .mutter.fedora@x86_64
|
||||
- .test-mutter
|
||||
tags:
|
||||
- asan
|
||||
- .mutter.fedora:34@x86_64
|
||||
needs:
|
||||
- build-mutter@x86_64
|
||||
|
||||
test-mutter-kvm@x86_64:
|
||||
extends:
|
||||
- .mutter.fedora@x86_64
|
||||
- .test-mutter-base
|
||||
tags:
|
||||
- kvm
|
||||
script:
|
||||
- meson test -C build
|
||||
--no-rebuild
|
||||
--timeout-multiplier 10
|
||||
--setup plain
|
||||
--suite 'mutter/kvm'
|
||||
--print-errorlogs
|
||||
needs:
|
||||
- build-mutter@x86_64
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "build/meson-logs/testlog-plain.junit.xml"
|
||||
|
||||
test-mutter@aarch64:
|
||||
extends:
|
||||
- .mutter.fedora@aarch64
|
||||
- .test-mutter
|
||||
tags:
|
||||
- asan-aarch64
|
||||
- .mutter.fedora:34@aarch64
|
||||
needs:
|
||||
- build-mutter@aarch64
|
||||
when: manual
|
||||
|
||||
coverage:
|
||||
.test-mutter-coverage:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
- .fdo.distribution-image@fedora
|
||||
stage: analyze
|
||||
script:
|
||||
- mkdir coveragereport
|
||||
- gcovr --add-tracefile 'coverage-*.json'
|
||||
--html-details --print-summary --output coveragereport/index.html
|
||||
- gcovr --add-tracefile 'coverage-*.json'
|
||||
--xml --output coveragereport/coverage.xml
|
||||
- ninja -C build coverage
|
||||
- cat build/meson-logs/coverage.txt
|
||||
artifacts:
|
||||
expose_as: 'Coverage Report'
|
||||
paths:
|
||||
- coveragereport
|
||||
- coveragereport/index.html
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
# TODO: we may need to split this file once it will reach the
|
||||
# gitlab limit size of 10M, or it will stop working:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/328772
|
||||
path: coveragereport/coverage.xml
|
||||
coverage: '/^lines: (\d+\.\d+\%)/'
|
||||
- build/meson-logs/coveragereport
|
||||
coverage: '/^TOTAL.*\s+(\d+\%)$/'
|
||||
|
||||
test-mutter-coverage@x86_64:
|
||||
extends:
|
||||
- .test-mutter-coverage
|
||||
- .mutter.fedora:34@x86_64
|
||||
needs:
|
||||
- test-mutter@x86_64
|
||||
# - test-mutter@aarch64
|
||||
- test-mutter-kvm@x86_64
|
||||
|
||||
can-run-gnome-shell@x86_64:
|
||||
test-mutter-coverage@aarch64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
- .test-setup
|
||||
- .test-mutter-coverage
|
||||
- .mutter.fedora:34@aarch64
|
||||
needs:
|
||||
- test-mutter@aarch64
|
||||
|
||||
can-build-gnome-shell@x86_64:
|
||||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora:34@x86_64
|
||||
stage: test
|
||||
needs:
|
||||
- build-mutter@x86_64
|
||||
before_script:
|
||||
- !reference [.mutter.fedora@x86_64, before_script]
|
||||
- sudo meson install --no-rebuild -C build
|
||||
- meson install --no-rebuild -C build
|
||||
script:
|
||||
- .gitlab-ci/checkout-gnome-shell.sh
|
||||
- meson setup gnome-shell gnome-shell/build --prefix /usr -Dbuildtype=debugoptimized -Dman=false --werror --fatal-meson-warnings
|
||||
- sudo meson install -C gnome-shell/build
|
||||
- dbus-run-session -- xvfb-run meson test -C gnome-shell/build --no-rebuild
|
||||
- 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: on_success
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
when: 'manual'
|
||||
when: always
|
||||
- when: manual
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora:34@x86_64
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-fedora-container@x86_64
|
||||
stage: analyze
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/download-coverity-tarball.sh
|
||||
- CC=clang meson setup coverity-build -Dprofiler=false
|
||||
- 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
|
||||
@@ -604,33 +349,18 @@ test-mutter-coverity:
|
||||
dist-mutter:
|
||||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora@x86_64
|
||||
- .build-mutter-base
|
||||
- .test-setup
|
||||
- .mutter.fedora:34@x86_64
|
||||
<<: *test-setup
|
||||
stage: deploy
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
- build-mutter@x86_64
|
||||
script:
|
||||
- meson setup . build --werror --prefix /usr
|
||||
-Dbuildtype=debugoptimized
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
|
||||
./src/tests/meta-dbus-runner.py
|
||||
--launch=wireplumber
|
||||
meson dist -C build
|
||||
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS" meson dist -C build
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
|
||||
when: manual
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes:
|
||||
- "**/meson.build"
|
||||
- meson/*
|
||||
when: on_success
|
||||
- if: '$GITLAB_USER_LOGIN == "marge-bot"'
|
||||
when: on_success
|
||||
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "marge-bot"'
|
||||
when: on_success
|
||||
|
||||
dist-mutter-tarball:
|
||||
extends: dist-mutter
|
||||
@@ -640,36 +370,3 @@ dist-mutter-tarball:
|
||||
- build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
|
||||
reference:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
stage: docs
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
script:
|
||||
- meson setup . build --werror -Ddocs=true -Dtests=false
|
||||
- ninja -C build
|
||||
- mkdir references
|
||||
- cp -r doc/website/* ./references
|
||||
- mv build/doc/reference/{cally/cally,clutter/clutter,cogl/cogl,cogl-pango/cogl-pango,meta/meta,mtk/mtk} references/
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
expose_as: 'Documentation'
|
||||
paths:
|
||||
- references/
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
needs: ['reference']
|
||||
extends:
|
||||
- .skip-git-clone
|
||||
script:
|
||||
- mv references public/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "GNOME")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
fetch() {
|
||||
local remote=$1
|
||||
@@ -41,9 +41,8 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$gnome_shell_target" ]; then
|
||||
ref_remote=${CI_PROJECT_URL//mutter/gnome-shell}
|
||||
echo -n Looking for $CI_COMMIT_REF_NAME on remote ...
|
||||
if fetch $ref_remote $CI_COMMIT_REF_NAME; then
|
||||
if fetch origin $CI_COMMIT_REF_NAME; then
|
||||
echo \ found
|
||||
gnome_shell_target=FETCH_HEAD
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
# We need a coverity token to fetch the tarball
|
||||
if [ -x $COVERITY_TOKEN ]
|
||||
|
||||
@@ -2,81 +2,38 @@
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<-EOF
|
||||
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
|
||||
|
||||
Check out and install a meson project
|
||||
|
||||
Options:
|
||||
-Dkey=val Option to pass on to meson
|
||||
--subdir Build subdirectory instead of whole project
|
||||
--prepare Script to run before build
|
||||
|
||||
-h, --help Display this help
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
TEMP=$(getopt \
|
||||
--name=$(basename $0) \
|
||||
--options='D:h' \
|
||||
--longoptions='subdir:' \
|
||||
--longoptions='prepare:' \
|
||||
--longoptions='help' \
|
||||
-- "$@")
|
||||
|
||||
eval set -- "$TEMP"
|
||||
unset TEMP
|
||||
|
||||
MESON_OPTIONS=()
|
||||
SUBDIR=.
|
||||
PREPARE=:
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-D)
|
||||
MESON_OPTIONS+=( -D$2 )
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--subdir)
|
||||
SUBDIR=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--prepare)
|
||||
PREPARE=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
usage
|
||||
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"
|
||||
COMMIT="$2"
|
||||
TAG_OR_BRANCH="$2"
|
||||
SUBDIR="$3"
|
||||
COMMIT="$4"
|
||||
|
||||
CHECKOUT_DIR=$(mktemp --directory)
|
||||
trap "rm -rf $CHECKOUT_DIR" EXIT
|
||||
REPO_DIR="$(basename ${REPO_URL%.git})"
|
||||
|
||||
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
|
||||
git clone --depth 1 "$REPO_URL" -b "$TAG_OR_BRANCH"
|
||||
pushd "$REPO_DIR"
|
||||
pushd "$SUBDIR"
|
||||
|
||||
pushd "$CHECKOUT_DIR/$SUBDIR"
|
||||
sh -c "$PREPARE"
|
||||
meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
|
||||
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"
|
||||
|
||||
@@ -52,39 +52,6 @@ style][gnome-coding-style], with some additions described below.
|
||||
* Initialize and assign floating point variables (i.e. `float` or
|
||||
`double`) using the form `floating_point = 3.14159` or `ratio = 2.0`.
|
||||
|
||||
## Naming conventions
|
||||
|
||||
* For object instance pointers, use a descriptive name instead of `self`, e.g.
|
||||
|
||||
```c
|
||||
G_DEFINE_TYPE (MetaPlaceholder, meta_placeholder, G_TYPE_OBJECT)
|
||||
|
||||
...
|
||||
|
||||
void
|
||||
meta_placeholder_hold_place (MetaPlaceholder *placeholder)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
* When object instance pointers are pointers to non-generic implementations of
|
||||
a generalized type, the convention is to suffix the variable name with the
|
||||
sub-type name. E.g.
|
||||
|
||||
```c
|
||||
G_DEFINE_TYPE (MetaPlaceholderWayland, meta_placeholder_wayland,
|
||||
META_TYPE_PLACEHOLDER)
|
||||
|
||||
...
|
||||
|
||||
void
|
||||
meta_placeholder_wayland_get_waylandy (MetaPlaceholderWayland *placeholder_wayland)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Header (.h) files
|
||||
|
||||
* The return type and `*` are separated by a space.
|
||||
@@ -108,50 +75,17 @@ MetaUdev * meta_udev_new (MetaBackendNative *backend_native);
|
||||
Keep functions in the following order in source files:
|
||||
|
||||
1. GPL header
|
||||
2. Include header files
|
||||
3. Enums
|
||||
4. Structures
|
||||
5. Function prototypes
|
||||
6. `G_DEFINE_TYPE()`
|
||||
7. Static variables
|
||||
8. Auxiliary functions
|
||||
9. Callbacks
|
||||
10. Interface implementations
|
||||
11. Parent vfunc overrides
|
||||
12. class_init and init
|
||||
13. Public API
|
||||
|
||||
### Include header files
|
||||
|
||||
Source files should use the header include order of the following example:
|
||||
|
||||
* `meta-example.c`:
|
||||
```c
|
||||
#include "config.h"
|
||||
|
||||
#include "meta-example-private.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include <wayland-server-core.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "mtk/mtk.h"
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "wayland/meta-wayland-surface-private.h"
|
||||
#endif
|
||||
|
||||
#include "meta-dbus-file-generated-by-gdbus-codegen.h"
|
||||
```
|
||||
|
||||
Include paths for non-system includes should be relative to the corresponding
|
||||
modules source root; i.e. `"backends/meta-backend-private.h"` for
|
||||
`src/backends/` and `"clutter/clutter.h"` for `clutter/clutter/clutter.h`.
|
||||
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
|
||||
|
||||
@@ -349,46 +283,4 @@ click_action_clicked_cb (ClutterClickAction *click_action,
|
||||
}
|
||||
```
|
||||
|
||||
## Trace Span Naming
|
||||
|
||||
Trace spans should be named in C++ style, i.e.
|
||||
`Namespace::Class::method(args)`. For example:
|
||||
|
||||
```c
|
||||
static void
|
||||
meta_wayland_surface_commit (MetaWaylandSurface *surface)
|
||||
{
|
||||
/* ... */
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (MetaWaylandSurfaceCommit,
|
||||
"Meta::WaylandSurface::commit()");
|
||||
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
This is to facilitate automatic name shrinking in profilers that will cut out
|
||||
the least important parts of the name (args, then namespaces in order, then
|
||||
class) to fit the name on screen when zoomed-out.
|
||||
|
||||
If you need to annotate multiple spans within a function, you can append their
|
||||
name to the function name, delimited by a `#` sign. For example:
|
||||
|
||||
```c
|
||||
void
|
||||
meta_thing_do_stuff (MetaThing *thing)
|
||||
{
|
||||
COGL_TRACE_BEGIN_SCOPED (OneThing, "Meta::Thing::do_stuff#one_thing()");
|
||||
/* Code that does one thing that takes time */
|
||||
COGL_TRACE_END (OneThing);
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (OtherThing, "Meta::Thing::do_stuff#other_thing()");
|
||||
/* Code that does other thing that takes time */
|
||||
COGL_TRACE_END (OtherThing);
|
||||
}
|
||||
```
|
||||
|
||||
Keeping in the entire method name helps in profiler views that don't show
|
||||
parent-child relationships, i.e. a global span statistics view.
|
||||
|
||||
[gnome-coding-style]: https://developer.gnome.org/documentation/guidelines/programming/coding-style.html
|
||||
[gnome-coding-style]: https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en
|
||||
900
NEWS
900
NEWS
@@ -1,818 +1,11 @@
|
||||
46.0
|
||||
41.1
|
||||
====
|
||||
* Fix duplicate scroll events over libei [Peter; !3637]
|
||||
* Fix window menu with mouse button modifier [Jonas; !3623]
|
||||
* Fix caret offset in accessible event [Carlos; !3643]
|
||||
* Fix handling of scroll events for mice [Carlos; !3642]
|
||||
* Use timerfd for clock timing [Christian; !3636]
|
||||
* Advertise support for BGRA for all screencast types [Robert; !3617]
|
||||
* Add support for preferred_buffer_scale/transform [Robert; !3580]
|
||||
* Use memfd to store selection data [Yotam; !3551]
|
||||
* Fix globally active input focus [Sebastian K.; !3651]
|
||||
* Call malloc_trim() after loading background image [Sebastian K.; !3653]
|
||||
* Fix dynamic max render time sometimes getting stuck on constant framerate
|
||||
[Robert; !3655]
|
||||
* Introduce base of new gesture framework [Jonas; !2389]
|
||||
* Work around windows missing work area changes [Balló; !3601]
|
||||
* Fix black screen with some drivers [Sebastian W.; !3646]
|
||||
* Improve login screen <-> session transition [Jocelyn; !3659]
|
||||
* Fixed crashes [Bilal, Carlos; !3656, !3660]
|
||||
* Misc. bug fixes and cleanups [Philip, Peter, Sebastian W., Zander, Petr,
|
||||
Sebastian K., Robert, Bilal, Jonas; !3640, !3647, !3648, !3654, !3658, !3622,
|
||||
!1918, !3067, !3661, !3662, !3652, !3645]
|
||||
|
||||
Contributors:
|
||||
Yotam Bar-On, Zander Brown, Jonas Dreßler, Bilal Elmoussaoui, Jocelyn Falempe,
|
||||
Carlos Garnacho, Balló György, Christian Hergert, Petr Hodina, Peter Hutterer,
|
||||
Sebastian Keller, Robert Mader, Sebastian Wick, Philip Withnall
|
||||
|
||||
Translators:
|
||||
Sabri Ünal [tr], Aurimas Černius [lt], Jordi Mas i Hernandez [ca],
|
||||
Asier Sarasua Garmendia [eu], Matej Urbančič [sl], Anders Jonsson [sv],
|
||||
Bruce Cowan [en_GB], Guillaume Bernard [fr], Kukuh Syafaat [id],
|
||||
Milo Casagrande [it], Rūdolfs Mazurs [lv], Fran Dieguez [gl],
|
||||
Ask Hjorth Larsen [da]
|
||||
|
||||
46.rc
|
||||
=====
|
||||
* screencast: Renegotiate when DMABUF allocation fails [columbarius; !2557]
|
||||
* Unify wayland pointer- and keyboard grab mechanisms [Carlos; !3420]
|
||||
* Add modifier-aware screencasting support [Doğukan; !3537]
|
||||
* Fix synchronization issue on Xorg [Daniel; !3590]
|
||||
* Send fractional_scale event immediately on window creation [Jonas; !3598]
|
||||
* wayland/client: Add make_dock() method [Leonhard; !3612]
|
||||
* Fix gray area on top of some X11 fullscreen windows [Sebastian K.; !3608]
|
||||
* Stick dragged windows to the right anchor point [Carlos; !3546]
|
||||
* cally/text: Fix emission of `text_caret_moved` signal [Florian; !3621]
|
||||
* clutter/text: Fix minimum height calculation [Julian; !3610]
|
||||
* Add experimental support for variable refresh rate [Dor; !1154]
|
||||
* Expose the minimum refresh rate of monitors through D-Bus [Dor; !3576]
|
||||
* Use "default" cursor for moving windows [Sebastian K.; !3634]
|
||||
* Fixed crashes [Carlos, Michel; !3618, !3632]
|
||||
* Misc. bug fixes and cleanups [Robert, Bilal, Dor, Florian, Sebastian W.,
|
||||
Daniel, msizanoen, Corentin, Agustín, Sebastian K., Marco, Doğukan, Carlos,
|
||||
Jonas, Barnabás; !3217, !3581, !3582, !3583, !3586, !3574, !3587, !3585,
|
||||
!3584, !3588, !3553, !3589, !3593, !3595, !3597, !3599, !3327, !3603, !3606,
|
||||
!3594, !3611, !3613, !3552, !3620, !3592, !3614, !3619, !3625, !3628, !3627,
|
||||
!3624, !3629, !3630, !3633, !3027]
|
||||
|
||||
Contributors:
|
||||
Dor Askayo, columbarius, Agustín Dall'Alba, Michel Dänzer, Jonas Dreßler,
|
||||
Bilal Elmoussaoui, Carlos Garnacho, Sebastian Keller, Doğukan Korkmaztürk,
|
||||
Leonhard, Robert Mader, msizanoen, Florian Müllner, Corentin Noël,
|
||||
Barnabás Pőcze, Julian Sparber, Marco Trevisan (Treviño), Daniel van Vugt,
|
||||
Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Ekaterine Papava [ka], Danial Behzadi [fa], Aurimas Černius [lt],
|
||||
Yuri Chornoivan [uk], Yaron Shahrabani [he], Nathan Follens [nl],
|
||||
Matej Urbančič [sl], Jordi Mas i Hernandez [ca], Kukuh Syafaat [id],
|
||||
Luming Zh [zh_CN], Andi Chandler [en_GB], Asier Sarasua Garmendia [eu],
|
||||
Quentin PAGÈS [oc], Rūdolfs Mazurs [lv], Irénée THIRION [fr],
|
||||
Daniel Mustieles [es], Daniel Rusek [cs], Piotr Drąg [pl], Balázs Úr [hu],
|
||||
Artur S0 [ru]
|
||||
|
||||
46.beta
|
||||
=======
|
||||
* Implement mouse cursor hotspots for KMS atomic [Albert, Zack; !3337, !3503]
|
||||
* Improve project and development documentation
|
||||
[Bilal, Sebastian W.; !3489, !3505, !3519]
|
||||
* Add a documentation website [Bilal; !3490]
|
||||
* Refactor wayland focus management [Carlos; !3511]
|
||||
* Remove experimental rt-scheduler feature [Dallas; !3296]
|
||||
* Remove ClutterCanvas [Shmuel; !3470]
|
||||
* Consider reduced blanking with lower pixelclock [Kai-Heng; !3449]
|
||||
* Fix centering non-modal transients over parent [Florian; !3533]
|
||||
* Allow XKB model to be configured [Leorize; !2760]
|
||||
* Enable KMS deadline timer after a VT switch if it was inhibited [Dor; !3534]
|
||||
* Prepare for variable refresh rate support [Dor; !3521, !3560, !3561]
|
||||
* Restore IM state flushing before handling key events [Carlos; !3536]
|
||||
* Swap stylus buttons to match traditional order [Peter; !3541]
|
||||
* Fix handling of pad ring wrap arounds [Peter; !3545]
|
||||
* Support Broadcast RGB/RGB range KMS property [Sebastian W.; !3535]
|
||||
* Ensure all planes support EGL config format [Sebastian W.; !3512]
|
||||
* Handle Alt modifier in pad actions [Peter; !3522]
|
||||
* Store eraser and stylus tools separately [Peter; !3542]
|
||||
* Disambiguate output mapped to tablet with connector name [Carlos; !3556]
|
||||
* Fix lost keyboard focus after dismissing popups [Carlos; !3568]
|
||||
* Implement direct scanout for cropped and scaled surfaces
|
||||
[Robert; !3559, !3177]
|
||||
* Fixed crashes [Peter, Carlos, Sebastian W., Simon, Olivier, Daniel; !3383,
|
||||
!3517, !3518, !2774, !3446, !3539, !3562, !3565]
|
||||
* Misc. bug fixes and cleanups [Bilal, Daniel, Sebastian W., Robert, Zander,
|
||||
Florian, Carlos, Corentin, Shmuel, Dor, Sebastian K., Jonas; !3498, !3418,
|
||||
!3500, !3492, !3484, !3504, !3499, !3333, !3351, !3501, !3211, !3506, !3387,
|
||||
!3509, !3510, !3483, !3467, !3514, !3515, !3516, !3520, !3513, !3507, !3526,
|
||||
!3527, !3528, !3450, !3531, !3549, !3532, !3543, !3529, !3530, !3550, !3554,
|
||||
!3540, !3569, !3563, !3570, !3555, !3572, !3571, !3538, !3573, !3575]
|
||||
|
||||
Contributors:
|
||||
Dor Askayo, Zander Brown, Jonas Dreßler, Bilal Elmoussaoui, Albert Esteve,
|
||||
Kai-Heng Feng, Olivier Fourdan, Carlos Garnacho, Peter Hutterer,
|
||||
Sebastian Keller, Leorize, Robert Mader, Simon McVittie, Shmuel Melamud,
|
||||
Florian Müllner, Corentin Noël, Zack Rusin, Dallas Strouse, Daniel van Vugt,
|
||||
Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Ekaterine Papava [ka], Efstathios Iosifidis [el], Artur S0 [ru],
|
||||
Daniel Rusek [cs], Fran Dieguez [gl], Sabri Ünal [tr]
|
||||
|
||||
46.alpha
|
||||
========
|
||||
* Fix filtering keybinding events in presence of grabs [Sebastian K.; !3054]
|
||||
* Fix direct scanout support when using integer scaling [Daniel; !3290]
|
||||
* Fix capitalization of some keys when caps lock is on [Carlos; !3306]
|
||||
* Fix vsync regression [Robert; !3286]
|
||||
* Fix visibility of software cursors when using direct scanout [Robert; !3302]
|
||||
* Fix artifacts at the bottom of some surfaces [Robert; !3310]
|
||||
* Discard monitor configs with fractional scale when unusable [Jonas Å.; !3299]
|
||||
* Apply track point settings [Rohan; !3089]
|
||||
* xwayland: Enable XDG portal only when not nested [Olivier; !3303]
|
||||
* Inhibit real-time scheduling when mode setting [Ray; !3324]
|
||||
* Don't delay frame updates after idle period [Michel; !3174]
|
||||
* Fix running Xwayland in headless setup with nvidia driver [Olivier; !3320]
|
||||
* wayland: Send keyboard modifiers after the enter event [Alexandros; !3341]
|
||||
* wayland/client: Add make_desktop() method [Florian; !3305]
|
||||
* Add a target workspace to raise_and_make_recent() [Sebastian W.; !3315]
|
||||
* clutter: Drop cairo helpers [Bilal; !3086]
|
||||
* cogl: Port away from CoglObject [Bilal; !3193]
|
||||
* mtk: Add a Region type [Bilal; !3292]
|
||||
* Propagate focus appearance to all ancestors [Sebastian W.; !3356]
|
||||
* Ignore locked modifiers in keybinding machinery [Carlos; !3369]
|
||||
* Fix disabling check-alive timeout [Sebastian K.; !3367]
|
||||
* Drop ClutterContainer interface [Zander; !3377, !3384]
|
||||
* Improve sloppy and mouse focus modes [Sebastian W.; !3258]
|
||||
* Sync geometry only when window is mapped [Sebastian W.; !3401, !3404]
|
||||
* Improve repick due to transform changes [Carlos; !3385]
|
||||
* Fix tablets on X11 having the wrong device [Carlos; !3393]
|
||||
* Disable HW cursor when inhibited by backend [Robert; !3412]
|
||||
* screencast: Bring back blitting [Georges; !3406]
|
||||
* backends/native: Try 10 bpc formats [Michel; !3139]
|
||||
* Fix forcing EGLStream with NVIDIA proprietary driver [Daniel; !2905]
|
||||
* screencast: Add ability to stop streams [Jonas Å., Pascal; !3307]
|
||||
* Use standard cursor names from CSS specification [Carlos; !3295]
|
||||
* Avoids over-synchronization due to client reads [Michel; !3389, !3408]
|
||||
* Add more profiling instrumentation [Ivan; !3417]
|
||||
* Allow specifyig the layout manager for an actor type [Florian; !3445]
|
||||
* Fix handling of relative mode for tablets [Peter; !3410]
|
||||
* Dynamically assign hardware planes during configuration [Jonas Å.; !3428]
|
||||
* Simplify X11 focus management [Carlos; !3269]
|
||||
* background: Fix background color around image [Sebastian W.; !3459]
|
||||
* text-input: Use correct offsets in delete_surrounding_text [Alynx; !2712]
|
||||
* Add wayland shm YCbCr support [Sebastian W.; !3371]
|
||||
* Set a minimum guessed scale [Joan; !3464]
|
||||
* Fix building without native backend [Bilal; !3480]
|
||||
* Fix occasional artifacts at top of X11 fullscreen windows [Carlos; !3476]
|
||||
* Add documentation for building, running and debugging
|
||||
[Sebastian W.; !3465, !3485]
|
||||
* Improve tablet pressure curve calculation [Peter; !3399]
|
||||
* Fixed crashes [Carlos, Jonas D., Robert, Sebastian W., Jonas Å., Sebastian K.;
|
||||
!3287, !3283, !3311, !3322, !3318, !3370, !3392, !3335, !3422, !3376, !3453]
|
||||
* Plugged leaks [Sebastian K.; !3411, !3442]
|
||||
* Misc. bug fixes and cleanups [Daniel, Corentin, Carlos, Jonas Å., Ivan,
|
||||
Michel, Sebastian W., Robert, Barnabás, Peter, Bilal, Sebastian K., Zander,
|
||||
Florian, Mike, Qiu, Olivier, Christopher, Mart; !3212, !3298, !3267, !3297,
|
||||
!3313, !3316, !3317, !3323, !3325, !3326, !3328, !3330, !3332, !3319, !3097,
|
||||
!3288, !3347, !3178, !3240, !3338, !3352, !3321, !2618, !3309, !3353, !3348,
|
||||
!3349, !3358, !3361, !3362, !3276, !3340, !3365, !3366, !3364, !3363, !3375,
|
||||
!3181, !3374, !3379, !3382, !3388, !3354, !3386, !3398, !3395, !3397, !3368,
|
||||
!3400, !3396, !3405, !3403, !3409, !3413, !3402, !3280, !3394, !3421, !3423,
|
||||
!3431, !3432, !3425, !3438, !3440, !3430, !3429, !2016, !3443, !3444, !3441,
|
||||
!3451, !3350, !3434, !3437, !3447, !1908, !3456, !3452, !3454, !3455, !2620,
|
||||
!3463, !3466, !3458, !3468, !3469, !3474, !3473, !3471, !3479, !3482, !3487,
|
||||
!3486, !3478, !3488, !3357, !3491]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Zander Brown, Michel Dänzer, Jonas Dreßler, Bilal Elmoussaoui,
|
||||
Christopher Fore, Olivier Fourdan, Alexandros Frantzis, Carlos Garnacho,
|
||||
Mike Gorse, Peter Hutterer, Rohan Hendrik Jotz-Lean, Sebastian Keller,
|
||||
Robert Mader, Ivan Molodetskikh, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Pascal Nowack, Barnabás Pőcze,
|
||||
Mart Raudsepp, Ray Strode, Joan Torres, Daniel van Vugt, Qiu Wenbo,
|
||||
Sebastian Wick, Alynx Zhou
|
||||
|
||||
Translators:
|
||||
Kristjan SCHMIDT [eo], Rafael Fontenelle [pt_BR], Guillaume Bernard [fr],
|
||||
Jordi Mas i Hernandez [ca], Florentina Mușat [ro], Ngọc Quân Trần [vi],
|
||||
Artur S0 [ru]
|
||||
|
||||
45.0
|
||||
====
|
||||
* Fix focus-follows-mouse mode [Carlos; !3256]
|
||||
* Optimize applying relative transformation matrix [Robert; !3259]
|
||||
* Add support for P010 YCbCr format [Robert; !3244]
|
||||
* Fix hardware cursor stuttering on Raspberry Pi [Daniel; !3279]
|
||||
* Fix input in multi-monitor remote desktop sessions with libei [Pascal; !3273]
|
||||
* Fixed crashes [Carlos, Daniel, Sebastian W.; !3252, !3253, !3255, !3160,
|
||||
!3268, !3262, !3277]
|
||||
* Misc. bug fixes and cleanups [Florian, Joan, Jonas, Carlos, Sebastian W.,
|
||||
Pascal; !3248, !3249, !3263, !3261, !3116, !3251, !3032, !3275, !3278]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Carlos Garnacho, Sebastian Keller, Andre Klapper, Robert Mader,
|
||||
Florian Müllner, Pascal Nowack, Joan Torres, Daniel van Vugt, Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Sabri Ünal [tr], Quentin PAGÈS [oc], Anders Jonsson [sv],
|
||||
Christian Kirbach [de], Ask Hjorth Larsen [da]
|
||||
|
||||
45.rc
|
||||
=====
|
||||
* Fix possible redraw freeze in fullscreen windows [msizanoen; !3127]
|
||||
* Fix restoring focus when leaving the overview [Jonas Å., Carlos; !3185]
|
||||
* Support alpha-composited window screencasts [Georges; !3175]
|
||||
* Fix some XWayland windows not getting mapped [Sebastian; !3194]
|
||||
* Fix cursor movement on rotated screens [Daniel; !3180]
|
||||
* Avoid global lock in stage signals [Christian; !3204]
|
||||
* Implemented suspended xdg_toplevel state [Jonas Å.; !3019, !3213]
|
||||
* Support idle_inhibit protocol [Charbel; !3145]
|
||||
* Do not trigger repick during relayout [Carlos; !3220]
|
||||
* Fix redraw issue when buffer age is unavailable [Carlos; !3221]
|
||||
* Add Meta Toolkit (MTK) library [Bilal; !3128]
|
||||
* Fix possible window freeze during resize operations [Carlos; !3189]
|
||||
* Fixes to tablet cursor visibility on Wayland [Carlos; !3218]
|
||||
* Improve support for input capture and emulated input [Jonas Å.; !3228]
|
||||
* Use headless mode when seat ID is unset [Joan; !3093]
|
||||
* Fix unresponsive touchscreen after titlebar drag [Carlos; !3059]
|
||||
* Fix absolute pointer events on virtual monitor streams [Jonas Å.; !3241]
|
||||
* Fix disabling CRTCs in disable-only mode updates [Jonas Å.; !3073]
|
||||
* Cache multi-texture shader snippets [Daniel; !3224]
|
||||
* Fixed crashes [Carlos, Jonas Å., Jonas D., Barnabás, Jeremy; !3183, !3219,
|
||||
!3234, !3216, !3202, !3229, !3246]
|
||||
* Plugged leaks [Sebastian, Niels; !3188, !3203]
|
||||
* Misc. bug fixes and cleanups [Bilal, Michel, Jonas Å., Florian, Carlos,
|
||||
Sebastian, Sandro, Daniel, Pascal, Georges, Jonas D., Uzair; !3087, !3154,
|
||||
!3169, !3124, !3173, !3190, !3197, !3198, !3215, !3209, !3155, !3225, !3226,
|
||||
!3223, !3231, !3187, !3230, !3210, !3227, !3233, !3235, !3237, !3238, !3236,
|
||||
!3239, !3243, !3199, !3247, !3242]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Uzair Ahmad, Charbel Assaad, Sandro Bonazzola, Jeremy Cline,
|
||||
Michel Dänzer, Jonas Dreßler, Bilal Elmoussaoui, Carlos Garnacho,
|
||||
Niels De Graef, Christian Hergert, Sebastian Keller, msizanoen,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Pascal Nowack, Barnabás Pőcze,
|
||||
Joan Torres, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Kukuh Syafaat [id], Sabri Ünal [tr], Jiri Grönroos [fi],
|
||||
Baurzhan Muftakhidinov [kk], Vasil Pupkin [be], Jordi Mas [ca],
|
||||
Aurimas Černius [lt], A S Alam [pa], Nathan Follens [nl], Philipp Kiemle [de],
|
||||
Milo Casagrande [it], Yaron Shahrabani [he], Gwan-gyeong Mun [ko],
|
||||
Bruce Cowan [en_GB]
|
||||
|
||||
45.beta.1
|
||||
=========
|
||||
* Fix blitting from premultiplied to opaque formats [Jonas; !3159]
|
||||
* Fix Super key not going to overview in GNOME Shell [Carlos; 3162]
|
||||
* Use ClutterEvent in ClutterActor class event vmethod signatures
|
||||
[Carlos; 3163]
|
||||
* Misc. bug fixes and cleanups [Carlos, !3167, !3168]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Carlos Garnacho
|
||||
|
||||
Translators:
|
||||
Piotr Drąg [pl], Daniel Mustieles [es]
|
||||
|
||||
45.beta
|
||||
=======
|
||||
* Support input capture and emulated input with libei
|
||||
[Jonas, Peter, Olivier; !2628]
|
||||
* Add KMS thread [Jonas; !2777]
|
||||
* Fix touch move operations on subsurfaces [Gergo; !3125]
|
||||
* Fix unexpected cursor changes over non-resizable windows [Michel; !3096]
|
||||
* Improve render time estimates [Michel; !3090]
|
||||
* Fix flickering when DRI driver isn't available [Daniel; !3117]
|
||||
* Fix restoring maximized state of SSD windows [Sebastian K.; !3035]
|
||||
* Add support for YUV formats [Niels, Robert; !2191]
|
||||
* Fix xwayland-allow-byte-swapped-clients setting [Olivier; !3156]
|
||||
* Misc. bug fixes and cleanups [Jonas, Florian, Bilal, Daniel, Robert,
|
||||
Sebastian W., Michel, Carlos; !3111, !3100, !3112, !3065, !3101, !3129,
|
||||
!3118, !3131, !3123, !3135, !3134, !3130, !3141, !3140, !3144, !3148, !3138,
|
||||
!3150, !3005, !3103, !3126, !3147, !3157, !3153]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Michel Dänzer, Bilal Elmoussaoui, Olivier Fourdan,
|
||||
Carlos Garnacho, Niels De Graef, Peter Hutterer, Sebastian Keller,
|
||||
Gergo Koteles, Robert Mader, Florian Müllner, Daniel van Vugt, Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Yosef Or Boczko [he], Fabio Tomat [fur], Balázs Úr [hu],
|
||||
Ekaterine Papava [ka], Yuri Chornoivan [uk], Artur So [ru],
|
||||
Matej Urbančič [sl], Asier Sarasua Garmendia [eu], Danial Behzadi [fa],
|
||||
Luming Zh [zh_CN], Hugo Carvalho [pt], Daniel Rusek [cs], Fran Dieguez [gl],
|
||||
Daniel Mustieles [es]
|
||||
|
||||
45.alpha
|
||||
========
|
||||
* Fix DND in some server-side decorated windows [Sebastian; !2978]
|
||||
* Optionally use libdisplay-info for EDID parsing [adarshgm; !2642]
|
||||
* Optimize partial surface updates [msizanoen1; !2965]
|
||||
* Fix redrawing regression in non-DMA remote sessions [Jonas Å.; !2987]
|
||||
* Avoid race condition in xwayland-on-demand [Marco; !2970]
|
||||
* Do not unminimize windows with initial IconicState [Carlos; !3001]
|
||||
* Implement physical pixel rounding of wayland surfaces [msizanoen1; !2726]
|
||||
* Fix mispositioning of some X11 fullscreen windows [Carlos; !2996]
|
||||
* Fix legacy fullscreen windows appearing on all monitors [Carlos; !2999]
|
||||
* Improve support for display-attached tablets [Carlos; !3012]
|
||||
* Fix stuck cursor in some clients [Carlos; !3025]
|
||||
* Avoid unexpected orientation changes around suspend/resume [Carlos; !3021]
|
||||
* Fix oversized input region around Xwayland windows [Jonas Å.; !3022]
|
||||
* Re-enable client modifiers with amdgpu driver [Robert; !3030]
|
||||
* Fix sysprof tracing in non-main threads [Jonas Å.; !2998]
|
||||
* Fix X11 client input region issues [Sebastian, Jonas Å.; !3031, !3045]
|
||||
* Optimize finish-layout step during stage updating [Robert, Jonas D.; !2679]
|
||||
* Fix profiling repeatedly [Jonas Å.; !3068]
|
||||
* Ensure preferred monitor mode is always included [Timotej; !3061]
|
||||
* Fully initialize input device state during init [Jonas Å.; !3070, !3071]
|
||||
* Forward modifiers to IM alongside regular key events [Carlos; !3044]
|
||||
* Fix window focus unexpectedly moving to secondary monitor when changing
|
||||
workspaces [Sebastian W.; !2909]
|
||||
* Avoid rapidly toggling dynamic max render time [Daniel; !3074]
|
||||
* Fix dynamic max render time blocking with direct scanout [Dor; !3080]
|
||||
* Mirror window placement in RTL locales [Shmuel; !3009]
|
||||
* Fix screencast with fractionally scaled surfaces [msizanoen; !3053]
|
||||
* Reipmlement strict focus mode policy [Brendan; !3063]
|
||||
* Fixed crashes [Jonas Å., Barnabás, Carlos, Robert, Dor; !2992, !2995,
|
||||
!3002, !3004, !3037, !3076, !3077, !3095, !3104]
|
||||
* Plugged leaks [Jonas Å., Dor; !2991, !3078]
|
||||
* Misc. bug fixes and cleanups [Marco, Andy, Sebastian K., Jonas Å., Robert,
|
||||
Alexandre, Bilal, Georges, Florian, Dmitry, Michel, Pascal, Olivier, Carlos,
|
||||
Daniel, Sebastian W., Corentin, Barnabás, Dor; !2903, !2983, !2986, !2985,
|
||||
!2990, !2982, !3000, !2938, !2445, !3006, !3010, !2913, !2893, !2939, !3011,
|
||||
!3007, !3018, !3016, !3024, !3020, !3029, !3034, !3036, !3040, !3046, !3051,
|
||||
!3047, !3055, !3058, !3075, !3081] !3082, !3079, !2911, !3084, !3088, !3085,
|
||||
!3052, !3094, !3083, !3092, !3008, !3098, !3091, !3062, !3108]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, adarshgm, Dor Askayo, Michel Dänzer, Jonas Dreßler,
|
||||
Bilal Elmoussaoui, Olivier Fourdan, Alexandre Franke, Carlos Garnacho,
|
||||
Andy Holmes, Sebastian Keller, Dmitry V. Levin, Robert Mader, Shmuel Melamud,
|
||||
msizanoen, msizanoen1, Florian Müllner, Georges Basile Stavracas Neto,
|
||||
Corentin Noël, Pascal Nowack, Barnabás Pőcze, Timotej Šulík,
|
||||
Marco Trevisan (Treviño), Daniel van Vugt, Sebastian Wick, Brendan William
|
||||
|
||||
Translators:
|
||||
Danial Behzadi [fa], Simon Elst [fr], Rafael Fontenelle [pt_BR],
|
||||
Sergej A [ru], Bruce Cowan [en_GB], Alexandre Franke [fr]
|
||||
|
||||
44.1
|
||||
====
|
||||
* Fall back to the default, not the unknown color space [Sebastian W.; !2915]
|
||||
* Fix resizing windows via keyboard [Florian; !2908]
|
||||
* Fix possible screen freeze after resume with multiple monitors [Daniel; !2933]
|
||||
* Fix anchor position when dragging window [Carlos; !2942]
|
||||
* Fix applying XSettings to decorations on X11 [Marco; !2948]
|
||||
* Allow clipped redraws for headless backend [Salman; !2775]
|
||||
* Improve screencast support [Georges; !2804]
|
||||
* Fix focus-on-click for server-side decorated windows [Carlos; !2954]
|
||||
* Fix initial fullscreen state of server-side decorated windows [Carlos; !2961]
|
||||
* Fix feedback loop triggering bursts of excessive CPU load [Robert; !2823]
|
||||
* Enable modifiers by default on non-native backend [Robert; !2972]
|
||||
* Check EDID for supported sink Colorimetry [Sebastian W.; !2919]
|
||||
* Fix artifacts in titlebars on some hardware [Carlos; !2976]
|
||||
* Fix map transitions for X11 windows on wayland [Carlos; !2975]
|
||||
* Fixed crashes [Jonas Å., Sebastian K., Carlos, Michel, Daniel, Robert;
|
||||
!2932, !2930, !2945, !2956, !2962, !2968, !2967, !2960, !2963]
|
||||
* Plugged leaks [Sebastian K., Jonas Å.; !2922, !2926, !2957]
|
||||
* Misc. bug fixes and cleanups [Daniel, Ivan, Emmanuele, Simon, Jonas D.,
|
||||
Jonas Å., Chris, Florian, Corentin, msizanoen1, Sebastian K.; !2918, !2904,
|
||||
!2928, !2929, !2900, !2856, !2944, !2935, !2947, !2949, !2951, !2940, !2953,
|
||||
!2964, !2934, !2902, !2971]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Emmanuele Bassi, Michel Dänzer, Jonas Dreßler, Carlos Garnacho,
|
||||
Sebastian Keller, Robert Mader, Chris Mayo, Simon McVittie, Ivan Molodetskikh,
|
||||
msizanoen1, Florian Müllner, Georges Basile Stavracas Neto, Corentin Noël,
|
||||
Salman, Marco Trevisan (Treviño), Daniel van Vugt, Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Boyuan Yang [zh_CN], Ngọc Quân Trần [vi], Nathan Follens [nl]
|
||||
|
||||
44.0
|
||||
====
|
||||
* Fix state confusion and delay on startup [Carlos; !2906]
|
||||
* Fix night light regression [Sebastian; !2916]
|
||||
* Fix fullscreen regression with many SDL apps [Jonas; !2921]
|
||||
* Fixed crashes [Jonas; !2901, !2912]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Carlos Garnacho, Sebastian Wick
|
||||
|
||||
Translators:
|
||||
Ask Hjorth Larsen [da], Piotr Drąg [pl], Marek Černocký [cs],
|
||||
Gwan-gyeong Mun [ko]
|
||||
|
||||
44.rc
|
||||
=====
|
||||
* Do not overwrite previously set offsets on attach [Matthias; !2843]
|
||||
* Fix Xwayland focus regressions [Carlos; !2841, !2878]
|
||||
* Stop parsing unused EDID parameters [adarshgm; !2825]
|
||||
* Fix partial updates on offscreen rotated screens [Robert; !2860]
|
||||
* Improve Xwayland RandR emulation compatibility [msizanoen1; !2725]
|
||||
* Fix touch window dragging on rotated monitors [Jonas D.; !2859]
|
||||
* Remove legacy OpenGL driver support [Jonas Å.; !2672]
|
||||
* Improve default scale factor selection [Adrian, Jonas Å.; !2653, !2880]
|
||||
* Handle all X11 window title fallbacks [Carlos; !2872]
|
||||
* Fix handling of keyboard-driven window resize [Carlos; !2871]
|
||||
* Fix recording windows on non-active workspaces [Robert; !2789]
|
||||
* Manage KMS updates more asynchronously [Jonas Å.; !2854, !2855]
|
||||
* Fix headless startup [Jonas Å.; !2821]
|
||||
* Remove support for window shading [Robert; !2884]
|
||||
* Move away from GTK3 [Carlos; !2864]
|
||||
* Restore zero-copy fast path for Xwayland fullscreen windows [Carlos; !2797]
|
||||
* Prevent clients from locking the compositor with cursor updates
|
||||
[Olivier; !2849]
|
||||
* Add experimental development tool for HDR modes [Sebastian; !2879]
|
||||
* Account for linear sampling when calculating actor damage [msizanoen1; !2771]
|
||||
* wayland: Implement fractional_scale protocol [Robert; !2394]
|
||||
* Fixed crashes [Jonas D., Jonas Å., Robert; !2858, !2863, !2869, !2885, !2887]
|
||||
* Memory handling fixes
|
||||
[Jonas Å., Carlos, Simon, Michel; !2853, !2868, !2877, !2886]
|
||||
* Misc. bug fixes and cleanups [Jonas Å., Florian, Robert, Carlos, Sebastian,
|
||||
Jonas D.; !2846, !2840, !2850, !2829, !2862, !2779, !2861, !2713, !2865,
|
||||
!2866, !2867, !2874, !2875, !2873, !2881, !2847, !2889, !2890, !2891, !2892,
|
||||
!2894, !2895, !2899]
|
||||
|
||||
Contributors:
|
||||
Dor Askayo, Matthias Clasen, Jonas Dreßler, Michel Dänzer, Olivier Fourdan,
|
||||
Carlos Garnacho, Robert Mader, Simon McVittie, Florian Müllner, Adrian Vovk,
|
||||
Sebastian Wick, adarshgm, msizanoen1, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Марко Костић [sr], Daniel [es], Fabio Tomat [fur], Matej Urbančič [sl],
|
||||
Jiri Grönroos [fi], Balázs Úr [hu], Anders Jonsson [sv], Marek Černocký [cs],
|
||||
Jürgen Benvenuti [de], Alexander Shopov [bg]
|
||||
|
||||
44.beta
|
||||
=======
|
||||
* Don't disable KMS modifiers on newer i915 systems [Sameer; !2641]
|
||||
* Set LOD bias for sharper mipmaps [Daniel; !2644]
|
||||
* Fix edge resistance and window snapping regression [John; !2687]
|
||||
* Avoid high-level udev queries for input caps and properties [Carlos; !2617]
|
||||
* Implement wl_output v3 and v4 [Robert; !2692]
|
||||
* Fix recalculating viewport after window resize [Sebastian Kr.; !2689]
|
||||
* Fix opaque cursors and LoDPI cursor on HiDPI screens [Jonas Å.; !2698]
|
||||
* Process device removing events immediately [Jonas D.; !2696]
|
||||
* Handle stage view updates without allocation more gracefully [Jonas D.; !2694]
|
||||
* Fix window screenshots being cut off at the bottom right [Sebastian K.; !2720]
|
||||
* wayland/subsurface: Avoid using buffers with unfinished client work
|
||||
[Michel; !1880]
|
||||
* Move X11 window decorations to a separate client
|
||||
[Carlos; !2175, !2735, !2756, !2791, !2796, !2758]
|
||||
* Fix cursor position in window screencasts [Georges; !2737]
|
||||
* Skip resize effects for tiled windows during user grabs [Michael; !2579]
|
||||
* Fix pointer constrains with subsurfaces [Robert; !2717]
|
||||
* Disable direct scanout during drag-n-drop operations [Robert; !2677]
|
||||
* Ignore unmapped subsurfaces in direct scanout check [Robert; !2755]
|
||||
* Fix cursor disappearing over windows during grabs [Carlos; !2754]
|
||||
* Make wl_output mode independent of the orientation [Sebastian W.; !2723]
|
||||
* Improve focus handling on workspace switches [Sebastian W.; !2747]
|
||||
* Fix initialization of keyboard accessibility [Carlos; !2750, !2778]
|
||||
* Refactor API to use well-defined ownership instead of singletons
|
||||
[Jonas Å.; !2718]
|
||||
* Add support for xdg-foreign-v2 [Jason, Jonas Å.; !2770]
|
||||
* Add higher bit depth offscreen framebuffers support [Jonas Å., Naveen; !2461]
|
||||
* Overhaul dynamic max render time calculation [Michel; !2500]
|
||||
* Do not require a physical device to update pointer visibility [Carlos; !2766]
|
||||
* Allow building without xwayland support [Bilal; !2407, !2399]
|
||||
* Add Xwayland byte-swapped clients support [Olivier; !2785]
|
||||
* Fix freeze when crossing monitors under some conditions [Carlos; !2803]
|
||||
* Don't allow window activation to break global grabs
|
||||
[Florian, Carlos; !2776, !2832]
|
||||
* Integrate window grab operations with new ClutterGrab API [Carlos; !2683]
|
||||
* Support selecting an acceleration profile for touchpad devices [Evan; !2426]
|
||||
* Enforce compliant surface buffer sizes [Robert; !2815]
|
||||
* Keep proportional position when moving window between rects [Sebastian; !2591]
|
||||
* Introduce implicit grabbing in Clutter [Jonas D.; !2342]
|
||||
* Fix unexpected window focus changes after global grabs [Sebastian W.; !2742]
|
||||
* Fix sloppy/mouse focus mode on wayland [Carlos; !2828]
|
||||
* Add service channel Wayland clients [Jonas Å.; !2810]
|
||||
* Fixed crashes [Sebastian W., Jonas Å., Bilal, Jonas D., msizanoen1, Georges,
|
||||
Carlos, Daniel, Keyu; !2695, !2704, !2706, !2711, !2691, !2709, !2690, !2736,
|
||||
!2745, !2674, !2793, !2794, !2827, !2831, !2834]
|
||||
* Plugged leaks [Niels; !2799, !2817]
|
||||
* Misc. bug fixes and cleanups [Jonas D., Jonas Å., Bilal, Florian, Corentin,
|
||||
Bram, Georges, Hunor, Carlos, Robert, Michel, Christian, Olivier, Daniel,
|
||||
Corey, Sebastian K., Jan, Anders, Simon, Sebastian W., Jake, Erico; !1492,
|
||||
!2508, !2645, !2699, !2418, !2701, !2702, !2703, !2708, !2697, !2710, !2714,
|
||||
!2715, !2716, !2719, 2724, 2739, 2740, 2733, 2753, 2741, !2680, !2727, !2757,
|
||||
!2762, !2671, !2765, !2767, !2707, !2768, !2428, !2467, !2772, !2769, !2781,
|
||||
!2784, !2786, !2780, !2788, !2792, !2783, !2798, !2795, !2800, !2805, !2790,
|
||||
!2809, !2572, !2811, !2812, !2813, !2807, !2773, !2806, !2816, !2818, !2814,
|
||||
!2819, !2782, !2822, !2087, !2824, !2826, !2621, !2748, !2091, !2833, !2808,
|
||||
!2836]
|
||||
|
||||
Contributors:
|
||||
Corey Berla, Hunor Csomortáni, Jake Dane, Jonas Dreßler, Michel Dänzer,
|
||||
Bilal Elmoussaoui, Olivier Fourdan, Jason Francis, Carlos Garnacho,
|
||||
Evan Goode, Niels De Graef, Christian Hergert, Peter Hutterer, Anders Jonsson,
|
||||
Sebastian Keller, Sebastian Krzyszkowiak, Naveen Kumar, Sameer Lattannavar,
|
||||
Robert Mader, Simon McVittie, Florian Müllner, Georges Basile Stavracas Neto,
|
||||
Corentin Noël, Erico Nunes, Bram Stolk, Keyu Tao, Jan Tojnar, Daniel van Vugt,
|
||||
Michael Webster, Sebastian Wick, John Wudrick, msizanoen1, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Dušan Kazik [sk], Aleksandr Melman [ru], Yuri Chornoivan [uk],
|
||||
Hugo Carvalho [pt], Emin Tufan Çetin [tr], Kukuh Syafaat [id],
|
||||
Fran Dieguez [gl], Yosef Or Boczko [he], Asier Sarasua Garmendia [eu],
|
||||
Quentin PAGÈS [oc], Aurimas Černius [lt]
|
||||
|
||||
43.1
|
||||
====
|
||||
* Add quirk to work around issue with Mali GPUs [Daniel; !2614]
|
||||
* Notify changes to night-light support over D-Bus [Sebastian W.; !2623]
|
||||
* Fix always-on-top windows unexpectedly taking focus [Sebastian W.; !2489]
|
||||
* Fix accidental direct scanout [Jonas Å.; !2624]
|
||||
* Disable client modifiers with amdgpu driver [Michel; !2637]
|
||||
* Cancel pointer gesture on wl_pointer.leave [Carlos; !2640]
|
||||
* Add black padding to fixed-size wayland fullscreen windows
|
||||
[Jonas Å., Sebastian W.; !2338]
|
||||
* Stop sending frame callbacks to minimized clients [Robert; !2662]
|
||||
* Fix scrolling in clients with no hi-res scroll support in RDP [José; !2664]
|
||||
* Fix skipped low-res scroll events with some high-res mice [José; !2668]
|
||||
* Throttle interactive move and resize updates [Jonas Å.; !2652]
|
||||
* wayland-keyboard: Send pressed keys on enter [Jonas Å.; !2657]
|
||||
* Fix some X11 windows getting unredirected erroneously [Sebastian K.; !2651]
|
||||
* Fix Flatpak applications bypassing X11 permission [msizanoen1; !2633]
|
||||
* Fix always visible cursor in virtual streams [Salman; !2629]
|
||||
* Fixed crashes [Jonas Å., Sebastian W., Max, Carlos, Łukasz; !2616, !2627,
|
||||
!2646, !2661, !2655, !2669, !2676]
|
||||
* Misc. bug fixes and cleanups [Daniel, Jonas Å., Sebastian W., Ivan, Marco,
|
||||
Florian, Carlos, Jonas D.; !2615, !2619, !2590, !2630, !2515, !2656,
|
||||
!2659, !2670, !2667, !2678]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jonas Dreßler, Michel Dänzer, José Expósito,
|
||||
Carlos Garnacho, Sebastian Keller, Robert Mader, Salman Malik,
|
||||
Ivan Molodetskikh, Florian Müllner, Łukasz Spintzyk, Daniel van Vugt,
|
||||
Sebastian Wick, Max Zhao, msizanoen1, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Baurzhan Muftakhidinov [kk], Sabri Ünal [tr], Pawan Chitrakar [ne],
|
||||
Jürgen Benvenuti [de], Nart Tlisha [ab], Fabio Tomat [fur],
|
||||
Quentin PAGÈS [oc], Freddy Cheng [zh_TW], Мирослав Николић [sr],
|
||||
Nathan Follens [nl]
|
||||
|
||||
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]
|
||||
* 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]
|
||||
@@ -823,82 +16,27 @@ Translators:
|
||||
* 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]
|
||||
* misc [Daniel, Jonas, Corentin, Robert; !1992, !2007, !2008, !2026, !2044]
|
||||
* 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 erratic scrolling in GTK apps [Carlos; gnome-shell#4647]
|
||||
* Fix tilt direction of pen/tablet inputs [Quytelda; !2065]
|
||||
* Sanitize event handling at gestures [Carlos; !2024]
|
||||
* Use b/w unicode for tablet mode OSD [Carlos; !2064]
|
||||
* Fix negative paint volume offscreen effect [Sebastian; !2031]
|
||||
* Only add paint volumes of mapped actors to stage clip [Robert; !2035]
|
||||
* 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 EGL image 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]
|
||||
* Misc. bug fixes and cleanups
|
||||
|
||||
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
|
||||
José Expósito, Olivier Fourdan, Carlos Garnacho, Jason Gerecke,
|
||||
Quytelda Kahja, Sebastian Keller, Robert Mader, Bastien Nocera, Corentin Noël,
|
||||
Christian Rauch, Ray Strode, Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
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]
|
||||
Zander Brown [en_GB], Ngọc Quân Trần [vi], Rūdolfs Mazurs [lv]
|
||||
|
||||
41.0
|
||||
====
|
||||
@@ -921,7 +59,7 @@ Translators:
|
||||
* 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 committing preedit string on focus loss [Carlos; !1940]
|
||||
* 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]
|
||||
@@ -1330,7 +468,7 @@ Translators:
|
||||
* Optimize resource scale computation [Jonas D.; !1196, !1276, !1343]
|
||||
* Allow animating ClutterActor's content property [Georges; !1301]
|
||||
* Implement backgrounds as ClutterContent [Georges; !1302]
|
||||
* Add ClutterAlignConstraint:pivot-point property [Jonas D.; !737]
|
||||
* 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]
|
||||
@@ -3865,7 +3003,7 @@ Translations:
|
||||
wasn't usable from a GNOME Shell extension, so has been changed to take
|
||||
a GSettings object rather than the name of a schema [Jasper; #673014]
|
||||
* Don't try to auto-maximize not-maximizable windows; this fixes the problem
|
||||
with the Nautilus desktop window being mispositioned when enabled
|
||||
with the Nautilus desktop window being mis-positioned when enabled
|
||||
[Owen; #673566]
|
||||
* Fix a crash in the default plugin (not used in GNOME) [Giovanni; #673809]
|
||||
* Make the <Super> key work when set as the mouse button modifier
|
||||
@@ -3980,7 +3118,7 @@ Translations:
|
||||
* Handle changes to workspaces-only-on-primary GSetting [Florian; #664853]
|
||||
* Don't use the Clutter default stage [Jasper; #664028]
|
||||
* Fix compilation with --disable-introspection [Lionel; #661871]
|
||||
* Fix problem where stage could end up missized on startup with
|
||||
* Fix problem where stage could end up mis-sized on startup with
|
||||
multiple monitors [Lionel]
|
||||
* Misc bug fixes [Adel, Lionel, Jasper; #666015]
|
||||
|
||||
@@ -4307,7 +3445,7 @@ Translations:
|
||||
meta_window_get_monitor()
|
||||
MetaWindow::window-entered-monitor, <etaWindow::window-left-monitor
|
||||
meta_window_move_to_monitor() [Florian]
|
||||
* Behavior improvements for attached modal dialogs:
|
||||
* Behavior improvemnts for attached modal dialogs:
|
||||
- Allow dragging dragging on the titlebar to move the parent ["Ron"]
|
||||
- Allow resizing [Florian]
|
||||
- Constrain to be on the current monitor [Florian]
|
||||
@@ -5076,7 +4214,7 @@ Translations: none
|
||||
Thanks to Thomas Thurman for improvements in this version.
|
||||
|
||||
- Add casts to fix failure to build from source on 64bit hosts (Thomas) (#562106)
|
||||
- Added script to produce announcements (Thomas)
|
||||
- Added script to produce annoucements (Thomas)
|
||||
|
||||
Translations
|
||||
Jorge González (es)
|
||||
|
||||
43
README.md
43
README.md
@@ -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,27 +26,34 @@ debugging purposes.
|
||||
|
||||
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
|
||||
|
||||
It can be useful to first look at the
|
||||
[GNOME Handbook](https://handbook.gnome.org/development.html) and the
|
||||
documentation and API references below first.
|
||||
It can be useful to look at the documentation available at the
|
||||
[Wiki](https://gitlab.gnome.org/GNOME/mutter/-/wikis/home).
|
||||
|
||||
## Documentation
|
||||
## Coding style and conventions
|
||||
|
||||
- [Coding style and conventions](doc/coding-style.md)
|
||||
- [Git conventions](doc/git-conventions.md)
|
||||
- [Code overview](doc/code-overview.md)
|
||||
- [Building and Running](doc/building-and-running.md)
|
||||
- [Debugging](doc/debugging.md)
|
||||
- [Monitor configuration](doc/monitor-configuration.md)
|
||||
See [HACKING.md](./HACKING.md).
|
||||
|
||||
## API Reference
|
||||
## Git messages
|
||||
|
||||
- Meta: <https://mutter.gnome.org/meta/>
|
||||
- Clutter: <https://mutter.gnome.org/clutter/>
|
||||
- Cally: <https://mutter.gnome.org/cally/>
|
||||
- Cogl: <https://mutter.gnome.org/cogl/>
|
||||
- CoglPango: <https://mutter.gnome.org/cogl-pango/>
|
||||
- Mtk: <https://mutter.gnome.org/mtk/>
|
||||
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
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -11,17 +11,13 @@ import tempfile
|
||||
uncrustify_cfg = 'tools/uncrustify.cfg'
|
||||
|
||||
def run_diff(sha):
|
||||
proc = subprocess.run(
|
||||
["git", "diff", "-U0", "--function-context", "--default-prefix", sha, "HEAD"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding="utf-8",
|
||||
)
|
||||
return proc.stdout.strip().splitlines()
|
||||
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(r'^\+\+\+ b/(.*)$')
|
||||
diff_chunk_re = re.compile(r'^@@ -\d+,\d+ \+(\d+),(\d+)')
|
||||
file_entry_re = re.compile('^\+\+\+ b/(.*)$')
|
||||
diff_chunk_re = re.compile('^@@ -\d+,\d+ \+(\d+),(\d+)')
|
||||
file = None
|
||||
chunks = []
|
||||
|
||||
@@ -46,15 +42,14 @@ def reformat_chunks(chunks, rewrite):
|
||||
def create_temp_file(file, start, end):
|
||||
with open(file) as f:
|
||||
tmp = tempfile.NamedTemporaryFile()
|
||||
if start > 1:
|
||||
tmp.write(b'/** *INDENT-OFF* **/\n')
|
||||
for i, line in enumerate(f, start=1):
|
||||
if i == start - 1:
|
||||
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 - 1:
|
||||
if i == end - 2:
|
||||
tmp.write(b'/** *INDENT-OFF* **/\n')
|
||||
|
||||
tmp.seek(0)
|
||||
@@ -80,11 +75,9 @@ def reformat_chunks(chunks, rewrite):
|
||||
tmp = create_temp_file(chunk['file'], chunk['start'], chunk['end'])
|
||||
|
||||
# uncrustify chunk
|
||||
proc = subprocess.run(
|
||||
["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
reindented = proc.stdout.splitlines(keepends=True)
|
||||
proc = subprocess.Popen(["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name], stdout=subprocess.PIPE)
|
||||
reindented = proc.stdout.readlines()
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
continue
|
||||
|
||||
@@ -95,32 +88,25 @@ def reformat_chunks(chunks, rewrite):
|
||||
|
||||
if dry_run is True:
|
||||
# Show changes
|
||||
proc = subprocess.run(
|
||||
["diff", "-up", "--color=always", chunk['file'], formatted.name],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding="utf-8",
|
||||
)
|
||||
diff = proc.stdout
|
||||
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.run(
|
||||
["diff", "-up", chunk['file'], formatted.name],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
patch = subprocess.run(["patch", chunk['file']], input=diff.stdout)
|
||||
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. Needs uncrustify installed.')
|
||||
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,
|
||||
@@ -143,22 +129,10 @@ chunks = find_chunks(diff)
|
||||
changed = reformat_chunks(chunks, rewrite)
|
||||
|
||||
if dry_run is not True and rewrite is True:
|
||||
proc = subprocess.run(["git", "add", "-p"])
|
||||
if proc.returncode == 0:
|
||||
# Commit the added changes as a squash commit
|
||||
subprocess.run(
|
||||
["git", "commit", "--squash", "HEAD", "-C", "HEAD"],
|
||||
stdout=subprocess.DEVNULL)
|
||||
# Delete the unapplied changes
|
||||
subprocess.run(["git", "reset", "--hard"], stdout=subprocess.DEVNULL)
|
||||
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(f"""
|
||||
Issue the following commands in your local tree to apply the suggested changes:
|
||||
|
||||
$ git rebase {sha} --exec "./check-style.py -r"
|
||||
$ git rebase --autosquash {sha}
|
||||
""")
|
||||
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)
|
||||
|
||||
95
clutter/.gitignore
vendored
Normal file
95
clutter/.gitignore
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
ABOUT-NLS
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
*.pc
|
||||
.deps
|
||||
.libs
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
*.gcov
|
||||
.dirstamp
|
||||
README
|
||||
stamp-enum-types
|
||||
stamp-marshal
|
||||
tags
|
||||
/ChangeLog*
|
||||
clutter-build-config.h
|
||||
clutter-build-config.h.in
|
||||
clutter-config.h
|
||||
clutter-enum-types.[ch]
|
||||
clutter-marshal.[ch]
|
||||
gcov-report.txt
|
||||
clutter-json.h
|
||||
clutter-lcov.info
|
||||
clutter-lcov
|
||||
!/build/autotools/introspection.m4
|
||||
!/build/autotools/as-linguas.m4
|
||||
!/build/autotools/as-compiler-flag.m4
|
||||
!/build/autotools/glibtests.m4
|
||||
/build/autotools/*.m4
|
||||
/build/test-driver
|
||||
*.gir
|
||||
*.typelib
|
||||
*.gcda
|
||||
*.gcno
|
||||
config.*
|
||||
configure
|
||||
depcomp
|
||||
/doc/cookbook/*.pdf
|
||||
/doc/cookbook/html
|
||||
/doc/cookbook/*.stamp
|
||||
/doc/cookbook/clutter-cookbook.xml
|
||||
/doc/cookbook/clutter-cookbook.html
|
||||
doc/reference/clutter-*.txt
|
||||
!/doc/reference/clutter-sections.txt
|
||||
doc/reference/html
|
||||
doc/reference/tmpl
|
||||
doc/reference/xml
|
||||
doc/reference/clutter.args
|
||||
doc/reference/clutter.hierarchy
|
||||
doc/reference/clutter.interfaces
|
||||
doc/reference/clutter.prerequisites
|
||||
doc/reference/clutter.signals
|
||||
doc/reference/clutter-docs.xml
|
||||
doc/reference/*.stamp
|
||||
doc/reference/*.bak
|
||||
doc/reference/*.log
|
||||
doc/reference/gtkdoc-check.*
|
||||
gtk-doc.make
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
stamp-h1
|
||||
TAGS
|
||||
/tests/tools/disable-npots.sh
|
||||
/tests/conform/test-launcher.sh
|
||||
/tests/interactive/wrapper.sh
|
||||
/po/POTFILES
|
||||
/po/clutter-1.0.pot
|
||||
/po/*.gmo
|
||||
/po/Makefile.in.in
|
||||
/po/Makevars.template
|
||||
/po/Rules-quot
|
||||
/po/boldquot.sed
|
||||
/po/en@boldquot.header
|
||||
/po/en@quot.header
|
||||
/po/insert-header.sin
|
||||
/po/quot.sed
|
||||
/po/remove-potcdate.sin
|
||||
/po/remove-potcdate.sed
|
||||
/po/stamp-po
|
||||
*.swn
|
||||
*.swo
|
||||
*.swp
|
||||
*~
|
||||
*.orig
|
||||
*.rej
|
||||
.DS_Store
|
||||
.testlogs-*
|
||||
@@ -27,7 +27,7 @@ that on CallyRoot:
|
||||
|
||||
* CallyUtil callbacks these signals are related to key event
|
||||
listeners (key snooper simulation). One of the main CallyUtil
|
||||
responsibilities is managing event (connecting, emitting), so I
|
||||
responsabilities is managing event (connecting, emitting), so I
|
||||
would prefer to not start to add/mix more functionalities here.
|
||||
|
||||
Ideally it would be better to emit all CallyStage methods from
|
||||
@@ -56,7 +56,7 @@ Adding -Wshadow option and solving warnings related
|
||||
|
||||
2010-06-14 Alejandro Piñeiro <apinheiro@igalia.com>
|
||||
|
||||
Added dummy padding for future vt expansion
|
||||
Added dummy padding for future vt expasion
|
||||
|
||||
Added dummy padding on the different classes structures, to allow
|
||||
future expansion of virtual methods.
|
||||
@@ -393,7 +393,7 @@ Manage properly ATK_STATE_ACTIVE on CallyStage
|
||||
|
||||
* cally/cally-stage.c
|
||||
Added private struct
|
||||
(cally_stage_class_init),(cally_stage_init),(cally_stage_real_initialize):
|
||||
(cally_stage_class_init),(cally_stage_init),(cally_stage_real_initalize):
|
||||
Initialization stuff
|
||||
(cally_stage_activate_cb)
|
||||
(cally_stage_deactivate_cb): new ClutterStage signal callbacks, change
|
||||
@@ -975,7 +975,7 @@ Missing cail-rectangle.[ch] files, according 2009-02-23 entry at Changelog
|
||||
|
||||
2009-02-18 Alejandro Pinheiro <apinheiro@igalia.com>
|
||||
|
||||
* configure.ac: added additional compile flags
|
||||
* configure.ac: added aditional compile flags
|
||||
* cail/cail-actor.[ch]: Reimplemented support for AtkAction interface
|
||||
* cail/cail-root.[ch]: code style review
|
||||
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_ACTOR_PRIVATE_H__
|
||||
#define __CALLY_ACTOR_PRIVATE_H__
|
||||
|
||||
#include "cally/cally-actor.h"
|
||||
#include "cally-actor.h"
|
||||
|
||||
/*
|
||||
* Auxiliary define, in order to get the clutter actor from the AtkObject using
|
||||
@@ -33,3 +34,9 @@
|
||||
*/
|
||||
#define CALLY_GET_CLUTTER_ACTOR(cally_object) \
|
||||
(CLUTTER_ACTOR (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (cally_object))))
|
||||
|
||||
void _cally_actor_get_top_level_origin (ClutterActor *actor,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
#endif /* __CALLY_ACTOR_PRIVATE_H__ */
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* CallyActor:
|
||||
* SECTION:cally-actor
|
||||
* @Title: CallyActor
|
||||
* @short_description: Implementation of the ATK interfaces for #ClutterActor
|
||||
* @see_also: #ClutterActor
|
||||
*
|
||||
* Implementation of the ATK interfaces for [class@Clutter.Actor]
|
||||
*
|
||||
* #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).
|
||||
*/
|
||||
|
||||
@@ -41,7 +42,7 @@
|
||||
* has a key focus managed by the stage. Basically any actor can be focused using
|
||||
* clutter_stage_set_key_focus. So, we will use this approach: all actors are
|
||||
* focusable, and we get the currently focused using clutter_stage_get_key_focus
|
||||
* This affects focus related stateset and some atk_component focus methods (like
|
||||
* This affects focus related stateset and some atk_componenet focus methods (like
|
||||
* grab focus).
|
||||
*
|
||||
* In the same way, we will manage the focus state change management
|
||||
@@ -66,17 +67,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "cally/cally-actor.h"
|
||||
#include "cally/cally-actor-private.h"
|
||||
#include "cally-actor.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
typedef struct _CallyActorActionInfo CallyActorActionInfo;
|
||||
|
||||
@@ -193,6 +194,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)
|
||||
@@ -222,7 +225,7 @@ cally_actor_initialize (AtkObject *obj,
|
||||
ATK_OBJECT_CLASS (cally_actor_parent_class)->initialize (obj, data);
|
||||
|
||||
self = CALLY_ACTOR(obj);
|
||||
priv = cally_actor_get_instance_private (self);
|
||||
priv = self->priv;
|
||||
actor = CLUTTER_ACTOR (data);
|
||||
|
||||
g_signal_connect (actor,
|
||||
@@ -240,13 +243,13 @@ cally_actor_initialize (AtkObject *obj,
|
||||
* need to remove these handlers.
|
||||
*/
|
||||
handler_id = g_signal_connect (actor,
|
||||
"child-added",
|
||||
"actor-added",
|
||||
G_CALLBACK (cally_actor_add_actor),
|
||||
obj);
|
||||
g_object_set_data (G_OBJECT (obj), "cally-add-handler-id",
|
||||
GUINT_TO_POINTER (handler_id));
|
||||
handler_id = g_signal_connect (actor,
|
||||
"child-removed",
|
||||
"actor-removed",
|
||||
G_CALLBACK (cally_actor_remove_actor),
|
||||
obj);
|
||||
g_object_set_data (G_OBJECT (obj), "cally-remove-handler-id",
|
||||
@@ -284,6 +287,8 @@ cally_actor_init (CallyActor *cally_actor)
|
||||
{
|
||||
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
cally_actor->priv = priv;
|
||||
|
||||
priv->action_queue = NULL;
|
||||
priv->action_idle_handler = 0;
|
||||
|
||||
@@ -299,7 +304,7 @@ cally_actor_finalize (GObject *obj)
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
cally_actor = CALLY_ACTOR (obj);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
_cally_actor_clean_action_list (cally_actor);
|
||||
|
||||
@@ -559,10 +564,10 @@ cally_actor_real_add_actor (ClutterActor *container,
|
||||
AtkObject *atk_parent = ATK_OBJECT (data);
|
||||
AtkObject *atk_child = clutter_actor_get_accessible (actor);
|
||||
CallyActor *cally_actor = CALLY_ACTOR (atk_parent);
|
||||
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
|
||||
CallyActorPrivate *priv = cally_actor->priv;
|
||||
gint index;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||
|
||||
g_object_notify (G_OBJECT (atk_child), "accessible_parent");
|
||||
@@ -589,7 +594,7 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
||||
CallyActorPrivate *priv = NULL;
|
||||
gint index;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
@@ -609,7 +614,7 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
||||
g_object_unref (atk_child);
|
||||
}
|
||||
|
||||
priv = cally_actor_get_instance_private (CALLY_ACTOR (atk_parent));
|
||||
priv = CALLY_ACTOR (atk_parent)->priv;
|
||||
index = g_list_index (priv->children, actor);
|
||||
g_list_free (priv->children);
|
||||
|
||||
@@ -645,6 +650,7 @@ cally_actor_get_extents (AtkComponent *component,
|
||||
{
|
||||
CallyActor *cally_actor = NULL;
|
||||
ClutterActor *actor = NULL;
|
||||
gint top_level_x, top_level_y;
|
||||
gfloat f_width, f_height;
|
||||
graphene_point3d_t verts[4];
|
||||
ClutterActor *stage = NULL;
|
||||
@@ -670,6 +676,22 @@ cally_actor_get_extents (AtkComponent *component,
|
||||
*y = verts[0].y;
|
||||
*width = ceilf (f_width);
|
||||
*height = ceilf (f_height);
|
||||
|
||||
/* In the ATK_XY_WINDOW case, we consider the stage as the
|
||||
* "top-level-window"
|
||||
*
|
||||
* http://library.gnome.org/devel/atk/stable/AtkUtil.html#AtkCoordType
|
||||
*/
|
||||
|
||||
if (coord_type == ATK_XY_SCREEN)
|
||||
{
|
||||
_cally_actor_get_top_level_origin (actor, &top_level_x, &top_level_y);
|
||||
|
||||
*x += top_level_x;
|
||||
*y += top_level_y;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -706,6 +728,25 @@ cally_actor_grab_focus (AtkComponent *component)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* This gets the top level origin, it is, the position of the stage in
|
||||
* the global screen. You can see it as the absolute display position
|
||||
* of the stage. This is 0,0 for a compositor.
|
||||
*/
|
||||
void
|
||||
_cally_actor_get_top_level_origin (ClutterActor *actor,
|
||||
gint *xp,
|
||||
gint *yp)
|
||||
{
|
||||
/* default values */
|
||||
if (xp)
|
||||
*xp = 0;
|
||||
|
||||
if (yp)
|
||||
*yp = 0;
|
||||
}
|
||||
|
||||
/* AtkAction implementation */
|
||||
static void
|
||||
cally_actor_action_interface_init (AtkActionIface *iface)
|
||||
@@ -731,7 +772,7 @@ cally_actor_action_do_action (AtkAction *action,
|
||||
gboolean did_action = FALSE;
|
||||
|
||||
cally_actor = CALLY_ACTOR (action);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
|
||||
|
||||
@@ -774,7 +815,7 @@ idle_do_action (gpointer data)
|
||||
ClutterActor *actor = NULL;
|
||||
|
||||
cally_actor = CALLY_ACTOR (data);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
|
||||
priv->action_idle_handler = 0;
|
||||
|
||||
@@ -802,7 +843,7 @@ cally_actor_action_get_n_actions (AtkAction *action)
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (action), 0);
|
||||
|
||||
cally_actor = CALLY_ACTOR (action);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
return g_list_length (priv->action_list);
|
||||
}
|
||||
@@ -951,7 +992,7 @@ _cally_actor_clean_action_list (CallyActor *cally_actor)
|
||||
{
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
if (priv->action_list)
|
||||
{
|
||||
@@ -970,7 +1011,7 @@ _cally_actor_get_action_info (CallyActor *cally_actor,
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), NULL);
|
||||
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
if (priv->action_list == NULL)
|
||||
return NULL;
|
||||
@@ -994,6 +1035,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,
|
||||
@@ -1023,6 +1066,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,
|
||||
@@ -1039,7 +1084,7 @@ cally_actor_add_action_full (CallyActor *cally_actor,
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), -1);
|
||||
g_return_val_if_fail (callback != NULL, -1);
|
||||
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
info = g_new0 (CallyActorActionInfo, 1);
|
||||
info->name = g_strdup (action_name);
|
||||
@@ -1059,9 +1104,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
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
cally_actor_remove_action (CallyActor *cally_actor,
|
||||
@@ -1071,7 +1118,7 @@ cally_actor_remove_action (CallyActor *cally_actor,
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = cally_actor->priv;
|
||||
|
||||
list_node = g_list_nth (priv->action_list, action_id - 1);
|
||||
|
||||
@@ -1091,9 +1138,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
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
cally_actor_remove_action_by_name (CallyActor *cally_actor,
|
||||
@@ -1104,7 +1153,7 @@ cally_actor_remove_action_by_name (CallyActor *cally_actor,
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
priv = CALLY_ACTOR (cally_actor)->priv;
|
||||
|
||||
for (node = priv->action_list; node && !action_found;
|
||||
node = node->next)
|
||||
|
||||
@@ -22,26 +22,24 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_ACTOR_H__
|
||||
#define __CALLY_ACTOR_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_ACTOR (cally_actor_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyActor,
|
||||
cally_actor,
|
||||
CALLY,
|
||||
ACTOR,
|
||||
AtkGObjectAccessible)
|
||||
#define CALLY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ACTOR, CallyActor))
|
||||
#define CALLY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ACTOR, CallyActorClass))
|
||||
#define CALLY_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ACTOR))
|
||||
#define CALLY_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ACTOR))
|
||||
#define CALLY_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ACTOR, CallyActorClass))
|
||||
|
||||
typedef struct _CallyActor CallyActor;
|
||||
typedef struct _CallyActorClass CallyActorClass;
|
||||
@@ -53,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);
|
||||
|
||||
@@ -62,19 +62,44 @@ 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.
|
||||
* an individual action. Unlike #CallyActionFunc, this function
|
||||
* uses the @user_data argument passed to cally_actor_add_action_full().
|
||||
*
|
||||
* Unlike #CallyActionFunc, this function uses the @user_data
|
||||
* argument passed to [method@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 >*/
|
||||
AtkGObjectAccessible parent;
|
||||
|
||||
CallyActorPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyActorClass:
|
||||
* @notify_clutter: Signal handler for notify signal on Clutter actor
|
||||
* @add_actor: Signal handler for child-added signal on Clutter actor
|
||||
* @remove_actor: Signal handler for child-removed 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
|
||||
* ClutterContainer interface
|
||||
*
|
||||
* The <structname>CallyActorClass</structname> structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyActorClass
|
||||
{
|
||||
@@ -85,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);
|
||||
@@ -92,8 +120,15 @@ struct _CallyActorClass
|
||||
gint (*remove_actor) (ClutterActor *container,
|
||||
ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[32];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_actor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_actor_new (ClutterActor *actor);
|
||||
|
||||
@@ -121,3 +156,5 @@ gboolean cally_actor_remove_action_by_name (CallyActor *cally_actor,
|
||||
const gchar *action_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_ACTOR_H__ */
|
||||
|
||||
@@ -15,15 +15,18 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -33,7 +36,7 @@
|
||||
*
|
||||
* In the old times, it was just ClutterCloneTexture. So, from a a11y POV
|
||||
* CallyCloneTexture was just another image, like ClutterTexture, and if
|
||||
* it was a clone was irrelevant. So on cally-0.8, CallyCloneTexture
|
||||
* it was a clone was irrevelant. So on cally-0.8, CallyCloneTexture
|
||||
* expose a object with role ATK_ROLE_IMAGE. But now, ClutterClone is more
|
||||
* general. You can clone any object, including groups, and made things
|
||||
* like have one text entry, and a clone with different properties in the
|
||||
@@ -66,10 +69,10 @@
|
||||
* a11y POV should still be managed as a image (with the proper properties,
|
||||
* position, size, etc.).
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally/cally-clone.h"
|
||||
#include "cally/cally-actor-private.h"
|
||||
#include "cally-clone.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
/* AtkObject */
|
||||
static void cally_clone_real_initialize (AtkObject *obj,
|
||||
@@ -97,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)
|
||||
|
||||
@@ -18,36 +18,67 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_CLONE_H__
|
||||
#define __CALLY_CLONE_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "cally/cally-actor.h"
|
||||
#include <clutter/clutter.h>
|
||||
#include <cally/cally-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_CLONE (cally_clone_get_type ())
|
||||
#define CALLY_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_CLONE, CallyClone))
|
||||
#define CALLY_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_CLONE, CallyCloneClass))
|
||||
#define CALLY_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_CLONE))
|
||||
#define CALLY_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_CLONE))
|
||||
#define CALLY_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_CLONE, CallyCloneClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyClone,
|
||||
cally_clone,
|
||||
CALLY,
|
||||
CLONE,
|
||||
CallyActor)
|
||||
typedef struct _CallyClone CallyClone;
|
||||
typedef struct _CallyCloneClass CallyCloneClass;
|
||||
typedef struct _CallyClonePrivate CallyClonePrivate;
|
||||
|
||||
typedef struct _CallyClone CallyClone;
|
||||
typedef struct _CallyCloneClass CallyCloneClass;
|
||||
/**
|
||||
* CallyClone:
|
||||
*
|
||||
* The <structname>CallyClone</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyClone
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyClonePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyCloneClass:
|
||||
*
|
||||
* The <structname>CallyCloneClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyCloneClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_clone_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject *cally_clone_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_CLONE_H__ */
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef _CALLY_FACTORY_H__
|
||||
#define _CALLY_FACTORY_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <atk/atkobject.h>
|
||||
@@ -39,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) \
|
||||
\
|
||||
@@ -101,8 +106,12 @@ 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 (), \
|
||||
widget_type, \
|
||||
type_as_function ## _factory_get_type ())
|
||||
|
||||
#endif /* _CALLY_FACTORY_H__ */
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_MAIN_H__
|
||||
#define __CALLY_MAIN_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
@@ -39,3 +40,5 @@ CLUTTER_EXPORT
|
||||
gboolean cally_accessibility_init (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_MAIN_H__ */
|
||||
|
||||
@@ -15,31 +15,33 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 [method@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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally/cally-root.h"
|
||||
#include "cally-root.h"
|
||||
|
||||
#include "clutter/clutter-actor.h"
|
||||
#include "clutter/clutter-stage-private.h"
|
||||
#include "clutter/clutter-stage-manager.h"
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-manager.h"
|
||||
|
||||
|
||||
/* GObject */
|
||||
@@ -62,7 +64,7 @@ static void cally_util_stage_removed_cb (ClutterStageManager *st
|
||||
ClutterStage *stage,
|
||||
gpointer data);
|
||||
|
||||
typedef struct _CallyRootPrivate
|
||||
struct _CallyRootPrivate
|
||||
{
|
||||
/* We save the CallyStage objects. Other option could save the stage
|
||||
* list, and then just get the a11y object on the ref_child, etc. But
|
||||
@@ -75,7 +77,7 @@ typedef struct _CallyRootPrivate
|
||||
/* signals id */
|
||||
gulong stage_added_id;
|
||||
gulong stage_removed_id;
|
||||
} CallyRootPrivate;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
|
||||
|
||||
@@ -98,11 +100,11 @@ cally_root_class_init (CallyRootClass *klass)
|
||||
static void
|
||||
cally_root_init (CallyRoot *root)
|
||||
{
|
||||
CallyRootPrivate *priv = cally_root_get_instance_private (root);
|
||||
root->priv = cally_root_get_instance_private (root);
|
||||
|
||||
priv->stage_list = NULL;
|
||||
priv->stage_added_id = 0;
|
||||
priv->stage_removed_id = 0;
|
||||
root->priv->stage_list = NULL;
|
||||
root->priv->stage_added_id = 0;
|
||||
root->priv->stage_removed_id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,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)
|
||||
@@ -134,22 +138,20 @@ cally_root_finalize (GObject *object)
|
||||
{
|
||||
CallyRoot *root = CALLY_ROOT (object);
|
||||
GObject *stage_manager = NULL;
|
||||
CallyRootPrivate *priv;
|
||||
|
||||
g_return_if_fail (CALLY_IS_ROOT (object));
|
||||
|
||||
priv = cally_root_get_instance_private (root);
|
||||
if (priv->stage_list)
|
||||
if (root->priv->stage_list)
|
||||
{
|
||||
g_slist_free (priv->stage_list);
|
||||
priv->stage_list = NULL;
|
||||
g_slist_free (root->priv->stage_list);
|
||||
root->priv->stage_list = NULL;
|
||||
}
|
||||
|
||||
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
|
||||
|
||||
g_clear_signal_handler (&priv->stage_added_id, stage_manager);
|
||||
g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
|
||||
|
||||
g_clear_signal_handler (&priv->stage_removed_id, stage_manager);
|
||||
g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
|
||||
|
||||
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -164,14 +166,13 @@ cally_root_initialize (AtkObject *accessible,
|
||||
const GSList *stage_list = NULL;
|
||||
ClutterStage *clutter_stage = NULL;
|
||||
AtkObject *cally_stage = NULL;
|
||||
CallyRoot *root = CALLY_ROOT (accessible);
|
||||
CallyRootPrivate *priv = cally_root_get_instance_private (root);
|
||||
|
||||
CallyRoot *root = NULL;
|
||||
|
||||
accessible->role = ATK_ROLE_APPLICATION;
|
||||
accessible->accessible_parent = NULL;
|
||||
|
||||
/* children initialization */
|
||||
root = CALLY_ROOT (accessible);
|
||||
stage_manager = CLUTTER_STAGE_MANAGER (data);
|
||||
stage_list = clutter_stage_manager_peek_stages (stage_manager);
|
||||
|
||||
@@ -182,14 +183,15 @@ cally_root_initialize (AtkObject *accessible,
|
||||
|
||||
atk_object_set_parent (cally_stage, ATK_OBJECT (root));
|
||||
|
||||
priv->stage_list = g_slist_append (priv->stage_list, cally_stage);
|
||||
root->priv->stage_list = g_slist_append (root->priv->stage_list,
|
||||
cally_stage);
|
||||
}
|
||||
|
||||
priv->stage_added_id =
|
||||
root->priv->stage_added_id =
|
||||
g_signal_connect (G_OBJECT (stage_manager), "stage-added",
|
||||
G_CALLBACK (cally_util_stage_added_cb), root);
|
||||
|
||||
priv->stage_removed_id =
|
||||
root->priv->stage_removed_id =
|
||||
g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
|
||||
G_CALLBACK (cally_util_stage_removed_cb), root);
|
||||
|
||||
@@ -201,22 +203,21 @@ static gint
|
||||
cally_root_get_n_children (AtkObject *obj)
|
||||
{
|
||||
CallyRoot *root = CALLY_ROOT (obj);
|
||||
CallyRootPrivate *priv = cally_root_get_instance_private (root);
|
||||
|
||||
return g_slist_length (priv->stage_list);
|
||||
return g_slist_length (root->priv->stage_list);
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
cally_root_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
gint i)
|
||||
{
|
||||
CallyRoot *cally_root = CALLY_ROOT (obj);
|
||||
CallyRootPrivate *priv = cally_root_get_instance_private (cally_root);
|
||||
CallyRoot *cally_root = NULL;
|
||||
GSList *stage_list = NULL;
|
||||
gint num = 0;
|
||||
AtkObject *item = NULL;
|
||||
|
||||
stage_list = priv->stage_list;
|
||||
cally_root = CALLY_ROOT (obj);
|
||||
stage_list = cally_root->priv->stage_list;
|
||||
num = g_slist_length (stage_list);
|
||||
|
||||
g_return_val_if_fail ((i < num)&&(i >= 0), NULL);
|
||||
@@ -248,22 +249,21 @@ cally_root_get_name (AtkObject *obj)
|
||||
|
||||
static void
|
||||
cally_util_stage_added_cb (ClutterStageManager *stage_manager,
|
||||
ClutterStage *stage,
|
||||
gpointer data)
|
||||
ClutterStage *stage,
|
||||
gpointer data)
|
||||
{
|
||||
CallyRoot *root = CALLY_ROOT (data);
|
||||
AtkObject *cally_stage = NULL;
|
||||
CallyRootPrivate *priv = cally_root_get_instance_private (root);
|
||||
|
||||
gint index = -1;
|
||||
|
||||
cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
||||
|
||||
atk_object_set_parent (cally_stage, ATK_OBJECT (root));
|
||||
|
||||
priv->stage_list = g_slist_append (priv->stage_list, cally_stage);
|
||||
root->priv->stage_list = g_slist_append (root->priv->stage_list,
|
||||
cally_stage);
|
||||
|
||||
index = g_slist_index (priv->stage_list, cally_stage);
|
||||
index = g_slist_index (root->priv->stage_list, cally_stage);
|
||||
g_signal_emit_by_name (root, "children_changed::add",
|
||||
index, cally_stage, NULL);
|
||||
g_signal_emit_by_name (cally_stage, "create", 0);
|
||||
@@ -271,23 +271,21 @@ cally_util_stage_added_cb (ClutterStageManager *stage_manager,
|
||||
|
||||
static void
|
||||
cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
|
||||
ClutterStage *stage,
|
||||
gpointer data)
|
||||
ClutterStage *stage,
|
||||
gpointer data)
|
||||
{
|
||||
CallyRoot *root = CALLY_ROOT (data);
|
||||
AtkObject *cally_stage = NULL;
|
||||
CallyRootPrivate *priv
|
||||
= cally_root_get_instance_private (root);
|
||||
gint index = -1;
|
||||
|
||||
cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
||||
|
||||
index = g_slist_index (priv->stage_list, cally_stage);
|
||||
index = g_slist_index (root->priv->stage_list, cally_stage);
|
||||
|
||||
priv->stage_list = g_slist_remove (priv->stage_list,
|
||||
cally_stage);
|
||||
root->priv->stage_list = g_slist_remove (root->priv->stage_list,
|
||||
cally_stage);
|
||||
|
||||
index = g_slist_index (priv->stage_list, cally_stage);
|
||||
index = g_slist_index (root->priv->stage_list, cally_stage);
|
||||
g_signal_emit_by_name (root, "children_changed::remove",
|
||||
index, cally_stage, NULL);
|
||||
g_signal_emit_by_name (cally_stage, "destroy", 0);
|
||||
|
||||
@@ -18,37 +18,67 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_ROOT_H__
|
||||
#define __CALLY_ROOT_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_ROOT (cally_root_get_type ())
|
||||
#define CALLY_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ROOT, CallyRoot))
|
||||
#define CALLY_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ROOT, CallyRootClass))
|
||||
#define CALLY_IS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ROOT))
|
||||
#define CALLY_IS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ROOT))
|
||||
#define CALLY_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ROOT, CallyRootClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyRoot,
|
||||
cally_root,
|
||||
CALLY,
|
||||
ROOT,
|
||||
AtkGObjectAccessible)
|
||||
typedef struct _CallyRoot CallyRoot;
|
||||
typedef struct _CallyRootClass CallyRootClass;
|
||||
typedef struct _CallyRootPrivate CallyRootPrivate;
|
||||
|
||||
typedef struct _CallyRoot CallyRoot;
|
||||
typedef struct _CallyRootClass CallyRootClass;
|
||||
/**
|
||||
* CallyRoot:
|
||||
*
|
||||
* The <structname>CallyRoot</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRoot
|
||||
{
|
||||
/*< private >*/
|
||||
AtkGObjectAccessible parent;
|
||||
|
||||
CallyRootPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyRootClass:
|
||||
*
|
||||
* The <structname>CallyRootClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRootClass
|
||||
{
|
||||
/*< private >*/
|
||||
AtkGObjectAccessibleClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_root_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject *cally_root_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_ROOT_H__ */
|
||||
|
||||
@@ -15,26 +15,29 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally/cally-stage.h"
|
||||
#include "cally/cally-actor-private.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
/* AtkObject.h */
|
||||
static void cally_stage_real_initialize (AtkObject *obj,
|
||||
@@ -50,13 +53,13 @@ static void cally_stage_activate_cb (ClutterStage *stage,
|
||||
static void cally_stage_deactivate_cb (ClutterStage *stage,
|
||||
gpointer data);
|
||||
|
||||
typedef struct _CallyStagePrivate
|
||||
struct _CallyStagePrivate
|
||||
{
|
||||
/* NULL means that the stage will receive the focus */
|
||||
ClutterActor *key_focus;
|
||||
|
||||
gboolean active;
|
||||
} CallyStagePrivate;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
||||
cally_stage,
|
||||
@@ -80,6 +83,8 @@ cally_stage_init (CallyStage *cally_stage)
|
||||
{
|
||||
CallyStagePrivate *priv = cally_stage_get_instance_private (cally_stage);
|
||||
|
||||
cally_stage->priv = priv;
|
||||
|
||||
priv->active = FALSE;
|
||||
}
|
||||
|
||||
@@ -88,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)
|
||||
@@ -115,25 +122,24 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
||||
{
|
||||
ClutterActor *key_focus = NULL;
|
||||
AtkObject *new = NULL;
|
||||
CallyStagePrivate *priv = cally_stage_get_instance_private (self);
|
||||
|
||||
if (priv->active == FALSE)
|
||||
if (self->priv->active == FALSE)
|
||||
return;
|
||||
|
||||
key_focus = clutter_stage_get_key_focus (stage);
|
||||
|
||||
if (key_focus != priv->key_focus)
|
||||
if (key_focus != self->priv->key_focus)
|
||||
{
|
||||
AtkObject *old = NULL;
|
||||
|
||||
if (priv->key_focus != NULL)
|
||||
if (self->priv->key_focus != NULL)
|
||||
{
|
||||
if (priv->key_focus != CLUTTER_ACTOR (stage))
|
||||
if (self->priv->key_focus != CLUTTER_ACTOR (stage))
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->key_focus),
|
||||
(gpointer *) &priv->key_focus);
|
||||
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
|
||||
(gpointer *) &self->priv->key_focus);
|
||||
}
|
||||
old = clutter_actor_get_accessible (priv->key_focus);
|
||||
old = clutter_actor_get_accessible (self->priv->key_focus);
|
||||
}
|
||||
else
|
||||
old = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
||||
@@ -146,7 +152,7 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
||||
/* we keep notifying the focus gain without checking previous
|
||||
* key-focus to avoid some missing events due timing
|
||||
*/
|
||||
priv->key_focus = key_focus;
|
||||
self->priv->key_focus = key_focus;
|
||||
|
||||
if (key_focus != NULL)
|
||||
{
|
||||
@@ -159,8 +165,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
||||
*/
|
||||
if (key_focus != CLUTTER_ACTOR (stage))
|
||||
{
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->key_focus),
|
||||
(gpointer *) &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);
|
||||
@@ -199,11 +205,9 @@ cally_stage_ref_state_set (AtkObject *obj)
|
||||
CallyStage *cally_stage = NULL;
|
||||
AtkStateSet *state_set = NULL;
|
||||
ClutterStage *stage = NULL;
|
||||
CallyStagePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL);
|
||||
cally_stage = CALLY_STAGE (obj);
|
||||
priv = cally_stage_get_instance_private (cally_stage);
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (cally_stage_parent_class)->ref_state_set (obj);
|
||||
stage = CLUTTER_STAGE (CALLY_GET_CLUTTER_ACTOR (cally_stage));
|
||||
@@ -211,7 +215,7 @@ cally_stage_ref_state_set (AtkObject *obj)
|
||||
if (stage == NULL)
|
||||
return state_set;
|
||||
|
||||
if (priv->active)
|
||||
if (cally_stage->priv->active)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
|
||||
|
||||
return state_set;
|
||||
@@ -230,14 +234,12 @@ cally_stage_activate_cb (ClutterStage *stage,
|
||||
gpointer data)
|
||||
{
|
||||
CallyStage *cally_stage = NULL;
|
||||
CallyStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CALLY_IS_STAGE (data));
|
||||
|
||||
cally_stage = CALLY_STAGE (data);
|
||||
priv = cally_stage_get_instance_private (cally_stage);
|
||||
|
||||
priv->active = TRUE;
|
||||
cally_stage->priv->active = TRUE;
|
||||
|
||||
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
|
||||
ATK_STATE_ACTIVE, TRUE);
|
||||
@@ -250,14 +252,12 @@ cally_stage_deactivate_cb (ClutterStage *stage,
|
||||
gpointer data)
|
||||
{
|
||||
CallyStage *cally_stage = NULL;
|
||||
CallyStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CALLY_IS_STAGE (data));
|
||||
|
||||
cally_stage = CALLY_STAGE (data);
|
||||
priv = cally_stage_get_instance_private (cally_stage);
|
||||
|
||||
priv->active = FALSE;
|
||||
cally_stage->priv->active = FALSE;
|
||||
|
||||
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
|
||||
ATK_STATE_ACTIVE, FALSE);
|
||||
|
||||
@@ -18,36 +18,67 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_STAGE_H__
|
||||
#define __CALLY_STAGE_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"
|
||||
#include <cally/cally-actor.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_STAGE (cally_stage_get_type ())
|
||||
#define CALLY_STAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_STAGE, CallyStage))
|
||||
#define CALLY_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_STAGE, CallyStageClass))
|
||||
#define CALLY_IS_STAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_STAGE))
|
||||
#define CALLY_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_STAGE))
|
||||
#define CALLY_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_STAGE, CallyStageClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyStage,
|
||||
cally_stage,
|
||||
CALLY,
|
||||
STAGE,
|
||||
CallyActor)
|
||||
typedef struct _CallyStage CallyStage;
|
||||
typedef struct _CallyStageClass CallyStageClass;
|
||||
typedef struct _CallyStagePrivate CallyStagePrivate;
|
||||
|
||||
typedef struct _CallyStage CallyStage;
|
||||
typedef struct _CallyStageClass CallyStageClass;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
CallyStagePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyStageClass:
|
||||
*
|
||||
* The <structname>CallyStageClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyStageClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_stage_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject *cally_stage_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_STAGE_H__ */
|
||||
|
||||
@@ -23,26 +23,30 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally/cally-text.h"
|
||||
#include "cally/cally-actor-private.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-text.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-text.h"
|
||||
|
||||
static void cally_text_finalize (GObject *obj);
|
||||
|
||||
@@ -168,7 +172,7 @@ static int _cally_misc_get_index_at_point (ClutterText *clutter
|
||||
gint y,
|
||||
AtkCoordType coords);
|
||||
|
||||
typedef struct _CallyTextPrivate
|
||||
struct _CallyTextPrivate
|
||||
{
|
||||
/* Cached ClutterText values*/
|
||||
gint cursor_position;
|
||||
@@ -187,7 +191,7 @@ typedef struct _CallyTextPrivate
|
||||
|
||||
/* action */
|
||||
guint activate_action_id;
|
||||
} CallyTextPrivate;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CallyText,
|
||||
cally_text,
|
||||
@@ -218,6 +222,8 @@ cally_text_init (CallyText *cally_text)
|
||||
{
|
||||
CallyTextPrivate *priv = cally_text_get_instance_private (cally_text);
|
||||
|
||||
cally_text->priv = priv;
|
||||
|
||||
priv->cursor_position = 0;
|
||||
priv->selection_bound = 0;
|
||||
|
||||
@@ -237,13 +243,11 @@ static void
|
||||
cally_text_finalize (GObject *obj)
|
||||
{
|
||||
CallyText *cally_text = CALLY_TEXT (obj);
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
|
||||
/* g_object_unref (priv->textutil); */
|
||||
/* priv->textutil = NULL; */
|
||||
/* g_object_unref (cally_text->priv->textutil); */
|
||||
/* cally_text->priv->textutil = NULL; */
|
||||
|
||||
g_clear_handle_id (&priv->insert_idle_handler, g_source_remove);
|
||||
g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
|
||||
}
|
||||
@@ -253,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)
|
||||
@@ -281,18 +287,16 @@ cally_text_real_initialize(AtkObject *obj,
|
||||
{
|
||||
ClutterText *clutter_text = NULL;
|
||||
CallyText *cally_text = NULL;
|
||||
CallyTextPrivate *priv;
|
||||
|
||||
ATK_OBJECT_CLASS (cally_text_parent_class)->initialize (obj, data);
|
||||
|
||||
g_return_if_fail (CLUTTER_TEXT (data));
|
||||
|
||||
cally_text = CALLY_TEXT (obj);
|
||||
priv = cally_text_get_instance_private (cally_text);
|
||||
clutter_text = CLUTTER_TEXT (data);
|
||||
|
||||
priv->cursor_position = clutter_text_get_cursor_position (clutter_text);
|
||||
priv->selection_bound = clutter_text_get_selection_bound (clutter_text);
|
||||
cally_text->priv->cursor_position = clutter_text_get_cursor_position (clutter_text);
|
||||
cally_text->priv->selection_bound = clutter_text_get_selection_bound (clutter_text);
|
||||
|
||||
g_signal_connect (clutter_text, "insert-text",
|
||||
G_CALLBACK (_cally_text_insert_text_cb),
|
||||
@@ -737,7 +741,7 @@ pango_layout_get_line_after (PangoLayout *layout,
|
||||
*
|
||||
* The @boundary_type determines the size of the returned slice of
|
||||
* text. For the exact semantics of this function, see
|
||||
* [method@Atk.Text.get_text_after_offset].
|
||||
* atk_text_get_text_after_offset().
|
||||
*
|
||||
* Returns: a newly allocated string containing a slice of text
|
||||
* from layout. Free with g_free().
|
||||
@@ -836,7 +840,7 @@ _gtk_pango_get_text_at (PangoLayout *layout,
|
||||
*
|
||||
* The @boundary_type determines the size of the returned slice of
|
||||
* text. For the exact semantics of this function, see
|
||||
* [method@Atk.Text.get_text_before_offset].
|
||||
* atk_text_get_text_before_offset().
|
||||
*
|
||||
* Returns: a newly allocated string containing a slice of text
|
||||
* from layout. Free with g_free().
|
||||
@@ -937,7 +941,7 @@ _gtk_pango_get_text_before (PangoLayout *layout,
|
||||
*
|
||||
* The @boundary_type determines the size of the returned slice of
|
||||
* text. For the exact semantics of this function, see
|
||||
* [method@Atk.Text.get_text_after_offset].
|
||||
* atk_text_get_text_after_offset().
|
||||
*
|
||||
* Returns: a newly allocated string containing a slice of text
|
||||
* from layout. Free with g_free().
|
||||
@@ -1180,21 +1184,13 @@ cally_text_get_text_after_offset (AtkText *text,
|
||||
static gint
|
||||
cally_text_get_caret_offset (AtkText *text)
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterTextBuffer *buffer;
|
||||
int cursor_pos;
|
||||
ClutterActor *actor = NULL;
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
||||
if (actor == NULL) /* State is defunct */
|
||||
return -1;
|
||||
|
||||
cursor_pos = clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
|
||||
if (cursor_pos >= 0)
|
||||
return cursor_pos;
|
||||
|
||||
/* Cursor is at end */
|
||||
buffer = clutter_text_get_buffer (CLUTTER_TEXT (actor));
|
||||
return clutter_text_buffer_get_length (buffer);
|
||||
return clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1433,7 +1429,7 @@ static void cally_text_get_character_extents (AtkText *text,
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterText *clutter_text = NULL;
|
||||
gint x = 0, y = 0, width = 0, height = 0;
|
||||
gint index, x_window, y_window;
|
||||
gint index, x_window, y_window, x_toplevel, y_toplevel;
|
||||
gint x_layout, y_layout;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle extents;
|
||||
@@ -1470,6 +1466,13 @@ static void cally_text_get_character_extents (AtkText *text,
|
||||
width = extents.width / PANGO_SCALE;
|
||||
height = extents.height / PANGO_SCALE;
|
||||
|
||||
if (coords == ATK_XY_SCREEN)
|
||||
{
|
||||
_cally_actor_get_top_level_origin (actor, &x_toplevel, &y_toplevel);
|
||||
x += x_toplevel;
|
||||
y += y_toplevel;
|
||||
}
|
||||
|
||||
done:
|
||||
if (widthp)
|
||||
*widthp = width;
|
||||
@@ -1546,7 +1549,6 @@ _cally_text_delete_text_cb (ClutterText *clutter_text,
|
||||
gpointer data)
|
||||
{
|
||||
CallyText *cally_text = NULL;
|
||||
CallyTextPrivate *priv;
|
||||
|
||||
g_return_if_fail (CALLY_IS_TEXT (data));
|
||||
|
||||
@@ -1555,13 +1557,12 @@ _cally_text_delete_text_cb (ClutterText *clutter_text,
|
||||
return;
|
||||
|
||||
cally_text = CALLY_TEXT (data);
|
||||
priv = cally_text_get_instance_private (cally_text);
|
||||
|
||||
if (!priv->signal_name_delete)
|
||||
if (!cally_text->priv->signal_name_delete)
|
||||
{
|
||||
priv->signal_name_delete = "text_changed::delete";
|
||||
priv->position_delete = start_pos;
|
||||
priv->length_delete = end_pos - start_pos;
|
||||
cally_text->priv->signal_name_delete = "text_changed::delete";
|
||||
cally_text->priv->position_delete = start_pos;
|
||||
cally_text->priv->length_delete = end_pos - start_pos;
|
||||
}
|
||||
|
||||
_notify_delete (cally_text);
|
||||
@@ -1575,27 +1576,25 @@ _cally_text_insert_text_cb (ClutterText *clutter_text,
|
||||
gpointer data)
|
||||
{
|
||||
CallyText *cally_text = NULL;
|
||||
CallyTextPrivate *priv;
|
||||
|
||||
g_return_if_fail (CALLY_IS_TEXT (data));
|
||||
|
||||
cally_text = CALLY_TEXT (data);
|
||||
priv = cally_text_get_instance_private (cally_text);
|
||||
|
||||
if (!priv->signal_name_insert)
|
||||
if (!cally_text->priv->signal_name_insert)
|
||||
{
|
||||
priv->signal_name_insert = "text_changed::insert";
|
||||
priv->position_insert = *position;
|
||||
priv->length_insert = g_utf8_strlen (new_text, new_text_length);
|
||||
cally_text->priv->signal_name_insert = "text_changed::insert";
|
||||
cally_text->priv->position_insert = *position;
|
||||
cally_text->priv->length_insert = g_utf8_strlen (new_text, new_text_length);
|
||||
}
|
||||
|
||||
/*
|
||||
* The signal will be emitted when the cursor position is updated,
|
||||
* or in an idle handler if it not updated.
|
||||
*/
|
||||
if (priv->insert_idle_handler == 0)
|
||||
priv->insert_idle_handler = clutter_threads_add_idle (_idle_notify_insert,
|
||||
cally_text);
|
||||
if (cally_text->priv->insert_idle_handler == 0)
|
||||
cally_text->priv->insert_idle_handler = clutter_threads_add_idle (_idle_notify_insert,
|
||||
cally_text);
|
||||
}
|
||||
|
||||
/***** atkeditabletext.h ******/
|
||||
@@ -1690,7 +1689,7 @@ cally_text_notify_clutter (GObject *obj,
|
||||
atk_obj = clutter_actor_get_accessible (CLUTTER_ACTOR (obj));
|
||||
cally_text = CALLY_TEXT (atk_obj);
|
||||
|
||||
if (g_strcmp0 (pspec->name, "cursor-position") == 0)
|
||||
if (g_strcmp0 (pspec->name, "position") == 0)
|
||||
{
|
||||
/* the selection can change also for the cursor position */
|
||||
if (_check_for_selection_change (cally_text, clutter_text))
|
||||
@@ -1727,22 +1726,20 @@ cally_text_notify_clutter (GObject *obj,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_check_for_selection_change (CallyText *cally_text,
|
||||
_check_for_selection_change (CallyText *cally_text,
|
||||
ClutterText *clutter_text)
|
||||
{
|
||||
gboolean ret_val = FALSE;
|
||||
gint clutter_pos = -1;
|
||||
gint clutter_bound = -1;
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
|
||||
clutter_pos = clutter_text_get_cursor_position (clutter_text);
|
||||
clutter_bound = clutter_text_get_selection_bound (clutter_text);
|
||||
|
||||
if (clutter_pos != clutter_bound)
|
||||
{
|
||||
if (clutter_pos != priv->cursor_position ||
|
||||
clutter_bound != priv->selection_bound)
|
||||
if (clutter_pos != cally_text->priv->cursor_position ||
|
||||
clutter_bound != cally_text->priv->selection_bound)
|
||||
/*
|
||||
* This check is here as this function can be called for
|
||||
* notification of selection_bound and current_pos. The
|
||||
@@ -1755,11 +1752,11 @@ _check_for_selection_change (CallyText *cally_text,
|
||||
else
|
||||
{
|
||||
/* We had a selection */
|
||||
ret_val = (priv->cursor_position != priv->selection_bound);
|
||||
ret_val = (cally_text->priv->cursor_position != cally_text->priv->selection_bound);
|
||||
}
|
||||
|
||||
priv->cursor_position = clutter_pos;
|
||||
priv->selection_bound = clutter_bound;
|
||||
cally_text->priv->cursor_position = clutter_pos;
|
||||
cally_text->priv->selection_bound = clutter_bound;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
@@ -1767,11 +1764,10 @@ _check_for_selection_change (CallyText *cally_text,
|
||||
static gboolean
|
||||
_idle_notify_insert (gpointer data)
|
||||
{
|
||||
CallyText *cally_text = CALLY_TEXT (data);
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
CallyText *cally_text = NULL;
|
||||
|
||||
priv->insert_idle_handler = 0;
|
||||
cally_text = CALLY_TEXT (data);
|
||||
cally_text->priv->insert_idle_handler = 0;
|
||||
|
||||
_notify_insert (cally_text);
|
||||
|
||||
@@ -1781,30 +1777,26 @@ _idle_notify_insert (gpointer data)
|
||||
static void
|
||||
_notify_insert (CallyText *cally_text)
|
||||
{
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
if (priv->signal_name_insert)
|
||||
if (cally_text->priv->signal_name_insert)
|
||||
{
|
||||
g_signal_emit_by_name (cally_text,
|
||||
priv->signal_name_insert,
|
||||
priv->position_insert,
|
||||
priv->length_insert);
|
||||
priv->signal_name_insert = NULL;
|
||||
cally_text->priv->signal_name_insert,
|
||||
cally_text->priv->position_insert,
|
||||
cally_text->priv->length_insert);
|
||||
cally_text->priv->signal_name_insert = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_notify_delete (CallyText *cally_text)
|
||||
{
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
if (priv->signal_name_delete)
|
||||
if (cally_text->priv->signal_name_delete)
|
||||
{
|
||||
g_signal_emit_by_name (cally_text,
|
||||
priv->signal_name_delete,
|
||||
priv->position_delete,
|
||||
priv->length_delete);
|
||||
priv->signal_name_delete = NULL;
|
||||
cally_text->priv->signal_name_delete,
|
||||
cally_text->priv->position_delete,
|
||||
cally_text->priv->length_delete);
|
||||
cally_text->priv->signal_name_delete = NULL;
|
||||
}
|
||||
}
|
||||
/* atkaction */
|
||||
@@ -1823,26 +1815,25 @@ static void
|
||||
_check_activate_action (CallyText *cally_text,
|
||||
ClutterText *clutter_text)
|
||||
{
|
||||
CallyTextPrivate *priv =
|
||||
cally_text_get_instance_private (cally_text);
|
||||
|
||||
if (clutter_text_get_activatable (clutter_text))
|
||||
{
|
||||
if (priv->activate_action_id != 0)
|
||||
if (cally_text->priv->activate_action_id != 0)
|
||||
return;
|
||||
|
||||
priv->activate_action_id = cally_actor_add_action (CALLY_ACTOR (cally_text),
|
||||
"activate", NULL, NULL,
|
||||
_cally_text_activate_action);
|
||||
cally_text->priv->activate_action_id = cally_actor_add_action (CALLY_ACTOR (cally_text),
|
||||
"activate", NULL, NULL,
|
||||
_cally_text_activate_action);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->activate_action_id == 0)
|
||||
if (cally_text->priv->activate_action_id == 0)
|
||||
return;
|
||||
|
||||
if (cally_actor_remove_action (CALLY_ACTOR (cally_text),
|
||||
priv->activate_action_id))
|
||||
cally_text->priv->activate_action_id))
|
||||
{
|
||||
priv->activate_action_id = 0;
|
||||
cally_text->priv->activate_action_id = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2296,7 +2287,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
|
||||
gint y,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
gint index, x_window, y_window;
|
||||
gint index, x_window, y_window, x_toplevel, y_toplevel;
|
||||
gint x_temp, y_temp;
|
||||
gboolean ret;
|
||||
graphene_point3d_t verts[4];
|
||||
@@ -2312,6 +2303,14 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
|
||||
x_temp = x - x_layout - x_window;
|
||||
y_temp = y - y_layout - y_window;
|
||||
|
||||
if (coords == ATK_XY_SCREEN)
|
||||
{
|
||||
_cally_actor_get_top_level_origin (CLUTTER_ACTOR (clutter_text), &x_toplevel,
|
||||
&y_toplevel);
|
||||
x_temp -= x_toplevel;
|
||||
y_temp -= y_toplevel;
|
||||
}
|
||||
|
||||
layout = clutter_text_get_layout (clutter_text);
|
||||
ret = pango_layout_xy_to_index (layout,
|
||||
x_temp * PANGO_SCALE,
|
||||
|
||||
@@ -18,36 +18,67 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_TEXT_H__
|
||||
#define __CALLY_TEXT_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "cally/cally-actor.h"
|
||||
#include <clutter/clutter.h>
|
||||
#include <cally/cally-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_TEXT (cally_text_get_type ())
|
||||
#define CALLY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXT, CallyText))
|
||||
#define CALLY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXT, CallyTextClass))
|
||||
#define CALLY_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXT))
|
||||
#define CALLY_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXT))
|
||||
#define CALLY_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXT, CallyTextClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyText,
|
||||
cally_text,
|
||||
CALLY,
|
||||
TEXT,
|
||||
CallyActor)
|
||||
typedef struct _CallyText CallyText;
|
||||
typedef struct _CallyTextClass CallyTextClass;
|
||||
typedef struct _CallyTextPrivate CallyTextPrivate;
|
||||
|
||||
typedef struct _CallyText CallyText;
|
||||
typedef struct _CallyTextClass CallyTextClass;
|
||||
/**
|
||||
* CallyText:
|
||||
*
|
||||
* The <structname>CallyText</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyText
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyTextPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyTextClass:
|
||||
*
|
||||
* The <structname>CallyTextClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyTextClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_text_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_text_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_TEXT_H__ */
|
||||
|
||||
@@ -18,32 +18,35 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* interfaces to be implemented in any ATK toolkit implementation.
|
||||
|
||||
* For instance, it defines [func@Atk.get_root], the method that returns
|
||||
* For instance, it defines atk_get_root(), the method that returns
|
||||
* the root object in the hierarchy. Without it, you don't have
|
||||
* available any accessible object.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "cally/cally-util.h"
|
||||
#include "cally/cally-root.h"
|
||||
#include "cally/cally-stage.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "cally-util.h"
|
||||
#include "cally-root.h"
|
||||
#include "cally-stage.h"
|
||||
|
||||
#define DEFAULT_PASSWORD_CHAR '*'
|
||||
|
||||
@@ -57,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);
|
||||
@@ -128,7 +142,7 @@ cally_util_get_toolkit_name (void)
|
||||
static const gchar *
|
||||
cally_util_get_toolkit_version (void)
|
||||
{
|
||||
return VERSION;
|
||||
return MUTTER_VERSION;
|
||||
}
|
||||
|
||||
static guint
|
||||
@@ -139,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;
|
||||
@@ -161,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)
|
||||
@@ -173,7 +255,7 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
|
||||
AtkKeyEventStruct *atk_event = g_new0 (AtkKeyEventStruct, 1);
|
||||
gunichar key_unichar;
|
||||
|
||||
switch (clutter_event_type ((ClutterEvent *) clutter_event))
|
||||
switch (clutter_event->type)
|
||||
{
|
||||
case CLUTTER_KEY_PRESS:
|
||||
atk_event->type = ATK_KEY_EVENT_PRESS;
|
||||
@@ -189,7 +271,7 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
|
||||
if (password_char)
|
||||
atk_event->state = 0;
|
||||
else
|
||||
atk_event->state = clutter_event_get_state ((ClutterEvent *) clutter_event);
|
||||
atk_event->state = clutter_event->modifier_state;
|
||||
|
||||
/* We emit the clutter keyval. This is not exactly the one expected
|
||||
by AtkKeyEventStruct, as it expects a Gdk-like event, with the
|
||||
@@ -200,7 +282,7 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
|
||||
if (password_char)
|
||||
atk_event->keyval = clutter_unicode_to_keysym (password_char);
|
||||
else
|
||||
atk_event->keyval = clutter_event_get_key_symbol ((ClutterEvent *) clutter_event);
|
||||
atk_event->keyval = clutter_event->keyval;
|
||||
|
||||
/* It is expected to store a key defining string here (ie "Space" in
|
||||
case you press a space). Anyway, there are no function on clutter
|
||||
@@ -222,7 +304,8 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
|
||||
|
||||
new = g_string_new ("");
|
||||
new = g_string_insert_unichar (new, 0, key_unichar);
|
||||
atk_event->string = g_string_free (new, FALSE);
|
||||
atk_event->string = new->str;
|
||||
g_string_free (new, FALSE);
|
||||
}
|
||||
else
|
||||
atk_event->string = NULL;
|
||||
@@ -236,9 +319,9 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
|
||||
if (password_char)
|
||||
atk_event->keycode = 0;
|
||||
else
|
||||
atk_event->keycode = clutter_event_get_key_code ((ClutterEvent *) clutter_event);
|
||||
atk_event->keycode = clutter_event->hardware_keycode;
|
||||
|
||||
atk_event->timestamp = clutter_event_get_time ((ClutterEvent *) clutter_event);
|
||||
atk_event->timestamp = clutter_event->time;
|
||||
|
||||
#ifdef CALLY_DEBUG
|
||||
|
||||
@@ -276,13 +359,10 @@ insert_hf (gpointer key, gpointer value, gpointer data)
|
||||
* char
|
||||
*/
|
||||
static gunichar
|
||||
check_key_visibility (ClutterStage *stage)
|
||||
check_key_visibility (ClutterEvent *event)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
ClutterActor *focus;
|
||||
|
||||
focus = clutter_stage_get_key_focus (stage);
|
||||
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);
|
||||
|
||||
@@ -298,44 +378,65 @@ check_key_visibility (ClutterStage *stage)
|
||||
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 (ClutterStage *stage,
|
||||
ClutterKeyEvent *key)
|
||||
static gboolean
|
||||
cally_key_snooper (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterEvent *event = (ClutterEvent *) key;
|
||||
AtkKeyEventStruct *key_event = NULL;
|
||||
ClutterEventType event_type;
|
||||
gboolean consumed = FALSE;
|
||||
gint consumed = 0;
|
||||
gunichar password_char = 0;
|
||||
|
||||
event_type = clutter_event_type (event);
|
||||
|
||||
/* filter key events */
|
||||
if ((event_type != CLUTTER_KEY_PRESS) && (event_type != CLUTTER_KEY_RELEASE))
|
||||
return FALSE;
|
||||
if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE))
|
||||
{
|
||||
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 (stage);
|
||||
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
|
||||
|
||||
@@ -18,38 +18,67 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_UTIL_H__
|
||||
#define __CALLY_UTIL_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include <clutter/clutter.h>
|
||||
#include <atk/atk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_UTIL (cally_util_get_type ())
|
||||
#define CALLY_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_UTIL, CallyUtil))
|
||||
#define CALLY_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_UTIL, CallyUtilClass))
|
||||
#define CALLY_IS_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_UTIL))
|
||||
#define CALLY_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_UTIL))
|
||||
#define CALLY_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_UTIL, CallyUtilClass))
|
||||
|
||||
typedef struct _CallyUtil CallyUtil;
|
||||
typedef struct _CallyUtilClass CallyUtilClass;
|
||||
typedef struct _CallyUtilPrivate CallyUtilPrivate;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyUtil,
|
||||
cally_util,
|
||||
CALLY,
|
||||
UTIL,
|
||||
AtkUtil)
|
||||
/**
|
||||
* CallyUtil:
|
||||
*
|
||||
* The <structname>CallyUtil</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyUtil
|
||||
{
|
||||
/*< private >*/
|
||||
AtkUtil parent;
|
||||
|
||||
CallyUtilPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyUtilClass:
|
||||
*
|
||||
* The <structname>CallyUtilClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyUtilClass
|
||||
{
|
||||
/*< private >*/
|
||||
AtkUtilClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_util_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _cally_util_override_atk_util (void);
|
||||
|
||||
gboolean cally_snoop_key_event (ClutterStage *stage,
|
||||
ClutterKeyEvent *key);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_UTIL_H__ */
|
||||
|
||||
@@ -15,24 +15,38 @@
|
||||
* 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/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "cally/cally.h"
|
||||
/**
|
||||
* SECTION:cally
|
||||
* @Title: Cally
|
||||
* @short_description: Cally initialization methods.
|
||||
*
|
||||
* Cally initialization methods.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cally/cally-actor.h"
|
||||
#include "cally/cally-stage.h"
|
||||
#include "cally/cally-text.h"
|
||||
#include "cally/cally-clone.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally/cally-factory.h"
|
||||
#include "cally/cally-util.h"
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "cally.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "cally-actor.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-clone.h"
|
||||
|
||||
#include "cally-factory.h"
|
||||
#include "cally-util.h"
|
||||
|
||||
#include "clutter.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/* factories initialization*/
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
|
||||
@@ -47,6 +61,8 @@ 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)
|
||||
@@ -72,6 +88,8 @@ cally_accessibility_init (void)
|
||||
*
|
||||
* Return value: %TRUE if accessibility support has been correctly
|
||||
* initialized.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean cally_get_cally_initialized (void)
|
||||
{
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CALLY_H__
|
||||
#define __CALLY_H__
|
||||
|
||||
#define __CALLY_H_INSIDE__
|
||||
|
||||
#include "cally/cally-actor.h"
|
||||
#include "cally/cally-clone.h"
|
||||
#include "cally/cally-factory.h"
|
||||
#include "cally/cally-main.h"
|
||||
#include "cally/cally-root.h"
|
||||
#include "cally/cally-stage.h"
|
||||
#include "cally/cally-text.h"
|
||||
#include "cally/cally-util.h"
|
||||
#include "cally-actor.h"
|
||||
#include "cally-clone.h"
|
||||
#include "cally-factory.h"
|
||||
#include "cally-main.h"
|
||||
#include "cally-root.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-util.h"
|
||||
|
||||
#undef __CALLY_H_INSIDE__
|
||||
|
||||
#endif /* __CALLY_H__ */
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2021 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/>.
|
||||
*
|
||||
* Author:
|
||||
* Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-action.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void clutter_action_set_phase (ClutterAction *action,
|
||||
ClutterEventPhase phase);
|
||||
|
||||
gboolean clutter_action_handle_event (ClutterAction *action,
|
||||
const ClutterEvent *event);
|
||||
|
||||
void clutter_action_sequence_cancelled (ClutterAction *action,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
gboolean clutter_action_register_sequence (ClutterAction *self,
|
||||
const ClutterEvent *event);
|
||||
|
||||
int clutter_action_setup_sequence_relationship (ClutterAction *action_1,
|
||||
ClutterAction *action_2,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -23,124 +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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-action.h"
|
||||
#include "clutter/clutter-action-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-action.h"
|
||||
|
||||
typedef struct _ClutterActionPrivate ClutterActionPrivate;
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
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)
|
||||
{
|
||||
gboolean retval;
|
||||
|
||||
g_object_ref (action);
|
||||
retval = CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
|
||||
g_object_unref (action);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_action_sequence_cancelled (ClutterAction *action,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
{
|
||||
ClutterActionClass *action_class = CLUTTER_ACTION_GET_CLASS (action);
|
||||
|
||||
if (action_class->sequence_cancelled)
|
||||
action_class->sequence_cancelled (action, device, sequence);
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_action_register_sequence (ClutterAction *self,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterActionClass *action_class = CLUTTER_ACTION_GET_CLASS (self);
|
||||
|
||||
if (action_class->register_sequence)
|
||||
return action_class->register_sequence (self, event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
clutter_action_setup_sequence_relationship (ClutterAction *action_1,
|
||||
ClutterAction *action_2,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
{
|
||||
ClutterActionClass *action_class = CLUTTER_ACTION_GET_CLASS (action_1);
|
||||
|
||||
if (action_class->setup_sequence_relationship)
|
||||
return action_class->setup_sequence_relationship (action_1, action_2, device, sequence);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTION_H__
|
||||
#define __CLUTTER_ACTION_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-actor-meta.h"
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -42,26 +43,22 @@ G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
|
||||
* 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 (* sequence_cancelled) (ClutterAction *action,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
gboolean (* register_sequence) (ClutterAction *self,
|
||||
const ClutterEvent *event);
|
||||
|
||||
int (* setup_sequence_relationship) (ClutterAction *action_1,
|
||||
ClutterAction *action_2,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
void (* _clutter_action1) (void);
|
||||
void (* _clutter_action2) (void);
|
||||
void (* _clutter_action3) (void);
|
||||
void (* _clutter_action4) (void);
|
||||
void (* _clutter_action5) (void);
|
||||
void (* _clutter_action6) (void);
|
||||
void (* _clutter_action7) (void);
|
||||
void (* _clutter_action8) (void);
|
||||
};
|
||||
|
||||
/* ClutterActor API */
|
||||
@@ -73,11 +70,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
|
||||
@@ -94,6 +86,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__ */
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
|
||||
#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-interval.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-actor-box-private.h"
|
||||
#include "clutter-types.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
/**
|
||||
* clutter_actor_box_new:
|
||||
@@ -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,10 +44,12 @@ 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)
|
||||
@@ -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,7 +122,9 @@ 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)
|
||||
@@ -129,8 +139,10 @@ 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)
|
||||
@@ -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)
|
||||
@@ -295,6 +323,8 @@ clutter_actor_box_get_area (const ClutterActorBox *box)
|
||||
* within @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,
|
||||
@@ -506,9 +548,6 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
|
||||
{
|
||||
float width, height;
|
||||
|
||||
if (clutter_actor_box_get_area (box) == 0.0)
|
||||
return;
|
||||
|
||||
/* The aim here is that for a given rectangle defined with floating point
|
||||
* coordinates we want to determine a stable quantized size in pixels
|
||||
* that doesn't vary due to the original box's sub-pixel position.
|
||||
@@ -561,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,
|
||||
|
||||
@@ -22,14 +22,19 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTOR_META_PRIVATE_H__
|
||||
#define __CLUTTER_ACTOR_META_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-actor-meta.h"
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_META_GROUP (_clutter_meta_group_get_type ())
|
||||
#define CLUTTER_META_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_META_GROUP, ClutterMetaGroup))
|
||||
#define CLUTTER_IS_META_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_META_GROUP))
|
||||
|
||||
typedef struct _ClutterMetaGroup ClutterMetaGroup;
|
||||
typedef struct _ClutterMetaGroupClass ClutterMetaGroupClass;
|
||||
|
||||
struct _ClutterMetaGroup
|
||||
{
|
||||
@@ -40,10 +45,10 @@ struct _ClutterMetaGroup
|
||||
GList *meta;
|
||||
};
|
||||
|
||||
G_DECLARE_FINAL_TYPE (ClutterMetaGroup,
|
||||
_clutter_meta_group,
|
||||
CLUTTER, META_GROUP,
|
||||
GObject)
|
||||
struct _ClutterMetaGroupClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
/* Each actor meta has a priority with zero as a default. A higher
|
||||
number means higher priority. Higher priority metas stay at the
|
||||
@@ -59,6 +64,8 @@ G_DECLARE_FINAL_TYPE (ClutterMetaGroup,
|
||||
#define CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH (G_MAXINT / 2)
|
||||
#define CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW (G_MININT / 2)
|
||||
|
||||
GType _clutter_meta_group_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _clutter_meta_group_add_meta (ClutterMetaGroup *group,
|
||||
ClutterActorMeta *meta);
|
||||
void _clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
||||
@@ -74,9 +81,17 @@ GList * _clutter_meta_group_get_metas_no_internal (ClutterMeta
|
||||
void _clutter_meta_group_clear_metas_no_internal (ClutterMetaGroup *group);
|
||||
|
||||
/* ActorMeta */
|
||||
void _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor);
|
||||
|
||||
const gchar * _clutter_actor_meta_get_debug_name (ClutterActorMeta *meta);
|
||||
|
||||
void _clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
||||
gint priority);
|
||||
int _clutter_actor_meta_get_priority (ClutterActorMeta *meta);
|
||||
|
||||
gboolean _clutter_actor_meta_is_internal (ClutterActorMeta *meta);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_META_PRIVATE_H__ */
|
||||
|
||||
@@ -23,27 +23,30 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-meta-private.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterActorMetaPrivate
|
||||
{
|
||||
@@ -106,8 +109,6 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||
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]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -204,35 +205,43 @@ 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", NULL, NULL,
|
||||
g_param_spec_object ("actor",
|
||||
P_("Actor"),
|
||||
P_("The actor attached to the meta"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
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", NULL, NULL,
|
||||
g_param_spec_string ("name",
|
||||
P_("Name"),
|
||||
P_("The name of the meta"),
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterActorMeta:enabled:
|
||||
*
|
||||
* Whether or not the #ClutterActorMeta is enabled
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_ENABLED] =
|
||||
g_param_spec_boolean ("enabled", NULL, NULL,
|
||||
g_param_spec_boolean ("enabled",
|
||||
P_("Enabled"),
|
||||
P_("Whether the meta is enabled"),
|
||||
TRUE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
gobject_class->finalize = clutter_actor_meta_finalize;
|
||||
gobject_class->set_property = clutter_actor_meta_set_property;
|
||||
@@ -260,6 +269,8 @@ 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,
|
||||
@@ -284,12 +295,14 @@ 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)
|
||||
@@ -309,6 +322,8 @@ 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,
|
||||
@@ -334,6 +349,8 @@ 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)
|
||||
@@ -354,8 +371,10 @@ clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
||||
*
|
||||
* Sets or unsets a back pointer to the #ClutterActor that owns
|
||||
* the @meta
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
static void
|
||||
void
|
||||
_clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
@@ -369,9 +388,11 @@ _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)
|
||||
@@ -406,7 +427,7 @@ _clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
||||
priv->priority = priority;
|
||||
}
|
||||
|
||||
static gint
|
||||
gint
|
||||
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv;
|
||||
@@ -418,7 +439,7 @@ _clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
||||
return priv->priority;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
@@ -433,7 +454,7 @@ _clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
||||
* ClutterMetaGroup: a collection of ClutterActorMeta instances
|
||||
*/
|
||||
|
||||
G_DEFINE_FINAL_TYPE (ClutterMetaGroup, _clutter_meta_group, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (ClutterMetaGroup, _clutter_meta_group, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
_clutter_meta_group_dispose (GObject *gobject)
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTOR_META_H__
|
||||
#define __CLUTTER_ACTOR_META_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -47,6 +48,8 @@ typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
||||
*
|
||||
* The #ClutterActorMetaClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterActorMetaClass
|
||||
{
|
||||
@@ -68,6 +71,14 @@ struct _ClutterActorMetaClass
|
||||
|
||||
void (* set_enabled) (ClutterActorMeta *meta,
|
||||
gboolean is_enabled);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_meta1) (void);
|
||||
void (* _clutter_meta2) (void);
|
||||
void (* _clutter_meta3) (void);
|
||||
void (* _clutter_meta4) (void);
|
||||
void (* _clutter_meta5) (void);
|
||||
void (* _clutter_meta6) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -85,3 +96,5 @@ CLUTTER_EXPORT
|
||||
ClutterActor * clutter_actor_meta_get_actor (ClutterActorMeta *meta);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_META_H__ */
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTOR_PRIVATE_H__
|
||||
#define __CLUTTER_ACTOR_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-actor.h"
|
||||
#include "clutter/clutter-grab.h"
|
||||
#include <clutter/clutter-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -83,7 +83,9 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor
|
||||
* @user_data: The private data specified when starting the iteration
|
||||
*
|
||||
* A generic callback for iterating over actor, such as with
|
||||
* _clutter_actor_foreach_child.
|
||||
* _clutter_actor_foreach_child. The difference when compared to
|
||||
* #ClutterCallback is that it returns a boolean so it is possible to break
|
||||
* out of an iteration early.
|
||||
*
|
||||
* Return value: %TRUE to continue iterating or %FALSE to break iteration
|
||||
* early.
|
||||
@@ -207,6 +209,10 @@ void _clutter_actor_apply_relative_transformation_mat
|
||||
ClutterActor *ancestor,
|
||||
graphene_matrix_t *matrix);
|
||||
|
||||
void _clutter_actor_rerealize (ClutterActor *self,
|
||||
ClutterCallback callback,
|
||||
gpointer data);
|
||||
|
||||
void _clutter_actor_set_in_clone_paint (ClutterActor *self,
|
||||
gboolean is_in_clone_paint);
|
||||
|
||||
@@ -226,6 +232,8 @@ void _clutter_actor_queue_redraw_full
|
||||
const ClutterPaintVolume *volume,
|
||||
ClutterEffect *effect);
|
||||
|
||||
void _clutter_actor_finish_queue_redraw (ClutterActor *self);
|
||||
|
||||
gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self,
|
||||
GType check_gtype,
|
||||
ClutterPaintVolume *volume);
|
||||
@@ -237,16 +245,21 @@ void _clutter_actor_pop_clone_paint
|
||||
|
||||
ClutterActorAlign _clutter_actor_get_effective_x_align (ClutterActor *self);
|
||||
|
||||
void _clutter_actor_handle_event (ClutterActor *actor,
|
||||
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_only_relayout (ClutterActor *actor);
|
||||
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor,
|
||||
gboolean stop_transitions);
|
||||
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor);
|
||||
|
||||
float clutter_actor_get_real_resource_scale (ClutterActor *actor);
|
||||
|
||||
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
CoglTexture *texture);
|
||||
|
||||
void clutter_actor_finish_layout (ClutterActor *self,
|
||||
int phase);
|
||||
|
||||
@@ -254,18 +267,10 @@ void clutter_actor_queue_immediate_relayout (ClutterActor *self);
|
||||
|
||||
gboolean clutter_actor_is_painting_unmapped (ClutterActor *self);
|
||||
|
||||
void clutter_actor_attach_grab (ClutterActor *actor,
|
||||
ClutterGrab *grab);
|
||||
void clutter_actor_detach_grab (ClutterActor *actor,
|
||||
ClutterGrab *grab);
|
||||
|
||||
void clutter_actor_collect_event_actors (ClutterActor *self,
|
||||
ClutterActor *deepmost,
|
||||
GPtrArray *actors);
|
||||
|
||||
const GList * clutter_actor_peek_actions (ClutterActor *self);
|
||||
|
||||
void clutter_actor_set_implicitly_grabbed (ClutterActor *actor,
|
||||
gboolean is_implicitly_grabbed);
|
||||
gboolean clutter_actor_get_redraw_clip (ClutterActor *self,
|
||||
ClutterPaintVolume *dst_old_pv,
|
||||
ClutterPaintVolume *dst_new_pv);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,8 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ACTOR_H__
|
||||
#define __CLUTTER_ACTOR_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
@@ -34,13 +35,12 @@
|
||||
#include <pango/pango.h>
|
||||
#include <atk/atk.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-event.h"
|
||||
#include "clutter/clutter-paint-context.h"
|
||||
#include "clutter/clutter-pick-context.h"
|
||||
#include "mtk/mtk.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -51,12 +51,79 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR))
|
||||
#define CLUTTER_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass))
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
||||
/**
|
||||
* CLUTTER_ACTOR_SET_FLAGS:
|
||||
* @a: a #ClutterActor
|
||||
* @f: the #ClutterActorFlags to set
|
||||
*
|
||||
* Sets the given flags on a #ClutterActor
|
||||
*
|
||||
* Deprecated: 1.24: Changing flags directly is heavily discouraged in
|
||||
* newly written code. #ClutterActor will take care of setting the
|
||||
* internal state.
|
||||
*/
|
||||
#define CLUTTER_ACTOR_SET_FLAGS(a,f) \
|
||||
CLUTTER_MACRO_DEPRECATED \
|
||||
(((ClutterActor*)(a))->flags |= (f))
|
||||
|
||||
/**
|
||||
* CLUTTER_ACTOR_UNSET_FLAGS:
|
||||
* @a: a #ClutterActor
|
||||
* @f: the #ClutterActorFlags to unset
|
||||
*
|
||||
* Unsets the given flags on a #ClutterActor
|
||||
*
|
||||
* Deprecated: 1.24: Changing flags directly is heavily discouraged in
|
||||
* newly written code. #ClutterActor will take care of unsetting the
|
||||
* internal state.
|
||||
*/
|
||||
#define CLUTTER_ACTOR_UNSET_FLAGS(a,f) \
|
||||
CLUTTER_MACRO_DEPRECATED \
|
||||
(((ClutterActor*)(a))->flags &= ~(f))
|
||||
|
||||
#define CLUTTER_ACTOR_IS_MAPPED(a) \
|
||||
CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_mapped instead") \
|
||||
((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_MAPPED) != FALSE)
|
||||
|
||||
#define CLUTTER_ACTOR_IS_REALIZED(a) \
|
||||
CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_realized instead") \
|
||||
((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_REALIZED) != FALSE)
|
||||
|
||||
#define CLUTTER_ACTOR_IS_VISIBLE(a) \
|
||||
CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_visible instead") \
|
||||
((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_VISIBLE) != FALSE)
|
||||
|
||||
#define CLUTTER_ACTOR_IS_REACTIVE(a) \
|
||||
CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_get_reactive instead") \
|
||||
((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_REACTIVE) != FALSE)
|
||||
|
||||
typedef struct _ClutterActorClass ClutterActorClass;
|
||||
typedef struct _ClutterActorPrivate ClutterActorPrivate;
|
||||
|
||||
/**
|
||||
* ClutterCallback:
|
||||
* @actor: a #ClutterActor
|
||||
* @data: (closure): user data
|
||||
*
|
||||
* Generic callback
|
||||
*/
|
||||
typedef void (*ClutterCallback) (ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* CLUTTER_CALLBACK:
|
||||
* @f: a function
|
||||
*
|
||||
* Convenience macro to cast a function to #ClutterCallback
|
||||
*/
|
||||
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
|
||||
|
||||
/**
|
||||
* ClutterActor:
|
||||
* @flags: #ClutterActorFlags
|
||||
*
|
||||
* Base class for actors.
|
||||
*/
|
||||
struct _ClutterActor
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -73,9 +140,9 @@ struct _ClutterActor
|
||||
|
||||
/**
|
||||
* ClutterActorClass:
|
||||
* @show: signal class handler for [signal@Clutter.Actor::show]; it must chain
|
||||
* @show: signal class handler for #ClutterActor::show; it must chain
|
||||
* up to the parent's implementation
|
||||
* @hide: signal class handler for [signal@Clutter.Actor::hide]; it must chain
|
||||
* @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
|
||||
* determine which children should be shown when calling
|
||||
@@ -115,26 +182,26 @@ struct _ClutterActor
|
||||
* have changed, the cached transformation must be invalidated by calling
|
||||
* clutter_actor_invalidate_transform(); it must chain up to the parent's
|
||||
* implementation
|
||||
* @parent_set: signal class handler for the [signal@Clutter.Actor::parent-set]
|
||||
* @destroy: signal class handler for [signal@Clutter.Actor::destroy]. It must
|
||||
* @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
|
||||
* @event: class handler for [signal@Clutter.Actor::event]
|
||||
* @button_press_event: class handler for [signal@Clutter.Actor::button-press-event]
|
||||
* @event: class handler for #ClutterActor::event
|
||||
* @button_press_event: class handler for #ClutterActor::button-press-event
|
||||
* @button_release_event: class handler for
|
||||
* [signal@Clutter.Actor::button-release-event]
|
||||
* @scroll_event: signal class closure for [signal@Clutter.Actor::scroll-event]
|
||||
* @key_press_event: signal class closure for [signal@Clutter.Actor::key-press-event]
|
||||
* #ClutterActor::button-release-event
|
||||
* @scroll_event: signal class closure for #ClutterActor::scroll-event
|
||||
* @key_press_event: signal class closure for #ClutterActor::key-press-event
|
||||
* @key_release_event: signal class closure for
|
||||
* [signal@Clutter.Actor::key-release-event]
|
||||
* @motion_event: signal class closure for [signal@Clutter.Actor::motion-event]
|
||||
* @enter_event: signal class closure for [signal@Clutter.Actor::enter-event]
|
||||
* @leave_event: signal class closure for [signal@Clutter.Actor::leave-event]
|
||||
* @captured_event: signal class closure for [signal@Clutter.Actor::captured-event]
|
||||
* @key_focus_in: signal class closure for [signal@Clutter.Actor::key-focus-in]
|
||||
* @key_focus_out: signal class closure for [signal@Clutter.Actor::key-focus-out]
|
||||
* @queue_relayout: class handler for [signal@Clutter.Actor::queue-relayout]
|
||||
* #ClutterActor::key-release-event
|
||||
* @motion_event: signal class closure for #ClutterActor::motion-event
|
||||
* @enter_event: signal class closure for #ClutterActor::enter-event
|
||||
* @leave_event: signal class closure for #ClutterActor::leave-event
|
||||
* @captured_event: signal class closure for #ClutterActor::captured-event
|
||||
* @key_focus_in: signal class closure for #ClutterActor::key-focus-in
|
||||
* @key_focus_out: signal class closure for #ClutterActor::key-focus-out
|
||||
* @queue_relayout: class handler for #ClutterActor::queue-relayout
|
||||
* @get_accessible: virtual function, returns the accessible object that
|
||||
* describes the actor to an assistive technology.
|
||||
* @get_paint_volume: virtual function, for sub-classes to define their
|
||||
@@ -145,7 +212,7 @@ struct _ClutterActor
|
||||
* clutter_actor_set_offscreen_redirect() for details.
|
||||
* @paint_node: virtual function for creating paint nodes and attaching
|
||||
* them to the render tree
|
||||
* @touch_event: signal class closure for [signal@Clutter.Actor::touch-event]
|
||||
* @touch_event: signal class closure for #ClutterActor::touch-event
|
||||
*
|
||||
* Base class for actors.
|
||||
*/
|
||||
@@ -191,21 +258,21 @@ struct _ClutterActorClass
|
||||
gboolean (* event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
gboolean (* button_press_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterButtonEvent *event);
|
||||
gboolean (* button_release_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterButtonEvent *event);
|
||||
gboolean (* scroll_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterScrollEvent *event);
|
||||
gboolean (* key_press_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterKeyEvent *event);
|
||||
gboolean (* key_release_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterKeyEvent *event);
|
||||
gboolean (* motion_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterMotionEvent *event);
|
||||
gboolean (* enter_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterCrossingEvent *event);
|
||||
gboolean (* leave_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
ClutterCrossingEvent *event);
|
||||
gboolean (* captured_event) (ClutterActor *actor,
|
||||
ClutterEvent *event);
|
||||
void (* key_focus_in) (ClutterActor *actor);
|
||||
@@ -225,19 +292,15 @@ struct _ClutterActorClass
|
||||
ClutterPaintNode *root);
|
||||
|
||||
gboolean (* touch_event) (ClutterActor *self,
|
||||
ClutterEvent *event);
|
||||
ClutterTouchEvent *event);
|
||||
gboolean (* has_accessible) (ClutterActor *self);
|
||||
void (* resource_scale_changed) (ClutterActor *self);
|
||||
float (* calculate_resource_scale) (ClutterActor *self,
|
||||
int phase);
|
||||
|
||||
void (* child_added) (ClutterActor *self,
|
||||
ClutterActor *child);
|
||||
void (* child_removed) (ClutterActor *self,
|
||||
ClutterActor *child);
|
||||
|
||||
/* private */
|
||||
GType layout_manager_type;
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[25];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -248,13 +311,17 @@ struct _ClutterActorClass
|
||||
*
|
||||
* The contents of the #ClutterActorIter structure
|
||||
* are private and should only be accessed using the provided API.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterActorIter
|
||||
{
|
||||
/*< private >*/
|
||||
gpointer CLUTTER_PRIVATE_FIELD (dummy1);
|
||||
gpointer CLUTTER_PRIVATE_FIELD (dummy2);
|
||||
gint CLUTTER_PRIVATE_FIELD (dummy3);
|
||||
gpointer CLUTTER_PRIVATE_FIELD (dummy3);
|
||||
gint CLUTTER_PRIVATE_FIELD (dummy4);
|
||||
gpointer CLUTTER_PRIVATE_FIELD (dummy5);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -290,9 +357,6 @@ CLUTTER_EXPORT
|
||||
void clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
CoglTexture *texture);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
CLUTTER_EXPORT
|
||||
@@ -301,8 +365,8 @@ void clutter_actor_continue_pick
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
const MtkRectangle *clip);
|
||||
void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_relayout (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@@ -560,13 +624,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);
|
||||
@@ -579,8 +636,10 @@ void clutter_actor_get_background_color
|
||||
CLUTTER_EXPORT
|
||||
const ClutterPaintVolume * clutter_actor_get_paint_volume (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintVolume * clutter_actor_get_transformed_paint_volume (ClutterActor *self,
|
||||
const ClutterPaintVolume * clutter_actor_get_transformed_paint_volume (ClutterActor *self,
|
||||
ClutterActor *relative_to_ancestor);
|
||||
CLUTTER_EXPORT
|
||||
const ClutterPaintVolume * clutter_actor_get_default_paint_volume (ClutterActor *self);
|
||||
|
||||
/* Events */
|
||||
CLUTTER_EXPORT
|
||||
@@ -841,7 +900,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);
|
||||
@@ -873,10 +934,6 @@ void clutter_actor_invalidate_transform (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_invalidate_paint_volume (ClutterActor *self);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_class_set_layout_manager_type (ClutterActorClass *actor_class,
|
||||
GType type);
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_actor_class_get_layout_manager_type (ClutterActorClass *actor_class);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_H__ */
|
||||
|
||||
@@ -23,28 +23,34 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:
|
||||
* SECTION:clutter-align-constraint
|
||||
* @Title: ClutterAlignConstraint
|
||||
* @Short_Description: A constraint aligning the position of an actor
|
||||
*
|
||||
* A constraint aligning the position of an actor
|
||||
* #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 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 available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-align-constraint.h"
|
||||
#include "clutter-align-constraint.h"
|
||||
|
||||
#include "clutter/clutter-actor-meta-private.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-constraint.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-constraint.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass))
|
||||
#define CLUTTER_IS_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT))
|
||||
#define CLUTTER_ALIGN_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass))
|
||||
|
||||
struct _ClutterAlignConstraint
|
||||
{
|
||||
ClutterConstraint parent_instance;
|
||||
@@ -56,6 +62,11 @@ struct _ClutterAlignConstraint
|
||||
gfloat factor;
|
||||
};
|
||||
|
||||
struct _ClutterAlignConstraintClass
|
||||
{
|
||||
ClutterConstraintClass parent_class;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@@ -70,9 +81,9 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_FINAL_TYPE (ClutterAlignConstraint,
|
||||
clutter_align_constraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
G_DEFINE_TYPE (ClutterAlignConstraint,
|
||||
clutter_align_constraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
|
||||
static void
|
||||
source_queue_relayout (ClutterActor *actor,
|
||||
@@ -278,26 +289,30 @@ 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", NULL, NULL,
|
||||
g_param_spec_object ("source",
|
||||
P_("Source"),
|
||||
P_("The source of the alignment"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
/**
|
||||
* 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", NULL, NULL,
|
||||
g_param_spec_enum ("align-axis",
|
||||
P_("Align Axis"),
|
||||
P_("The axis to align the position to"),
|
||||
CLUTTER_TYPE_ALIGN_AXIS,
|
||||
CLUTTER_ALIGN_X_AXIS,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:pivot-point:
|
||||
@@ -316,7 +331,9 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
|
||||
* the source actor.
|
||||
*/
|
||||
obj_props[PROP_PIVOT_POINT] =
|
||||
g_param_spec_boxed ("pivot-point", NULL, NULL,
|
||||
g_param_spec_boxed ("pivot-point",
|
||||
P_("Pivot point"),
|
||||
P_("The pivot point"),
|
||||
GRAPHENE_TYPE_POINT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
@@ -330,14 +347,16 @@ 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", NULL, NULL,
|
||||
g_param_spec_float ("factor",
|
||||
P_("Factor"),
|
||||
P_("The alignment factor, between 0.0 and 1.0"),
|
||||
0.0, 1.0,
|
||||
0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
gobject_class->dispose = clutter_align_constraint_dispose;
|
||||
gobject_class->set_property = clutter_align_constraint_set_property;
|
||||
@@ -368,6 +387,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,
|
||||
@@ -389,6 +410,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,
|
||||
@@ -455,6 +478,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)
|
||||
@@ -470,6 +495,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,
|
||||
@@ -492,9 +519,11 @@ clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
|
||||
* clutter_align_constraint_get_align_axis:
|
||||
* @align: a #ClutterAlignConstraint
|
||||
*
|
||||
* Retrieves the value set using [method@Clutter.AlignConstraint.set_align_axis]
|
||||
* 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)
|
||||
@@ -546,7 +575,7 @@ clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
|
||||
* @pivot_point: (out caller-allocates): return location for a #GraphenePoint
|
||||
*
|
||||
* Gets the pivot point used by the constraint set with
|
||||
* [method@Clutter.AlignConstraint.set_pivot_point]. If no custom pivot
|
||||
* clutter_align_constraint_set_pivot_point(). If no custom pivot
|
||||
* point is set, -1 is set.
|
||||
*/
|
||||
void
|
||||
@@ -575,6 +604,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,
|
||||
@@ -594,9 +625,11 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
|
||||
* clutter_align_constraint_get_factor:
|
||||
* @align: a #ClutterAlignConstraint
|
||||
*
|
||||
* Retrieves the factor set using [method@Clutter.AlignConstraint.set_factor]
|
||||
* 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)
|
||||
|
||||
@@ -22,21 +22,34 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ALIGN_CONSTRAINT_H__
|
||||
#define __CLUTTER_ALIGN_CONSTRAINT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-constraint.h"
|
||||
#include <clutter/clutter-constraint.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ALIGN_CONSTRAINT (clutter_align_constraint_get_type ())
|
||||
#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;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (ClutterAlignConstraint, clutter_align_constraint,
|
||||
CLUTTER, ALIGN_CONSTRAINT, ClutterConstraint)
|
||||
GType clutter_align_constraint_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterConstraint *clutter_align_constraint_new (ClutterActor *source,
|
||||
@@ -66,3 +79,5 @@ CLUTTER_EXPORT
|
||||
gfloat clutter_align_constraint_get_factor (ClutterAlignConstraint *align);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ALIGN_CONSTRAINT_H__ */
|
||||
|
||||
@@ -23,25 +23,26 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* #ClutterAnimatable is an interface that allows a #GObject class
|
||||
* to control how an actor 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.
|
||||
*
|
||||
* #ClutterAnimatable is available since Clutter 1.0
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-animatable.h"
|
||||
#include "clutter/clutter-interval.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
||||
|
||||
@@ -55,10 +56,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 +89,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 +118,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,10 +156,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,
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_ANIMATABLE_H__
|
||||
#define __CLUTTER_ANIMATABLE_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -50,6 +51,8 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
||||
* @interpolate_value: virtual function for interpolating the progress
|
||||
* of a property
|
||||
* @get_actor: virtual function for getting associated actor
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterAnimatableInterface
|
||||
{
|
||||
@@ -95,3 +98,5 @@ CLUTTER_EXPORT
|
||||
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
||||
|
||||
93
clutter/clutter/clutter-autocleanups.h
Normal file
93
clutter/clutter/clutter-autocleanups.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright 2015 Emmanuele Bassi
|
||||
*
|
||||
* 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_AUTO_CLEANUPS_H__
|
||||
#define __CLUTTER_AUTO_CLEANUPS_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, 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)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBinLayout, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBlurEffect, g_object_unref)
|
||||
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 (ClutterClone, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
||||
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 (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)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutMeta, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPanAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathConstraint, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPath, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRotateAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScriptable, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScript, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSettings, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterShaderEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSnapConstraint, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStage, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTapAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTextBuffer, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTimeline, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTransitionGroup, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTransition, g_object_unref)
|
||||
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 (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)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
|
||||
|
||||
#endif /* __GI_SCANNER__ */
|
||||
|
||||
#endif /* __CLUTTER_AUTO_CLEANUPS_H__ */
|
||||
@@ -19,11 +19,12 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BACKEND_PRIVATE_H__
|
||||
#define __CLUTTER_BACKEND_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-backend.h"
|
||||
#include "clutter/clutter-seat.h"
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
|
||||
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
|
||||
#define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND))
|
||||
@@ -49,6 +50,9 @@ struct _ClutterBackend
|
||||
|
||||
gchar *font_name;
|
||||
|
||||
gfloat units_per_em;
|
||||
gint32 units_serial;
|
||||
|
||||
float fallback_resource_scale;
|
||||
|
||||
ClutterStageWindow *stage_window;
|
||||
@@ -62,9 +66,17 @@ struct _ClutterBackendClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* vfuncs */
|
||||
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_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,
|
||||
@@ -74,6 +86,10 @@ struct _ClutterBackendClass
|
||||
gboolean (* create_context) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
|
||||
gboolean (* translate_event) (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event);
|
||||
|
||||
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
||||
|
||||
gboolean (* is_display_server) (ClutterBackend *backend);
|
||||
@@ -84,12 +100,34 @@ struct _ClutterBackendClass
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
void clutter_set_allowed_drivers (const char *drivers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
|
||||
|
||||
@@ -105,3 +143,5 @@ CLUTTER_EXPORT
|
||||
void clutter_backend_destroy (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
||||
|
||||
@@ -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,22 +34,23 @@
|
||||
* #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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-backend-private.h"
|
||||
#include "clutter/clutter-context-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-event-private.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-stage-manager-private.h"
|
||||
#include "clutter/clutter-stage-private.h"
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-window.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#define DEFAULT_FONT_NAME "Sans 10"
|
||||
|
||||
@@ -91,10 +91,66 @@ clutter_backend_dispose (GObject *gobject)
|
||||
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static gfloat
|
||||
get_units_per_em (ClutterBackend *backend,
|
||||
PangoFontDescription *font_desc)
|
||||
{
|
||||
gfloat units_per_em = -1.0;
|
||||
gboolean free_font_desc = FALSE;
|
||||
gdouble dpi;
|
||||
|
||||
dpi = clutter_backend_get_resolution (backend);
|
||||
|
||||
if (font_desc == NULL)
|
||||
{
|
||||
ClutterSettings *settings;
|
||||
gchar *font_name = NULL;
|
||||
|
||||
settings = clutter_settings_get_default ();
|
||||
g_object_get (settings, "font-name", &font_name, NULL);
|
||||
|
||||
if (G_LIKELY (font_name != NULL && *font_name != '\0'))
|
||||
{
|
||||
font_desc = pango_font_description_from_string (font_name);
|
||||
free_font_desc = TRUE;
|
||||
|
||||
g_free (font_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (font_desc != NULL)
|
||||
{
|
||||
gdouble font_size = 0;
|
||||
gint pango_size;
|
||||
gboolean is_absolute;
|
||||
|
||||
pango_size = pango_font_description_get_size (font_desc);
|
||||
is_absolute = pango_font_description_get_size_is_absolute (font_desc);
|
||||
|
||||
/* "absolute" means "device units" (usually, pixels); otherwise,
|
||||
* it means logical units (points)
|
||||
*/
|
||||
if (is_absolute)
|
||||
font_size = (gdouble) pango_size / PANGO_SCALE;
|
||||
else
|
||||
font_size = dpi * ((gdouble) pango_size / PANGO_SCALE) / 72.0f;
|
||||
|
||||
/* 10 points at 96 DPI is 13.3 pixels */
|
||||
units_per_em = (1.2f * font_size) * dpi / 96.0f;
|
||||
}
|
||||
else
|
||||
units_per_em = -1.0f;
|
||||
|
||||
if (free_font_desc)
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
return units_per_em;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
||||
{
|
||||
ClutterContext *context;
|
||||
ClutterMainContext *context;
|
||||
ClutterSettings *settings;
|
||||
gdouble resolution;
|
||||
gint dpi;
|
||||
@@ -110,6 +166,20 @@ clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
||||
context = _clutter_context_get_default ();
|
||||
if (context->font_map != NULL)
|
||||
cogl_pango_font_map_set_resolution (context->font_map, resolution);
|
||||
|
||||
backend->units_per_em = get_units_per_em (backend, NULL);
|
||||
backend->units_serial += 1;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Units per em: %.2f", backend->units_per_em);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_real_font_changed (ClutterBackend *backend)
|
||||
{
|
||||
backend->units_per_em = get_units_per_em (backend, NULL);
|
||||
backend->units_serial += 1;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Units per em: %.2f", backend->units_per_em);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -168,7 +238,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer, tmpl);
|
||||
|
||||
/* the display owns the template */
|
||||
g_object_unref (tmpl);
|
||||
cogl_object_unref (tmpl);
|
||||
}
|
||||
|
||||
if (backend->cogl_display == NULL)
|
||||
@@ -184,17 +254,26 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
goto error;
|
||||
|
||||
/* the display owns the renderer and the swap chain */
|
||||
g_object_unref (backend->cogl_renderer);
|
||||
g_object_unref (swap_chain);
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
g_clear_object (&backend->cogl_display);
|
||||
g_clear_object (&backend->cogl_renderer);
|
||||
if (backend->cogl_display != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_display);
|
||||
backend->cogl_display = NULL;
|
||||
}
|
||||
|
||||
if (backend->cogl_renderer != NULL)
|
||||
{
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
backend->cogl_renderer = NULL;
|
||||
}
|
||||
|
||||
if (swap_chain != NULL)
|
||||
g_object_unref (swap_chain);
|
||||
cogl_object_unref (swap_chain);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -204,11 +283,14 @@ static const struct {
|
||||
const char *driver_desc;
|
||||
CoglDriver driver_id;
|
||||
} all_known_drivers[] = {
|
||||
{ "gl3", "OpenGL 3.1 core profile", COGL_DRIVER_GL3 },
|
||||
{ "gl3", "OpenGL 3.2 core profile", COGL_DRIVER_GL3 },
|
||||
{ "gl", "OpenGL legacy profile", COGL_DRIVER_GL },
|
||||
{ "gles2", "OpenGL ES 2.0", COGL_DRIVER_GLES2 },
|
||||
{ "any", "Default Cogl driver", COGL_DRIVER_ANY },
|
||||
};
|
||||
|
||||
static const char *allowed_drivers;
|
||||
|
||||
static gboolean
|
||||
clutter_backend_real_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
@@ -216,14 +298,20 @@ clutter_backend_real_create_context (ClutterBackend *backend,
|
||||
GError *internal_error = NULL;
|
||||
const char *drivers_list;
|
||||
char **known_drivers;
|
||||
gboolean allow_any;
|
||||
int i;
|
||||
|
||||
if (backend->cogl_context != NULL)
|
||||
return TRUE;
|
||||
|
||||
if (allowed_drivers == NULL)
|
||||
allowed_drivers = CLUTTER_DRIVERS;
|
||||
|
||||
allow_any = strstr (allowed_drivers, "*") != NULL;
|
||||
|
||||
drivers_list = g_getenv ("CLUTTER_DRIVER");
|
||||
if (drivers_list == NULL)
|
||||
drivers_list = "*";
|
||||
drivers_list = allowed_drivers;
|
||||
|
||||
known_drivers = g_strsplit (drivers_list, ",", 0);
|
||||
|
||||
@@ -235,7 +323,11 @@ clutter_backend_real_create_context (ClutterBackend *backend,
|
||||
|
||||
for (j = 0; j < G_N_ELEMENTS (all_known_drivers); j++)
|
||||
{
|
||||
if (is_any ||
|
||||
if (!allow_any && !is_any && !strstr (driver_name, all_known_drivers[j].driver_name))
|
||||
continue;
|
||||
|
||||
if ((allow_any && is_any) ||
|
||||
(is_any && strstr (allowed_drivers, all_known_drivers[j].driver_name)) ||
|
||||
g_str_equal (all_known_drivers[j].driver_name, driver_name))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Checking for the %s driver", all_known_drivers[j].driver_desc);
|
||||
@@ -261,7 +353,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;
|
||||
@@ -273,6 +366,53 @@ 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_BUFFERS_EVENT))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
|
||||
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static ClutterBackend * (* custom_backend_func) (void);
|
||||
|
||||
void
|
||||
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
||||
{
|
||||
custom_backend_func = func;
|
||||
}
|
||||
|
||||
ClutterBackend *
|
||||
_clutter_create_backend (void)
|
||||
{
|
||||
ClutterBackend *retval;
|
||||
|
||||
g_return_val_if_fail (custom_backend_func, NULL);
|
||||
|
||||
retval = custom_backend_func ();
|
||||
if (!retval)
|
||||
g_error ("Failed to create custom backend.");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
{
|
||||
@@ -284,8 +424,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
* 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"),
|
||||
@@ -299,8 +441,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"),
|
||||
@@ -314,8 +458,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"),
|
||||
@@ -326,18 +472,66 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
klass->resolution_changed = clutter_backend_real_resolution_changed;
|
||||
klass->font_changed = clutter_backend_real_font_changed;
|
||||
|
||||
klass->create_context = clutter_backend_real_create_context;
|
||||
klass->get_features = clutter_backend_real_get_features;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_init (ClutterBackend *self)
|
||||
{
|
||||
self->units_per_em = -1.0;
|
||||
self->units_serial = 1;
|
||||
|
||||
self->dummy_onscreen = NULL;
|
||||
|
||||
self->fallback_resource_scale = 1.f;
|
||||
}
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
ClutterStageWindow *
|
||||
_clutter_backend_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
@@ -378,6 +572,60 @@ _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;
|
||||
}
|
||||
|
||||
gfloat
|
||||
_clutter_backend_get_units_per_em (ClutterBackend *backend,
|
||||
PangoFontDescription *font_desc)
|
||||
{
|
||||
/* recompute for the font description, but do not cache the result */
|
||||
if (font_desc != NULL)
|
||||
return get_units_per_em (backend, font_desc);
|
||||
|
||||
if (backend->units_per_em < 0)
|
||||
backend->units_per_em = get_units_per_em (backend, NULL);
|
||||
|
||||
return backend->units_per_em;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_default_backend:
|
||||
*
|
||||
@@ -387,11 +635,13 @@ _clutter_backend_create_context (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)
|
||||
{
|
||||
ClutterContext *clutter_context;
|
||||
ClutterMainContext *clutter_context;
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
|
||||
@@ -415,6 +665,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)
|
||||
@@ -442,11 +694,13 @@ clutter_backend_get_resolution (ClutterBackend *backend)
|
||||
* copy the #cairo_font_options_t.
|
||||
*
|
||||
* If @options is %NULL, the first following call to
|
||||
* [method@Clutter.Backend.get_font_options] will return the default font
|
||||
* clutter_backend_get_font_options() will return the default font
|
||||
* options for @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,
|
||||
@@ -477,6 +731,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)
|
||||
@@ -497,8 +753,24 @@ clutter_backend_get_font_options (ClutterBackend *backend)
|
||||
return backend->font_options;
|
||||
}
|
||||
|
||||
gint32
|
||||
_clutter_backend_get_units_serial (ClutterBackend *backend)
|
||||
{
|
||||
return backend->units_serial;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_backend_translate_event (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->translate_event (backend,
|
||||
native,
|
||||
event);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_cogl_context:
|
||||
* clutter_backend_get_cogl_context: (skip)
|
||||
* @backend: a #ClutterBackend
|
||||
*
|
||||
* Retrieves the #CoglContext associated with the given clutter
|
||||
@@ -513,6 +785,9 @@ clutter_backend_get_font_options (ClutterBackend *backend)
|
||||
* explicitly create a CoglContext.
|
||||
*
|
||||
* Return value: (transfer none): The #CoglContext associated with @backend.
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: unstable
|
||||
*/
|
||||
CoglContext *
|
||||
clutter_backend_get_cogl_context (ClutterBackend *backend)
|
||||
@@ -520,6 +795,18 @@ clutter_backend_get_cogl_context (ClutterBackend *backend)
|
||||
return backend->cogl_context;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("Clutter has already been initialized.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
allowed_drivers = g_strdup (drivers);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_input_method:
|
||||
* @backend: the #CLutterBackend
|
||||
@@ -537,7 +824,7 @@ clutter_backend_get_input_method (ClutterBackend *backend)
|
||||
/**
|
||||
* clutter_backend_set_input_method:
|
||||
* @backend: the #ClutterBackend
|
||||
* @method: (nullable): the input method
|
||||
* @method: the input method
|
||||
*
|
||||
* Sets the input method to be used by Clutter
|
||||
**/
|
||||
@@ -545,12 +832,6 @@ void
|
||||
clutter_backend_set_input_method (ClutterBackend *backend,
|
||||
ClutterInputMethod *method)
|
||||
{
|
||||
if (backend->input_method == method)
|
||||
return;
|
||||
|
||||
if (backend->input_method)
|
||||
clutter_input_method_focus_out (backend->input_method);
|
||||
|
||||
g_set_object (&backend->input_method, method);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,19 +21,21 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BACKEND_H__
|
||||
#define __CLUTTER_BACKEND_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cairo.h>
|
||||
#include <pango/pango.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter/clutter-keymap.h"
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-seat.h"
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -41,6 +43,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;
|
||||
|
||||
@@ -71,6 +81,6 @@ void clutter_backend_set_input_method (Clutter
|
||||
CLUTTER_EXPORT
|
||||
ClutterSeat * clutter_backend_get_default_seat (ClutterBackend *backend);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_H__ */
|
||||
|
||||
@@ -20,15 +20,27 @@
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
/**
|
||||
* SECTION:clutter-geometric-types
|
||||
* @Title: Base geometric types
|
||||
* @Short_Description: Common geometric data types used by Clutter
|
||||
*
|
||||
* Clutter defines a set of geometric data structures that are commonly used
|
||||
* across the whole API.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-types.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define FLOAT_EPSILON (1e-15)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ClutterMargin
|
||||
*/
|
||||
@@ -39,8 +51,10 @@
|
||||
* Creates a new #ClutterMargin.
|
||||
*
|
||||
* Return value: (transfer full): a newly allocated #ClutterMargin. Use
|
||||
* [method@Clutter.Margin.free] to free the resources associated with it when
|
||||
* clutter_margin_free() to free the resources associated with it when
|
||||
* done.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterMargin *
|
||||
clutter_margin_new (void)
|
||||
@@ -56,6 +70,8 @@ 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_)
|
||||
@@ -70,8 +86,10 @@ clutter_margin_copy (const ClutterMargin *margin_)
|
||||
* clutter_margin_free:
|
||||
* @margin_: a #ClutterMargin
|
||||
*
|
||||
* Frees the resources allocated by [ctor@Clutter.Margin.new] and
|
||||
* [method@Clutter.Margin.copy].
|
||||
* Frees the resources allocated by clutter_margin_new() and
|
||||
* clutter_margin_copy().
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_margin_free (ClutterMargin *margin_)
|
||||
|
||||
514
clutter/clutter/clutter-bezier.c
Normal file
514
clutter/clutter/clutter-bezier.c
Normal file
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Tomas Frydrych <tf@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
*
|
||||
* 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 <glib.h>
|
||||
#include <string.h>
|
||||
#include "clutter-bezier.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
/*
|
||||
* We have some experimental code here to allow for constant velocity
|
||||
* movement of actors along the bezier path, this macro enables it.
|
||||
*/
|
||||
#undef CBZ_L2T_INTERPOLATION
|
||||
|
||||
/****************************************************************************
|
||||
* ClutterBezier -- representation of a cubic bezier curve *
|
||||
* (private; a building block for the public bspline object) *
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* The t parameter of the bezier is from interval <0,1>, so we can use
|
||||
* 14.18 format and special multiplication functions that preserve
|
||||
* more of the least significant bits but would overflow if the value
|
||||
* is > 1
|
||||
*/
|
||||
#define CBZ_T_Q 18
|
||||
#define CBZ_T_ONE (1 << CBZ_T_Q)
|
||||
#define CBZ_T_MUL(x,y) ((((x) >> 3) * ((y) >> 3)) >> 12)
|
||||
#define CBZ_T_POW2(x) CBZ_T_MUL (x, x)
|
||||
#define CBZ_T_POW3(x) CBZ_T_MUL (CBZ_T_POW2 (x), x)
|
||||
#define CBZ_T_DIV(x,y) ((((x) << 9)/(y)) << 9)
|
||||
|
||||
/*
|
||||
* Constants for sampling of the bezier
|
||||
*/
|
||||
#define CBZ_T_SAMPLES 128
|
||||
#define CBZ_T_STEP (CBZ_T_ONE / CBZ_T_SAMPLES)
|
||||
#define CBZ_L_STEP (CBZ_T_ONE / CBZ_T_SAMPLES)
|
||||
|
||||
#define FIXED_BITS (32)
|
||||
#define FIXED_Q (FIXED_BITS - 16)
|
||||
#define FIXED_FROM_INT(x) ((x) << FIXED_Q)
|
||||
|
||||
typedef gint32 _FixedT;
|
||||
|
||||
/*
|
||||
* This is a private type representing a single cubic bezier
|
||||
*/
|
||||
struct _ClutterBezier
|
||||
{
|
||||
/*
|
||||
* bezier coefficients -- these are calculated using multiplication and
|
||||
* addition from integer input, so these are also integers
|
||||
*/
|
||||
gint ax;
|
||||
gint bx;
|
||||
gint cx;
|
||||
gint dx;
|
||||
|
||||
gint ay;
|
||||
gint by;
|
||||
gint cy;
|
||||
gint dy;
|
||||
|
||||
/* length of the bezier */
|
||||
guint length;
|
||||
|
||||
#ifdef CBZ_L2T_INTERPOLATION
|
||||
/*
|
||||
* coefficients for the L -> t bezier; these are calculated from fixed
|
||||
* point input, and more specifically numbers that have been normalised
|
||||
* to fit <0,1>, so these are also fixed point, and we can used the
|
||||
* _FixedT type here.
|
||||
*/
|
||||
_FixedT La;
|
||||
_FixedT Lb;
|
||||
_FixedT Lc;
|
||||
/* _FixedT Ld; == 0 */
|
||||
#endif
|
||||
};
|
||||
|
||||
ClutterBezier *
|
||||
_clutter_bezier_new (void)
|
||||
{
|
||||
return g_new0 (ClutterBezier, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_bezier_free (ClutterBezier * b)
|
||||
{
|
||||
if (G_LIKELY (b))
|
||||
{
|
||||
g_free (b);
|
||||
}
|
||||
}
|
||||
|
||||
ClutterBezier *
|
||||
_clutter_bezier_clone_and_move (const ClutterBezier *b, gint x, gint y)
|
||||
{
|
||||
ClutterBezier * b2 = _clutter_bezier_new ();
|
||||
memcpy (b2, b, sizeof (ClutterBezier));
|
||||
|
||||
b2->dx += x;
|
||||
b2->dy += y;
|
||||
|
||||
return b2;
|
||||
}
|
||||
|
||||
#ifdef CBZ_L2T_INTERPOLATION
|
||||
/*
|
||||
* L is relative advance along the bezier curve from interval <0,1>
|
||||
*/
|
||||
static _FixedT
|
||||
_clutter_bezier_L2t (const ClutterBezier *b, _FixedT L)
|
||||
{
|
||||
_FixedT t = CBZ_T_MUL (b->La, CBZ_T_POW3(L))
|
||||
+ CBZ_T_MUL (b->Lb, CBZ_T_POW2(L))
|
||||
+ CBZ_T_MUL (b->Lc, L);
|
||||
|
||||
if (t > CBZ_T_ONE)
|
||||
t = CBZ_T_ONE;
|
||||
else if (t < 0)
|
||||
t = 0;
|
||||
|
||||
return t;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
_clutter_bezier_t2x (const ClutterBezier * b, _FixedT t)
|
||||
{
|
||||
/*
|
||||
* NB -- the int coefficients can be at most 8192 for the multiplication
|
||||
* to work in this fashion due to the limits of the 14.18 fixed.
|
||||
*/
|
||||
return ((b->ax*CBZ_T_POW3(t) + b->bx*CBZ_T_POW2(t) + b->cx*t) >> CBZ_T_Q)
|
||||
+ b->dx;
|
||||
}
|
||||
|
||||
static gint
|
||||
_clutter_bezier_t2y (const ClutterBezier * b, _FixedT t)
|
||||
{
|
||||
/*
|
||||
* NB -- the int coefficients can be at most 8192 for the multiplication
|
||||
* to work in this fashion due to the limits of the 14.18 fixed.
|
||||
*/
|
||||
return ((b->ay*CBZ_T_POW3(t) + b->by*CBZ_T_POW2(t) + b->cy*t) >> CBZ_T_Q)
|
||||
+ b->dy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Advances along the bezier to relative length L and returns the coordinances
|
||||
* in knot
|
||||
*/
|
||||
void
|
||||
_clutter_bezier_advance (const ClutterBezier *b, gint L, ClutterKnot * knot)
|
||||
{
|
||||
#ifdef CBZ_L2T_INTERPOLATION
|
||||
_FixedT t = clutter_bezier_L2t (b, L);
|
||||
#else
|
||||
_FixedT t = L;
|
||||
#endif
|
||||
|
||||
knot->x = _clutter_bezier_t2x (b, t);
|
||||
knot->y = _clutter_bezier_t2y (b, t);
|
||||
|
||||
CLUTTER_NOTE (MISC, "advancing to relative pt %f: t %f, {%d,%d}",
|
||||
(double) L / (double) CBZ_T_ONE,
|
||||
(double) t / (double) CBZ_T_ONE,
|
||||
knot->x, knot->y);
|
||||
}
|
||||
|
||||
static int
|
||||
sqrti (int number)
|
||||
{
|
||||
#if defined __SSE2__
|
||||
/* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as
|
||||
* the pure integer code below. It is also more accurate.
|
||||
*/
|
||||
return __builtin_sqrt (number);
|
||||
#else
|
||||
/* This is a fixed point implementation of the Quake III sqrt algorithm,
|
||||
* described, for example, at
|
||||
* http://www.codemaestro.com/reviews/review00000105.html
|
||||
*
|
||||
* While the original QIII is extremely fast, the use of floating division
|
||||
* and multiplication makes it perform very on arm processors without FPU.
|
||||
*
|
||||
* The key to successfully replacing the floating point operations with
|
||||
* fixed point is in the choice of the fixed point format. The QIII
|
||||
* 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
|
||||
* elsewhere in clutter is not good enough, and 10.22 is used instead.
|
||||
*/
|
||||
_FixedT x;
|
||||
uint32_t y_1; /* 10.22 fixed point */
|
||||
uint32_t f = 0x600000; /* '1.5' as 10.22 fixed */
|
||||
|
||||
union
|
||||
{
|
||||
float f;
|
||||
uint32_t i;
|
||||
} flt, flt2;
|
||||
|
||||
flt.f = number;
|
||||
|
||||
x = FIXED_FROM_INT (number) / 2;
|
||||
|
||||
/* The QIII initial estimate */
|
||||
flt.i = 0x5f3759df - ( flt.i >> 1 );
|
||||
|
||||
/* 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
|
||||
* 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).
|
||||
*
|
||||
* Note: we have to use two separate variables here -- for some reason,
|
||||
* if we try to use just the flt variable, gcc on ARM optimises the whole
|
||||
* addition out, and it all goes pear shape, since without it, the bits
|
||||
* in the float will not be correctly aligned.
|
||||
*/
|
||||
flt2.f = flt.f + 2.0;
|
||||
flt2.i &= 0x7FFFFF;
|
||||
|
||||
/* Now we correct the estimate */
|
||||
y_1 = (flt2.i >> 11) * (flt2.i >> 11);
|
||||
y_1 = (y_1 >> 8) * (x >> 8);
|
||||
|
||||
y_1 = f - y_1;
|
||||
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 produces generally better results).
|
||||
*/
|
||||
if (x < 171)
|
||||
{
|
||||
y_1 = (flt2.i >> 11) * (flt2.i >> 11);
|
||||
y_1 = (y_1 >> 8) * (x >> 8);
|
||||
|
||||
y_1 = f - y_1;
|
||||
flt2.i = (flt2.i >> 11) * (y_1 >> 11);
|
||||
}
|
||||
|
||||
/* Invert, round and convert from 10.22 to an integer
|
||||
* 0x1e3c68 is a magical rounding constant that produces slightly
|
||||
* better results than 0x200000.
|
||||
*/
|
||||
return (number * flt2.i + 0x1e3c68) >> 22;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_bezier_init (ClutterBezier *b,
|
||||
gint x_0, gint y_0,
|
||||
gint x_1, gint y_1,
|
||||
gint x_2, gint y_2,
|
||||
gint x_3, gint y_3)
|
||||
{
|
||||
_FixedT t;
|
||||
int i;
|
||||
int xp = x_0;
|
||||
int yp = y_0;
|
||||
_FixedT length [CBZ_T_SAMPLES + 1];
|
||||
|
||||
#ifdef CBZ_L2T_INTERPOLATION
|
||||
int j, k;
|
||||
_FixedT L;
|
||||
_FixedT t_equalized [CBZ_T_SAMPLES + 1];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_debug ("Initializing bezier at {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
|
||||
x0, y0, x1, y1, x2, y2, x3, y3);
|
||||
#endif
|
||||
|
||||
b->dx = x_0;
|
||||
b->dy = y_0;
|
||||
|
||||
b->cx = 3 * (x_1 - x_0);
|
||||
b->cy = 3 * (y_1 - y_0);
|
||||
|
||||
b->bx = 3 * (x_2 - x_1) - b->cx;
|
||||
b->by = 3 * (y_2 - y_1) - b->cy;
|
||||
|
||||
b->ax = x_3 - 3 * x_2 + 3 * x_1 - x_0;
|
||||
b->ay = y_3 - 3 * y_2 + 3 * y_1 - y_0;
|
||||
|
||||
#if 0
|
||||
g_debug ("Cooeficients {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
|
||||
b->ax, b->ay, b->bx, b->by, b->cx, b->cy, b->dx, b->dy);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Because of the way we do the multiplication in bezeir_t2x,y
|
||||
* these coefficients need to be at most 0x1fff; this should be the case,
|
||||
* I think, but have added this warning to catch any problems -- if it
|
||||
* triggers, we need to change those two functions a bit.
|
||||
*/
|
||||
if (b->ax > 0x1fff || b->bx > 0x1fff || b->cx > 0x1fff)
|
||||
g_warning ("Calculated coefficients will result in multiplication "
|
||||
"overflow in clutter_bezier_t2x and clutter_bezier_t2y.");
|
||||
|
||||
/*
|
||||
* Sample the bezier with CBZ_T_SAMPLES and calculate length at
|
||||
* each point.
|
||||
*
|
||||
* We are working with integers here, so we use the fast sqrti function.
|
||||
*/
|
||||
length[0] = 0;
|
||||
|
||||
for (t = CBZ_T_STEP, i = 1; i <= CBZ_T_SAMPLES; ++i, t += CBZ_T_STEP)
|
||||
{
|
||||
int x = _clutter_bezier_t2x (b, t);
|
||||
int y = _clutter_bezier_t2y (b, t);
|
||||
|
||||
guint l = sqrti ((y - yp)*(y - yp) + (x - xp)*(x - xp));
|
||||
|
||||
l += length[i-1];
|
||||
|
||||
length[i] = l;
|
||||
|
||||
xp = x;
|
||||
yp = y;
|
||||
}
|
||||
|
||||
b->length = length[CBZ_T_SAMPLES];
|
||||
|
||||
#if 0
|
||||
g_debug ("length %d", b->length);
|
||||
#endif
|
||||
|
||||
#ifdef CBZ_L2T_INTERPOLATION
|
||||
/*
|
||||
* Now normalize the length values, converting them into _FixedT
|
||||
*/
|
||||
for (i = 0; i <= CBZ_T_SAMPLES; ++i)
|
||||
{
|
||||
length[i] = (length[i] << CBZ_T_Q) / b->length;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now generate a L -> t table such that the L will equidistant
|
||||
* over <0,1>
|
||||
*/
|
||||
t_equalized[0] = 0;
|
||||
|
||||
for (i = 1, j = 1, L = CBZ_L_STEP; i < CBZ_T_SAMPLES; ++i, L += CBZ_L_STEP)
|
||||
{
|
||||
_FixedT l1, l2;
|
||||
_FixedT d1, d2, d;
|
||||
_FixedT t1, t2;
|
||||
|
||||
/* find the band for our L */
|
||||
for (k = j; k < CBZ_T_SAMPLES; ++k)
|
||||
{
|
||||
if (L < length[k])
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we know that L is from (length[k-1],length[k]>
|
||||
* We remember k-1 in order not to have to iterate over the
|
||||
* whole length array in the next iteration of the main loop
|
||||
*/
|
||||
j = k - 1;
|
||||
|
||||
/*
|
||||
* Now interpolate equlised t as a weighted average
|
||||
*/
|
||||
l1 = length[k-1];
|
||||
l2 = length[k];
|
||||
d1 = l2 - L;
|
||||
d2 = L - l1;
|
||||
d = l2 - l1;
|
||||
t1 = (k - 1) * CBZ_T_STEP;
|
||||
t2 = k * CBZ_T_STEP;
|
||||
|
||||
t_equalized[i] = (t1*d1 + t2*d2)/d;
|
||||
|
||||
if (t_equalized[i] < t_equalized[i-1])
|
||||
g_debug ("wrong t: L %f, l1 %f, l2 %f, t1 %f, t2 %f",
|
||||
(double) (L)/(double)CBZ_T_ONE,
|
||||
(double) (l1)/(double)CBZ_T_ONE,
|
||||
(double) (l2)/(double)CBZ_T_ONE,
|
||||
(double) (t1)/(double)CBZ_T_ONE,
|
||||
(double) (t2)/(double)CBZ_T_ONE);
|
||||
|
||||
}
|
||||
|
||||
t_equalized[CBZ_T_SAMPLES] = CBZ_T_ONE;
|
||||
|
||||
/* We now fit a bezier -- at this stage, do a single fit through our values
|
||||
* at 0, 1/3, 2/3 and 1
|
||||
*
|
||||
* FIXME -- do we need to use a better fitting approach to choose the best
|
||||
* beziere. The actual curve we acquire this way is not too bad shapwise,
|
||||
* but (probably due to rounding errors) the resulting curve no longer
|
||||
* satisfies the necessary condition that for L2 > L1, t2 > t1, which
|
||||
* causes oscilation.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* These are the control points we use to calculate the curve coefficients
|
||||
* for bezier t(L); these are not needed directly, but are implied in the
|
||||
* calculations below.
|
||||
*
|
||||
* (p0 is 0,0, and p3 is 1,1)
|
||||
*/
|
||||
p1 = (18 * t_equalized[CBZ_T_SAMPLES/3] -
|
||||
9 * t_equalized[2*CBZ_T_SAMPLES/3] +
|
||||
2 << CBZ_T_Q) / 6;
|
||||
|
||||
p2 = (18 * t_equalized[2*CBZ_T_SAMPLES/3] -
|
||||
9 * t_equalized[CBZ_T_SAMPLES/3] -
|
||||
(5 << CBZ_T_Q)) / 6;
|
||||
#endif
|
||||
|
||||
b->Lc = (18 * t_equalized[CBZ_T_SAMPLES/3] -
|
||||
9 * t_equalized[2*CBZ_T_SAMPLES/3] +
|
||||
(2 << CBZ_T_Q)) >> 1;
|
||||
|
||||
b->Lb = (36 * t_equalized[2*CBZ_T_SAMPLES/3] -
|
||||
45 * t_equalized[CBZ_T_SAMPLES/3] -
|
||||
(9 << CBZ_T_Q)) >> 1;
|
||||
|
||||
b->La = ((27 * (t_equalized[CBZ_T_SAMPLES/3] -
|
||||
t_equalized[2*CBZ_T_SAMPLES/3]) +
|
||||
(7 << CBZ_T_Q)) >> 1) + CBZ_T_ONE;
|
||||
|
||||
g_debug ("t(1/3) %f, t(2/3) %f",
|
||||
(double)t_equalized[CBZ_T_SAMPLES/3]/(double)CBZ_T_ONE,
|
||||
(double)t_equalized[2*CBZ_T_SAMPLES/3]/(double)CBZ_T_ONE);
|
||||
|
||||
g_debug ("L -> t coefficients: %f, %f, %f",
|
||||
(double)b->La/(double)CBZ_T_ONE,
|
||||
(double)b->Lb/(double)CBZ_T_ONE,
|
||||
(double)b->Lc/(double)CBZ_T_ONE);
|
||||
|
||||
|
||||
/*
|
||||
* For debugging, you can load these values into a spreadsheet and graph
|
||||
* them to see how well the approximation matches the data
|
||||
*/
|
||||
for (i = 0; i < CBZ_T_SAMPLES; ++i)
|
||||
{
|
||||
g_print ("%f, %f, %f\n",
|
||||
(double)(i*CBZ_T_STEP)/(double)CBZ_T_ONE,
|
||||
(double)(t_equalized[i])/(double)CBZ_T_ONE,
|
||||
(double)(clutter_bezier_L2t(b,i*CBZ_T_STEP))/(double)CBZ_T_ONE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves a control point at indx to location represented by knot
|
||||
*/
|
||||
void
|
||||
_clutter_bezier_adjust (ClutterBezier * b, ClutterKnot * knot, guint indx)
|
||||
{
|
||||
guint x[4], y[4];
|
||||
|
||||
g_assert (indx < 4);
|
||||
|
||||
x[0] = b->dx;
|
||||
y[0] = b->dy;
|
||||
|
||||
x[1] = b->cx / 3 + x[0];
|
||||
y[1] = b->cy / 3 + y[0];
|
||||
|
||||
x[2] = b->bx / 3 + b->cx + x[1];
|
||||
y[2] = b->by / 3 + b->cy + y[1];
|
||||
|
||||
x[3] = b->ax + x[0] + b->cx + b->bx;
|
||||
y[3] = b->ay + y[0] + b->cy + b->by;
|
||||
|
||||
x[indx] = knot->x;
|
||||
y[indx] = knot->y;
|
||||
|
||||
_clutter_bezier_init (b, x[0], y[0], x[1], y[1], x[2], y[2], x[3], y[3]);
|
||||
}
|
||||
|
||||
guint
|
||||
_clutter_bezier_get_length (const ClutterBezier *b)
|
||||
{
|
||||
return b->length;
|
||||
}
|
||||
65
clutter/clutter/clutter-bezier.h
Normal file
65
clutter/clutter/clutter-bezier.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Tomas Frydrych <tf@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenedHand
|
||||
*
|
||||
* 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_BEZIER_H__
|
||||
#define __CLUTTER_BEZIER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "clutter-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* This is used in _clutter_bezier_advance to represent the full
|
||||
length of the bezier curve. Anything less than that represents a
|
||||
fraction of the length */
|
||||
#define CLUTTER_BEZIER_MAX_LENGTH (1 << 18)
|
||||
|
||||
typedef struct _ClutterBezier ClutterBezier;
|
||||
|
||||
ClutterBezier *_clutter_bezier_new (void);
|
||||
|
||||
void _clutter_bezier_free (ClutterBezier * b);
|
||||
|
||||
ClutterBezier *_clutter_bezier_clone_and_move (const ClutterBezier *b,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void _clutter_bezier_advance (const ClutterBezier *b,
|
||||
gint L,
|
||||
ClutterKnot *knot);
|
||||
|
||||
void _clutter_bezier_init (ClutterBezier *b,
|
||||
gint x_0, gint y_0,
|
||||
gint x_1, gint y_1,
|
||||
gint x_2, gint y_2,
|
||||
gint x_3, gint y_3);
|
||||
|
||||
void _clutter_bezier_adjust (ClutterBezier *b,
|
||||
ClutterKnot *knot,
|
||||
guint indx);
|
||||
|
||||
guint _clutter_bezier_get_length (const ClutterBezier *b);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEZIER_H__ */
|
||||
@@ -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:
|
||||
@@ -37,27 +36,258 @@
|
||||
* of the other;
|
||||
* - for each layer there are horizontal and vertical
|
||||
* alignment policies.
|
||||
*
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-animatable.h"
|
||||
#include "clutter/clutter-bin-layout.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-layout-meta.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
G_DEFINE_TYPE (ClutterBinLayout,
|
||||
clutter_bin_layout,
|
||||
CLUTTER_TYPE_LAYOUT_MANAGER)
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-bin-layout.h"
|
||||
#include "clutter-child-meta.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-layout-meta.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define CLUTTER_TYPE_BIN_LAYER (clutter_bin_layer_get_type ())
|
||||
#define CLUTTER_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYER, ClutterBinLayer))
|
||||
#define CLUTTER_IS_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIN_LAYER))
|
||||
|
||||
typedef struct _ClutterBinLayer ClutterBinLayer;
|
||||
typedef struct _ClutterLayoutMetaClass ClutterBinLayerClass;
|
||||
|
||||
struct _ClutterBinLayoutPrivate
|
||||
{
|
||||
ClutterBinAlignment x_align;
|
||||
ClutterBinAlignment y_align;
|
||||
|
||||
ClutterContainer *container;
|
||||
};
|
||||
|
||||
struct _ClutterBinLayer
|
||||
{
|
||||
ClutterLayoutMeta parent_instance;
|
||||
|
||||
ClutterBinAlignment x_align;
|
||||
ClutterBinAlignment y_align;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_LAYER_0,
|
||||
|
||||
PROP_LAYER_X_ALIGN,
|
||||
PROP_LAYER_Y_ALIGN,
|
||||
|
||||
PROP_LAYER_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_X_ALIGN,
|
||||
PROP_Y_ALIGN,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *layer_props[PROP_LAYER_LAST] = { NULL, };
|
||||
static GParamSpec *bin_props[PROP_LAST] = { NULL, };
|
||||
|
||||
GType clutter_bin_layer_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (ClutterBinLayer,
|
||||
clutter_bin_layer,
|
||||
CLUTTER_TYPE_LAYOUT_META)
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBinLayout,
|
||||
clutter_bin_layout,
|
||||
CLUTTER_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
/*
|
||||
* ClutterBinLayer
|
||||
*/
|
||||
|
||||
static void
|
||||
set_layer_x_align (ClutterBinLayer *self,
|
||||
ClutterBinAlignment alignment)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterLayoutMeta *meta;
|
||||
|
||||
if (self->x_align == alignment)
|
||||
return;
|
||||
|
||||
self->x_align = alignment;
|
||||
|
||||
meta = CLUTTER_LAYOUT_META (self);
|
||||
manager = clutter_layout_meta_get_manager (meta);
|
||||
clutter_layout_manager_layout_changed (manager);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_X_ALIGN]);
|
||||
}
|
||||
|
||||
static void
|
||||
set_layer_y_align (ClutterBinLayer *self,
|
||||
ClutterBinAlignment alignment)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterLayoutMeta *meta;
|
||||
|
||||
if (self->y_align == alignment)
|
||||
return;
|
||||
|
||||
self->y_align = alignment;
|
||||
|
||||
meta = CLUTTER_LAYOUT_META (self);
|
||||
manager = clutter_layout_meta_get_manager (meta);
|
||||
clutter_layout_manager_layout_changed (manager);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_Y_ALIGN]);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layer_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBinLayer *layer = CLUTTER_BIN_LAYER (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LAYER_X_ALIGN:
|
||||
set_layer_x_align (layer, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_LAYER_Y_ALIGN:
|
||||
set_layer_y_align (layer, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layer_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBinLayer *layer = CLUTTER_BIN_LAYER (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LAYER_X_ALIGN:
|
||||
g_value_set_enum (value, layer->x_align);
|
||||
break;
|
||||
|
||||
case PROP_LAYER_Y_ALIGN:
|
||||
g_value_set_enum (value, layer->y_align);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layer_class_init (ClutterBinLayerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_bin_layer_set_property;
|
||||
gobject_class->get_property = clutter_bin_layer_get_property;
|
||||
|
||||
layer_props[PROP_LAYER_X_ALIGN] =
|
||||
g_param_spec_enum ("x-align",
|
||||
P_("Horizontal Alignment"),
|
||||
P_("Horizontal alignment for the actor "
|
||||
"inside the layout manager"),
|
||||
CLUTTER_TYPE_BIN_ALIGNMENT,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
layer_props[PROP_LAYER_Y_ALIGN] =
|
||||
g_param_spec_enum ("y-align",
|
||||
P_("Vertical Alignment"),
|
||||
P_("Vertical alignment for the actor "
|
||||
"inside the layout manager"),
|
||||
CLUTTER_TYPE_BIN_ALIGNMENT,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAYER_LAST,
|
||||
layer_props);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layer_init (ClutterBinLayer *layer)
|
||||
{
|
||||
layer->x_align = CLUTTER_BIN_ALIGNMENT_CENTER;
|
||||
layer->y_align = CLUTTER_BIN_ALIGNMENT_CENTER;
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterBinLayout
|
||||
*/
|
||||
|
||||
static void
|
||||
set_x_align (ClutterBinLayout *self,
|
||||
ClutterBinAlignment alignment)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv = self->priv;
|
||||
|
||||
if (priv->x_align != alignment)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
|
||||
priv->x_align = alignment;
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
clutter_layout_manager_layout_changed (manager);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), bin_props[PROP_X_ALIGN]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_y_align (ClutterBinLayout *self,
|
||||
ClutterBinAlignment alignment)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv = self->priv;
|
||||
|
||||
if (priv->y_align != alignment)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
|
||||
priv->y_align = alignment;
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
clutter_layout_manager_layout_changed (manager);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), bin_props[PROP_Y_ALIGN]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *nat_width_p)
|
||||
@@ -94,7 +324,7 @@ clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
|
||||
|
||||
static void
|
||||
clutter_bin_layout_get_preferred_height (ClutterLayoutManager *manager,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *nat_height_p)
|
||||
@@ -129,6 +359,29 @@ clutter_bin_layout_get_preferred_height (ClutterLayoutManager *manager,
|
||||
*nat_height_p = nat_height;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
get_bin_alignment_factor (ClutterBinAlignment alignment,
|
||||
ClutterTextDirection text_dir)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case CLUTTER_BIN_ALIGNMENT_CENTER:
|
||||
return 0.5;
|
||||
|
||||
case CLUTTER_BIN_ALIGNMENT_START:
|
||||
return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 0.0 : 1.0;
|
||||
|
||||
case CLUTTER_BIN_ALIGNMENT_END:
|
||||
return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 1.0 : 0.0;
|
||||
|
||||
case CLUTTER_BIN_ALIGNMENT_FIXED:
|
||||
case CLUTTER_BIN_ALIGNMENT_FILL:
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
get_actor_align_factor (ClutterActorAlign alignment)
|
||||
{
|
||||
@@ -152,7 +405,7 @@ get_actor_align_factor (ClutterActorAlign alignment)
|
||||
|
||||
static void
|
||||
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation)
|
||||
{
|
||||
gfloat allocation_x, allocation_y;
|
||||
@@ -168,6 +421,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
ClutterLayoutMeta *meta;
|
||||
ClutterBinLayer *layer;
|
||||
ClutterActorBox child_alloc = { 0, };
|
||||
gdouble x_align, y_align;
|
||||
gboolean x_fill, y_fill, is_fixed_position_set;
|
||||
@@ -176,6 +431,11 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
if (!clutter_actor_is_visible (child))
|
||||
continue;
|
||||
|
||||
meta = clutter_layout_manager_get_child_meta (manager,
|
||||
container,
|
||||
child);
|
||||
layer = CLUTTER_BIN_LAYER (meta);
|
||||
|
||||
fixed_x = fixed_y = 0.f;
|
||||
g_object_get (child,
|
||||
"fixed-position-set", &is_fixed_position_set,
|
||||
@@ -183,7 +443,11 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
"fixed-y", &fixed_y,
|
||||
NULL);
|
||||
|
||||
if (is_fixed_position_set)
|
||||
/* XXX:2.0 - remove the FIXED alignment, and just use the fixed position
|
||||
* of the actor if one is set
|
||||
*/
|
||||
if (is_fixed_position_set ||
|
||||
layer->x_align == CLUTTER_BIN_ALIGNMENT_FIXED)
|
||||
{
|
||||
if (is_fixed_position_set)
|
||||
child_alloc.x1 = fixed_x;
|
||||
@@ -193,7 +457,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
else
|
||||
child_alloc.x1 = allocation_x;
|
||||
|
||||
if (is_fixed_position_set)
|
||||
if (is_fixed_position_set ||
|
||||
layer->y_align == CLUTTER_BIN_ALIGNMENT_FIXED)
|
||||
{
|
||||
if (is_fixed_position_set)
|
||||
child_alloc.y1 = fixed_y;
|
||||
@@ -216,10 +481,14 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
}
|
||||
else
|
||||
{
|
||||
x_fill = FALSE;
|
||||
ClutterTextDirection text_dir;
|
||||
|
||||
x_fill = (layer->x_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
||||
|
||||
text_dir = clutter_actor_get_text_direction (child);
|
||||
|
||||
if (!is_fixed_position_set)
|
||||
x_align = 0.5;
|
||||
x_align = get_bin_alignment_factor (layer->x_align, text_dir);
|
||||
else
|
||||
x_align = 0.0;
|
||||
}
|
||||
@@ -234,10 +503,11 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
}
|
||||
else
|
||||
{
|
||||
y_fill = FALSE;
|
||||
y_fill = (layer->y_align == CLUTTER_BIN_ALIGNMENT_FILL);
|
||||
|
||||
if (!is_fixed_position_set)
|
||||
y_align = 0.5;
|
||||
y_align = get_bin_alignment_factor (layer->y_align,
|
||||
CLUTTER_TEXT_DIRECTION_LTR);
|
||||
else
|
||||
y_align = 0.0;
|
||||
}
|
||||
@@ -248,32 +518,181 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
}
|
||||
}
|
||||
|
||||
static GType
|
||||
clutter_bin_layout_get_child_meta_type (ClutterLayoutManager *manager)
|
||||
{
|
||||
return CLUTTER_TYPE_BIN_LAYER;
|
||||
}
|
||||
|
||||
static ClutterLayoutMeta *
|
||||
clutter_bin_layout_create_child_meta (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
|
||||
priv = CLUTTER_BIN_LAYOUT (manager)->priv;
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_BIN_LAYER,
|
||||
"container", container,
|
||||
"actor", actor,
|
||||
"manager", manager,
|
||||
"x-align", priv->x_align,
|
||||
"y_align", priv->y_align,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_set_container (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
ClutterLayoutManagerClass *parent_class;
|
||||
|
||||
priv = CLUTTER_BIN_LAYOUT (manager)->priv;
|
||||
priv->container = container;
|
||||
|
||||
parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_bin_layout_parent_class);
|
||||
parent_class->set_container (manager, container);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBinLayout *layout = CLUTTER_BIN_LAYOUT (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_ALIGN:
|
||||
set_x_align (layout, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_Y_ALIGN:
|
||||
set_y_align (layout, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
|
||||
priv = CLUTTER_BIN_LAYOUT (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_ALIGN:
|
||||
g_value_set_enum (value, priv->x_align);
|
||||
break;
|
||||
|
||||
case PROP_Y_ALIGN:
|
||||
g_value_set_enum (value, priv->y_align);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterLayoutManagerClass *layout_class =
|
||||
CLUTTER_LAYOUT_MANAGER_CLASS (klass);
|
||||
|
||||
/**
|
||||
* ClutterBinLayout:x-align:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
bin_props[PROP_X_ALIGN] =
|
||||
g_param_spec_enum ("x-align",
|
||||
P_("Horizontal Alignment"),
|
||||
P_("Default horizontal alignment for the actors "
|
||||
"inside the layout manager"),
|
||||
CLUTTER_TYPE_BIN_ALIGNMENT,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterBinLayout:y-align:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
bin_props[PROP_Y_ALIGN] =
|
||||
g_param_spec_enum ("y-align",
|
||||
P_("Vertical Alignment"),
|
||||
P_("Default vertical alignment for the actors "
|
||||
"inside the layout manager"),
|
||||
CLUTTER_TYPE_BIN_ALIGNMENT,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
gobject_class->set_property = clutter_bin_layout_set_property;
|
||||
gobject_class->get_property = clutter_bin_layout_get_property;
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, bin_props);
|
||||
|
||||
layout_class->get_preferred_width = clutter_bin_layout_get_preferred_width;
|
||||
layout_class->get_preferred_height = clutter_bin_layout_get_preferred_height;
|
||||
layout_class->allocate = clutter_bin_layout_allocate;
|
||||
layout_class->create_child_meta = clutter_bin_layout_create_child_meta;
|
||||
layout_class->get_child_meta_type = clutter_bin_layout_get_child_meta_type;
|
||||
layout_class->set_container = clutter_bin_layout_set_container;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bin_layout_init (ClutterBinLayout *self)
|
||||
{
|
||||
self->priv = clutter_bin_layout_get_instance_private (self);
|
||||
|
||||
self->priv->x_align = CLUTTER_BIN_ALIGNMENT_CENTER;
|
||||
self->priv->y_align = CLUTTER_BIN_ALIGNMENT_CENTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_bin_layout_new:
|
||||
* @x_align: the default alignment policy to be used on the
|
||||
* horizontal axis
|
||||
* @y_align: the default alignment policy to be used on the
|
||||
* vertical axis
|
||||
*
|
||||
* Creates a new #ClutterBinLayout layout manager
|
||||
*
|
||||
* Return value: the newly created layout manager
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterLayoutManager *
|
||||
clutter_bin_layout_new (void)
|
||||
clutter_bin_layout_new (ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_BIN_LAYOUT,
|
||||
"x-align", x_align,
|
||||
"y-align", y_align,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -22,30 +22,51 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BIN_LAYOUT_H__
|
||||
#define __CLUTTER_BIN_LAYOUT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-layout-manager.h"
|
||||
#include <clutter/clutter-layout-manager.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BIN_LAYOUT (clutter_bin_layout_get_type ())
|
||||
#define CLUTTER_TYPE_BIN_LAYOUT (clutter_bin_layout_get_type ())
|
||||
#define CLUTTER_BIN_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayout))
|
||||
#define CLUTTER_IS_BIN_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIN_LAYOUT))
|
||||
#define CLUTTER_BIN_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayoutClass))
|
||||
#define CLUTTER_IS_BIN_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIN_LAYOUT))
|
||||
#define CLUTTER_BIN_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayoutClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterBinLayout,
|
||||
clutter_bin_layout,
|
||||
CLUTTER,
|
||||
BIN_LAYOUT,
|
||||
ClutterLayoutManager)
|
||||
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 >*/
|
||||
ClutterLayoutManager parent_instance;
|
||||
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBinLayoutClass:
|
||||
*
|
||||
* The #ClutterBinLayoutClass structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBinLayoutClass
|
||||
{
|
||||
@@ -54,6 +75,12 @@ struct _ClutterBinLayoutClass
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterLayoutManager * clutter_bin_layout_new (void);
|
||||
GType clutter_bin_layout_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BIN_LAYOUT_H__ */
|
||||
|
||||
@@ -23,20 +23,20 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:
|
||||
* SECTION:clutter-bind-constraint
|
||||
* @Title: ClutterBindConstraint
|
||||
* @Short_Description: A constraint binding the position or size of an actor
|
||||
*
|
||||
* 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);
|
||||
@@ -64,12 +64,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,21 +78,27 @@
|
||||
* "@constraints.blue-x.offset", 200.0,
|
||||
* "opacity", 255,
|
||||
* NULL);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* #ClutterBindConstraint is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-bind-constraint.h"
|
||||
#include "clutter-bind-constraint.h"
|
||||
|
||||
#include "clutter/clutter-actor-meta-private.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-constraint.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-constraint.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define CLUTTER_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass))
|
||||
#define CLUTTER_IS_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIND_CONSTRAINT))
|
||||
#define CLUTTER_BIND_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass))
|
||||
|
||||
struct _ClutterBindConstraint
|
||||
{
|
||||
@@ -104,6 +110,11 @@ struct _ClutterBindConstraint
|
||||
gfloat offset;
|
||||
};
|
||||
|
||||
struct _ClutterBindConstraintClass
|
||||
{
|
||||
ClutterConstraintClass parent_class;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@@ -117,9 +128,9 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_FINAL_TYPE (ClutterBindConstraint,
|
||||
clutter_bind_constraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
G_DEFINE_TYPE (ClutterBindConstraint,
|
||||
clutter_bind_constraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
|
||||
static void
|
||||
source_queue_relayout (ClutterActor *source,
|
||||
@@ -381,39 +392,45 @@ 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", NULL, NULL,
|
||||
g_param_spec_object ("source",
|
||||
P_("Source"),
|
||||
P_("The source of the binding"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:coordinate:
|
||||
*
|
||||
* The coordinate to be bound
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_COORDINATE] =
|
||||
g_param_spec_enum ("coordinate", NULL, NULL,
|
||||
g_param_spec_enum ("coordinate",
|
||||
P_("Coordinate"),
|
||||
P_("The coordinate to bind"),
|
||||
CLUTTER_TYPE_BIND_COORDINATE,
|
||||
CLUTTER_BIND_X,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:offset:
|
||||
*
|
||||
* The offset, in pixels, to be applied to the binding
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_OFFSET] =
|
||||
g_param_spec_float ("offset", NULL, NULL,
|
||||
g_param_spec_float ("offset",
|
||||
P_("Offset"),
|
||||
P_("The offset in pixels to apply to the binding"),
|
||||
-G_MAXFLOAT, G_MAXFLOAT,
|
||||
0.0f,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT);
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAST,
|
||||
@@ -440,6 +457,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,
|
||||
@@ -461,6 +480,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,
|
||||
@@ -523,9 +544,11 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
|
||||
* clutter_bind_constraint_get_source:
|
||||
* @constraint: a #ClutterBindConstraint
|
||||
*
|
||||
* Retrieves the #ClutterActor set using [method@Clutter.BindConstraint.set_source]
|
||||
* 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)
|
||||
@@ -541,6 +564,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,
|
||||
@@ -566,6 +591,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)
|
||||
@@ -582,6 +609,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,
|
||||
@@ -604,9 +633,11 @@ clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
|
||||
* clutter_bind_constraint_get_offset:
|
||||
* @constraint: a #ClutterBindConstraint
|
||||
*
|
||||
* Retrieves the offset set using [method@Clutter.BindConstraint.set_offset]
|
||||
* 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)
|
||||
|
||||
@@ -22,21 +22,34 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BIND_CONSTRAINT_H__
|
||||
#define __CLUTTER_BIND_CONSTRAINT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-constraint.h"
|
||||
#include <clutter/clutter-constraint.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BIND_CONSTRAINT (clutter_bind_constraint_get_type ())
|
||||
#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;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (ClutterBindConstraint, clutter_bind_constraint,
|
||||
CLUTTER, BIND_CONSTRAINT, ClutterConstraint)
|
||||
GType clutter_bind_constraint_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterConstraint * clutter_bind_constraint_new (ClutterActor *source,
|
||||
@@ -60,3 +73,5 @@ CLUTTER_EXPORT
|
||||
gfloat clutter_bind_constraint_get_offset (ClutterBindConstraint *constraint);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BIND_CONSTRAINT_H__ */
|
||||
|
||||
@@ -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@Event] key event
|
||||
* structure to one of the actions:
|
||||
* 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,28 +84,34 @@
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-binding-pool.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-binding-pool.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define BINDING_MOD_MASK ((CLUTTER_SHIFT_MASK | \
|
||||
#define CLUTTER_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
|
||||
#define CLUTTER_IS_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_BINDING_POOL))
|
||||
#define CLUTTER_BINDING_POOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
|
||||
|
||||
#define BINDING_MOD_MASK ((CLUTTER_SHIFT_MASK | \
|
||||
CLUTTER_CONTROL_MASK | \
|
||||
CLUTTER_MOD1_MASK | \
|
||||
CLUTTER_SUPER_MASK | \
|
||||
CLUTTER_HYPER_MASK | \
|
||||
CLUTTER_META_MASK) | CLUTTER_RELEASE_MASK)
|
||||
CLUTTER_MOD1_MASK | \
|
||||
CLUTTER_SUPER_MASK | \
|
||||
CLUTTER_HYPER_MASK | \
|
||||
CLUTTER_META_MASK) | CLUTTER_RELEASE_MASK)
|
||||
|
||||
typedef struct _ClutterBindingEntry ClutterBindingEntry;
|
||||
|
||||
@@ -123,6 +128,11 @@ struct _ClutterBindingPool
|
||||
GHashTable *entries_hash;
|
||||
};
|
||||
|
||||
struct _ClutterBindingPoolClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
struct _ClutterBindingEntry
|
||||
{
|
||||
gchar *name; /* interned string, do not free */
|
||||
@@ -146,7 +156,7 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_FINAL_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT);
|
||||
|
||||
static guint
|
||||
binding_entry_hash (gconstpointer v)
|
||||
@@ -297,12 +307,15 @@ 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", NULL, NULL,
|
||||
g_param_spec_string ("name",
|
||||
P_("Name"),
|
||||
P_("The unique name of the binding pool"),
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
@@ -327,11 +340,13 @@ clutter_binding_pool_init (ClutterBindingPool *pool)
|
||||
*
|
||||
* Creates a new #ClutterBindingPool that can be used to store
|
||||
* key bindings for an actor. The @name must be a unique identifier
|
||||
* for the binding pool, so that [func@Clutter.BindingPool.find] will
|
||||
* for the binding pool, so that clutter_binding_pool_find() will
|
||||
* be able to return the correct binding 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)
|
||||
@@ -358,22 +373,24 @@ clutter_binding_pool_new (const gchar *name)
|
||||
*
|
||||
* Retrieves the #ClutterBindingPool for the given #GObject class
|
||||
* and, eventually, creates it. This function is a wrapper around
|
||||
* [ctor@Clutter.BindingPool.new] and uses the class type name as the
|
||||
* clutter_binding_pool_new() and uses the class type name as the
|
||||
* unique name for the binding pool.
|
||||
*
|
||||
* Calling this function multiple times will return the same
|
||||
* #ClutterBindingPool.
|
||||
*
|
||||
* A binding pool for a class can also be retrieved using
|
||||
* [func@Clutter.BindingPool.find] with the class type name:
|
||||
* 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)
|
||||
@@ -404,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)
|
||||
@@ -429,7 +448,7 @@ clutter_binding_pool_find (const gchar *name)
|
||||
* @action_name: the name of the action
|
||||
* @key_val: key symbol
|
||||
* @modifiers: bitmask of modifiers
|
||||
* @callback: function to be called
|
||||
* @callback: (type Clutter.BindingActionFunc): function to be called
|
||||
* when the action is activated
|
||||
* @data: data to be passed to @callback
|
||||
* @notify: function to be called when the action is removed
|
||||
@@ -441,11 +460,13 @@ clutter_binding_pool_find (const gchar *name)
|
||||
* The same action name can be used for multiple @key_val, @modifiers
|
||||
* pairs.
|
||||
*
|
||||
* When an action has been activated using [method@Clutter.BindingPool.activate]
|
||||
* When an action has been activated using clutter_binding_pool_activate()
|
||||
* the passed @callback will be invoked (with @data).
|
||||
*
|
||||
* Actions can be blocked with [method@Clutter.BindingPool.block_action]
|
||||
* and then unblocked using [method@Clutter.BindingPool.unblock_action].
|
||||
* 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,
|
||||
@@ -501,7 +522,7 @@ clutter_binding_pool_install_action (ClutterBindingPool *pool,
|
||||
* @modifiers: bitmask of modifiers
|
||||
* @closure: a #GClosure
|
||||
*
|
||||
* A #GClosure variant of [method@Clutter.BindingPool.install_action].
|
||||
* A #GClosure variant of clutter_binding_pool_install_action().
|
||||
*
|
||||
* Installs a new action inside a #ClutterBindingPool. The action
|
||||
* is bound to @key_val and @modifiers.
|
||||
@@ -509,11 +530,13 @@ clutter_binding_pool_install_action (ClutterBindingPool *pool,
|
||||
* The same action name can be used for multiple @key_val, @modifiers
|
||||
* pairs.
|
||||
*
|
||||
* When an action has been activated using [method@Clutter.BindingPool.activate]
|
||||
* When an action has been activated using clutter_binding_pool_activate()
|
||||
* the passed @closure will be invoked.
|
||||
*
|
||||
* Actions can be blocked with [method@Clutter.BindingPool.block_action]
|
||||
* and then unblocked using [method@Clutter.BindingPool.unblock_action].
|
||||
* 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,
|
||||
@@ -568,13 +591,15 @@ clutter_binding_pool_install_closure (ClutterBindingPool *pool,
|
||||
* from the pool
|
||||
*
|
||||
* Allows overriding the action for @key_val and @modifiers inside a
|
||||
* #ClutterBindingPool. See [method@Clutter.BindingPool.install_action].
|
||||
* #ClutterBindingPool. See clutter_binding_pool_install_action().
|
||||
*
|
||||
* When an action has been activated using [method@Clutter.BindingPool.activate]
|
||||
* When an action has been activated using clutter_binding_pool_activate()
|
||||
* the passed @callback will be invoked (with @data).
|
||||
*
|
||||
* Actions can be blocked with [method@Clutter.BindingPool.block_action]
|
||||
* and then unblocked using [method@Clutter.BindingPool.unblock_action].
|
||||
* 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,
|
||||
@@ -627,16 +652,18 @@ clutter_binding_pool_override_action (ClutterBindingPool *pool,
|
||||
* @modifiers: bitmask of modifiers
|
||||
* @closure: a #GClosure
|
||||
*
|
||||
* A #GClosure variant of [method@Clutter.BindingPool.override_action].
|
||||
* A #GClosure variant of clutter_binding_pool_override_action().
|
||||
*
|
||||
* Allows overriding the action for @key_val and @modifiers inside a
|
||||
* #ClutterBindingPool. See [method@Clutter.BindingPool.install_closure].
|
||||
* #ClutterBindingPool. See clutter_binding_pool_install_closure().
|
||||
*
|
||||
* When an action has been activated using [method@Clutter.BindingPool.activate]
|
||||
* When an action has been activated using clutter_binding_pool_activate()
|
||||
* the passed @callback will be invoked (with @data).
|
||||
*
|
||||
* Actions can be blocked with [method@Clutter.BindingPool.block_action]
|
||||
* and then unblocked using [method@Clutter.BindingPool.unblock_action].
|
||||
* 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,
|
||||
@@ -690,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,
|
||||
@@ -716,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,
|
||||
@@ -801,23 +832,25 @@ 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
|
||||
* [method@Clutter.BindingPool.install_action].
|
||||
* clutter_binding_pool_install_action().
|
||||
*
|
||||
* If the action bound to the @key_val, @modifiers pair has been
|
||||
* blocked using [method@Clutter.BindingPool.block_action], the callback
|
||||
* blocked using clutter_binding_pool_block_action(), the callback
|
||||
* 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,
|
||||
@@ -849,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,
|
||||
@@ -876,8 +911,10 @@ clutter_binding_pool_block_action (ClutterBindingPool *pool,
|
||||
* Unblockes all the actions with name @action_name inside @pool.
|
||||
*
|
||||
* Unblocking an action does not cause the callback bound to it to
|
||||
* be invoked in case [method@Clutter.BindingPool.activate] was called on
|
||||
* an action previously blocked with [method@Clutter.BindingPool.block_action].
|
||||
* 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,
|
||||
|
||||
@@ -21,26 +21,58 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BINDING_POOL_H__
|
||||
#define __CLUTTER_BINDING_POOL_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter/clutter-event.h"
|
||||
#include <clutter/clutter-event.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BINDING_POOL (clutter_binding_pool_get_type ())
|
||||
#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;
|
||||
|
||||
/**
|
||||
* ClutterBindingActionFunc:
|
||||
* @gobject: a #GObject
|
||||
* @action_name: the name of the action
|
||||
* @key_val: the key symbol
|
||||
* @modifiers: bitmask of the modifier flags
|
||||
* @user_data: data passed to the function
|
||||
*
|
||||
* The prototype for the callback function registered with
|
||||
* clutter_binding_pool_install_action() and invoked by
|
||||
* clutter_binding_pool_activate().
|
||||
*
|
||||
* 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,
|
||||
guint key_val,
|
||||
ClutterModifierType modifiers,
|
||||
gpointer user_data);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (ClutterBindingPool,
|
||||
clutter_binding_pool,
|
||||
CLUTTER,
|
||||
BINDING_POOL,
|
||||
GObject)
|
||||
GType clutter_binding_pool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterBindingPool * clutter_binding_pool_new (const gchar *name);
|
||||
@@ -99,3 +131,5 @@ void clutter_binding_pool_unblock_action (ClutterBindingPool
|
||||
const gchar *action_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BINDING_POOL_H__ */
|
||||
|
||||
@@ -23,21 +23,29 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter/clutter-blur-effect.h"
|
||||
#define CLUTTER_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
|
||||
#define CLUTTER_IS_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BLUR_EFFECT))
|
||||
#define CLUTTER_BLUR_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-blur-effect.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define BLUR_PADDING 2
|
||||
|
||||
@@ -62,30 +70,36 @@ static const gchar *box_blur_glsl_shader =
|
||||
" cogl_texel /= 9.0;\n";
|
||||
#undef SAMPLE
|
||||
|
||||
typedef struct _ClutterBlurEffectPrivate
|
||||
struct _ClutterBlurEffect
|
||||
{
|
||||
ClutterOffscreenEffect parent_instance;
|
||||
|
||||
/* a back pointer to our actor, so that we can query it */
|
||||
ClutterActor *actor;
|
||||
|
||||
gint pixel_step_uniform;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
} ClutterBlurEffectPrivate;
|
||||
};
|
||||
|
||||
struct _ClutterBlurEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBlurEffect,
|
||||
clutter_blur_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterBlurEffect,
|
||||
clutter_blur_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture)
|
||||
{
|
||||
ClutterBlurEffect *blur_effect = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterBlurEffectPrivate *priv =
|
||||
clutter_blur_effect_get_instance_private (blur_effect);
|
||||
|
||||
if (priv->pixel_step_uniform > -1)
|
||||
if (blur_effect->pixel_step_uniform > -1)
|
||||
{
|
||||
float pixel_step[2];
|
||||
int tex_width, tex_height;
|
||||
@@ -96,16 +110,39 @@ clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
pixel_step[0] = 1.0f / tex_width;
|
||||
pixel_step[1] = 1.0f / tex_height;
|
||||
|
||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
||||
priv->pixel_step_uniform,
|
||||
cogl_pipeline_set_uniform_float (blur_effect->pipeline,
|
||||
blur_effect->pixel_step_uniform,
|
||||
2, /* n_components */
|
||||
1, /* count */
|
||||
pixel_step);
|
||||
}
|
||||
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
|
||||
cogl_pipeline_set_layer_texture (blur_effect->pipeline, 0, texture);
|
||||
|
||||
return g_object_ref (priv->pipeline);
|
||||
return cogl_object_ref (blur_effect->pipeline);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterEffectClass *parent_class;
|
||||
|
||||
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_blur_effect_parent_class);
|
||||
return parent_class->pre_paint (effect, node, paint_context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -134,10 +171,12 @@ static void
|
||||
clutter_blur_effect_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (gobject);
|
||||
ClutterBlurEffectPrivate *priv =
|
||||
clutter_blur_effect_get_instance_private (self);
|
||||
|
||||
g_clear_object (&priv->pipeline);
|
||||
if (self->pipeline != NULL)
|
||||
{
|
||||
cogl_object_unref (self->pipeline);
|
||||
self->pipeline = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_blur_effect_parent_class)->dispose (gobject);
|
||||
}
|
||||
@@ -151,6 +190,7 @@ 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);
|
||||
@@ -161,8 +201,6 @@ static void
|
||||
clutter_blur_effect_init (ClutterBlurEffect *self)
|
||||
{
|
||||
ClutterBlurEffectClass *klass = CLUTTER_BLUR_EFFECT_GET_CLASS (self);
|
||||
ClutterBlurEffectPrivate *priv =
|
||||
clutter_blur_effect_get_instance_private (self);
|
||||
|
||||
if (G_UNLIKELY (klass->base_pipeline == NULL))
|
||||
{
|
||||
@@ -177,24 +215,26 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
|
||||
NULL);
|
||||
cogl_snippet_set_replace (snippet, box_blur_glsl_shader);
|
||||
cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
|
||||
g_object_unref (snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
|
||||
}
|
||||
|
||||
priv->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
|
||||
priv->pixel_step_uniform =
|
||||
cogl_pipeline_get_uniform_location (priv->pipeline, "pixel_step");
|
||||
self->pixel_step_uniform =
|
||||
cogl_pipeline_get_uniform_location (self->pipeline, "pixel_step");
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_blur_effect_new:
|
||||
*
|
||||
* Creates a new #ClutterBlurEffect to be used with
|
||||
* [method@Clutter.Actor.add_effect]
|
||||
* clutter_actor_add_effect()
|
||||
*
|
||||
* Return value: the newly created #ClutterBlurEffect or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterEffect *
|
||||
clutter_blur_effect_new (void)
|
||||
|
||||
@@ -22,33 +22,38 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BLUR_EFFECT_H__
|
||||
#define __CLUTTER_BLUR_EFFECT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-effect.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include <clutter/clutter-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BLUR_EFFECT (clutter_blur_effect_get_type ())
|
||||
#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;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterBlurEffect,
|
||||
clutter_blur_effect,
|
||||
CLUTTER, BLUR_EFFECT,
|
||||
ClutterOffscreenEffect)
|
||||
|
||||
struct _ClutterBlurEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
GType clutter_blur_effect_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterEffect *clutter_blur_effect_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BLUR_EFFECT_H__ */
|
||||
|
||||
@@ -15,18 +15,19 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef CLUTTER_BLUR_PRIVATE_H
|
||||
#define CLUTTER_BLUR_PRIVATE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterBlur ClutterBlur;
|
||||
|
||||
ClutterBlur * clutter_blur_new (CoglTexture *texture,
|
||||
float radius);
|
||||
float sigma);
|
||||
|
||||
void clutter_blur_apply (ClutterBlur *blur);
|
||||
|
||||
@@ -35,3 +36,5 @@ CoglTexture * clutter_blur_get_texture (ClutterBlur *blur);
|
||||
void clutter_blur_free (ClutterBlur *blur);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* CLUTTER_BLUR_PRIVATE_H */
|
||||
|
||||
@@ -15,16 +15,13 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-blur-private.h"
|
||||
|
||||
#include "clutter/clutter-blur-private.h"
|
||||
|
||||
#include "clutter/clutter-backend.h"
|
||||
#include "clutter-backend.h"
|
||||
|
||||
/**
|
||||
* ClutterBlur:
|
||||
*
|
||||
* Blur textures
|
||||
* SECTION:clutter-blur
|
||||
* @short_description: Blur textures
|
||||
*
|
||||
* #ClutterBlur is a moderately fast gaussian blur implementation.
|
||||
*
|
||||
@@ -164,7 +161,7 @@ create_blur_pipeline (void)
|
||||
NULL);
|
||||
cogl_snippet_set_replace (snippet, gaussian_blur_glsl);
|
||||
cogl_pipeline_add_layer_snippet (blur_pipeline, 0, snippet);
|
||||
g_object_unref (snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_context_set_named_pipeline (ctx, &blur_pipeline_key, blur_pipeline);
|
||||
}
|
||||
@@ -233,7 +230,7 @@ create_fbo (ClutterBlur *blur,
|
||||
float height;
|
||||
float width;
|
||||
|
||||
g_clear_object (&pass->texture);
|
||||
g_clear_pointer (&pass->texture, cogl_object_unref);
|
||||
g_clear_object (&pass->framebuffer);
|
||||
|
||||
width = cogl_texture_get_width (blur->source_texture);
|
||||
@@ -241,9 +238,9 @@ create_fbo (ClutterBlur *blur,
|
||||
scaled_width = floorf (width / blur->downscale_factor);
|
||||
scaled_height = floorf (height / blur->downscale_factor);
|
||||
|
||||
pass->texture = cogl_texture_2d_new_with_size (ctx,
|
||||
scaled_width,
|
||||
scaled_height);
|
||||
pass->texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||
scaled_width,
|
||||
scaled_height));
|
||||
if (!pass->texture)
|
||||
return FALSE;
|
||||
|
||||
@@ -313,7 +310,7 @@ apply_blur_pass (BlurPass *pass)
|
||||
{
|
||||
CoglColor transparent;
|
||||
|
||||
cogl_color_init_from_4f (&transparent, 0.0, 0.0, 0.0, 0.0);
|
||||
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
|
||||
|
||||
cogl_framebuffer_clear (pass->framebuffer,
|
||||
COGL_BUFFER_BIT_COLOR,
|
||||
@@ -329,8 +326,8 @@ apply_blur_pass (BlurPass *pass)
|
||||
static void
|
||||
clear_blur_pass (BlurPass *pass)
|
||||
{
|
||||
g_clear_object (&pass->pipeline);
|
||||
g_clear_object (&pass->texture);
|
||||
g_clear_pointer (&pass->pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&pass->texture, cogl_object_unref);
|
||||
g_clear_object (&pass->framebuffer);
|
||||
}
|
||||
|
||||
@@ -345,7 +342,7 @@ clear_blur_pass (BlurPass *pass)
|
||||
*/
|
||||
ClutterBlur *
|
||||
clutter_blur_new (CoglTexture *texture,
|
||||
float radius)
|
||||
float sigma)
|
||||
{
|
||||
ClutterBlur *blur;
|
||||
unsigned int height;
|
||||
@@ -354,19 +351,17 @@ clutter_blur_new (CoglTexture *texture,
|
||||
BlurPass *vpass;
|
||||
|
||||
g_return_val_if_fail (texture != NULL, NULL);
|
||||
g_return_val_if_fail (radius >= 0.0, 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 = radius / 2.0;
|
||||
blur->source_texture = g_object_ref (texture);
|
||||
blur->downscale_factor = calculate_downscale_factor (width,
|
||||
height,
|
||||
blur->sigma);
|
||||
blur->sigma = sigma;
|
||||
blur->source_texture = cogl_object_ref (texture);
|
||||
blur->downscale_factor = calculate_downscale_factor (width, height, sigma);
|
||||
|
||||
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
|
||||
if (G_APPROX_VALUE (sigma, 0.0, FLT_EPSILON))
|
||||
goto out;
|
||||
|
||||
vpass = &blur->pass[VERTICAL];
|
||||
@@ -388,7 +383,7 @@ out:
|
||||
* @blur: a #ClutterBlur
|
||||
*
|
||||
* Applies the blur. The resulting texture can be retrieved by
|
||||
* [method@Clutter.Blur.get_texture].
|
||||
* clutter_blur_get_texture().
|
||||
*/
|
||||
void
|
||||
clutter_blur_apply (ClutterBlur *blur)
|
||||
@@ -405,7 +400,7 @@ clutter_blur_apply (ClutterBlur *blur)
|
||||
* @blur: a #ClutterBlur
|
||||
*
|
||||
* Retrieves the texture where the blurred contents are stored. The
|
||||
* contents are undefined until [method@Clutter.Blur.apply] is called.
|
||||
* contents are undefined until clutter_blur_apply() is called.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglTexture
|
||||
*/
|
||||
@@ -431,6 +426,6 @@ clutter_blur_free (ClutterBlur *blur)
|
||||
|
||||
clear_blur_pass (&blur->pass[VERTICAL]);
|
||||
clear_blur_pass (&blur->pass[HORIZONTAL]);
|
||||
g_clear_object (&blur->source_texture);
|
||||
cogl_clear_object (&blur->source_texture);
|
||||
g_free (blur);
|
||||
}
|
||||
|
||||
@@ -26,42 +26,47 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBoxLayout:
|
||||
* SECTION:clutter-box-layout
|
||||
* @short_description: A layout manager arranging children on a single line
|
||||
*
|
||||
* A layout manager arranging children on a single line
|
||||
*
|
||||
* The #ClutterBoxLayout is a [class@Clutter.LayoutManager] implementing the
|
||||
* The #ClutterBoxLayout is a #ClutterLayoutManager implementing the
|
||||
* following layout policy:
|
||||
*
|
||||
* - all children are arranged on a single line
|
||||
* - the axis used is controlled by the [property@Clutter.BoxLayout:orientation] property
|
||||
* - each child will be allocated to its natural size or, if [property@Clutter.Actor:x-expand] or
|
||||
* [property@Clutter.Actor:y-expand] are set, the available size
|
||||
* - honours the #ClutterActor's [property@Clutter.Actor:x-align] and [property@Clutter.Actor:y-align] properties
|
||||
* - the axis used is controlled by the #ClutterBoxLayout:orientation property
|
||||
* - the order of the packing is determined by the #ClutterBoxLayout:pack-start boolean property
|
||||
* - each child will be allocated to its natural size or, if #ClutterActor:x-expand or
|
||||
* #ClutterActor:y-expand are set, the available size
|
||||
* - honours the #ClutterActor's #ClutterActor:x-align and #ClutterActor:y-align properties
|
||||
* to fill the available size
|
||||
* - if the [property@Clutter.BoxLayout:homogeneous] boolean property is set, then all widgets will
|
||||
* - if the #ClutterBoxLayout:homogeneous boolean property is set, then all widgets will
|
||||
* get the same size, ignoring expand settings and the preferred sizes
|
||||
*
|
||||
* It is possible to control the spacing between children of a
|
||||
* #ClutterBoxLayout by using [method@Clutter.BoxLayout.set_spacing].
|
||||
* #ClutterBoxLayout by using clutter_box_layout_set_spacing().
|
||||
*
|
||||
* #ClutterBoxLayout is available since Clutter 1.2
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-box-layout.h"
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-layout-meta.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter-box-layout.h"
|
||||
|
||||
typedef struct _ClutterBoxLayoutPrivate
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-layout-meta.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-types.h"
|
||||
|
||||
struct _ClutterBoxLayoutPrivate
|
||||
{
|
||||
ClutterActor *container;
|
||||
ClutterContainer *container;
|
||||
|
||||
guint spacing;
|
||||
|
||||
@@ -70,8 +75,9 @@ typedef struct _ClutterBoxLayoutPrivate
|
||||
|
||||
ClutterOrientation orientation;
|
||||
|
||||
guint is_pack_start : 1;
|
||||
guint is_homogeneous : 1;
|
||||
} ClutterBoxLayoutPrivate;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -79,6 +85,7 @@ enum
|
||||
|
||||
PROP_SPACING,
|
||||
PROP_HOMOGENEOUS,
|
||||
PROP_PACK_START,
|
||||
PROP_ORIENTATION,
|
||||
|
||||
PROP_LAST
|
||||
@@ -103,17 +110,15 @@ static float distribute_natural_allocation (float extra_space,
|
||||
unsigned int n_requested_sizes,
|
||||
RequestedSize *sizes);
|
||||
static void count_expand_children (ClutterLayoutManager *layout,
|
||||
ClutterActor *container,
|
||||
gint *visible_children,
|
||||
gint *expand_children);
|
||||
ClutterContainer *container,
|
||||
gint *visible_children,
|
||||
gint *expand_children);
|
||||
|
||||
static void
|
||||
clutter_box_layout_set_container (ClutterLayoutManager *layout,
|
||||
ClutterActor *container)
|
||||
ClutterContainer *container)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
|
||||
ClutterLayoutManagerClass *parent_class;
|
||||
|
||||
priv->container = container;
|
||||
@@ -152,13 +157,12 @@ get_child_size (ClutterActor *actor,
|
||||
/* Handle the request in the orientation of the box (i.e. width request of horizontal box) */
|
||||
static void
|
||||
get_preferred_size_for_orientation (ClutterBoxLayout *self,
|
||||
ClutterActor *container,
|
||||
gfloat for_size,
|
||||
gfloat *min_size_p,
|
||||
gfloat *natural_size_p)
|
||||
ClutterActor *container,
|
||||
gfloat for_size,
|
||||
gfloat *min_size_p,
|
||||
gfloat *natural_size_p)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = self->priv;
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
gint n_children = 0;
|
||||
@@ -218,8 +222,7 @@ get_base_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
gfloat *min_size_p,
|
||||
gfloat *natural_size_p)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = self->priv;
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
gint n_children = 0;
|
||||
@@ -272,8 +275,8 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
gfloat *natural_size_p)
|
||||
{
|
||||
ClutterLayoutManager *layout = CLUTTER_LAYOUT_MANAGER (self);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = self->priv;
|
||||
ClutterContainer *real_container = CLUTTER_CONTAINER (container);
|
||||
ClutterActor *child;
|
||||
ClutterActorIter iter;
|
||||
gint nvis_children = 0, n_extra_widgets = 0;
|
||||
@@ -287,7 +290,8 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
|
||||
minimum = natural = 0;
|
||||
|
||||
count_expand_children (layout, container, &nvis_children, &nexpand_children);
|
||||
count_expand_children (layout, real_container,
|
||||
&nvis_children, &nexpand_children);
|
||||
|
||||
if (nvis_children < 1)
|
||||
{
|
||||
@@ -419,7 +423,7 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
|
||||
static void
|
||||
allocate_box_child (ClutterBoxLayout *self,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
ClutterActorBox *child_box)
|
||||
{
|
||||
@@ -434,14 +438,13 @@ allocate_box_child (ClutterBoxLayout *self,
|
||||
|
||||
static void
|
||||
clutter_box_layout_get_preferred_width (ClutterLayoutManager *layout,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = self->priv;
|
||||
|
||||
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
|
||||
{
|
||||
@@ -459,14 +462,13 @@ clutter_box_layout_get_preferred_width (ClutterLayoutManager *layout,
|
||||
|
||||
static void
|
||||
clutter_box_layout_get_preferred_height (ClutterLayoutManager *layout,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = self->priv;
|
||||
|
||||
if (priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
@@ -484,19 +486,19 @@ clutter_box_layout_get_preferred_height (ClutterLayoutManager *layout,
|
||||
|
||||
static void
|
||||
count_expand_children (ClutterLayoutManager *layout,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
gint *visible_children,
|
||||
gint *expand_children)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterActor *child;
|
||||
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
|
||||
ClutterActor *actor, *child;
|
||||
ClutterActorIter iter;
|
||||
|
||||
actor = CLUTTER_ACTOR (container);
|
||||
|
||||
*visible_children = *expand_children = 0;
|
||||
|
||||
clutter_actor_iter_init (&iter, container);
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
if (clutter_actor_is_visible (child))
|
||||
@@ -595,17 +597,17 @@ distribute_natural_allocation (float extra_space,
|
||||
/* Distribute available space.
|
||||
* This master piece of a loop was conceived by Behdad Esfahbod.
|
||||
*/
|
||||
for (i = n_requested_sizes - 1; extra_space > 0.0 && i >= 0; --i)
|
||||
for (i = n_requested_sizes - 1; extra_space > 0 && i >= 0; --i)
|
||||
{
|
||||
/* Divide remaining space by number of remaining children.
|
||||
* Sort order and reducing remaining space by assigned space
|
||||
* ensures that space is distributed equally.
|
||||
*/
|
||||
float glue = (extra_space + i) / (i + 1.0);
|
||||
float gap =
|
||||
sizes[(spreading[i])].natural_size - sizes[(spreading[i])].minimum_size;
|
||||
int glue = (extra_space + i) / (i + 1);
|
||||
int gap = sizes[(spreading[i])].natural_size
|
||||
- sizes[(spreading[i])].minimum_size;
|
||||
|
||||
float extra = MIN (glue, gap);
|
||||
int extra = MIN (glue, gap);
|
||||
|
||||
sizes[spreading[i]].minimum_size += extra;
|
||||
|
||||
@@ -619,12 +621,10 @@ distribute_natural_allocation (float extra_space,
|
||||
|
||||
static void
|
||||
clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
ClutterActor *container,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
|
||||
ClutterActor *actor, *child;
|
||||
gint nvis_children;
|
||||
gint nexpand_children;
|
||||
@@ -764,13 +764,19 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
{
|
||||
child_allocation.x1 = box->x1;
|
||||
child_allocation.x2 = MAX (1.0, box->x2);
|
||||
y = box->y1;
|
||||
if (priv->is_pack_start)
|
||||
y = box->y2 - box->y1;
|
||||
else
|
||||
y = box->y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.y1 = box->y1;
|
||||
child_allocation.y2 = MAX (1.0, box->y2);
|
||||
x = box->x1;
|
||||
if (priv->is_pack_start)
|
||||
x = box->x2 - box->x1;
|
||||
else
|
||||
x = box->x1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@@ -822,7 +828,17 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size;
|
||||
}
|
||||
|
||||
y += child_size + priv->spacing;
|
||||
if (priv->is_pack_start)
|
||||
{
|
||||
y -= child_size + priv->spacing;
|
||||
|
||||
child_allocation.y1 -= child_size;
|
||||
child_allocation.y2 -= child_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
y += child_size + priv->spacing;
|
||||
}
|
||||
}
|
||||
else /* CLUTTER_ORIENTATION_HORIZONTAL */
|
||||
{
|
||||
@@ -837,7 +853,17 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size;
|
||||
}
|
||||
|
||||
x += child_size + priv->spacing;
|
||||
if (priv->is_pack_start)
|
||||
{
|
||||
x -= child_size + priv->spacing;
|
||||
|
||||
child_allocation.x1 -= child_size;
|
||||
child_allocation.x2 -= child_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += child_size + priv->spacing;
|
||||
}
|
||||
|
||||
if (is_rtl)
|
||||
{
|
||||
@@ -880,6 +906,10 @@ clutter_box_layout_set_property (GObject *gobject,
|
||||
clutter_box_layout_set_spacing (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_PACK_START:
|
||||
clutter_box_layout_set_pack_start (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -892,9 +922,7 @@ clutter_box_layout_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (gobject);
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -910,6 +938,10 @@ clutter_box_layout_get_property (GObject *gobject,
|
||||
g_value_set_uint (value, priv->spacing);
|
||||
break;
|
||||
|
||||
case PROP_PACK_START:
|
||||
g_value_set_boolean (value, priv->is_pack_start);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -934,9 +966,13 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
|
||||
*
|
||||
* The orientation of the #ClutterBoxLayout, either horizontal
|
||||
* or vertical
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
obj_props[PROP_ORIENTATION] =
|
||||
g_param_spec_enum ("orientation", NULL, NULL,
|
||||
g_param_spec_enum ("orientation",
|
||||
P_("Orientation"),
|
||||
P_("The orientation of the layout"),
|
||||
CLUTTER_TYPE_ORIENTATION,
|
||||
CLUTTER_ORIENTATION_HORIZONTAL,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -947,23 +983,45 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
|
||||
*
|
||||
* Whether the #ClutterBoxLayout should arrange its children
|
||||
* homogeneously, i.e. all children get the same size
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_HOMOGENEOUS] =
|
||||
g_param_spec_boolean ("homogeneous", NULL, NULL,
|
||||
g_param_spec_boolean ("homogeneous",
|
||||
P_("Homogeneous"),
|
||||
P_("Whether the layout should be homogeneous, "
|
||||
"i.e. all children get the same size"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterBoxLayout:pack-start:
|
||||
*
|
||||
* Whether the #ClutterBoxLayout should pack items at the start
|
||||
* or append them at the end
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
obj_props[PROP_PACK_START] =
|
||||
g_param_spec_boolean ("pack-start",
|
||||
P_("Pack Start"),
|
||||
P_("Whether to pack items at the start of the box"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterBoxLayout:spacing:
|
||||
*
|
||||
* The spacing between children of the #ClutterBoxLayout, in pixels
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
obj_props[PROP_SPACING] =
|
||||
g_param_spec_uint ("spacing", NULL, NULL,
|
||||
g_param_spec_uint ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Spacing between children"),
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
gobject_class->set_property = clutter_box_layout_set_property;
|
||||
gobject_class->get_property = clutter_box_layout_get_property;
|
||||
@@ -973,15 +1031,15 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
|
||||
static void
|
||||
clutter_box_layout_init (ClutterBoxLayout *self)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv =
|
||||
clutter_box_layout_get_instance_private (self);
|
||||
self->priv = clutter_box_layout_get_instance_private (self);
|
||||
|
||||
priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
|
||||
priv->is_homogeneous = FALSE;
|
||||
priv->spacing = 0;
|
||||
self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
|
||||
self->priv->is_homogeneous = FALSE;
|
||||
self->priv->is_pack_start = FALSE;
|
||||
self->priv->spacing = 0;
|
||||
|
||||
priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
|
||||
priv->easing_duration = 500;
|
||||
self->priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
|
||||
self->priv->easing_duration = 500;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -990,6 +1048,8 @@ clutter_box_layout_init (ClutterBoxLayout *self)
|
||||
* Creates a new #ClutterBoxLayout layout manager
|
||||
*
|
||||
* Return value: the newly created #ClutterBoxLayout
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterLayoutManager *
|
||||
clutter_box_layout_new (void)
|
||||
@@ -1003,6 +1063,8 @@ clutter_box_layout_new (void)
|
||||
* @spacing: the spacing between children of the layout, in pixels
|
||||
*
|
||||
* Sets the spacing between children of @layout
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
|
||||
@@ -1012,7 +1074,8 @@ clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
priv = layout->priv;
|
||||
|
||||
if (priv->spacing != spacing)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
@@ -1031,19 +1094,18 @@ clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
|
||||
* clutter_box_layout_get_spacing:
|
||||
* @layout: a #ClutterBoxLayout
|
||||
*
|
||||
* Retrieves the spacing set using [method@Clutter.BoxLayout.set_spacing]
|
||||
* Retrieves the spacing set using clutter_box_layout_set_spacing()
|
||||
*
|
||||
* Return value: the spacing between children of the #ClutterBoxLayout
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
guint
|
||||
clutter_box_layout_get_spacing (ClutterBoxLayout *layout)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), 0);
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
return priv->spacing;
|
||||
return layout->priv->spacing;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1052,17 +1114,20 @@ clutter_box_layout_get_spacing (ClutterBoxLayout *layout)
|
||||
* @orientation: the orientation of the #ClutterBoxLayout
|
||||
*
|
||||
* Sets the orientation of the #ClutterBoxLayout layout manager.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_box_layout_set_orientation (ClutterBoxLayout *layout,
|
||||
ClutterOrientation orientation)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
ClutterLayoutManager *manager;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
priv = layout->priv;
|
||||
|
||||
if (priv->orientation == orientation)
|
||||
return;
|
||||
|
||||
@@ -1082,17 +1147,16 @@ clutter_box_layout_set_orientation (ClutterBoxLayout *layout,
|
||||
* Retrieves the orientation of the @layout.
|
||||
*
|
||||
* Return value: the orientation of the layout
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterOrientation
|
||||
clutter_box_layout_get_orientation (ClutterBoxLayout *layout)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout),
|
||||
CLUTTER_ORIENTATION_HORIZONTAL);
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
return priv->orientation;
|
||||
return layout->priv->orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1102,16 +1166,19 @@ clutter_box_layout_get_orientation (ClutterBoxLayout *layout)
|
||||
*
|
||||
* Sets whether the size of @layout children should be
|
||||
* homogeneous
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_box_layout_set_homogeneous (ClutterBoxLayout *layout,
|
||||
gboolean homogeneous)
|
||||
gboolean homogeneous)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
priv = layout->priv;
|
||||
|
||||
if (priv->is_homogeneous != homogeneous)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
@@ -1134,15 +1201,67 @@ clutter_box_layout_set_homogeneous (ClutterBoxLayout *layout,
|
||||
*
|
||||
* Return value: %TRUE if the #ClutterBoxLayout is arranging its children
|
||||
* homogeneously, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), FALSE);
|
||||
|
||||
priv = clutter_box_layout_get_instance_private (layout);
|
||||
return priv->is_homogeneous;
|
||||
return layout->priv->is_homogeneous;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_box_layout_set_pack_start:
|
||||
* @layout: a #ClutterBoxLayout
|
||||
* @pack_start: %TRUE if the @layout should pack children at the
|
||||
* beginning of the layout
|
||||
*
|
||||
* Sets whether children of @layout should be laid out by appending
|
||||
* them or by prepending them
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
|
||||
gboolean pack_start)
|
||||
{
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
|
||||
|
||||
priv = layout->priv;
|
||||
|
||||
if (priv->is_pack_start != pack_start)
|
||||
{
|
||||
ClutterLayoutManager *manager;
|
||||
|
||||
priv->is_pack_start = pack_start ? TRUE : FALSE;
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
||||
|
||||
clutter_layout_manager_layout_changed (manager);
|
||||
|
||||
g_object_notify (G_OBJECT (layout), "pack-start");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_box_layout_get_pack_start:
|
||||
* @layout: a #ClutterBoxLayout
|
||||
*
|
||||
* Retrieves the value set using clutter_box_layout_set_pack_start()
|
||||
*
|
||||
* Return value: %TRUE if the #ClutterBoxLayout should pack children
|
||||
* at the beginning of the layout, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
gboolean
|
||||
clutter_box_layout_get_pack_start (ClutterBoxLayout *layout)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), FALSE);
|
||||
|
||||
return layout->priv->is_pack_start;
|
||||
}
|
||||
|
||||
@@ -25,30 +25,61 @@
|
||||
* Thomas Wood <thomas.wood@intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BOX_LAYOUT_H__
|
||||
#define __CLUTTER_BOX_LAYOUT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-layout-manager.h"
|
||||
#include <clutter/clutter-layout-manager.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BOX_LAYOUT (clutter_box_layout_get_type ())
|
||||
#define CLUTTER_BOX_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayout))
|
||||
#define CLUTTER_IS_BOX_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX_LAYOUT))
|
||||
#define CLUTTER_BOX_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayoutClass))
|
||||
#define CLUTTER_IS_BOX_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BOX_LAYOUT))
|
||||
#define CLUTTER_BOX_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayoutClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterBoxLayout,
|
||||
clutter_box_layout,
|
||||
CLUTTER, BOX_LAYOUT,
|
||||
ClutterLayoutManager)
|
||||
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 >*/
|
||||
ClutterLayoutManager parent_instance;
|
||||
|
||||
ClutterBoxLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBoxLayoutClass:
|
||||
*
|
||||
* The #ClutterBoxLayoutClass structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBoxLayoutClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterLayoutManagerClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_box_layout_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterLayoutManager * clutter_box_layout_new (void);
|
||||
|
||||
@@ -68,5 +99,12 @@ 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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
||||
|
||||
@@ -23,26 +23,37 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
|
||||
#define CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT))
|
||||
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "clutter-brightness-contrast-effect.h"
|
||||
|
||||
#include "clutter/clutter-brightness-contrast-effect.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
typedef struct _ClutterBrightnessContrastEffectPrivate
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterBrightnessContrastEffect
|
||||
{
|
||||
ClutterOffscreenEffect parent_instance;
|
||||
|
||||
/* Brightness and contrast changes. */
|
||||
gfloat brightness_red;
|
||||
gfloat brightness_green;
|
||||
@@ -57,8 +68,14 @@ typedef struct _ClutterBrightnessContrastEffectPrivate
|
||||
gint contrast_uniform;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
} ClutterBrightnessContrastEffectPrivate;
|
||||
};
|
||||
|
||||
struct _ClutterBrightnessContrastEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
|
||||
/* Brightness effects in GLSL.
|
||||
*/
|
||||
@@ -92,22 +109,19 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBrightnessContrastEffect,
|
||||
clutter_brightness_contrast_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT)
|
||||
G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
|
||||
clutter_brightness_contrast_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
will_have_no_effect (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (self);
|
||||
|
||||
return (G_APPROX_VALUE (priv->brightness_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (priv->brightness_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (priv->brightness_blue, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (priv->contrast_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (priv->contrast_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (priv->contrast_blue, no_change, FLT_EPSILON));
|
||||
return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
|
||||
}
|
||||
|
||||
static CoglPipeline *
|
||||
@@ -116,12 +130,10 @@ clutter_brightness_contrast_effect_create_pipeline (ClutterOffscreenEffect *effe
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self =
|
||||
CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (self);
|
||||
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
|
||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||
|
||||
return g_object_ref (priv->pipeline);
|
||||
return cogl_object_ref (self->pipeline);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -135,6 +147,19 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
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);
|
||||
|
||||
@@ -145,10 +170,12 @@ static void
|
||||
clutter_brightness_contrast_effect_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (self);
|
||||
|
||||
g_clear_object (&priv->pipeline);
|
||||
if (self->pipeline != NULL)
|
||||
{
|
||||
cogl_object_unref (self->pipeline);
|
||||
self->pipeline = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_brightness_contrast_effect_parent_class)->dispose (gobject);
|
||||
}
|
||||
@@ -196,17 +223,15 @@ clutter_brightness_contrast_effect_get_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *effect = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (effect);
|
||||
ClutterColor color;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BRIGHTNESS:
|
||||
{
|
||||
color.red = (priv->brightness_red + 1.0f) * 127.0f;
|
||||
color.green = (priv->brightness_green + 1.0f) * 127.0f;
|
||||
color.blue = (priv->brightness_blue + 1.0f) * 127.0f;
|
||||
color.red = (effect->brightness_red + 1.0f) * 127.0f;
|
||||
color.green = (effect->brightness_green + 1.0f) * 127.0f;
|
||||
color.blue = (effect->brightness_blue + 1.0f) * 127.0f;
|
||||
color.alpha = 0xff;
|
||||
|
||||
clutter_value_set_color (value, &color);
|
||||
@@ -215,9 +240,9 @@ clutter_brightness_contrast_effect_get_property (GObject *gobject,
|
||||
|
||||
case PROP_CONTRAST:
|
||||
{
|
||||
color.red = (priv->contrast_red + 1.0f) * 127.0f;
|
||||
color.green = (priv->contrast_green + 1.0f) * 127.0f;
|
||||
color.blue = (priv->contrast_blue + 1.0f) * 127.0f;
|
||||
color.red = (effect->contrast_red + 1.0f) * 127.0f;
|
||||
color.green = (effect->contrast_green + 1.0f) * 127.0f;
|
||||
color.blue = (effect->contrast_blue + 1.0f) * 127.0f;
|
||||
color.alpha = 0xff;
|
||||
|
||||
clutter_value_set_color (value, &color);
|
||||
@@ -256,12 +281,15 @@ 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", NULL, NULL,
|
||||
clutter_param_spec_color ("brightness",
|
||||
P_("Brightness"),
|
||||
P_("The brightness change to apply"),
|
||||
&no_brightness_change,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterBrightnessContrastEffect:contrast:
|
||||
@@ -273,12 +301,15 @@ 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", NULL, NULL,
|
||||
clutter_param_spec_color ("contrast",
|
||||
P_("Contrast"),
|
||||
P_("The contrast change to apply"),
|
||||
&no_contrast_change,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
@@ -303,47 +334,44 @@ get_brightness_values (gfloat value,
|
||||
static inline void
|
||||
update_uniforms (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (self);
|
||||
|
||||
if (priv->brightness_multiplier_uniform > -1 &&
|
||||
priv->brightness_offset_uniform > -1)
|
||||
if (self->brightness_multiplier_uniform > -1 &&
|
||||
self->brightness_offset_uniform > -1)
|
||||
{
|
||||
float brightness_multiplier[3];
|
||||
float brightness_offset[3];
|
||||
|
||||
get_brightness_values (priv->brightness_red,
|
||||
get_brightness_values (self->brightness_red,
|
||||
brightness_multiplier + 0,
|
||||
brightness_offset + 0);
|
||||
get_brightness_values (priv->brightness_green,
|
||||
get_brightness_values (self->brightness_green,
|
||||
brightness_multiplier + 1,
|
||||
brightness_offset + 1);
|
||||
get_brightness_values (priv->brightness_blue,
|
||||
get_brightness_values (self->brightness_blue,
|
||||
brightness_multiplier + 2,
|
||||
brightness_offset + 2);
|
||||
|
||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
||||
priv->brightness_multiplier_uniform,
|
||||
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||
self->brightness_multiplier_uniform,
|
||||
3, /* n_components */
|
||||
1, /* count */
|
||||
brightness_multiplier);
|
||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
||||
priv->brightness_offset_uniform,
|
||||
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||
self->brightness_offset_uniform,
|
||||
3, /* n_components */
|
||||
1, /* count */
|
||||
brightness_offset);
|
||||
}
|
||||
|
||||
if (priv->contrast_uniform > -1)
|
||||
if (self->contrast_uniform > -1)
|
||||
{
|
||||
float contrast[3] = {
|
||||
tan ((priv->contrast_red + 1) * G_PI_4),
|
||||
tan ((priv->contrast_green + 1) * G_PI_4),
|
||||
tan ((priv->contrast_blue + 1) * G_PI_4)
|
||||
tan ((self->contrast_red + 1) * G_PI_4),
|
||||
tan ((self->contrast_green + 1) * G_PI_4),
|
||||
tan ((self->contrast_blue + 1) * G_PI_4)
|
||||
};
|
||||
|
||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
||||
priv->contrast_uniform,
|
||||
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||
self->contrast_uniform,
|
||||
3, /* n_components */
|
||||
1, /* count */
|
||||
contrast);
|
||||
@@ -354,16 +382,14 @@ static void
|
||||
clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
ClutterBrightnessContrastEffectClass *klass;
|
||||
ClutterBrightnessContrastEffectPrivate *priv =
|
||||
clutter_brightness_contrast_effect_get_instance_private (self);
|
||||
|
||||
priv->brightness_red = no_change;
|
||||
priv->brightness_green = no_change;
|
||||
priv->brightness_blue = no_change;
|
||||
self->brightness_red = no_change;
|
||||
self->brightness_green = no_change;
|
||||
self->brightness_blue = no_change;
|
||||
|
||||
priv->contrast_red = no_change;
|
||||
priv->contrast_green = no_change;
|
||||
priv->contrast_blue = no_change;
|
||||
self->contrast_red = no_change;
|
||||
self->contrast_green = no_change;
|
||||
self->contrast_blue = no_change;
|
||||
|
||||
klass = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_GET_CLASS (self);
|
||||
|
||||
@@ -379,21 +405,21 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
|
||||
brightness_contrast_decls,
|
||||
brightness_contrast_source);
|
||||
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
|
||||
g_object_unref (snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
|
||||
}
|
||||
|
||||
priv->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
|
||||
priv->brightness_multiplier_uniform =
|
||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
||||
self->brightness_multiplier_uniform =
|
||||
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||
"brightness_multiplier");
|
||||
priv->brightness_offset_uniform =
|
||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
||||
self->brightness_offset_uniform =
|
||||
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||
"brightness_offset");
|
||||
priv->contrast_uniform =
|
||||
cogl_pipeline_get_uniform_location (priv->pipeline, "contrast");
|
||||
self->contrast_uniform =
|
||||
cogl_pipeline_get_uniform_location (self->pipeline, "contrast");
|
||||
|
||||
update_uniforms (self);
|
||||
}
|
||||
@@ -402,11 +428,13 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
|
||||
* clutter_brightness_contrast_effect_new:
|
||||
*
|
||||
* Creates a new #ClutterBrightnessContrastEffect to be used with
|
||||
* [method@Clutter.Actor.add_effect]
|
||||
* clutter_actor_add_effect()
|
||||
*
|
||||
* 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)
|
||||
@@ -424,6 +452,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,
|
||||
@@ -431,19 +461,16 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
|
||||
gfloat green,
|
||||
gfloat blue)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
priv = clutter_brightness_contrast_effect_get_instance_private (effect);
|
||||
if (G_APPROX_VALUE (red, priv->brightness_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, priv->brightness_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, priv->brightness_blue, FLT_EPSILON))
|
||||
if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
priv->brightness_red = red;
|
||||
priv->brightness_green = green;
|
||||
priv->brightness_blue = blue;
|
||||
effect->brightness_red = red;
|
||||
effect->brightness_green = green;
|
||||
effect->brightness_blue = blue;
|
||||
|
||||
update_uniforms (effect);
|
||||
|
||||
@@ -463,6 +490,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,
|
||||
@@ -470,19 +499,16 @@ clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffe
|
||||
gfloat *green,
|
||||
gfloat *blue)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
priv = clutter_brightness_contrast_effect_get_instance_private (effect);
|
||||
if (red != NULL)
|
||||
*red = priv->brightness_red;
|
||||
*red = effect->brightness_red;
|
||||
|
||||
if (green != NULL)
|
||||
*green = priv->brightness_green;
|
||||
*green = effect->brightness_green;
|
||||
|
||||
if (blue != NULL)
|
||||
*blue = priv->brightness_blue;
|
||||
*blue = effect->brightness_blue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,6 +519,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,
|
||||
@@ -514,6 +542,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,
|
||||
@@ -521,19 +551,16 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
|
||||
gfloat green,
|
||||
gfloat blue)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
priv = clutter_brightness_contrast_effect_get_instance_private (effect);
|
||||
if (G_APPROX_VALUE (red, priv->contrast_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, priv->contrast_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, priv->contrast_blue, FLT_EPSILON))
|
||||
if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
priv->contrast_red = red;
|
||||
priv->contrast_green = green;
|
||||
priv->contrast_blue = blue;
|
||||
effect->contrast_red = red;
|
||||
effect->contrast_green = green;
|
||||
effect->contrast_blue = blue;
|
||||
|
||||
update_uniforms (effect);
|
||||
|
||||
@@ -553,6 +580,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,
|
||||
@@ -560,19 +589,16 @@ clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect
|
||||
gfloat *green,
|
||||
gfloat *blue)
|
||||
{
|
||||
ClutterBrightnessContrastEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
priv = clutter_brightness_contrast_effect_get_instance_private (effect);
|
||||
if (red != NULL)
|
||||
*red = priv->contrast_red;
|
||||
*red = effect->contrast_red;
|
||||
|
||||
if (green != NULL)
|
||||
*green = priv->contrast_green;
|
||||
*green = effect->contrast_green;
|
||||
|
||||
if (blue != NULL)
|
||||
*blue = priv->contrast_blue;
|
||||
*blue = effect->contrast_blue;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,6 +609,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,
|
||||
|
||||
@@ -22,33 +22,35 @@
|
||||
* Joseph Scheuhammer <clown@alum.mit.edu>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__
|
||||
#define __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-effect.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include <clutter/clutter-color.h>
|
||||
#include <clutter/clutter-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT (clutter_brightness_contrast_effect_get_type ())
|
||||
#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))
|
||||
|
||||
|
||||
struct _ClutterBrightnessContrastEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
/**
|
||||
* ClutterBrightnessContrastEffect:
|
||||
*
|
||||
* #ClutterBrightnessContrastEffect is an opaque structure
|
||||
* whose members cannot be directly accessed
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterBrightnessContrastEffect ClutterBrightnessContrastEffect;
|
||||
typedef struct _ClutterBrightnessContrastEffectClass ClutterBrightnessContrastEffectClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterBrightnessContrastEffect,
|
||||
clutter_brightness_contrast_effect,
|
||||
CLUTTER, BRIGHTNESS_CONTRAST_EFFECT,
|
||||
ClutterOffscreenEffect)
|
||||
GType clutter_brightness_contrast_effect_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterEffect * clutter_brightness_contrast_effect_new (void);
|
||||
@@ -82,3 +84,5 @@ void clutter_brightness_contrast_effect_get_contrast
|
||||
float *blue);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__ */
|
||||
|
||||
8
clutter/clutter/clutter-build-config.h.meson
Normal file
8
clutter/clutter/clutter-build-config.h.meson
Normal file
@@ -0,0 +1,8 @@
|
||||
/* Mutter version */
|
||||
#mesondefine MUTTER_VERSION
|
||||
|
||||
/* List of Cogl drivers */
|
||||
#mesondefine CLUTTER_DRIVERS
|
||||
|
||||
/* Supports PangoFt2 */
|
||||
#mesondefine HAVE_PANGO_FT2
|
||||
90
clutter/clutter/clutter-cairo.c
Normal file
90
clutter/clutter/clutter-cairo.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2012 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-cairo
|
||||
* @Title: Cairo integration
|
||||
* @Short_Description: Functions for interoperating with Cairo
|
||||
*
|
||||
* Clutter provides some utility functions for using Cairo.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-cairo.h"
|
||||
#include "clutter-color.h"
|
||||
|
||||
/**
|
||||
* clutter_cairo_set_source_color:
|
||||
* @cr: a Cairo context
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Utility function for setting the source color of @cr using
|
||||
* a #ClutterColor. This function is the equivalent of:
|
||||
*
|
||||
* |[
|
||||
* 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,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
if (color->alpha == 0xff)
|
||||
cairo_set_source_rgb (cr,
|
||||
color->red / 255.0,
|
||||
color->green / 255.0,
|
||||
color->blue / 255.0);
|
||||
else
|
||||
cairo_set_source_rgba (cr,
|
||||
color->red / 255.0,
|
||||
color->green / 255.0,
|
||||
color->blue / 255.0,
|
||||
color->alpha / 255.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_cairo_clear:
|
||||
* @cr: a Cairo context
|
||||
*
|
||||
* Utility function to clear a Cairo context.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_cairo_clear (cairo_t *cr)
|
||||
{
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
61
clutter/clutter/clutter-cairo.h
Normal file
61
clutter/clutter/clutter-cairo.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2012 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CAIRO_H__
|
||||
#define __CLUTTER_CAIRO_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
|
||||
|
||||
/**
|
||||
* CLUTTER_CAIRO_FORMAT_ARGB32:
|
||||
*
|
||||
* 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
|
||||
* formats specify the actual byte order. Therefore we need to use a
|
||||
* different format depending on the architecture
|
||||
*/
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_BGRA_8888_PRE)
|
||||
#else
|
||||
#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_ARGB_8888_PRE)
|
||||
#endif
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_cairo_clear (cairo_t *cr);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_cairo_set_source_color (cairo_t *cr,
|
||||
const ClutterColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CAIRO_H__ */
|
||||
644
clutter/clutter/clutter-canvas.c
Normal file
644
clutter/clutter/clutter-canvas.c
Normal file
@@ -0,0 +1,644 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2012 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:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* In order to draw on a #ClutterCanvas, you should connect a handler to the
|
||||
* #ClutterCanvas::draw signal; the signal will receive a #cairo_t context
|
||||
* that can be used to draw. #ClutterCanvas will emit the #ClutterCanvas::draw
|
||||
* 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.
|
||||
*
|
||||
* #ClutterCanvas is available since Clutter 1.10.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cogl/cogl.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "clutter-canvas.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-cairo.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-content-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-paint-node.h"
|
||||
#include "clutter-paint-nodes.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-settings.h"
|
||||
|
||||
struct _ClutterCanvasPrivate
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
float scale_factor;
|
||||
|
||||
CoglTexture *texture;
|
||||
gboolean dirty;
|
||||
|
||||
CoglBitmap *buffer;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_SCALE_FACTOR,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[LAST_PROP] = { NULL, };
|
||||
|
||||
enum
|
||||
{
|
||||
DRAW,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint canvas_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterCanvas)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
|
||||
clutter_content_iface_init))
|
||||
|
||||
static void
|
||||
clutter_cairo_context_draw_marshaller (GClosure *closure,
|
||||
GValue *return_value,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer invocation_hint,
|
||||
gpointer marshal_data)
|
||||
{
|
||||
cairo_t *cr = g_value_get_boxed (¶m_values[1]);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
_clutter_marshal_BOOLEAN__BOXED_INT_INT (closure,
|
||||
return_value,
|
||||
n_param_values,
|
||||
param_values,
|
||||
invocation_hint,
|
||||
marshal_data);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
|
||||
|
||||
if (priv->buffer != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_canvas_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WIDTH:
|
||||
{
|
||||
gint new_size = g_value_get_int (value);
|
||||
|
||||
if (priv->width != new_size)
|
||||
{
|
||||
priv->width = new_size;
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (gobject));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
{
|
||||
gint new_size = g_value_get_int (value);
|
||||
|
||||
if (priv->height != new_size)
|
||||
{
|
||||
priv->height = new_size;
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (gobject));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SCALE_FACTOR:
|
||||
{
|
||||
gfloat new_scale_factor = g_value_get_float (value);
|
||||
|
||||
if (priv->scale_factor != new_scale_factor)
|
||||
{
|
||||
priv->scale_factor = new_scale_factor;
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (gobject));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WIDTH:
|
||||
g_value_set_int (value, priv->width);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_int (value, priv->height);
|
||||
break;
|
||||
|
||||
case PROP_SCALE_FACTOR:
|
||||
g_value_set_float (value, priv->scale_factor);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_class_init (ClutterCanvasClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
/**
|
||||
* ClutterCanvas:width:
|
||||
*
|
||||
* The width of the canvas.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
obj_props[PROP_WIDTH] =
|
||||
g_param_spec_int ("width",
|
||||
P_("Width"),
|
||||
P_("The width of the canvas"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* ClutterCanvas:height:
|
||||
*
|
||||
* The height of the canvas.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
obj_props[PROP_HEIGHT] =
|
||||
g_param_spec_int ("height",
|
||||
P_("Height"),
|
||||
P_("The height of the canvas"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* ClutterCanvas:scale-factor:
|
||||
*
|
||||
* The height of the canvas.
|
||||
*/
|
||||
obj_props[PROP_SCALE_FACTOR] =
|
||||
g_param_spec_float ("scale-factor",
|
||||
P_("Scale Factor"),
|
||||
P_("The Scale factor of the canvas"),
|
||||
0.01f, G_MAXFLOAT,
|
||||
1.0f,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* ClutterCanvas::draw:
|
||||
* @canvas: the #ClutterCanvas that emitted the signal
|
||||
* @cr: the Cairo context used to draw
|
||||
* @width: the width of the @canvas
|
||||
* @height: the height of the @canvas
|
||||
*
|
||||
* The #ClutterCanvas::draw signal is emitted each time a canvas is
|
||||
* invalidated.
|
||||
*
|
||||
* It is safe to connect multiple handlers to this signal: each
|
||||
* handler invocation will be automatically protected by cairo_save()
|
||||
* and cairo_restore() pairs.
|
||||
*
|
||||
* Return value: %TRUE if the signal emission should stop, and
|
||||
* %FALSE otherwise
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
canvas_signals[DRAW] =
|
||||
g_signal_new (I_("draw"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
|
||||
G_STRUCT_OFFSET (ClutterCanvasClass, draw),
|
||||
_clutter_boolean_handled_accumulator, NULL,
|
||||
clutter_cairo_context_draw_marshaller,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
CAIRO_GOBJECT_TYPE_CONTEXT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
|
||||
gobject_class->set_property = clutter_canvas_set_property;
|
||||
gobject_class->get_property = clutter_canvas_get_property;
|
||||
gobject_class->finalize = clutter_canvas_finalize;
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, obj_props);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_init (ClutterCanvas *self)
|
||||
{
|
||||
self->priv = clutter_canvas_get_instance_private (self);
|
||||
|
||||
self->priv->width = -1;
|
||||
self->priv->height = -1;
|
||||
self->priv->scale_factor = 1.0f;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterCanvas *self = CLUTTER_CANVAS (content);
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
ClutterPaintNode *node;
|
||||
|
||||
if (priv->buffer == NULL)
|
||||
return;
|
||||
|
||||
if (priv->dirty)
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
|
||||
if (priv->texture == NULL)
|
||||
priv->texture = cogl_texture_new_from_bitmap (priv->buffer,
|
||||
COGL_TEXTURE_NO_SLICING,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32);
|
||||
|
||||
if (priv->texture == NULL)
|
||||
return;
|
||||
|
||||
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
||||
clutter_paint_node_set_static_name (node, "Canvas Content");
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
|
||||
priv->dirty = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_emit_draw (ClutterCanvas *self)
|
||||
{
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
int real_width, real_height;
|
||||
cairo_surface_t *surface;
|
||||
gboolean mapped_buffer;
|
||||
unsigned char *data;
|
||||
CoglBuffer *buffer;
|
||||
gboolean res;
|
||||
cairo_t *cr;
|
||||
|
||||
g_assert (priv->height > 0 && priv->width > 0);
|
||||
|
||||
priv->dirty = TRUE;
|
||||
|
||||
real_width = ceilf (priv->width * priv->scale_factor);
|
||||
real_height = ceilf (priv->height * priv->scale_factor);
|
||||
|
||||
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
|
||||
priv->width, priv->height);
|
||||
|
||||
if (priv->buffer == NULL)
|
||||
{
|
||||
CoglContext *ctx;
|
||||
|
||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
priv->buffer = cogl_bitmap_new_with_size (ctx,
|
||||
real_width,
|
||||
real_height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32);
|
||||
}
|
||||
|
||||
buffer = COGL_BUFFER (cogl_bitmap_get_buffer (priv->buffer));
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_DYNAMIC);
|
||||
|
||||
data = cogl_buffer_map (buffer,
|
||||
COGL_BUFFER_ACCESS_READ_WRITE,
|
||||
COGL_BUFFER_MAP_HINT_DISCARD);
|
||||
|
||||
if (data != NULL)
|
||||
{
|
||||
int bitmap_stride = cogl_bitmap_get_rowstride (priv->buffer);
|
||||
|
||||
surface = cairo_image_surface_create_for_data (data,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
real_width,
|
||||
real_height,
|
||||
bitmap_stride);
|
||||
mapped_buffer = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
real_width,
|
||||
real_height);
|
||||
|
||||
mapped_buffer = FALSE;
|
||||
}
|
||||
|
||||
cairo_surface_set_device_scale (surface,
|
||||
priv->scale_factor,
|
||||
priv->scale_factor);
|
||||
|
||||
self->priv->cr = cr = cairo_create (surface);
|
||||
|
||||
g_signal_emit (self, canvas_signals[DRAW], 0,
|
||||
cr, priv->width, priv->height,
|
||||
&res);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (_clutter_diagnostic_enabled () && cairo_status (cr))
|
||||
{
|
||||
g_warning ("Drawing failed for <ClutterCanvas>[%p]: %s",
|
||||
self,
|
||||
cairo_status_to_string (cairo_status (cr)));
|
||||
}
|
||||
#endif
|
||||
|
||||
self->priv->cr = NULL;
|
||||
cairo_destroy (cr);
|
||||
|
||||
if (mapped_buffer)
|
||||
cogl_buffer_unmap (buffer);
|
||||
else
|
||||
{
|
||||
int size = cairo_image_surface_get_stride (surface) * priv->height;
|
||||
cogl_buffer_set_data (buffer,
|
||||
0,
|
||||
cairo_image_surface_get_data (surface),
|
||||
size);
|
||||
}
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_invalidate (ClutterContent *content)
|
||||
{
|
||||
ClutterCanvas *self = CLUTTER_CANVAS (content);
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
|
||||
if (priv->buffer != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
}
|
||||
|
||||
if (priv->width <= 0 || priv->height <= 0)
|
||||
return;
|
||||
|
||||
clutter_canvas_emit_draw (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_canvas_get_preferred_size (ClutterContent *content,
|
||||
gfloat *width,
|
||||
gfloat *height)
|
||||
{
|
||||
ClutterCanvasPrivate *priv = CLUTTER_CANVAS (content)->priv;
|
||||
|
||||
if (priv->width < 0 || priv->height < 0)
|
||||
return FALSE;
|
||||
|
||||
if (width != NULL)
|
||||
*width = ceilf (priv->width * priv->scale_factor);
|
||||
|
||||
if (height != NULL)
|
||||
*height = ceilf (priv->height * priv->scale_factor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
{
|
||||
iface->invalidate = clutter_canvas_invalidate;
|
||||
iface->paint_content = clutter_canvas_paint_content;
|
||||
iface->get_preferred_size = clutter_canvas_get_preferred_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_canvas_new:
|
||||
*
|
||||
* Creates a new instance of #ClutterCanvas.
|
||||
*
|
||||
* You should call clutter_canvas_set_size() to set the size of the canvas.
|
||||
*
|
||||
* You should call clutter_content_invalidate() every time you wish to
|
||||
* draw the contents of the canvas.
|
||||
*
|
||||
* Return value: (transfer full): The newly allocated instance of
|
||||
* #ClutterCanvas. Use g_object_unref() when done.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterContent *
|
||||
clutter_canvas_new (void)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_CANVAS, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_canvas_invalidate_internal (ClutterCanvas *canvas,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
gboolean width_changed = FALSE, height_changed = FALSE;
|
||||
gboolean res = FALSE;
|
||||
GObject *obj;
|
||||
|
||||
obj = G_OBJECT (canvas);
|
||||
|
||||
g_object_freeze_notify (obj);
|
||||
|
||||
if (canvas->priv->width != width)
|
||||
{
|
||||
canvas->priv->width = width;
|
||||
width_changed = TRUE;
|
||||
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
|
||||
}
|
||||
|
||||
if (canvas->priv->height != height)
|
||||
{
|
||||
canvas->priv->height = height;
|
||||
height_changed = TRUE;
|
||||
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
|
||||
}
|
||||
|
||||
if (width_changed || height_changed)
|
||||
{
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (canvas));
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
g_object_thaw_notify (obj);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_canvas_set_size:
|
||||
* @canvas: a #ClutterCanvas
|
||||
* @width: the width of the canvas, in pixels
|
||||
* @height: the height of the canvas, in pixels
|
||||
*
|
||||
* Sets the size of the @canvas, and invalidates the content.
|
||||
*
|
||||
* This function will cause the @canvas to be invalidated only
|
||||
* if the size of the canvas surface has changed.
|
||||
*
|
||||
* If you want to invalidate the contents of the @canvas when setting
|
||||
* the size, you can use the return value of the function to conditionally
|
||||
* call clutter_content_invalidate():
|
||||
*
|
||||
* |[
|
||||
* 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,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), FALSE);
|
||||
g_return_val_if_fail (width >= -1 && height >= -1, FALSE);
|
||||
|
||||
return clutter_canvas_invalidate_internal (canvas, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_canvas_set_scale_factor:
|
||||
* @canvas: a #ClutterCanvas
|
||||
* @scale: the integer scaling factor of the canvas
|
||||
*
|
||||
* Sets the scaling factor of the @canvas, and invalidates the content.
|
||||
*
|
||||
* This function will cause the @canvas to be invalidated only
|
||||
* if the scale factor of the canvas surface has changed.
|
||||
*/
|
||||
void
|
||||
clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
|
||||
float scale)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
|
||||
g_return_if_fail (scale > 0.0f);
|
||||
|
||||
if (canvas->priv->scale_factor != scale)
|
||||
{
|
||||
canvas->priv->scale_factor = scale;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (canvas));
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (canvas));
|
||||
g_object_thaw_notify (G_OBJECT (canvas));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (canvas), obj_props[PROP_SCALE_FACTOR]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_canvas_get_scale_factor:
|
||||
* @canvas: a #ClutterCanvas
|
||||
*
|
||||
* Gets the scale factor of the @canvas.
|
||||
*
|
||||
* Return value: the current @canvas scale factor or -1 if invalid
|
||||
*/
|
||||
float
|
||||
clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1.0f);
|
||||
|
||||
return canvas->priv->scale_factor;
|
||||
}
|
||||
106
clutter/clutter/clutter-canvas.h
Normal file
106
clutter/clutter/clutter-canvas.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2012 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:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CANVAS_H__
|
||||
#define __CLUTTER_CANVAS_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_CANVAS (clutter_canvas_get_type ())
|
||||
#define CLUTTER_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CANVAS, ClutterCanvas))
|
||||
#define CLUTTER_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CANVAS))
|
||||
#define CLUTTER_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CANVAS, ClutterCanvasClass))
|
||||
#define CLUTTER_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CANVAS))
|
||||
#define CLUTTER_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CANVAS, ClutterCanvasClass))
|
||||
|
||||
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 >*/
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterCanvasPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterCanvasClass:
|
||||
* @draw: class handler for the #ClutterCanvas::draw signal
|
||||
*
|
||||
* The #ClutterCanvasClass structure contains
|
||||
* private data.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterCanvasClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* draw) (ClutterCanvas *canvas,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _padding[16];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_canvas_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterContent * clutter_canvas_new (void);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_canvas_set_size (ClutterCanvas *canvas,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
|
||||
float scale);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_canvas_get_scale_factor (ClutterCanvas *canvas);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CANVAS_H__ */
|
||||
191
clutter/clutter/clutter-child-meta.c
Normal file
191
clutter/clutter/clutter-child-meta.c
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
* Tomas Frydrych <tf@openedhand.com>
|
||||
* Øyvind Kolås <ok@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-child-meta
|
||||
* @short_description: Wrapper for actors inside a container
|
||||
*
|
||||
* #ClutterChildMeta is a wrapper object created by #ClutterContainer
|
||||
* implementations in order to store child-specific data and properties.
|
||||
*
|
||||
* A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer.
|
||||
*
|
||||
* #ClutterChildMeta is available since Clutter 0.8
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-child-meta.h"
|
||||
#include "clutter-container.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_CONTAINER,
|
||||
PROP_ACTOR,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
static void
|
||||
clutter_child_meta_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTAINER:
|
||||
child_meta->container = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_ACTOR:
|
||||
child_meta->actor = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_child_meta_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTAINER:
|
||||
g_value_set_object (value, child_meta->container);
|
||||
break;
|
||||
|
||||
case PROP_ACTOR:
|
||||
g_value_set_object (value, child_meta->actor);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_child_meta_class_init (ClutterChildMetaClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_child_meta_set_property;
|
||||
gobject_class->get_property = clutter_child_meta_get_property;
|
||||
|
||||
/**
|
||||
* ClutterChildMeta:container:
|
||||
*
|
||||
* The #ClutterContainer that created this #ClutterChildMeta.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
obj_props[PROP_CONTAINER] =
|
||||
g_param_spec_object ("container",
|
||||
P_("Container"),
|
||||
P_("The container that created this data"),
|
||||
CLUTTER_TYPE_CONTAINER,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterChildMeta:actor:
|
||||
*
|
||||
* The #ClutterActor being wrapped by this #ClutterChildMeta
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
obj_props[PROP_ACTOR] =
|
||||
g_param_spec_object ("actor",
|
||||
P_("Actor"),
|
||||
P_("The actor wrapped by this data"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAST,
|
||||
obj_props);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_child_meta_init (ClutterChildMeta *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_child_meta_get_container:
|
||||
* @data: a #ClutterChildMeta
|
||||
*
|
||||
* Retrieves the container using @data
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterContainer
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterContainer *
|
||||
clutter_child_meta_get_container (ClutterChildMeta *data)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
||||
|
||||
return data->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_child_meta_get_actor:
|
||||
* @data: a #ClutterChildMeta
|
||||
*
|
||||
* Retrieves the actor wrapped by @data
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterActor
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_child_meta_get_actor (ClutterChildMeta *data)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
|
||||
|
||||
return data->actor;
|
||||
}
|
||||
122
clutter/clutter/clutter-child-meta.h
Normal file
122
clutter/clutter/clutter-child-meta.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
* Tomas Frydrych <tf@openedhand.com>
|
||||
* Øyvind Kolås <ok@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* 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_CHILD_META_H__
|
||||
#define __CLUTTER_CHILD_META_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CHILD_META (clutter_child_meta_get_type ())
|
||||
#define CLUTTER_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMeta))
|
||||
#define CLUTTER_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
|
||||
#define CLUTTER_IS_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CHILD_META))
|
||||
#define CLUTTER_IS_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CHILD_META))
|
||||
#define CLUTTER_CHILD_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
|
||||
|
||||
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 >*/
|
||||
GObject parent_instance;
|
||||
|
||||
/*< public >*/
|
||||
ClutterContainer *container;
|
||||
ClutterActor *actor;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterChildMetaClass:
|
||||
*
|
||||
* The #ClutterChildMetaClass contains only private data
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
struct _ClutterChildMetaClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_child_meta_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterContainer * clutter_child_meta_get_container (ClutterChildMeta *data);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_child_meta_get_actor (ClutterChildMeta *data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CHILD_META_H__ */
|
||||
@@ -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,42 +64,49 @@
|
||||
* 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
|
||||
* /* return TRUE if the actor should support long press
|
||||
* * gestures, and FALSE otherwise; this state will be
|
||||
* * emitted on button presses
|
||||
* */
|
||||
* 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
|
||||
* /* this state is emitted if the minimum duration has
|
||||
* * been reached without the gesture being cancelled.
|
||||
* * the return value is not used
|
||||
* */
|
||||
* 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
|
||||
* /* 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
|
||||
* */
|
||||
* return FALSE;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* #ClutterClickAction is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-click-action.h"
|
||||
#include "clutter-click-action.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterClickActionPrivate
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong event_id;
|
||||
gulong capture_id;
|
||||
guint long_press_id;
|
||||
|
||||
gint long_press_threshold;
|
||||
@@ -143,6 +150,11 @@ 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)
|
||||
@@ -193,6 +205,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);
|
||||
|
||||
@@ -260,7 +274,7 @@ click_action_cancel_long_press (ClutterClickAction *action)
|
||||
|
||||
static inline gboolean
|
||||
event_within_drag_threshold (ClutterClickAction *click_action,
|
||||
const ClutterEvent *event)
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (click_action);
|
||||
@@ -276,44 +290,29 @@ event_within_drag_threshold (ClutterClickAction *click_action,
|
||||
}
|
||||
|
||||
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));
|
||||
clutter_click_action_get_instance_private (action);
|
||||
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_STAGE (clutter_actor_get_stage (actor)),
|
||||
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;
|
||||
@@ -336,47 +335,71 @@ 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);
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
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);
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
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 =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
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) ||
|
||||
(has_button && clutter_event_get_click_count (event) != 1) ||
|
||||
clutter_event_get_device (event) != priv->press_device ||
|
||||
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_STAGE (clutter_actor_get_stage (actor)),
|
||||
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,10 +418,10 @@ clutter_click_action_handle_event (ClutterAction *action,
|
||||
if (modifier_state != priv->modifier_state)
|
||||
priv->modifier_state = 0;
|
||||
|
||||
click_action_set_pressed (click_action, FALSE);
|
||||
click_action_set_pressed (action, FALSE);
|
||||
|
||||
if (event_within_drag_threshold (click_action, event))
|
||||
g_signal_emit (click_action, click_signals[CLICKED], 0, actor);
|
||||
if (event_within_drag_threshold (action, event))
|
||||
g_signal_emit (action, click_signals[CLICKED], 0, actor);
|
||||
break;
|
||||
|
||||
case CLUTTER_MOTION:
|
||||
@@ -411,8 +434,8 @@ clutter_click_action_handle_event (ClutterAction *action,
|
||||
if (!priv->is_held)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
if (!event_within_drag_threshold (click_action, event))
|
||||
clutter_click_action_release (click_action);
|
||||
if (!event_within_drag_threshold (action, event))
|
||||
clutter_click_action_release (action);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -420,20 +443,7 @@ clutter_click_action_handle_event (ClutterAction *action,
|
||||
break;
|
||||
}
|
||||
|
||||
return priv->is_held ? CLUTTER_EVENT_STOP : CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_click_action_sequence_cancelled (ClutterAction *action,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
{
|
||||
ClutterClickAction *self = CLUTTER_CLICK_ACTION (action);
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (self);
|
||||
|
||||
if (priv->press_device == device && priv->press_sequence == sequence)
|
||||
clutter_click_action_release (self);
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -444,11 +454,35 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -530,20 +564,22 @@ clutter_click_action_dispose (GObject *gobject)
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||
|
||||
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;
|
||||
action_class->sequence_cancelled = clutter_click_action_sequence_cancelled;
|
||||
|
||||
meta_class->set_actor = clutter_click_action_set_actor;
|
||||
meta_class->set_enabled = clutter_click_action_set_enabled;
|
||||
@@ -556,23 +592,29 @@ 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", NULL, NULL,
|
||||
g_param_spec_boolean ("pressed",
|
||||
P_("Pressed"),
|
||||
P_("Whether the clickable should be in pressed state"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* ClutterClickAction:held:
|
||||
*
|
||||
* Whether the clickable actor has the pointer grabbed
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_HELD] =
|
||||
g_param_spec_boolean ("held", NULL, NULL,
|
||||
g_param_spec_boolean ("held",
|
||||
P_("Held"),
|
||||
P_("Whether the clickable has a grab"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* ClutterClickAction:long-press-duration:
|
||||
@@ -581,14 +623,17 @@ 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", NULL, NULL,
|
||||
g_param_spec_int ("long-press-duration",
|
||||
P_("Long Press Duration"),
|
||||
P_("The minimum duration of a long press to recognize the gesture"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterClickAction:long-press-threshold:
|
||||
@@ -597,14 +642,17 @@ 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", NULL, NULL,
|
||||
g_param_spec_int ("long-press-threshold",
|
||||
P_("Long Press Threshold"),
|
||||
P_("The maximum threshold before a long press is cancelled"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAST,
|
||||
@@ -615,9 +663,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"),
|
||||
@@ -634,7 +684,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.
|
||||
@@ -648,10 +698,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"),
|
||||
@@ -681,6 +733,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)
|
||||
@@ -693,13 +747,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)
|
||||
@@ -713,6 +769,9 @@ clutter_click_action_release (ClutterClickAction *action)
|
||||
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);
|
||||
@@ -725,6 +784,8 @@ 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)
|
||||
@@ -745,6 +806,8 @@ 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)
|
||||
@@ -765,6 +828,8 @@ 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,
|
||||
|
||||
@@ -25,14 +25,15 @@
|
||||
* Colin Walters <walters@verbum.org>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CLICK_ACTION_H__
|
||||
#define __CLUTTER_CLICK_ACTION_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-action.h"
|
||||
#include "clutter/clutter-event.h"
|
||||
#include <clutter/clutter-action.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -51,6 +52,8 @@ typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
||||
*
|
||||
* The #ClutterClickActionClass structure
|
||||
* contains only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterClickActionClass
|
||||
{
|
||||
@@ -64,6 +67,15 @@ struct _ClutterClickActionClass
|
||||
gboolean (* long_press) (ClutterClickAction *action,
|
||||
ClutterActor *actor,
|
||||
ClutterLongPressState state);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_click_action1) (void);
|
||||
void (* _clutter_click_action2) (void);
|
||||
void (* _clutter_click_action3) (void);
|
||||
void (* _clutter_click_action4) (void);
|
||||
void (* _clutter_click_action5) (void);
|
||||
void (* _clutter_click_action6) (void);
|
||||
void (* _clutter_click_action7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -82,3 +94,5 @@ CLUTTER_EXPORT
|
||||
void clutter_click_action_release (ClutterClickAction *action);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CLICK_ACTION_H__ */
|
||||
|
||||
@@ -22,37 +22,39 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 [class@Clutter.Actor] which draws with the paint
|
||||
* #ClutterClone is a #ClutterActor which draws with the paint
|
||||
* function of another actor, scaled to fit its own allocation.
|
||||
*
|
||||
* #ClutterClone can be used to efficiently clone any other actor.
|
||||
*
|
||||
* #ClutterClone does not require the presence of support for FBOs
|
||||
* in the underlying GL or GLES implementation.
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-clone.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-paint-volume-private.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-clone.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
typedef struct _ClutterClonePrivate
|
||||
struct _ClutterClonePrivate
|
||||
{
|
||||
ClutterActor *clone_source;
|
||||
float x_scale, y_scale;
|
||||
|
||||
gulong source_destroy_id;
|
||||
} ClutterClonePrivate;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
@@ -75,8 +77,7 @@ clutter_clone_get_preferred_width (ClutterActor *self,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (self));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActor *clone_source = priv->clone_source;
|
||||
|
||||
if (clone_source == NULL)
|
||||
@@ -100,8 +101,7 @@ clutter_clone_get_preferred_height (ClutterActor *self,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (self));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActor *clone_source = priv->clone_source;
|
||||
|
||||
if (clone_source == NULL)
|
||||
@@ -123,8 +123,8 @@ static void
|
||||
clutter_clone_apply_transform (ClutterActor *self,
|
||||
graphene_matrix_t *matrix)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (self));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
|
||||
|
||||
if (priv->clone_source)
|
||||
graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
|
||||
@@ -138,7 +138,7 @@ clutter_clone_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterClone *self = CLUTTER_CLONE (actor);
|
||||
ClutterClonePrivate *priv = clutter_clone_get_instance_private (self);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
gboolean was_unmapped = FALSE;
|
||||
|
||||
if (priv->clone_source == NULL)
|
||||
@@ -157,7 +157,7 @@ clutter_clone_paint (ClutterActor *actor,
|
||||
*/
|
||||
_clutter_actor_set_in_clone_paint (priv->clone_source, TRUE);
|
||||
clutter_actor_set_opacity_override (priv->clone_source,
|
||||
clutter_actor_get_paint_opacity (actor));
|
||||
clutter_actor_get_paint_opacity (actor));
|
||||
_clutter_actor_set_enable_model_view_transform (priv->clone_source, FALSE);
|
||||
|
||||
if (!clutter_actor_is_mapped (priv->clone_source))
|
||||
@@ -188,8 +188,7 @@ static gboolean
|
||||
clutter_clone_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (actor));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv;
|
||||
const ClutterPaintVolume *source_volume;
|
||||
|
||||
/* if the source is not set the paint volume is defined to be empty */
|
||||
@@ -211,8 +210,7 @@ clutter_clone_get_paint_volume (ClutterActor *actor,
|
||||
static gboolean
|
||||
clutter_clone_has_overlaps (ClutterActor *actor)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (actor));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv;
|
||||
|
||||
/* The clone has overlaps iff the source has overlaps */
|
||||
|
||||
@@ -226,8 +224,7 @@ static void
|
||||
clutter_clone_allocate (ClutterActor *self,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (self));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActorClass *parent_class;
|
||||
ClutterActorBox source_box;
|
||||
float x_scale, y_scale;
|
||||
@@ -313,8 +310,7 @@ clutter_clone_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterClonePrivate *priv =
|
||||
clutter_clone_get_instance_private (CLUTTER_CLONE (gobject));
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -358,13 +354,16 @@ 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", NULL, NULL,
|
||||
g_param_spec_object ("source",
|
||||
P_("Source"),
|
||||
P_("Specifies the actor to be cloned"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
@@ -372,10 +371,10 @@ clutter_clone_class_init (ClutterCloneClass *klass)
|
||||
static void
|
||||
clutter_clone_init (ClutterClone *self)
|
||||
{
|
||||
ClutterClonePrivate *priv = clutter_clone_get_instance_private (self);
|
||||
self->priv = clutter_clone_get_instance_private (self);
|
||||
|
||||
priv->x_scale = 1.f;
|
||||
priv->y_scale = 1.f;
|
||||
self->priv->x_scale = 1.f;
|
||||
self->priv->y_scale = 1.f;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,6 +384,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)
|
||||
@@ -403,7 +404,7 @@ static void
|
||||
clutter_clone_set_source_internal (ClutterClone *self,
|
||||
ClutterActor *source)
|
||||
{
|
||||
ClutterClonePrivate *priv = clutter_clone_get_instance_private (self);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
|
||||
if (priv->clone_source == source)
|
||||
return;
|
||||
@@ -435,6 +436,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,
|
||||
@@ -454,14 +457,13 @@ 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)
|
||||
{
|
||||
ClutterClonePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_CLONE (self), NULL);
|
||||
|
||||
priv = clutter_clone_get_instance_private (self);
|
||||
return priv->clone_source;
|
||||
return self->priv->clone_source;
|
||||
}
|
||||
|
||||
@@ -21,34 +21,65 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CLONE_H__
|
||||
#define __CLUTTER_CLONE_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-actor.h"
|
||||
#include <clutter/clutter-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CLONE (clutter_clone_get_type ())
|
||||
#define CLUTTER_TYPE_CLONE (clutter_clone_get_type())
|
||||
#define CLUTTER_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLONE, ClutterClone))
|
||||
#define CLUTTER_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLONE, ClutterCloneClass))
|
||||
#define CLUTTER_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLONE))
|
||||
#define CLUTTER_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLONE))
|
||||
#define CLUTTER_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLONE, ClutterCloneClass))
|
||||
|
||||
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 >*/
|
||||
ClutterActor parent_instance;
|
||||
|
||||
ClutterClonePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterCloneClass:
|
||||
*
|
||||
* The #ClutterCloneClass structure contains only private data
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterCloneClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
void (*_clutter_actor_clone1) (void);
|
||||
void (*_clutter_actor_clone2) (void);
|
||||
void (*_clutter_actor_clone3) (void);
|
||||
void (*_clutter_actor_clone4) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterClone,
|
||||
clutter_clone,
|
||||
CLUTTER, CLONE,
|
||||
ClutterActor)
|
||||
GType clutter_clone_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_clone_new (ClutterActor *source);
|
||||
@@ -59,3 +90,5 @@ CLUTTER_EXPORT
|
||||
ClutterActor * clutter_clone_get_source (ClutterClone *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CLONE_H__ */
|
||||
|
||||
@@ -1,181 +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 "config.h"
|
||||
|
||||
#include "clutter/clutter-color-state.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/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", NULL, NULL,
|
||||
CLUTTER_TYPE_COLORSPACE,
|
||||
CLUTTER_COLORSPACE_SRGB,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
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);
|
||||
}
|
||||
@@ -1,47 +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>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#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
|
||||
79
clutter/clutter/clutter-color-static.h
Normal file
79
clutter/clutter/clutter-color-static.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_COLOR_STATIC_H__
|
||||
#define __CLUTTER_COLOR_STATIC_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#define __CLUTTER_COLOR_SYM(x) (clutter_color_get_static (CLUTTER_COLOR_##x))
|
||||
|
||||
#define CLUTTER_COLOR_White (__CLUTTER_COLOR_SYM (WHITE))
|
||||
#define CLUTTER_COLOR_Black (__CLUTTER_COLOR_SYM (BLACK))
|
||||
#define CLUTTER_COLOR_Red (__CLUTTER_COLOR_SYM (RED))
|
||||
#define CLUTTER_COLOR_DarkRed (__CLUTTER_COLOR_SYM (DARK_RED))
|
||||
#define CLUTTER_COLOR_Green (__CLUTTER_COLOR_SYM (GREEN))
|
||||
#define CLUTTER_COLOR_DarkGreen (__CLUTTER_COLOR_SYM (DARK_GREEN))
|
||||
#define CLUTTER_COLOR_Blue (__CLUTTER_COLOR_SYM (BLUE))
|
||||
#define CLUTTER_COLOR_DarkBlue (__CLUTTER_COLOR_SYM (DARK_BLUE))
|
||||
#define CLUTTER_COLOR_Cyan (__CLUTTER_COLOR_SYM (CYAN))
|
||||
#define CLUTTER_COLOR_DarkCyan (__CLUTTER_COLOR_SYM (DARK_CYAN))
|
||||
#define CLUTTER_COLOR_Magenta (__CLUTTER_COLOR_SYM (MAGENTA))
|
||||
#define CLUTTER_COLOR_DarkMagenta (__CLUTTER_COLOR_SYM (DARK_MAGENTA))
|
||||
#define CLUTTER_COLOR_Yellow (__CLUTTER_COLOR_SYM (YELLOW))
|
||||
#define CLUTTER_COLOR_DarkYellow (__CLUTTER_COLOR_SYM (DARK_YELLOW))
|
||||
#define CLUTTER_COLOR_Gray (__CLUTTER_COLOR_SYM (GRAY))
|
||||
#define CLUTTER_COLOR_DarkGray (__CLUTTER_COLOR_SYM (DARK_GRAY))
|
||||
#define CLUTTER_COLOR_LightGray (__CLUTTER_COLOR_SYM (LIGHT_GRAY))
|
||||
|
||||
#define CLUTTER_COLOR_Butter (__CLUTTER_COLOR_SYM (BUTTER))
|
||||
#define CLUTTER_COLOR_LightButter (__CLUTTER_COLOR_SYM (BUTTER_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkButter (__CLUTTER_COLOR_SYM (BUTTER_DARK))
|
||||
#define CLUTTER_COLOR_Orange (__CLUTTER_COLOR_SYM (ORANGE))
|
||||
#define CLUTTER_COLOR_LightOrange (__CLUTTER_COLOR_SYM (ORANGE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkOrange (__CLUTTER_COLOR_SYM (ORANGE_DARK))
|
||||
#define CLUTTER_COLOR_Chocolate (__CLUTTER_COLOR_SYM (CHOCOLATE))
|
||||
#define CLUTTER_COLOR_LightChocolate (__CLUTTER_COLOR_SYM (CHOCOLATE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkChocolate (__CLUTTER_COLOR_SYM (CHOCOLATE_DARK))
|
||||
#define CLUTTER_COLOR_Chameleon (__CLUTTER_COLOR_SYM (CHAMELEON))
|
||||
#define CLUTTER_COLOR_LightChameleon (__CLUTTER_COLOR_SYM (CHAMELEON_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkChameleon (__CLUTTER_COLOR_SYM (CHAMELEON_DARK))
|
||||
#define CLUTTER_COLOR_SkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE))
|
||||
#define CLUTTER_COLOR_LightSkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkSkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE_DARK))
|
||||
#define CLUTTER_COLOR_Plum (__CLUTTER_COLOR_SYM (PLUM))
|
||||
#define CLUTTER_COLOR_LightPlum (__CLUTTER_COLOR_SYM (PLUM_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkPlum (__CLUTTER_COLOR_SYM (PLUM_DARK))
|
||||
#define CLUTTER_COLOR_ScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED))
|
||||
#define CLUTTER_COLOR_LightScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED_LIGHT))
|
||||
#define CLUTTER_COLOR_DarkScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED_DARK))
|
||||
#define CLUTTER_COLOR_Aluminium1 (__CLUTTER_COLOR_SYM (ALUMINIUM_1))
|
||||
#define CLUTTER_COLOR_Aluminium2 (__CLUTTER_COLOR_SYM (ALUMINIUM_2))
|
||||
#define CLUTTER_COLOR_Aluminium3 (__CLUTTER_COLOR_SYM (ALUMINIUM_3))
|
||||
#define CLUTTER_COLOR_Aluminium4 (__CLUTTER_COLOR_SYM (ALUMINIUM_4))
|
||||
#define CLUTTER_COLOR_Aluminium5 (__CLUTTER_COLOR_SYM (ALUMINIUM_5))
|
||||
#define CLUTTER_COLOR_Aluminium6 (__CLUTTER_COLOR_SYM (ALUMINIUM_6))
|
||||
|
||||
#define CLUTTER_COLOR_Transparent (__CLUTTER_COLOR_SYM (TRANSPARENT))
|
||||
|
||||
#endif /* __CLUTTER_COLOR_STATIC_H__ */
|
||||
@@ -21,17 +21,193 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
/**
|
||||
* 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>
|
||||
|
||||
#include <pango/pango-attributes.h>
|
||||
|
||||
#include "clutter/clutter-interval.h"
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
/* XXX - keep in sync with the ClutterStaticColor enumeration order */
|
||||
static const ClutterColor static_colors[] = {
|
||||
/* CGA/EGA color palette */
|
||||
{ 0xff, 0xff, 0xff, 0xff }, /* white */
|
||||
{ 0x00, 0x00, 0x00, 0xff }, /* black */
|
||||
{ 0xff, 0x00, 0x00, 0xff }, /* red */
|
||||
{ 0x80, 0x00, 0x00, 0xff }, /* dark red */
|
||||
{ 0x00, 0xff, 0x00, 0xff }, /* green */
|
||||
{ 0x00, 0x80, 0x00, 0xff }, /* dark green */
|
||||
{ 0x00, 0x00, 0xff, 0xff }, /* blue */
|
||||
{ 0x00, 0x00, 0x80, 0xff }, /* dark blue */
|
||||
{ 0x00, 0xff, 0xff, 0xff }, /* cyan */
|
||||
{ 0x00, 0x80, 0x80, 0xff }, /* dark cyan */
|
||||
{ 0xff, 0x00, 0xff, 0xff }, /* magenta */
|
||||
{ 0x80, 0x00, 0x80, 0xff }, /* dark magenta */
|
||||
{ 0xff, 0xff, 0x00, 0xff }, /* yellow */
|
||||
{ 0x80, 0x80, 0x00, 0xff }, /* dark yellow */
|
||||
{ 0xa0, 0xa0, 0xa4, 0xff }, /* gray */
|
||||
{ 0x80, 0x80, 0x80, 0xff }, /* dark gray */
|
||||
{ 0xc0, 0xc0, 0xc0, 0xff }, /* light gray */
|
||||
|
||||
/* Tango Icon color palette */
|
||||
{ 0xed, 0xd4, 0x00, 0xff }, /* butter */
|
||||
{ 0xfc, 0xe9, 0x4f, 0xff }, /* butter light */
|
||||
{ 0xc4, 0xa0, 0x00, 0xff }, /* butter dark */
|
||||
{ 0xf5, 0x79, 0x00, 0xff }, /* orange */
|
||||
{ 0xfc, 0xaf, 0x3e, 0xff }, /* orange light */
|
||||
{ 0xce, 0x5c, 0x00, 0xff }, /* orange dark */
|
||||
{ 0xc1, 0x7d, 0x11, 0xff }, /* chocolate */
|
||||
{ 0xe9, 0xb9, 0x6e, 0xff }, /* chocolate light */
|
||||
{ 0x8f, 0x59, 0x02, 0xff }, /* chocolate dark */
|
||||
{ 0x73, 0xd2, 0x16, 0xff }, /* chameleon */
|
||||
{ 0x8a, 0xe2, 0x34, 0xff }, /* chameleon light */
|
||||
{ 0x4e, 0x9a, 0x06, 0xff }, /* chameleon dark */
|
||||
{ 0x34, 0x65, 0xa4, 0xff }, /* sky blue */
|
||||
{ 0x72, 0x9f, 0xcf, 0xff }, /* sky blue light */
|
||||
{ 0x20, 0x4a, 0x87, 0xff }, /* sky blue dark */
|
||||
{ 0x75, 0x50, 0x7b, 0xff }, /* plum */
|
||||
{ 0xad, 0x7f, 0xa8, 0xff }, /* plum light */
|
||||
{ 0x5c, 0x35, 0x66, 0xff }, /* plum dark */
|
||||
{ 0xcc, 0x00, 0x00, 0xff }, /* scarlet red */
|
||||
{ 0xef, 0x29, 0x29, 0xff }, /* scarlet red light */
|
||||
{ 0xa4, 0x00, 0x00, 0xff }, /* scarlet red dark */
|
||||
{ 0xee, 0xee, 0xec, 0xff }, /* aluminium 1 */
|
||||
{ 0xd3, 0xd7, 0xcf, 0xff }, /* aluminium 2 */
|
||||
{ 0xba, 0xbd, 0xb6, 0xff }, /* aluminium 3 */
|
||||
{ 0x88, 0x8a, 0x85, 0xff }, /* aluminium 4 */
|
||||
{ 0x55, 0x57, 0x53, 0xff }, /* aluminium 5 */
|
||||
{ 0x2e, 0x34, 0x36, 0xff }, /* aluminium 6 */
|
||||
|
||||
/* last color */
|
||||
{ 0x00, 0x00, 0x00, 0x00 } /* transparent */
|
||||
};
|
||||
|
||||
/**
|
||||
* clutter_color_get_static:
|
||||
* @color: the named global color
|
||||
*
|
||||
* Retrieves a static color for the given @color name
|
||||
*
|
||||
* Static colors are created by Clutter and are guaranteed to always be
|
||||
* available and valid
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
g_return_val_if_fail (color >= CLUTTER_COLOR_WHITE &&
|
||||
color <= CLUTTER_COLOR_TRANSPARENT, NULL);
|
||||
|
||||
return &static_colors[color];
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_add:
|
||||
* @a: a #ClutterColor
|
||||
* @b: a #ClutterColor
|
||||
* @result: (out caller-allocates): return location for the result
|
||||
*
|
||||
* Adds @a to @b and saves the resulting color inside @result.
|
||||
*
|
||||
* The alpha channel of @result is set as as the maximum value
|
||||
* between the alpha channels of @a and @b.
|
||||
*/
|
||||
void
|
||||
clutter_color_add (const ClutterColor *a,
|
||||
const ClutterColor *b,
|
||||
ClutterColor *result)
|
||||
{
|
||||
g_return_if_fail (a != NULL);
|
||||
g_return_if_fail (b != NULL);
|
||||
g_return_if_fail (result != NULL);
|
||||
|
||||
result->red = CLAMP (a->red + b->red, 0, 255);
|
||||
result->green = CLAMP (a->green + b->green, 0, 255);
|
||||
result->blue = CLAMP (a->blue + b->blue, 0, 255);
|
||||
|
||||
result->alpha = MAX (a->alpha, b->alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_subtract:
|
||||
* @a: a #ClutterColor
|
||||
* @b: a #ClutterColor
|
||||
* @result: (out caller-allocates): return location for the result
|
||||
*
|
||||
* Subtracts @b from @a and saves the resulting color inside @result.
|
||||
*
|
||||
* This function assumes that the components of @a are greater than the
|
||||
* components of @b; the result is, otherwise, undefined.
|
||||
*
|
||||
* The alpha channel of @result is set as the minimum value
|
||||
* between the alpha channels of @a and @b.
|
||||
*/
|
||||
void
|
||||
clutter_color_subtract (const ClutterColor *a,
|
||||
const ClutterColor *b,
|
||||
ClutterColor *result)
|
||||
{
|
||||
g_return_if_fail (a != NULL);
|
||||
g_return_if_fail (b != NULL);
|
||||
g_return_if_fail (result != NULL);
|
||||
|
||||
result->red = CLAMP (a->red - b->red, 0, 255);
|
||||
result->green = CLAMP (a->green - b->green, 0, 255);
|
||||
result->blue = CLAMP (a->blue - b->blue, 0, 255);
|
||||
|
||||
result->alpha = MIN (a->alpha, b->alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_lighten:
|
||||
* @color: a #ClutterColor
|
||||
* @result: (out caller-allocates): return location for the lighter color
|
||||
*
|
||||
* Lightens @color by a fixed amount, and saves the changed color
|
||||
* in @result.
|
||||
*/
|
||||
void
|
||||
clutter_color_lighten (const ClutterColor *color,
|
||||
ClutterColor *result)
|
||||
{
|
||||
clutter_color_shade (color, 1.3, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_darken:
|
||||
* @color: a #ClutterColor
|
||||
* @result: (out caller-allocates): return location for the darker color
|
||||
*
|
||||
* Darkens @color by a fixed amount, and saves the changed color
|
||||
* in @result.
|
||||
*/
|
||||
void
|
||||
clutter_color_darken (const ClutterColor *color,
|
||||
ClutterColor *result)
|
||||
{
|
||||
clutter_color_shade (color, 0.7, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_to_hls:
|
||||
@@ -186,6 +362,34 @@ clutter_color_from_hls (ClutterColor *color,
|
||||
color->blue = floorf (clr[2] * 255.0 + 0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_shade:
|
||||
* @color: a #ClutterColor
|
||||
* @factor: the shade factor to apply
|
||||
* @result: (out caller-allocates): return location for the shaded color
|
||||
*
|
||||
* Shades @color by @factor and saves the modified color into @result.
|
||||
*/
|
||||
void
|
||||
clutter_color_shade (const ClutterColor *color,
|
||||
gdouble factor,
|
||||
ClutterColor *result)
|
||||
{
|
||||
float h, l, s;
|
||||
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (result != NULL);
|
||||
|
||||
clutter_color_to_hls (color, &h, &l, &s);
|
||||
|
||||
l = CLAMP (l * factor, 0.0, 1.0);
|
||||
s = CLAMP (s * factor, 0.0, 1.0);
|
||||
|
||||
clutter_color_from_hls (result, h, l, s);
|
||||
|
||||
result->alpha = color->alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_to_pixel:
|
||||
* @color: a #ClutterColor
|
||||
@@ -445,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,
|
||||
@@ -571,11 +777,14 @@ clutter_color_from_string (ClutterColor *color,
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Returns a textual specification of @color in the hexadecimal form
|
||||
* `#rrggbbaa`, where `r`, `g`, `b` and `a` are
|
||||
* <literal>#rrggbbaa</literal>, where <literal>r</literal>,
|
||||
* <literal>g</literal>, <literal>b</literal> and <literal>a</literal> are
|
||||
* hexadecimal digits representing the red, green, blue and alpha components
|
||||
* respectively.
|
||||
*
|
||||
* Return value: (transfer full): a newly-allocated text string
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
gchar *
|
||||
clutter_color_to_string (const ClutterColor *color)
|
||||
@@ -594,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,
|
||||
@@ -629,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)
|
||||
@@ -646,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,
|
||||
@@ -686,9 +901,11 @@ clutter_color_progress (const GValue *a,
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Makes a copy of the color structure. The result must be
|
||||
* freed using [method@Clutter.Color.free].
|
||||
* freed using clutter_color_free().
|
||||
*
|
||||
* Return value: (transfer full): an allocated copy of @color.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_copy (const ClutterColor *color)
|
||||
@@ -703,7 +920,9 @@ clutter_color_copy (const ClutterColor *color)
|
||||
* clutter_color_free:
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Frees a color structure created with [method@Clutter.Color.copy].
|
||||
* Frees a color structure created with clutter_color_copy().
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
clutter_color_free (ClutterColor *color)
|
||||
@@ -723,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 [method@Clutter.Color.free] when done
|
||||
* Use clutter_color_free() when done
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_new (guint8 red,
|
||||
@@ -749,7 +970,9 @@ clutter_color_new (guint8 red,
|
||||
* Allocates a new, transparent black #ClutterColor.
|
||||
*
|
||||
* Return value: (transfer full): the newly allocated #ClutterColor; use
|
||||
* [method@Clutter.Color.free] to free its resources
|
||||
* clutter_color_free() to free its resources
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_alloc (void)
|
||||
@@ -768,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,
|
||||
@@ -833,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,
|
||||
@@ -850,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)
|
||||
@@ -943,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,
|
||||
|
||||
@@ -23,13 +23,14 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_COLOR_H__
|
||||
#define __CLUTTER_COLOR_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -42,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
|
||||
{
|
||||
@@ -55,7 +51,7 @@ struct _ClutterColor
|
||||
guint8 red;
|
||||
guint8 green;
|
||||
guint8 blue;
|
||||
|
||||
|
||||
guint8 alpha;
|
||||
};
|
||||
|
||||
@@ -67,14 +63,10 @@ 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) \
|
||||
(ClutterColor) { \
|
||||
.red = (_r), \
|
||||
.green = (_g), \
|
||||
.blue = (_b), \
|
||||
.alpha = (_a) \
|
||||
}
|
||||
#define CLUTTER_COLOR_INIT(r,g,b,a) { (r), (g), (b), (a) }
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_color_get_type (void) G_GNUC_CONST;
|
||||
@@ -97,6 +89,25 @@ ClutterColor *clutter_color_copy (const ClutterColor *color);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_free (ClutterColor *color);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_add (const ClutterColor *a,
|
||||
const ClutterColor *b,
|
||||
ClutterColor *result);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_subtract (const ClutterColor *a,
|
||||
const ClutterColor *b,
|
||||
ClutterColor *result);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_lighten (const ClutterColor *color,
|
||||
ClutterColor *result);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_darken (const ClutterColor *color,
|
||||
ClutterColor *result);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_color_shade (const ClutterColor *color,
|
||||
gdouble factor,
|
||||
ClutterColor *result);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gchar * clutter_color_to_string (const ClutterColor *color);
|
||||
CLUTTER_EXPORT
|
||||
@@ -132,8 +143,6 @@ void clutter_color_interpolate (const ClutterColor *initial,
|
||||
gdouble progress,
|
||||
ClutterColor *result);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
|
||||
#define CLUTTER_TYPE_PARAM_COLOR (clutter_param_color_get_type ())
|
||||
#define CLUTTER_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_COLOR, ClutterParamSpecColor))
|
||||
#define CLUTTER_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), CLUTTER_TYPE_PARAM_COLOR))
|
||||
@@ -142,7 +151,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
* 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))
|
||||
|
||||
@@ -154,6 +165,8 @@ typedef struct _ClutterParamSpecColor ClutterParamSpecColor;
|
||||
*
|
||||
* A #GParamSpec subclass for defining properties holding
|
||||
* a #ClutterColor.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterParamSpecColor
|
||||
{
|
||||
@@ -179,4 +192,9 @@ GParamSpec * clutter_param_spec_color (const gchar *name,
|
||||
const ClutterColor *default_value,
|
||||
GParamFlags flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const ClutterColor *clutter_color_get_static (ClutterStaticColor color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_COLOR_H__ */
|
||||
|
||||
@@ -23,25 +23,32 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#define CLUTTER_COLORIZE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffectClass))
|
||||
#define CLUTTER_IS_COLORIZE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_COLORIZE_EFFECT))
|
||||
#define CLUTTER_COLORIZE_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffectClass))
|
||||
|
||||
#include "clutter/clutter-colorize-effect.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-colorize-effect.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
typedef struct _ClutterColorizeEffectPrivate
|
||||
struct _ClutterColorizeEffect
|
||||
{
|
||||
ClutterOffscreenEffect parent_instance;
|
||||
|
||||
@@ -51,7 +58,14 @@ typedef struct _ClutterColorizeEffectPrivate
|
||||
gint tint_uniform;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
} ClutterColorizeEffectPrivate;
|
||||
};
|
||||
|
||||
struct _ClutterColorizeEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
|
||||
/* the magic gray vec3 has been taken from the NTSC conversion weights
|
||||
* as defined by:
|
||||
@@ -81,31 +95,54 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterColorizeEffect,
|
||||
clutter_colorize_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
clutter_colorize_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_colorize_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture)
|
||||
{
|
||||
ClutterColorizeEffect *colorize_effect = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterColorizeEffectPrivate *priv =
|
||||
clutter_colorize_effect_get_instance_private (colorize_effect);
|
||||
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
|
||||
cogl_pipeline_set_layer_texture (colorize_effect->pipeline, 0, texture);
|
||||
|
||||
return g_object_ref (priv->pipeline);
|
||||
return cogl_object_ref (colorize_effect->pipeline);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterEffectClass *parent_class;
|
||||
|
||||
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);
|
||||
return parent_class->pre_paint (effect, node, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (gobject);
|
||||
ClutterColorizeEffectPrivate *priv =
|
||||
clutter_colorize_effect_get_instance_private (self);
|
||||
|
||||
g_clear_object (&priv->pipeline);
|
||||
if (self->pipeline != NULL)
|
||||
{
|
||||
cogl_object_unref (self->pipeline);
|
||||
self->pipeline = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_colorize_effect_parent_class)->dispose (gobject);
|
||||
}
|
||||
@@ -138,13 +175,11 @@ clutter_colorize_effect_get_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterColorizeEffect *effect = CLUTTER_COLORIZE_EFFECT (gobject);
|
||||
ClutterColorizeEffectPrivate *priv =
|
||||
clutter_colorize_effect_get_instance_private (effect);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TINT:
|
||||
clutter_value_set_color (value, &priv->tint);
|
||||
clutter_value_set_color (value, &effect->tint);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -156,12 +191,15 @@ 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;
|
||||
|
||||
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;
|
||||
gobject_class->dispose = clutter_colorize_effect_dispose;
|
||||
@@ -170,12 +208,15 @@ 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", NULL, NULL,
|
||||
clutter_param_spec_color ("tint",
|
||||
P_("Tint"),
|
||||
P_("The tint to apply"),
|
||||
&default_tint,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
@@ -183,18 +224,16 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
|
||||
static void
|
||||
update_tint_uniform (ClutterColorizeEffect *self)
|
||||
{
|
||||
ClutterColorizeEffectPrivate *priv =
|
||||
clutter_colorize_effect_get_instance_private (self);
|
||||
if (priv->tint_uniform > -1)
|
||||
if (self->tint_uniform > -1)
|
||||
{
|
||||
float tint[3] = {
|
||||
priv->tint.red / 255.0,
|
||||
priv->tint.green / 255.0,
|
||||
priv->tint.blue / 255.0
|
||||
self->tint.red / 255.0,
|
||||
self->tint.green / 255.0,
|
||||
self->tint.blue / 255.0
|
||||
};
|
||||
|
||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
||||
priv->tint_uniform,
|
||||
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||
self->tint_uniform,
|
||||
3, /* n_components */
|
||||
1, /* count */
|
||||
tint);
|
||||
@@ -205,8 +244,7 @@ static void
|
||||
clutter_colorize_effect_init (ClutterColorizeEffect *self)
|
||||
{
|
||||
ClutterColorizeEffectClass *klass = CLUTTER_COLORIZE_EFFECT_GET_CLASS (self);
|
||||
ClutterColorizeEffectPrivate *priv =
|
||||
clutter_colorize_effect_get_instance_private (self);
|
||||
|
||||
if (G_UNLIKELY (klass->base_pipeline == NULL))
|
||||
{
|
||||
CoglSnippet *snippet;
|
||||
@@ -219,17 +257,17 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
|
||||
colorize_glsl_declarations,
|
||||
colorize_glsl_source);
|
||||
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
|
||||
g_object_unref (snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
|
||||
}
|
||||
|
||||
priv->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
|
||||
|
||||
priv->tint_uniform =
|
||||
cogl_pipeline_get_uniform_location (priv->pipeline, "tint");
|
||||
self->tint_uniform =
|
||||
cogl_pipeline_get_uniform_location (self->pipeline, "tint");
|
||||
|
||||
priv->tint = default_tint;
|
||||
self->tint = default_tint;
|
||||
|
||||
update_tint_uniform (self);
|
||||
}
|
||||
@@ -239,9 +277,11 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
|
||||
* @tint: the color to be used
|
||||
*
|
||||
* Creates a new #ClutterColorizeEffect to be used with
|
||||
* [method@Clutter.Actor.add_effect]
|
||||
* clutter_actor_add_effect()
|
||||
*
|
||||
* Return value: the newly created #ClutterColorizeEffect or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterEffect *
|
||||
clutter_colorize_effect_new (const ClutterColor *tint)
|
||||
@@ -257,17 +297,16 @@ 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,
|
||||
const ClutterColor *tint)
|
||||
{
|
||||
ClutterColorizeEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_COLORIZE_EFFECT (effect));
|
||||
|
||||
priv = clutter_colorize_effect_get_instance_private (effect);
|
||||
priv->tint = *tint;
|
||||
effect->tint = *tint;
|
||||
|
||||
update_tint_uniform (effect);
|
||||
|
||||
@@ -282,16 +321,15 @@ 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,
|
||||
ClutterColor *tint)
|
||||
{
|
||||
ClutterColorizeEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_COLORIZE_EFFECT (effect));
|
||||
g_return_if_fail (tint != NULL);
|
||||
|
||||
priv = clutter_colorize_effect_get_instance_private (effect);
|
||||
*tint = priv->tint;
|
||||
*tint = effect->tint;
|
||||
}
|
||||
|
||||
@@ -22,32 +22,35 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_COLORIZE_EFFECT_H__
|
||||
#define __CLUTTER_COLORIZE_EFFECT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-effect.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include <clutter/clutter-color.h>
|
||||
#include <clutter/clutter-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_COLORIZE_EFFECT (clutter_colorize_effect_get_type ())
|
||||
#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;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterColorizeEffect,
|
||||
clutter_colorize_effect,
|
||||
CLUTTER, COLORIZE_EFFECT,
|
||||
ClutterOffscreenEffect)
|
||||
|
||||
struct _ClutterColorizeEffectClass
|
||||
{
|
||||
ClutterOffscreenEffectClass parent_class;
|
||||
|
||||
CoglPipeline *base_pipeline;
|
||||
};
|
||||
GType clutter_colorize_effect_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterEffect *clutter_colorize_effect_new (const ClutterColor *tint);
|
||||
@@ -60,3 +63,5 @@ void clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,
|
||||
ClutterColor *tint);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_COLORIZE_EFFECT_H__ */
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONSTRAINT_PRIVATE_H__
|
||||
#define __CLUTTER_CONSTRAINT_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-constraint.h"
|
||||
#include "clutter-constraint.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -30,3 +31,5 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterActorBox *allocation);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +35,9 @@
|
||||
* the position or size of the #ClutterActor to which it is applied, by
|
||||
* updating the actor's allocation. Each #ClutterConstraint can change the
|
||||
* allocation of the actor to which they are applied by overriding the
|
||||
* [vfunc@Clutter.Constraint.update_allocation] virtual function.
|
||||
* #ClutterConstraintClass.update_allocation() virtual function.
|
||||
*
|
||||
* #ClutterConstraint is available since Clutter 1.4
|
||||
*
|
||||
* ## Using Constraints
|
||||
*
|
||||
@@ -48,7 +51,7 @@
|
||||
* #ClutterBoxLayout lay out their children.
|
||||
*
|
||||
* Constraints are attached to a #ClutterActor, and are available
|
||||
* for inspection using [method@Clutter.Actor.get_constraints].
|
||||
* for inspection using clutter_actor_get_constraints().
|
||||
*
|
||||
* Clutter provides different implementation of the #ClutterConstraint
|
||||
* abstract class, for instance:
|
||||
@@ -64,6 +67,35 @@
|
||||
* horizontal or vertical edges then it can also expand to fit the empty
|
||||
* space.
|
||||
*
|
||||
* The [constraints example](https://git.gnome.org/browse/clutter/tree/examples/constraints.c?h=clutter-1.18)
|
||||
* uses various types of #ClutterConstraints to lay out three actors on a
|
||||
* resizable stage. Only the central actor has an explicit size, and no
|
||||
* actor has an explicit position.
|
||||
*
|
||||
* - The #ClutterActor with #ClutterActor:name `layerA` is explicitly
|
||||
* sized to 100 pixels by 25 pixels, and it's added to the #ClutterStage
|
||||
* - two #ClutterAlignConstraints are used to anchor `layerA` to the
|
||||
* center of the stage, by using 0.5 as the alignment #ClutterAlignConstraint:factor on
|
||||
* both the X and Y axis
|
||||
* - the #ClutterActor with #ClutterActor:name `layerB` is added to the
|
||||
* #ClutterStage with no explicit size
|
||||
* - the #ClutterActor:x and #ClutterActor:width of `layerB` are bound
|
||||
* to the same properties of `layerA` using two #ClutterBindConstraint
|
||||
* objects, thus keeping `layerB` aligned to `layerA`
|
||||
* - the top edge of `layerB` is snapped together with the bottom edge
|
||||
* of `layerA`; the bottom edge of `layerB` is also snapped together with
|
||||
* the bottom edge of the #ClutterStage; an offset is given to the two
|
||||
* #ClutterSnapConstraintss to allow for some padding; since `layerB` is
|
||||
* snapped between two different #ClutterActors, its height is stretched
|
||||
* to match the gap
|
||||
* - the #ClutterActor with #ClutterActor:name `layerC` mirrors `layerB`,
|
||||
* snapping the top edge of the #ClutterStage to the top edge of `layerC`
|
||||
* and the top edge of `layerA` to the bottom edge of `layerC`
|
||||
*
|
||||
* You can try resizing interactively the #ClutterStage and verify
|
||||
* that the three #ClutterActors maintain the same position and
|
||||
* size relative to each other, and to the #ClutterStage.
|
||||
*
|
||||
* It is important to note that Clutter does not avoid loops or
|
||||
* competing constraints; if two or more #ClutterConstraints
|
||||
* are operating on the same positional or dimensional attributes of an
|
||||
@@ -73,7 +105,7 @@
|
||||
* ## Implementing a ClutterConstraint
|
||||
*
|
||||
* Creating a sub-class of #ClutterConstraint requires the
|
||||
* implementation of the [vfunc@Clutter.Constraint.update_allocation]
|
||||
* implementation of the #ClutterConstraintClass.update_allocation()
|
||||
* virtual function.
|
||||
*
|
||||
* The `update_allocation()` virtual function is called during the
|
||||
@@ -96,15 +128,15 @@
|
||||
* can be recovered at any point using clutter_actor_meta_get_actor().
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "clutter/clutter-constraint-private.h"
|
||||
#include "clutter-constraint-private.h"
|
||||
|
||||
#include "clutter/clutter-actor.h"
|
||||
#include "clutter/clutter-actor-meta-private.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (ClutterConstraint,
|
||||
clutter_constraint,
|
||||
|
||||
@@ -22,24 +22,39 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONSTRAINT_H__
|
||||
#define __CLUTTER_CONSTRAINT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-actor-meta.h"
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CONSTRAINT (clutter_constraint_get_type ())
|
||||
#define CLUTTER_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraint))
|
||||
#define CLUTTER_IS_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONSTRAINT))
|
||||
#define CLUTTER_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass))
|
||||
#define CLUTTER_IS_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CONSTRAINT))
|
||||
#define CLUTTER_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterConstraint,
|
||||
clutter_constraint,
|
||||
CLUTTER,
|
||||
CONSTRAINT,
|
||||
ClutterActorMeta)
|
||||
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 >*/
|
||||
ClutterActorMeta parent_instance;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterConstraintClass:
|
||||
@@ -51,6 +66,8 @@ G_DECLARE_DERIVABLE_TYPE (ClutterConstraint,
|
||||
*
|
||||
* The #ClutterConstraintClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterConstraintClass
|
||||
{
|
||||
@@ -68,8 +85,20 @@ struct _ClutterConstraintClass
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_constraint1) (void);
|
||||
void (* _clutter_constraint2) (void);
|
||||
void (* _clutter_constraint3) (void);
|
||||
void (* _clutter_constraint4) (void);
|
||||
void (* _clutter_constraint5) (void);
|
||||
void (* _clutter_constraint6) (void);
|
||||
void (* _clutter_constraint7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_constraint_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
@@ -104,3 +133,5 @@ CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_constraints (ClutterActor *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_H__ */
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* Copyright (C) 2023 Red Hat Inc.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright 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
|
||||
@@ -15,33 +17,20 @@
|
||||
*
|
||||
* 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: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
#define __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
|
||||
#include "clutter-grab.h"
|
||||
#include "clutter-stage.h"
|
||||
#include <clutter/clutter-container.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _ClutterGrab
|
||||
{
|
||||
GObject parent_instance;
|
||||
ClutterStage *stage;
|
||||
|
||||
ClutterActor *actor;
|
||||
gboolean owns_actor;
|
||||
|
||||
ClutterGrab *prev;
|
||||
ClutterGrab *next;
|
||||
};
|
||||
|
||||
ClutterGrab * clutter_grab_new (ClutterStage *stage,
|
||||
ClutterActor *actor,
|
||||
gboolean owns_actor);
|
||||
|
||||
void clutter_grab_notify (ClutterGrab *grab);
|
||||
void _clutter_container_emit_actor_added (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void _clutter_container_emit_actor_removed (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
|
||||
1273
clutter/clutter/clutter-container.c
Normal file
1273
clutter/clutter/clutter-container.c
Normal file
File diff suppressed because it is too large
Load Diff
181
clutter/clutter/clutter-container.h
Normal file
181
clutter/clutter/clutter-container.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* ClutterContainer: Generic actor container interface.
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CONTAINER_H__
|
||||
#define __CLUTTER_CONTAINER_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor.h>
|
||||
#include <clutter/clutter-child-meta.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CONTAINER (clutter_container_get_type ())
|
||||
#define CLUTTER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainer))
|
||||
#define CLUTTER_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTAINER))
|
||||
#define CLUTTER_CONTAINER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainerIface))
|
||||
|
||||
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
|
||||
* child, the function should instantiate an object of type
|
||||
* #ClutterContainerIface::child_meta_type, set the container and actor
|
||||
* 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
|
||||
* @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
|
||||
* @child_notify: class handler for #ClutterContainer::child-notify
|
||||
*
|
||||
* 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
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/*< public >*/
|
||||
void (* add) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
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,
|
||||
ClutterActor *actor);
|
||||
void (* destroy_child_meta) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
ClutterChildMeta *(* get_child_meta) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
/* signals */
|
||||
void (* actor_added) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void (* actor_removed) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* child_notify) (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
GParamSpec *pspec);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_container_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_container_find_child_by_name (ClutterContainer *container,
|
||||
const gchar *child_name);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GParamSpec * clutter_container_class_find_child_property (GObjectClass *klass,
|
||||
const gchar *property_name);
|
||||
CLUTTER_EXPORT
|
||||
GParamSpec ** clutter_container_class_list_child_properties (GObjectClass *klass,
|
||||
guint *n_properties);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_create_child_meta (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_destroy_child_meta (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
ClutterChildMeta * clutter_container_get_child_meta (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_child_set_property (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
const gchar * property,
|
||||
const GValue *value);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_child_get_property (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
const gchar *property,
|
||||
GValue *value);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_child_set (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_prop,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_child_get (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
const gchar *first_prop,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_container_child_notify (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
GParamSpec *pspec);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_H__ */
|
||||
@@ -22,9 +22,10 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONTENT_PRIVATE_H__
|
||||
#define __CLUTTER_CONTENT_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-content.h"
|
||||
#include <clutter/clutter-content.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -39,3 +40,5 @@ void _clutter_content_paint_content (ClutterContent *co
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTENT_PRIVATE_H__ */
|
||||
|
||||
@@ -23,25 +23,27 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-content-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-content-private.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -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)
|
||||
@@ -192,7 +200,7 @@ clutter_content_invalidate (ClutterContent *content)
|
||||
* set to %CLUTTER_REQUEST_CONTENT_SIZE will have a relayout queued.
|
||||
*
|
||||
* Attached actors with other request modes are not redrawn. To redraw them
|
||||
* too, use [method@Clutter.Content.invalidate].
|
||||
* too, use clutter_content_invalidate().
|
||||
*/
|
||||
void
|
||||
clutter_content_invalidate_size (ClutterContent *content)
|
||||
@@ -234,7 +242,7 @@ clutter_content_invalidate_size (ClutterContent *content)
|
||||
* is associated to a #ClutterContent, to set up a backpointer from
|
||||
* the @content to the @actor.
|
||||
*
|
||||
* This function will invoke the [vfunc@Clutter.Content.attached] virtual
|
||||
* This function will invoke the #ClutterContentInterface.attached() virtual
|
||||
* function.
|
||||
*/
|
||||
void
|
||||
@@ -268,7 +276,7 @@ _clutter_content_attached (ClutterContent *content,
|
||||
* This function should be used internally every time a #ClutterActor
|
||||
* removes the association with a #ClutterContent.
|
||||
*
|
||||
* This function will invoke the [vfunc@Clutter.Content.detached] virtual
|
||||
* This function will invoke the #ClutterContentInterface.detached() virtual
|
||||
* function.
|
||||
*/
|
||||
void
|
||||
@@ -298,7 +306,7 @@ _clutter_content_detached (ClutterContent *content,
|
||||
*
|
||||
* Creates the render tree for the @content and @actor.
|
||||
*
|
||||
* This function will invoke the [vfunc@Clutter.Content.paint_content]
|
||||
* This function will invoke the #ClutterContentInterface.paint_content()
|
||||
* virtual function.
|
||||
*/
|
||||
void
|
||||
@@ -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,
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONTENT_H__
|
||||
#define __CLUTTER_CONTENT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -52,6 +53,8 @@ G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
|
||||
*
|
||||
* The #ClutterContentInterface structure contains only
|
||||
* private data.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterContentInterface
|
||||
{
|
||||
@@ -88,3 +91,5 @@ CLUTTER_EXPORT
|
||||
void clutter_content_invalidate_size (ClutterContent *content);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTENT_H__ */
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
* Copyright (C) 2023 Red Hat
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "clutter/clutter-context.h"
|
||||
|
||||
struct _ClutterContext
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
ClutterBackend *backend;
|
||||
ClutterStageManager *stage_manager;
|
||||
|
||||
GAsyncQueue *events_queue;
|
||||
|
||||
/* the event filters added via clutter_event_add_filter. these are
|
||||
* ordered from least recently added to most recently added */
|
||||
GList *event_filters;
|
||||
|
||||
CoglPangoFontMap *font_map;
|
||||
|
||||
GSList *current_event;
|
||||
|
||||
GList *repaint_funcs;
|
||||
guint last_repaint_id;
|
||||
|
||||
ClutterSettings *settings;
|
||||
|
||||
gboolean is_initialized;
|
||||
gboolean show_fps;
|
||||
};
|
||||
@@ -1,319 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter/clutter-context-private.h"
|
||||
|
||||
#include <hb-glib.h>
|
||||
|
||||
#include "cally/cally.h"
|
||||
#include "clutter/clutter-backend-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-graphene.h"
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-paint-node-private.h"
|
||||
#include "clutter/clutter-settings-private.h"
|
||||
|
||||
static gboolean clutter_disable_mipmap_text = FALSE;
|
||||
static gboolean clutter_show_fps = FALSE;
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
static const GDebugKey clutter_debug_keys[] = {
|
||||
{ "misc", CLUTTER_DEBUG_MISC },
|
||||
{ "actor", CLUTTER_DEBUG_ACTOR },
|
||||
{ "texture", CLUTTER_DEBUG_TEXTURE },
|
||||
{ "event", CLUTTER_DEBUG_EVENT },
|
||||
{ "paint", CLUTTER_DEBUG_PAINT },
|
||||
{ "pick", CLUTTER_DEBUG_PICK },
|
||||
{ "pango", CLUTTER_DEBUG_PANGO },
|
||||
{ "backend", CLUTTER_DEBUG_BACKEND },
|
||||
{ "scheduler", CLUTTER_DEBUG_SCHEDULER },
|
||||
{ "script", CLUTTER_DEBUG_SCRIPT },
|
||||
{ "shader", CLUTTER_DEBUG_SHADER },
|
||||
{ "animation", CLUTTER_DEBUG_ANIMATION },
|
||||
{ "layout", CLUTTER_DEBUG_LAYOUT },
|
||||
{ "clipping", CLUTTER_DEBUG_CLIPPING },
|
||||
{ "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
|
||||
{ "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
|
||||
{ "detailed-trace", CLUTTER_DEBUG_DETAILED_TRACE },
|
||||
{ "grabs", CLUTTER_DEBUG_GRABS },
|
||||
{ "frame-clock", CLUTTER_DEBUG_FRAME_CLOCK },
|
||||
{ "gestures", CLUTTER_DEBUG_GESTURES },
|
||||
};
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
static const GDebugKey clutter_pick_debug_keys[] = {
|
||||
{ "nop-picking", CLUTTER_DEBUG_NOP_PICKING },
|
||||
};
|
||||
|
||||
static const GDebugKey clutter_paint_debug_keys[] = {
|
||||
{ "disable-swap-events", CLUTTER_DEBUG_DISABLE_SWAP_EVENTS },
|
||||
{ "disable-clipped-redraws", CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS },
|
||||
{ "redraws", CLUTTER_DEBUG_REDRAWS },
|
||||
{ "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES },
|
||||
{ "disable-culling", CLUTTER_DEBUG_DISABLE_CULLING },
|
||||
{ "disable-offscreen-redirect", CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT },
|
||||
{ "continuous-redraw", CLUTTER_DEBUG_CONTINUOUS_REDRAW },
|
||||
{ "paint-deform-tiles", CLUTTER_DEBUG_PAINT_DEFORM_TILES },
|
||||
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
|
||||
{ "disable-dynamic-max-render-time", CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME },
|
||||
{ "max-render-time", CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME },
|
||||
};
|
||||
|
||||
typedef struct _ClutterContextPrivate
|
||||
{
|
||||
ClutterTextDirection text_direction;
|
||||
} ClutterContextPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterContext, clutter_context, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
clutter_context_dispose (GObject *object)
|
||||
{
|
||||
ClutterContext *context = CLUTTER_CONTEXT (object);
|
||||
|
||||
g_clear_pointer (&context->events_queue, g_async_queue_unref);
|
||||
g_clear_pointer (&context->backend, clutter_backend_destroy);
|
||||
|
||||
G_OBJECT_CLASS (clutter_context_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_context_class_init (ClutterContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = clutter_context_dispose;
|
||||
|
||||
clutter_graphene_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_context_init (ClutterContext *context)
|
||||
{
|
||||
ClutterContextPrivate *priv = clutter_context_get_instance_private (context);
|
||||
|
||||
priv->text_direction = CLUTTER_TEXT_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
ClutterTextDirection
|
||||
clutter_get_text_direction (void)
|
||||
{
|
||||
ClutterTextDirection dir = CLUTTER_TEXT_DIRECTION_LTR;
|
||||
const gchar *direction;
|
||||
|
||||
direction = g_getenv ("CLUTTER_TEXT_DIRECTION");
|
||||
if (direction && *direction != '\0')
|
||||
{
|
||||
if (strcmp (direction, "rtl") == 0)
|
||||
dir = CLUTTER_TEXT_DIRECTION_RTL;
|
||||
else if (strcmp (direction, "ltr") == 0)
|
||||
dir = CLUTTER_TEXT_DIRECTION_LTR;
|
||||
}
|
||||
else
|
||||
{
|
||||
PangoLanguage *language;
|
||||
const PangoScript *scripts;
|
||||
int n_scripts, i;
|
||||
|
||||
language = pango_language_get_default ();
|
||||
scripts = pango_language_get_scripts (language, &n_scripts);
|
||||
|
||||
for (i = 0; i < n_scripts; i++)
|
||||
{
|
||||
hb_script_t script;
|
||||
hb_direction_t text_dir;
|
||||
|
||||
script = hb_glib_script_to_script ((GUnicodeScript) scripts[i]);
|
||||
text_dir = hb_script_get_horizontal_direction (script);
|
||||
|
||||
if (text_dir == HB_DIRECTION_LTR)
|
||||
dir = CLUTTER_TEXT_DIRECTION_LTR;
|
||||
else if (text_dir == HB_DIRECTION_RTL)
|
||||
dir = CLUTTER_TEXT_DIRECTION_RTL;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (MISC, "Text direction: %s",
|
||||
dir == CLUTTER_TEXT_DIRECTION_RTL ? "rtl" : "ltr");
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_context_init_real (ClutterContext *context,
|
||||
ClutterContextFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
ClutterContextPrivate *priv = clutter_context_get_instance_private (context);
|
||||
|
||||
/* If we are displaying the regions that would get redrawn with clipped
|
||||
* redraws enabled we actually have to disable the clipped redrawing
|
||||
* because otherwise we end up with nasty trails of rectangles everywhere.
|
||||
*/
|
||||
if (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)
|
||||
clutter_paint_debug_flags |= CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS;
|
||||
|
||||
/* The same is true when drawing the outlines of paint volumes... */
|
||||
if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES)
|
||||
{
|
||||
clutter_paint_debug_flags |=
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS | CLUTTER_DEBUG_DISABLE_CULLING;
|
||||
}
|
||||
|
||||
if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
|
||||
g_message ("Enabling damaged region");
|
||||
|
||||
if (!_clutter_backend_create_context (context->backend, error))
|
||||
return FALSE;
|
||||
|
||||
priv->text_direction = clutter_get_text_direction ();
|
||||
|
||||
context->is_initialized = TRUE;
|
||||
|
||||
/* Initialize a11y */
|
||||
if (!(flags & CLUTTER_CONTEXT_FLAG_NO_A11Y))
|
||||
cally_accessibility_init ();
|
||||
|
||||
/* Initialize types required for paint nodes */
|
||||
clutter_paint_node_init_types (context->backend);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
init_clutter_debug (ClutterContext *context)
|
||||
{
|
||||
const char *env_string;
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
env_string = g_getenv ("CLUTTER_DEBUG");
|
||||
if (env_string != NULL)
|
||||
{
|
||||
clutter_debug_flags =
|
||||
g_parse_debug_string (env_string,
|
||||
clutter_debug_keys,
|
||||
G_N_ELEMENTS (clutter_debug_keys));
|
||||
env_string = NULL;
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
env_string = g_getenv ("CLUTTER_PICK");
|
||||
if (env_string != NULL)
|
||||
{
|
||||
clutter_pick_debug_flags =
|
||||
g_parse_debug_string (env_string,
|
||||
clutter_pick_debug_keys,
|
||||
G_N_ELEMENTS (clutter_pick_debug_keys));
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("CLUTTER_PAINT");
|
||||
if (env_string != NULL)
|
||||
{
|
||||
clutter_paint_debug_flags =
|
||||
g_parse_debug_string (env_string,
|
||||
clutter_paint_debug_keys,
|
||||
G_N_ELEMENTS (clutter_paint_debug_keys));
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("CLUTTER_SHOW_FPS");
|
||||
if (env_string)
|
||||
clutter_show_fps = TRUE;
|
||||
|
||||
env_string = g_getenv ("CLUTTER_DISABLE_MIPMAPPED_TEXT");
|
||||
if (env_string)
|
||||
clutter_disable_mipmap_text = TRUE;
|
||||
}
|
||||
|
||||
ClutterContext *
|
||||
clutter_context_new (ClutterContextFlags flags,
|
||||
ClutterBackendConstructor backend_constructor,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
ClutterContext *context;
|
||||
|
||||
context = g_object_new (CLUTTER_TYPE_CONTEXT, NULL);
|
||||
|
||||
init_clutter_debug (context);
|
||||
context->show_fps = clutter_show_fps;
|
||||
context->is_initialized = FALSE;
|
||||
|
||||
context->backend = backend_constructor (user_data);
|
||||
context->settings = clutter_settings_get_default ();
|
||||
_clutter_settings_set_backend (context->settings,
|
||||
context->backend);
|
||||
|
||||
context->events_queue =
|
||||
g_async_queue_new_full ((GDestroyNotify) clutter_event_free);
|
||||
context->last_repaint_id = 1;
|
||||
|
||||
if (!clutter_context_init_real (context, flags, error))
|
||||
return NULL;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_context_destroy (ClutterContext *context)
|
||||
{
|
||||
g_object_run_dispose (G_OBJECT (context));
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
ClutterBackend *
|
||||
clutter_context_get_backend (ClutterContext *context)
|
||||
{
|
||||
return context->backend;
|
||||
}
|
||||
|
||||
CoglPangoFontMap *
|
||||
clutter_context_get_pango_fontmap (ClutterContext *context)
|
||||
{
|
||||
CoglPangoFontMap *font_map;
|
||||
gdouble resolution;
|
||||
gboolean use_mipmapping;
|
||||
|
||||
if (G_LIKELY (context->font_map != NULL))
|
||||
return context->font_map;
|
||||
|
||||
font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
||||
|
||||
resolution = clutter_backend_get_resolution (context->backend);
|
||||
cogl_pango_font_map_set_resolution (font_map, resolution);
|
||||
|
||||
use_mipmapping = !clutter_disable_mipmap_text;
|
||||
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
||||
|
||||
context->font_map = font_map;
|
||||
|
||||
return context->font_map;
|
||||
}
|
||||
|
||||
ClutterTextDirection
|
||||
clutter_context_get_text_direction (ClutterContext *context)
|
||||
{
|
||||
ClutterContextPrivate *priv = clutter_context_get_instance_private (context);
|
||||
|
||||
return priv->text_direction;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
* Copyright (C) 2023 Red Hat
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-stage-manager.h"
|
||||
#include "clutter-settings.h"
|
||||
#include "cogl-pango/cogl-pango.h"
|
||||
|
||||
typedef enum _ClutterContextFlags
|
||||
{
|
||||
CLUTTER_CONTEXT_FLAG_NONE = 0,
|
||||
CLUTTER_CONTEXT_FLAG_NO_A11Y = 1 << 0,
|
||||
} ClutterContextFlags;
|
||||
|
||||
typedef ClutterBackend * (* ClutterBackendConstructor) (gpointer user_data);
|
||||
|
||||
#define CLUTTER_TYPE_CONTEXT (clutter_context_get_type ())
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (ClutterContext, clutter_context,
|
||||
CLUTTER, CONTEXT, GObject)
|
||||
|
||||
/**
|
||||
* clutter_context_new: (skip)
|
||||
*/
|
||||
ClutterContext * clutter_context_new (ClutterContextFlags flags,
|
||||
ClutterBackendConstructor backend_constructor,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* clutter_context_destroy: (skip)
|
||||
*/
|
||||
CLUTTER_EXPORT
|
||||
void clutter_context_destroy (ClutterContext *context);
|
||||
|
||||
/**
|
||||
* clutter_context_get_backend:
|
||||
*
|
||||
* Returns: (transfer none): The %ClutterBackend
|
||||
*/
|
||||
CLUTTER_EXPORT
|
||||
ClutterBackend * clutter_context_get_backend (ClutterContext *context);
|
||||
|
||||
/**
|
||||
* clutter_context_get_pango_fontmap: (skip)
|
||||
*/
|
||||
CoglPangoFontMap * clutter_context_get_pango_fontmap (ClutterContext *context);
|
||||
|
||||
ClutterTextDirection clutter_context_get_text_direction (ClutterContext *context);
|
||||
@@ -16,15 +16,15 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-damage-history.h"
|
||||
#include "clutter-damage-history.h"
|
||||
|
||||
#define DAMAGE_HISTORY_LENGTH 0x10
|
||||
|
||||
struct _ClutterDamageHistory
|
||||
{
|
||||
MtkRegion *damages[DAMAGE_HISTORY_LENGTH];
|
||||
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
||||
int index;
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ clutter_damage_history_free (ClutterDamageHistory *history)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
||||
g_clear_pointer (&history->damages[i], mtk_region_unref);
|
||||
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
||||
|
||||
g_free (history);
|
||||
}
|
||||
@@ -65,10 +65,10 @@ clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
|
||||
void
|
||||
clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const MtkRegion *damage)
|
||||
const cairo_region_t *damage)
|
||||
{
|
||||
g_clear_pointer (&history->damages[history->index], mtk_region_unref);
|
||||
history->damages[history->index] = mtk_region_copy (damage);
|
||||
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
||||
history->damages[history->index] = cairo_region_copy (damage);
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -84,7 +84,7 @@ clutter_damage_history_step (ClutterDamageHistory *history)
|
||||
history->index = step_damage_index (history->index, 1);
|
||||
}
|
||||
|
||||
const MtkRegion *
|
||||
const cairo_region_t *
|
||||
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age)
|
||||
{
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef CLUTTER_DAMAGE_HISTORY_H
|
||||
#define CLUTTER_DAMAGE_HISTORY_H
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "clutter/clutter-macros.h"
|
||||
#include "mtk/mtk.h"
|
||||
#include "clutter-macros.h"
|
||||
|
||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||
|
||||
@@ -37,11 +38,13 @@ gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const MtkRegion *damage);
|
||||
const cairo_region_t *damage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const MtkRegion * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
||||
#endif /* CLUTTER_DAMAGE_HISTORY_H */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_DEBUG_H__
|
||||
#define __CLUTTER_DEBUG_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter-main.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -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
|
||||
@@ -49,3 +49,5 @@ void _clutter_debug_message (const char *format,
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEBUG_H__ */
|
||||
|
||||
@@ -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,31 +39,35 @@
|
||||
* 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
|
||||
* [vfunc@Clutter.DeformEffect.deform_vertex] virtual function; this function
|
||||
* #ClutterDeformEffectClass.deform_vertex() virtual function; this function
|
||||
* is called on every vertex that needs to be deformed by the effect.
|
||||
* Each passed vertex is an in-out parameter that initially contains the
|
||||
* position of the vertex and should be modified according to a specific
|
||||
* deformation algorithm.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "clutter-deform-effect.h"
|
||||
|
||||
#include "clutter/clutter-deform-effect.h"
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-paint-node.h"
|
||||
#include "clutter/clutter-paint-nodes.h"
|
||||
#include "clutter/clutter-private.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
|
||||
|
||||
typedef struct _ClutterDeformEffectPrivate
|
||||
struct _ClutterDeformEffectPrivate
|
||||
{
|
||||
CoglPipeline *back_pipeline;
|
||||
|
||||
@@ -80,7 +85,7 @@ typedef struct _ClutterDeformEffectPrivate
|
||||
gulong allocation_id;
|
||||
|
||||
guint is_dirty : 1;
|
||||
} ClutterDeformEffectPrivate;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -129,19 +134,14 @@ vbo_invalidate (ClutterActor *actor,
|
||||
GParamSpec *pspec,
|
||||
ClutterDeformEffect *effect)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (effect);
|
||||
|
||||
priv->is_dirty = TRUE;
|
||||
effect->priv->is_dirty = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterDeformEffect *effect = CLUTTER_DEFORM_EFFECT (meta);
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (effect);
|
||||
ClutterDeformEffectPrivate *priv = CLUTTER_DEFORM_EFFECT (meta)->priv;
|
||||
|
||||
if (priv->allocation_id != 0)
|
||||
{
|
||||
@@ -171,9 +171,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDeformEffect *self = CLUTTER_DEFORM_EFFECT (effect);
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
CoglPipeline *pipeline;
|
||||
CoglDepthState depth_state;
|
||||
|
||||
@@ -238,7 +237,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
vertex.y = height * vertex.ty;
|
||||
vertex.z = 0.0f;
|
||||
|
||||
cogl_color_init_from_4f (&vertex.color, 1.0, 1.0, 1.0, opacity / 255.0);
|
||||
cogl_color_init_from_4ub (&vertex.color, 255, 255, 255, opacity);
|
||||
|
||||
clutter_deform_effect_deform_vertex (self,
|
||||
width, height,
|
||||
@@ -251,10 +250,10 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
vertex_out->z = vertex.z;
|
||||
vertex_out->s = vertex.tx;
|
||||
vertex_out->t = vertex.ty;
|
||||
vertex_out->r = cogl_color_get_red (&vertex.color) * 255.0;
|
||||
vertex_out->g = cogl_color_get_green (&vertex.color) * 255.0;
|
||||
vertex_out->b = cogl_color_get_blue (&vertex.color) * 255.0;
|
||||
vertex_out->a = cogl_color_get_alpha (&vertex.color) * 255.0;
|
||||
vertex_out->r = cogl_color_get_red_byte (&vertex.color);
|
||||
vertex_out->g = cogl_color_get_green_byte (&vertex.color);
|
||||
vertex_out->b = cogl_color_get_blue_byte (&vertex.color);
|
||||
vertex_out->a = cogl_color_get_alpha_byte (&vertex.color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,15 +318,17 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
clutter_paint_node_add_primitive (back_node, priv->primitive);
|
||||
|
||||
clutter_paint_node_unref (back_node);
|
||||
g_object_unref (back_pipeline);
|
||||
cogl_object_unref (back_pipeline);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (priv->lines_primitive != NULL))
|
||||
{
|
||||
static ClutterColor red = CLUTTER_COLOR_INIT (255, 0, 0, 255);
|
||||
const ClutterColor *red;
|
||||
ClutterPaintNode *lines_node;
|
||||
|
||||
lines_node = clutter_color_node_new (&red);
|
||||
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);
|
||||
@@ -339,19 +340,31 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
static inline void
|
||||
clutter_deform_effect_free_arrays (ClutterDeformEffect *self)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
|
||||
g_clear_object (&priv->buffer);
|
||||
g_clear_object (&priv->primitive);
|
||||
g_clear_object (&priv->lines_primitive);
|
||||
if (priv->buffer)
|
||||
{
|
||||
cogl_object_unref (priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
}
|
||||
|
||||
if (priv->primitive)
|
||||
{
|
||||
cogl_object_unref (priv->primitive);
|
||||
priv->primitive = NULL;
|
||||
}
|
||||
|
||||
if (priv->lines_primitive)
|
||||
{
|
||||
cogl_object_unref (priv->lines_primitive);
|
||||
priv->lines_primitive = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
gint x, y, direction, n_indices;
|
||||
CoglAttribute *attributes[3];
|
||||
guint16 *static_indices;
|
||||
@@ -480,10 +493,10 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
|
||||
n_indices);
|
||||
}
|
||||
|
||||
g_object_unref (indices);
|
||||
cogl_object_unref (indices);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
g_object_unref (attributes[i]);
|
||||
cogl_object_unref (attributes[i]);
|
||||
|
||||
priv->is_dirty = TRUE;
|
||||
}
|
||||
@@ -491,10 +504,13 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
|
||||
static inline void
|
||||
clutter_deform_effect_free_back_pipeline (ClutterDeformEffect *self)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
|
||||
g_clear_object (&priv->back_pipeline);
|
||||
if (priv->back_pipeline != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->back_pipeline);
|
||||
priv->back_pipeline = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -515,23 +531,21 @@ clutter_deform_effect_set_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterDeformEffect *self = CLUTTER_DEFORM_EFFECT (gobject);
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_TILES:
|
||||
clutter_deform_effect_set_n_tiles (self, g_value_get_uint (value),
|
||||
priv->y_tiles);
|
||||
self->priv->y_tiles);
|
||||
break;
|
||||
|
||||
case PROP_Y_TILES:
|
||||
clutter_deform_effect_set_n_tiles (self, priv->x_tiles,
|
||||
clutter_deform_effect_set_n_tiles (self, self->priv->x_tiles,
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_BACK_MATERIAL:
|
||||
clutter_deform_effect_set_back_material (self, g_value_get_object (value));
|
||||
clutter_deform_effect_set_back_material (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -546,9 +560,7 @@ clutter_deform_effect_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterDeformEffect *effect = CLUTTER_DEFORM_EFFECT (gobject);
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (effect);
|
||||
ClutterDeformEffectPrivate *priv = CLUTTER_DEFORM_EFFECT (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -561,7 +573,7 @@ clutter_deform_effect_get_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_BACK_MATERIAL:
|
||||
g_value_set_object (value, priv->back_pipeline);
|
||||
g_value_set_boxed (value, priv->back_pipeline);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -584,26 +596,32 @@ 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", NULL, NULL,
|
||||
g_param_spec_uint ("x-tiles",
|
||||
P_("Horizontal Tiles"),
|
||||
P_("The number of horizontal tiles"),
|
||||
1, G_MAXUINT,
|
||||
DEFAULT_N_TILES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterDeformEffect:y-tiles:
|
||||
*
|
||||
* 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", NULL, NULL,
|
||||
g_param_spec_uint ("y-tiles",
|
||||
P_("Vertical Tiles"),
|
||||
P_("The number of vertical tiles"),
|
||||
1, G_MAXUINT,
|
||||
DEFAULT_N_TILES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterDeformEffect:back-material:
|
||||
@@ -612,12 +630,15 @@ 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_object ("back-material", NULL, NULL,
|
||||
COGL_TYPE_PIPELINE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_param_spec_boxed ("back-material",
|
||||
P_("Back Material"),
|
||||
P_("The material to be used when painting the back of the actor"),
|
||||
COGL_TYPE_HANDLE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
gobject_class->finalize = clutter_deform_effect_finalize;
|
||||
gobject_class->set_property = clutter_deform_effect_set_property;
|
||||
@@ -634,11 +655,9 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
|
||||
static void
|
||||
clutter_deform_effect_init (ClutterDeformEffect *self)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv =
|
||||
clutter_deform_effect_get_instance_private (self);
|
||||
|
||||
priv->x_tiles = priv->y_tiles = DEFAULT_N_TILES;
|
||||
priv->back_pipeline = NULL;
|
||||
self->priv = clutter_deform_effect_get_instance_private (self);
|
||||
self->priv->x_tiles = self->priv->y_tiles = DEFAULT_N_TILES;
|
||||
self->priv->back_pipeline = NULL;
|
||||
|
||||
clutter_deform_effect_init_arrays (self);
|
||||
}
|
||||
@@ -653,23 +672,26 @@ 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,
|
||||
CoglPipeline *pipeline)
|
||||
CoglHandle material)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
CoglPipeline *pipeline = COGL_PIPELINE (material);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||
g_return_if_fail (pipeline == NULL || COGL_IS_PIPELINE (pipeline));
|
||||
g_return_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline));
|
||||
|
||||
priv = clutter_deform_effect_get_instance_private (effect);
|
||||
priv = effect->priv;
|
||||
|
||||
clutter_deform_effect_free_back_pipeline (effect);
|
||||
|
||||
priv->back_pipeline = pipeline;
|
||||
priv->back_pipeline = material;
|
||||
if (priv->back_pipeline != NULL)
|
||||
g_object_ref (priv->back_pipeline);
|
||||
cogl_object_ref (priv->back_pipeline);
|
||||
|
||||
clutter_deform_effect_invalidate (effect);
|
||||
}
|
||||
@@ -683,16 +705,15 @@ 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
|
||||
*/
|
||||
CoglPipeline*
|
||||
CoglHandle
|
||||
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect), NULL);
|
||||
|
||||
priv = clutter_deform_effect_get_instance_private (effect);
|
||||
return priv->back_pipeline;
|
||||
return effect->priv->back_pipeline;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -706,6 +727,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,
|
||||
@@ -718,7 +741,7 @@ clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
|
||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||
g_return_if_fail (x_tiles > 0 && y_tiles > 0);
|
||||
|
||||
priv = clutter_deform_effect_get_instance_private (effect);
|
||||
priv = effect->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (effect));
|
||||
|
||||
@@ -759,44 +782,43 @@ 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,
|
||||
guint *x_tiles,
|
||||
guint *y_tiles)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||
|
||||
priv = clutter_deform_effect_get_instance_private (effect);
|
||||
if (x_tiles != NULL)
|
||||
*x_tiles = priv->x_tiles;
|
||||
*x_tiles = effect->priv->x_tiles;
|
||||
|
||||
if (y_tiles != NULL)
|
||||
*y_tiles = priv->y_tiles;
|
||||
*y_tiles = effect->priv->y_tiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||
|
||||
priv = clutter_deform_effect_get_instance_private (effect);
|
||||
if (priv->is_dirty)
|
||||
if (effect->priv->is_dirty)
|
||||
return;
|
||||
|
||||
priv->is_dirty = TRUE;
|
||||
effect->priv->is_dirty = TRUE;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
|
||||
if (actor != NULL)
|
||||
|
||||
@@ -22,25 +22,44 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_DEFORM_EFFECT_H__
|
||||
#define __CLUTTER_DEFORM_EFFECT_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include <cogl/cogl.h>
|
||||
#include <clutter/clutter-offscreen-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DEFORM_EFFECT (clutter_deform_effect_get_type ())
|
||||
#define CLUTTER_DEFORM_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffect))
|
||||
#define CLUTTER_IS_DEFORM_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEFORM_EFFECT))
|
||||
#define CLUTTER_DEFORM_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffectClass))
|
||||
#define CLUTTER_IS_DEFORM_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEFORM_EFFECT))
|
||||
#define CLUTTER_DEFORM_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffectClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterDeformEffect,
|
||||
clutter_deform_effect,
|
||||
CLUTTER,
|
||||
DEFORM_EFFECT,
|
||||
ClutterOffscreenEffect)
|
||||
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 >*/
|
||||
ClutterOffscreenEffect parent_instance;
|
||||
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterDeformEffectClass:
|
||||
@@ -49,6 +68,8 @@ G_DECLARE_DERIVABLE_TYPE (ClutterDeformEffect,
|
||||
*
|
||||
* The #ClutterDeformEffectClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterDeformEffectClass
|
||||
{
|
||||
@@ -60,13 +81,25 @@ struct _ClutterDeformEffectClass
|
||||
gfloat width,
|
||||
gfloat height,
|
||||
CoglTextureVertex *vertex);
|
||||
|
||||
/*< private >*/
|
||||
void (*_clutter_deform1) (void);
|
||||
void (*_clutter_deform2) (void);
|
||||
void (*_clutter_deform3) (void);
|
||||
void (*_clutter_deform4) (void);
|
||||
void (*_clutter_deform5) (void);
|
||||
void (*_clutter_deform6) (void);
|
||||
void (*_clutter_deform7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||
CoglPipeline *material);
|
||||
GType clutter_deform_effect_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglPipeline* clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
||||
void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||
CoglHandle material);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
|
||||
guint x_tiles,
|
||||
@@ -80,3 +113,5 @@ CLUTTER_EXPORT
|
||||
void clutter_deform_effect_invalidate (ClutterDeformEffect *effect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEFORM_EFFECT_H__ */
|
||||
|
||||
10
clutter/clutter/clutter-deprecated.h
Normal file
10
clutter/clutter/clutter-deprecated.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __CLUTTER_DEPRECATED_H__
|
||||
#define __CLUTTER_DEPRECATED_H__
|
||||
|
||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
#endif /* __CLUTTER_DEPRECATED_H__ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user