Compare commits
1 Commits
citadel-45
...
wip/smcv/c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2efd0dfc06 |
105
.gitignore
vendored
105
.gitignore
vendored
@@ -1,6 +1,105 @@
|
||||
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.*
|
||||
subprojects/sysprof/
|
||||
__pycache__/
|
||||
.buildconfig
|
||||
build/
|
||||
|
674
.gitlab-ci.yml
674
.gitlab-ci.yml
@@ -1,665 +1,111 @@
|
||||
include:
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/28b430bd847da130d7c678772b8be260abaab5b3/templates/fedora.yml'
|
||||
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
|
||||
stages:
|
||||
- review
|
||||
- prepare
|
||||
- code-review
|
||||
- build
|
||||
- test
|
||||
- analyze
|
||||
- docs
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: GNOME/mutter
|
||||
|
||||
.skip-git-clone:
|
||||
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_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: 39
|
||||
BASE_TAG: '2023-09-12.0'
|
||||
MUTTER_USER: 'meta-user'
|
||||
FDO_DISTRIBUTION_PACKAGES:
|
||||
asciidoc
|
||||
clang
|
||||
gcovr
|
||||
gdm
|
||||
gnome-shell
|
||||
sassc
|
||||
uncrustify
|
||||
xorg-x11-server-Xvfb
|
||||
mesa-dri-drivers
|
||||
xorg-x11-proto-devel
|
||||
qemu-system-x86-core
|
||||
busybox
|
||||
zenity
|
||||
gi-docgen
|
||||
python3-dbusmock
|
||||
pkgconfig(libgcrypt)
|
||||
pkgconfig(libdisplay-info)
|
||||
|
||||
FDO_DISTRIBUTION_EXEC: |
|
||||
set -e
|
||||
|
||||
# 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 libei --setopt=install_weak_deps=False
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.gnome.org/jadahl/catch.git \
|
||||
main . 29ad36e2b1d28ac9d8b2bc44af46296cb1db5d66
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.gnome.org/GNOME/glib.git \
|
||||
main . a7c34b431bfaf3d56de64cb1cfea851ac11099d3
|
||||
|
||||
./.gitlab-ci/install-meson-project.sh \
|
||||
https://gitlab.freedesktop.org/libinput/libei.git \
|
||||
1.0.901 .
|
||||
|
||||
rpm -e --nodeps gnome-bluetooth-libs-devel \
|
||||
mutter mutter-devel \
|
||||
gnome-shell
|
||||
|
||||
# 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'
|
||||
|
||||
default:
|
||||
# Cancel jobs if newer commits are pushed to the branch
|
||||
interruptible: true
|
||||
# Auto-retry jobs in case of infra failures
|
||||
retry:
|
||||
max: 1
|
||||
when:
|
||||
- 'runner_system_failure'
|
||||
- 'stuck_or_timeout_failure'
|
||||
- 'scheduler_failure'
|
||||
- 'api_failure'
|
||||
|
||||
.mutter.fedora@x86_64:
|
||||
extends:
|
||||
- .mutter.fedora@common
|
||||
- .mutter.git-clone
|
||||
variables:
|
||||
FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
|
||||
|
||||
.mutter.fedora@aarch64:
|
||||
extends:
|
||||
- .mutter.fedora@common
|
||||
- .mutter.git-clone
|
||||
variables:
|
||||
FDO_DISTRIBUTION_TAG: "aarch64-${BASE_TAG}"
|
||||
tags:
|
||||
- aarch64
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
# Allow to switch from branch pipelines to MR pipelines seamlessly
|
||||
# https://docs.gitlab.com/ee/ci/jobs/job_control.html#avoid-duplicate-pipelines
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
|
||||
when: never
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
# Don't trigger a branch pipeline if there is an open MR
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||
when: never
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
|
||||
.pipeline-guard:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
- if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/'
|
||||
# Avoid catchall `when: manual` rule which might
|
||||
# cause duplicate pipelines to be triggered.
|
||||
# https://docs.gitlab.com/ee/ci/jobs/job_control.html#avoid-duplicate-pipelines
|
||||
#
|
||||
# Also make it so pipelines without MR need to be started
|
||||
# manually, since their state will most likely be WIP
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
when: 'manual'
|
||||
|
||||
.only-merge-requests:
|
||||
rules:
|
||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^$/'
|
||||
when: never
|
||||
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
when: on_success
|
||||
- coverage
|
||||
|
||||
check-commit-log:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
stage: review
|
||||
variables:
|
||||
GIT_DEPTH: "100"
|
||||
script:
|
||||
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- commit-message-junit-report.xml
|
||||
reports:
|
||||
junit: commit-message-junit-report.xml
|
||||
rules:
|
||||
- !reference [.only-merge-requests, rules]
|
||||
- ./.gitlab-ci/check-commit-log.sh
|
||||
only:
|
||||
- merge_requests
|
||||
|
||||
check-merge-request:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
- .skip-git-clone
|
||||
stage: review
|
||||
script:
|
||||
ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request-report.xml
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- check-merge-request-report.xml
|
||||
reports:
|
||||
junit: check-merge-request-report.xml
|
||||
rules:
|
||||
- !reference [.only-merge-requests, rules]
|
||||
|
||||
build-fedora-container@x86_64:
|
||||
extends:
|
||||
- .fdo.container-build@fedora@x86_64
|
||||
- .mutter.fedora@x86_64
|
||||
- .mutter.skip-git-clone
|
||||
stage: prepare
|
||||
rules:
|
||||
- !reference [.pipeline-guard, rules]
|
||||
|
||||
build-fedora-container@aarch64:
|
||||
extends:
|
||||
- .fdo.container-build@fedora@aarch64
|
||||
- .mutter.fedora@aarch64
|
||||
- .mutter.skip-git-clone
|
||||
stage: prepare
|
||||
rules:
|
||||
- !reference [.pipeline-guard, rules]
|
||||
when: manual
|
||||
|
||||
check-code-style:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
variables:
|
||||
MUTTER_CLONE_DEPTH: 200
|
||||
stage: code-review
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
script:
|
||||
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 ;
|
||||
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=true
|
||||
|
||||
.build-mutter:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .build-mutter-base
|
||||
build-mutter:
|
||||
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 compile -C build
|
||||
- sudo meson install --dry-run -C build
|
||||
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-mutter@x86_64:
|
||||
variables:
|
||||
EXTRA_MESON_OPTIONS:
|
||||
-Dkvm_tests=true
|
||||
-Dkvm_kernel_image=/opt/mutter/bzImage
|
||||
extends:
|
||||
- .build-mutter
|
||||
- .mutter.fedora@x86_64
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
|
||||
build-mutter@aarch64:
|
||||
extends:
|
||||
- .build-mutter
|
||||
- .mutter.fedora@aarch64
|
||||
needs:
|
||||
- job: build-fedora-container@aarch64
|
||||
artifacts: false
|
||||
when: manual
|
||||
|
||||
build-without-opengl-and-glx@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
build-without-opengl-and-glx:
|
||||
stage: build
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
script:
|
||||
- meson setup . build --werror --prefix /usr
|
||||
-Dbuildtype=debugoptimized
|
||||
-Dopengl=false
|
||||
-Dglx=false
|
||||
-Degl_device=true
|
||||
-Dwayland_eglstream=true
|
||||
-Dintrospection=false
|
||||
- meson compile -C build
|
||||
- sudo meson install --no-rebuild -C build
|
||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-native-backend-and-wayland@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
build-without-native-backend-and-wayland:
|
||||
stage: build
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
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 compile -C build
|
||||
- sudo meson install --no-rebuild -C build
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
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-mutter:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-mutter
|
||||
variables:
|
||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||
MUTTER_DEBUG_DUMMY_MODE_SPECS: "800x600@10.0"
|
||||
PIPEWIRE_DEBUG: 2
|
||||
PIPEWIRE_LOG: "$CI_PROJECT_DIR/build/meson-logs/pipewire.log"
|
||||
XVFB_SERVER_ARGS: "+iglx -noreset"
|
||||
G_SLICE: "always-malloc"
|
||||
MALLOC_CHECK_: "3"
|
||||
NO_AT_BRIDGE: "1"
|
||||
GTK_A11Y: "none"
|
||||
before_script:
|
||||
- !reference [.mutter.git-clone, before_script]
|
||||
# Disable e.g. audio support to not dead lock screen cast tests
|
||||
script:
|
||||
- dconf update
|
||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
- pipewire & sleep 2
|
||||
|
||||
.test-mutter-base:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .test-setup
|
||||
stage: test
|
||||
after_script:
|
||||
- pushd build
|
||||
- gcovr --root=..
|
||||
--filter='\.\./src/' --filter='\.\./clutter/' --filter='\.\./cogl/'
|
||||
--exclude='\.\./build/.*\.[ch]$' --exclude='.*/tests/.*\.[ch]$'
|
||||
--json --output=../coverage-${CI_JOB_NAME}.json
|
||||
- popd
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
- >
|
||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||
when: always
|
||||
paths:
|
||||
- build
|
||||
- coverage-*.json
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
.test-mutter:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .test-mutter-base
|
||||
test-mutter-coverage:
|
||||
stage: coverage
|
||||
dependencies:
|
||||
- test-mutter
|
||||
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
|
||||
- ninja -C build coverage
|
||||
- cat build/meson-logs/coverage.txt
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "build/meson-logs/testlog-plain.junit.xml"
|
||||
|
||||
test-mutter@x86_64:
|
||||
extends:
|
||||
- .mutter.fedora@x86_64
|
||||
- .test-mutter
|
||||
tags:
|
||||
- asan
|
||||
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
|
||||
needs:
|
||||
- build-mutter@aarch64
|
||||
when: manual
|
||||
|
||||
coverage:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
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
|
||||
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+\%)/'
|
||||
needs:
|
||||
- test-mutter@x86_64
|
||||
# - test-mutter@aarch64
|
||||
- test-mutter-kvm@x86_64
|
||||
- build/meson-logs
|
||||
when: manual
|
||||
except:
|
||||
refs:
|
||||
- tags
|
||||
- master
|
||||
|
||||
can-build-gnome-shell@x86_64:
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
can-build-gnome-shell:
|
||||
stage: test
|
||||
needs:
|
||||
- build-mutter@x86_64
|
||||
dependencies:
|
||||
- build-mutter
|
||||
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 -Dman=false
|
||||
- sudo 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'
|
||||
extends:
|
||||
- .mutter.distribution-image
|
||||
- .mutter.fedora@x86_64
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
stage: analyze
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/download-coverity-tarball.sh
|
||||
- CC=clang meson setup coverity-build -Dprofiler=false
|
||||
- ./coverity/cov-analysis-linux64-*/bin/cov-build --dir cov-int meson compile -C coverity-build
|
||||
- tar czf cov-int.tar.gz cov-int
|
||||
- curl https://scan.coverity.com/builds?project=mutter
|
||||
--form token=$COVERITY_TOKEN --form email=carlosg@gnome.org
|
||||
--form file=@cov-int.tar.gz --form version="`git describe --tags`"
|
||||
--form description="GitLab CI build"
|
||||
cache:
|
||||
key: coverity-tarball
|
||||
paths:
|
||||
- coverity
|
||||
|
||||
dist-mutter:
|
||||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
- .mutter.fedora@x86_64
|
||||
- .build-mutter-base
|
||||
- .test-setup
|
||||
stage: deploy
|
||||
needs:
|
||||
- job: build-fedora-container@x86_64
|
||||
artifacts: false
|
||||
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
|
||||
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
|
||||
artifacts:
|
||||
expose_as: 'Get tarball here'
|
||||
paths:
|
||||
- build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
|
||||
reference:
|
||||
extends:
|
||||
- .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
|
||||
- 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")
|
||||
- meson gnome-shell gnome-shell/build --prefix /usr -Dman=false
|
||||
- ninja -C gnome-shell/build install
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
27
.gitlab-ci/Dockerfile
Normal file
27
.gitlab-ci/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v4 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
#
|
||||
|
||||
FROM fedora:32
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
|
||||
dnf builddep -y mutter --setopt=install_weak_deps=False && \
|
||||
|
||||
# For running unit tests
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
|
||||
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
|
||||
--setopt=install_weak_deps=False && \
|
||||
|
||||
# GNOME Shell
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
dnf clean all
|
60
.gitlab-ci/check-commit-log.sh
Executable file
60
.gitlab-ci/check-commit-log.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
echo Cannot review non-merge request
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
|
||||
branch_point=$(git merge-base HEAD FETCH_HEAD)
|
||||
|
||||
commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
|
||||
|
||||
if [ -z "$commits" ]; then
|
||||
echo Commit range empty
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function commit_message_has_url() {
|
||||
commit=$1
|
||||
commit_message=$(git show -s --format='format:%b' $commit)
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
return $?
|
||||
}
|
||||
|
||||
function commit_message_subject_is_compliant() {
|
||||
commit=$1
|
||||
commit_message_subject=$(git show -s --format='format:%s' $commit)
|
||||
|
||||
if echo "$commit_message_subject" | grep -qe "\(^meta-\|^Meta\)"; then
|
||||
echo " - message subject should not be prefixed with 'meta-' or 'Meta'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if echo "$commit_message_subject" | grep -qe "\.[ch]:"; then
|
||||
echo " - message subject prefix should not include .c, .h, etc."
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
RET=0
|
||||
for commit in $commits; do
|
||||
commit_short=$(echo $commit | cut -c -8)
|
||||
|
||||
if ! commit_message_has_url $commit; then
|
||||
echo "Commit $commit_short needs a merge request or issue URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
errors=$(commit_message_subject_is_compliant $commit)
|
||||
if [ $? != 0 ]; then
|
||||
echo "Commit message for $commit_short is not compliant:"
|
||||
echo "$errors"
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
@@ -1,19 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
fetch() {
|
||||
local remote=$1
|
||||
local ref=$2
|
||||
|
||||
git fetch --quiet --depth=1 $remote $ref 2>/dev/null
|
||||
}
|
||||
#!/usr/bin/bash
|
||||
|
||||
gnome_shell_target=
|
||||
|
||||
echo -n Cloning into gnome-shell ...
|
||||
if git clone --quiet --depth=1 https://gitlab.gnome.org/GNOME/gnome-shell.git; then
|
||||
echo \ done
|
||||
else
|
||||
echo \ failed
|
||||
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo Checkout failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -23,34 +15,19 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell}
|
||||
merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
|
||||
echo -n Looking for $merge_request_branch on remote ...
|
||||
if fetch $merge_request_remote $merge_request_branch; then
|
||||
echo \ found
|
||||
echo Looking for $merge_request_branch on remote ...
|
||||
if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
|
||||
gnome_shell_target=FETCH_HEAD
|
||||
else
|
||||
echo \ not found
|
||||
|
||||
echo -n Looking for $CI_MERGE_REQUEST_TARGET_BRANCH_NAME instead ...
|
||||
if fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME; then
|
||||
echo \ found
|
||||
gnome_shell_target=FETCH_HEAD
|
||||
else
|
||||
echo \ not found
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$gnome_shell_target" ]; then
|
||||
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
|
||||
echo \ found
|
||||
gnome_shell_target=FETCH_HEAD
|
||||
else
|
||||
echo \ not found
|
||||
gnome_shell_target=HEAD
|
||||
gnome_shell_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
echo Using $gnome_shell_target instead
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$gnome_shell_target" ]; then
|
||||
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
|
||||
gnome_shell_target=${gnome_shell_target:-origin/master}
|
||||
echo Using $gnome_shell_target instead
|
||||
fi
|
||||
|
||||
git checkout -q $gnome_shell_target
|
||||
|
@@ -1,19 +0,0 @@
|
||||
patterns:
|
||||
deny:
|
||||
- regex: '^$CI_MERGE_REQUEST_PROJECT_URL/(-/)?merge_requests/$CI_MERGE_REQUEST_IID$'
|
||||
message: Commit message must not contain a link to its own merge request
|
||||
- regex: '^(meta-|Meta)'
|
||||
message: Commit message subject should not be prefixed with 'meta-' or 'Meta'
|
||||
where: subject
|
||||
- regex: '^(clutter-|Clutter)'
|
||||
message: Commit message subject should not be prefixed with 'clutter-' or 'Clutter', use 'clutter/' instead
|
||||
where: subject
|
||||
- regex: '^(cogl-|Cogl)'
|
||||
message: Commit message subject should not be prefixed with 'cogl-' or 'Cogl', use 'cogl/' instead
|
||||
where: subject
|
||||
- regex: '^[^:]+: [a-z]'
|
||||
message: "Commit message subject should be properly Capitalized. E.g. 'window: Marginalize extradicity'"
|
||||
where: subject
|
||||
- regex: '^\S*\.[ch]:'
|
||||
message: Commit message subject prefix should not include .c, .h, etc.
|
||||
where: subject
|
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# We need a coverity token to fetch the tarball
|
||||
if [ -x $COVERITY_TOKEN ]
|
||||
then
|
||||
echo "No coverity token. Run this job from a protected branch."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
mkdir -p coverity
|
||||
|
||||
# Download and check MD5 first
|
||||
curl https://scan.coverity.com/download/linux64 \
|
||||
--data "token=$COVERITY_TOKEN&project=mutter&md5=1" \
|
||||
--output /tmp/coverity_tool.md5
|
||||
|
||||
diff /tmp/coverity_tool.md5 coverity/coverity_tool.md5 >/dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 -a -d coverity/cov-analysis* ]
|
||||
then
|
||||
echo "Coverity tarball is up-to-date"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Download and extract coverity tarball
|
||||
curl https://scan.coverity.com/download/linux64 \
|
||||
--data "token=$COVERITY_TOKEN&project=mutter" \
|
||||
--output /tmp/coverity_tool.tgz
|
||||
|
||||
rm -rf ./coverity/cov-analysis*
|
||||
|
||||
tar zxf /tmp/coverity_tool.tgz -C coverity/
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
mv /tmp/coverity_tool.md5 coverity/
|
||||
fi
|
||||
|
||||
rm /tmp/coverity_tool.tgz
|
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<-EOF
|
||||
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
|
||||
|
||||
Check out and install a meson project
|
||||
|
||||
Options:
|
||||
-Dkey=val Option to pass on to meson
|
||||
--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
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_URL="$1"
|
||||
COMMIT="$2"
|
||||
|
||||
CHECKOUT_DIR=$(mktemp --directory)
|
||||
trap "rm -rf $CHECKOUT_DIR" EXIT
|
||||
|
||||
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
|
||||
|
||||
pushd "$CHECKOUT_DIR/$SUBDIR"
|
||||
sh -c "$PREPARE"
|
||||
meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
|
||||
meson install -C _build
|
||||
popd
|
286
HACKING.md
286
HACKING.md
@@ -1,286 +0,0 @@
|
||||
# Style
|
||||
|
||||
The coding style used is primarily the GNU flavor of the [GNOME coding
|
||||
style][gnome-coding-style], with some additions described below.
|
||||
|
||||
## General
|
||||
|
||||
* Use this code style on new code. When changing old code with a different
|
||||
code style, feel free to also adjust it to use this code style.
|
||||
|
||||
* Use regular C types and `stdint.h` types instead of GLib fundamental
|
||||
types, except for `gboolean`, and `guint`/`gulong` for GSource IDs and
|
||||
signal handler IDs. That means e.g. `uint64_t` instead of `guint64`, `int`
|
||||
instead of `gint`, `unsigned int` instead of `guint` if unsignedness
|
||||
is of importance, `uint8_t` instead of `guchar`, and so on.
|
||||
|
||||
* Try to to limit line length to 80 characters, although it's not a
|
||||
strict limit.
|
||||
|
||||
* Usage of `g_autofree` and `g_autoptr` is encouraged. The style to use is
|
||||
|
||||
```c
|
||||
g_autofree char *text = NULL;
|
||||
g_autoptr (MetaSomeThing) thing = NULL;
|
||||
|
||||
text = g_strdup_printf ("The text: %d", a_number);
|
||||
thing = g_object_new (META_TYPE_SOME_THING,
|
||||
"text", text,
|
||||
NULL);
|
||||
thinger_use_thing (rocket, thing);
|
||||
```
|
||||
|
||||
* Declare variables at the top of the block they are used, but avoid
|
||||
non-trivial logic among variable declarations. Non-trivial logic can be
|
||||
getting a pointer that may be `NULL`, any kind of math, or anything
|
||||
that may have side effects.
|
||||
|
||||
* Instead of boolean arguments in functions, prefer enums or flags when
|
||||
they're more expressive. The naming convention for flags is
|
||||
|
||||
```c
|
||||
typedef _MetaSomeThingFlags
|
||||
{
|
||||
META_SOME_THING_FLAG_NONE = 0,
|
||||
META_SOME_THING_FLAG_ALTER_REALITY = 1 << 0,
|
||||
META_SOME_THING_FLAG_MANIPULATE_PERCEPTION = 1 << 1,
|
||||
} MetaSomeThingFlags;
|
||||
```
|
||||
|
||||
* Use `g_new0 ()` etc. instead of `g_slice_new0 ()`.
|
||||
|
||||
* Initialize and assign floating point variables (i.e. `float` or
|
||||
`double`) using the form `floating_point = 3.14159` or `ratio = 2.0`.
|
||||
|
||||
## Header (.h) files
|
||||
|
||||
* The return type and `*` are separated by a space.
|
||||
* Function name starts one space after the last `*`.
|
||||
* Parenthesis comes one space after the function name.
|
||||
|
||||
As an example, this is how functions in a header file should look like:
|
||||
|
||||
```c
|
||||
gboolean meta_udev_is_drm_device (MetaUdev *udev,
|
||||
GUdevDevice *device);
|
||||
|
||||
GList * meta_udev_list_drm_devices (MetaUdev *udev,
|
||||
GError **error);
|
||||
|
||||
MetaUdev * meta_udev_new (MetaBackendNative *backend_native);
|
||||
```
|
||||
|
||||
## Source code
|
||||
|
||||
Keep functions in the following order in source files:
|
||||
|
||||
1. GPL header
|
||||
2. Enums
|
||||
3. Structures
|
||||
4. Function prototypes
|
||||
5. `G_DEFINE_TYPE()`
|
||||
6. Static variables
|
||||
7. Auxiliary functions
|
||||
8. Callbacks
|
||||
9. Interface implementations
|
||||
10. Parent vfunc overrides
|
||||
11. class_init and init
|
||||
12. Public API
|
||||
|
||||
### Structures
|
||||
|
||||
Each structure field has a space after their type name. Structure fields aren't
|
||||
aligned. For example:
|
||||
|
||||
```c
|
||||
struct _MetaFooBar
|
||||
{
|
||||
MetaFoo parent;
|
||||
|
||||
MetaBar *bar;
|
||||
MetaSomething *something;
|
||||
};
|
||||
```
|
||||
|
||||
### Function Prototypes
|
||||
|
||||
Function prototypes must be formatted just like in header files.
|
||||
|
||||
### Overrides
|
||||
|
||||
When overriding parent class vfuncs, or implementing an interface, vfunc
|
||||
overrides should be named as a composition of the current class prefix,
|
||||
followed by the vfunc name. For example:
|
||||
|
||||
|
||||
```c
|
||||
static void
|
||||
meta_bar_spawn_unicorn (MetaParent *parent)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_bar_dispose (GObject *object)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_bar_finalize (GObject *object)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_bar_class_init (MetaBarClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MetaParentClass *parent_class = META_PARENT_CLASS (klass);
|
||||
|
||||
object_class->dispose = meta_bar_dispose;
|
||||
object_class->finalize = meta_bar_finalize;
|
||||
|
||||
parent_class->spawn_unicorn = meta_bar_spawn_unicorn;
|
||||
}
|
||||
```
|
||||
|
||||
### Interface Implementations
|
||||
|
||||
When implementing interfaces, two groups of functions are involved: the init
|
||||
function, and the overrides.
|
||||
|
||||
The interface init function is named after the interface type in snake case,
|
||||
followed by the `_iface_init` suffix. For example:
|
||||
|
||||
|
||||
```c
|
||||
static void meta_foo_iface_init (MetaFooInterface *foo_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaBar, meta_bar, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_FOO,
|
||||
meta_foo_iface_init));
|
||||
```
|
||||
|
||||
Then, when implementing each vfunc of the interface, follow the same pattern
|
||||
of the [Overrides](###Overrides) section. Here's an example:
|
||||
|
||||
```c
|
||||
static void
|
||||
meta_bar_do_something (MetaFoo *foo)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_foo_iface_init (MetaFooInterface *foo_iface)
|
||||
{
|
||||
foo_iface->do_something = meta_bar_do_something;
|
||||
}
|
||||
```
|
||||
|
||||
### Auxiliary Functions
|
||||
|
||||
Auxiliary functions are above every other functions to minimize the number of
|
||||
function prototypes in the file. These functions often grow when factoring out
|
||||
the same code between two or more functions:
|
||||
|
||||
```c
|
||||
static void
|
||||
do_something_on_data (Foo *data,
|
||||
Bar *bar)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
random_function (Foo *foo)
|
||||
{
|
||||
do_something_on_data (foo, bar);
|
||||
}
|
||||
|
||||
static void
|
||||
another_random_function (Foo *foo)
|
||||
{
|
||||
do_something_on_data (foo, bar);
|
||||
}
|
||||
```
|
||||
|
||||
Sometimes, however, auxiliary functions are created to break down otherwise
|
||||
large functions - in this case, it is appropriate to keep these auxiliary
|
||||
functions close to the function they are tightly related to.
|
||||
|
||||
Auxiliary function names must have a verb in the imperative form, and should
|
||||
always perform an action over something. They usually don't have the class
|
||||
prefix (`meta_`, `clutter_`, or `cogl_`). For example:
|
||||
|
||||
```c
|
||||
static void
|
||||
do_something_on_data (Foo *data,
|
||||
Bar *bar)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
Exceptionally, when converting between types, auxiliary function names may
|
||||
have the class prefix to this rule. For example:
|
||||
|
||||
```c
|
||||
static MetaFoo *
|
||||
meta_foo_from_bar (Bar *bar)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
### Callback Functions
|
||||
|
||||
Callback function names should have the name of the action in imperative
|
||||
form. They don't have any prefix, but have a `_func` suffix. For example:
|
||||
|
||||
```c
|
||||
static void
|
||||
filter_something_func (Foo *foo,
|
||||
Bar *bar,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
### Signal Callbacks
|
||||
|
||||
Signal callbacks generally have the signal name. They should be prefixed with
|
||||
`on_`, or suffixed with `_cb`, but not both. For example:
|
||||
|
||||
```c
|
||||
static void
|
||||
on_realize (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_cb (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
When the callback is named after the object that generated it, and the signal,
|
||||
then passive voice is used. For example:
|
||||
|
||||
```c
|
||||
static void
|
||||
click_action_clicked_cb (ClutterClickAction *click_action,
|
||||
ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
[gnome-coding-style]: https://developer.gnome.org/documentation/guidelines/programming/coding-style.html
|
81
README.md
81
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,82 +26,15 @@ debugging purposes.
|
||||
|
||||
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
|
||||
|
||||
It can be useful to look at the documentation available at the
|
||||
[Wiki](https://gitlab.gnome.org/GNOME/mutter/-/wikis/home).
|
||||
|
||||
The API documentation is available at:
|
||||
|
||||
- Meta: <https://gnome.pages.gitlab.gnome.org/mutter/meta/>
|
||||
- Clutter: <https://gnome.pages.gitlab.gnome.org/mutter/clutter/>
|
||||
- Cally: <https://gnome.pages.gitlab.gnome.org/mutter/cally/>
|
||||
- Cogl: <https://gnome.pages.gitlab.gnome.org/mutter/cogl/>
|
||||
- CoglPango: <https://gnome.pages.gitlab.gnome.org/mutter/cogl-pango/>
|
||||
- Mtk: <https://gnome.pages.gitlab.gnome.org/mutter/mtk/>
|
||||
|
||||
## Coding style and conventions
|
||||
|
||||
See [HACKING.md](./HACKING.md).
|
||||
|
||||
## Git messages
|
||||
The coding style used is primarily the GNU flavor of the [GNOME coding
|
||||
style](https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en)
|
||||
with some minor additions such as preferring `stdint.h` types over GLib
|
||||
fundamental types, and a soft 80 character line limit. However, in general,
|
||||
look at the file you're editing for inspiration.
|
||||
|
||||
Commit messages should follow the [GNOME commit message
|
||||
guidelines](https://wiki.gnome.org/Git/CommitMessages). We require an URL
|
||||
to either an issue or a merge request in each commit. Try to always prefix
|
||||
commit subjects with a relevant topic, such as `compositor:` or
|
||||
`clutter/actor:`, and it's always better to write too much in the commit
|
||||
message body than too little.
|
||||
|
||||
If a commit fixes an issue and that issue should be closed, add URL to it in
|
||||
the bottom of the commit message and prefix with `Closes:`.
|
||||
|
||||
Do not add any `Part-of:` line, as that will be handled automatically when
|
||||
merging.
|
||||
|
||||
### The Fixes tag
|
||||
|
||||
If a commit fixes a regression caused by a particular commit, it can be marked
|
||||
with the `Fixes:` tag. To produce such a tag, use
|
||||
|
||||
```
|
||||
git show -s --pretty='format:Fixes: %h (\"%s\")' <COMMIT>
|
||||
```
|
||||
|
||||
or create an alias
|
||||
|
||||
```
|
||||
git config --global alias.fixes "show -s --pretty='format:Fixes: %h (\"%s\")'"
|
||||
```
|
||||
|
||||
and then use
|
||||
|
||||
```
|
||||
git fixes <COMMIT>
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
compositor: Also consider dark matter when calculating paint volume
|
||||
|
||||
Ignoring dark matter when calculating the paint volume missed the case where
|
||||
compositing happens in complete vacuum.
|
||||
|
||||
Fixes: 123abc123ab ("compositor: Calculate paint volume ourselves")
|
||||
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1234
|
||||
```
|
||||
|
||||
## Default branch
|
||||
|
||||
The default development branch is `main`. If you still have a local
|
||||
checkout under the old name, use:
|
||||
```sh
|
||||
git checkout master
|
||||
git branch -m master main
|
||||
git fetch
|
||||
git branch --unset-upstream
|
||||
git branch -u origin/main
|
||||
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
|
||||
```
|
||||
to either an issue or a merge request in each commit.
|
||||
|
||||
## License
|
||||
|
||||
|
164
check-style.py
164
check-style.py
@@ -1,164 +0,0 @@
|
||||
#!/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Path relative to this script
|
||||
uncrustify_cfg = 'tools/uncrustify.cfg'
|
||||
|
||||
def run_diff(sha):
|
||||
proc = subprocess.run(
|
||||
["git", "diff", "-U0", "--function-context", sha, "HEAD"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding="utf-8",
|
||||
)
|
||||
return proc.stdout.strip().splitlines()
|
||||
|
||||
def find_chunks(diff):
|
||||
file_entry_re = re.compile('^\+\+\+ b/(.*)$')
|
||||
diff_chunk_re = re.compile('^@@ -\d+,\d+ \+(\d+),(\d+)')
|
||||
file = None
|
||||
chunks = []
|
||||
|
||||
for line in diff:
|
||||
match = file_entry_re.match(line)
|
||||
if match:
|
||||
file = match.group(1)
|
||||
|
||||
match = diff_chunk_re.match(line)
|
||||
if match:
|
||||
start = int(match.group(1))
|
||||
len = int(match.group(2))
|
||||
end = start + len
|
||||
|
||||
if len > 0 and (file.endswith('.c') or file.endswith('.h') or file.endswith('.vala')):
|
||||
chunks.append({ 'file': file, 'start': start, 'end': end })
|
||||
|
||||
return chunks
|
||||
|
||||
def reformat_chunks(chunks, rewrite):
|
||||
# Creates temp file with INDENT-ON/OFF comments
|
||||
def create_temp_file(file, start, end):
|
||||
with open(file) as f:
|
||||
tmp = tempfile.NamedTemporaryFile()
|
||||
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-ON* **/\n')
|
||||
|
||||
tmp.write(bytes(line, 'utf-8'))
|
||||
|
||||
if i == end - 1:
|
||||
tmp.write(b'/** *INDENT-OFF* **/\n')
|
||||
|
||||
tmp.seek(0)
|
||||
|
||||
return tmp
|
||||
|
||||
# Removes uncrustify INDENT-ON/OFF helper comments
|
||||
def remove_indent_comments(output):
|
||||
tmp = tempfile.NamedTemporaryFile()
|
||||
|
||||
for line in output:
|
||||
if line != b'/** *INDENT-OFF* **/\n' and line != b'/** *INDENT-ON* **/\n':
|
||||
tmp.write(line)
|
||||
|
||||
tmp.seek(0)
|
||||
|
||||
return tmp
|
||||
|
||||
changed = None
|
||||
|
||||
for chunk in chunks:
|
||||
# Add INDENT-ON/OFF comments
|
||||
tmp = create_temp_file(chunk['file'], chunk['start'], chunk['end'])
|
||||
|
||||
# uncrustify chunk
|
||||
proc = subprocess.run(
|
||||
["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
reindented = proc.stdout.splitlines(keepends=True)
|
||||
if proc.returncode != 0:
|
||||
continue
|
||||
|
||||
tmp.close()
|
||||
|
||||
# Remove INDENT-ON/OFF comments
|
||||
formatted = remove_indent_comments(reindented)
|
||||
|
||||
if dry_run is True:
|
||||
# Show changes
|
||||
proc = subprocess.run(
|
||||
["diff", "-up", "--color=always", chunk['file'], formatted.name],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
encoding="utf-8",
|
||||
)
|
||||
diff = proc.stdout
|
||||
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)
|
||||
|
||||
formatted.close()
|
||||
|
||||
return changed
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='Check code style. Needs uncrustify installed.')
|
||||
parser.add_argument('--sha', metavar='SHA', type=str,
|
||||
help='SHA for the commit to compare HEAD with')
|
||||
parser.add_argument('--dry-run', '-d', type=bool,
|
||||
action=argparse.BooleanOptionalAction,
|
||||
help='Only print changes to stdout, do not change code')
|
||||
parser.add_argument('--rewrite', '-r', type=bool,
|
||||
action=argparse.BooleanOptionalAction,
|
||||
help='Whether to amend the result to the last commit (e.g. \'git rebase --exec "%(prog)s -r"\')')
|
||||
|
||||
# Change CWD to script location, necessary for always locating the configuration file
|
||||
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
|
||||
|
||||
args = parser.parse_args()
|
||||
sha = args.sha or 'HEAD^'
|
||||
rewrite = args.rewrite
|
||||
dry_run = args.dry_run
|
||||
|
||||
diff = run_diff(sha)
|
||||
chunks = find_chunks(diff)
|
||||
changed = reformat_chunks(chunks, rewrite)
|
||||
|
||||
if dry_run is not True and rewrite is True:
|
||||
proc = subprocess.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)
|
||||
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}
|
||||
""")
|
||||
os._exit(-1)
|
||||
|
||||
os._exit(0)
|
@@ -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<50>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,12 +22,13 @@
|
||||
* 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
|
||||
* Auxiliar define, in order to get the clutter actor from the AtkObject using
|
||||
* AtkGObject methods
|
||||
*
|
||||
*/
|
||||
@@ -37,3 +38,5 @@
|
||||
void _cally_actor_get_top_level_origin (ClutterActor *actor,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
#endif /* __CALLY_ACTOR_PRIVATE_H__ */
|
||||
|
@@ -23,11 +23,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* CallyActor:
|
||||
*
|
||||
* Implementation of the ATK interfaces for [class@Clutter.Actor]
|
||||
* SECTION:cally-actor
|
||||
* @Title: CallyActor
|
||||
* @short_description: Implementation of the ATK interfaces for #ClutterActor
|
||||
* @see_also: #ClutterActor
|
||||
*
|
||||
* #CallyActor implements the required ATK interfaces of [class@Clutter.Actor]
|
||||
* #CallyActor implements the required ATK interfaces of #ClutterActor
|
||||
* exposing the common elements on each actor (position, extents, etc).
|
||||
*/
|
||||
|
||||
@@ -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,19 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#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 +196,8 @@ G_DEFINE_TYPE_WITH_CODE (CallyActor,
|
||||
* Creates a new #CallyActor for the given @actor
|
||||
*
|
||||
* Return value: the newly created #AtkObject
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject *
|
||||
cally_actor_new (ClutterActor *actor)
|
||||
@@ -762,11 +767,10 @@ static gboolean
|
||||
cally_actor_action_do_action (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
CallyActor *cally_actor = NULL;
|
||||
AtkStateSet *set = NULL;
|
||||
CallyActorPrivate *priv = NULL;
|
||||
CallyActorActionInfo *info = NULL;
|
||||
gboolean did_action = FALSE;
|
||||
CallyActor *cally_actor = NULL;
|
||||
AtkStateSet *set = NULL;
|
||||
CallyActorPrivate *priv = NULL;
|
||||
CallyActorActionInfo *info = NULL;
|
||||
|
||||
cally_actor = CALLY_ACTOR (action);
|
||||
priv = cally_actor->priv;
|
||||
@@ -774,19 +778,21 @@ cally_actor_action_do_action (AtkAction *action,
|
||||
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
|
||||
|
||||
if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
|
||||
!atk_state_set_contains_state (set, ATK_STATE_SHOWING))
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
g_object_unref (set);
|
||||
|
||||
info = _cally_actor_get_action_info (cally_actor, index);
|
||||
|
||||
if (info == NULL)
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
if (info->do_action_func == NULL)
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
if (!priv->action_queue)
|
||||
priv->action_queue = g_queue_new ();
|
||||
@@ -796,12 +802,7 @@ cally_actor_action_do_action (AtkAction *action,
|
||||
if (!priv->action_idle_handler)
|
||||
priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
|
||||
|
||||
did_action = TRUE;
|
||||
|
||||
out:
|
||||
g_clear_object (&set);
|
||||
|
||||
return did_action;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -967,7 +968,7 @@ cally_actor_real_notify_clutter (GObject *obj,
|
||||
* paint it; we don't want this to generate an ATK
|
||||
* state change
|
||||
*/
|
||||
if (clutter_actor_is_painting_unmapped (actor))
|
||||
if (clutter_actor_is_in_clone_paint (actor))
|
||||
return;
|
||||
|
||||
state = ATK_STATE_SHOWING;
|
||||
@@ -1032,6 +1033,8 @@ _cally_actor_get_action_info (CallyActor *cally_actor,
|
||||
* Adds a new action to be accessed with the #AtkAction interface.
|
||||
*
|
||||
* Return value: added action id, or -1 if failure
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
guint
|
||||
cally_actor_add_action (CallyActor *cally_actor,
|
||||
@@ -1061,6 +1064,8 @@ cally_actor_add_action (CallyActor *cally_actor,
|
||||
* Adds a new action to be accessed with the #AtkAction interface.
|
||||
*
|
||||
* Return value: added action id, or -1 if failure
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
guint
|
||||
cally_actor_add_action_full (CallyActor *cally_actor,
|
||||
@@ -1079,7 +1084,7 @@ cally_actor_add_action_full (CallyActor *cally_actor,
|
||||
|
||||
priv = cally_actor->priv;
|
||||
|
||||
info = g_new0 (CallyActorActionInfo, 1);
|
||||
info = g_slice_new (CallyActorActionInfo);
|
||||
info->name = g_strdup (action_name);
|
||||
info->description = g_strdup (action_description);
|
||||
info->keybinding = g_strdup (action_keybinding);
|
||||
@@ -1097,9 +1102,11 @@ cally_actor_add_action_full (CallyActor *cally_actor,
|
||||
* @cally_actor: a #CallyActor
|
||||
* @action_id: the action id
|
||||
*
|
||||
* Removes a action, using the @action_id returned by [method@Actor.add_action]
|
||||
* Removes a action, using the @action_id returned by cally_actor_add_action()
|
||||
*
|
||||
* Return value: %TRUE if the operation was successful, %FALSE otherwise
|
||||
* Return value: %TRUE if the operation was succesful, %FALSE otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
cally_actor_remove_action (CallyActor *cally_actor,
|
||||
@@ -1129,9 +1136,11 @@ cally_actor_remove_action (CallyActor *cally_actor,
|
||||
* @action_name: the name of the action to remove
|
||||
*
|
||||
* Removes an action, using the @action_name used when the action was added
|
||||
* with [method@Actor.add_action]
|
||||
* with cally_actor_add_action()
|
||||
*
|
||||
* Return value: %TRUE if the operation was successful, %FALSE otherwise
|
||||
* Return value: %TRUE if the operation was succesful, %FALSE otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
cally_actor_remove_action_by_name (CallyActor *cally_actor,
|
||||
@@ -1180,5 +1189,5 @@ _cally_actor_destroy_action_info (gpointer action_info,
|
||||
if (info->notify)
|
||||
info->notify (info->user_data);
|
||||
|
||||
g_free (info);
|
||||
g_slice_free (CallyActorActionInfo, info);
|
||||
}
|
||||
|
@@ -22,15 +22,15 @@
|
||||
* 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
|
||||
|
||||
@@ -51,6 +51,8 @@ typedef struct _CallyActorPrivate CallyActorPrivate;
|
||||
*
|
||||
* Action function, to be used on #AtkAction implementations as a individual
|
||||
* action
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef void (* CallyActionFunc) (CallyActor *cally_actor);
|
||||
|
||||
@@ -60,14 +62,22 @@ typedef void (* CallyActionFunc) (CallyActor *cally_actor);
|
||||
* @user_data: user data passed to the function
|
||||
*
|
||||
* Action function, to be used on #AtkAction implementations as
|
||||
* an individual action.
|
||||
*
|
||||
* Unlike #CallyActionFunc, this function uses the @user_data
|
||||
* argument passed to [method@Actor.add_action_full].
|
||||
* an individual action. Unlike #CallyActionFunc, this function
|
||||
* uses the @user_data argument passed to cally_actor_add_action_full().
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
typedef void (* CallyActionCallback) (CallyActor *cally_actor,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* CallyActor:
|
||||
*
|
||||
* The <structname>CallyActor</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyActor
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -79,6 +89,8 @@ struct _CallyActor
|
||||
/**
|
||||
* CallyActorClass:
|
||||
* @notify_clutter: Signal handler for notify signal on Clutter actor
|
||||
* @focus_clutter: Signal handler for key-focus-in and key-focus-out
|
||||
* signal on Clutter actor. This virtual functions is deprecated.
|
||||
* @add_actor: Signal handler for actor-added signal on
|
||||
* ClutterContainer interface
|
||||
* @remove_actor: Signal handler for actor-added signal on
|
||||
@@ -86,6 +98,8 @@ struct _CallyActor
|
||||
*
|
||||
* The <structname>CallyActorClass</structname> structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyActorClass
|
||||
{
|
||||
@@ -96,6 +110,9 @@ struct _CallyActorClass
|
||||
void (*notify_clutter) (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
|
||||
gboolean (*focus_clutter) (ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
gint (*add_actor) (ClutterActor *container,
|
||||
ClutterActor *actor,
|
||||
gpointer data);
|
||||
@@ -103,6 +120,10 @@ struct _CallyActorClass
|
||||
gint (*remove_actor) (ClutterActor *container,
|
||||
ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[32];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -135,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 "clutter/clutter-build-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,14 +18,15 @@
|
||||
* 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
|
||||
|
||||
@@ -40,6 +41,14 @@ typedef struct _CallyClone CallyClone;
|
||||
typedef struct _CallyCloneClass CallyCloneClass;
|
||||
typedef struct _CallyClonePrivate CallyClonePrivate;
|
||||
|
||||
/**
|
||||
* CallyClone:
|
||||
*
|
||||
* The <structname>CallyClone</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyClone
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -53,11 +62,16 @@ struct _CallyClone
|
||||
*
|
||||
* 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
|
||||
@@ -66,3 +80,5 @@ 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__ */
|
||||
|
147
clutter/clutter/cally/cally-group.c
Normal file
147
clutter/clutter/cally/cally-group.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2008 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* Based on GailContainer from GAIL
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:cally-group
|
||||
* @Title: CallyGroup
|
||||
* @short_description: Implementation of the ATK interfaces for a #ClutterGroup
|
||||
* @see_also: #ClutterGroup
|
||||
*
|
||||
* #CallyGroup implements the required ATK interfaces of #ClutterGroup
|
||||
* In particular it exposes each of the Clutter actors contained in the
|
||||
* group.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally-group.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
static gint cally_group_get_n_children (AtkObject *obj);
|
||||
static AtkObject* cally_group_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
static void cally_group_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
cally_group_class_init (CallyGroupClass *klass)
|
||||
{
|
||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_n_children = cally_group_get_n_children;
|
||||
class->ref_child = cally_group_ref_child;
|
||||
class->initialize = cally_group_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_group_init (CallyGroup *group)
|
||||
{
|
||||
/* nothing to do yet */
|
||||
}
|
||||
|
||||
/**
|
||||
* cally_group_new:
|
||||
* @actor: a #ClutterGroup
|
||||
*
|
||||
* Creates a #CallyGroup for @actor
|
||||
*
|
||||
* Return value: the newly created #CallyGroup
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject *
|
||||
cally_group_new (ClutterActor *actor)
|
||||
{
|
||||
GObject *object = NULL;
|
||||
AtkObject *accessible = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL);
|
||||
|
||||
object = g_object_new (CALLY_TYPE_GROUP, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, actor);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static gint
|
||||
cally_group_get_n_children (AtkObject *obj)
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
gint count = 0;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), count);
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
||||
|
||||
if (actor == NULL) /* defunct */
|
||||
return 0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count);
|
||||
|
||||
count = clutter_actor_get_n_children (actor);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
cally_group_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
AtkObject *accessible = NULL;
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterActor *child = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL);
|
||||
g_return_val_if_fail ((i >= 0), NULL);
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL);
|
||||
child = clutter_actor_get_child_at_index (actor, i);
|
||||
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
||||
accessible = clutter_actor_get_accessible (child);
|
||||
|
||||
if (accessible != NULL)
|
||||
g_object_ref (accessible);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_group_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_PANEL;
|
||||
}
|
87
clutter/clutter/cally/cally-group.h
Normal file
87
clutter/clutter/cally/cally-group.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2008 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* Based on GailContainer from GAIL
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CALLY_GROUP_H__
|
||||
#define __CALLY_GROUP_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cally/cally-actor.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_GROUP (cally_group_get_type ())
|
||||
#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup))
|
||||
#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass))
|
||||
#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP))
|
||||
#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP))
|
||||
#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass))
|
||||
|
||||
typedef struct _CallyGroup CallyGroup;
|
||||
typedef struct _CallyGroupClass CallyGroupClass;
|
||||
typedef struct _CallyGroupPrivate CallyGroupPrivate;
|
||||
|
||||
/**
|
||||
* CallyGroup:
|
||||
*
|
||||
* The <structname>CallyGroup</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyGroup
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyGroupPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyGroupClass:
|
||||
*
|
||||
* The <structname>CallyGroupClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyGroupClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_group_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_group_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_GROUP_H__ */
|
@@ -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__ */
|
||||
|
98
clutter/clutter/cally/cally-rectangle.c
Normal file
98
clutter/clutter/cally/cally-rectangle.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:cally-rectangle
|
||||
* @short_description: Implementation of the ATK interfaces for a #ClutterRectangle
|
||||
* @see_also: #ClutterRectangle
|
||||
*
|
||||
* #CallyRectangle implements the required ATK interfaces of #ClutterRectangle
|
||||
*
|
||||
* In particular it sets a proper role for the rectangle.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
#include "clutter-color.h"
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
|
||||
/* AtkObject */
|
||||
static void cally_rectangle_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE (CallyRectangle, cally_rectangle, CALLY_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
cally_rectangle_class_init (CallyRectangleClass *klass)
|
||||
{
|
||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = cally_rectangle_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_rectangle_init (CallyRectangle *rectangle)
|
||||
{
|
||||
/* nothing to do yet */
|
||||
}
|
||||
|
||||
/**
|
||||
* cally_rectangle_new:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Creates a new #CallyRectangle for the given @actor. @actor must be
|
||||
* a #ClutterRectangle.
|
||||
*
|
||||
* Return value: the newly created #AtkObject
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject*
|
||||
cally_rectangle_new (ClutterActor *actor)
|
||||
{
|
||||
GObject *object = NULL;
|
||||
AtkObject *accessible = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (actor), NULL);
|
||||
|
||||
object = g_object_new (CALLY_TYPE_RECTANGLE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, actor);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_rectangle_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (cally_rectangle_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_IMAGE;
|
||||
}
|
84
clutter/clutter/cally/cally-rectangle.h
Normal file
84
clutter/clutter/cally/cally-rectangle.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CALLY_RECTANGLE_H__
|
||||
#define __CALLY_RECTANGLE_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cally/cally-actor.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_RECTANGLE (cally_rectangle_get_type ())
|
||||
#define CALLY_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_RECTANGLE, CallyRectangle))
|
||||
#define CALLY_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
||||
#define CALLY_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_RECTANGLE))
|
||||
#define CALLY_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_RECTANGLE))
|
||||
#define CALLY_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
||||
|
||||
typedef struct _CallyRectangle CallyRectangle;
|
||||
typedef struct _CallyRectangleClass CallyRectangleClass;
|
||||
typedef struct _CallyRectanglePrivate CallyRectanglePrivate;
|
||||
|
||||
/**
|
||||
* CallyRectangle:
|
||||
*
|
||||
* The <structname>CallyRectangle</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRectangle
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyRectanglePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyRectangleClass:
|
||||
*
|
||||
* The <structname>CallyRectangleClass</structname> structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRectangleClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_rectangle_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_rectangle_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_RECTANGLE_H__ */
|
@@ -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 atk_object_initialize() is the
|
||||
* [class@Clutter.StageManager]).
|
||||
* expose the a11y information of the #ClutterStageManager, as the
|
||||
* children of this object are the different ClutterStage managed (so
|
||||
* the #GObject used in the atk_object_initialize() is the
|
||||
* #ClutterStageManager).
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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 */
|
||||
@@ -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)
|
||||
|
@@ -18,15 +18,15 @@
|
||||
* 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
|
||||
|
||||
@@ -41,6 +41,14 @@ typedef struct _CallyRoot CallyRoot;
|
||||
typedef struct _CallyRootClass CallyRootClass;
|
||||
typedef struct _CallyRootPrivate CallyRootPrivate;
|
||||
|
||||
/**
|
||||
* CallyRoot:
|
||||
*
|
||||
* The <structname>CallyRoot</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRoot
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -54,11 +62,16 @@ struct _CallyRoot
|
||||
*
|
||||
* 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
|
||||
@@ -67,3 +80,5 @@ 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 "clutter/clutter-build-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,
|
||||
@@ -44,7 +47,7 @@ static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj);
|
||||
/* AtkWindow */
|
||||
static void cally_stage_window_interface_init (AtkWindowIface *iface);
|
||||
|
||||
/* Auxiliary */
|
||||
/* Auxiliar */
|
||||
static void cally_stage_activate_cb (ClutterStage *stage,
|
||||
gpointer data);
|
||||
static void cally_stage_deactivate_cb (ClutterStage *stage,
|
||||
@@ -60,7 +63,7 @@ struct _CallyStagePrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
||||
cally_stage,
|
||||
CALLY_TYPE_ACTOR,
|
||||
CALLY_TYPE_GROUP,
|
||||
G_ADD_PRIVATE (CallyStage)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
|
||||
cally_stage_window_interface_init));
|
||||
@@ -90,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)
|
||||
@@ -129,11 +134,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
||||
|
||||
if (self->priv->key_focus != NULL)
|
||||
{
|
||||
if (self->priv->key_focus != CLUTTER_ACTOR (stage))
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
|
||||
(gpointer *) &self->priv->key_focus);
|
||||
}
|
||||
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
|
||||
(gpointer *) &self->priv->key_focus);
|
||||
old = clutter_actor_get_accessible (self->priv->key_focus);
|
||||
}
|
||||
else
|
||||
@@ -158,11 +160,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
||||
*
|
||||
* we remove the weak pointer above.
|
||||
*/
|
||||
if (key_focus != CLUTTER_ACTOR (stage))
|
||||
{
|
||||
g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
|
||||
(gpointer *) &self->priv->key_focus);
|
||||
}
|
||||
g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
|
||||
(gpointer *) &self->priv->key_focus);
|
||||
|
||||
new = clutter_actor_get_accessible (key_focus);
|
||||
}
|
||||
@@ -223,7 +222,7 @@ cally_stage_window_interface_init (AtkWindowIface *iface)
|
||||
/* At this moment AtkWindow is just about signals */
|
||||
}
|
||||
|
||||
/* Auxiliary */
|
||||
/* Auxiliar */
|
||||
static void
|
||||
cally_stage_activate_cb (ClutterStage *stage,
|
||||
gpointer data)
|
||||
|
@@ -18,14 +18,15 @@
|
||||
* 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-group.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -40,10 +41,18 @@ typedef struct _CallyStage CallyStage;
|
||||
typedef struct _CallyStageClass CallyStageClass;
|
||||
typedef struct _CallyStagePrivate CallyStagePrivate;
|
||||
|
||||
/**
|
||||
* CallyStage:
|
||||
*
|
||||
* The <structname>CallyStage</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyStage
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
CallyGroup parent;
|
||||
|
||||
CallyStagePrivate *priv;
|
||||
};
|
||||
@@ -53,11 +62,16 @@ struct _CallyStage
|
||||
*
|
||||
* The <structname>CallyStageClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyStageClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
CallyGroupClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -66,3 +80,5 @@ 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 "clutter/clutter-build-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);
|
||||
|
||||
@@ -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)
|
||||
@@ -1507,7 +1513,7 @@ cally_text_get_offset_at_point (AtkText *text,
|
||||
}
|
||||
|
||||
|
||||
/******** Auxiliary private methods ******/
|
||||
/******** Auxiliar private methods ******/
|
||||
|
||||
/* ClutterText only maintains the current cursor position and a extra selection
|
||||
bound, but this could be before or after the cursor. This method returns
|
||||
@@ -1546,7 +1552,7 @@ _cally_text_delete_text_cb (ClutterText *clutter_text,
|
||||
|
||||
g_return_if_fail (CALLY_IS_TEXT (data));
|
||||
|
||||
/* Ignore zero length deletions */
|
||||
/* Ignore zero lengh deletions */
|
||||
if (end_pos - start_pos == 0)
|
||||
return;
|
||||
|
||||
@@ -1647,7 +1653,7 @@ cally_text_insert_text (AtkEditableText *text,
|
||||
clutter_text_insert_text (CLUTTER_TEXT (actor),
|
||||
string, *position);
|
||||
|
||||
/* we suppose that the text insertion will be successful,
|
||||
/* we suppose that the text insertion will be succesful,
|
||||
clutter-text doesn't warn about it. A option would be search for
|
||||
the text, but it seems not really required */
|
||||
*position += length;
|
||||
@@ -1860,7 +1866,7 @@ static gint
|
||||
_cally_atk_attribute_lookup_func (gconstpointer data,
|
||||
gconstpointer user_data)
|
||||
{
|
||||
AtkTextAttribute attr = (AtkTextAttribute) GPOINTER_TO_INT (user_data);
|
||||
AtkTextAttribute attr = (AtkTextAttribute) user_data;
|
||||
AtkAttribute *at = (AtkAttribute *) data;
|
||||
if (!g_strcmp0 (at->name, atk_text_attribute_get_name (attr)))
|
||||
return 0;
|
||||
|
@@ -18,14 +18,15 @@
|
||||
* 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
|
||||
|
||||
@@ -40,6 +41,14 @@ typedef struct _CallyText CallyText;
|
||||
typedef struct _CallyTextClass CallyTextClass;
|
||||
typedef struct _CallyTextPrivate CallyTextPrivate;
|
||||
|
||||
/**
|
||||
* CallyText:
|
||||
*
|
||||
* The <structname>CallyText</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyText
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -53,11 +62,16 @@ struct _CallyText
|
||||
*
|
||||
* 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
|
||||
@@ -66,3 +80,5 @@ CLUTTER_EXPORT
|
||||
AtkObject* cally_text_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_TEXT_H__ */
|
||||
|
@@ -18,13 +18,16 @@
|
||||
* 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
|
||||
@@ -35,15 +38,15 @@
|
||||
* available any accessible object.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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);
|
||||
@@ -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,13 +18,14 @@
|
||||
* 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
|
||||
@@ -40,6 +41,14 @@ typedef struct _CallyUtil CallyUtil;
|
||||
typedef struct _CallyUtilClass CallyUtilClass;
|
||||
typedef struct _CallyUtilPrivate CallyUtilPrivate;
|
||||
|
||||
/**
|
||||
* CallyUtil:
|
||||
*
|
||||
* The <structname>CallyUtil</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyUtil
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -53,11 +62,16 @@ struct _CallyUtil
|
||||
*
|
||||
* 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
|
||||
@@ -65,7 +79,6 @@ 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,7 +15,9 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -27,29 +29,33 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "cally/cally.h"
|
||||
#include "cally.h"
|
||||
|
||||
#include "cally/cally-actor.h"
|
||||
#include "cally/cally-stage.h"
|
||||
#include "cally/cally-text.h"
|
||||
#include "cally/cally-clone.h"
|
||||
#include "cally-actor.h"
|
||||
#include "cally-group.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-clone.h"
|
||||
|
||||
#include "cally/cally-factory.h"
|
||||
#include "cally/cally-util.h"
|
||||
#include "cally-factory.h"
|
||||
#include "cally-util.h"
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/* factories initialization*/
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
|
||||
|
||||
/**
|
||||
@@ -59,14 +65,18 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
|
||||
*
|
||||
* Return value: %TRUE if accessibility support has been correctly
|
||||
* initialized.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
cally_accessibility_init (void)
|
||||
{
|
||||
/* setting the factories */
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
|
||||
|
||||
/* Initialize the CallyUtility class */
|
||||
@@ -84,6 +94,8 @@ cally_accessibility_init (void)
|
||||
*
|
||||
* Return value: %TRUE if accessibility support has been correctly
|
||||
* initialized.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean cally_get_cally_initialized (void)
|
||||
{
|
||||
|
@@ -18,17 +18,22 @@
|
||||
* 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-group.h"
|
||||
#include "cally-main.h"
|
||||
#include "cally-rectangle.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,45 +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);
|
||||
|
||||
G_END_DECLS
|
@@ -23,92 +23,39 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterAction:
|
||||
*
|
||||
* Abstract class for event-related logic
|
||||
* SECTION:clutter-action
|
||||
* @Title: ClutterAction
|
||||
* @Short_Description: Abstract class for event-related logic
|
||||
* @See_Also: #ClutterConstraint
|
||||
*
|
||||
* #ClutterAction is an abstract base class for event-related actions that
|
||||
* modify the user interaction of a [class@Actor], just like
|
||||
* [class@Constraint] is an abstract class for modifiers of an actor's
|
||||
* modify the user interaction of a #ClutterActor, just like
|
||||
* #ClutterConstraint is an abstract class for modifiers of an actor's
|
||||
* position or size.
|
||||
*
|
||||
* Implementations of #ClutterAction are associated to an actor and can
|
||||
* provide behavioral changes when dealing with user input - for instance
|
||||
* drag and drop capabilities, or scrolling, or panning - by using the
|
||||
* various event-related signals provided by [class@Actor] itself.
|
||||
* various event-related signals provided by #ClutterActor itself.
|
||||
*
|
||||
* #ClutterAction is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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)
|
||||
{
|
||||
return CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@@ -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,18 +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);
|
||||
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 */
|
||||
@@ -65,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
|
||||
@@ -86,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 "clutter/clutter-build-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,15 +44,17 @@ clutter_actor_box_new (gfloat x_1,
|
||||
/**
|
||||
* clutter_actor_box_alloc:
|
||||
*
|
||||
* Allocates a new [struct@ActorBox].
|
||||
* Allocates a new #ClutterActorBox.
|
||||
*
|
||||
* Return value: (transfer full): the newly allocated #ClutterActorBox.
|
||||
* Use [method@ActorBox.free] to free its resources
|
||||
* Use clutter_actor_box_free() to free its resources
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterActorBox *
|
||||
clutter_actor_box_alloc (void)
|
||||
{
|
||||
return g_new0 (ClutterActorBox, 1);
|
||||
return g_slice_new0 (ClutterActorBox);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,6 +68,8 @@ clutter_actor_box_alloc (void)
|
||||
* Initializes @box with the given coordinates.
|
||||
*
|
||||
* Return value: (transfer none): the initialized #ClutterActorBox
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterActorBox *
|
||||
clutter_actor_box_init (ClutterActorBox *box,
|
||||
@@ -91,6 +97,8 @@ clutter_actor_box_init (ClutterActorBox *box,
|
||||
* @height: height of the box
|
||||
*
|
||||
* Initializes @box with the given origin and size.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_init_rect (ClutterActorBox *box,
|
||||
@@ -114,13 +122,15 @@ clutter_actor_box_init_rect (ClutterActorBox *box,
|
||||
* Copies @box
|
||||
*
|
||||
* Return value: a newly allocated copy of #ClutterActorBox. Use
|
||||
* [method@ActorBox.free] to free the allocated resources
|
||||
* clutter_actor_box_free() to free the allocated resources
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
ClutterActorBox *
|
||||
clutter_actor_box_copy (const ClutterActorBox *box)
|
||||
{
|
||||
if (G_LIKELY (box != NULL))
|
||||
return g_memdup2 (box, sizeof (ClutterActorBox));
|
||||
return g_slice_dup (ClutterActorBox, box);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -129,14 +139,16 @@ clutter_actor_box_copy (const ClutterActorBox *box)
|
||||
* clutter_actor_box_free:
|
||||
* @box: a #ClutterActorBox
|
||||
*
|
||||
* Frees a #ClutterActorBox allocated using [ctor@ActorBox.new]
|
||||
* or [method@ActorBox.copy].
|
||||
* Frees a #ClutterActorBox allocated using clutter_actor_box_new()
|
||||
* or clutter_actor_box_copy()
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_free (ClutterActorBox *box)
|
||||
{
|
||||
if (G_LIKELY (box != NULL))
|
||||
g_free (box);
|
||||
g_slice_free (ClutterActorBox, box);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,6 +159,8 @@ clutter_actor_box_free (ClutterActorBox *box)
|
||||
* Checks @box_a and @box_b for equality
|
||||
*
|
||||
* Return value: %TRUE if the passed #ClutterActorBox are equal
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_box_equal (const ClutterActorBox *box_a,
|
||||
@@ -168,6 +182,8 @@ clutter_actor_box_equal (const ClutterActorBox *box_a,
|
||||
* Retrieves the X coordinate of the origin of @box
|
||||
*
|
||||
* Return value: the X coordinate of the origin
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gfloat
|
||||
clutter_actor_box_get_x (const ClutterActorBox *box)
|
||||
@@ -184,6 +200,8 @@ clutter_actor_box_get_x (const ClutterActorBox *box)
|
||||
* Retrieves the Y coordinate of the origin of @box
|
||||
*
|
||||
* Return value: the Y coordinate of the origin
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gfloat
|
||||
clutter_actor_box_get_y (const ClutterActorBox *box)
|
||||
@@ -200,6 +218,8 @@ clutter_actor_box_get_y (const ClutterActorBox *box)
|
||||
* Retrieves the width of the @box
|
||||
*
|
||||
* Return value: the width of the box
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gfloat
|
||||
clutter_actor_box_get_width (const ClutterActorBox *box)
|
||||
@@ -216,6 +236,8 @@ clutter_actor_box_get_width (const ClutterActorBox *box)
|
||||
* Retrieves the height of the @box
|
||||
*
|
||||
* Return value: the height of the box
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gfloat
|
||||
clutter_actor_box_get_height (const ClutterActorBox *box)
|
||||
@@ -232,6 +254,8 @@ clutter_actor_box_get_height (const ClutterActorBox *box)
|
||||
* @y: (out) (allow-none): return location for the Y coordinate, or %NULL
|
||||
*
|
||||
* Retrieves the origin of @box
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_get_origin (const ClutterActorBox *box,
|
||||
@@ -254,6 +278,8 @@ clutter_actor_box_get_origin (const ClutterActorBox *box,
|
||||
* @height: (out) (allow-none): return location for the height, or %NULL
|
||||
*
|
||||
* Retrieves the size of @box
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_get_size (const ClutterActorBox *box,
|
||||
@@ -276,6 +302,8 @@ clutter_actor_box_get_size (const ClutterActorBox *box,
|
||||
* Retrieves the area of @box
|
||||
*
|
||||
* Return value: the area of a #ClutterActorBox, in pixels
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gfloat
|
||||
clutter_actor_box_get_area (const ClutterActorBox *box)
|
||||
@@ -292,9 +320,11 @@ clutter_actor_box_get_area (const ClutterActorBox *box)
|
||||
* @y: Y coordinate of the point
|
||||
*
|
||||
* Checks whether a point with @x, @y coordinates is contained
|
||||
* within @box
|
||||
* withing @box
|
||||
*
|
||||
* Return value: %TRUE if the point is contained by the #ClutterActorBox
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
@@ -313,7 +343,9 @@ clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
|
||||
*
|
||||
* Calculates the bounding box represented by the four vertices; for details
|
||||
* of the vertex array see [method@Actor.get_abs_allocation_vertices].
|
||||
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
@@ -380,8 +412,10 @@ clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
* @progress: the interpolation progress
|
||||
* @result: (out): return location for the interpolation
|
||||
*
|
||||
* Interpolates between @initial and @final `ClutterActorBox`es
|
||||
* Interpolates between @initial and @final #ClutterActorBox<!-- -->es
|
||||
* using @progress
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_interpolate (const ClutterActorBox *initial,
|
||||
@@ -404,6 +438,8 @@ clutter_actor_box_interpolate (const ClutterActorBox *initial,
|
||||
* @box: (inout): the #ClutterActorBox to clamp
|
||||
*
|
||||
* Clamps the components of @box to the nearest integer
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
|
||||
@@ -424,6 +460,8 @@ clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
|
||||
* of @a and @b
|
||||
*
|
||||
* Unions the two boxes @a and @b and stores the result in @result.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_union (const ClutterActorBox *a,
|
||||
@@ -466,6 +504,8 @@ clutter_actor_box_progress (const GValue *a,
|
||||
* @y: the Y coordinate of the new origin
|
||||
*
|
||||
* Changes the origin of @box, maintaining the size of the #ClutterActorBox.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_set_origin (ClutterActorBox *box,
|
||||
@@ -489,6 +529,8 @@ clutter_actor_box_set_origin (ClutterActorBox *box,
|
||||
* @height: the new height
|
||||
*
|
||||
* Sets the size of @box, maintaining the origin of the #ClutterActorBox.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_set_size (ClutterActorBox *box,
|
||||
@@ -506,16 +548,13 @@ _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.
|
||||
*
|
||||
* The reason this is important is because effects will use this
|
||||
* API to determine the size of offscreen framebuffers and so for
|
||||
* a fixed-size object that may be animated across the screen we
|
||||
* a fixed-size object that may be animated accross the screen we
|
||||
* want to make sure that the stage paint-box has an equally stable
|
||||
* size so that effects aren't made to continuously re-allocate
|
||||
* a corresponding fbo.
|
||||
@@ -544,7 +583,7 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
|
||||
|
||||
/* Now we redefine the top-left relative to the bottom right based on the
|
||||
* rounded width/height determined above + a constant so that the overall
|
||||
* size of the box will be stable and not dependent on the box's
|
||||
* size of the box will be stable and not dependant on the box's
|
||||
* position.
|
||||
*
|
||||
* Adding 3px to the width/height will ensure we cover the maximum of
|
||||
@@ -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,
|
||||
@@ -574,32 +615,6 @@ clutter_actor_box_scale (ClutterActorBox *box,
|
||||
box->y2 *= scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_box_is_initialized:
|
||||
* @box: a #ClutterActorBox
|
||||
*
|
||||
* Checks if @box has been initialized, a #ClutterActorBox is uninitialized
|
||||
* if it has a size of -1 at an origin of 0, 0.
|
||||
*
|
||||
* Returns: %TRUE if the box is uninitialized, %FALSE if it isn't
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_box_is_initialized (ClutterActorBox *box)
|
||||
{
|
||||
gboolean x1_uninitialized, x2_uninitialized;
|
||||
gboolean y1_uninitialized, y2_uninitialized;
|
||||
|
||||
g_return_val_if_fail (box != NULL, TRUE);
|
||||
|
||||
x1_uninitialized = isinf (box->x1);
|
||||
x2_uninitialized = isinf (box->x2) && signbit (box->x2);
|
||||
y1_uninitialized = isinf (box->y1);
|
||||
y2_uninitialized = isinf (box->y2) && signbit (box->y2);
|
||||
|
||||
return !x1_uninitialized || !x2_uninitialized ||
|
||||
!y1_uninitialized || !y2_uninitialized;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
|
||||
clutter_actor_box_copy,
|
||||
clutter_actor_box_free,
|
||||
|
@@ -22,9 +22,10 @@
|
||||
* 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
|
||||
|
||||
@@ -92,3 +93,5 @@ int _clutter_actor_meta_get_priority (ClutterActorMet
|
||||
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 "clutter/clutter-build-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,20 +205,27 @@ 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,
|
||||
CLUTTER_PARAM_READABLE |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* ClutterActorMeta:name:
|
||||
*
|
||||
* The unique name to access the #ClutterActorMeta
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_NAME] =
|
||||
g_param_spec_string ("name", NULL, NULL,
|
||||
g_param_spec_string ("name",
|
||||
P_("Name"),
|
||||
P_("The name of the meta"),
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -225,9 +233,13 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
||||
* ClutterActorMeta:enabled:
|
||||
*
|
||||
* Whether or not the #ClutterActorMeta is enabled
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_ENABLED] =
|
||||
g_param_spec_boolean ("enabled", NULL, NULL,
|
||||
g_param_spec_boolean ("enabled",
|
||||
P_("Enabled"),
|
||||
P_("Whether the meta is enabled"),
|
||||
TRUE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -257,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,
|
||||
@@ -281,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)
|
||||
@@ -306,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,
|
||||
@@ -331,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)
|
||||
@@ -351,6 +371,8 @@ clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
||||
*
|
||||
* Sets or unsets a back pointer to the #ClutterActor that owns
|
||||
* the @meta
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
_clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
||||
@@ -366,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)
|
||||
|
@@ -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,13 +19,30 @@
|
||||
* 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
|
||||
|
||||
/*< private >
|
||||
* ClutterRedrawFlags:
|
||||
* @CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION: Tells clutter the maximum
|
||||
* extents of what needs to be redrawn lies within the actors
|
||||
* current allocation. (Only use this for 2D actors though because
|
||||
* any actor with depth may be projected outside of its allocation)
|
||||
*
|
||||
* Flags passed to the clutter_actor_queue_redraw_with_clip ()
|
||||
* function
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION = 1 << 0
|
||||
} ClutterRedrawFlags;
|
||||
|
||||
/*< private >
|
||||
* ClutterActorTraverseFlags:
|
||||
* CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
|
||||
@@ -93,12 +110,35 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor
|
||||
typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
|
||||
gpointer user_data);
|
||||
|
||||
typedef struct _AnchorCoord AnchorCoord;
|
||||
typedef struct _SizeRequest SizeRequest;
|
||||
|
||||
typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
|
||||
typedef struct _ClutterTransformInfo ClutterTransformInfo;
|
||||
typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
|
||||
|
||||
/* Internal helper struct to represent a point that can be stored in
|
||||
either direct pixel coordinates or as a fraction of the actor's
|
||||
size. It is used for the anchor point, scale center and rotation
|
||||
centers. */
|
||||
struct _AnchorCoord
|
||||
{
|
||||
gboolean is_fractional;
|
||||
|
||||
union
|
||||
{
|
||||
/* Used when is_fractional == TRUE */
|
||||
struct
|
||||
{
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
} fraction;
|
||||
|
||||
/* Use when is_fractional == FALSE */
|
||||
graphene_point3d_t units;
|
||||
} v;
|
||||
};
|
||||
|
||||
struct _SizeRequest
|
||||
{
|
||||
guint age;
|
||||
@@ -143,15 +183,24 @@ ClutterLayoutInfo * _clutter_actor_peek_layout_info
|
||||
|
||||
struct _ClutterTransformInfo
|
||||
{
|
||||
/* rotation */
|
||||
/* rotation (angle and center) */
|
||||
gdouble rx_angle;
|
||||
AnchorCoord rx_center;
|
||||
|
||||
gdouble ry_angle;
|
||||
AnchorCoord ry_center;
|
||||
|
||||
gdouble rz_angle;
|
||||
AnchorCoord rz_center;
|
||||
|
||||
/* scaling */
|
||||
gdouble scale_x;
|
||||
gdouble scale_y;
|
||||
gdouble scale_z;
|
||||
AnchorCoord scale_center;
|
||||
|
||||
/* anchor point */
|
||||
AnchorCoord anchor;
|
||||
|
||||
/* translation */
|
||||
graphene_point3d_t translation;
|
||||
@@ -163,10 +212,10 @@ struct _ClutterTransformInfo
|
||||
graphene_point_t pivot;
|
||||
gfloat pivot_z;
|
||||
|
||||
graphene_matrix_t transform;
|
||||
CoglMatrix transform;
|
||||
guint transform_set : 1;
|
||||
|
||||
graphene_matrix_t child_transform;
|
||||
CoglMatrix child_transform;
|
||||
guint child_transform_set : 1;
|
||||
};
|
||||
|
||||
@@ -203,11 +252,11 @@ void _clutter_actor_traverse
|
||||
gpointer user_data);
|
||||
ClutterActor * _clutter_actor_get_stage_internal (ClutterActor *actor);
|
||||
|
||||
void _clutter_actor_apply_modelview_transform (ClutterActor *self,
|
||||
graphene_matrix_t *matrix);
|
||||
void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
graphene_matrix_t *matrix);
|
||||
void _clutter_actor_apply_modelview_transform (ClutterActor *self,
|
||||
CoglMatrix *matrix);
|
||||
void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
CoglMatrix *matrix);
|
||||
|
||||
void _clutter_actor_rerealize (ClutterActor *self,
|
||||
ClutterCallback callback,
|
||||
@@ -228,55 +277,50 @@ void _clutter_actor_set_has_pointer
|
||||
void _clutter_actor_set_has_key_focus (ClutterActor *self,
|
||||
gboolean has_key_focus);
|
||||
|
||||
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
ClutterRedrawFlags flags,
|
||||
const ClutterPaintVolume *clip_volume);
|
||||
void _clutter_actor_queue_redraw_full (ClutterActor *self,
|
||||
ClutterRedrawFlags flags,
|
||||
const ClutterPaintVolume *volume,
|
||||
ClutterEffect *effect);
|
||||
|
||||
void _clutter_actor_finish_queue_redraw (ClutterActor *self);
|
||||
void _clutter_actor_finish_queue_redraw (ClutterActor *self,
|
||||
ClutterPaintVolume *clip);
|
||||
|
||||
gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self,
|
||||
GType check_gtype,
|
||||
ClutterPaintVolume *volume);
|
||||
|
||||
const char * _clutter_actor_get_debug_name (ClutterActor *self);
|
||||
const gchar * _clutter_actor_get_debug_name (ClutterActor *self);
|
||||
|
||||
void _clutter_actor_push_clone_paint (void);
|
||||
void _clutter_actor_pop_clone_paint (void);
|
||||
|
||||
void _clutter_actor_shader_pre_paint (ClutterActor *actor,
|
||||
gboolean repeat);
|
||||
void _clutter_actor_shader_post_paint (ClutterActor *actor);
|
||||
|
||||
ClutterActorAlign _clutter_actor_get_effective_x_align (ClutterActor *self);
|
||||
|
||||
void _clutter_actor_handle_event (ClutterActor *actor,
|
||||
const ClutterEvent *event);
|
||||
|
||||
void _clutter_actor_attach_clone (ClutterActor *actor,
|
||||
ClutterActor *clone);
|
||||
void _clutter_actor_detach_clone (ClutterActor *actor,
|
||||
ClutterActor *clone);
|
||||
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
|
||||
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
|
||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor,
|
||||
gboolean stop_transitions);
|
||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
||||
|
||||
float clutter_actor_get_real_resource_scale (ClutterActor *actor);
|
||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
||||
float *resource_scale);
|
||||
|
||||
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
CoglTexture *texture);
|
||||
|
||||
void clutter_actor_finish_layout (ClutterActor *self,
|
||||
int phase);
|
||||
|
||||
void clutter_actor_queue_immediate_relayout (ClutterActor *self);
|
||||
|
||||
gboolean clutter_actor_is_painting_unmapped (ClutterActor *self);
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
|
||||
@@ -81,6 +81,22 @@ G_BEGIN_DECLS
|
||||
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;
|
||||
|
||||
@@ -102,7 +118,12 @@ typedef void (*ClutterCallback) (ClutterActor *actor,
|
||||
*/
|
||||
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
|
||||
|
||||
|
||||
/**
|
||||
* ClutterActor:
|
||||
* @flags: #ClutterActorFlags
|
||||
*
|
||||
* Base class for actors.
|
||||
*/
|
||||
struct _ClutterActor
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -121,6 +142,11 @@ struct _ClutterActor
|
||||
* ClutterActorClass:
|
||||
* @show: signal class handler for #ClutterActor::show; it must chain
|
||||
* up to the parent's implementation
|
||||
* @show_all: virtual function for containers and composite actors, to
|
||||
* determine which children should be shown when calling
|
||||
* clutter_actor_show_all() on the actor. Defaults to calling
|
||||
* clutter_actor_show(). This virtual function is deprecated and it
|
||||
* should not be overridden.
|
||||
* @hide: signal class handler for #ClutterActor::hide; it must chain
|
||||
* up to the parent's implementation
|
||||
* @hide_all: virtual function for containers and composite actors, to
|
||||
@@ -157,15 +183,13 @@ struct _ClutterActor
|
||||
* implementation.
|
||||
* @apply_transform: virtual function, used when applying the transformations
|
||||
* to an actor before painting it or when transforming coordinates or
|
||||
* the allocation; if the transformation calculated by this function may
|
||||
* have changed, the cached transformation must be invalidated by calling
|
||||
* clutter_actor_invalidate_transform(); it must chain up to the parent's
|
||||
* implementation
|
||||
* the allocation; it must chain up to the parent's implementation
|
||||
* @parent_set: signal class handler for the #ClutterActor::parent-set
|
||||
* @destroy: signal class handler for #ClutterActor::destroy. It must
|
||||
* chain up to the parent's implementation
|
||||
* @pick: virtual function, used to draw an outline of the actor with
|
||||
* the given color
|
||||
* @queue_redraw: class handler for #ClutterActor::queue-redraw
|
||||
* @event: class handler for #ClutterActor::event
|
||||
* @button_press_event: class handler for #ClutterActor::button-press-event
|
||||
* @button_release_event: class handler for
|
||||
@@ -202,6 +226,7 @@ struct _ClutterActorClass
|
||||
|
||||
/*< public >*/
|
||||
void (* show) (ClutterActor *self);
|
||||
void (* show_all) (ClutterActor *self);
|
||||
void (* hide) (ClutterActor *self);
|
||||
void (* hide_all) (ClutterActor *self);
|
||||
void (* realize) (ClutterActor *self);
|
||||
@@ -217,6 +242,10 @@ struct _ClutterActorClass
|
||||
void (* pick) (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
ClutterPaintVolume *paint_volume);
|
||||
|
||||
/* size negotiation */
|
||||
void (* get_preferred_width) (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
@@ -231,27 +260,27 @@ struct _ClutterActorClass
|
||||
|
||||
/* transformations */
|
||||
void (* apply_transform) (ClutterActor *actor,
|
||||
graphene_matrix_t *matrix);
|
||||
ClutterMatrix *matrix);
|
||||
|
||||
/* event signals */
|
||||
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);
|
||||
@@ -271,11 +300,12 @@ 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);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[25];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -286,13 +316,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
|
||||
@@ -336,8 +370,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
|
||||
@@ -385,9 +419,7 @@ CLUTTER_EXPORT
|
||||
void clutter_actor_allocate (ClutterActor *self,
|
||||
const ClutterActorBox *box);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_allocate_preferred_size (ClutterActor *self,
|
||||
float x,
|
||||
float y);
|
||||
void clutter_actor_allocate_preferred_size (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_allocate_available_size (ClutterActor *self,
|
||||
gfloat x,
|
||||
@@ -422,10 +454,6 @@ void clutter_actor_set_position
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_get_fixed_position (ClutterActor *self,
|
||||
float *x,
|
||||
float *y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_position (ClutterActor *self,
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
@@ -557,8 +585,7 @@ void clutter_actor_set_offscreen_redirect
|
||||
CLUTTER_EXPORT
|
||||
ClutterOffscreenRedirect clutter_actor_get_offscreen_redirect (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_should_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context);
|
||||
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_is_in_clone_paint (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@@ -566,7 +593,8 @@ gboolean clutter_actor_get_paint_box
|
||||
ClutterActorBox *box);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
float clutter_actor_get_resource_scale (ClutterActor *self);
|
||||
gboolean clutter_actor_get_resource_scale (ClutterActor *self,
|
||||
gfloat *resource_scale);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_overlaps (ClutterActor *self);
|
||||
@@ -595,13 +623,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);
|
||||
@@ -616,6 +637,8 @@ const ClutterPaintVolume * clutter_actor_get_paint_volume
|
||||
CLUTTER_EXPORT
|
||||
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
|
||||
@@ -775,21 +798,16 @@ void clutter_actor_get_translation
|
||||
gfloat *translate_z);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_transform (ClutterActor *self,
|
||||
const graphene_matrix_t *transform);
|
||||
const ClutterMatrix *transform);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_transform (ClutterActor *self,
|
||||
graphene_matrix_t *transform);
|
||||
ClutterMatrix *transform);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_child_transform (ClutterActor *self,
|
||||
const graphene_matrix_t *transform);
|
||||
const ClutterMatrix *transform);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_child_transform (ClutterActor *self,
|
||||
graphene_matrix_t *transform);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_transformed_extents (ClutterActor *self,
|
||||
graphene_rect_t *rect);
|
||||
|
||||
ClutterMatrix *transform);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_transformed_position (ClutterActor *self,
|
||||
gfloat *x,
|
||||
@@ -876,7 +894,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);
|
||||
@@ -899,13 +919,6 @@ void clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GList * clutter_actor_peek_stage_views (ClutterActor *self);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_invalidate_transform (ClutterActor *self);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_invalidate_paint_volume (ClutterActor *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_H__ */
|
||||
|
@@ -23,25 +23,27 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:
|
||||
*
|
||||
* A constraint aligning the position of an actor
|
||||
* SECTION:clutter-align-constraint
|
||||
* @Title: ClutterAlignConstraint
|
||||
* @Short_Description: A constraint aligning the position of an actor
|
||||
*
|
||||
* #ClutterAlignConstraint is a [class@Constraint] that aligns the position
|
||||
* of the [class@Actor] to which it is applied to the size of another
|
||||
* [class@Actor] using an alignment factor
|
||||
* #ClutterAlignConstraint is a #ClutterConstraint that aligns the position
|
||||
* of the #ClutterActor to which it is applied to the size of another
|
||||
* #ClutterActor using an alignment factor
|
||||
*
|
||||
* #ClutterAlignConstraint is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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>
|
||||
|
||||
@@ -56,7 +58,6 @@ struct _ClutterAlignConstraint
|
||||
ClutterActor *actor;
|
||||
ClutterActor *source;
|
||||
ClutterAlignAxis align_axis;
|
||||
graphene_point_t pivot;
|
||||
gfloat factor;
|
||||
};
|
||||
|
||||
@@ -71,7 +72,6 @@ enum
|
||||
|
||||
PROP_SOURCE,
|
||||
PROP_ALIGN_AXIS,
|
||||
PROP_PIVOT_POINT,
|
||||
PROP_FACTOR,
|
||||
|
||||
PROP_LAST
|
||||
@@ -84,11 +84,12 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
|
||||
static void
|
||||
source_queue_relayout (ClutterActor *actor,
|
||||
ClutterAlignConstraint *align)
|
||||
source_position_changed (ClutterActor *actor,
|
||||
GParamSpec *pspec,
|
||||
ClutterAlignConstraint *align)
|
||||
{
|
||||
if (align->actor != NULL)
|
||||
_clutter_actor_queue_only_relayout (align->actor);
|
||||
clutter_actor_queue_relayout (align->actor);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -133,41 +134,35 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint);
|
||||
gfloat source_width, source_height;
|
||||
gfloat actor_width, actor_height;
|
||||
gfloat offset_x_start, offset_y_start;
|
||||
gfloat pivot_x, pivot_y;
|
||||
gfloat source_x, source_y;
|
||||
|
||||
if (align->source == NULL)
|
||||
return;
|
||||
|
||||
clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
|
||||
|
||||
clutter_actor_get_position (align->source, &source_x, &source_y);
|
||||
clutter_actor_get_size (align->source, &source_width, &source_height);
|
||||
|
||||
pivot_x = align->pivot.x == -1.f
|
||||
? align->factor
|
||||
: align->pivot.x;
|
||||
pivot_y = align->pivot.y == -1.f
|
||||
? align->factor
|
||||
: align->pivot.y;
|
||||
|
||||
offset_x_start = pivot_x * -actor_width;
|
||||
offset_y_start = pivot_y * -actor_height;
|
||||
|
||||
switch (align->align_axis)
|
||||
{
|
||||
case CLUTTER_ALIGN_X_AXIS:
|
||||
allocation->x1 += offset_x_start + (source_width * align->factor);
|
||||
allocation->x1 = ((source_width - actor_width) * align->factor)
|
||||
+ source_x;
|
||||
allocation->x2 = allocation->x1 + actor_width;
|
||||
break;
|
||||
|
||||
case CLUTTER_ALIGN_Y_AXIS:
|
||||
allocation->y1 += offset_y_start + (source_height * align->factor);
|
||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
||||
+ source_y;
|
||||
allocation->y2 = allocation->y1 + actor_height;
|
||||
break;
|
||||
|
||||
case CLUTTER_ALIGN_BOTH:
|
||||
allocation->x1 += offset_x_start + (source_width * align->factor);
|
||||
allocation->y1 += offset_y_start + (source_height * align->factor);
|
||||
allocation->x1 = ((source_width - actor_width) * align->factor)
|
||||
+ source_x;
|
||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
||||
+ source_y;
|
||||
allocation->x2 = allocation->x1 + actor_width;
|
||||
allocation->y2 = allocation->y1 + actor_height;
|
||||
break;
|
||||
@@ -191,7 +186,7 @@ clutter_align_constraint_dispose (GObject *gobject)
|
||||
G_CALLBACK (source_destroyed),
|
||||
align);
|
||||
g_signal_handlers_disconnect_by_func (align->source,
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
align->source = NULL;
|
||||
}
|
||||
@@ -217,10 +212,6 @@ clutter_align_constraint_set_property (GObject *gobject,
|
||||
clutter_align_constraint_set_align_axis (align, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
case PROP_PIVOT_POINT:
|
||||
clutter_align_constraint_set_pivot_point (align, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_FACTOR:
|
||||
clutter_align_constraint_set_factor (align, g_value_get_float (value));
|
||||
break;
|
||||
@@ -249,16 +240,6 @@ clutter_align_constraint_get_property (GObject *gobject,
|
||||
g_value_set_enum (value, align->align_axis);
|
||||
break;
|
||||
|
||||
case PROP_PIVOT_POINT:
|
||||
{
|
||||
graphene_point_t point;
|
||||
|
||||
clutter_align_constraint_get_pivot_point (align, &point);
|
||||
|
||||
g_value_set_boxed (value, &point);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FACTOR:
|
||||
g_value_set_float (value, align->factor);
|
||||
break;
|
||||
@@ -287,9 +268,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
@@ -297,35 +282,17 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
|
||||
* ClutterAlignConstraint:align-axis:
|
||||
*
|
||||
* The axis to be used to compute the alignment
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_ALIGN_AXIS] =
|
||||
g_param_spec_enum ("align-axis", 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,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:pivot-point:
|
||||
*
|
||||
* The pivot point used by the constraint. The pivot point is the
|
||||
* point in the constraint actor around which the aligning is applied,
|
||||
* with (0, 0) being the top left corner of the actor and (1, 1) the
|
||||
* bottom right corner of the actor.
|
||||
*
|
||||
* For example, setting the pivot point to (0.5, 0.5) and using a factor
|
||||
* of 1 for both axes will align the actors horizontal and vertical
|
||||
* center point with the bottom right corner of the source actor.
|
||||
*
|
||||
* By default, the pivot point is set to (-1, -1), which means it's not
|
||||
* used and the constrained actor will be aligned to always stay inside
|
||||
* the source actor.
|
||||
*/
|
||||
obj_props[PROP_PIVOT_POINT] =
|
||||
g_param_spec_boxed ("pivot-point", NULL, NULL,
|
||||
GRAPHENE_TYPE_POINT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:factor:
|
||||
*
|
||||
@@ -335,9 +302,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
@@ -354,8 +325,6 @@ clutter_align_constraint_init (ClutterAlignConstraint *self)
|
||||
self->actor = NULL;
|
||||
self->source = NULL;
|
||||
self->align_axis = CLUTTER_ALIGN_X_AXIS;
|
||||
self->pivot.x = -1.f;
|
||||
self->pivot.y = -1.f;
|
||||
self->factor = 0.0f;
|
||||
}
|
||||
|
||||
@@ -371,6 +340,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,
|
||||
@@ -392,6 +363,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,
|
||||
@@ -429,15 +402,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
|
||||
G_CALLBACK (source_destroyed),
|
||||
align);
|
||||
g_signal_handlers_disconnect_by_func (old_source,
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
}
|
||||
|
||||
align->source = source;
|
||||
if (align->source != NULL)
|
||||
{
|
||||
g_signal_connect (align->source, "queue-relayout",
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
g_signal_connect (align->source, "notify::allocation",
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
g_signal_connect (align->source, "destroy",
|
||||
G_CALLBACK (source_destroyed),
|
||||
@@ -458,6 +431,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)
|
||||
@@ -473,6 +448,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,
|
||||
@@ -498,6 +475,8 @@ clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
|
||||
* Retrieves the value set using clutter_align_constraint_set_align_axis()
|
||||
*
|
||||
* Return value: the alignment axis
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterAlignAxis
|
||||
clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
|
||||
@@ -508,60 +487,6 @@ clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
|
||||
return align->align_axis;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_align_constraint_set_pivot_point:
|
||||
* @align: a #ClutterAlignConstraint
|
||||
* @pivot_point: A #GraphenePoint
|
||||
*
|
||||
* Sets the pivot point used by the constraint, the pivot point is the
|
||||
* point in the constraint actor around which the aligning is applied,
|
||||
* with (0, 0) being the top left corner of the actor and (1, 1) the
|
||||
* bottom right corner of the actor.
|
||||
*
|
||||
* If -1 is used, the pivot point is unset and the constrained actor
|
||||
* will be aligned to always stay inside the source actor.
|
||||
*/
|
||||
void
|
||||
clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
|
||||
const graphene_point_t *pivot_point)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
|
||||
g_return_if_fail (pivot_point != NULL);
|
||||
g_return_if_fail (pivot_point->x == -1.f ||
|
||||
(pivot_point->x >= 0.f && pivot_point->x <= 1.f));
|
||||
g_return_if_fail (pivot_point->y == -1.f ||
|
||||
(pivot_point->y >= 0.f && pivot_point->y <= 1.f));
|
||||
|
||||
if (graphene_point_equal (&align->pivot, pivot_point))
|
||||
return;
|
||||
|
||||
align->pivot = *pivot_point;
|
||||
|
||||
if (align->actor != NULL)
|
||||
clutter_actor_queue_relayout (align->actor);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_PIVOT_POINT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_align_constraint_get_pivot_point
|
||||
* @align: a #ClutterAlignConstraint
|
||||
* @pivot_point: (out caller-allocates): return location for a #GraphenePoint
|
||||
*
|
||||
* Gets the pivot point used by the constraint set with
|
||||
* clutter_align_constraint_set_pivot_point(). If no custom pivot
|
||||
* point is set, -1 is set.
|
||||
*/
|
||||
void
|
||||
clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
|
||||
graphene_point_t *pivot_point)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
|
||||
g_return_if_fail (pivot_point != NULL);
|
||||
|
||||
*pivot_point = align->pivot;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_align_constraint_set_factor:
|
||||
* @align: a #ClutterAlignConstraint
|
||||
@@ -578,6 +503,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,
|
||||
@@ -600,6 +527,8 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
|
||||
* Retrieves the factor set using clutter_align_constraint_set_factor()
|
||||
*
|
||||
* Return value: the alignment factor
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gfloat
|
||||
clutter_align_constraint_get_factor (ClutterAlignConstraint *align)
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* 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
|
||||
|
||||
@@ -36,6 +37,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraint))
|
||||
#define CLUTTER_IS_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT))
|
||||
|
||||
/**
|
||||
* ClutterAlignConstraint:
|
||||
*
|
||||
* #ClutterAlignConstraint is an opaque structure
|
||||
* whose members cannot be directly accesses
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef struct _ClutterAlignConstraint ClutterAlignConstraint;
|
||||
typedef struct _ClutterAlignConstraintClass ClutterAlignConstraintClass;
|
||||
|
||||
@@ -58,15 +67,11 @@ void clutter_align_constraint_set_align_axis (ClutterAlignConstrai
|
||||
CLUTTER_EXPORT
|
||||
ClutterAlignAxis clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
|
||||
const graphene_point_t *pivot_point);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
|
||||
graphene_point_t *pivot_point);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
|
||||
gfloat factor);
|
||||
CLUTTER_EXPORT
|
||||
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 "clutter/clutter-build-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,12 +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,
|
||||
@@ -185,25 +194,3 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
||||
else
|
||||
return clutter_interval_compute_value (interval, progress, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animatable_get_actor:
|
||||
* @animatable: a #ClutterAnimatable
|
||||
*
|
||||
* Get animated actor.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterActor
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_animatable_get_actor (ClutterAnimatable *animatable)
|
||||
{
|
||||
ClutterAnimatableInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
|
||||
|
||||
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
|
||||
|
||||
g_return_val_if_fail (iface->get_actor, NULL);
|
||||
|
||||
return iface->get_actor (animatable);
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
@@ -49,7 +50,8 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
||||
* animatable property
|
||||
* @interpolate_value: virtual function for interpolating the progress
|
||||
* of a property
|
||||
* @get_actor: virtual function for getting associated actor
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterAnimatableInterface
|
||||
{
|
||||
@@ -70,7 +72,6 @@ struct _ClutterAnimatableInterface
|
||||
ClutterInterval *interval,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -91,7 +92,6 @@ gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
||||
|
@@ -21,7 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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."
|
||||
@@ -50,6 +51,7 @@ 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)
|
||||
@@ -81,9 +83,12 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterZoomAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
|
||||
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))
|
||||
@@ -52,8 +53,6 @@ struct _ClutterBackend
|
||||
gfloat units_per_em;
|
||||
gint32 units_serial;
|
||||
|
||||
float fallback_resource_scale;
|
||||
|
||||
ClutterStageWindow *stage_window;
|
||||
|
||||
ClutterInputMethod *input_method;
|
||||
@@ -65,11 +64,18 @@ struct _ClutterBackendClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* vfuncs */
|
||||
gboolean (* finish_init) (ClutterBackend *backend,
|
||||
gboolean (* pre_parse) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
gboolean (* post_parse) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error);
|
||||
void (* init_events) (ClutterBackend *backend);
|
||||
void (* init_features) (ClutterBackend *backend);
|
||||
void (* add_options) (ClutterBackend *backend,
|
||||
GOptionGroup *group);
|
||||
ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
|
||||
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
CoglDisplay * (* get_display) (ClutterBackend *backend,
|
||||
@@ -79,9 +85,11 @@ struct _ClutterBackendClass
|
||||
gboolean (* create_context) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
|
||||
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
||||
gboolean (* translate_event) (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event);
|
||||
|
||||
gboolean (* is_display_server) (ClutterBackend *backend);
|
||||
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
||||
|
||||
/* signals */
|
||||
void (* resolution_changed) (ClutterBackend *backend);
|
||||
@@ -89,14 +97,33 @@ 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);
|
||||
|
||||
gboolean _clutter_backend_finish_init (ClutterBackend *backend,
|
||||
void _clutter_backend_add_options (ClutterBackend *backend,
|
||||
GOptionGroup *group);
|
||||
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
|
||||
GError **error);
|
||||
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
|
||||
GError **error);
|
||||
|
||||
void _clutter_backend_init_events (ClutterBackend *backend);
|
||||
void _clutter_backend_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void _clutter_backend_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event);
|
||||
|
||||
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
|
||||
|
||||
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
|
||||
PangoFontDescription *font_desc);
|
||||
@@ -107,15 +134,6 @@ void clutter_set_allowed_drivers (const c
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
|
||||
float fallback_resource_scale);
|
||||
|
||||
float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend);
|
||||
|
||||
gboolean clutter_backend_is_display_server (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_backend_destroy (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
||||
|
@@ -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,21 +34,42 @@
|
||||
* #ClutterBackend is the base class abstracting the various implementation;
|
||||
* it provides a basic API to query the backend for generic information
|
||||
* and settings.
|
||||
*
|
||||
* #ClutterBackend is available since Clutter 0.4
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-backend-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"
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#include "cogl/cogl.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"
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#include "wayland/clutter-wayland-compositor.h"
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#ifdef CLUTTER_INPUT_X11
|
||||
#include "x11/clutter-backend-x11.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
#include "egl/clutter-backend-eglnative.h"
|
||||
#endif
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
#include <wayland-server.h>
|
||||
#include "wayland/clutter-wayland-compositor.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_FONT_NAME "Sans 10"
|
||||
|
||||
@@ -66,6 +86,12 @@ G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT)
|
||||
|
||||
static guint backend_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
/* Global for being able to specify a compositor side wayland display
|
||||
* pointer before clutter initialization */
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
static struct wl_display *_wayland_compositor_display;
|
||||
#endif
|
||||
|
||||
static void
|
||||
clutter_backend_dispose (GObject *gobject)
|
||||
{
|
||||
@@ -74,20 +100,28 @@ clutter_backend_dispose (GObject *gobject)
|
||||
/* clear the events still in the queue of the main context */
|
||||
_clutter_clear_events_queue ();
|
||||
|
||||
g_clear_object (&backend->dummy_onscreen);
|
||||
g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref);
|
||||
if (backend->stage_window)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (backend->stage_window),
|
||||
(gpointer *) &backend->stage_window);
|
||||
backend->stage_window = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&backend->cogl_source, g_source_destroy);
|
||||
g_clear_pointer (&backend->font_name, g_free);
|
||||
g_clear_pointer (&backend->font_options, cairo_font_options_destroy);
|
||||
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (gobject);
|
||||
|
||||
g_source_destroy (backend->cogl_source);
|
||||
|
||||
g_free (backend->font_name);
|
||||
clutter_backend_set_font_options (backend, NULL);
|
||||
g_clear_object (&backend->input_method);
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
|
||||
G_OBJECT_CLASS (clutter_backend_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static gfloat
|
||||
@@ -188,20 +222,22 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
CoglSwapChain *swap_chain;
|
||||
GError *internal_error;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
|
||||
swap_chain = NULL;
|
||||
internal_error = NULL;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Creating Cogl renderer");
|
||||
backend->cogl_renderer = klass->get_renderer (backend, error);
|
||||
backend->cogl_renderer = klass->get_renderer (backend, &internal_error);
|
||||
|
||||
if (backend->cogl_renderer == NULL)
|
||||
goto error;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Connecting the renderer");
|
||||
cogl_renderer_set_driver (backend->cogl_renderer, driver_id);
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, error))
|
||||
if (!cogl_renderer_connect (backend->cogl_renderer, &internal_error))
|
||||
goto error;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Creating Cogl swap chain");
|
||||
@@ -213,7 +249,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
backend->cogl_display = klass->get_display (backend,
|
||||
backend->cogl_renderer,
|
||||
swap_chain,
|
||||
error);
|
||||
&internal_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,7 +265,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
*/
|
||||
res = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
|
||||
tmpl,
|
||||
error);
|
||||
&internal_error);
|
||||
|
||||
if (!res)
|
||||
goto error;
|
||||
@@ -243,12 +279,17 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
if (backend->cogl_display == NULL)
|
||||
goto error;
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
cogl_wayland_display_set_compositor_display (backend->cogl_display,
|
||||
_wayland_compositor_display);
|
||||
#endif
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Setting up the display");
|
||||
if (!cogl_display_setup (backend->cogl_display, error))
|
||||
if (!cogl_display_setup (backend->cogl_display, &internal_error))
|
||||
goto error;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Creating the Cogl context");
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display, error);
|
||||
backend->cogl_context = cogl_context_new (backend->cogl_display, &internal_error);
|
||||
if (backend->cogl_context == NULL)
|
||||
goto error;
|
||||
|
||||
@@ -282,7 +323,8 @@ 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 },
|
||||
};
|
||||
@@ -351,7 +393,8 @@ clutter_backend_real_create_context (ClutterBackend *backend,
|
||||
if (internal_error != NULL)
|
||||
g_propagate_error (error, internal_error);
|
||||
else
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
g_set_error_literal (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Unable to initialize the Clutter backend: no available drivers found.");
|
||||
|
||||
return FALSE;
|
||||
@@ -363,19 +406,143 @@ clutter_backend_real_create_context (ClutterBackend *backend,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_backend_real_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterFeatureFlags flags = 0;
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
|
||||
flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer");
|
||||
flags |= CLUTTER_FEATURE_STAGE_STATIC;
|
||||
}
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
|
||||
flags |= CLUTTER_FEATURE_SWAP_THROTTLE;
|
||||
}
|
||||
else
|
||||
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
|
||||
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static const char *allowed_backends;
|
||||
|
||||
static ClutterBackend * (* custom_backend_func) (void);
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
ClutterBackend * (* create_backend) (void);
|
||||
} available_backends[] = {
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
{ CLUTTER_WINDOWING_X11, clutter_backend_x11_new },
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
{ CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new },
|
||||
#endif
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
void
|
||||
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
||||
{
|
||||
custom_backend_func = func;
|
||||
}
|
||||
|
||||
ClutterBackend *
|
||||
_clutter_create_backend (void)
|
||||
{
|
||||
const char *backends_list;
|
||||
ClutterBackend *retval;
|
||||
gboolean allow_any;
|
||||
char **backends;
|
||||
int i;
|
||||
|
||||
if (custom_backend_func)
|
||||
{
|
||||
retval = custom_backend_func ();
|
||||
|
||||
if (!retval)
|
||||
g_error ("Failed to create custom backend.");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (allowed_backends == NULL)
|
||||
allowed_backends = "*";
|
||||
|
||||
allow_any = strstr (allowed_backends, "*") != NULL;
|
||||
|
||||
backends_list = g_getenv ("CLUTTER_BACKEND");
|
||||
if (backends_list == NULL)
|
||||
backends_list = allowed_backends;
|
||||
|
||||
backends = g_strsplit (backends_list, ",", 0);
|
||||
|
||||
retval = NULL;
|
||||
|
||||
for (i = 0; retval == NULL && backends[i] != NULL; i++)
|
||||
{
|
||||
const char *backend = backends[i];
|
||||
gboolean is_any = g_str_equal (backend, "*");
|
||||
int j;
|
||||
|
||||
for (j = 0; available_backends[j].name != NULL; j++)
|
||||
{
|
||||
if ((is_any && allow_any) ||
|
||||
(is_any && strstr (allowed_backends, available_backends[j].name)) ||
|
||||
g_str_equal (backend, available_backends[j].name))
|
||||
{
|
||||
retval = available_backends[j].create_backend ();
|
||||
if (retval != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (backends);
|
||||
|
||||
if (retval == NULL)
|
||||
g_error ("No default Clutter backend found.");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_real_init_events (ClutterBackend *backend)
|
||||
{
|
||||
g_error ("Unknown input backend");
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_backend_dispose;
|
||||
gobject_class->finalize = clutter_backend_finalize;
|
||||
|
||||
/**
|
||||
* ClutterBackend::resolution-changed:
|
||||
* @backend: the #ClutterBackend that emitted the signal
|
||||
*
|
||||
* The signal is emitted each time the font
|
||||
* The ::resolution-changed signal is emitted each time the font
|
||||
* resolutions has been changed through #ClutterSettings.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
backend_signals[RESOLUTION_CHANGED] =
|
||||
g_signal_new (I_("resolution-changed"),
|
||||
@@ -389,8 +556,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
* ClutterBackend::font-changed:
|
||||
* @backend: the #ClutterBackend that emitted the signal
|
||||
*
|
||||
* The signal is emitted each time the font options
|
||||
* The ::font-changed signal is emitted each time the font options
|
||||
* have been changed through #ClutterSettings.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
backend_signals[FONT_CHANGED] =
|
||||
g_signal_new (I_("font-changed"),
|
||||
@@ -404,8 +573,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
* ClutterBackend::settings-changed:
|
||||
* @backend: the #ClutterBackend that emitted the signal
|
||||
*
|
||||
* The signal is emitted each time the #ClutterSettings
|
||||
* The ::settings-changed signal is emitted each time the #ClutterSettings
|
||||
* properties have been changed.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
backend_signals[SETTINGS_CHANGED] =
|
||||
g_signal_new (I_("settings-changed"),
|
||||
@@ -418,7 +589,9 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
klass->resolution_changed = clutter_backend_real_resolution_changed;
|
||||
klass->font_changed = clutter_backend_real_font_changed;
|
||||
|
||||
klass->init_events = clutter_backend_real_init_events;
|
||||
klass->create_context = clutter_backend_real_create_context;
|
||||
klass->get_features = clutter_backend_real_get_features;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -428,21 +601,47 @@ clutter_backend_init (ClutterBackend *self)
|
||||
self->units_serial = 1;
|
||||
|
||||
self->dummy_onscreen = NULL;
|
||||
|
||||
self->fallback_resource_scale = 1.f;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_backend_finish_init (ClutterBackend *backend,
|
||||
GError **error)
|
||||
void
|
||||
_clutter_backend_add_options (ClutterBackend *backend,
|
||||
GOptionGroup *group)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->finish_init)
|
||||
return klass->finish_init (backend, error);
|
||||
if (klass->add_options)
|
||||
klass->add_options (backend, group);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_backend_pre_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->pre_parse)
|
||||
return klass->pre_parse (backend, error);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_backend_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->post_parse)
|
||||
return klass->post_parse (backend, error);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -487,6 +686,57 @@ _clutter_backend_create_context (ClutterBackend *backend,
|
||||
return klass->create_context (backend, error);
|
||||
}
|
||||
|
||||
ClutterFeatureFlags
|
||||
_clutter_backend_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
GError *error;
|
||||
|
||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
|
||||
/* we need to have a context here; so we create the
|
||||
* GL context first and the ask for features. if the
|
||||
* context already exists this should be a no-op
|
||||
*/
|
||||
error = NULL;
|
||||
if (klass->create_context != NULL)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
res = klass->create_context (backend, &error);
|
||||
if (!res)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
g_critical ("Unable to create a context: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
g_critical ("Unable to create a context: unknown error");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (klass->get_features)
|
||||
return klass->get_features (backend);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_init_events (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
klass->init_events (backend);
|
||||
}
|
||||
|
||||
gfloat
|
||||
_clutter_backend_get_units_per_em (ClutterBackend *backend,
|
||||
PangoFontDescription *font_desc)
|
||||
@@ -501,6 +751,31 @@ _clutter_backend_get_units_per_em (ClutterBackend *backend,
|
||||
return backend->units_per_em;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->copy_event_data (seat, src, dest);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->free_event_data (seat, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_default_backend:
|
||||
*
|
||||
@@ -510,6 +785,8 @@ _clutter_backend_get_units_per_em (ClutterBackend *backend,
|
||||
* Return value: (transfer none): the default backend. You should
|
||||
* not ref or unref the returned object. Applications should rarely
|
||||
* need to use this.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
ClutterBackend *
|
||||
clutter_get_default_backend (void)
|
||||
@@ -538,6 +815,8 @@ clutter_get_default_backend (void)
|
||||
*
|
||||
* Return value: the current resolution, or -1 if no resolution
|
||||
* has been set.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
gdouble
|
||||
clutter_backend_get_resolution (ClutterBackend *backend)
|
||||
@@ -570,6 +849,8 @@ clutter_backend_get_resolution (ClutterBackend *backend)
|
||||
*
|
||||
* This function is intended for actors creating a Pango layout
|
||||
* using the PangoCairo API.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_backend_set_font_options (ClutterBackend *backend,
|
||||
@@ -600,6 +881,8 @@ clutter_backend_set_font_options (ClutterBackend *backend,
|
||||
* Return value: (transfer none): the font options of the #ClutterBackend.
|
||||
* The returned #cairo_font_options_t is owned by the backend and should
|
||||
* not be modified or freed
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
const cairo_font_options_t *
|
||||
clutter_backend_get_font_options (ClutterBackend *backend)
|
||||
@@ -626,8 +909,18 @@ _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
|
||||
@@ -642,6 +935,9 @@ _clutter_backend_get_units_serial (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)
|
||||
@@ -649,6 +945,31 @@ clutter_backend_get_cogl_context (ClutterBackend *backend)
|
||||
return backend->cogl_context;
|
||||
}
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
/**
|
||||
* clutter_wayland_set_compositor_display:
|
||||
* @display: A compositor side struct wl_display pointer
|
||||
*
|
||||
* This informs Clutter of your compositor side Wayland display
|
||||
* object. This must be called before calling clutter_init().
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
clutter_wayland_set_compositor_display (void *display)
|
||||
{
|
||||
if (_clutter_context_is_initialized ())
|
||||
{
|
||||
g_warning ("%s() can only be used before calling clutter_init()",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
_wayland_compositor_display = display;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
@@ -678,7 +999,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
|
||||
**/
|
||||
@@ -686,12 +1007,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);
|
||||
}
|
||||
|
||||
@@ -716,29 +1031,3 @@ clutter_backend_get_default_seat (ClutterBackend *backend)
|
||||
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
|
||||
float fallback_resource_scale)
|
||||
{
|
||||
backend->fallback_resource_scale = fallback_resource_scale;
|
||||
}
|
||||
|
||||
float
|
||||
clutter_backend_get_fallback_resource_scale (ClutterBackend *backend)
|
||||
{
|
||||
return backend->fallback_resource_scale;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_backend_is_display_server (ClutterBackend *backend)
|
||||
{
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_backend_destroy (ClutterBackend *backend)
|
||||
{
|
||||
g_object_run_dispose (G_OBJECT (backend));
|
||||
g_object_unref (backend);
|
||||
}
|
||||
|
@@ -21,7 +21,8 @@
|
||||
* 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."
|
||||
@@ -30,11 +31,12 @@
|
||||
#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-config.h>
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -42,6 +44,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND, ClutterBackend))
|
||||
#define CLUTTER_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND))
|
||||
|
||||
/**
|
||||
* ClutterBackend:
|
||||
*
|
||||
* #ClutterBackend is an opaque structure whose
|
||||
* members cannot be directly accessed.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
typedef struct _ClutterBackend ClutterBackend;
|
||||
typedef struct _ClutterBackendClass ClutterBackendClass;
|
||||
|
||||
@@ -73,3 +83,5 @@ CLUTTER_EXPORT
|
||||
ClutterSeat * clutter_backend_get_default_seat (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_H__ */
|
||||
|
@@ -30,15 +30,17 @@
|
||||
* across the whole API.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-types.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define FLOAT_EPSILON (1e-15)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ClutterMargin
|
||||
*/
|
||||
@@ -51,11 +53,13 @@
|
||||
* Return value: (transfer full): a newly allocated #ClutterMargin. Use
|
||||
* clutter_margin_free() to free the resources associated with it when
|
||||
* done.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterMargin *
|
||||
clutter_margin_new (void)
|
||||
{
|
||||
return g_new0 (ClutterMargin, 1);
|
||||
return g_slice_new0 (ClutterMargin);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,12 +70,14 @@ clutter_margin_new (void)
|
||||
* the newly created structure.
|
||||
*
|
||||
* Return value: (transfer full): a copy of the #ClutterMargin.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterMargin *
|
||||
clutter_margin_copy (const ClutterMargin *margin_)
|
||||
{
|
||||
if (G_LIKELY (margin_ != NULL))
|
||||
return g_memdup2 (margin_, sizeof (ClutterMargin));
|
||||
return g_slice_dup (ClutterMargin, margin_);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -82,14 +88,205 @@ clutter_margin_copy (const ClutterMargin *margin_)
|
||||
*
|
||||
* Frees the resources allocated by clutter_margin_new() and
|
||||
* clutter_margin_copy().
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_margin_free (ClutterMargin *margin_)
|
||||
{
|
||||
if (G_LIKELY (margin_ != NULL))
|
||||
g_free (margin_);
|
||||
g_slice_free (ClutterMargin, margin_);
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
|
||||
clutter_margin_copy,
|
||||
clutter_margin_free)
|
||||
|
||||
/**
|
||||
* ClutterMatrix:
|
||||
*
|
||||
* A type representing a 4x4 matrix.
|
||||
*
|
||||
* It is identicaly to #CoglMatrix.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
|
||||
static gpointer
|
||||
clutter_matrix_copy (gpointer data)
|
||||
{
|
||||
return cogl_matrix_copy (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_matrix_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
gdouble progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const ClutterMatrix *matrix1 = g_value_get_boxed (a);
|
||||
const ClutterMatrix *matrix2 = g_value_get_boxed (b);
|
||||
graphene_point3d_t scale1 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
|
||||
float shear1[3] = { 0.f, 0.f, 0.f };
|
||||
graphene_point3d_t rotate1 = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
graphene_point3d_t translate1 = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
ClutterVertex4 perspective1 = { 0.f, 0.f, 0.f, 0.f };
|
||||
graphene_point3d_t scale2 = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
|
||||
float shear2[3] = { 0.f, 0.f, 0.f };
|
||||
graphene_point3d_t rotate2 = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
graphene_point3d_t translate2 = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
ClutterVertex4 perspective2 = { 0.f, 0.f, 0.f, 0.f };
|
||||
graphene_point3d_t scale_res = GRAPHENE_POINT3D_INIT (1.f, 1.f, 1.f);
|
||||
float shear_res = 0.f;
|
||||
graphene_point3d_t rotate_res = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
graphene_point3d_t translate_res = GRAPHENE_POINT3D_INIT_ZERO;
|
||||
ClutterVertex4 perspective_res = { 0.f, 0.f, 0.f, 0.f };
|
||||
ClutterMatrix res;
|
||||
|
||||
clutter_matrix_init_identity (&res);
|
||||
|
||||
_clutter_util_matrix_decompose (matrix1,
|
||||
&scale1, shear1, &rotate1, &translate1,
|
||||
&perspective1);
|
||||
_clutter_util_matrix_decompose (matrix2,
|
||||
&scale2, shear2, &rotate2, &translate2,
|
||||
&perspective2);
|
||||
|
||||
/* perspective */
|
||||
_clutter_util_vertex4_interpolate (&perspective1, &perspective2, progress, &perspective_res);
|
||||
res.wx = perspective_res.x;
|
||||
res.wy = perspective_res.y;
|
||||
res.wz = perspective_res.z;
|
||||
res.ww = perspective_res.w;
|
||||
|
||||
/* translation */
|
||||
graphene_point3d_interpolate (&translate1, &translate2, progress, &translate_res);
|
||||
cogl_matrix_translate (&res, translate_res.x, translate_res.y, translate_res.z);
|
||||
|
||||
/* rotation */
|
||||
graphene_point3d_interpolate (&rotate1, &rotate2, progress, &rotate_res);
|
||||
cogl_matrix_rotate (&res, rotate_res.x, 1.0f, 0.0f, 0.0f);
|
||||
cogl_matrix_rotate (&res, rotate_res.y, 0.0f, 1.0f, 0.0f);
|
||||
cogl_matrix_rotate (&res, rotate_res.z, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
/* skew */
|
||||
shear_res = shear1[2] + (shear2[2] - shear1[2]) * progress; /* YZ */
|
||||
if (shear_res != 0.f)
|
||||
_clutter_util_matrix_skew_yz (&res, shear_res);
|
||||
|
||||
shear_res = shear1[1] + (shear2[1] - shear1[1]) * progress; /* XZ */
|
||||
if (shear_res != 0.f)
|
||||
_clutter_util_matrix_skew_xz (&res, shear_res);
|
||||
|
||||
shear_res = shear1[0] + (shear2[0] - shear1[0]) * progress; /* XY */
|
||||
if (shear_res != 0.f)
|
||||
_clutter_util_matrix_skew_xy (&res, shear_res);
|
||||
|
||||
/* scale */
|
||||
graphene_point3d_interpolate (&scale1, &scale2, progress, &scale_res);
|
||||
cogl_matrix_scale (&res, scale_res.x, scale_res.y, scale_res.z);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterMatrix, clutter_matrix,
|
||||
clutter_matrix_copy,
|
||||
clutter_matrix_free,
|
||||
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_matrix_progress))
|
||||
|
||||
/**
|
||||
* clutter_matrix_alloc:
|
||||
*
|
||||
* Allocates enough memory to hold a #ClutterMatrix.
|
||||
*
|
||||
* Return value: (transfer full): the newly allocated #ClutterMatrix
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterMatrix *
|
||||
clutter_matrix_alloc (void)
|
||||
{
|
||||
return g_new0 (ClutterMatrix, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_matrix_free:
|
||||
* @matrix: (allow-none): a #ClutterMatrix
|
||||
*
|
||||
* Frees the memory allocated by clutter_matrix_alloc().
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_matrix_free (ClutterMatrix *matrix)
|
||||
{
|
||||
cogl_matrix_free (matrix);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_matrix_init_identity:
|
||||
* @matrix: a #ClutterMatrix
|
||||
*
|
||||
* Initializes @matrix with the identity matrix, i.e.:
|
||||
*
|
||||
* |[
|
||||
* .xx = 1.0, .xy = 0.0, .xz = 0.0, .xw = 0.0
|
||||
* .yx = 0.0, .yy = 1.0, .yz = 0.0, .yw = 0.0
|
||||
* .zx = 0.0, .zy = 0.0, .zz = 1.0, .zw = 0.0
|
||||
* .wx = 0.0, .wy = 0.0, .wz = 0.0, .ww = 1.0
|
||||
* ]|
|
||||
*
|
||||
* Return value: (transfer none): the initialized #ClutterMatrix
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterMatrix *
|
||||
clutter_matrix_init_identity (ClutterMatrix *matrix)
|
||||
{
|
||||
cogl_matrix_init_identity (matrix);
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_matrix_init_from_array:
|
||||
* @matrix: a #ClutterMatrix
|
||||
* @values: (array fixed-size=16): a C array of 16 floating point values,
|
||||
* representing a 4x4 matrix, with column-major order
|
||||
*
|
||||
* Initializes @matrix with the contents of a C array of floating point
|
||||
* values.
|
||||
*
|
||||
* Return value: (transfer none): the initialzed #ClutterMatrix
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterMatrix *
|
||||
clutter_matrix_init_from_array (ClutterMatrix *matrix,
|
||||
const float values[16])
|
||||
{
|
||||
cogl_matrix_init_from_array (matrix, values);
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_matrix_init_from_matrix:
|
||||
* @a: the #ClutterMatrix to initialize
|
||||
* @b: the #ClutterMatrix to copy
|
||||
*
|
||||
* Initializes the #ClutterMatrix @a with the contents of the
|
||||
* #ClutterMatrix @b.
|
||||
*
|
||||
* Return value: (transfer none): the initialized #ClutterMatrix
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterMatrix *
|
||||
clutter_matrix_init_from_matrix (ClutterMatrix *a,
|
||||
const ClutterMatrix *b)
|
||||
{
|
||||
return memcpy (a, b, sizeof (ClutterMatrix));
|
||||
}
|
||||
|
@@ -21,13 +21,12 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "clutter/clutter-bezier.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter-bezier.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
/*
|
||||
* We have some experimental code here to allow for constant velocity
|
||||
@@ -36,7 +35,7 @@
|
||||
#undef CBZ_L2T_INTERPOLATION
|
||||
|
||||
/****************************************************************************
|
||||
* ClutterBezier -- representation of a cubic bezier curve *
|
||||
* ClutterBezier -- represenation of a cubic bezier curve *
|
||||
* (private; a building block for the public bspline object) *
|
||||
****************************************************************************/
|
||||
|
||||
@@ -105,7 +104,7 @@ struct _ClutterBezier
|
||||
ClutterBezier *
|
||||
_clutter_bezier_new (void)
|
||||
{
|
||||
return g_new0 (ClutterBezier, 1);
|
||||
return g_slice_new0 (ClutterBezier);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -113,7 +112,7 @@ _clutter_bezier_free (ClutterBezier * b)
|
||||
{
|
||||
if (G_LIKELY (b))
|
||||
{
|
||||
g_free (b);
|
||||
g_slice_free (ClutterBezier, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ sqrti (int number)
|
||||
* algorithm does not calculate the square root, but its reciprocal ('y'
|
||||
* below), which is only at the end turned to the inverse value. In order
|
||||
* for the algorithm to produce satisfactory results, the reciprocal value
|
||||
* must be represented with sufficient precision; the 16.16 we use
|
||||
* must be represented with sufficient precission; the 16.16 we use
|
||||
* elsewhere in clutter is not good enough, and 10.22 is used instead.
|
||||
*/
|
||||
_FixedT x;
|
||||
@@ -237,7 +236,7 @@ sqrti (int number)
|
||||
/* Now, we convert the float to 10.22 fixed. We exploit the mechanism
|
||||
* described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf.
|
||||
*
|
||||
* We want 22 bit fraction; a single precision float uses 23 bit
|
||||
* We want 22 bit fraction; a single precission float uses 23 bit
|
||||
* mantisa, so we only need to add 2^(23-22) (no need for the 1.5
|
||||
* multiplier as we are only dealing with positive numbers).
|
||||
*
|
||||
@@ -257,7 +256,7 @@ sqrti (int number)
|
||||
flt2.i = (flt2.i >> 11) * (y_1 >> 11);
|
||||
|
||||
/* If the original argument is less than 342, we do another
|
||||
* iteration to improve precision (for arguments >= 342, the single
|
||||
* iteration to improve precission (for arguments >= 342, the single
|
||||
* iteration produces generally better results).
|
||||
*/
|
||||
if (x < 171)
|
||||
|
@@ -21,11 +21,11 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_BEZIER_H__
|
||||
#define __CLUTTER_BEZIER_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -61,3 +61,5 @@ void _clutter_bezier_adjust (ClutterBezier *b,
|
||||
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:
|
||||
@@ -40,23 +39,25 @@
|
||||
*
|
||||
* The [bin-layout example](https://git.gnome.org/browse/clutter/tree/examples/bin-layout.c?h=clutter-1.18)
|
||||
* shows how to pack actors inside a #ClutterBinLayout.
|
||||
*
|
||||
* #ClutterBinLayout is available since Clutter 1.2
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter/deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-animatable.h"
|
||||
#include "clutter/clutter-bin-layout.h"
|
||||
#include "clutter/clutter-child-meta.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-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))
|
||||
@@ -213,13 +214,19 @@ clutter_bin_layer_class_init (ClutterBinLayerClass *klass)
|
||||
gobject_class->get_property = clutter_bin_layer_get_property;
|
||||
|
||||
layer_props[PROP_LAYER_X_ALIGN] =
|
||||
g_param_spec_enum ("x-align", NULL, NULL,
|
||||
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", NULL, NULL,
|
||||
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);
|
||||
@@ -612,11 +619,16 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
|
||||
* The default horizontal alignment policy for actors managed
|
||||
* by the #ClutterBinLayout
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12: Use the #ClutterActor:x-expand and the
|
||||
* #ClutterActor:x-align properties on #ClutterActor instead.
|
||||
*/
|
||||
bin_props[PROP_X_ALIGN] =
|
||||
g_param_spec_enum ("x-align", NULL, NULL,
|
||||
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);
|
||||
@@ -627,11 +639,16 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
|
||||
* The default vertical alignment policy for actors managed
|
||||
* by the #ClutterBinLayout
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12: Use the #ClutterActor:y-expand and the
|
||||
* #ClutterActor:y-align properties on #ClutterActor instead.
|
||||
*/
|
||||
bin_props[PROP_Y_ALIGN] =
|
||||
g_param_spec_enum ("y-align", NULL, NULL,
|
||||
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);
|
||||
@@ -667,6 +684,8 @@ clutter_bin_layout_init (ClutterBinLayout *self)
|
||||
* Creates a new #ClutterBinLayout layout manager
|
||||
*
|
||||
* Return value: the newly created layout manager
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterLayoutManager *
|
||||
clutter_bin_layout_new (ClutterBinAlignment x_align,
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* 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
|
||||
|
||||
@@ -43,6 +44,14 @@ typedef struct _ClutterBinLayout ClutterBinLayout;
|
||||
typedef struct _ClutterBinLayoutPrivate ClutterBinLayoutPrivate;
|
||||
typedef struct _ClutterBinLayoutClass ClutterBinLayoutClass;
|
||||
|
||||
/**
|
||||
* ClutterBinLayout:
|
||||
*
|
||||
* The #ClutterBinLayout structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBinLayout
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -56,6 +65,8 @@ struct _ClutterBinLayout
|
||||
*
|
||||
* The #ClutterBinLayoutClass structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBinLayoutClass
|
||||
{
|
||||
@@ -71,3 +82,5 @@ ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BIN_LAYOUT_H__ */
|
||||
|
@@ -23,29 +23,27 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:
|
||||
*
|
||||
* A constraint binding the position or size of an actor
|
||||
* SECTION:clutter-bind-constraint
|
||||
* @Title: ClutterBindConstraint
|
||||
* @Short_Description: A constraint binding the position or size of an actor
|
||||
*
|
||||
* #ClutterBindConstraint is a [class@Constraint] that binds the
|
||||
* position or the size of the [class@Actor] to which it is applied
|
||||
* to the the position or the size of another [class@Actor], or
|
||||
* #ClutterBindConstraint is a #ClutterConstraint that binds the
|
||||
* position or the size of the #ClutterActor to which it is applied
|
||||
* to the the position or the size of another #ClutterActor, or
|
||||
* "source".
|
||||
*
|
||||
* An offset can be applied to the constraint, to avoid overlapping. The offset
|
||||
* can also be animated. For instance, the following code will set up three
|
||||
* actors to be bound to the same origin:
|
||||
*
|
||||
* ```c
|
||||
* |[<!-- language="C" -->
|
||||
* // source
|
||||
* rect[0] = clutter_actor_new ();
|
||||
* clutter_actor_set_background_color (rect[0], &red_color);
|
||||
* rect[0] = clutter_rectangle_new_with_color (&red_color);
|
||||
* clutter_actor_set_position (rect[0], x_pos, y_pos);
|
||||
* clutter_actor_set_size (rect[0], 100, 100);
|
||||
*
|
||||
* // second rectangle
|
||||
* rect[1] = clutter_actor_new ();
|
||||
* clutter_actor_set_background_color (rect[1], &green_color);
|
||||
* rect[1] = clutter_rectangle_new_with_color (&green_color);
|
||||
* clutter_actor_set_size (rect[1], 100, 100);
|
||||
* clutter_actor_set_opacity (rect[1], 0);
|
||||
*
|
||||
@@ -55,8 +53,7 @@
|
||||
* clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);
|
||||
*
|
||||
* // third rectangle
|
||||
* rect[2] = clutter_actor_new ();
|
||||
* clutter_actor_set_background_color (rect[2], &blue_color);
|
||||
* rect[2] = clutter_rectangle_new_with_color (&blue_color);
|
||||
* clutter_actor_set_size (rect[2], 100, 100);
|
||||
* clutter_actor_set_opacity (rect[2], 0);
|
||||
*
|
||||
@@ -64,12 +61,12 @@
|
||||
* clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint);
|
||||
* constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
|
||||
* clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* The following code animates the second and third rectangles to "expand"
|
||||
* them horizontally from underneath the first rectangle:
|
||||
*
|
||||
* ```c
|
||||
* |[<!-- language="C" -->
|
||||
* clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250,
|
||||
* "@constraints.green-x.offset", 100.0,
|
||||
* "opacity", 255,
|
||||
@@ -78,21 +75,23 @@
|
||||
* "@constraints.blue-x.offset", 200.0,
|
||||
* "opacity", 255,
|
||||
* NULL);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* #ClutterBindConstraint is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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))
|
||||
@@ -166,9 +165,6 @@ clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
bind->coordinate == CLUTTER_BIND_ALL))
|
||||
return;
|
||||
|
||||
if (clutter_actor_contains (bind->source, actor))
|
||||
return;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case CLUTTER_ORIENTATION_HORIZONTAL:
|
||||
@@ -390,9 +386,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
|
||||
@@ -400,9 +400,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
|
||||
* ClutterBindConstraint:coordinate:
|
||||
*
|
||||
* The coordinate to be bound
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_COORDINATE] =
|
||||
g_param_spec_enum ("coordinate", NULL, NULL,
|
||||
g_param_spec_enum ("coordinate",
|
||||
P_("Coordinate"),
|
||||
P_("The coordinate to bind"),
|
||||
CLUTTER_TYPE_BIND_COORDINATE,
|
||||
CLUTTER_BIND_X,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
@@ -411,9 +415,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
|
||||
* ClutterBindConstraint:offset:
|
||||
*
|
||||
* The offset, in pixels, to be applied to the binding
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_OFFSET] =
|
||||
g_param_spec_float ("offset", 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,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
@@ -443,6 +451,8 @@ clutter_bind_constraint_init (ClutterBindConstraint *self)
|
||||
* the given @coordinate of the position of @source
|
||||
*
|
||||
* Return value: the newly created #ClutterBindConstraint
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterConstraint *
|
||||
clutter_bind_constraint_new (ClutterActor *source,
|
||||
@@ -464,6 +474,8 @@ clutter_bind_constraint_new (ClutterActor *source,
|
||||
* @source: (allow-none): a #ClutterActor, or %NULL to unset the source
|
||||
*
|
||||
* Sets the source #ClutterActor for the constraint
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
|
||||
@@ -529,6 +541,8 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
|
||||
* Retrieves the #ClutterActor set using clutter_bind_constraint_set_source()
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the source actor
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_bind_constraint_get_source (ClutterBindConstraint *constraint)
|
||||
@@ -544,6 +558,8 @@ clutter_bind_constraint_get_source (ClutterBindConstraint *constraint)
|
||||
* @coordinate: the coordinate to bind
|
||||
*
|
||||
* Sets the coordinate to bind in the constraint
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
|
||||
@@ -569,6 +585,8 @@ clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
|
||||
* Retrieves the bound coordinate of the constraint
|
||||
*
|
||||
* Return value: the bound coordinate
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterBindCoordinate
|
||||
clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint)
|
||||
@@ -585,6 +603,8 @@ clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint)
|
||||
* @offset: the offset to apply, in pixels
|
||||
*
|
||||
* Sets the offset to be applied to the constraint
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
|
||||
@@ -610,6 +630,8 @@ clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
|
||||
* Retrieves the offset set using clutter_bind_constraint_set_offset()
|
||||
*
|
||||
* Return value: the offset, in pixels
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gfloat
|
||||
clutter_bind_constraint_get_offset (ClutterBindConstraint *bind)
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* 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
|
||||
|
||||
@@ -36,6 +37,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraint))
|
||||
#define CLUTTER_IS_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIND_CONSTRAINT))
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:
|
||||
*
|
||||
* #ClutterBindConstraint is an opaque structure
|
||||
* whose members cannot be directly accessed
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef struct _ClutterBindConstraint ClutterBindConstraint;
|
||||
typedef struct _ClutterBindConstraintClass ClutterBindConstraintClass;
|
||||
|
||||
@@ -64,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,21 +84,23 @@
|
||||
* key_event->keyval,
|
||||
* key_event->modifier_state,
|
||||
* G_OBJECT (actor));
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* The [method@BindingPool.activate] function will return %FALSE if
|
||||
* The clutter_binding_pool_activate() function will return %FALSE if
|
||||
* no action for the given key binding was found, if the action was
|
||||
* blocked (using [method@BindingPool.block_action]) or if the
|
||||
* blocked (using clutter_binding_pool_block_action()) or if the
|
||||
* key binding handler returned %FALSE.
|
||||
*
|
||||
* #ClutterBindingPool is available since Clutter 1.0
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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 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))
|
||||
@@ -188,7 +189,7 @@ binding_entry_new (const gchar *name,
|
||||
|
||||
modifiers = modifiers & BINDING_MOD_MASK;
|
||||
|
||||
entry = g_new0 (ClutterBindingEntry, 1);
|
||||
entry = g_slice_new (ClutterBindingEntry);
|
||||
entry->key_val = key_val;
|
||||
entry->modifiers = modifiers;
|
||||
entry->name = (gchar *) g_intern_string (name);
|
||||
@@ -220,7 +221,7 @@ binding_entry_free (gpointer data)
|
||||
|
||||
g_closure_unref (entry->closure);
|
||||
|
||||
g_free (entry);
|
||||
g_slice_free (ClutterBindingEntry, entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,9 +307,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
@@ -340,6 +345,8 @@ clutter_binding_pool_init (ClutterBindingPool *pool)
|
||||
*
|
||||
* Return value: the newly created binding pool with the given
|
||||
* name. Use g_object_unref() when done.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
ClutterBindingPool *
|
||||
clutter_binding_pool_new (const gchar *name)
|
||||
@@ -375,13 +382,15 @@ clutter_binding_pool_new (const gchar *name)
|
||||
* A binding pool for a class can also be retrieved using
|
||||
* clutter_binding_pool_find() with the class type name:
|
||||
*
|
||||
* ```
|
||||
* |[
|
||||
* pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance));
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* Return value: (transfer none): the binding pool for the given class.
|
||||
* The returned #ClutterBindingPool is owned by Clutter and should not
|
||||
* be freed directly
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
ClutterBindingPool *
|
||||
clutter_binding_pool_get_for_class (gpointer klass)
|
||||
@@ -412,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)
|
||||
@@ -454,6 +465,8 @@ clutter_binding_pool_find (const gchar *name)
|
||||
*
|
||||
* Actions can be blocked with clutter_binding_pool_block_action()
|
||||
* and then unblocked using clutter_binding_pool_unblock_action().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_binding_pool_install_action (ClutterBindingPool *pool,
|
||||
@@ -522,6 +535,8 @@ clutter_binding_pool_install_action (ClutterBindingPool *pool,
|
||||
*
|
||||
* Actions can be blocked with clutter_binding_pool_block_action()
|
||||
* and then unblocked using clutter_binding_pool_unblock_action().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_binding_pool_install_closure (ClutterBindingPool *pool,
|
||||
@@ -583,6 +598,8 @@ clutter_binding_pool_install_closure (ClutterBindingPool *pool,
|
||||
*
|
||||
* Actions can be blocked with clutter_binding_pool_block_action()
|
||||
* and then unblocked using clutter_binding_pool_unblock_action().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_binding_pool_override_action (ClutterBindingPool *pool,
|
||||
@@ -645,6 +662,8 @@ clutter_binding_pool_override_action (ClutterBindingPool *pool,
|
||||
*
|
||||
* Actions can be blocked with clutter_binding_pool_block_action()
|
||||
* and then unblocked using clutter_binding_pool_unblock_action().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_binding_pool_override_closure (ClutterBindingPool *pool,
|
||||
@@ -698,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,
|
||||
@@ -724,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,
|
||||
@@ -809,13 +832,13 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry,
|
||||
*
|
||||
* The callback has the following signature:
|
||||
*
|
||||
* ```
|
||||
* |[
|
||||
* void (* callback) (GObject *gobject,
|
||||
* const gchar *action_name,
|
||||
* guint key_val,
|
||||
* ClutterModifierType modifiers,
|
||||
* gpointer user_data);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* Where the #GObject instance is @gobject and the user data
|
||||
* is the one passed when installing the action with
|
||||
@@ -826,6 +849,8 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry,
|
||||
* will not be invoked, and this function will return %FALSE.
|
||||
*
|
||||
* Return value: %TRUE if an action was found and was activated
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean
|
||||
clutter_binding_pool_activate (ClutterBindingPool *pool,
|
||||
@@ -857,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,
|
||||
@@ -886,6 +913,8 @@ clutter_binding_pool_block_action (ClutterBindingPool *pool,
|
||||
* Unblocking an action does not cause the callback bound to it to
|
||||
* be invoked in case clutter_binding_pool_activate() was called on
|
||||
* an action previously blocked with clutter_binding_pool_block_action().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_binding_pool_unblock_action (ClutterBindingPool *pool,
|
||||
|
@@ -21,15 +21,15 @@
|
||||
* 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
|
||||
|
||||
@@ -37,6 +37,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPool))
|
||||
#define CLUTTER_IS_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BINDING_POOL))
|
||||
|
||||
/**
|
||||
* ClutterBindingPool:
|
||||
*
|
||||
* Container of key bindings. The #ClutterBindingPool struct is
|
||||
* private.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
typedef struct _ClutterBindingPool ClutterBindingPool;
|
||||
typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
|
||||
|
||||
@@ -54,6 +62,8 @@ typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
|
||||
*
|
||||
* Return value: the function should return %TRUE if the key
|
||||
* binding has been handled, and return %FALSE otherwise
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
typedef gboolean (* ClutterBindingActionFunc) (GObject *gobject,
|
||||
const gchar *action_name,
|
||||
@@ -121,3 +131,5 @@ void clutter_binding_pool_unblock_action (ClutterBindingPool
|
||||
const gchar *action_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BINDING_POOL_H__ */
|
||||
|
@@ -23,27 +23,31 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBlurEffect:
|
||||
*
|
||||
* A blur effect
|
||||
* SECTION:clutter-blur-effect
|
||||
* @short_description: A blur effect
|
||||
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
|
||||
*
|
||||
* #ClutterBlurEffect is a sub-class of #ClutterEffect that allows blurring a
|
||||
* actor and its contents.
|
||||
*
|
||||
* #ClutterBlurEffect is available since Clutter 1.4
|
||||
*/
|
||||
|
||||
#define CLUTTER_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
|
||||
#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/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-blur-effect.h"
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#include "clutter-blur-effect.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#define BLUR_PADDING 2
|
||||
|
||||
@@ -77,6 +81,9 @@ struct _ClutterBlurEffect
|
||||
|
||||
gint pixel_step_uniform;
|
||||
|
||||
gint tex_width;
|
||||
gint tex_height;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
};
|
||||
|
||||
@@ -91,33 +98,86 @@ G_DEFINE_TYPE (ClutterBlurEffect,
|
||||
clutter_blur_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture)
|
||||
static gboolean
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *blur_effect = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
|
||||
if (blur_effect->pixel_step_uniform > -1)
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
|
||||
self->actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
|
||||
if (self->actor == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
float pixel_step[2];
|
||||
int tex_width, tex_height;
|
||||
|
||||
tex_width = cogl_texture_get_width (texture);
|
||||
tex_height = cogl_texture_get_height (texture);
|
||||
|
||||
pixel_step[0] = 1.0f / tex_width;
|
||||
pixel_step[1] = 1.0f / tex_height;
|
||||
|
||||
cogl_pipeline_set_uniform_float (blur_effect->pipeline,
|
||||
blur_effect->pixel_step_uniform,
|
||||
2, /* n_components */
|
||||
1, /* count */
|
||||
pixel_step);
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
* forcibly disable the ActorMeta
|
||||
*/
|
||||
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
|
||||
"or the current GL driver does not implement support "
|
||||
"for the GLSL shading language.");
|
||||
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cogl_pipeline_set_layer_texture (blur_effect->pipeline, 0, texture);
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
CoglHandle texture;
|
||||
|
||||
return cogl_object_ref (blur_effect->pipeline);
|
||||
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
|
||||
self->tex_width = cogl_texture_get_width (texture);
|
||||
self->tex_height = cogl_texture_get_height (texture);
|
||||
|
||||
if (self->pixel_step_uniform > -1)
|
||||
{
|
||||
gfloat pixel_step[2];
|
||||
|
||||
pixel_step[0] = 1.0f / self->tex_width;
|
||||
pixel_step[1] = 1.0f / self->tex_height;
|
||||
|
||||
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||
self->pixel_step_uniform,
|
||||
2, /* n_components */
|
||||
1, /* count */
|
||||
pixel_step);
|
||||
}
|
||||
|
||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
|
||||
|
||||
cogl_pipeline_set_color4ub (self->pipeline,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
self->pipeline,
|
||||
0, 0,
|
||||
self->tex_width, self->tex_height);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -165,10 +225,11 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
|
||||
|
||||
gobject_class->dispose = clutter_blur_effect_dispose;
|
||||
|
||||
effect_class->pre_paint = clutter_blur_effect_pre_paint;
|
||||
effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume;
|
||||
|
||||
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
||||
offscreen_class->create_pipeline = clutter_blur_effect_create_pipeline;
|
||||
offscreen_class->paint_target = clutter_blur_effect_paint_target;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -207,6 +268,8 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
|
||||
* clutter_actor_add_effect()
|
||||
*
|
||||
* Return value: the newly created #ClutterBlurEffect or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterEffect *
|
||||
clutter_blur_effect_new (void)
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* 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-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -36,6 +37,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffect))
|
||||
#define CLUTTER_IS_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BLUR_EFFECT))
|
||||
|
||||
/**
|
||||
* ClutterBlurEffect:
|
||||
*
|
||||
* #ClutterBlurEffect is an opaque structure
|
||||
* whose members cannot be accessed directly
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef struct _ClutterBlurEffect ClutterBlurEffect;
|
||||
typedef struct _ClutterBlurEffectClass ClutterBlurEffectClass;
|
||||
|
||||
@@ -46,3 +55,5 @@ CLUTTER_EXPORT
|
||||
ClutterEffect *clutter_blur_effect_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BLUR_EFFECT_H__ */
|
||||
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Endless OS Foundation, LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterBlur ClutterBlur;
|
||||
|
||||
ClutterBlur * clutter_blur_new (CoglTexture *texture,
|
||||
float sigma);
|
||||
|
||||
void clutter_blur_apply (ClutterBlur *blur);
|
||||
|
||||
CoglTexture * clutter_blur_get_texture (ClutterBlur *blur);
|
||||
|
||||
void clutter_blur_free (ClutterBlur *blur);
|
||||
|
||||
G_END_DECLS
|
@@ -1,431 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Endless OS Foundation, LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-blur-private.h"
|
||||
|
||||
#include "clutter/clutter-backend.h"
|
||||
|
||||
/**
|
||||
* SECTION:clutter-blur
|
||||
* @short_description: Blur textures
|
||||
*
|
||||
* #ClutterBlur is a moderately fast gaussian blur implementation.
|
||||
*
|
||||
* # Optimizations
|
||||
*
|
||||
* There are a number of optimizations in place to make this blur implementation
|
||||
* real-time. All in all, the implementation performs best when using large
|
||||
* blur-radii that allow downscaling the texture to smaller sizes, at small
|
||||
* radii where no downscaling is possible this can easily halve the framerate.
|
||||
*
|
||||
* ## Multipass
|
||||
*
|
||||
* It is implemented in 2 passes: vertical and horizontal.
|
||||
*
|
||||
* ## Downscaling
|
||||
*
|
||||
* #ClutterBlur uses dynamic downscaling to speed up blurring. Downscaling
|
||||
* happens in factors of 2 (the image is downscaled either by 2, 4, 8, 16, …)
|
||||
* and depends on the blur radius, the texture size, among others.
|
||||
*
|
||||
* The texture is drawn into a downscaled framebuffer; the blur passes are
|
||||
* applied on the downscaled texture contents; and finally, the blurred
|
||||
* contents are drawn
|
||||
* upscaled again.
|
||||
*
|
||||
* ## Hardware Interpolation
|
||||
*
|
||||
* This blur implementation cuts down the number of sampling operations by
|
||||
* exploiting the hardware interpolation that is performed when sampling between
|
||||
* pixel boundaries. This technique is described at:
|
||||
*
|
||||
* http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
|
||||
*
|
||||
* ## Incremental gauss-factor calculation
|
||||
*
|
||||
* The kernel values for the gaussian kernel are computed incrementally instead
|
||||
* of running the expensive calculations multiple times inside the blur shader.
|
||||
* The implementation is based on the algorithm presented by K. Turkowski in
|
||||
* GPU Gems 3, chapter 40:
|
||||
*
|
||||
* https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html
|
||||
*
|
||||
*/
|
||||
|
||||
static const char *gaussian_blur_glsl_declarations =
|
||||
"uniform float sigma; \n"
|
||||
"uniform float pixel_step; \n"
|
||||
"uniform vec2 direction; \n";
|
||||
|
||||
static const char *gaussian_blur_glsl =
|
||||
" vec2 uv = vec2 (cogl_tex_coord.st); \n"
|
||||
" \n"
|
||||
" vec3 gauss_coefficient; \n"
|
||||
" gauss_coefficient.x = 1.0 / (sqrt (2.0 * 3.14159265) * sigma); \n"
|
||||
" gauss_coefficient.y = exp (-0.5 / (sigma * sigma)); \n"
|
||||
" gauss_coefficient.z = gauss_coefficient.y * gauss_coefficient.y; \n"
|
||||
" \n"
|
||||
" float gauss_coefficient_total = gauss_coefficient.x; \n"
|
||||
" \n"
|
||||
" vec4 ret = texture2D (cogl_sampler, uv) * gauss_coefficient.x; \n"
|
||||
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
|
||||
" \n"
|
||||
" int n_steps = int (ceil (1.5 * sigma)) * 2; \n"
|
||||
" \n"
|
||||
" for (int i = 1; i <= n_steps; i += 2) { \n"
|
||||
" float coefficient_subtotal = gauss_coefficient.x; \n"
|
||||
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
|
||||
" coefficient_subtotal += gauss_coefficient.x; \n"
|
||||
" \n"
|
||||
" float gauss_ratio = gauss_coefficient.x / coefficient_subtotal; \n"
|
||||
" \n"
|
||||
" float foffset = float (i) + gauss_ratio; \n"
|
||||
" vec2 offset = direction * foffset * pixel_step; \n"
|
||||
" \n"
|
||||
" ret += texture2D (cogl_sampler, uv + offset) * coefficient_subtotal; \n"
|
||||
" ret += texture2D (cogl_sampler, uv - offset) * coefficient_subtotal; \n"
|
||||
" \n"
|
||||
" gauss_coefficient_total += 2.0 * coefficient_subtotal; \n"
|
||||
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
|
||||
" } \n"
|
||||
" \n"
|
||||
" cogl_texel = ret / gauss_coefficient_total; \n";
|
||||
|
||||
#define MIN_DOWNSCALE_SIZE 256.f
|
||||
#define MAX_SIGMA 6.f
|
||||
|
||||
enum
|
||||
{
|
||||
VERTICAL,
|
||||
HORIZONTAL,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
CoglPipeline *pipeline;
|
||||
CoglTexture *texture;
|
||||
int orientation;
|
||||
} BlurPass;
|
||||
|
||||
struct _ClutterBlur
|
||||
{
|
||||
CoglTexture *source_texture;
|
||||
float sigma;
|
||||
float downscale_factor;
|
||||
|
||||
BlurPass pass[2];
|
||||
};
|
||||
|
||||
static CoglPipeline*
|
||||
create_blur_pipeline (void)
|
||||
{
|
||||
static CoglPipelineKey blur_pipeline_key = "clutter-blur-pipeline-private";
|
||||
CoglContext *ctx =
|
||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
CoglPipeline *blur_pipeline;
|
||||
|
||||
blur_pipeline =
|
||||
cogl_context_get_named_pipeline (ctx, &blur_pipeline_key);
|
||||
|
||||
if (G_UNLIKELY (blur_pipeline == NULL))
|
||||
{
|
||||
CoglSnippet *snippet;
|
||||
|
||||
blur_pipeline = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_layer_null_texture (blur_pipeline, 0);
|
||||
cogl_pipeline_set_layer_filters (blur_pipeline,
|
||||
0,
|
||||
COGL_PIPELINE_FILTER_LINEAR,
|
||||
COGL_PIPELINE_FILTER_LINEAR);
|
||||
cogl_pipeline_set_layer_wrap_mode (blur_pipeline,
|
||||
0,
|
||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
|
||||
gaussian_blur_glsl_declarations,
|
||||
NULL);
|
||||
cogl_snippet_set_replace (snippet, gaussian_blur_glsl);
|
||||
cogl_pipeline_add_layer_snippet (blur_pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
cogl_context_set_named_pipeline (ctx, &blur_pipeline_key, blur_pipeline);
|
||||
}
|
||||
|
||||
return cogl_pipeline_copy (blur_pipeline);
|
||||
}
|
||||
|
||||
static void
|
||||
update_blur_uniforms (ClutterBlur *blur,
|
||||
BlurPass *pass)
|
||||
{
|
||||
gboolean vertical = pass->orientation == VERTICAL;
|
||||
int sigma_uniform;
|
||||
int pixel_step_uniform;
|
||||
int direction_uniform;
|
||||
|
||||
pixel_step_uniform =
|
||||
cogl_pipeline_get_uniform_location (pass->pipeline, "pixel_step");
|
||||
if (pixel_step_uniform > -1)
|
||||
{
|
||||
float pixel_step;
|
||||
|
||||
if (vertical)
|
||||
pixel_step = 1.f / cogl_texture_get_height (pass->texture);
|
||||
else
|
||||
pixel_step = 1.f / cogl_texture_get_width (pass->texture);
|
||||
|
||||
cogl_pipeline_set_uniform_1f (pass->pipeline,
|
||||
pixel_step_uniform,
|
||||
pixel_step);
|
||||
}
|
||||
|
||||
sigma_uniform = cogl_pipeline_get_uniform_location (pass->pipeline, "sigma");
|
||||
if (sigma_uniform > -1)
|
||||
{
|
||||
cogl_pipeline_set_uniform_1f (pass->pipeline,
|
||||
sigma_uniform,
|
||||
blur->sigma / blur->downscale_factor);
|
||||
}
|
||||
|
||||
direction_uniform =
|
||||
cogl_pipeline_get_uniform_location (pass->pipeline, "direction");
|
||||
if (direction_uniform > -1)
|
||||
{
|
||||
gboolean horizontal = !vertical;
|
||||
float direction[2] = {
|
||||
horizontal,
|
||||
vertical,
|
||||
};
|
||||
|
||||
cogl_pipeline_set_uniform_float (pass->pipeline,
|
||||
direction_uniform,
|
||||
2, 1,
|
||||
direction);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_fbo (ClutterBlur *blur,
|
||||
BlurPass *pass)
|
||||
{
|
||||
CoglContext *ctx =
|
||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
float scaled_height;
|
||||
float scaled_width;
|
||||
float height;
|
||||
float width;
|
||||
|
||||
g_clear_pointer (&pass->texture, cogl_object_unref);
|
||||
g_clear_object (&pass->framebuffer);
|
||||
|
||||
width = cogl_texture_get_width (blur->source_texture);
|
||||
height = cogl_texture_get_height (blur->source_texture);
|
||||
scaled_width = floorf (width / blur->downscale_factor);
|
||||
scaled_height = floorf (height / blur->downscale_factor);
|
||||
|
||||
pass->texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||
scaled_width,
|
||||
scaled_height));
|
||||
if (!pass->texture)
|
||||
return FALSE;
|
||||
|
||||
pass->framebuffer =
|
||||
COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (pass->texture));
|
||||
if (!pass->framebuffer)
|
||||
{
|
||||
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cogl_framebuffer_orthographic (pass->framebuffer,
|
||||
0.0, 0.0,
|
||||
scaled_width,
|
||||
scaled_height,
|
||||
0.0, 1.0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
setup_blur_pass (ClutterBlur *blur,
|
||||
BlurPass *pass,
|
||||
int orientation,
|
||||
CoglTexture *texture)
|
||||
{
|
||||
pass->orientation = orientation;
|
||||
pass->pipeline = create_blur_pipeline ();
|
||||
cogl_pipeline_set_layer_texture (pass->pipeline, 0, texture);
|
||||
|
||||
if (!create_fbo (blur, pass))
|
||||
return FALSE;
|
||||
|
||||
update_blur_uniforms (blur, pass);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static float
|
||||
calculate_downscale_factor (float width,
|
||||
float height,
|
||||
float sigma)
|
||||
{
|
||||
float downscale_factor = 1.f;
|
||||
float scaled_width = width;
|
||||
float scaled_height = height;
|
||||
float scaled_sigma = sigma;
|
||||
|
||||
/* This is the algorithm used by Firefox; keep downscaling until either the
|
||||
* blur radius is lower than the threshold, or the downscaled texture is too
|
||||
* small.
|
||||
*/
|
||||
while (scaled_sigma > MAX_SIGMA &&
|
||||
scaled_width > MIN_DOWNSCALE_SIZE &&
|
||||
scaled_height > MIN_DOWNSCALE_SIZE)
|
||||
{
|
||||
downscale_factor *= 2.f;
|
||||
|
||||
scaled_width = width / downscale_factor;
|
||||
scaled_height = height / downscale_factor;
|
||||
scaled_sigma = sigma / downscale_factor;
|
||||
}
|
||||
|
||||
return downscale_factor;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_blur_pass (BlurPass *pass)
|
||||
{
|
||||
CoglColor transparent;
|
||||
|
||||
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
|
||||
|
||||
cogl_framebuffer_clear (pass->framebuffer,
|
||||
COGL_BUFFER_BIT_COLOR,
|
||||
&transparent);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (pass->framebuffer,
|
||||
pass->pipeline,
|
||||
0, 0,
|
||||
cogl_texture_get_width (pass->texture),
|
||||
cogl_texture_get_height (pass->texture));
|
||||
}
|
||||
|
||||
static void
|
||||
clear_blur_pass (BlurPass *pass)
|
||||
{
|
||||
g_clear_pointer (&pass->pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&pass->texture, cogl_object_unref);
|
||||
g_clear_object (&pass->framebuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_blur_new:
|
||||
* @texture: a #CoglTexture
|
||||
* @sigma: blur sigma
|
||||
*
|
||||
* Creates a new #ClutterBlur.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A newly created #ClutterBlur
|
||||
*/
|
||||
ClutterBlur *
|
||||
clutter_blur_new (CoglTexture *texture,
|
||||
float sigma)
|
||||
{
|
||||
ClutterBlur *blur;
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
BlurPass *hpass;
|
||||
BlurPass *vpass;
|
||||
|
||||
g_return_val_if_fail (texture != NULL, NULL);
|
||||
g_return_val_if_fail (sigma >= 0.0, NULL);
|
||||
|
||||
width = cogl_texture_get_width (texture);
|
||||
height = cogl_texture_get_height (texture);
|
||||
|
||||
blur = g_new0 (ClutterBlur, 1);
|
||||
blur->sigma = sigma;
|
||||
blur->source_texture = cogl_object_ref (texture);
|
||||
blur->downscale_factor = calculate_downscale_factor (width, height, sigma);
|
||||
|
||||
if (G_APPROX_VALUE (sigma, 0.0, FLT_EPSILON))
|
||||
goto out;
|
||||
|
||||
vpass = &blur->pass[VERTICAL];
|
||||
hpass = &blur->pass[HORIZONTAL];
|
||||
|
||||
if (!setup_blur_pass (blur, vpass, VERTICAL, texture) ||
|
||||
!setup_blur_pass (blur, hpass, HORIZONTAL, vpass->texture))
|
||||
{
|
||||
clutter_blur_free (blur);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
return g_steal_pointer (&blur);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_blur_apply:
|
||||
* @blur: a #ClutterBlur
|
||||
*
|
||||
* Applies the blur. The resulting texture can be retrieved by
|
||||
* clutter_blur_get_texture().
|
||||
*/
|
||||
void
|
||||
clutter_blur_apply (ClutterBlur *blur)
|
||||
{
|
||||
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
apply_blur_pass (&blur->pass[VERTICAL]);
|
||||
apply_blur_pass (&blur->pass[HORIZONTAL]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_blur_get_texture:
|
||||
* @blur: a #ClutterBlur
|
||||
*
|
||||
* Retrieves the texture where the blurred contents are stored. The
|
||||
* contents are undefined until clutter_blur_apply() is called.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglTexture
|
||||
*/
|
||||
CoglTexture *
|
||||
clutter_blur_get_texture (ClutterBlur *blur)
|
||||
{
|
||||
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
|
||||
return blur->source_texture;
|
||||
else
|
||||
return blur->pass[HORIZONTAL].texture;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_blur_free:
|
||||
* @blur: A #ClutterBlur
|
||||
*
|
||||
* Frees @blur.
|
||||
*/
|
||||
void
|
||||
clutter_blur_free (ClutterBlur *blur)
|
||||
{
|
||||
g_assert (blur);
|
||||
|
||||
clear_blur_pass (&blur->pass[VERTICAL]);
|
||||
clear_blur_pass (&blur->pass[HORIZONTAL]);
|
||||
cogl_clear_object (&blur->source_texture);
|
||||
g_free (blur);
|
||||
}
|
@@ -26,41 +26,43 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBoxLayout:
|
||||
*
|
||||
* A layout manager arranging children on a single line
|
||||
* SECTION:clutter-box-layout
|
||||
* @short_description: A layout manager arranging children on a single line
|
||||
*
|
||||
* 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 #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 #ClutterBoxLayout:homogeneous boolean property is set, then all widgets will
|
||||
* - if the #ClutterBoxLayout:homogeneous boolean propert 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 clutter_box_layout_set_spacing().
|
||||
*
|
||||
* #ClutterBoxLayout is available since Clutter 1.2
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter/deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter/clutter-box-layout.h"
|
||||
#include "clutter-box-layout.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-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
|
||||
{
|
||||
@@ -73,6 +75,7 @@ struct _ClutterBoxLayoutPrivate
|
||||
|
||||
ClutterOrientation orientation;
|
||||
|
||||
guint is_pack_start : 1;
|
||||
guint is_homogeneous : 1;
|
||||
};
|
||||
|
||||
@@ -82,6 +85,7 @@ enum
|
||||
|
||||
PROP_SPACING,
|
||||
PROP_HOMOGENEOUS,
|
||||
PROP_PACK_START,
|
||||
PROP_ORIENTATION,
|
||||
|
||||
PROP_LAST
|
||||
@@ -163,10 +167,8 @@ get_preferred_size_for_orientation (ClutterBoxLayout *self,
|
||||
ClutterActor *child;
|
||||
gint n_children = 0;
|
||||
gfloat minimum, natural;
|
||||
float largest_min_size, largest_nat_size;
|
||||
|
||||
minimum = natural = 0;
|
||||
largest_min_size = largest_nat_size = 0;
|
||||
|
||||
clutter_actor_iter_init (&iter, container);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
@@ -181,22 +183,8 @@ get_preferred_size_for_orientation (ClutterBoxLayout *self,
|
||||
get_child_size (child, priv->orientation,
|
||||
for_size, &child_min, &child_nat);
|
||||
|
||||
if (priv->is_homogeneous)
|
||||
{
|
||||
largest_min_size = MAX (largest_min_size, child_min);
|
||||
largest_nat_size = MAX (largest_nat_size, child_nat);
|
||||
}
|
||||
else
|
||||
{
|
||||
minimum += child_min;
|
||||
natural += child_nat;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->is_homogeneous)
|
||||
{
|
||||
minimum = largest_min_size * n_children;
|
||||
natural = largest_nat_size * n_children;
|
||||
minimum += child_min;
|
||||
natural += child_nat;
|
||||
}
|
||||
|
||||
if (n_children > 1)
|
||||
@@ -327,8 +315,6 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
size -= (nvis_children - 1) * priv->spacing;
|
||||
|
||||
/* Bring children up to size first */
|
||||
if (isnormal (size) || size == 0)
|
||||
{
|
||||
@@ -593,17 +579,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;
|
||||
|
||||
@@ -715,7 +701,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
|
||||
if (priv->is_homogeneous)
|
||||
{
|
||||
/* If were homogeneous we still need to run the above loop to get the
|
||||
/* If were homogenous we still need to run the above loop to get the
|
||||
* minimum sizes for children that are not going to fill
|
||||
*/
|
||||
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
|
||||
@@ -760,13 +746,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;
|
||||
@@ -818,7 +810,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 */
|
||||
{
|
||||
@@ -833,7 +835,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)
|
||||
{
|
||||
@@ -876,6 +888,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;
|
||||
@@ -904,6 +920,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;
|
||||
@@ -928,9 +948,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 |
|
||||
@@ -941,9 +965,29 @@ 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,
|
||||
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);
|
||||
|
||||
@@ -951,9 +995,13 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
|
||||
* 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -969,6 +1017,7 @@ clutter_box_layout_init (ClutterBoxLayout *self)
|
||||
|
||||
self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
|
||||
self->priv->is_homogeneous = FALSE;
|
||||
self->priv->is_pack_start = FALSE;
|
||||
self->priv->spacing = 0;
|
||||
|
||||
self->priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
|
||||
@@ -981,6 +1030,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)
|
||||
@@ -994,6 +1045,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,
|
||||
@@ -1026,6 +1079,8 @@ clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
|
||||
* 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)
|
||||
@@ -1041,6 +1096,8 @@ 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,
|
||||
@@ -1072,6 +1129,8 @@ 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)
|
||||
@@ -1089,6 +1148,8 @@ 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,
|
||||
@@ -1122,6 +1183,8 @@ 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)
|
||||
@@ -1131,3 +1194,56 @@ clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout)
|
||||
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 layed 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,13 +25,14 @@
|
||||
* 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
|
||||
|
||||
@@ -46,6 +47,14 @@ typedef struct _ClutterBoxLayout ClutterBoxLayout;
|
||||
typedef struct _ClutterBoxLayoutPrivate ClutterBoxLayoutPrivate;
|
||||
typedef struct _ClutterBoxLayoutClass ClutterBoxLayoutClass;
|
||||
|
||||
/**
|
||||
* ClutterBoxLayout:
|
||||
*
|
||||
* The #ClutterBoxLayout structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBoxLayout
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -59,6 +68,8 @@ struct _ClutterBoxLayout
|
||||
*
|
||||
* The #ClutterBoxLayoutClass structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterBoxLayoutClass
|
||||
{
|
||||
@@ -88,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,29 +23,34 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterBrightnessContrastEffect:
|
||||
*
|
||||
* Increase/decrease brightness and/or contrast of actor.
|
||||
* SECTION:clutter-brightness-contrast-effect
|
||||
* @short_description: Increase/decrease brightness and/or contrast of actor.
|
||||
* @see_also: #ClutterEffect, #ClutterOffscreenEffect
|
||||
*
|
||||
* #ClutterBrightnessContrastEffect is a sub-class of #ClutterEffect that
|
||||
* changes the overall brightness of a #ClutterActor.
|
||||
*
|
||||
* #ClutterBrightnessContrastEffect is available since Clutter 1.10
|
||||
*/
|
||||
|
||||
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
|
||||
#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/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#include "clutter/clutter-brightness-contrast-effect.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-brightness-contrast-effect.h"
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterBrightnessContrastEffect
|
||||
{
|
||||
@@ -64,6 +69,9 @@ struct _ClutterBrightnessContrastEffect
|
||||
gint brightness_offset_uniform;
|
||||
gint contrast_uniform;
|
||||
|
||||
gint tex_width;
|
||||
gint tex_height;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
};
|
||||
|
||||
@@ -121,33 +129,75 @@ will_have_no_effect (ClutterBrightnessContrastEffect *self)
|
||||
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
|
||||
}
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_brightness_contrast_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self =
|
||||
CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
|
||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||
|
||||
return cogl_object_ref (self->pipeline);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
|
||||
if (will_have_no_effect (self))
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
* forcibly disable the ActorMeta
|
||||
*/
|
||||
g_warning ("Unable to use the ClutterBrightnessContrastEffect: the "
|
||||
"graphics hardware or the current GL driver does not "
|
||||
"implement support for the GLSL shading language. The "
|
||||
"effect will be disabled.");
|
||||
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
parent_class =
|
||||
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
CoglHandle texture;
|
||||
|
||||
return parent_class->pre_paint (effect, node, paint_context);
|
||||
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
|
||||
self->tex_width = cogl_texture_get_width (texture);
|
||||
self->tex_height = cogl_texture_get_height (texture);
|
||||
|
||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
|
||||
paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||
|
||||
cogl_pipeline_set_color4ub (self->pipeline,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
self->pipeline,
|
||||
0, 0,
|
||||
self->tex_width, self->tex_height);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -247,7 +297,7 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
|
||||
ClutterOffscreenEffectClass *offscreen_class;
|
||||
|
||||
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
||||
offscreen_class->create_pipeline = clutter_brightness_contrast_effect_create_pipeline;
|
||||
offscreen_class->paint_target = clutter_brightness_contrast_effect_paint_target;
|
||||
|
||||
effect_class->pre_paint = clutter_brightness_contrast_effect_pre_paint;
|
||||
|
||||
@@ -265,9 +315,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -281,9 +335,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -409,6 +467,8 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
|
||||
* Return value: (transfer full): the newly created
|
||||
* #ClutterBrightnessContrastEffect or %NULL. Use g_object_unref() when
|
||||
* done.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterEffect *
|
||||
clutter_brightness_contrast_effect_new (void)
|
||||
@@ -426,6 +486,8 @@ clutter_brightness_contrast_effect_new (void)
|
||||
* The range for each component is [-1.0, 1.0] where 0.0 designates no change,
|
||||
* values below 0.0 mean a decrease in brightness, and values above indicate
|
||||
* an increase.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect,
|
||||
@@ -462,6 +524,8 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
|
||||
* change in brightness
|
||||
*
|
||||
* Retrieves the change in brightness used by @effect.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffect *effect,
|
||||
@@ -489,6 +553,8 @@ clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffe
|
||||
* The range of @brightness is [-1.0, 1.0], where 0.0 designates no change;
|
||||
* a value below 0.0 indicates a decrease in brightness; and a value
|
||||
* above 0.0 indicates an increase of brightness.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffect *effect,
|
||||
@@ -510,6 +576,8 @@ clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffe
|
||||
* The range for each component is [-1.0, 1.0] where 0.0 designates no change,
|
||||
* values below 0.0 mean a decrease in contrast, and values above indicate
|
||||
* an increase.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect,
|
||||
@@ -546,6 +614,8 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
|
||||
* change in contrast
|
||||
*
|
||||
* Retrieves the contrast value used by @effect.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect *effect,
|
||||
@@ -573,6 +643,8 @@ clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect
|
||||
* The range for @contrast is [-1.0, 1.0], where 0.0 designates no change;
|
||||
* a value below 0.0 indicates a decrease in contrast; and a value above
|
||||
* 0.0 indicates an increase.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect,
|
||||
|
@@ -22,14 +22,15 @@
|
||||
* 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-color.h>
|
||||
#include <clutter/clutter-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -37,6 +38,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffect))
|
||||
#define CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT))
|
||||
|
||||
/**
|
||||
* ClutterBrightnessContrastEffect:
|
||||
*
|
||||
* #ClutterBrightnessContrastEffect is an opaque structure
|
||||
* whose members cannot be directly accessed
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterBrightnessContrastEffect ClutterBrightnessContrastEffect;
|
||||
typedef struct _ClutterBrightnessContrastEffectClass ClutterBrightnessContrastEffectClass;
|
||||
|
||||
@@ -75,3 +84,5 @@ void clutter_brightness_contrast_effect_get_contrast
|
||||
float *blue);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__ */
|
||||
|
@@ -1,11 +1,14 @@
|
||||
/* The prefix for our gettext translation domains. */
|
||||
#mesondefine GETTEXT_PACKAGE
|
||||
|
||||
/* Mutter version */
|
||||
#mesondefine MUTTER_VERSION
|
||||
|
||||
/* List of Cogl drivers */
|
||||
#mesondefine CLUTTER_DRIVERS
|
||||
|
||||
/* Have evdev support for input handling */
|
||||
#mesondefine HAVE_EVDEV
|
||||
|
||||
/* Building with libwacom for advanced tablet management */
|
||||
#mesondefine HAVE_LIBWACOM
|
||||
|
||||
/* Supports PangoFt2 */
|
||||
#mesondefine HAVE_PANGO_FT2
|
||||
|
@@ -27,10 +27,10 @@
|
||||
* Clutter provides some utility functions for using Cairo.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-cairo.h"
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter-cairo.h"
|
||||
#include "clutter-color.h"
|
||||
|
||||
/**
|
||||
* clutter_cairo_set_source_color:
|
||||
@@ -40,13 +40,15 @@
|
||||
* Utility function for setting the source color of @cr using
|
||||
* a #ClutterColor. This function is the equivalent of:
|
||||
*
|
||||
* ```c
|
||||
* |[
|
||||
* cairo_set_source_rgba (cr,
|
||||
* color->red / 255.0,
|
||||
* color->green / 255.0,
|
||||
* color->blue / 255.0,
|
||||
* color->alpha / 255.0);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_cairo_set_source_color (cairo_t *cr,
|
||||
@@ -73,6 +75,8 @@ clutter_cairo_set_source_color (cairo_t *cr,
|
||||
* @cr: a Cairo context
|
||||
*
|
||||
* Utility function to clear a Cairo context.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_cairo_clear (cairo_t *cr)
|
||||
|
@@ -19,13 +19,14 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -35,6 +36,8 @@ G_BEGIN_DECLS
|
||||
* The #CoglPixelFormat to be used when uploading image data from
|
||||
* and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and
|
||||
* %CAIRO_FORMAT_RGB24 as #cairo_format_t.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
|
||||
/* Cairo stores the data in native byte order as ARGB but Cogl's pixel
|
||||
@@ -54,3 +57,5 @@ void clutter_cairo_set_source_color (cairo_t *cr,
|
||||
const ClutterColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CAIRO_H__ */
|
||||
|
@@ -23,9 +23,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterCanvas:
|
||||
*
|
||||
* Content for 2D painting
|
||||
* SECTION:clutter-canvas
|
||||
* @Title: ClutterCanvas
|
||||
* @Short_Description: Content for 2D painting
|
||||
* @See_Also: #ClutterContent
|
||||
*
|
||||
* The #ClutterCanvas class is a #ClutterContent implementation that allows
|
||||
* drawing using the Cairo API on a 2D surface.
|
||||
@@ -36,27 +37,32 @@
|
||||
* signal when invalidated using clutter_content_invalidate().
|
||||
*
|
||||
* See [canvas.c](https://git.gnome.org/browse/clutter/tree/examples/canvas.c?h=clutter-1.18)
|
||||
* for an example of how to use #ClutterCanvas..
|
||||
* for an example of how to use #ClutterCanvas.
|
||||
*
|
||||
* #ClutterCanvas is available since Clutter 1.10.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cogl/cogl.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "clutter/clutter-canvas.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-backend.h"
|
||||
#include "clutter/clutter-cairo.h"
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-content-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-paint-node.h"
|
||||
#include "clutter/clutter-paint-nodes.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-settings.h"
|
||||
#include "clutter-canvas.h"
|
||||
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#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
|
||||
{
|
||||
@@ -231,9 +237,13 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
|
||||
* ClutterCanvas:width:
|
||||
*
|
||||
* The width of the canvas.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
obj_props[PROP_WIDTH] =
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
g_param_spec_int ("width",
|
||||
P_("Width"),
|
||||
P_("The width of the canvas"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -243,9 +253,13 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
|
||||
* ClutterCanvas:height:
|
||||
*
|
||||
* The height of the canvas.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
obj_props[PROP_HEIGHT] =
|
||||
g_param_spec_int ("height", NULL, NULL,
|
||||
g_param_spec_int ("height",
|
||||
P_("Height"),
|
||||
P_("The height of the canvas"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
G_PARAM_READWRITE |
|
||||
@@ -257,7 +271,9 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
|
||||
* The height of the canvas.
|
||||
*/
|
||||
obj_props[PROP_SCALE_FACTOR] =
|
||||
g_param_spec_float ("scale-factor", NULL, NULL,
|
||||
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 |
|
||||
@@ -279,6 +295,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
|
||||
*
|
||||
* Return value: %TRUE if the signal emission should stop, and
|
||||
* %FALSE otherwise
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
canvas_signals[DRAW] =
|
||||
g_signal_new (I_("draw"),
|
||||
@@ -326,7 +344,9 @@ clutter_canvas_paint_content (ClutterContent *content,
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
|
||||
if (priv->texture == NULL)
|
||||
priv->texture = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (priv->buffer));
|
||||
priv->texture = cogl_texture_new_from_bitmap (priv->buffer,
|
||||
COGL_TEXTURE_NO_SLICING,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32);
|
||||
|
||||
if (priv->texture == NULL)
|
||||
return;
|
||||
@@ -495,6 +515,8 @@ clutter_content_iface_init (ClutterContentInterface *iface)
|
||||
*
|
||||
* Return value: (transfer full): The newly allocated instance of
|
||||
* #ClutterCanvas. Use g_object_unref() when done.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterContent *
|
||||
clutter_canvas_new (void)
|
||||
@@ -557,13 +579,15 @@ clutter_canvas_invalidate_internal (ClutterCanvas *canvas,
|
||||
* the size, you can use the return value of the function to conditionally
|
||||
* call clutter_content_invalidate():
|
||||
*
|
||||
* ```c
|
||||
* |[
|
||||
* if (!clutter_canvas_set_size (canvas, width, height))
|
||||
* clutter_content_invalidate (CLUTTER_CONTENT (canvas));
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* Return value: this function returns %TRUE if the size change
|
||||
* caused a content invalidation, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
gboolean
|
||||
clutter_canvas_set_size (ClutterCanvas *canvas,
|
||||
|
@@ -22,13 +22,14 @@
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -43,6 +44,15 @@ typedef struct _ClutterCanvas ClutterCanvas;
|
||||
typedef struct _ClutterCanvasPrivate ClutterCanvasPrivate;
|
||||
typedef struct _ClutterCanvasClass ClutterCanvasClass;
|
||||
|
||||
/**
|
||||
* ClutterCanvas:
|
||||
*
|
||||
* The #ClutterCanvas structure contains
|
||||
* private data and should only be accessed using the provided
|
||||
* API.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterCanvas
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -57,6 +67,8 @@ struct _ClutterCanvas
|
||||
*
|
||||
* The #ClutterCanvasClass structure contains
|
||||
* private data.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct _ClutterCanvasClass
|
||||
{
|
||||
@@ -68,6 +80,9 @@ struct _ClutterCanvasClass
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _padding[16];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -87,3 +102,5 @@ CLUTTER_EXPORT
|
||||
float clutter_canvas_get_scale_factor (ClutterCanvas *canvas);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CANVAS_H__ */
|
||||
|
@@ -25,51 +25,24 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* ClutterChildMeta:
|
||||
*
|
||||
* Base interface for container specific state for child actors.
|
||||
*
|
||||
* A child data is meant to be used when you need to keep track
|
||||
* of information about each individual child added to a container.
|
||||
* SECTION:clutter-child-meta
|
||||
* @short_description: Wrapper for actors inside a container
|
||||
*
|
||||
* In order to use it you should create your own subclass of
|
||||
* #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
|
||||
* interface member to your subclass type, like:
|
||||
* #ClutterChildMeta is a wrapper object created by #ClutterContainer
|
||||
* implementations in order to store child-specific data and properties.
|
||||
*
|
||||
* ```c
|
||||
* static void
|
||||
* my_container_iface_init (ClutterContainerIface *iface)
|
||||
* {
|
||||
* // set the rest of the #ClutterContainer vtable
|
||||
* A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer.
|
||||
*
|
||||
* container_iface->child_meta_type = MY_TYPE_CHILD_META;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* This will automatically create a #ClutterChildMeta of type
|
||||
* `MY_TYPE_CHILD_META` for every actor that is added to the container.
|
||||
*
|
||||
* The child data for an actor can be retrieved using the
|
||||
* clutter_container_get_child_meta() function.
|
||||
*
|
||||
* The properties of the data and your subclass can be manipulated with
|
||||
* clutter_container_child_set() and clutter_container_child_get() which
|
||||
* act like g_object_set() and g_object_get().
|
||||
*
|
||||
* You can provide hooks for your own storage as well as control the
|
||||
* instantiation by overriding the #ClutterContainerIface virtual functions
|
||||
* #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
|
||||
* and #ClutterContainerIface.get_child_meta().
|
||||
* #ClutterChildMeta is available since Clutter 0.8
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-child-meta.h"
|
||||
#include "clutter/clutter-container.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-private.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);
|
||||
|
||||
@@ -145,9 +118,13 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass)
|
||||
* ClutterChildMeta:container:
|
||||
*
|
||||
* The #ClutterContainer that created this #ClutterChildMeta.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
obj_props[PROP_CONTAINER] =
|
||||
g_param_spec_object ("container", NULL, NULL,
|
||||
g_param_spec_object ("container",
|
||||
P_("Container"),
|
||||
P_("The container that created this data"),
|
||||
CLUTTER_TYPE_CONTAINER,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
@@ -156,9 +133,13 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass)
|
||||
* ClutterChildMeta:actor:
|
||||
*
|
||||
* The #ClutterActor being wrapped by this #ClutterChildMeta
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
obj_props[PROP_ACTOR] =
|
||||
g_param_spec_object ("actor", NULL, NULL,
|
||||
g_param_spec_object ("actor",
|
||||
P_("Actor"),
|
||||
P_("The actor wrapped by this data"),
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
@@ -180,6 +161,8 @@ clutter_child_meta_init (ClutterChildMeta *self)
|
||||
* Retrieves the container using @data
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterContainer
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterContainer *
|
||||
clutter_child_meta_get_container (ClutterChildMeta *data)
|
||||
@@ -196,6 +179,8 @@ clutter_child_meta_get_container (ClutterChildMeta *data)
|
||||
* Retrieves the actor wrapped by @data
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterActor
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_child_meta_get_actor (ClutterChildMeta *data)
|
||||
|
@@ -25,15 +25,15 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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"
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -46,6 +46,46 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterChildMetaClass ClutterChildMetaClass;
|
||||
|
||||
/**
|
||||
* ClutterChildMeta:
|
||||
* @container: the container handling this data
|
||||
* @actor: the actor wrapped by this data
|
||||
*
|
||||
* Base interface for container specific state for child actors. A child
|
||||
* data is meant to be used when you need to keep track of information
|
||||
* about each individual child added to a container.
|
||||
*
|
||||
* In order to use it you should create your own subclass of
|
||||
* #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
|
||||
* interface member to your subclass type, like:
|
||||
*
|
||||
* |[
|
||||
* static void
|
||||
* my_container_iface_init (ClutterContainerIface *iface)
|
||||
* {
|
||||
* // set the rest of the #ClutterContainer vtable
|
||||
*
|
||||
* container_iface->child_meta_type = MY_TYPE_CHILD_META;
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* This will automatically create a #ClutterChildMeta of type
|
||||
* `MY_TYPE_CHILD_META` for every actor that is added to the container.
|
||||
*
|
||||
* The child data for an actor can be retrieved using the
|
||||
* clutter_container_get_child_meta() function.
|
||||
*
|
||||
* The properties of the data and your subclass can be manipulated with
|
||||
* clutter_container_child_set() and clutter_container_child_get() which
|
||||
* act like g_object_set() and g_object_get().
|
||||
*
|
||||
* You can provide hooks for your own storage as well as control the
|
||||
* instantiation by overriding the #ClutterContainerIface virtual functions
|
||||
* #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
|
||||
* and #ClutterContainerIface.get_child_meta().
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
struct _ClutterChildMeta
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -60,6 +100,8 @@ struct _ClutterChildMeta
|
||||
* ClutterChildMetaClass:
|
||||
*
|
||||
* The #ClutterChildMetaClass contains only private data
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
struct _ClutterChildMetaClass
|
||||
{
|
||||
@@ -76,3 +118,5 @@ 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 "clutter/clutter-build-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;
|
||||
@@ -107,7 +114,7 @@ struct _ClutterClickActionPrivate
|
||||
gint drag_threshold;
|
||||
|
||||
guint press_button;
|
||||
ClutterInputDevice *press_device;
|
||||
gint press_device_id;
|
||||
ClutterEventSequence *press_sequence;
|
||||
ClutterModifierType modifier_state;
|
||||
gfloat press_x;
|
||||
@@ -143,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);
|
||||
|
||||
@@ -258,66 +272,34 @@ click_action_cancel_long_press (ClutterClickAction *action)
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
event_within_drag_threshold (ClutterClickAction *click_action,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (click_action);
|
||||
float motion_x, motion_y;
|
||||
float delta_x, delta_y;
|
||||
|
||||
clutter_event_get_coords (event, &motion_x, &motion_y);
|
||||
|
||||
delta_x = ABS (motion_x - priv->press_x);
|
||||
delta_y = ABS (motion_y - priv->press_y);
|
||||
|
||||
return delta_x <= priv->drag_threshold && delta_y <= priv->drag_threshold;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_click_action_handle_event (ClutterAction *action,
|
||||
const ClutterEvent *event)
|
||||
on_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
ClutterClickAction *action)
|
||||
{
|
||||
ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (action);
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (click_action);
|
||||
ClutterActor *actor =
|
||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||
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;
|
||||
priv->press_device = clutter_event_get_device (event);
|
||||
priv->press_device_id = clutter_event_get_device_id (event);
|
||||
priv->press_sequence = clutter_event_get_event_sequence (event);
|
||||
priv->modifier_state = clutter_event_get_state (event);
|
||||
clutter_event_get_coords (event, &priv->press_x, &priv->press_y);
|
||||
@@ -336,47 +318,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) ||
|
||||
clutter_event_get_device (event) != priv->press_device ||
|
||||
(has_button && clutter_event_get_click_count (event) != 1) ||
|
||||
clutter_event_get_device_id (event) != priv->press_device_id ||
|
||||
clutter_event_get_event_sequence (event) != priv->press_sequence)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
click_action_set_held (click_action, FALSE);
|
||||
click_action_cancel_long_press (click_action);
|
||||
click_action_set_held (action, FALSE);
|
||||
click_action_cancel_long_press (action);
|
||||
|
||||
/* disconnect the capture */
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
|
||||
target = clutter_stage_get_device_actor (CLUTTER_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,24 +401,31 @@ clutter_click_action_handle_event (ClutterAction *action,
|
||||
if (modifier_state != priv->modifier_state)
|
||||
priv->modifier_state = 0;
|
||||
|
||||
click_action_set_pressed (click_action, FALSE);
|
||||
|
||||
if (event_within_drag_threshold (click_action, event))
|
||||
g_signal_emit (click_action, click_signals[CLICKED], 0, actor);
|
||||
click_action_set_pressed (action, FALSE);
|
||||
g_signal_emit (action, click_signals[CLICKED], 0, actor);
|
||||
break;
|
||||
|
||||
case CLUTTER_MOTION:
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
{
|
||||
if (clutter_event_get_device (event) != priv->press_device ||
|
||||
gfloat motion_x, motion_y;
|
||||
gfloat delta_x, delta_y;
|
||||
|
||||
if (clutter_event_get_device_id (event) != priv->press_device_id ||
|
||||
clutter_event_get_event_sequence (event) != priv->press_sequence)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
if (!priv->is_held)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
if (!event_within_drag_threshold (click_action, event))
|
||||
clutter_click_action_release (click_action);
|
||||
clutter_event_get_coords (event, &motion_x, &motion_y);
|
||||
|
||||
delta_x = ABS (motion_x - priv->press_x);
|
||||
delta_y = ABS (motion_y - priv->press_y);
|
||||
|
||||
if (delta_x > priv->drag_threshold ||
|
||||
delta_y > priv->drag_threshold)
|
||||
click_action_cancel_long_press (action);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -420,20 +433,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 +444,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 +554,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,9 +582,13 @@ 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,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
@@ -566,9 +596,13 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
||||
* ClutterClickAction:held:
|
||||
*
|
||||
* Whether the clickable actor has the pointer grabbed
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_HELD] =
|
||||
g_param_spec_boolean ("held", NULL, NULL,
|
||||
g_param_spec_boolean ("held",
|
||||
P_("Held"),
|
||||
P_("Whether the clickable has a grab"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
@@ -579,10 +613,14 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
@@ -594,10 +632,14 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
@@ -611,9 +653,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"),
|
||||
@@ -630,7 +674,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.
|
||||
@@ -644,10 +688,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"),
|
||||
@@ -677,6 +723,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)
|
||||
@@ -689,13 +737,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)
|
||||
@@ -709,6 +759,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);
|
||||
@@ -721,6 +774,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)
|
||||
@@ -741,6 +796,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)
|
||||
@@ -761,6 +818,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,9 +22,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterClone:
|
||||
*
|
||||
* An actor that displays a clone of a source actor
|
||||
* SECTION:clutter-clone
|
||||
* @short_description: An actor that displays a clone of a source actor
|
||||
*
|
||||
* #ClutterClone is a #ClutterActor which draws with the paint
|
||||
* function of another actor, scaled to fit its own allocation.
|
||||
@@ -34,24 +33,25 @@
|
||||
* Unlike clutter_texture_new_from_actor(), #ClutterClone does not require
|
||||
* the presence of support for FBOs in the underlying GL or GLES
|
||||
* implementation.
|
||||
*
|
||||
* #ClutterClone is available since Clutter 1.0
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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"
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
#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"
|
||||
|
||||
struct _ClutterClonePrivate
|
||||
{
|
||||
ClutterActor *clone_source;
|
||||
float x_scale, y_scale;
|
||||
|
||||
gulong source_destroy_id;
|
||||
};
|
||||
|
||||
@@ -119,17 +119,36 @@ clutter_clone_get_preferred_height (ClutterActor *self,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clone_apply_transform (ClutterActor *self,
|
||||
graphene_matrix_t *matrix)
|
||||
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
{
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActorBox box, source_box;
|
||||
gfloat x_scale, y_scale;
|
||||
|
||||
|
||||
if (priv->clone_source)
|
||||
graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
|
||||
|
||||
/* First chain up and apply all the standard ClutterActor
|
||||
* transformations... */
|
||||
CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self,
|
||||
matrix);
|
||||
|
||||
/* if we don't have a source, nothing else to do */
|
||||
if (priv->clone_source == NULL)
|
||||
return;
|
||||
|
||||
/* get our allocated size */
|
||||
clutter_actor_get_allocation_box (self, &box);
|
||||
|
||||
/* and get the allocated size of the source */
|
||||
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
|
||||
|
||||
/* We need to scale what the clone-source actor paints to fill our own
|
||||
* allocation...
|
||||
*/
|
||||
x_scale = clutter_actor_box_get_width (&box)
|
||||
/ clutter_actor_box_get_width (&source_box);
|
||||
y_scale = clutter_actor_box_get_height (&box)
|
||||
/ clutter_actor_box_get_height (&source_box);
|
||||
|
||||
cogl_matrix_scale (matrix, x_scale, y_scale, x_scale);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -194,7 +213,7 @@ clutter_clone_get_paint_volume (ClutterActor *actor,
|
||||
if (priv->clone_source == NULL)
|
||||
return TRUE;
|
||||
|
||||
/* query the volume of the source actor and simply masquerade it as
|
||||
/* query the volume of the source actor and simply masquarade it as
|
||||
* the clones volume... */
|
||||
source_volume = clutter_actor_get_paint_volume (priv->clone_source);
|
||||
if (source_volume == NULL)
|
||||
@@ -225,8 +244,6 @@ clutter_clone_allocate (ClutterActor *self,
|
||||
{
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActorClass *parent_class;
|
||||
ClutterActorBox source_box;
|
||||
float x_scale, y_scale;
|
||||
|
||||
/* chain up */
|
||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
|
||||
@@ -240,31 +257,7 @@ clutter_clone_allocate (ClutterActor *self,
|
||||
*/
|
||||
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
||||
!clutter_actor_has_allocation (priv->clone_source))
|
||||
{
|
||||
float x = 0.f;
|
||||
float y = 0.f;
|
||||
|
||||
clutter_actor_get_fixed_position (priv->clone_source, &x, &y);
|
||||
clutter_actor_allocate_preferred_size (priv->clone_source, x, y);
|
||||
}
|
||||
|
||||
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
|
||||
|
||||
/* We need to scale what the clone-source actor paints to fill our own
|
||||
* allocation...
|
||||
*/
|
||||
x_scale = clutter_actor_box_get_width (box)
|
||||
/ clutter_actor_box_get_width (&source_box);
|
||||
y_scale = clutter_actor_box_get_height (box)
|
||||
/ clutter_actor_box_get_height (&source_box);
|
||||
|
||||
if (!G_APPROX_VALUE (priv->x_scale, x_scale, FLT_EPSILON) ||
|
||||
!G_APPROX_VALUE (priv->y_scale, y_scale, FLT_EPSILON))
|
||||
{
|
||||
priv->x_scale = x_scale;
|
||||
priv->y_scale = y_scale;
|
||||
clutter_actor_invalidate_transform (CLUTTER_ACTOR (self));
|
||||
}
|
||||
clutter_actor_allocate_preferred_size (priv->clone_source);
|
||||
|
||||
#if 0
|
||||
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
||||
@@ -353,9 +346,13 @@ 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 |
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
@@ -367,9 +364,6 @@ static void
|
||||
clutter_clone_init (ClutterClone *self)
|
||||
{
|
||||
self->priv = clutter_clone_get_instance_private (self);
|
||||
|
||||
self->priv->x_scale = 1.f;
|
||||
self->priv->y_scale = 1.f;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,6 +373,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)
|
||||
@@ -429,6 +425,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,
|
||||
@@ -448,6 +446,8 @@ clutter_clone_set_source (ClutterClone *self,
|
||||
* Retrieves the source #ClutterActor being cloned by @self.
|
||||
*
|
||||
* Return value: (transfer none): the actor source for the clone
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_clone_get_source (ClutterClone *self)
|
||||
|
@@ -21,13 +21,14 @@
|
||||
* 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
|
||||
|
||||
@@ -42,6 +43,14 @@ typedef struct _ClutterClone ClutterClone;
|
||||
typedef struct _ClutterCloneClass ClutterCloneClass;
|
||||
typedef struct _ClutterClonePrivate ClutterClonePrivate;
|
||||
|
||||
/**
|
||||
* ClutterClone:
|
||||
*
|
||||
* The #ClutterClone structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterClone
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -54,11 +63,19 @@ struct _ClutterClone
|
||||
* 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
|
||||
@@ -73,3 +90,5 @@ CLUTTER_EXPORT
|
||||
ClutterActor * clutter_clone_get_source (ClutterClone *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CLONE_H__ */
|
||||
|
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2022 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Naveen Kumar <naveen1.kumar@intel.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterColorState:
|
||||
*
|
||||
* Color state of each ClutterActor
|
||||
*
|
||||
* The #ClutterColorState class contains the colorspace of each color
|
||||
* states (e.g. sRGB colorspace).
|
||||
*
|
||||
* Each [class@Actor] would own such an object.
|
||||
*
|
||||
* A single #ClutterColorState object can be shared by multiple [class@Actor]
|
||||
* or maybe a separate color state for each [class@Actor] (depending on whether
|
||||
* #ClutterColorState would be statefull or stateless).
|
||||
*
|
||||
* #ClutterColorState, if not set during construction, it will default to sRGB
|
||||
* color state
|
||||
*
|
||||
* The #ClutterColorState would have API to get the colorspace, whether the
|
||||
* actor content is in pq or not, and things like that
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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,
|
||||
CLUTTER_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_color_state_init (ClutterColorState *color_state)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_state_new:
|
||||
*
|
||||
* Create a new ClutterColorState object.
|
||||
*
|
||||
* Return value: A new ClutterColorState object.
|
||||
**/
|
||||
ClutterColorState*
|
||||
clutter_color_state_new (ClutterColorspace colorspace)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_COLOR_STATE,
|
||||
"colorspace", colorspace,
|
||||
NULL);
|
||||
}
|
@@ -19,7 +19,8 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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."
|
||||
@@ -74,3 +75,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,29 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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[] = {
|
||||
@@ -98,6 +110,8 @@ static const ClutterColor static_colors[] = {
|
||||
*
|
||||
* Return value: a pointer to a static color; the returned pointer
|
||||
* is owned by Clutter and it should never be modified or freed
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
const ClutterColor *
|
||||
clutter_color_get_static (ClutterStaticColor color)
|
||||
@@ -597,7 +611,7 @@ parse_hsla (ClutterColor *color,
|
||||
/**
|
||||
* clutter_color_from_string:
|
||||
* @color: (out caller-allocates): return location for a #ClutterColor
|
||||
* @str: a string specifying a color
|
||||
* @str: a string specifiying a color
|
||||
*
|
||||
* Parses a string definition of a color, filling the #ClutterColor.red,
|
||||
* #ClutterColor.green, #ClutterColor.blue and #ClutterColor.alpha fields
|
||||
@@ -635,6 +649,8 @@ parse_hsla (ClutterColor *color,
|
||||
* be fully opaque.
|
||||
*
|
||||
* Return value: %TRUE if parsing succeeded, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean
|
||||
clutter_color_from_string (ClutterColor *color,
|
||||
@@ -767,6 +783,8 @@ clutter_color_from_string (ClutterColor *color,
|
||||
* respectively.
|
||||
*
|
||||
* Return value: (transfer full): a newly-allocated text string
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
gchar *
|
||||
clutter_color_to_string (const ClutterColor *color)
|
||||
@@ -785,12 +803,14 @@ clutter_color_to_string (const ClutterColor *color)
|
||||
* @v1: (type Clutter.Color): a #ClutterColor
|
||||
* @v2: (type Clutter.Color): a #ClutterColor
|
||||
*
|
||||
* Compares two `ClutterColor`s and checks if they are the same.
|
||||
* Compares two #ClutterColor<!-- -->s and checks if they are the same.
|
||||
*
|
||||
* This function can be passed to g_hash_table_new() as the @key_equal_func
|
||||
* parameter, when using `ClutterColor`s as keys in a #GHashTable.
|
||||
* parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
|
||||
*
|
||||
* Return value: %TRUE if the two colors are the same.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
gboolean
|
||||
clutter_color_equal (gconstpointer v1,
|
||||
@@ -820,9 +840,11 @@ clutter_color_equal (gconstpointer v1,
|
||||
* Converts a #ClutterColor to a hash value.
|
||||
*
|
||||
* This function can be passed to g_hash_table_new() as the @hash_func
|
||||
* parameter, when using `ClutterColor`s as keys in a #GHashTable.
|
||||
* parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
|
||||
*
|
||||
* Return value: a hash value corresponding to the color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
guint
|
||||
clutter_color_hash (gconstpointer v)
|
||||
@@ -837,8 +859,10 @@ clutter_color_hash (gconstpointer v)
|
||||
* @progress: the interpolation progress
|
||||
* @result: (out): return location for the interpolation
|
||||
*
|
||||
* Interpolates between @initial and @final `ClutterColor`s
|
||||
* Interpolates between @initial and @final #ClutterColor<!-- -->s
|
||||
* using @progress
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_color_interpolate (const ClutterColor *initial,
|
||||
@@ -880,12 +904,14 @@ clutter_color_progress (const GValue *a,
|
||||
* freed using clutter_color_free().
|
||||
*
|
||||
* Return value: (transfer full): an allocated copy of @color.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_copy (const ClutterColor *color)
|
||||
{
|
||||
if (G_LIKELY (color != NULL))
|
||||
return g_memdup2 (color, sizeof (ClutterColor));
|
||||
return g_slice_dup (ClutterColor, color);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -895,12 +921,14 @@ clutter_color_copy (const ClutterColor *color)
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Frees a color structure created with clutter_color_copy().
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
clutter_color_free (ClutterColor *color)
|
||||
{
|
||||
if (G_LIKELY (color != NULL))
|
||||
g_free (color);
|
||||
g_slice_free (ClutterColor, color);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -914,12 +942,14 @@ clutter_color_free (ClutterColor *color)
|
||||
*
|
||||
* This function is the equivalent of:
|
||||
*
|
||||
* ```c
|
||||
* |[
|
||||
* clutter_color_init (clutter_color_alloc (), red, green, blue, alpha);
|
||||
* ```
|
||||
* ]|
|
||||
*
|
||||
* Return value: (transfer full): the newly allocated color.
|
||||
* Use clutter_color_free() when done
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_new (guint8 red,
|
||||
@@ -941,11 +971,13 @@ clutter_color_new (guint8 red,
|
||||
*
|
||||
* Return value: (transfer full): the newly allocated #ClutterColor; use
|
||||
* clutter_color_free() to free its resources
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_alloc (void)
|
||||
{
|
||||
return g_new0 (ClutterColor, 1);
|
||||
return g_slice_new0 (ClutterColor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -959,6 +991,8 @@ clutter_color_alloc (void)
|
||||
* Initializes @color with the given values.
|
||||
*
|
||||
* Return value: (transfer none): the initialized #ClutterColor
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_init (ClutterColor *color,
|
||||
@@ -1024,6 +1058,8 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterColor, clutter_color,
|
||||
* @color: the color to set
|
||||
*
|
||||
* Sets @value to @color.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_value_set_color (GValue *value,
|
||||
@@ -1041,6 +1077,8 @@ clutter_value_set_color (GValue *value,
|
||||
* Gets the #ClutterColor contained in @value.
|
||||
*
|
||||
* Return value: (transfer none): the color inside the passed #GValue
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
const ClutterColor *
|
||||
clutter_value_get_color (const GValue *value)
|
||||
@@ -1134,6 +1172,8 @@ clutter_param_color_get_type (void)
|
||||
* Creates a #GParamSpec for properties using #ClutterColor.
|
||||
*
|
||||
* Return value: the newly created #GParamSpec
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
GParamSpec *
|
||||
clutter_param_spec_color (const gchar *name,
|
||||
|
@@ -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
|
||||
{
|
||||
@@ -67,6 +63,8 @@ struct _ClutterColor
|
||||
* @a: value for the alpha channel, between 0 and 255
|
||||
*
|
||||
* A macro that initializes a #ClutterColor, to be used when declaring it.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_COLOR_INIT(r,g,b,a) { (r), (g), (b), (a) }
|
||||
|
||||
@@ -153,7 +151,9 @@ void clutter_color_interpolate (const ClutterColor *initial,
|
||||
* CLUTTER_VALUE_HOLDS_COLOR:
|
||||
* @x: a #GValue
|
||||
*
|
||||
* Evaluates to %TRUE if @x holds a `ClutterColor`.
|
||||
* Evaluates to %TRUE if @x holds a #ClutterColor<!-- -->.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
#define CLUTTER_VALUE_HOLDS_COLOR(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_COLOR))
|
||||
|
||||
@@ -165,6 +165,8 @@ typedef struct _ClutterParamSpecColor ClutterParamSpecColor;
|
||||
*
|
||||
* A #GParamSpec subclass for defining properties holding
|
||||
* a #ClutterColor.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _ClutterParamSpecColor
|
||||
{
|
||||
@@ -194,3 +196,5 @@ CLUTTER_EXPORT
|
||||
const ClutterColor *clutter_color_get_static (ClutterStaticColor color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_COLOR_H__ */
|
||||
|
@@ -23,28 +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
|
||||
*/
|
||||
|
||||
#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-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-colorize-effect.h"
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#include "clutter-colorize-effect.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter/clutter-offscreen-effect.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-offscreen-effect.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterColorizeEffect
|
||||
{
|
||||
@@ -55,6 +59,9 @@ struct _ClutterColorizeEffect
|
||||
|
||||
gint tint_uniform;
|
||||
|
||||
gint tex_width;
|
||||
gint tex_height;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
};
|
||||
|
||||
@@ -97,15 +104,70 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
clutter_colorize_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_colorize_effect_create_pipeline (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture)
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *colorize_effect = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
|
||||
cogl_pipeline_set_layer_texture (colorize_effect->pipeline, 0, texture);
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
|
||||
return cogl_object_ref (colorize_effect->pipeline);
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
* forcibly disable the ActorMeta
|
||||
*/
|
||||
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
|
||||
"or the current GL driver does not implement support "
|
||||
"for the GLSL shading language.");
|
||||
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
CoglHandle texture;
|
||||
|
||||
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
|
||||
self->tex_width = cogl_texture_get_width (texture);
|
||||
self->tex_height = cogl_texture_get_height (texture);
|
||||
|
||||
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
|
||||
paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||
|
||||
cogl_pipeline_set_color4ub (self->pipeline,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
self->pipeline,
|
||||
0, 0,
|
||||
self->tex_width, self->tex_height);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -166,11 +228,14 @@ clutter_colorize_effect_get_property (GObject *gobject,
|
||||
static void
|
||||
clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
|
||||
{
|
||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterOffscreenEffectClass *offscreen_class;
|
||||
|
||||
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
||||
offscreen_class->create_pipeline = clutter_colorize_effect_create_pipeline;
|
||||
offscreen_class->paint_target = clutter_colorize_effect_paint_target;
|
||||
|
||||
effect_class->pre_paint = clutter_colorize_effect_pre_paint;
|
||||
|
||||
gobject_class->set_property = clutter_colorize_effect_set_property;
|
||||
gobject_class->get_property = clutter_colorize_effect_get_property;
|
||||
@@ -180,9 +245,13 @@ 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,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
@@ -248,6 +317,8 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
|
||||
* clutter_actor_add_effect()
|
||||
*
|
||||
* Return value: the newly created #ClutterColorizeEffect or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
ClutterEffect *
|
||||
clutter_colorize_effect_new (const ClutterColor *tint)
|
||||
@@ -263,6 +334,8 @@ clutter_colorize_effect_new (const ClutterColor *tint)
|
||||
* @tint: the color to be used
|
||||
*
|
||||
* Sets the tint to be used when colorizing
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
|
||||
@@ -285,6 +358,8 @@ clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
|
||||
* @tint: (out caller-allocates): return location for the color used
|
||||
*
|
||||
* Retrieves the tint used by @effect
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,
|
||||
|
@@ -22,14 +22,15 @@
|
||||
* 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-color.h>
|
||||
#include <clutter/clutter-effect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -37,6 +38,14 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffect))
|
||||
#define CLUTTER_IS_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_COLORIZE_EFFECT))
|
||||
|
||||
/**
|
||||
* ClutterColorizeEffect:
|
||||
*
|
||||
* #ClutterColorizeEffect is an opaque structure
|
||||
* whose members cannot be directly accessed
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef struct _ClutterColorizeEffect ClutterColorizeEffect;
|
||||
typedef struct _ClutterColorizeEffectClass ClutterColorizeEffectClass;
|
||||
|
||||
@@ -54,3 +63,5 @@ void clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,
|
||||
ClutterColor *tint);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_COLORIZE_EFFECT_H__ */
|
||||
|
22
clutter/clutter/clutter-config.h.in
Normal file
22
clutter/clutter/clutter-config.h.in
Normal file
@@ -0,0 +1,22 @@
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_CONFIG_H__
|
||||
#define __CLUTTER_CONFIG_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#mesondefine CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#mesondefine CLUTTER_WINDOWING_X11
|
||||
#mesondefine CLUTTER_INPUT_X11
|
||||
#mesondefine CLUTTER_WINDOWING_GLX
|
||||
#mesondefine CLUTTER_WINDOWING_EGL
|
||||
#mesondefine CLUTTER_INPUT_EVDEV
|
||||
#mesondefine CLUTTER_INPUT_NULL
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONFIG_H__ */
|
@@ -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.
|
||||
@@ -36,6 +37,8 @@
|
||||
* allocation of the actor to which they are applied by overriding the
|
||||
* #ClutterConstraintClass.update_allocation() virtual function.
|
||||
*
|
||||
* #ClutterConstraint is available since Clutter 1.4
|
||||
*
|
||||
* ## Using Constraints
|
||||
*
|
||||
* Constraints can be used with fixed layout managers, like
|
||||
@@ -125,15 +128,15 @@
|
||||
* can be recovered at any point using clutter_actor_meta_get_actor().
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-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,13 +22,14 @@
|
||||
* 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
|
||||
|
||||
@@ -41,6 +42,14 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterConstraintClass ClutterConstraintClass;
|
||||
|
||||
/**
|
||||
* ClutterConstraint:
|
||||
*
|
||||
* The #ClutterConstraint structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterConstraint
|
||||
{
|
||||
/*< private >*/
|
||||
@@ -57,6 +66,8 @@ struct _ClutterConstraint
|
||||
*
|
||||
* The #ClutterConstraintClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterConstraintClass
|
||||
{
|
||||
@@ -74,6 +85,15 @@ 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
|
||||
@@ -113,3 +133,5 @@ CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_constraints (ClutterActor *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_H__ */
|
||||
|
@@ -19,9 +19,10 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
#define __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-container.h"
|
||||
#include <clutter/clutter-container.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -31,3 +32,5 @@ void _clutter_container_emit_actor_removed (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
|
||||
|
@@ -26,23 +26,23 @@
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <glib-object.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter/deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-child-meta.h"
|
||||
#include "clutter/clutter-container-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-marshal.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-child-meta.h"
|
||||
#include "clutter-container-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
|
||||
#define CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED(container,vfunc) \
|
||||
G_STMT_START { \
|
||||
@@ -63,14 +63,20 @@
|
||||
} G_STMT_END
|
||||
|
||||
/**
|
||||
* ClutterContainer:
|
||||
*
|
||||
* An interface for container actors
|
||||
* SECTION:clutter-container
|
||||
* @short_description: An interface for container actors
|
||||
*
|
||||
* #ClutterContainer is an interface implemented by [class@Actor], and
|
||||
* #ClutterContainer is an interface implemented by #ClutterActor, and
|
||||
* it provides some common API for notifying when a child actor is added
|
||||
* or removed, as well as the infrastructure for accessing child properties
|
||||
* through [class@ChildMeta].
|
||||
* through #ClutterChildMeta.
|
||||
*
|
||||
* Until Clutter 1.10, the #ClutterContainer interface was also the public
|
||||
* API for implementing container actors; this part of the interface has
|
||||
* been deprecated: #ClutterContainer has a default implementation which
|
||||
* defers to #ClutterActor the child addition and removal, as well as the
|
||||
* iteration. See the documentation of #ClutterContainerIface for the list
|
||||
* of virtual functions that should be overridden.
|
||||
*/
|
||||
|
||||
enum
|
||||
@@ -113,6 +119,31 @@ container_real_remove (ClutterContainer *container,
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_raise (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
ClutterActor *self = CLUTTER_ACTOR (container);
|
||||
|
||||
clutter_actor_set_child_above_sibling (self, child, sibling);
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_lower (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
ClutterActor *self = CLUTTER_ACTOR (container);
|
||||
|
||||
clutter_actor_set_child_below_sibling (self, child, sibling);
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_sort_depth_order (ClutterContainer *container)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
{
|
||||
@@ -126,8 +157,10 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
* @container: the actor which received the signal
|
||||
* @actor: the new child that has been added to @container
|
||||
*
|
||||
* The signal is emitted each time an actor
|
||||
* The ::actor-added signal is emitted each time an actor
|
||||
* has been added to @container.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
container_signals[ACTOR_ADDED] =
|
||||
g_signal_new (I_("actor-added"),
|
||||
@@ -142,8 +175,10 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
* @container: the actor which received the signal
|
||||
* @actor: the child that has been removed from @container
|
||||
*
|
||||
* The signal is emitted each time an actor
|
||||
* The ::actor-removed signal is emitted each time an actor
|
||||
* is removed from @container.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
container_signals[ACTOR_REMOVED] =
|
||||
g_signal_new (I_("actor-removed"),
|
||||
@@ -160,9 +195,11 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
* @actor: the child that has had a property set
|
||||
* @pspec: (type GParamSpec): the #GParamSpec of the property set
|
||||
*
|
||||
* The signal is emitted each time a property is
|
||||
* The ::child-notify signal is emitted each time a property is
|
||||
* being set through the clutter_container_child_set() and
|
||||
* clutter_container_child_set_property() calls.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
container_signals[CHILD_NOTIFY] =
|
||||
g_signal_new (I_("child-notify"),
|
||||
@@ -176,6 +213,9 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
|
||||
iface->add = container_real_add;
|
||||
iface->remove = container_real_remove;
|
||||
iface->raise = container_real_raise;
|
||||
iface->lower = container_real_lower;
|
||||
iface->sort_depth_order = container_real_sort_depth_order;
|
||||
|
||||
iface->child_meta_type = G_TYPE_INVALID;
|
||||
iface->create_child_meta = create_child_meta;
|
||||
@@ -289,7 +329,7 @@ container_remove_valist (ClutterContainer *container,
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @...: %NULL terminated list of actors to add
|
||||
*
|
||||
* Adds a list of `ClutterActor`s to @container. Each time and
|
||||
* Adds a list of #ClutterActor<!-- -->s to @container. Each time and
|
||||
* actor is added, the "actor-added" signal is emitted. Each actor should
|
||||
* be parented to @container, which takes a reference on the actor. You
|
||||
* cannot add a #ClutterActor to more than one #ClutterContainer.
|
||||
@@ -298,6 +338,8 @@ container_remove_valist (ClutterContainer *container,
|
||||
* deprecated virtual function. The default implementation will
|
||||
* call clutter_actor_add_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
@@ -329,6 +371,8 @@ clutter_container_add (ClutterContainer *container,
|
||||
* deprecated virtual function. The default implementation will
|
||||
* call clutter_actor_add_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
@@ -347,7 +391,7 @@ clutter_container_add_actor (ClutterContainer *container,
|
||||
* @first_actor: first #ClutterActor to remove
|
||||
* @...: a %NULL-terminated list of actors to remove
|
||||
*
|
||||
* Removes a %NULL terminated list of `ClutterActor`s from
|
||||
* Removes a %NULL terminated list of #ClutterActor<!-- -->s from
|
||||
* @container. Each actor should be unparented, so if you want to keep it
|
||||
* around you must hold a reference to it yourself, using g_object_ref().
|
||||
* Each time an actor is removed, the "actor-removed" signal is
|
||||
@@ -357,6 +401,8 @@ clutter_container_add_actor (ClutterContainer *container,
|
||||
* deprecated virtual function. The default implementation will call
|
||||
* clutter_actor_remove_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
@@ -388,6 +434,8 @@ clutter_container_remove (ClutterContainer *container,
|
||||
* deprecated virtual function. The default implementation will call
|
||||
* clutter_actor_remove_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
@@ -400,6 +448,202 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
container_remove_actor (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_get_children:
|
||||
* @container: a #ClutterContainer
|
||||
*
|
||||
* Retrieves all the children of @container.
|
||||
*
|
||||
* Return value: (element-type Clutter.Actor) (transfer container): a list
|
||||
* of #ClutterActor<!-- -->s. Use g_list_free() on the returned
|
||||
* list when done.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_get_children() instead.
|
||||
*/
|
||||
GList *
|
||||
clutter_container_get_children (ClutterContainer *container)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
|
||||
|
||||
return clutter_actor_get_children (CLUTTER_ACTOR (container));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_raise_child: (virtual raise)
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: the actor to raise
|
||||
* @sibling: (allow-none): the sibling to raise to, or %NULL to raise
|
||||
* to the top
|
||||
*
|
||||
* Raises @actor to @sibling level, in the depth ordering.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.raise() virtual function,
|
||||
* which has been deprecated. The default implementation will call
|
||||
* clutter_actor_set_child_above_sibling().
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_raise_child (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
ClutterActor *self;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
|
||||
|
||||
if (actor == sibling)
|
||||
return;
|
||||
|
||||
self = CLUTTER_ACTOR (container);
|
||||
|
||||
if (clutter_actor_get_parent (actor) != self)
|
||||
{
|
||||
g_warning ("Actor of type '%s' is not a child of the container "
|
||||
"of type '%s'",
|
||||
g_type_name (G_OBJECT_TYPE (actor)),
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sibling != NULL &&
|
||||
clutter_actor_get_parent (sibling) != self)
|
||||
{
|
||||
g_warning ("Actor of type '%s' is not a child of the container "
|
||||
"of type '%s'",
|
||||
g_type_name (G_OBJECT_TYPE (sibling)),
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
if (iface->raise != container_real_raise)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::raise() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
iface->raise (container, actor, sibling);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_lower_child: (virtual lower)
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: the actor to raise
|
||||
* @sibling: (allow-none): the sibling to lower to, or %NULL to lower
|
||||
* to the bottom
|
||||
*
|
||||
* Lowers @actor to @sibling level, in the depth ordering.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.lower() virtual function,
|
||||
* which has been deprecated. The default implementation will call
|
||||
* clutter_actor_set_child_below_sibling().
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_lower_child (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
ClutterActor *self;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
|
||||
|
||||
if (actor == sibling)
|
||||
return;
|
||||
|
||||
self = CLUTTER_ACTOR (container);
|
||||
|
||||
if (clutter_actor_get_parent (actor) != self)
|
||||
{
|
||||
g_warning ("Actor of type '%s' is not a child of the container "
|
||||
"of type '%s'",
|
||||
g_type_name (G_OBJECT_TYPE (actor)),
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sibling != NULL&&
|
||||
clutter_actor_get_parent (sibling) != self)
|
||||
{
|
||||
g_warning ("Actor of type '%s' is not a child of the container "
|
||||
"of type '%s'",
|
||||
g_type_name (G_OBJECT_TYPE (sibling)),
|
||||
g_type_name (G_OBJECT_TYPE (container)));
|
||||
return;
|
||||
}
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
if (iface->lower != container_real_lower)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::lower() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
iface->lower (container, actor, sibling);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_sort_depth_order:
|
||||
* @container: a #ClutterContainer
|
||||
*
|
||||
* Sorts a container's children using their depth. This function should not
|
||||
* be normally used by applications.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: The #ClutterContainerIface.sort_depth_order() virtual
|
||||
* function should not be used any more; the default implementation in
|
||||
* #ClutterContainer does not do anything.
|
||||
*/
|
||||
void
|
||||
clutter_container_sort_depth_order (ClutterContainer *container)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
if (iface->sort_depth_order != container_real_sort_depth_order)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::sort_depth_order() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
iface->sort_depth_order (container);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_find_child_by_name:
|
||||
* @container: a #ClutterContainer
|
||||
@@ -410,6 +654,8 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
*
|
||||
* Return value: (transfer none): The child actor with the requested name,
|
||||
* or %NULL if no actor with that name was found.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_container_find_child_by_name (ClutterContainer *container,
|
||||
@@ -422,7 +668,7 @@ clutter_container_find_child_by_name (ClutterContainer *container,
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
|
||||
g_return_val_if_fail (child_name != NULL, NULL);
|
||||
|
||||
children = clutter_actor_get_children (CLUTTER_ACTOR (container));
|
||||
children = clutter_container_get_children (container);
|
||||
|
||||
for (iter = children; iter; iter = g_list_next (iter))
|
||||
{
|
||||
@@ -518,8 +764,10 @@ destroy_child_meta (ClutterContainer *container,
|
||||
* @container specific state for @actor.
|
||||
*
|
||||
* Return value: (transfer none): the #ClutterChildMeta for the @actor child
|
||||
* of @container or %NULL if the specific actor does not exist or the
|
||||
* container is not configured to provide `ClutterChildMeta`s
|
||||
* of @container or %NULL if the specifiec actor does not exist or the
|
||||
* container is not configured to provide #ClutterChildMeta<!-- -->s
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterChildMeta *
|
||||
clutter_container_get_child_meta (ClutterContainer *container,
|
||||
@@ -550,6 +798,8 @@ clutter_container_get_child_meta (ClutterContainer *container,
|
||||
* #ClutterContainer::add() virtual function implementation.
|
||||
*
|
||||
* Applications should not call this function.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_container_create_child_meta (ClutterContainer *container,
|
||||
@@ -584,6 +834,8 @@ clutter_container_create_child_meta (ClutterContainer *container,
|
||||
* #ClutterContainer::add() virtual function implementation.
|
||||
*
|
||||
* Applications should not call this function.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_container_destroy_child_meta (ClutterContainer *container,
|
||||
@@ -612,6 +864,8 @@ clutter_container_destroy_child_meta (ClutterContainer *container,
|
||||
*
|
||||
* Return value: (transfer none): The #GParamSpec for the property or %NULL
|
||||
* if no such property exist.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
GParamSpec *
|
||||
clutter_container_class_find_child_property (GObjectClass *klass,
|
||||
@@ -648,7 +902,9 @@ clutter_container_class_find_child_property (GObjectClass *klass,
|
||||
* Returns an array of #GParamSpec for all child properties.
|
||||
*
|
||||
* Return value: (array length=n_properties) (transfer full): an array
|
||||
* of `GParamSpec`s which should be freed after use.
|
||||
* of #GParamSpec<!-- -->s which should be freed after use.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
GParamSpec **
|
||||
clutter_container_class_list_child_properties (GObjectClass *klass,
|
||||
@@ -709,6 +965,8 @@ container_set_child_property (ClutterContainer *container,
|
||||
* @value: the value.
|
||||
*
|
||||
* Sets a container-specific property on a child of @container.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_container_child_set_property (ClutterContainer *container,
|
||||
@@ -755,6 +1013,8 @@ clutter_container_child_set_property (ClutterContainer *container,
|
||||
* pairs terminated with NULL.
|
||||
*
|
||||
* Sets container specific properties on the child of a container.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_container_child_set (ClutterContainer *container,
|
||||
@@ -848,6 +1108,8 @@ container_get_child_property (ClutterContainer *container,
|
||||
* Note that clutter_container_child_set_property() is really intended for
|
||||
* language bindings, clutter_container_child_set() is much more convenient
|
||||
* for C programming.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_container_child_get_property (ClutterContainer *container,
|
||||
@@ -899,6 +1161,8 @@ clutter_container_child_get_property (ClutterContainer *container,
|
||||
* In general, a copy is made of the property contents and the caller is
|
||||
* responsible for freeing the memory in the appropriate manner for the type, for
|
||||
* instance by calling g_free() or g_object_unref().
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_container_child_get (ClutterContainer *container,
|
||||
@@ -969,6 +1233,8 @@ clutter_container_child_get (ClutterContainer *container,
|
||||
* Calls the #ClutterContainerIface.child_notify() virtual function
|
||||
* of #ClutterContainer. The default implementation will emit the
|
||||
* #ClutterContainer::child-notify signal.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_container_child_notify (ClutterContainer *container,
|
||||
|
@@ -24,15 +24,16 @@
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#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"
|
||||
#include <clutter/clutter-actor.h>
|
||||
#include <clutter/clutter-child-meta.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -43,12 +44,28 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
|
||||
/**
|
||||
* ClutterContainer:
|
||||
*
|
||||
* #ClutterContainer is an opaque structure whose members cannot be directly
|
||||
* accessed
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClutterContainerIface:
|
||||
* @add: virtual function for adding an actor to the container. This virtual
|
||||
* function is deprecated, and it should not be overridden.
|
||||
* @remove: virtual function for removing an actor from the container. This
|
||||
* virtual function is deprecated, and it should not be overridden.
|
||||
* @raise: virtual function for raising a child. This virtual function is
|
||||
* deprecated and it should not be overridden.
|
||||
* @lower: virtual function for lowering a child. This virtual function is
|
||||
* deprecated and it should not be overridden.
|
||||
* @sort_depth_order: virtual function for sorting the children of a
|
||||
* container depending on their depth. This virtual function is deprecated
|
||||
* and it should not be overridden.
|
||||
* @child_meta_type: The GType used for storing auxiliary information about
|
||||
* each of the containers children.
|
||||
* @create_child_meta: virtual function that gets called for each added
|
||||
@@ -57,7 +74,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* fields in the instance and add the record to a data structure for
|
||||
* subsequent access for #ClutterContainerIface::get_child_meta
|
||||
* @destroy_child_meta: virtual function that gets called when a child is
|
||||
* removed; it should release all resources held by the record
|
||||
* removed; it shuld release all resources held by the record
|
||||
* @get_child_meta: return the record for a container child
|
||||
* @actor_added: class handler for #ClutterContainer::actor-added
|
||||
* @actor_removed: class handler for #ClutterContainer::actor-removed
|
||||
@@ -66,6 +83,8 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* Base interface for container actors. The @add and @remove
|
||||
* virtual functions must be provided by any implementation; the other
|
||||
* virtual functions are optional.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
struct _ClutterContainerIface
|
||||
{
|
||||
@@ -78,6 +97,15 @@ struct _ClutterContainerIface
|
||||
void (* remove) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
/* child stacking */
|
||||
void (* raise) (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling);
|
||||
void (* lower) (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *sibling);
|
||||
void (* sort_depth_order) (ClutterContainer *container);
|
||||
|
||||
/* ClutterChildMeta management */
|
||||
GType child_meta_type;
|
||||
void (* create_child_meta) (ClutterContainer *container,
|
||||
@@ -149,3 +177,5 @@ void clutter_container_child_notify (Clutter
|
||||
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 "clutter/clutter-build-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)
|
||||
@@ -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__ */
|
||||
|
@@ -16,9 +16,9 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter/clutter-build-config.h"
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-damage-history.h"
|
||||
#include "clutter-damage-history.h"
|
||||
|
||||
#define DAMAGE_HISTORY_LENGTH 0x10
|
||||
|
||||
|
@@ -16,32 +16,27 @@
|
||||
* 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"
|
||||
|
||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterDamageHistory * clutter_damage_history_new (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_free (ClutterDamageHistory *history);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const cairo_region_t *damage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
||||
#endif /* CLUTTER_DAMAGE_HISTORY_H */
|
||||
|
@@ -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
|
||||
@@ -41,7 +41,6 @@ G_BEGIN_DECLS
|
||||
extern guint clutter_debug_flags;
|
||||
extern guint clutter_pick_debug_flags;
|
||||
extern guint clutter_paint_debug_flags;
|
||||
extern int clutter_max_render_time_constant_us;
|
||||
|
||||
void _clutter_debug_messagev (const char *format,
|
||||
va_list var_args) G_GNUC_PRINTF (1, 0);
|
||||
@@ -49,3 +48,5 @@ void _clutter_debug_message (const char *format,
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEBUG_H__ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user