Compare commits
	
		
			15 Commits
		
	
	
		
			citadel-45
			...
			wip/garnac
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 7e3f96d972 | ||
|   | 5f91d34f88 | ||
|   | d0a708b42c | ||
|   | d940d5e581 | ||
|   | 70f69e5de4 | ||
|   | c2ce0e6795 | ||
|   | adbd566f83 | ||
|   | f511f65a14 | ||
|   | 0942d68f1a | ||
|   | 73d5d837db | ||
|   | ea5b691ac6 | ||
|   | 53d1b11386 | ||
|   | 85e8feca67 | ||
|   | fb47374629 | ||
|   | 9a92d5fe89 | 
							
								
								
									
										107
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										107
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,105 @@ | |||||||
|  | Makefile | ||||||
|  | Makefile.in | ||||||
|  | Makefile.in.in | ||||||
|  | aclocal.m4 | ||||||
|  | autom4te.cache | ||||||
|  | build-aux | ||||||
|  | compile | ||||||
|  | config.guess | ||||||
|  | config.h | ||||||
|  | config.h.in | ||||||
|  | config.log | ||||||
|  | config.status | ||||||
|  | config.sub | ||||||
|  | configure | ||||||
|  | depcomp | ||||||
|  | install-sh | ||||||
|  | intltool-extract.in | ||||||
|  | intltool-merge.in | ||||||
|  | libtool | ||||||
|  | ltmain.sh | ||||||
|  | missing | ||||||
|  | .deps | ||||||
|  | 50-mutter-navigation.xml | ||||||
|  | 50-mutter-system.xml | ||||||
|  | 50-mutter-windows.xml | ||||||
|  | mutter.desktop | ||||||
|  | mutter-wayland.desktop | ||||||
|  | *.o | ||||||
|  | *.a | ||||||
|  | *.lo | ||||||
|  | *.la | ||||||
|  | .libs | ||||||
| *.swp | *.swp | ||||||
|  | *.gir | ||||||
|  | *.typelib | ||||||
|  | stamp-h1 | ||||||
|  | *.gmo | ||||||
|  | *.make | ||||||
|  | *.log | ||||||
|  | *.trs | ||||||
| *~ | *~ | ||||||
| **/tags.* | stamp-it | ||||||
| subprojects/sysprof/ | .intltool-merge-cache | ||||||
| __pycache__/ | POTFILES | ||||||
| .buildconfig | po/*.pot | ||||||
|  | libmutter.pc | ||||||
|  | mutter | ||||||
|  | mutter-restart-helper | ||||||
|  | mutter-test-client | ||||||
|  | mutter-test-runner | ||||||
|  | mutter-test-unit-tests | ||||||
|  | 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 | ||||||
|  | m4/* | ||||||
|  | INSTALL | ||||||
|  | mkinstalldirs | ||||||
|  | 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/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/meta/meta-version.h | ||||||
|  | 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 | ||||||
|  | gtk-doc.m4 | ||||||
|  | intltool.m4 | ||||||
|  | libtool.m4 | ||||||
|  | ltoptions.m4 | ||||||
|  | ltsugar.m4 | ||||||
|  | ltversion.m4 | ||||||
|  | lt~obsolete.m4 | ||||||
|  | .dirstamp | ||||||
|   | |||||||
							
								
								
									
										665
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							
							
						
						
									
										665
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							| @@ -1,665 +0,0 @@ | |||||||
| 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' |  | ||||||
|  |  | ||||||
| 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 |  | ||||||
|  |  | ||||||
| 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] |  | ||||||
|  |  | ||||||
| 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 |  | ||||||
|   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 |  | ||||||
|   artifacts: |  | ||||||
|     expire_in: 1 day |  | ||||||
|     paths: |  | ||||||
|       - build |  | ||||||
|  |  | ||||||
| build-mutter@x86_64: |  | ||||||
|   variables: |  | ||||||
|     EXTRA_MESON_OPTIONS: |  | ||||||
|       -Dkvm_tests=true |  | ||||||
|       -Dkvm_kernel_image=/opt/mutter/bzImage |  | ||||||
|   extends: |  | ||||||
|     - .build-mutter |  | ||||||
|     - .mutter.fedora@x86_64 |  | ||||||
|   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 |  | ||||||
|   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 |  | ||||||
|   artifacts: |  | ||||||
|     paths: |  | ||||||
|       - build/meson-logs |  | ||||||
|  |  | ||||||
| build-without-native-backend-and-wayland@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 |  | ||||||
|         -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 |  | ||||||
|   artifacts: |  | ||||||
|     paths: |  | ||||||
|       - build/meson-logs |  | ||||||
|  |  | ||||||
| build-wayland-only@x86_64: |  | ||||||
|   extends: |  | ||||||
|     - .mutter.distribution-image |  | ||||||
|     - .mutter.fedora@x86_64 |  | ||||||
|   stage: build |  | ||||||
|   needs: |  | ||||||
|     - job: build-fedora-container@x86_64 |  | ||||||
|       artifacts: false |  | ||||||
|   script: |  | ||||||
|     - meson setup . build --werror --prefix /usr |  | ||||||
|         -Dbuildtype=debugoptimized |  | ||||||
|         -Dwayland=true |  | ||||||
|         -Dxwayland=false |  | ||||||
|         -Dcore_tests=false |  | ||||||
|         -Dnative_tests=false |  | ||||||
|         -Dintrospection=false |  | ||||||
|     - meson compile -C build |  | ||||||
|     - sudo meson install --no-rebuild -C build |  | ||||||
|   artifacts: |  | ||||||
|     paths: |  | ||||||
|       - build/meson-logs |  | ||||||
|  |  | ||||||
| .test-setup: |  | ||||||
|   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 |  | ||||||
|     - 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 |  | ||||||
|   artifacts: |  | ||||||
|     expire_in: 1 day |  | ||||||
|     name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" |  | ||||||
|     when: always |  | ||||||
|     paths: |  | ||||||
|       - build |  | ||||||
|       - coverage-*.json |  | ||||||
|  |  | ||||||
| .test-mutter: |  | ||||||
|   extends: |  | ||||||
|     - .mutter.distribution-image |  | ||||||
|     - .test-mutter-base |  | ||||||
|   script: |  | ||||||
|     - glib-compile-schemas $GSETTINGS_SCHEMA_DIR |  | ||||||
|     - xvfb-run -a -s "$XVFB_SERVER_ARGS" |  | ||||||
|         ./src/tests/meta-dbus-runner.py |  | ||||||
|           --launch=wireplumber |  | ||||||
|           meson test |  | ||||||
|             -C build |  | ||||||
|             --setup plain |  | ||||||
|             --no-suite 'mutter/kvm' |  | ||||||
|             --no-rebuild |  | ||||||
|             --timeout-multiplier 10 |  | ||||||
|             --print-errorlogs |  | ||||||
|   artifacts: |  | ||||||
|     reports: |  | ||||||
|       junit: "build/meson-logs/testlog-plain.junit.xml" |  | ||||||
|  |  | ||||||
| test-mutter@x86_64: |  | ||||||
|   extends: |  | ||||||
|     - .mutter.fedora@x86_64 |  | ||||||
|     - .test-mutter |  | ||||||
|   tags: |  | ||||||
|     - asan |  | ||||||
|   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 |  | ||||||
|  |  | ||||||
| can-build-gnome-shell@x86_64: |  | ||||||
|   extends: |  | ||||||
|     - .mutter.distribution-image |  | ||||||
|     - .mutter.fedora@x86_64 |  | ||||||
|   stage: test |  | ||||||
|   needs: |  | ||||||
|     - build-mutter@x86_64 |  | ||||||
|   before_script: |  | ||||||
|     - !reference [.mutter.fedora@x86_64, before_script] |  | ||||||
|     - sudo meson install --no-rebuild -C build |  | ||||||
|   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") |  | ||||||
| @@ -1,56 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
|  |  | ||||||
| fetch() { |  | ||||||
|   local remote=$1 |  | ||||||
|   local ref=$2 |  | ||||||
|  |  | ||||||
|   git fetch --quiet --depth=1 $remote $ref 2>/dev/null |  | ||||||
| } |  | ||||||
|  |  | ||||||
| gnome_shell_target= |  | ||||||
|  |  | ||||||
| echo -n Cloning into gnome-shell ... |  | ||||||
| if git clone --quiet --depth=1 https://gitlab.gnome.org/GNOME/gnome-shell.git; then |  | ||||||
|   echo \ done |  | ||||||
| else |  | ||||||
|   echo \ failed |  | ||||||
|   exit 1 |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| cd gnome-shell |  | ||||||
|  |  | ||||||
| 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 |  | ||||||
|     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 |  | ||||||
|     echo Using $gnome_shell_target instead |  | ||||||
|   fi |  | ||||||
| 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 |  | ||||||
| @@ -1,55 +0,0 @@ | |||||||
| <!--  |  | ||||||
| Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines |  | ||||||
| first to ensure that you create a clear and specific issue. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Affected version |  | ||||||
|  |  | ||||||
| <!-- |  | ||||||
| Provide at least the following information: |  | ||||||
| * Your OS and version |  | ||||||
| * Affected Mutter version |  | ||||||
| * Does this issue appear in XOrg and/or Wayland |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Bug summary |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| Provide a short summary of the bug you encountered. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Steps to reproduce |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| 1. Step one |  | ||||||
| 2. Step two |  | ||||||
| 3. ... |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### What happened |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| What did Mutter do that was unexpected? |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### What did you expect to happen |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| What did you expect Mutter to do? |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Relevant logs, screenshots, screencasts etc. |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| If you have further information, such as technical documentation, logs, |  | ||||||
| screenshots or screencasts related, please provide them here. |  | ||||||
|  |  | ||||||
| If the bug is a crash, please obtain a stack trace with installed debug |  | ||||||
| symbols (at least for GNOME Shell and Mutter) and attach it to |  | ||||||
| this issue following the instructions on |  | ||||||
| https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <!-- Do not remove the following line. --> |  | ||||||
| /label ~"1. Bug" |  | ||||||
| @@ -1,30 +0,0 @@ | |||||||
| <!--  |  | ||||||
| Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines |  | ||||||
| first to ensure that you create a clear and specific issue. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Feature summary |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| Describe what you would like to be able to do with Mutter |  | ||||||
| that you currently cannot do. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### How would you like it to work |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| If you can think of a way Mutter might be able to do this, |  | ||||||
| let us know here. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
| ### Relevant links, screenshots, screencasts etc. |  | ||||||
|  |  | ||||||
| <!--  |  | ||||||
| If you have further information, such as technical documentation, |  | ||||||
| code, mockups or a similar feature in another window managers, |  | ||||||
| please provide them here. |  | ||||||
| --> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <!-- Do not remove the following line. --> |  | ||||||
| /label ~"1. Feature" |  | ||||||
							
								
								
									
										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 |  | ||||||
							
								
								
									
										11
									
								
								Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  |  | ||||||
|  | SUBDIRS = cogl clutter data src po doc | ||||||
|  |  | ||||||
|  | ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} | ||||||
|  |  | ||||||
|  | DISTCLEANFILES = \ | ||||||
|  | 	intltool-extract \ | ||||||
|  | 	intltool-merge \ | ||||||
|  | 	intltool-update \ | ||||||
|  | 	po/stamp-it \ | ||||||
|  | 	po/.intltool-merge-cache | ||||||
							
								
								
									
										112
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,112 +0,0 @@ | |||||||
| # Mutter |  | ||||||
|  |  | ||||||
| Mutter is a Wayland display server and X11 window manager and compositor library. |  | ||||||
|  |  | ||||||
| When used as a Wayland display server, it runs on top of KMS and libinput. It |  | ||||||
| implements the compositor side of the Wayland core protocol as well as various |  | ||||||
| protocol extensions. It also has functionality related to running X11 |  | ||||||
| applications using Xwayland. |  | ||||||
|  |  | ||||||
| When used on top of Xorg it acts as a X11 window manager and compositing manager. |  | ||||||
|  |  | ||||||
| It contains functionality related to, among other things, window management, |  | ||||||
| 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 |  | ||||||
| scene graph and user interface toolkit. |  | ||||||
|  |  | ||||||
| Mutter is used by, for example, GNOME Shell, the GNOME core user interface, and |  | ||||||
| by  Gala, elementary OS's window manager. It can also be run standalone, using |  | ||||||
| the  command "mutter", but just running plain mutter is only intended for |  | ||||||
| debugging purposes. |  | ||||||
|  |  | ||||||
| ## Contributing |  | ||||||
|  |  | ||||||
| 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 |  | ||||||
|  |  | ||||||
| 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 |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## License |  | ||||||
|  |  | ||||||
| Mutter is distributed under the terms of the GNU General Public License, |  | ||||||
| version 2 or later. See the [COPYING][license] file for detalis. |  | ||||||
|  |  | ||||||
| [bug-tracker]: https://gitlab.gnome.org/GNOME/mutter/issues |  | ||||||
| [license]: COPYING |  | ||||||
							
								
								
									
										21
									
								
								autogen.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								autogen.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | # Run this to generate all the initial makefiles, etc. | ||||||
|  |  | ||||||
|  | srcdir=`dirname $0` | ||||||
|  | test -z "$srcdir" && srcdir=. | ||||||
|  |  | ||||||
|  | REQUIRED_AUTOMAKE_VERSION=1.11 | ||||||
|  |  | ||||||
|  | (test -f $srcdir/configure.ac \ | ||||||
|  |   && test -d $srcdir/src) || { | ||||||
|  |     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" | ||||||
|  |     echo " top-level metacity directory" | ||||||
|  |     exit 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | which gnome-autogen.sh || { | ||||||
|  |     echo "You need to install gnome-common from GNOME Subversion (or from" | ||||||
|  |     echo "your distribution's package manager)." | ||||||
|  |     exit 1 | ||||||
|  | } | ||||||
|  | . gnome-autogen.sh | ||||||
							
								
								
									
										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) |  | ||||||
							
								
								
									
										1
									
								
								clutter/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								clutter/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -23,6 +23,7 @@ clutter-build-config.h.in | |||||||
| clutter-config.h | clutter-config.h | ||||||
| clutter-enum-types.[ch] | clutter-enum-types.[ch] | ||||||
| clutter-marshal.[ch] | clutter-marshal.[ch] | ||||||
|  | clutter-version.h | ||||||
| gcov-report.txt | gcov-report.txt | ||||||
| clutter-json.h | clutter-json.h | ||||||
| clutter-lcov.info | clutter-lcov.info | ||||||
|   | |||||||
							
								
								
									
										53
									
								
								clutter/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								clutter/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | |||||||
|  | NULL = | ||||||
|  |  | ||||||
|  | SUBDIRS = build clutter tests | ||||||
|  |  | ||||||
|  | if BUILD_EXAMPLES | ||||||
|  | SUBDIRS += examples | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | DIST_SUBDIRS = clutter tests examples build | ||||||
|  |  | ||||||
|  | # XXX - this is a massive hack to make autoreconf honour the ACLOCAL_FLAGS | ||||||
|  | # that jhbuild sets while still retaining build/autotools as the authoritative | ||||||
|  | # source for m4 macros | ||||||
|  | ACLOCAL_AMFLAGS = -I build/autotools ${ACLOCAL_FLAGS} | ||||||
|  |  | ||||||
|  | CLEANFILES = $(pcfiles) | ||||||
|  |  | ||||||
|  | DISTCLEANFILES = | ||||||
|  |  | ||||||
|  | DISTCHECK_CONFIGURE_FLAGS = --enable-maintainer-flags | ||||||
|  |  | ||||||
|  | # proxy rules for tests | ||||||
|  | test-report full-report: | ||||||
|  | 	$(MAKE) -C tests/conform $(@) | ||||||
|  |  | ||||||
|  | perf-report: | ||||||
|  | 	$(MAKE) -C tests/performance $(@) | ||||||
|  |  | ||||||
|  | if ENABLE_GCOV | ||||||
|  | # use recursive makes in order to ignore errors during check/perf | ||||||
|  | lcov: | ||||||
|  | 	-$(MAKE) $(AM_MAKEFLAGS) -C clutter check | ||||||
|  | 	-$(MAKE) $(AM_MAKEFLAGS) -C tests/conform test | ||||||
|  | 	$(MAKE) $(AM_MAKEFLAGS) genlcov | ||||||
|  |  | ||||||
|  | # we have to massage the lcov.info file slightly to hide the effect of libtool | ||||||
|  | # placing the objects files in the .libs/ directory separate from the *.c | ||||||
|  | genlcov: | ||||||
|  | 	$(LTP) --directory $(top_builddir) --capture --output-file clutter-lcov.info --test-name CLUTTER_TEST --no-checksum | ||||||
|  | 	$(SED) -e 's#.libs/##' < clutter-lcov.info > clutter-lcov.info.tmp | ||||||
|  | 	LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory clutter-lcov --title "Clutter Code Coverage" --show-details clutter-lcov.info.tmp | ||||||
|  | 	rm -f clutter-lcov.info.tmp | ||||||
|  |  | ||||||
|  | lcov-clean: | ||||||
|  | 	-$(LTP) --directory $(top_builddir) -z | ||||||
|  | 	-$(RM) -rf clutter-lcov.info clutter-lcov | ||||||
|  | else | ||||||
|  | lcov genlcov lcov-clean: | ||||||
|  | 	@echo You need to configure Clutter with support for gcov enabled. | ||||||
|  | 	@echo e.g., ./configure --enable-gcov | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | .PHONY: test-report full-report perf-report lcov genlcov lcov-clean | ||||||
							
								
								
									
										1
									
								
								clutter/build/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								clutter/build/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | SUBDIRS = autotools | ||||||
							
								
								
									
										8
									
								
								clutter/build/autotools/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								clutter/build/autotools/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | gtk-doc.m4 | ||||||
|  | libtool.m4 | ||||||
|  | ltoptions.m4 | ||||||
|  | ltsugar.m4 | ||||||
|  | ltversion.m4 | ||||||
|  | lt~obsolete.m4 | ||||||
|  | shave | ||||||
|  | shave-libtool | ||||||
							
								
								
									
										10
									
								
								clutter/build/autotools/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								clutter/build/autotools/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | NULL = | ||||||
|  |  | ||||||
|  | EXTRA_DIST = \ | ||||||
|  | 	introspection.m4	\ | ||||||
|  | 	as-compiler-flag.m4	\ | ||||||
|  | 	glibtests.m4		\ | ||||||
|  | 	glib-tap.mk		\ | ||||||
|  | 	tap-driver.sh		\ | ||||||
|  | 	tap-test		\ | ||||||
|  | 	$(NULL) | ||||||
							
								
								
									
										62
									
								
								clutter/build/autotools/as-compiler-flag.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								clutter/build/autotools/as-compiler-flag.m4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | |||||||
|  | dnl as-compiler-flag.m4 0.1.0 | ||||||
|  |  | ||||||
|  | dnl autostars m4 macro for detection of compiler flags | ||||||
|  |  | ||||||
|  | dnl David Schleef <ds@schleef.org> | ||||||
|  |  | ||||||
|  | dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $ | ||||||
|  |  | ||||||
|  | dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) | ||||||
|  | dnl Tries to compile with the given CFLAGS. | ||||||
|  | dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, | ||||||
|  | dnl and ACTION-IF-NOT-ACCEPTED otherwise. | ||||||
|  |  | ||||||
|  | AC_DEFUN([AS_COMPILER_FLAG], | ||||||
|  | [ | ||||||
|  |   AC_MSG_CHECKING([to see if compiler understands $1]) | ||||||
|  |  | ||||||
|  |   save_CFLAGS="$CFLAGS" | ||||||
|  |   CFLAGS="$CFLAGS $1" | ||||||
|  |  | ||||||
|  |   AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) | ||||||
|  |   CFLAGS="$save_CFLAGS" | ||||||
|  |  | ||||||
|  |   if test "X$flag_ok" = Xyes ; then | ||||||
|  |     m4_ifvaln([$2],[$2]) | ||||||
|  |     true | ||||||
|  |   else | ||||||
|  |     m4_ifvaln([$3],[$3]) | ||||||
|  |     true | ||||||
|  |   fi | ||||||
|  |   AC_MSG_RESULT([$flag_ok]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  | dnl AS_COMPILER_FLAGS(VAR, FLAGS) | ||||||
|  | dnl Tries to compile with the given CFLAGS. | ||||||
|  |  | ||||||
|  | AC_DEFUN([AS_COMPILER_FLAGS], | ||||||
|  | [ | ||||||
|  |   list=$2 | ||||||
|  |   flags_supported="" | ||||||
|  |   flags_unsupported="" | ||||||
|  |   AC_MSG_CHECKING([for supported compiler flags]) | ||||||
|  |   for each in $list | ||||||
|  |   do | ||||||
|  |     save_CFLAGS="$CFLAGS" | ||||||
|  |     CFLAGS="$CFLAGS $each" | ||||||
|  |     AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) | ||||||
|  |     CFLAGS="$save_CFLAGS" | ||||||
|  |  | ||||||
|  |     if test "X$flag_ok" = Xyes ; then | ||||||
|  |       flags_supported="$flags_supported $each" | ||||||
|  |     else | ||||||
|  |       flags_unsupported="$flags_unsupported $each" | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  |   AC_MSG_RESULT([$flags_supported]) | ||||||
|  |   if test "X$flags_unsupported" != X ; then | ||||||
|  |     AC_MSG_WARN([unsupported compiler flags: $flags_unsupported]) | ||||||
|  |   fi | ||||||
|  |   $1="$$1 $flags_supported" | ||||||
|  | ]) | ||||||
|  |  | ||||||
							
								
								
									
										134
									
								
								clutter/build/autotools/glib-tap.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								clutter/build/autotools/glib-tap.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | |||||||
|  | # GLIB - Library of useful C routines | ||||||
|  |  | ||||||
|  | TESTS_ENVIRONMENT= \ | ||||||
|  | 	G_TEST_SRCDIR="$(abs_srcdir)" 		\ | ||||||
|  | 	G_TEST_BUILDDIR="$(abs_builddir)" 	\ | ||||||
|  | 	G_DEBUG=gc-friendly 			\ | ||||||
|  | 	MALLOC_CHECK_=2 			\ | ||||||
|  | 	MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) | ||||||
|  | LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build/autotools/tap-driver.sh | ||||||
|  | LOG_COMPILER = $(top_srcdir)/build/autotools/tap-test | ||||||
|  |  | ||||||
|  | NULL = | ||||||
|  |  | ||||||
|  | # initialize variables for unconditional += appending | ||||||
|  | BUILT_SOURCES = | ||||||
|  | BUILT_EXTRA_DIST = | ||||||
|  | CLEANFILES = *.log *.trs | ||||||
|  | DISTCLEANFILES = | ||||||
|  | MAINTAINERCLEANFILES = | ||||||
|  | EXTRA_DIST = | ||||||
|  | TESTS = | ||||||
|  |  | ||||||
|  | installed_test_LTLIBRARIES = | ||||||
|  | installed_test_PROGRAMS = | ||||||
|  | installed_test_SCRIPTS = | ||||||
|  | nobase_installed_test_DATA = | ||||||
|  |  | ||||||
|  | noinst_LTLIBRARIES = | ||||||
|  | noinst_PROGRAMS = | ||||||
|  | noinst_SCRIPTS = | ||||||
|  | noinst_DATA = | ||||||
|  |  | ||||||
|  | check_LTLIBRARIES = | ||||||
|  | check_PROGRAMS = | ||||||
|  | check_SCRIPTS = | ||||||
|  | check_DATA = | ||||||
|  |  | ||||||
|  | # We support a fairly large range of possible variables.  It is expected that all types of files in a test suite | ||||||
|  | # will belong in exactly one of the following variables. | ||||||
|  | # | ||||||
|  | # First, we support the usual automake suffixes, but in lowercase, with the customary meaning: | ||||||
|  | # | ||||||
|  | #   test_programs, test_scripts, test_data, test_ltlibraries | ||||||
|  | # | ||||||
|  | # The above are used to list files that are involved in both uninstalled and installed testing.  The | ||||||
|  | # test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite. | ||||||
|  | # Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is | ||||||
|  | # installed in the same way as it appears in the package layout. | ||||||
|  | # | ||||||
|  | # In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled', | ||||||
|  | # like so: | ||||||
|  | # | ||||||
|  | #   installed_test_programs, uninstalled_test_programs | ||||||
|  | #   installed_test_scripts, uninstalled_test_scripts | ||||||
|  | #   installed_test_data, uninstalled_test_data | ||||||
|  | #   installed_test_ltlibraries, uninstalled_test_ltlibraries | ||||||
|  | # | ||||||
|  | # Additionally, we support 'extra' infixes for programs and scripts.  This is used for support programs/scripts | ||||||
|  | # that should not themselves be run as testcases (but exist to be used from other testcases): | ||||||
|  | # | ||||||
|  | #   test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs | ||||||
|  | #   test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts | ||||||
|  | # | ||||||
|  | # Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data | ||||||
|  | # file automatically end up in the tarball. | ||||||
|  | # | ||||||
|  | #   dist_test_scripts, dist_test_data, dist_test_extra_scripts | ||||||
|  | #   dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts | ||||||
|  | #   dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts | ||||||
|  | # | ||||||
|  | # Note that no file is automatically disted unless it appears in one of the dist_ variables.  This follows the | ||||||
|  | # standard automake convention of not disting programs scripts or data by default. | ||||||
|  | # | ||||||
|  | # test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted | ||||||
|  | # variants) will be run as part of the in-tree 'make check'.  These are all assumed to be runnable under | ||||||
|  | # gtester.  That's a bit strange for scripts, but it's possible. | ||||||
|  |  | ||||||
|  | TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \ | ||||||
|  |          $(dist_test_scripts) $(dist_uninstalled_test_scripts) | ||||||
|  |  | ||||||
|  | # Note: build even the installed-only targets during 'make check' to ensure that they still work. | ||||||
|  | # We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to | ||||||
|  | # prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were | ||||||
|  | # filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'. | ||||||
|  | all_test_programs     = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \ | ||||||
|  |                         $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs) | ||||||
|  | all_test_scripts      = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \ | ||||||
|  |                         $(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts) | ||||||
|  | all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \ | ||||||
|  |                         $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts) | ||||||
|  | all_test_scripts     += $(all_dist_test_scripts) | ||||||
|  | EXTRA_DIST           += $(all_dist_test_scripts) | ||||||
|  | all_test_data         = $(test_data) $(uninstalled_test_data) $(installed_test_data) | ||||||
|  | all_dist_test_data    = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data) | ||||||
|  | all_test_data        += $(all_dist_test_data) | ||||||
|  | EXTRA_DIST           += $(all_dist_test_data) | ||||||
|  | all_test_ltlibs       = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries) | ||||||
|  |  | ||||||
|  | if ENABLE_ALWAYS_BUILD_TESTS | ||||||
|  | noinst_LTLIBRARIES += $(all_test_ltlibs) | ||||||
|  | noinst_PROGRAMS += $(all_test_programs) | ||||||
|  | noinst_SCRIPTS += $(all_test_scripts) | ||||||
|  | noinst_DATA += $(all_test_data) | ||||||
|  | else | ||||||
|  | check_LTLIBRARIES += $(all_test_ltlibs) | ||||||
|  | check_PROGRAMS += $(all_test_programs) | ||||||
|  | check_SCRIPTS += $(all_test_scripts) | ||||||
|  | check_DATA += $(all_test_data) | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | if ENABLE_INSTALLED_TESTS | ||||||
|  | installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \ | ||||||
|  |                           $(test_extra_programs) $(installed_test_extra_programs) | ||||||
|  | installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \ | ||||||
|  |                           $(test_extra_scripts) $(test_installed_extra_scripts) | ||||||
|  | installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \ | ||||||
|  |                           $(dist_installed_test_scripts) $(dist_installed_test_extra_scripts) | ||||||
|  | nobase_installed_test_DATA += $(test_data) $(installed_test_data) | ||||||
|  | nobase_installed_test_DATA += $(dist_test_data) $(dist_installed_test_data) | ||||||
|  | installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries) | ||||||
|  | installed_testcases = $(test_programs) $(installed_test_programs) \ | ||||||
|  |                       $(test_scripts) $(installed_test_scripts) \ | ||||||
|  |                       $(dist_test_scripts) $(dist_installed_test_scripts) | ||||||
|  |  | ||||||
|  | installed_test_meta_DATA = $(installed_testcases:=.test) | ||||||
|  |  | ||||||
|  | %.test: %$(EXEEXT) Makefile | ||||||
|  | 	$(AM_V_GEN) (echo '[Test]' > $@.tmp; \ | ||||||
|  | 	echo 'Type=session' >> $@.tmp; \ | ||||||
|  | 	echo 'Exec=env G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0 $(installed_testdir)/$<' >> $@.tmp; \ | ||||||
|  | 	mv $@.tmp $@) | ||||||
|  |  | ||||||
|  | CLEANFILES += $(installed_test_meta_DATA) | ||||||
|  | endif | ||||||
							
								
								
									
										28
									
								
								clutter/build/autotools/glibtests.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								clutter/build/autotools/glibtests.m4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | dnl GLIB_TESTS | ||||||
|  | dnl | ||||||
|  |  | ||||||
|  | AC_DEFUN([GLIB_TESTS], | ||||||
|  | [ | ||||||
|  |   AC_ARG_ENABLE(installed-tests, | ||||||
|  |                 AS_HELP_STRING([--enable-installed-tests], | ||||||
|  |                                [Enable installation of some test cases]), | ||||||
|  |                 [case ${enableval} in | ||||||
|  |                   yes) ENABLE_INSTALLED_TESTS="1"  ;; | ||||||
|  |                   no)  ENABLE_INSTALLED_TESTS="" ;; | ||||||
|  |                   *) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;; | ||||||
|  |                  esac]) | ||||||
|  |   AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1") | ||||||
|  |   AC_ARG_ENABLE(always-build-tests, | ||||||
|  |                 AS_HELP_STRING([--enable-always-build-tests], | ||||||
|  |                                [Enable always building tests during 'make all']), | ||||||
|  |                 [case ${enableval} in | ||||||
|  |                   yes) ENABLE_ALWAYS_BUILD_TESTS="1"  ;; | ||||||
|  |                   no)  ENABLE_ALWAYS_BUILD_TESTS="" ;; | ||||||
|  |                   *) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;; | ||||||
|  |                  esac]) | ||||||
|  |   AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1") | ||||||
|  |   if test "$ENABLE_INSTALLED_TESTS" = "1"; then | ||||||
|  |     AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME) | ||||||
|  |     AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME) | ||||||
|  |   fi | ||||||
|  | ]) | ||||||
							
								
								
									
										96
									
								
								clutter/build/autotools/introspection.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								clutter/build/autotools/introspection.m4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | |||||||
|  | dnl -*- mode: autoconf -*- | ||||||
|  | dnl Copyright 2009 Johan Dahlin | ||||||
|  | dnl | ||||||
|  | dnl This file is free software; the author(s) gives unlimited | ||||||
|  | dnl permission to copy and/or distribute it, with or without | ||||||
|  | dnl modifications, as long as this notice is preserved. | ||||||
|  | dnl | ||||||
|  |  | ||||||
|  | # serial 1 | ||||||
|  |  | ||||||
|  | m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], | ||||||
|  | [ | ||||||
|  |     AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first | ||||||
|  |     AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first | ||||||
|  |     AC_BEFORE([LT_INIT],[$0])dnl setup libtool first | ||||||
|  |  | ||||||
|  |     dnl enable/disable introspection | ||||||
|  |     m4_if([$2], [require], | ||||||
|  |     [dnl | ||||||
|  |         enable_introspection=yes | ||||||
|  |     ],[dnl | ||||||
|  |         AC_ARG_ENABLE(introspection, | ||||||
|  |                   AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], | ||||||
|  |                                  [Enable introspection for this build]),,  | ||||||
|  |                                  [enable_introspection=auto]) | ||||||
|  |     ])dnl | ||||||
|  |  | ||||||
|  |     AC_MSG_CHECKING([for gobject-introspection]) | ||||||
|  |  | ||||||
|  |     dnl presence/version checking | ||||||
|  |     AS_CASE([$enable_introspection], | ||||||
|  |     [no], [dnl | ||||||
|  |         found_introspection="no (disabled, use --enable-introspection to enable)" | ||||||
|  |     ],dnl | ||||||
|  |     [yes],[dnl | ||||||
|  |         PKG_CHECK_EXISTS([gobject-introspection-1.0],, | ||||||
|  |                          AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) | ||||||
|  |         PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], | ||||||
|  |                          found_introspection=yes, | ||||||
|  |                          AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) | ||||||
|  |     ],dnl | ||||||
|  |     [auto],[dnl | ||||||
|  |         PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) | ||||||
|  | 	dnl Canonicalize enable_introspection | ||||||
|  | 	enable_introspection=$found_introspection | ||||||
|  |     ],dnl | ||||||
|  |     [dnl	 | ||||||
|  |         AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) | ||||||
|  |     ])dnl | ||||||
|  |  | ||||||
|  |     AC_MSG_RESULT([$found_introspection]) | ||||||
|  |  | ||||||
|  |     INTROSPECTION_SCANNER= | ||||||
|  |     INTROSPECTION_COMPILER= | ||||||
|  |     INTROSPECTION_GENERATE= | ||||||
|  |     INTROSPECTION_GIRDIR= | ||||||
|  |     INTROSPECTION_TYPELIBDIR= | ||||||
|  |     if test "x$found_introspection" = "xyes"; then | ||||||
|  |        INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" | ||||||
|  |        INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` | ||||||
|  |        INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection | ||||||
|  |     fi | ||||||
|  |     AC_SUBST(INTROSPECTION_SCANNER) | ||||||
|  |     AC_SUBST(INTROSPECTION_COMPILER) | ||||||
|  |     AC_SUBST(INTROSPECTION_GENERATE) | ||||||
|  |     AC_SUBST(INTROSPECTION_GIRDIR) | ||||||
|  |     AC_SUBST(INTROSPECTION_TYPELIBDIR) | ||||||
|  |     AC_SUBST(INTROSPECTION_CFLAGS) | ||||||
|  |     AC_SUBST(INTROSPECTION_LIBS) | ||||||
|  |     AC_SUBST(INTROSPECTION_MAKEFILE) | ||||||
|  |  | ||||||
|  |     AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl Usage: | ||||||
|  | dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) | ||||||
|  |  | ||||||
|  | AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], | ||||||
|  | [ | ||||||
|  |   _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  | dnl Usage: | ||||||
|  | dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], | ||||||
|  | [ | ||||||
|  |   _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) | ||||||
|  | ]) | ||||||
							
								
								
									
										652
									
								
								clutter/build/autotools/tap-driver.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										652
									
								
								clutter/build/autotools/tap-driver.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,652 @@ | |||||||
|  | #! /bin/sh | ||||||
|  | # Copyright (C) 2011-2013 Free Software Foundation, Inc. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU General Public License as published by | ||||||
|  | # the Free Software Foundation; either version 2, or (at your option) | ||||||
|  | # any later version. | ||||||
|  | # | ||||||
|  | # This program 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 General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU General Public License | ||||||
|  | # along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  |  | ||||||
|  | # As a special exception to the GNU General Public License, if you | ||||||
|  | # distribute this file as part of a program that contains a | ||||||
|  | # configuration script generated by Autoconf, you may include it under | ||||||
|  | # the same distribution terms that you use for the rest of that program. | ||||||
|  |  | ||||||
|  | # This file is maintained in Automake, please report | ||||||
|  | # bugs to <bug-automake@gnu.org> or send patches to | ||||||
|  | # <automake-patches@gnu.org>. | ||||||
|  |  | ||||||
|  | scriptversion=2011-12-27.17; # UTC | ||||||
|  |  | ||||||
|  | # Make unconditional expansion of undefined variables an error.  This | ||||||
|  | # helps a lot in preventing typo-related bugs. | ||||||
|  | set -u | ||||||
|  |  | ||||||
|  | me=tap-driver.sh | ||||||
|  |  | ||||||
|  | fatal () | ||||||
|  | { | ||||||
|  |   echo "$me: fatal: $*" >&2 | ||||||
|  |   exit 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | usage_error () | ||||||
|  | { | ||||||
|  |   echo "$me: $*" >&2 | ||||||
|  |   print_usage >&2 | ||||||
|  |   exit 2 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | print_usage () | ||||||
|  | { | ||||||
|  |   cat <<END | ||||||
|  | Usage: | ||||||
|  |   tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH | ||||||
|  |                 [--expect-failure={yes|no}] [--color-tests={yes|no}] | ||||||
|  |                 [--enable-hard-errors={yes|no}] [--ignore-exit] | ||||||
|  |                 [--diagnostic-string=STRING] [--merge|--no-merge] | ||||||
|  |                 [--comments|--no-comments] [--] TEST-COMMAND | ||||||
|  | The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory. | ||||||
|  | END | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # TODO: better error handling in option parsing (in particular, ensure | ||||||
|  | # TODO: $log_file, $trs_file and $test_name are defined). | ||||||
|  | test_name= # Used for reporting. | ||||||
|  | log_file=  # Where to save the result and output of the test script. | ||||||
|  | trs_file=  # Where to save the metadata of the test run. | ||||||
|  | expect_failure=0 | ||||||
|  | color_tests=0 | ||||||
|  | merge=0 | ||||||
|  | ignore_exit=0 | ||||||
|  | comments=0 | ||||||
|  | diag_string='#' | ||||||
|  | while test $# -gt 0; do | ||||||
|  |   case $1 in | ||||||
|  |   --help) print_usage; exit $?;; | ||||||
|  |   --version) echo "$me $scriptversion"; exit $?;; | ||||||
|  |   --test-name) test_name=$2; shift;; | ||||||
|  |   --log-file) log_file=$2; shift;; | ||||||
|  |   --trs-file) trs_file=$2; shift;; | ||||||
|  |   --color-tests) color_tests=$2; shift;; | ||||||
|  |   --expect-failure) expect_failure=$2; shift;; | ||||||
|  |   --enable-hard-errors) shift;; # No-op. | ||||||
|  |   --merge) merge=1;; | ||||||
|  |   --no-merge) merge=0;; | ||||||
|  |   --ignore-exit) ignore_exit=1;; | ||||||
|  |   --comments) comments=1;; | ||||||
|  |   --no-comments) comments=0;; | ||||||
|  |   --diagnostic-string) diag_string=$2; shift;; | ||||||
|  |   --) shift; break;; | ||||||
|  |   -*) usage_error "invalid option: '$1'";; | ||||||
|  |   esac | ||||||
|  |   shift | ||||||
|  | done | ||||||
|  |  | ||||||
|  | test $# -gt 0 || usage_error "missing test command" | ||||||
|  |  | ||||||
|  | case $expect_failure in | ||||||
|  |   yes) expect_failure=1;; | ||||||
|  |     *) expect_failure=0;; | ||||||
|  | esac | ||||||
|  |  | ||||||
|  | if test $color_tests = yes; then | ||||||
|  |   init_colors=' | ||||||
|  |     color_map["red"]="[0;31m" # Red. | ||||||
|  |     color_map["grn"]="[0;32m" # Green. | ||||||
|  |     color_map["lgn"]="[1;32m" # Light green. | ||||||
|  |     color_map["blu"]="[1;34m" # Blue. | ||||||
|  |     color_map["mgn"]="[0;35m" # Magenta. | ||||||
|  |     color_map["std"]="[m"     # No color. | ||||||
|  |     color_for_result["ERROR"] = "mgn" | ||||||
|  |     color_for_result["PASS"]  = "grn" | ||||||
|  |     color_for_result["XPASS"] = "red" | ||||||
|  |     color_for_result["FAIL"]  = "red" | ||||||
|  |     color_for_result["XFAIL"] = "lgn" | ||||||
|  |     color_for_result["SKIP"]  = "blu"' | ||||||
|  | else | ||||||
|  |   init_colors='' | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # :; is there to work around a bug in bash 3.2 (and earlier) which | ||||||
|  | # does not always set '$?' properly on redirection failure. | ||||||
|  | # See the Autoconf manual for more details. | ||||||
|  | :;{ | ||||||
|  |   ( | ||||||
|  |     # Ignore common signals (in this subshell only!), to avoid potential | ||||||
|  |     # problems with Korn shells.  Some Korn shells are known to propagate | ||||||
|  |     # to themselves signals that have killed a child process they were | ||||||
|  |     # waiting for; this is done at least for SIGINT (and usually only for | ||||||
|  |     # it, in truth).  Without the `trap' below, such a behaviour could | ||||||
|  |     # cause a premature exit in the current subshell, e.g., in case the | ||||||
|  |     # test command it runs gets terminated by a SIGINT.  Thus, the awk | ||||||
|  |     # script we are piping into would never seen the exit status it | ||||||
|  |     # expects on its last input line (which is displayed below by the | ||||||
|  |     # last `echo $?' statement), and would thus die reporting an internal | ||||||
|  |     # error. | ||||||
|  |     # For more information, see the Autoconf manual and the threads: | ||||||
|  |     # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html> | ||||||
|  |     # <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html> | ||||||
|  |     trap : 1 3 2 13 15 | ||||||
|  |     if test $merge -gt 0; then | ||||||
|  |       exec 2>&1 | ||||||
|  |     else | ||||||
|  |       exec 2>&3 | ||||||
|  |     fi | ||||||
|  |     "$@" | ||||||
|  |     echo $? | ||||||
|  |   ) | LC_ALL=C ${AM_TAP_AWK-awk} \ | ||||||
|  |         -v me="$me" \ | ||||||
|  |         -v test_script_name="$test_name" \ | ||||||
|  |         -v log_file="$log_file" \ | ||||||
|  |         -v trs_file="$trs_file" \ | ||||||
|  |         -v expect_failure="$expect_failure" \ | ||||||
|  |         -v merge="$merge" \ | ||||||
|  |         -v ignore_exit="$ignore_exit" \ | ||||||
|  |         -v comments="$comments" \ | ||||||
|  |         -v diag_string="$diag_string" \ | ||||||
|  | ' | ||||||
|  | # FIXME: the usages of "cat >&3" below could be optimized when using | ||||||
|  | # FIXME: GNU awk, and/on on systems that supports /dev/fd/. | ||||||
|  |  | ||||||
|  | # Implementation note: in what follows, `result_obj` will be an | ||||||
|  | # associative array that (partly) simulates a TAP result object | ||||||
|  | # from the `TAP::Parser` perl module. | ||||||
|  |  | ||||||
|  | ## ----------- ## | ||||||
|  | ##  FUNCTIONS  ## | ||||||
|  | ## ----------- ## | ||||||
|  |  | ||||||
|  | function fatal(msg) | ||||||
|  | { | ||||||
|  |   print me ": " msg | "cat >&2" | ||||||
|  |   exit 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function abort(where) | ||||||
|  | { | ||||||
|  |   fatal("internal error " where) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # Convert a boolean to a "yes"/"no" string. | ||||||
|  | function yn(bool) | ||||||
|  | { | ||||||
|  |   return bool ? "yes" : "no"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function add_test_result(result) | ||||||
|  | { | ||||||
|  |   if (!test_results_index) | ||||||
|  |     test_results_index = 0 | ||||||
|  |   test_results_list[test_results_index] = result | ||||||
|  |   test_results_index += 1 | ||||||
|  |   test_results_seen[result] = 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # Whether the test script should be re-run by "make recheck". | ||||||
|  | function must_recheck() | ||||||
|  | { | ||||||
|  |   for (k in test_results_seen) | ||||||
|  |     if (k != "XFAIL" && k != "PASS" && k != "SKIP") | ||||||
|  |       return 1 | ||||||
|  |   return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # Whether the content of the log file associated to this test should | ||||||
|  | # be copied into the "global" test-suite.log. | ||||||
|  | function copy_in_global_log() | ||||||
|  | { | ||||||
|  |   for (k in test_results_seen) | ||||||
|  |     if (k != "PASS") | ||||||
|  |       return 1 | ||||||
|  |   return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # FIXME: this can certainly be improved ... | ||||||
|  | function get_global_test_result() | ||||||
|  | { | ||||||
|  |     if ("ERROR" in test_results_seen) | ||||||
|  |       return "ERROR" | ||||||
|  |     if ("FAIL" in test_results_seen || "XPASS" in test_results_seen) | ||||||
|  |       return "FAIL" | ||||||
|  |     all_skipped = 1 | ||||||
|  |     for (k in test_results_seen) | ||||||
|  |       if (k != "SKIP") | ||||||
|  |         all_skipped = 0 | ||||||
|  |     if (all_skipped) | ||||||
|  |       return "SKIP" | ||||||
|  |     return "PASS"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function stringify_result_obj(result_obj) | ||||||
|  | { | ||||||
|  |   if (result_obj["is_unplanned"] || result_obj["number"] != testno) | ||||||
|  |     return "ERROR" | ||||||
|  |  | ||||||
|  |   if (plan_seen == LATE_PLAN) | ||||||
|  |     return "ERROR" | ||||||
|  |  | ||||||
|  |   if (result_obj["directive"] == "TODO") | ||||||
|  |     return result_obj["is_ok"] ? "XPASS" : "XFAIL" | ||||||
|  |  | ||||||
|  |   if (result_obj["directive"] == "SKIP") | ||||||
|  |     return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL; | ||||||
|  |  | ||||||
|  |   if (length(result_obj["directive"])) | ||||||
|  |       abort("in function stringify_result_obj()") | ||||||
|  |  | ||||||
|  |   return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function decorate_result(result) | ||||||
|  | { | ||||||
|  |   color_name = color_for_result[result] | ||||||
|  |   if (color_name) | ||||||
|  |     return color_map[color_name] "" result "" color_map["std"] | ||||||
|  |   # If we are not using colorized output, or if we do not know how | ||||||
|  |   # to colorize the given result, we should return it unchanged. | ||||||
|  |   return result | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function report(result, details) | ||||||
|  | { | ||||||
|  |   if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/) | ||||||
|  |     { | ||||||
|  |       msg = ": " test_script_name | ||||||
|  |       add_test_result(result) | ||||||
|  |     } | ||||||
|  |   else if (result == "#") | ||||||
|  |     { | ||||||
|  |       msg = " " test_script_name ":" | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     { | ||||||
|  |       abort("in function report()") | ||||||
|  |     } | ||||||
|  |   if (length(details)) | ||||||
|  |     msg = msg " " details | ||||||
|  |   # Output on console might be colorized. | ||||||
|  |   print decorate_result(result) msg | ||||||
|  |   # Log the result in the log file too, to help debugging (this is | ||||||
|  |   # especially true when said result is a TAP error or "Bail out!"). | ||||||
|  |   print result msg | "cat >&3"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function testsuite_error(error_message) | ||||||
|  | { | ||||||
|  |   report("ERROR", "- " error_message) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function handle_tap_result() | ||||||
|  | { | ||||||
|  |   details = result_obj["number"]; | ||||||
|  |   if (length(result_obj["description"])) | ||||||
|  |     details = details " " result_obj["description"] | ||||||
|  |  | ||||||
|  |   if (plan_seen == LATE_PLAN) | ||||||
|  |     { | ||||||
|  |       details = details " # AFTER LATE PLAN"; | ||||||
|  |     } | ||||||
|  |   else if (result_obj["is_unplanned"]) | ||||||
|  |     { | ||||||
|  |        details = details " # UNPLANNED"; | ||||||
|  |     } | ||||||
|  |   else if (result_obj["number"] != testno) | ||||||
|  |     { | ||||||
|  |        details = sprintf("%s # OUT-OF-ORDER (expecting %d)", | ||||||
|  |                          details, testno); | ||||||
|  |     } | ||||||
|  |   else if (result_obj["directive"]) | ||||||
|  |     { | ||||||
|  |       details = details " # " result_obj["directive"]; | ||||||
|  |       if (length(result_obj["explanation"])) | ||||||
|  |         details = details " " result_obj["explanation"] | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   report(stringify_result_obj(result_obj), details) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # `skip_reason` should be empty whenever planned > 0. | ||||||
|  | function handle_tap_plan(planned, skip_reason) | ||||||
|  | { | ||||||
|  |   planned += 0 # Avoid getting confused if, say, `planned` is "00" | ||||||
|  |   if (length(skip_reason) && planned > 0) | ||||||
|  |     abort("in function handle_tap_plan()") | ||||||
|  |   if (plan_seen) | ||||||
|  |     { | ||||||
|  |       # Error, only one plan per stream is acceptable. | ||||||
|  |       testsuite_error("multiple test plans") | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |   planned_tests = planned | ||||||
|  |   # The TAP plan can come before or after *all* the TAP results; we speak | ||||||
|  |   # respectively of an "early" or a "late" plan.  If we see the plan line | ||||||
|  |   # after at least one TAP result has been seen, assume we have a late | ||||||
|  |   # plan; in this case, any further test result seen after the plan will | ||||||
|  |   # be flagged as an error. | ||||||
|  |   plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN) | ||||||
|  |   # If testno > 0, we have an error ("too many tests run") that will be | ||||||
|  |   # automatically dealt with later, so do not worry about it here.  If | ||||||
|  |   # $plan_seen is true, we have an error due to a repeated plan, and that | ||||||
|  |   # has already been dealt with above.  Otherwise, we have a valid "plan | ||||||
|  |   # with SKIP" specification, and should report it as a particular kind | ||||||
|  |   # of SKIP result. | ||||||
|  |   if (planned == 0 && testno == 0) | ||||||
|  |     { | ||||||
|  |       if (length(skip_reason)) | ||||||
|  |         skip_reason = "- "  skip_reason; | ||||||
|  |       report("SKIP", skip_reason); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function extract_tap_comment(line) | ||||||
|  | { | ||||||
|  |   if (index(line, diag_string) == 1) | ||||||
|  |     { | ||||||
|  |       # Strip leading `diag_string` from `line`. | ||||||
|  |       line = substr(line, length(diag_string) + 1) | ||||||
|  |       # And strip any leading and trailing whitespace left. | ||||||
|  |       sub("^[ \t]*", "", line) | ||||||
|  |       sub("[ \t]*$", "", line) | ||||||
|  |       # Return what is left (if any). | ||||||
|  |       return line; | ||||||
|  |     } | ||||||
|  |   return ""; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # When this function is called, we know that line is a TAP result line, | ||||||
|  | # so that it matches the (perl) RE "^(not )?ok\b". | ||||||
|  | function setup_result_obj(line) | ||||||
|  | { | ||||||
|  |   # Get the result, and remove it from the line. | ||||||
|  |   result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0) | ||||||
|  |   sub("^(not )?ok[ \t]*", "", line) | ||||||
|  |  | ||||||
|  |   # If the result has an explicit number, get it and strip it; otherwise, | ||||||
|  |   # automatically assing the next progresive number to it. | ||||||
|  |   if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) | ||||||
|  |     { | ||||||
|  |       match(line, "^[0-9]+") | ||||||
|  |       # The final `+ 0` is to normalize numbers with leading zeros. | ||||||
|  |       result_obj["number"] = substr(line, 1, RLENGTH) + 0 | ||||||
|  |       line = substr(line, RLENGTH + 1) | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     { | ||||||
|  |       result_obj["number"] = testno | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (plan_seen == LATE_PLAN) | ||||||
|  |     # No further test results are acceptable after a "late" TAP plan | ||||||
|  |     # has been seen. | ||||||
|  |     result_obj["is_unplanned"] = 1 | ||||||
|  |   else if (plan_seen && testno > planned_tests) | ||||||
|  |     result_obj["is_unplanned"] = 1 | ||||||
|  |   else | ||||||
|  |     result_obj["is_unplanned"] = 0 | ||||||
|  |  | ||||||
|  |   # Strip trailing and leading whitespace. | ||||||
|  |   sub("^[ \t]*", "", line) | ||||||
|  |   sub("[ \t]*$", "", line) | ||||||
|  |  | ||||||
|  |   # This will have to be corrected if we have a "TODO"/"SKIP" directive. | ||||||
|  |   result_obj["description"] = line | ||||||
|  |   result_obj["directive"] = "" | ||||||
|  |   result_obj["explanation"] = "" | ||||||
|  |  | ||||||
|  |   if (index(line, "#") == 0) | ||||||
|  |     return # No possible directive, nothing more to do. | ||||||
|  |  | ||||||
|  |   # Directives are case-insensitive. | ||||||
|  |   rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*" | ||||||
|  |  | ||||||
|  |   # See whether we have the directive, and if yes, where. | ||||||
|  |   pos = match(line, rx "$") | ||||||
|  |   if (!pos) | ||||||
|  |     pos = match(line, rx "[^a-zA-Z0-9_]") | ||||||
|  |  | ||||||
|  |   # If there was no TAP directive, we have nothing more to do. | ||||||
|  |   if (!pos) | ||||||
|  |     return | ||||||
|  |  | ||||||
|  |   # Let`s now see if the TAP directive has been escaped.  For example: | ||||||
|  |   #  escaped:     ok \# SKIP | ||||||
|  |   #  not escaped: ok \\# SKIP | ||||||
|  |   #  escaped:     ok \\\\\# SKIP | ||||||
|  |   #  not escaped: ok \ # SKIP | ||||||
|  |   if (substr(line, pos, 1) == "#") | ||||||
|  |     { | ||||||
|  |       bslash_count = 0 | ||||||
|  |       for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) | ||||||
|  |         bslash_count += 1 | ||||||
|  |       if (bslash_count % 2) | ||||||
|  |         return # Directive was escaped. | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   # Strip the directive and its explanation (if any) from the test | ||||||
|  |   # description. | ||||||
|  |   result_obj["description"] = substr(line, 1, pos - 1) | ||||||
|  |   # Now remove the test description from the line, that has been dealt | ||||||
|  |   # with already. | ||||||
|  |   line = substr(line, pos) | ||||||
|  |   # Strip the directive, and save its value (normalized to upper case). | ||||||
|  |   sub("^[ \t]*#[ \t]*", "", line) | ||||||
|  |   result_obj["directive"] = toupper(substr(line, 1, 4)) | ||||||
|  |   line = substr(line, 5) | ||||||
|  |   # Now get the explanation for the directive (if any), with leading | ||||||
|  |   # and trailing whitespace removed. | ||||||
|  |   sub("^[ \t]*", "", line) | ||||||
|  |   sub("[ \t]*$", "", line) | ||||||
|  |   result_obj["explanation"] = line | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function get_test_exit_message(status) | ||||||
|  | { | ||||||
|  |   if (status == 0) | ||||||
|  |     return "" | ||||||
|  |   if (status !~ /^[1-9][0-9]*$/) | ||||||
|  |     abort("getting exit status") | ||||||
|  |   if (status < 127) | ||||||
|  |     exit_details = "" | ||||||
|  |   else if (status == 127) | ||||||
|  |     exit_details = " (command not found?)" | ||||||
|  |   else if (status >= 128 && status <= 255) | ||||||
|  |     exit_details = sprintf(" (terminated by signal %d?)", status - 128) | ||||||
|  |   else if (status > 256 && status <= 384) | ||||||
|  |     # We used to report an "abnormal termination" here, but some Korn | ||||||
|  |     # shells, when a child process die due to signal number n, can leave | ||||||
|  |     # in $? an exit status of 256+n instead of the more standard 128+n. | ||||||
|  |     # Apparently, both behaviours are allowed by POSIX (2008), so be | ||||||
|  |     # prepared to handle them both.  See also Austing Group report ID | ||||||
|  |     # 0000051 <http://www.austingroupbugs.net/view.php?id=51> | ||||||
|  |     exit_details = sprintf(" (terminated by signal %d?)", status - 256) | ||||||
|  |   else | ||||||
|  |     # Never seen in practice. | ||||||
|  |     exit_details = " (abnormal termination)" | ||||||
|  |   return sprintf("exited with status %d%s", status, exit_details) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function write_test_results() | ||||||
|  | { | ||||||
|  |   print ":global-test-result: " get_global_test_result() > trs_file | ||||||
|  |   print ":recheck: "  yn(must_recheck()) > trs_file | ||||||
|  |   print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file | ||||||
|  |   for (i = 0; i < test_results_index; i += 1) | ||||||
|  |     print ":test-result: " test_results_list[i] > trs_file | ||||||
|  |   close(trs_file); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | BEGIN { | ||||||
|  |  | ||||||
|  | ## ------- ## | ||||||
|  | ##  SETUP  ## | ||||||
|  | ## ------- ## | ||||||
|  |  | ||||||
|  | '"$init_colors"' | ||||||
|  |  | ||||||
|  | # Properly initialized once the TAP plan is seen. | ||||||
|  | planned_tests = 0 | ||||||
|  |  | ||||||
|  | COOKED_PASS = expect_failure ? "XPASS": "PASS"; | ||||||
|  | COOKED_FAIL = expect_failure ? "XFAIL": "FAIL"; | ||||||
|  |  | ||||||
|  | # Enumeration-like constants to remember which kind of plan (if any) | ||||||
|  | # has been seen.  It is important that NO_PLAN evaluates "false" as | ||||||
|  | # a boolean. | ||||||
|  | NO_PLAN = 0 | ||||||
|  | EARLY_PLAN = 1 | ||||||
|  | LATE_PLAN = 2 | ||||||
|  |  | ||||||
|  | testno = 0     # Number of test results seen so far. | ||||||
|  | bailed_out = 0 # Whether a "Bail out!" directive has been seen. | ||||||
|  |  | ||||||
|  | # Whether the TAP plan has been seen or not, and if yes, which kind | ||||||
|  | # it is ("early" is seen before any test result, "late" otherwise). | ||||||
|  | plan_seen = NO_PLAN | ||||||
|  |  | ||||||
|  | ## --------- ## | ||||||
|  | ##  PARSING  ## | ||||||
|  | ## --------- ## | ||||||
|  |  | ||||||
|  | is_first_read = 1 | ||||||
|  |  | ||||||
|  | while (1) | ||||||
|  |   { | ||||||
|  |     # Involutions required so that we are able to read the exit status | ||||||
|  |     # from the last input line. | ||||||
|  |     st = getline | ||||||
|  |     if (st < 0) # I/O error. | ||||||
|  |       fatal("I/O error while reading from input stream") | ||||||
|  |     else if (st == 0) # End-of-input | ||||||
|  |       { | ||||||
|  |         if (is_first_read) | ||||||
|  |           abort("in input loop: only one input line") | ||||||
|  |         break | ||||||
|  |       } | ||||||
|  |     if (is_first_read) | ||||||
|  |       { | ||||||
|  |         is_first_read = 0 | ||||||
|  |         nextline = $0 | ||||||
|  |         continue | ||||||
|  |       } | ||||||
|  |     else | ||||||
|  |       { | ||||||
|  |         curline = nextline | ||||||
|  |         nextline = $0 | ||||||
|  |         $0 = curline | ||||||
|  |       } | ||||||
|  |     # Copy any input line verbatim into the log file. | ||||||
|  |     print | "cat >&3" | ||||||
|  |     # Parsing of TAP input should stop after a "Bail out!" directive. | ||||||
|  |     if (bailed_out) | ||||||
|  |       continue | ||||||
|  |  | ||||||
|  |     # TAP test result. | ||||||
|  |     if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/) | ||||||
|  |       { | ||||||
|  |         testno += 1 | ||||||
|  |         setup_result_obj($0) | ||||||
|  |         handle_tap_result() | ||||||
|  |       } | ||||||
|  |     # TAP plan (normal or "SKIP" without explanation). | ||||||
|  |     else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/) | ||||||
|  |       { | ||||||
|  |         # The next two lines will put the number of planned tests in $0. | ||||||
|  |         sub("^1\\.\\.", "") | ||||||
|  |         sub("[^0-9]*$", "") | ||||||
|  |         handle_tap_plan($0, "") | ||||||
|  |         continue | ||||||
|  |       } | ||||||
|  |     # TAP "SKIP" plan, with an explanation. | ||||||
|  |     else if ($0 ~ /^1\.\.0+[ \t]*#/) | ||||||
|  |       { | ||||||
|  |         # The next lines will put the skip explanation in $0, stripping | ||||||
|  |         # any leading and trailing whitespace.  This is a little more | ||||||
|  |         # tricky in truth, since we want to also strip a potential leading | ||||||
|  |         # "SKIP" string from the message. | ||||||
|  |         sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "") | ||||||
|  |         sub("[ \t]*$", ""); | ||||||
|  |         handle_tap_plan(0, $0) | ||||||
|  |       } | ||||||
|  |     # "Bail out!" magic. | ||||||
|  |     # Older versions of prove and TAP::Harness (e.g., 3.17) did not | ||||||
|  |     # recognize a "Bail out!" directive when preceded by leading | ||||||
|  |     # whitespace, but more modern versions (e.g., 3.23) do.  So we | ||||||
|  |     # emulate the latter, "more modern" behaviour. | ||||||
|  |     else if ($0 ~ /^[ \t]*Bail out!/) | ||||||
|  |       { | ||||||
|  |         bailed_out = 1 | ||||||
|  |         # Get the bailout message (if any), with leading and trailing | ||||||
|  |         # whitespace stripped.  The message remains stored in `$0`. | ||||||
|  |         sub("^[ \t]*Bail out![ \t]*", ""); | ||||||
|  |         sub("[ \t]*$", ""); | ||||||
|  |         # Format the error message for the | ||||||
|  |         bailout_message = "Bail out!" | ||||||
|  |         if (length($0)) | ||||||
|  |           bailout_message = bailout_message " " $0 | ||||||
|  |         testsuite_error(bailout_message) | ||||||
|  |       } | ||||||
|  |     # Maybe we have too look for dianogtic comments too. | ||||||
|  |     else if (comments != 0) | ||||||
|  |       { | ||||||
|  |         comment = extract_tap_comment($0); | ||||||
|  |         if (length(comment)) | ||||||
|  |           report("#", comment); | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | ## -------- ## | ||||||
|  | ##  FINISH  ## | ||||||
|  | ## -------- ## | ||||||
|  |  | ||||||
|  | # A "Bail out!" directive should cause us to ignore any following TAP | ||||||
|  | # error, as well as a non-zero exit status from the TAP producer. | ||||||
|  | if (!bailed_out) | ||||||
|  |   { | ||||||
|  |     if (!plan_seen) | ||||||
|  |       { | ||||||
|  |         testsuite_error("missing test plan") | ||||||
|  |       } | ||||||
|  |     else if (planned_tests != testno) | ||||||
|  |       { | ||||||
|  |         bad_amount = testno > planned_tests ? "many" : "few" | ||||||
|  |         testsuite_error(sprintf("too %s tests run (expected %d, got %d)", | ||||||
|  |                                 bad_amount, planned_tests, testno)) | ||||||
|  |       } | ||||||
|  |     if (!ignore_exit) | ||||||
|  |       { | ||||||
|  |         # Fetch exit status from the last line. | ||||||
|  |         exit_message = get_test_exit_message(nextline) | ||||||
|  |         if (exit_message) | ||||||
|  |           testsuite_error(exit_message) | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | write_test_results() | ||||||
|  |  | ||||||
|  | exit 0 | ||||||
|  |  | ||||||
|  | } # End of "BEGIN" block. | ||||||
|  | ' | ||||||
|  |  | ||||||
|  | # TODO: document that we consume the file descriptor 3 :-( | ||||||
|  | } 3>"$log_file" | ||||||
|  |  | ||||||
|  | test $? -eq 0 || fatal "I/O or internal error" | ||||||
|  |  | ||||||
|  | # Local Variables: | ||||||
|  | # mode: shell-script | ||||||
|  | # sh-indentation: 2 | ||||||
|  | # eval: (add-hook 'write-file-hooks 'time-stamp) | ||||||
|  | # time-stamp-start: "scriptversion=" | ||||||
|  | # time-stamp-format: "%:y-%02m-%02d.%02H" | ||||||
|  | # time-stamp-time-zone: "UTC" | ||||||
|  | # time-stamp-end: "; # UTC" | ||||||
|  | # End: | ||||||
							
								
								
									
										5
									
								
								clutter/build/autotools/tap-test
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								clutter/build/autotools/tap-test
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | #! /bin/sh | ||||||
|  |  | ||||||
|  | # run a GTest in tap mode. The test binary is passed as $1 | ||||||
|  |  | ||||||
|  | $1 -k --tap | ||||||
							
								
								
									
										710
									
								
								clutter/clutter/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										710
									
								
								clutter/clutter/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,710 @@ | |||||||
|  | AUTOMAKE_OPTIONS = subdir-objects | ||||||
|  |  | ||||||
|  | # preamble | ||||||
|  | NULL = | ||||||
|  |  | ||||||
|  | # common definitions | ||||||
|  | CLEANFILES = | ||||||
|  | DISTCLEANFILES = | ||||||
|  | EXTRA_DIST = | ||||||
|  | BUILT_SOURCES = | ||||||
|  |  | ||||||
|  | AM_CPPFLAGS = \ | ||||||
|  | 	-DCLUTTER_PREFIX=\""$(prefix)"\"	\ | ||||||
|  | 	-DCLUTTER_LIBDIR=\""$(libdir)"\"	\ | ||||||
|  | 	-DCLUTTER_DATADIR=\""$(datadir)"\"	\ | ||||||
|  | 	-DCLUTTER_LOCALEDIR=\""$(localedir)"\"	\ | ||||||
|  | 	-DCLUTTER_SYSCONFDIR=\""$(sysconfdir)"\" \ | ||||||
|  | 	-DCLUTTER_COMPILATION=1			\ | ||||||
|  | 	-DCOGL_DISABLE_DEPRECATION_WARNINGS	\ | ||||||
|  | 	-DG_LOG_DOMAIN=\"Clutter\" 		\ | ||||||
|  | 	-I$(top_srcdir) 			\ | ||||||
|  | 	-I$(top_srcdir)/clutter			\ | ||||||
|  | 	-I$(top_srcdir)/clutter/cally		\ | ||||||
|  | 	-I$(top_builddir)			\ | ||||||
|  | 	-I$(top_builddir)/clutter		\ | ||||||
|  | 	-I$(top_srcdir)/../cogl			\ | ||||||
|  | 	-I$(top_builddir)/../cogl		\ | ||||||
|  | 	$(CLUTTER_DEPRECATED_CFLAGS)		\ | ||||||
|  | 	$(CLUTTER_DEBUG_CFLAGS)			\ | ||||||
|  | 	$(CLUTTER_HIDDEN_VISIBILITY_CFLAGS)	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | AM_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS) | ||||||
|  |  | ||||||
|  | # these are the gir files we generate using g-ir-scanner | ||||||
|  | INTROSPECTION_GIRS = | ||||||
|  |  | ||||||
|  | # the base include path for headers | ||||||
|  | clutter_base_includedir = $(includedir)/mutter/clutter-$(CLUTTER_API_VERSION) | ||||||
|  | clutter_includedir = $(clutter_base_includedir)/clutter | ||||||
|  | clutter_deprecateddir = $(clutter_base_includedir)/clutter/deprecated | ||||||
|  |  | ||||||
|  | # pkg-config files | ||||||
|  | pc_files = | ||||||
|  |  | ||||||
|  | # common sources - please, keep these sorted alphabetically | ||||||
|  | source_h =					\ | ||||||
|  | 	clutter-action.h		\ | ||||||
|  | 	clutter-actor-meta.h		\ | ||||||
|  | 	clutter-actor.h		\ | ||||||
|  | 	clutter-align-constraint.h	\ | ||||||
|  | 	clutter-animatable.h          \ | ||||||
|  | 	clutter-backend.h		\ | ||||||
|  | 	clutter-bind-constraint.h	\ | ||||||
|  | 	clutter-binding-pool.h 	\ | ||||||
|  | 	clutter-bin-layout.h		\ | ||||||
|  | 	clutter-blur-effect.h		\ | ||||||
|  | 	clutter-box-layout.h		\ | ||||||
|  | 	clutter-brightness-contrast-effect.h	\ | ||||||
|  | 	clutter-cairo.h		\ | ||||||
|  | 	clutter-canvas.h		\ | ||||||
|  | 	clutter-child-meta.h		\ | ||||||
|  | 	clutter-click-action.h	\ | ||||||
|  | 	clutter-clone.h		\ | ||||||
|  | 	clutter-color-static.h	\ | ||||||
|  | 	clutter-color.h		\ | ||||||
|  | 	clutter-colorize-effect.h	\ | ||||||
|  | 	clutter-constraint.h		\ | ||||||
|  | 	clutter-container.h		\ | ||||||
|  | 	clutter-content.h		\ | ||||||
|  | 	clutter-deform-effect.h	\ | ||||||
|  | 	clutter-deprecated.h		\ | ||||||
|  | 	clutter-desaturate-effect.h	\ | ||||||
|  | 	clutter-device-manager.h	\ | ||||||
|  | 	clutter-drag-action.h		\ | ||||||
|  | 	clutter-drop-action.h		\ | ||||||
|  | 	clutter-effect.h		\ | ||||||
|  | 	clutter-enums.h		\ | ||||||
|  | 	clutter-event.h 		\ | ||||||
|  | 	clutter-feature.h 		\ | ||||||
|  | 	clutter-fixed-layout.h	\ | ||||||
|  | 	clutter-flow-layout.h		\ | ||||||
|  | 	clutter-gesture-action.h 	\ | ||||||
|  | 	clutter-grid-layout.h 	\ | ||||||
|  | 	clutter-group.h 		\ | ||||||
|  | 	clutter-image.h		\ | ||||||
|  | 	clutter-input-device.h	\ | ||||||
|  | 	clutter-input-device-tool.h	\ | ||||||
|  |         clutter-interval.h            \ | ||||||
|  | 	clutter-keyframe-transition.h	\ | ||||||
|  | 	clutter-keysyms.h 		\ | ||||||
|  | 	clutter-layout-manager.h	\ | ||||||
|  | 	clutter-layout-meta.h		\ | ||||||
|  | 	clutter-macros.h		\ | ||||||
|  | 	clutter-main.h		\ | ||||||
|  | 	clutter-offscreen-effect.h	\ | ||||||
|  | 	clutter-page-turn-effect.h	\ | ||||||
|  | 	clutter-paint-nodes.h		\ | ||||||
|  | 	clutter-paint-node.h		\ | ||||||
|  | 	clutter-pan-action.h		\ | ||||||
|  | 	clutter-path-constraint.h	\ | ||||||
|  | 	clutter-path.h		\ | ||||||
|  | 	clutter-property-transition.h	\ | ||||||
|  | 	clutter-rotate-action.h	\ | ||||||
|  | 	clutter-script.h		\ | ||||||
|  | 	clutter-scriptable.h		\ | ||||||
|  | 	clutter-scroll-actor.h	\ | ||||||
|  | 	clutter-settings.h		\ | ||||||
|  | 	clutter-shader-effect.h	\ | ||||||
|  | 	clutter-shader-types.h	\ | ||||||
|  | 	clutter-swipe-action.h	\ | ||||||
|  | 	clutter-snap-constraint.h	\ | ||||||
|  | 	clutter-stage.h 		\ | ||||||
|  | 	clutter-stage-manager.h	\ | ||||||
|  | 	clutter-stage-view.h		\ | ||||||
|  | 	clutter-tap-action.h		\ | ||||||
|  | 	clutter-test-utils.h		\ | ||||||
|  | 	clutter-texture.h 		\ | ||||||
|  | 	clutter-text.h		\ | ||||||
|  | 	clutter-text-buffer.h		\ | ||||||
|  | 	clutter-timeline.h 		\ | ||||||
|  | 	clutter-transition-group.h	\ | ||||||
|  | 	clutter-transition.h		\ | ||||||
|  | 	clutter-types.h		\ | ||||||
|  | 	clutter-units.h 		\ | ||||||
|  | 	clutter-virtual-input-device.h	\ | ||||||
|  | 	clutter-zoom-action.h		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | source_c = \ | ||||||
|  | 	clutter-action.c		\ | ||||||
|  | 	clutter-actor-box.c		\ | ||||||
|  | 	clutter-actor-meta.c		\ | ||||||
|  | 	clutter-actor.c		\ | ||||||
|  | 	clutter-align-constraint.c	\ | ||||||
|  | 	clutter-animatable.c		\ | ||||||
|  | 	clutter-backend.c		\ | ||||||
|  | 	clutter-base-types.c		\ | ||||||
|  | 	clutter-bezier.c		\ | ||||||
|  | 	clutter-bind-constraint.c	\ | ||||||
|  | 	clutter-binding-pool.c	\ | ||||||
|  | 	clutter-bin-layout.c		\ | ||||||
|  | 	clutter-blur-effect.c		\ | ||||||
|  | 	clutter-box-layout.c		\ | ||||||
|  | 	clutter-brightness-contrast-effect.c	\ | ||||||
|  | 	clutter-cairo.c		\ | ||||||
|  | 	clutter-canvas.c		\ | ||||||
|  | 	clutter-child-meta.c		\ | ||||||
|  | 	clutter-click-action.c	\ | ||||||
|  | 	clutter-clone.c		\ | ||||||
|  | 	clutter-color.c 		\ | ||||||
|  | 	clutter-colorize-effect.c	\ | ||||||
|  | 	clutter-constraint.c		\ | ||||||
|  | 	clutter-container.c		\ | ||||||
|  | 	clutter-content.c		\ | ||||||
|  | 	clutter-deform-effect.c	\ | ||||||
|  | 	clutter-desaturate-effect.c	\ | ||||||
|  | 	clutter-device-manager.c	\ | ||||||
|  | 	clutter-drag-action.c		\ | ||||||
|  | 	clutter-drop-action.c		\ | ||||||
|  | 	clutter-effect.c		\ | ||||||
|  | 	clutter-event.c 		\ | ||||||
|  | 	clutter-feature.c 		\ | ||||||
|  | 	clutter-fixed-layout.c	\ | ||||||
|  | 	clutter-flatten-effect.c	\ | ||||||
|  | 	clutter-flow-layout.c		\ | ||||||
|  | 	clutter-gesture-action.c 	\ | ||||||
|  | 	clutter-grid-layout.c 	\ | ||||||
|  | 	clutter-image.c		\ | ||||||
|  | 	clutter-input-device.c	\ | ||||||
|  | 	clutter-input-device-tool.c	\ | ||||||
|  | 	clutter-virtual-input-device.c	\ | ||||||
|  | 	clutter-interval.c            \ | ||||||
|  | 	clutter-keyframe-transition.c	\ | ||||||
|  | 	clutter-keysyms-table.c	\ | ||||||
|  | 	clutter-layout-manager.c	\ | ||||||
|  | 	clutter-layout-meta.c		\ | ||||||
|  | 	clutter-main.c 		\ | ||||||
|  | 	clutter-master-clock.c	\ | ||||||
|  | 	clutter-master-clock-default.c	\ | ||||||
|  | 	clutter-offscreen-effect.c	\ | ||||||
|  | 	clutter-page-turn-effect.c	\ | ||||||
|  | 	clutter-paint-nodes.c		\ | ||||||
|  | 	clutter-paint-node.c		\ | ||||||
|  | 	clutter-pan-action.c		\ | ||||||
|  | 	clutter-path-constraint.c	\ | ||||||
|  | 	clutter-path.c		\ | ||||||
|  | 	clutter-property-transition.c	\ | ||||||
|  | 	clutter-rotate-action.c	\ | ||||||
|  | 	clutter-script.c		\ | ||||||
|  | 	clutter-script-parser.c	\ | ||||||
|  | 	clutter-scriptable.c		\ | ||||||
|  | 	clutter-scroll-actor.c	\ | ||||||
|  | 	clutter-settings.c		\ | ||||||
|  | 	clutter-shader-effect.c	\ | ||||||
|  | 	clutter-shader-types.c	\ | ||||||
|  | 	clutter-swipe-action.c	\ | ||||||
|  | 	clutter-snap-constraint.c	\ | ||||||
|  | 	clutter-stage.c		\ | ||||||
|  | 	clutter-stage-manager.c	\ | ||||||
|  | 	clutter-stage-view.c	\ | ||||||
|  | 	clutter-stage-window.c	\ | ||||||
|  | 	clutter-tap-action.c		\ | ||||||
|  | 	clutter-test-utils.c		\ | ||||||
|  | 	clutter-text.c		\ | ||||||
|  | 	clutter-text-buffer.c		\ | ||||||
|  | 	clutter-transition-group.c	\ | ||||||
|  | 	clutter-transition.c		\ | ||||||
|  | 	clutter-timeline.c 		\ | ||||||
|  | 	clutter-units.c		\ | ||||||
|  | 	clutter-util.c 		\ | ||||||
|  | 	clutter-paint-volume.c 	\ | ||||||
|  | 	clutter-zoom-action.c 	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # private headers; these should not be distributed or introspected | ||||||
|  | source_h_priv = \ | ||||||
|  | 	clutter-actor-meta-private.h		\ | ||||||
|  | 	clutter-actor-private.h			\ | ||||||
|  | 	clutter-backend-private.h		\ | ||||||
|  | 	clutter-bezier.h			\ | ||||||
|  | 	clutter-constraint-private.h		\ | ||||||
|  | 	clutter-content-private.h		\ | ||||||
|  | 	clutter-debug.h 			\ | ||||||
|  | 	clutter-device-manager-private.h	\ | ||||||
|  | 	clutter-easing.h			\ | ||||||
|  | 	clutter-effect-private.h		\ | ||||||
|  | 	clutter-event-translator.h		\ | ||||||
|  | 	clutter-event-private.h			\ | ||||||
|  | 	clutter-flatten-effect.h		\ | ||||||
|  | 	clutter-gesture-action-private.h	\ | ||||||
|  | 	clutter-id-pool.h 			\ | ||||||
|  | 	clutter-master-clock.h			\ | ||||||
|  | 	clutter-master-clock-default.h		\ | ||||||
|  | 	clutter-offscreen-effect-private.h	\ | ||||||
|  | 	clutter-paint-node-private.h		\ | ||||||
|  | 	clutter-paint-volume-private.h		\ | ||||||
|  | 	clutter-private.h 			\ | ||||||
|  | 	clutter-script-private.h		\ | ||||||
|  | 	clutter-settings-private.h		\ | ||||||
|  | 	clutter-stage-manager-private.h		\ | ||||||
|  | 	clutter-stage-private.h			\ | ||||||
|  | 	clutter-stage-window.h			\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # private source code; these should not be introspected | ||||||
|  | source_c_priv = \ | ||||||
|  | 	clutter-easing.c		\ | ||||||
|  | 	clutter-event-translator.c	\ | ||||||
|  | 	clutter-id-pool.c 		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # deprecated installed headers | ||||||
|  | deprecated_h = \ | ||||||
|  | 	deprecated/clutter-actor.h			\ | ||||||
|  | 	deprecated/clutter-alpha.h 			\ | ||||||
|  | 	deprecated/clutter-animatable.h		\ | ||||||
|  | 	deprecated/clutter-animation.h		\ | ||||||
|  | 	deprecated/clutter-animator.h			\ | ||||||
|  | 	deprecated/clutter-backend.h			\ | ||||||
|  | 	deprecated/clutter-behaviour.h 		\ | ||||||
|  | 	deprecated/clutter-behaviour-depth.h 		\ | ||||||
|  | 	deprecated/clutter-behaviour-ellipse.h	\ | ||||||
|  | 	deprecated/clutter-behaviour-opacity.h 	\ | ||||||
|  | 	deprecated/clutter-behaviour-path.h 		\ | ||||||
|  | 	deprecated/clutter-behaviour-rotate.h 	\ | ||||||
|  | 	deprecated/clutter-behaviour-scale.h 		\ | ||||||
|  | 	deprecated/clutter-bin-layout.h		\ | ||||||
|  | 	deprecated/clutter-box.h			\ | ||||||
|  | 	deprecated/clutter-cairo-texture.h		\ | ||||||
|  | 	deprecated/clutter-container.h		\ | ||||||
|  | 	deprecated/clutter-frame-source.h		\ | ||||||
|  | 	deprecated/clutter-group.h			\ | ||||||
|  | 	deprecated/clutter-input-device.h		\ | ||||||
|  | 	deprecated/clutter-keysyms.h			\ | ||||||
|  | 	deprecated/clutter-list-model.h			\ | ||||||
|  | 	deprecated/clutter-main.h			\ | ||||||
|  | 	deprecated/clutter-media.h			\ | ||||||
|  | 	deprecated/clutter-model.h			\ | ||||||
|  | 	deprecated/clutter-rectangle.h		\ | ||||||
|  | 	deprecated/clutter-score.h 			\ | ||||||
|  | 	deprecated/clutter-shader.h 			\ | ||||||
|  | 	deprecated/clutter-stage-manager.h		\ | ||||||
|  | 	deprecated/clutter-stage.h			\ | ||||||
|  | 	deprecated/clutter-state.h			\ | ||||||
|  | 	deprecated/clutter-table-layout.h		\ | ||||||
|  | 	deprecated/clutter-texture.h			\ | ||||||
|  | 	deprecated/clutter-timeline.h 		\ | ||||||
|  | 	deprecated/clutter-timeout-pool.h 		\ | ||||||
|  | 	deprecated/clutter-util.h 			\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # deprecated source code | ||||||
|  | deprecated_c = \ | ||||||
|  | 	deprecated/clutter-actor-deprecated.c		\ | ||||||
|  | 	deprecated/clutter-alpha.c 			\ | ||||||
|  | 	deprecated/clutter-animation.c		\ | ||||||
|  | 	deprecated/clutter-animator.c			\ | ||||||
|  | 	deprecated/clutter-behaviour.c 		\ | ||||||
|  | 	deprecated/clutter-behaviour-depth.c		\ | ||||||
|  | 	deprecated/clutter-behaviour-ellipse.c	\ | ||||||
|  | 	deprecated/clutter-behaviour-opacity.c	\ | ||||||
|  | 	deprecated/clutter-behaviour-path.c		\ | ||||||
|  | 	deprecated/clutter-behaviour-rotate.c		\ | ||||||
|  | 	deprecated/clutter-behaviour-scale.c		\ | ||||||
|  | 	deprecated/clutter-box.c			\ | ||||||
|  | 	deprecated/clutter-cairo-texture.c		\ | ||||||
|  | 	deprecated/clutter-frame-source.c		\ | ||||||
|  | 	deprecated/clutter-group.c 			\ | ||||||
|  | 	deprecated/clutter-input-device-deprecated.c	\ | ||||||
|  | 	deprecated/clutter-layout-manager-deprecated.c \ | ||||||
|  | 	deprecated/clutter-list-model.c			\ | ||||||
|  | 	deprecated/clutter-media.c			\ | ||||||
|  | 	deprecated/clutter-model.c			\ | ||||||
|  | 	deprecated/clutter-rectangle.c 		\ | ||||||
|  | 	deprecated/clutter-score.c 			\ | ||||||
|  | 	deprecated/clutter-shader.c 			\ | ||||||
|  | 	deprecated/clutter-state.c			\ | ||||||
|  | 	deprecated/clutter-table-layout.c		\ | ||||||
|  | 	deprecated/clutter-texture.c 			\ | ||||||
|  | 	deprecated/clutter-timeout-pool.c		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # deprecated private headers; these should not be installed | ||||||
|  | deprecated_h_priv = \ | ||||||
|  | 	deprecated/clutter-model-private.h	\ | ||||||
|  | 	deprecated/clutter-timeout-interval.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # deprecated private source code; these should not be introspected | ||||||
|  | deprecated_c_priv = \ | ||||||
|  | 	deprecated/clutter-timeout-interval.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # built sources | ||||||
|  | built_source_c = \ | ||||||
|  | 	clutter-enum-types.c			\ | ||||||
|  | 	clutter-marshal.c			\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # built headers | ||||||
|  | built_source_h = \ | ||||||
|  | 	clutter-enum-types.h			\ | ||||||
|  | 	clutter-marshal.h			\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | # config header | ||||||
|  | DISTCLEANFILES += clutter-config.h | ||||||
|  | EXTRA_DIST += clutter-config.h.in | ||||||
|  |  | ||||||
|  | # version header | ||||||
|  | DISTCLEANFILES += clutter-version.h | ||||||
|  | EXTRA_DIST += clutter-version.h.in clutter-version.h | ||||||
|  |  | ||||||
|  | # key symbol update script | ||||||
|  | EXTRA_DIST += clutter-keysyms-update.pl | ||||||
|  |  | ||||||
|  | pc_files += mutter-clutter-$(CLUTTER_API_VERSION).pc | ||||||
|  |  | ||||||
|  | # in order to be compatible with Clutter < 1.10, when we shipped a single | ||||||
|  | # shared library whose name was determined by the single backend it | ||||||
|  | # supported, we need to install symbolic links so that existing applications | ||||||
|  | # using Clutter won't break in the Brave New World of multi-backend support | ||||||
|  | # in the same shared object. | ||||||
|  | compat_libs = | ||||||
|  |  | ||||||
|  | # backends source listings | ||||||
|  | # | ||||||
|  | #   backend_source_c := source code | ||||||
|  | #   backend_source_h := installed public headers | ||||||
|  | #   backend_source_c_priv := source that should not be scanned by g-i | ||||||
|  | #   backend_source_h_priv := private headers | ||||||
|  | #   backend_source_built := built sources | ||||||
|  | # | ||||||
|  | backend_source_c = | ||||||
|  | backend_source_h = | ||||||
|  | backend_source_c_priv = | ||||||
|  | backend_source_h_priv = | ||||||
|  | backend_source_built = | ||||||
|  |  | ||||||
|  | # X11 backend rules | ||||||
|  | x11_source_c = \ | ||||||
|  | 	x11/clutter-backend-x11.c		\ | ||||||
|  | 	x11/clutter-device-manager-core-x11.c	\ | ||||||
|  | 	x11/clutter-event-x11.c		\ | ||||||
|  | 	x11/clutter-input-device-core-x11.c	\ | ||||||
|  | 	x11/clutter-keymap-x11.c		\ | ||||||
|  | 	x11/clutter-stage-x11.c		\ | ||||||
|  | 	x11/clutter-x11-texture-pixmap.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_h = \ | ||||||
|  | 	x11/clutter-x11.h			\ | ||||||
|  | 	x11/clutter-x11-texture-pixmap.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_h_priv = \ | ||||||
|  | 	x11/clutter-backend-x11.h		\ | ||||||
|  | 	x11/clutter-device-manager-core-x11.h	\ | ||||||
|  | 	x11/clutter-input-device-core-x11.h	\ | ||||||
|  | 	x11/clutter-keymap-x11.h		\ | ||||||
|  | 	x11/clutter-settings-x11.h		\ | ||||||
|  | 	x11/clutter-stage-x11.h		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_c_priv = \ | ||||||
|  | 	x11/xsettings/xsettings-client.c	\ | ||||||
|  | 	x11/xsettings/xsettings-client.h	\ | ||||||
|  | 	x11/xsettings/xsettings-common.c	\ | ||||||
|  | 	x11/xsettings/xsettings-common.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_c += \ | ||||||
|  | 	x11/clutter-device-manager-xi2.c	\ | ||||||
|  | 	x11/clutter-input-device-xi2.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_h_priv += \ | ||||||
|  | 	x11/clutter-device-manager-xi2.h	\ | ||||||
|  | 	x11/clutter-input-device-xi2.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_c += \ | ||||||
|  | 	x11/clutter-virtual-input-device-x11.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | x11_source_h_priv += \ | ||||||
|  | 	x11/clutter-virtual-input-device-x11.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | backend_source_h += $(x11_source_h) | ||||||
|  | backend_source_c += $(x11_source_c) | ||||||
|  | backend_source_h_priv += $(x11_source_h_priv) | ||||||
|  | backend_source_c_priv += $(x11_source_c_priv) | ||||||
|  |  | ||||||
|  | # the list of files we want to introspect on X11 | ||||||
|  | x11_introspection = $(x11_source_c) $(x11_source_h) | ||||||
|  |  | ||||||
|  | clutterx11_includedir = $(clutter_includedir)/x11 | ||||||
|  | clutterx11_include_HEADERS = $(x11_source_h) | ||||||
|  |  | ||||||
|  | mutter-clutter-x11-$(CLUTTER_API_VERSION).pc: mutter-clutter-$(CLUTTER_API_VERSION).pc | ||||||
|  | 	$(QUIET_GEN)cp -f $< $(@F) | ||||||
|  |  | ||||||
|  | pc_files += mutter-clutter-x11-$(CLUTTER_API_VERSION).pc | ||||||
|  |  | ||||||
|  | # Shared cogl backend files | ||||||
|  | cogl_source_h = | ||||||
|  |  | ||||||
|  | cogl_source_c = \ | ||||||
|  | 	cogl/clutter-stage-cogl.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | cogl_source_h_priv = \ | ||||||
|  | 	cogl/clutter-stage-cogl.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | cogl_source_c_priv = | ||||||
|  |  | ||||||
|  | backend_source_h += $(cogl_source_h) | ||||||
|  | backend_source_c += $(cogl_source_c) | ||||||
|  | backend_source_h_priv += $(cogl_source_h_priv) | ||||||
|  | backend_source_c_priv += $(cogl_source_c_priv) | ||||||
|  |  | ||||||
|  | backend_source_h += $(glx_source_h) | ||||||
|  | backend_source_c += $(glx_source_c) | ||||||
|  |  | ||||||
|  | evdev_c_priv = \ | ||||||
|  | 	evdev/clutter-device-manager-evdev.c	\ | ||||||
|  | 	evdev/clutter-input-device-evdev.c	\ | ||||||
|  | 	evdev/clutter-seat-evdev.c		\ | ||||||
|  | 	evdev/clutter-virtual-input-device-evdev.c	\ | ||||||
|  | 	evdev/clutter-event-evdev.c		\ | ||||||
|  | 	evdev/clutter-input-device-tool-evdev.c	\ | ||||||
|  | 	$(NULL) | ||||||
|  | evdev_h_priv = \ | ||||||
|  | 	evdev/clutter-device-manager-evdev.h	\ | ||||||
|  | 	evdev/clutter-input-device-evdev.h	\ | ||||||
|  | 	evdev/clutter-seat-evdev.h		\ | ||||||
|  | 	evdev/clutter-input-device-tool-evdev.h	\ | ||||||
|  | 	evdev/clutter-virtual-input-device-evdev.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  | evdev_h = evdev/clutter-evdev.h | ||||||
|  |  | ||||||
|  | if SUPPORT_WAYLAND | ||||||
|  | backend_source_c_priv += $(evdev_c_priv) | ||||||
|  | backend_source_h_priv += $(evdev_h_priv) | ||||||
|  | backend_source_h += $(evdev_h) | ||||||
|  |  | ||||||
|  | clutterevdev_includedir = $(clutter_includedir)/evdev | ||||||
|  | clutterevdev_include_HEADERS = $(evdev_h) | ||||||
|  |  | ||||||
|  | backend_source_c += evdev/clutter-xkb-utils.c | ||||||
|  | backend_source_h_priv += evdev/clutter-xkb-utils.h | ||||||
|  |  | ||||||
|  | # EGL backend rules | ||||||
|  | egl_source_h = \ | ||||||
|  | 	egl/clutter-egl-headers.h	\ | ||||||
|  | 	egl/clutter-egl.h		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | egl_source_h_priv = egl/clutter-backend-eglnative.h | ||||||
|  | egl_source_c = egl/clutter-backend-eglnative.c | ||||||
|  |  | ||||||
|  | wayland_compositor_source_h = \ | ||||||
|  | 	wayland/clutter-wayland-compositor.h		\ | ||||||
|  | 	wayland/clutter-wayland-surface.h | ||||||
|  | backend_source_h += $(wayland_compositor_source_h) | ||||||
|  | backend_source_c += \ | ||||||
|  | 	wayland/clutter-wayland-surface.c | ||||||
|  |  | ||||||
|  | wayland_compositor_includedir = $(clutter_includedir)/wayland | ||||||
|  | wayland_compositor_include_HEADERS = $(wayland_compositor_source_h) | ||||||
|  |  | ||||||
|  | backend_source_h += $(egl_source_h) | ||||||
|  | backend_source_c += $(egl_source_c) | ||||||
|  | backend_source_h_priv += $(egl_source_h_priv) | ||||||
|  |  | ||||||
|  | clutteregl_includedir = $(clutter_includedir)/egl | ||||||
|  | clutteregl_include_HEADERS = $(egl_source_h) | ||||||
|  | endif # SUPPORT_WAYLAND | ||||||
|  |  | ||||||
|  | # cally | ||||||
|  | cally_sources_h = \ | ||||||
|  | 	cally/cally-actor.h		\ | ||||||
|  | 	cally/cally-clone.h		\ | ||||||
|  | 	cally/cally-factory.h		\ | ||||||
|  | 	cally/cally-group.h		\ | ||||||
|  | 	cally/cally.h			\ | ||||||
|  | 	cally/cally-main.h		\ | ||||||
|  | 	cally/cally-rectangle.h	\ | ||||||
|  | 	cally/cally-root.h		\ | ||||||
|  | 	cally/cally-stage.h		\ | ||||||
|  | 	cally/cally-text.h		\ | ||||||
|  | 	cally/cally-texture.h		\ | ||||||
|  | 	cally/cally-util.h		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | cally_sources_c = \ | ||||||
|  | 	cally/cally-actor.c		\ | ||||||
|  | 	cally/cally.c			\ | ||||||
|  | 	cally/cally-clone.c		\ | ||||||
|  | 	cally/cally-group.c		\ | ||||||
|  | 	cally/cally-rectangle.c	\ | ||||||
|  | 	cally/cally-root.c		\ | ||||||
|  | 	cally/cally-stage.c		\ | ||||||
|  | 	cally/cally-text.c		\ | ||||||
|  | 	cally/cally-texture.c		\ | ||||||
|  | 	cally/cally-util.c		\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | cally_sources_private = \ | ||||||
|  | 	cally/cally-actor-private.h	\ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | cally_includedir = $(clutter_base_includedir)/cally | ||||||
|  | cally_include_HEADERS = $(cally_sources_h) | ||||||
|  |  | ||||||
|  | # general build rules: | ||||||
|  | # you should not need to modify anything below this point | ||||||
|  |  | ||||||
|  | # glib-genmarshal rules | ||||||
|  | glib_marshal_list = clutter-marshal.list | ||||||
|  | glib_marshal_prefix = _clutter_marshal | ||||||
|  | include $(srcdir)/Makefile.am.marshal | ||||||
|  |  | ||||||
|  | # glib-mkenums rules | ||||||
|  | glib_enum_h = clutter-enum-types.h | ||||||
|  | glib_enum_c = clutter-enum-types.c | ||||||
|  | glib_enum_headers = $(source_h) $(deprecated_h) | ||||||
|  | include $(srcdir)/Makefile.am.enums | ||||||
|  |  | ||||||
|  | pkgconfigdir = $(libdir)/pkgconfig | ||||||
|  | pkgconfig_DATA = $(pc_files) | ||||||
|  | DISTCLEANFILES += $(pc_files) | ||||||
|  |  | ||||||
|  | clutter_include_HEADERS = $(source_h) clutter.h clutter-version.h clutter-autocleanups.h clutter-mutter.h | ||||||
|  | nodist_clutter_include_HEADERS = clutter-config.h $(built_source_h) | ||||||
|  |  | ||||||
|  | clutter_deprecated_HEADERS = $(deprecated_h) | ||||||
|  |  | ||||||
|  | mutterlibdir = $(libdir)/mutter | ||||||
|  | mutterlib_LTLIBRARIES = libmutter-clutter-@CLUTTER_API_VERSION@.la | ||||||
|  |  | ||||||
|  | libmutter_clutter_@CLUTTER_API_VERSION@_la_LIBADD = \ | ||||||
|  | 	$(LIBM) \ | ||||||
|  | 	$(CLUTTER_LIBS) \ | ||||||
|  | 	$(top_builddir)/../cogl/cogl/libmutter-cogl.la \ | ||||||
|  | 	$(top_builddir)/../cogl/cogl-pango/libmutter-cogl-pango.la \ | ||||||
|  | 	$(top_builddir)/../cogl/cogl-path/libmutter-cogl-path.la \ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | libmutter_clutter_@CLUTTER_API_VERSION@_la_SOURCES = \ | ||||||
|  | 	$(backend_source_c) \ | ||||||
|  | 	$(backend_source_h) \ | ||||||
|  | 	$(backend_source_c_priv) \ | ||||||
|  | 	$(backend_source_h_priv) \ | ||||||
|  | 	$(source_c) \ | ||||||
|  | 	$(source_h) \ | ||||||
|  | 	$(source_c_priv) \ | ||||||
|  | 	$(source_h_priv) \ | ||||||
|  | 	$(deprecated_c) \ | ||||||
|  | 	$(deprecated_h) \ | ||||||
|  | 	$(deprecated_c_priv) \ | ||||||
|  | 	$(deprecated_h_priv) \ | ||||||
|  | 	$(cally_sources_c) \ | ||||||
|  | 	$(cally_sources_h) \ | ||||||
|  | 	$(cally_sources_private) \ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | nodist_libmutter_clutter_@CLUTTER_API_VERSION@_la_SOURCES = \ | ||||||
|  | 	$(backend_source_built) \ | ||||||
|  | 	$(built_source_c) \ | ||||||
|  | 	$(built_source_h) | ||||||
|  |  | ||||||
|  | libmutter_clutter_@CLUTTER_API_VERSION@_la_LDFLAGS = \ | ||||||
|  | 	$(CLUTTER_LINK_FLAGS) \ | ||||||
|  | 	$(CLUTTER_LT_LDFLAGS) \ | ||||||
|  | 	-export-dynamic \ | ||||||
|  | 	-rpath $(mutterlibdir) \ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
|  | install-exec-local: | ||||||
|  | 	test -z "$(mutterlibdir)" || $(MKDIR_P) "$(DESTDIR)$(mutterlibdir)" | ||||||
|  | 	for lib in `echo $(compat_libs)`; do \ | ||||||
|  | 	  (cd $(DESTDIR)$(mutterlibdir) && \ | ||||||
|  | 	    rm -f $$lib.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION); \ | ||||||
|  | 	  ) ; \ | ||||||
|  | 	  (cd $(DESTDIR)$(mutterlibdir) && \ | ||||||
|  | 	    { ln -s -f libmutter-clutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0 || \ | ||||||
|  | 	      { rm -f $$lib.0 && ln -s libmutter-clutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0; }; \ | ||||||
|  | 	    } \ | ||||||
|  | 	  ) ; \ | ||||||
|  | 	  (cd $(DESTDIR)$(mutterlibdir) && \ | ||||||
|  | 	    { ln -s -f libmutter-clutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib || \ | ||||||
|  | 	      { rm -f $$lib && ln -s libmutter-clutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib; }; \ | ||||||
|  | 	    } \ | ||||||
|  | 	  ) ; \ | ||||||
|  | 	done | ||||||
|  |  | ||||||
|  | # gobject-introspection rules | ||||||
|  | -include $(INTROSPECTION_MAKEFILE) | ||||||
|  |  | ||||||
|  | INTROSPECTION_SCANNER_ARGS = --add-include-path=$(top_builddir)/../cogl/cogl --add-include-path=$(top_builddir)/../cogl/cogl-pango | ||||||
|  | INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/../cogl/cogl --includedir=$(top_builddir)/../cogl/cogl-pango | ||||||
|  |  | ||||||
|  | Clutter-@CLUTTER_API_VERSION@.gir: libmutter-clutter-@CLUTTER_API_VERSION@.la Makefile | ||||||
|  |  | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Clutter | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = \ | ||||||
|  | 	$(clutter_include_HEADERS) \ | ||||||
|  | 	$(clutter_deprecated_HEADERS) \ | ||||||
|  | 	$(nodist_clutter_include_HEADERS) \ | ||||||
|  | 	$(source_c) \ | ||||||
|  | 	$(deprecated_c) \ | ||||||
|  | 	$(built_source_c) | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS) | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Cogl-1.0 CoglPango-1.0 Atk-1.0 Json-1.0 | ||||||
|  | Clutter_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ | ||||||
|  | 	--warn-all \ | ||||||
|  | 	--c-include='clutter/clutter.h' \ | ||||||
|  | 	--pkg-export=mutter-clutter-@CLUTTER_API_VERSION@ | ||||||
|  |  | ||||||
|  | INTROSPECTION_GIRS += Clutter-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | Cally-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cally_sources_h) $(cally_sources_c) | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS) | ||||||
|  | Cally_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ | ||||||
|  | 	--warn-all \ | ||||||
|  | 	--c-include='cally/cally.h' \ | ||||||
|  | 	--pkg-export=mutter-cally-@CLUTTER_API_VERSION@ \ | ||||||
|  | 	--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | INTROSPECTION_GIRS += Cally-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | ClutterX11-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = ClutterX11 | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = xlib-2.0 | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_FILES = $(x11_introspection) | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS) | ||||||
|  | ClutterX11_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ | ||||||
|  | 	--warn-all \ | ||||||
|  | 	--c-include='clutter/x11/clutter-x11.h' \ | ||||||
|  | 	--pkg-export=mutter-clutter-x11-@CLUTTER_API_VERSION@ \ | ||||||
|  | 	--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | INTROSPECTION_GIRS += ClutterX11-@CLUTTER_API_VERSION@.gir | ||||||
|  |  | ||||||
|  | # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to | ||||||
|  | # install anything - we need to install inside our prefix. | ||||||
|  | girdir = $(mutterlibdir) | ||||||
|  | gir_DATA = $(INTROSPECTION_GIRS) | ||||||
|  |  | ||||||
|  | typelibdir = $(mutterlibdir) | ||||||
|  | typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) | ||||||
|  |  | ||||||
|  | EXTRA_DIST += \ | ||||||
|  | 	Makefile.am.marshal	\ | ||||||
|  | 	Makefile.am.enums | ||||||
|  |  | ||||||
|  | CLEANFILES += $(gir_DATA) $(typelib_DATA) | ||||||
							
								
								
									
										52
									
								
								clutter/clutter/Makefile.am.enums
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								clutter/clutter/Makefile.am.enums
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | # Rules for generating enumeration types using glib-mkenums | ||||||
|  | # | ||||||
|  | # Define: | ||||||
|  | # 	glib_enum_h = header template file | ||||||
|  | # 	glib_enum_c = source template file | ||||||
|  | # 	glib_enum_headers = list of headers to parse | ||||||
|  | # | ||||||
|  | # before including Makefile.am.enums. You will also need to have | ||||||
|  | # the following targets already defined: | ||||||
|  | # | ||||||
|  | # 	CLEANFILES | ||||||
|  | #	DISTCLEANFILES | ||||||
|  | #	BUILT_SOURCES | ||||||
|  | #	EXTRA_DIST | ||||||
|  | # | ||||||
|  | # Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||||
|  |  | ||||||
|  | # Basic sanity checks | ||||||
|  | $(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS)) | ||||||
|  |  | ||||||
|  | $(if $(or $(glib_enum_h), \ | ||||||
|  |           $(glib_enum_c)),, \ | ||||||
|  |     $(error Need to define glib_enum_h and glib_enum_c)) | ||||||
|  |  | ||||||
|  | $(if $(glib_enum_headers),,$(error Need to define glib_enum_headers)) | ||||||
|  |  | ||||||
|  | enum_tmpl_h=$(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in)) | ||||||
|  | enum_tmpl_c=$(addprefix $(srcdir)/, $(glib_enum_c:.c=.c.in)) | ||||||
|  | enum_headers=$(addprefix $(srcdir)/, $(glib_enum_headers)) | ||||||
|  |  | ||||||
|  | CLEANFILES += stamp-enum-types | ||||||
|  | DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c) | ||||||
|  | BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c) | ||||||
|  | EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c) | ||||||
|  |  | ||||||
|  | stamp-enum-types: $(enum_headers) $(enum_tmpl_h) | ||||||
|  | 	$(AM_V_GEN)$(GLIB_MKENUMS) \ | ||||||
|  | 		--template $(enum_tmpl_h) \ | ||||||
|  | 	$(enum_headers) > xgen-eh \ | ||||||
|  | 	&& (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \ | ||||||
|  | 	&& rm -f xgen-eh \ | ||||||
|  | 	&& echo timestamp > $(@F) | ||||||
|  |  | ||||||
|  | $(glib_enum_h): stamp-enum-types | ||||||
|  | 	@true | ||||||
|  |  | ||||||
|  | $(glib_enum_c): $(enum_headers) $(enum_tmpl_h) $(enum_tmpl_c) | ||||||
|  | 	$(AM_V_GEN)$(GLIB_MKENUMS) \ | ||||||
|  | 		--template $(enum_tmpl_c) \ | ||||||
|  | 	$(enum_headers) > xgen-ec \ | ||||||
|  | 	&& cp -f xgen-ec $(glib_enum_c) \ | ||||||
|  | 	&& rm -f xgen-ec | ||||||
							
								
								
									
										52
									
								
								clutter/clutter/Makefile.am.marshal
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								clutter/clutter/Makefile.am.marshal
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | # Rules for generating marshal files using glib-genmarshal | ||||||
|  | # | ||||||
|  | # Define: | ||||||
|  | # 	glib_marshal_list = marshal list file | ||||||
|  | # 	glib_marshal_prefix = prefix for marshal functions | ||||||
|  | # | ||||||
|  | # before including Makefile.am.marshal. You will also need to have | ||||||
|  | # the following targets already defined: | ||||||
|  | # | ||||||
|  | # 	CLEANFILES | ||||||
|  | #	DISTCLEANFILES | ||||||
|  | #	BUILT_SOURCES | ||||||
|  | #	EXTRA_DIST | ||||||
|  | # | ||||||
|  | # Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||||
|  |  | ||||||
|  | # Basic sanity checks | ||||||
|  | $(if $(GLIB_GENMARSHAL),,$(error Need to define GLIB_GENMARSHAL)) | ||||||
|  |  | ||||||
|  | $(if $(or $(glib_marshal_list), \ | ||||||
|  |           $(glib_marshal_prefix)),, \ | ||||||
|  |     $(error Need to define glib_marshal_list and glib_marshal_prefix)) | ||||||
|  |  | ||||||
|  | marshal_h = $(glib_marshal_list:.list=.h) | ||||||
|  | marshal_c = $(glib_marshal_list:.list=.c) | ||||||
|  | marshal_list = $(addprefix $(srcdir)/, $(glib_marshal_list)) | ||||||
|  |  | ||||||
|  | CLEANFILES += stamp-marshal | ||||||
|  | DISTCLEANFILES += $(marshal_h) $(marshal_c) | ||||||
|  | BUILT_SOURCES += $(marshal_h) $(marshal_c) | ||||||
|  | EXTRA_DIST += $(marshal_list) | ||||||
|  |  | ||||||
|  | stamp-marshal: $(marshal_list) | ||||||
|  | 	$(AM_V_GEN)$(GLIB_GENMARSHAL) \ | ||||||
|  | 		--prefix=$(glib_marshal_prefix) \ | ||||||
|  | 		--header \ | ||||||
|  | 	$(marshal_list) > xgen-mh \ | ||||||
|  | 	&& (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \ | ||||||
|  | 	&& rm -f xgen-mh \ | ||||||
|  | 	&& echo timestamp > $(@F) | ||||||
|  |  | ||||||
|  | $(marshal_h): stamp-marshal | ||||||
|  | 	@true | ||||||
|  |  | ||||||
|  | $(marshal_c): $(marshal_h) | ||||||
|  | 	$(AM_V_GEN)(echo "#include \"$(marshal_h)\"" ; \ | ||||||
|  | 	$(GLIB_GENMARSHAL) \ | ||||||
|  | 		--prefix=$(glib_marshal_prefix) \ | ||||||
|  | 		--body \ | ||||||
|  | 	$(marshal_list)) > xgen-mc \ | ||||||
|  | 	&& cp xgen-mc $(marshal_c) \ | ||||||
|  | 	&& rm -f xgen-mc | ||||||
| @@ -27,7 +27,7 @@ that on CallyRoot: | |||||||
|  |  | ||||||
|   * CallyUtil callbacks these signals are related to key event |   * CallyUtil callbacks these signals are related to key event | ||||||
|     listeners (key snooper simulation). One of the main CallyUtil |     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. |     would prefer to not start to add/mix more functionalities here. | ||||||
|  |  | ||||||
| Ideally it would be better to emit all CallyStage methods from | 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> | 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 | Added dummy padding on the different classes structures, to allow | ||||||
| future expansion of virtual methods. | future expansion of virtual methods. | ||||||
| @@ -393,7 +393,7 @@ Manage properly ATK_STATE_ACTIVE on CallyStage | |||||||
|  |  | ||||||
| * cally/cally-stage.c | * cally/cally-stage.c | ||||||
| Added private struct | 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 | Initialization stuff | ||||||
| (cally_stage_activate_cb) | (cally_stage_activate_cb) | ||||||
| (cally_stage_deactivate_cb): new ClutterStage signal callbacks, change | (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> | 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-actor.[ch]: Reimplemented support for AtkAction interface | ||||||
| 	* cail/cail-root.[ch]: code style review | 	* cail/cail-root.[ch]: code style review | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,12 +22,13 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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 |  * AtkGObject methods | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| @@ -37,3 +38,5 @@ | |||||||
| void _cally_actor_get_top_level_origin (ClutterActor *actor, | void _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||||
|                                         gint         *x, |                                         gint         *x, | ||||||
|                                         gint         *y); |                                         gint         *y); | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_ACTOR_PRIVATE_H__ */ | ||||||
|   | |||||||
| @@ -23,11 +23,12 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * CallyActor: |  * SECTION:cally-actor | ||||||
|  *  |  * @Title: CallyActor | ||||||
|  * Implementation of the ATK interfaces for [class@Clutter.Actor] |  * @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). |  * 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 |  * 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 |  * 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 |  * 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). |  * grab focus). | ||||||
|  * |  * | ||||||
|  * In the same way, we will manage the focus state change management |  * In the same way, we will manage the focus state change management | ||||||
| @@ -66,17 +67,21 @@ | |||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <glib.h> | #include <glib.h> | ||||||
|  | #include <clutter/clutter.h> | ||||||
|  |  | ||||||
| #include "clutter/clutter.h" | #ifdef CLUTTER_WINDOWING_X11 | ||||||
| #include "clutter/clutter-actor-private.h" | #include <clutter/x11/clutter-x11.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| #include "cally/cally-actor.h" | #include "cally-actor.h" | ||||||
| #include "cally/cally-actor-private.h" | #include "cally-actor-private.h" | ||||||
|  |  | ||||||
| typedef struct _CallyActorActionInfo CallyActorActionInfo; | typedef struct _CallyActorActionInfo CallyActorActionInfo; | ||||||
|  |  | ||||||
| @@ -193,6 +198,8 @@ G_DEFINE_TYPE_WITH_CODE (CallyActor, | |||||||
|  * Creates a new #CallyActor for the given @actor |  * Creates a new #CallyActor for the given @actor | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #AtkObject |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| AtkObject * | AtkObject * | ||||||
| cally_actor_new (ClutterActor *actor) | cally_actor_new (ClutterActor *actor) | ||||||
| @@ -305,7 +312,11 @@ cally_actor_finalize (GObject *obj) | |||||||
|  |  | ||||||
|   _cally_actor_clean_action_list (cally_actor); |   _cally_actor_clean_action_list (cally_actor); | ||||||
|  |  | ||||||
|   g_clear_handle_id (&priv->action_idle_handler, g_source_remove); |   if (priv->action_idle_handler) | ||||||
|  |     { | ||||||
|  |       g_source_remove (priv->action_idle_handler); | ||||||
|  |       priv->action_idle_handler = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   if (priv->action_queue) |   if (priv->action_queue) | ||||||
|     { |     { | ||||||
| @@ -595,11 +606,10 @@ cally_actor_real_remove_actor (ClutterActor *container, | |||||||
|   g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0); |   g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0); | ||||||
|  |  | ||||||
|   atk_parent = ATK_OBJECT (data); |   atk_parent = ATK_OBJECT (data); | ||||||
|  |   atk_child = clutter_actor_get_accessible (actor); | ||||||
|  |  | ||||||
|   if (clutter_actor_has_accessible (actor)) |   if (atk_child) | ||||||
|     { |     { | ||||||
|       atk_child = clutter_actor_get_accessible (actor); |  | ||||||
|  |  | ||||||
|       g_value_init (&values.old_value, G_TYPE_POINTER); |       g_value_init (&values.old_value, G_TYPE_POINTER); | ||||||
|       g_value_set_pointer (&values.old_value, atk_parent); |       g_value_set_pointer (&values.old_value, atk_parent); | ||||||
|  |  | ||||||
| @@ -649,7 +659,7 @@ cally_actor_get_extents (AtkComponent *component, | |||||||
|   ClutterActor *actor      = NULL; |   ClutterActor *actor      = NULL; | ||||||
|   gint          top_level_x, top_level_y; |   gint          top_level_x, top_level_y; | ||||||
|   gfloat        f_width, f_height; |   gfloat        f_width, f_height; | ||||||
|   graphene_point3d_t verts[4]; |   ClutterVertex verts[4]; | ||||||
|   ClutterActor  *stage = NULL; |   ClutterActor  *stage = NULL; | ||||||
|  |  | ||||||
|   g_return_if_fail (CALLY_IS_ACTOR (component)); |   g_return_if_fail (CALLY_IS_ACTOR (component)); | ||||||
| @@ -729,7 +739,11 @@ cally_actor_grab_focus (AtkComponent    *component) | |||||||
|  * |  * | ||||||
|  * This gets the top level origin, it is, the position of the stage in |  * This gets the top level origin, it is, the position of the stage in | ||||||
|  * the global screen. You can see it as the absolute display position |  * the global screen. You can see it as the absolute display position | ||||||
|  * of the stage. This is 0,0 for a compositor. |  * of the stage. | ||||||
|  |  * | ||||||
|  |  * FIXME: only the case with x11 is implemented, other backends are | ||||||
|  |  * required | ||||||
|  |  * | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| _cally_actor_get_top_level_origin (ClutterActor *actor, | _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||||
| @@ -737,11 +751,55 @@ _cally_actor_get_top_level_origin (ClutterActor *actor, | |||||||
|                                    gint         *yp) |                                    gint         *yp) | ||||||
| { | { | ||||||
|   /* default values */ |   /* default values */ | ||||||
|  |   gint x = 0; | ||||||
|  |   gint y = 0; | ||||||
|  |  | ||||||
|  | #ifdef CLUTTER_WINDOWING_X11 | ||||||
|  |   if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) | ||||||
|  |     { | ||||||
|  |       ClutterActor *stage      = NULL; | ||||||
|  |       Display *display    = NULL; | ||||||
|  |       Window root_window; | ||||||
|  |       Window stage_window; | ||||||
|  |       Window child; | ||||||
|  |       gint return_val = 0; | ||||||
|  |  | ||||||
|  |       stage = clutter_actor_get_stage (actor); | ||||||
|  |  | ||||||
|  |       /* FIXME: what happens if you use another display with | ||||||
|  |          clutter_backend_x11_set_display ?*/ | ||||||
|  |       display = clutter_x11_get_default_display (); | ||||||
|  |       root_window = clutter_x11_get_root_window (); | ||||||
|  |       stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage)); | ||||||
|  |  | ||||||
|  |       return_val = XTranslateCoordinates (display, stage_window, root_window, | ||||||
|  |                                           0, 0, &x, &y, | ||||||
|  |                                           &child); | ||||||
|  |  | ||||||
|  |       if (!return_val) | ||||||
|  |         g_warning ("[x11] We were not able to get proper absolute " | ||||||
|  |                    "position of the stage"); | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  | #else | ||||||
|  |     { | ||||||
|  |       static gboolean yet_warned = FALSE; | ||||||
|  |  | ||||||
|  |       if (!yet_warned) | ||||||
|  |         { | ||||||
|  |           yet_warned = TRUE; | ||||||
|  |  | ||||||
|  |           g_warning ("The current Clutter backend does not support using " | ||||||
|  |                      "atk_component_get_extents() with ATK_XY_SCREEN."); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   if (xp) |   if (xp) | ||||||
|     *xp = 0; |     *xp = x; | ||||||
|  |  | ||||||
|   if (yp) |   if (yp) | ||||||
|     *yp = 0; |     *yp = y; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* AtkAction implementation */ | /* AtkAction implementation */ | ||||||
| @@ -762,11 +820,10 @@ static gboolean | |||||||
| cally_actor_action_do_action (AtkAction *action, | cally_actor_action_do_action (AtkAction *action, | ||||||
|                              gint       index) |                              gint       index) | ||||||
| { | { | ||||||
|   CallyActor *cally_actor = NULL; |   CallyActor           *cally_actor = NULL; | ||||||
|   AtkStateSet *set = NULL; |   AtkStateSet          *set         = NULL; | ||||||
|   CallyActorPrivate *priv = NULL; |   CallyActorPrivate    *priv        = NULL; | ||||||
|   CallyActorActionInfo *info = NULL; |   CallyActorActionInfo *info        = NULL; | ||||||
|   gboolean did_action = FALSE; |  | ||||||
|  |  | ||||||
|   cally_actor = CALLY_ACTOR (action); |   cally_actor = CALLY_ACTOR (action); | ||||||
|   priv = cally_actor->priv; |   priv = cally_actor->priv; | ||||||
| @@ -774,19 +831,21 @@ cally_actor_action_do_action (AtkAction *action, | |||||||
|   set = atk_object_ref_state_set (ATK_OBJECT (cally_actor)); |   set = atk_object_ref_state_set (ATK_OBJECT (cally_actor)); | ||||||
|  |  | ||||||
|   if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT)) |   if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT)) | ||||||
|     goto out; |     return FALSE; | ||||||
|  |  | ||||||
|   if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) || |   if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) || | ||||||
|       !atk_state_set_contains_state (set, ATK_STATE_SHOWING)) |       !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); |   info = _cally_actor_get_action_info (cally_actor, index); | ||||||
|  |  | ||||||
|   if (info == NULL) |   if (info == NULL) | ||||||
|     goto out; |     return FALSE; | ||||||
|  |  | ||||||
|   if (info->do_action_func == NULL) |   if (info->do_action_func == NULL) | ||||||
|     goto out; |     return FALSE; | ||||||
|  |  | ||||||
|   if (!priv->action_queue) |   if (!priv->action_queue) | ||||||
|     priv->action_queue = g_queue_new (); |     priv->action_queue = g_queue_new (); | ||||||
| @@ -796,12 +855,7 @@ cally_actor_action_do_action (AtkAction *action, | |||||||
|   if (!priv->action_idle_handler) |   if (!priv->action_idle_handler) | ||||||
|     priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor); |     priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor); | ||||||
|  |  | ||||||
|   did_action = TRUE; |   return TRUE; | ||||||
|  |  | ||||||
| out: |  | ||||||
|   g_clear_object (&set); |  | ||||||
|  |  | ||||||
|   return did_action; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static gboolean | static gboolean | ||||||
| @@ -967,7 +1021,7 @@ cally_actor_real_notify_clutter (GObject    *obj, | |||||||
|        * paint it; we don't want this to generate an ATK |        * paint it; we don't want this to generate an ATK | ||||||
|        * state change |        * state change | ||||||
|        */ |        */ | ||||||
|       if (clutter_actor_is_painting_unmapped (actor)) |       if (clutter_actor_is_in_clone_paint (actor)) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|       state = ATK_STATE_SHOWING; |       state = ATK_STATE_SHOWING; | ||||||
| @@ -993,8 +1047,10 @@ _cally_actor_clean_action_list (CallyActor *cally_actor) | |||||||
|  |  | ||||||
|   if (priv->action_list) |   if (priv->action_list) | ||||||
|     { |     { | ||||||
|       g_list_free_full (priv->action_list, |       g_list_foreach (priv->action_list, | ||||||
|                         (GDestroyNotify) _cally_actor_destroy_action_info); |                       (GFunc) _cally_actor_destroy_action_info, | ||||||
|  |                       NULL); | ||||||
|  |       g_list_free (priv->action_list); | ||||||
|       priv->action_list = NULL; |       priv->action_list = NULL; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1032,6 +1088,8 @@ _cally_actor_get_action_info (CallyActor *cally_actor, | |||||||
|  * Adds a new action to be accessed with the #AtkAction interface. |  * Adds a new action to be accessed with the #AtkAction interface. | ||||||
|  * |  * | ||||||
|  * Return value: added action id, or -1 if failure |  * Return value: added action id, or -1 if failure | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| guint | guint | ||||||
| cally_actor_add_action (CallyActor      *cally_actor, | cally_actor_add_action (CallyActor      *cally_actor, | ||||||
| @@ -1061,6 +1119,8 @@ cally_actor_add_action (CallyActor      *cally_actor, | |||||||
|  * Adds a new action to be accessed with the #AtkAction interface. |  * Adds a new action to be accessed with the #AtkAction interface. | ||||||
|  * |  * | ||||||
|  * Return value: added action id, or -1 if failure |  * Return value: added action id, or -1 if failure | ||||||
|  |  * | ||||||
|  |  * Since: 1.6 | ||||||
|  */ |  */ | ||||||
| guint | guint | ||||||
| cally_actor_add_action_full (CallyActor          *cally_actor, | cally_actor_add_action_full (CallyActor          *cally_actor, | ||||||
| @@ -1079,7 +1139,7 @@ cally_actor_add_action_full (CallyActor          *cally_actor, | |||||||
|  |  | ||||||
|   priv = cally_actor->priv; |   priv = cally_actor->priv; | ||||||
|  |  | ||||||
|   info = g_new0 (CallyActorActionInfo, 1); |   info = g_slice_new (CallyActorActionInfo); | ||||||
|   info->name = g_strdup (action_name); |   info->name = g_strdup (action_name); | ||||||
|   info->description = g_strdup (action_description); |   info->description = g_strdup (action_description); | ||||||
|   info->keybinding = g_strdup (action_keybinding); |   info->keybinding = g_strdup (action_keybinding); | ||||||
| @@ -1097,9 +1157,11 @@ cally_actor_add_action_full (CallyActor          *cally_actor, | |||||||
|  * @cally_actor: a #CallyActor |  * @cally_actor: a #CallyActor | ||||||
|  * @action_id: the action id |  * @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 | gboolean | ||||||
| cally_actor_remove_action (CallyActor *cally_actor, | cally_actor_remove_action (CallyActor *cally_actor, | ||||||
| @@ -1129,9 +1191,11 @@ cally_actor_remove_action (CallyActor *cally_actor, | |||||||
|  * @action_name: the name of the action to remove |  * @action_name: the name of the action to remove | ||||||
|  * |  * | ||||||
|  * Removes an action, using the @action_name used when the action was added |  * 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 | gboolean | ||||||
| cally_actor_remove_action_by_name (CallyActor  *cally_actor, | cally_actor_remove_action_by_name (CallyActor  *cally_actor, | ||||||
| @@ -1180,5 +1244,5 @@ _cally_actor_destroy_action_info (gpointer action_info, | |||||||
|   if (info->notify) |   if (info->notify) | ||||||
|     info->notify (info->user_data); |     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/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <atk/atk.h> | #include <atk/atk.h> | ||||||
|  | #include <clutter/clutter.h> | ||||||
| #include "clutter/clutter.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -51,6 +51,8 @@ typedef struct _CallyActorPrivate    CallyActorPrivate; | |||||||
|  * |  * | ||||||
|  * Action function, to be used on #AtkAction implementations as a individual |  * Action function, to be used on #AtkAction implementations as a individual | ||||||
|  * action |  * action | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| typedef void (* CallyActionFunc) (CallyActor *cally_actor); | typedef void (* CallyActionFunc) (CallyActor *cally_actor); | ||||||
|  |  | ||||||
| @@ -60,14 +62,22 @@ typedef void (* CallyActionFunc) (CallyActor *cally_actor); | |||||||
|  * @user_data: user data passed to the function |  * @user_data: user data passed to the function | ||||||
|  * |  * | ||||||
|  * Action function, to be used on #AtkAction implementations as |  * Action function, to be used on #AtkAction implementations as | ||||||
|  * an individual action. |  * an individual action. Unlike #CallyActionFunc, this function | ||||||
|  *  |  * uses the @user_data argument passed to cally_actor_add_action_full(). | ||||||
|  * Unlike #CallyActionFunc, this function uses the @user_data  |  * | ||||||
|  * argument passed to [method@Actor.add_action_full]. |  * Since: 1.6 | ||||||
|  */ |  */ | ||||||
| typedef void (* CallyActionCallback) (CallyActor *cally_actor, | typedef void (* CallyActionCallback) (CallyActor *cally_actor, | ||||||
|                                       gpointer    user_data); |                                       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 | struct _CallyActor | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -79,6 +89,8 @@ struct _CallyActor | |||||||
| /** | /** | ||||||
|  * CallyActorClass: |  * CallyActorClass: | ||||||
|  * @notify_clutter: Signal handler for notify signal on Clutter actor |  * @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 |  * @add_actor: Signal handler for actor-added signal on | ||||||
|  *   ClutterContainer interface |  *   ClutterContainer interface | ||||||
|  * @remove_actor: Signal handler for actor-added signal on |  * @remove_actor: Signal handler for actor-added signal on | ||||||
| @@ -86,6 +98,8 @@ struct _CallyActor | |||||||
|  * |  * | ||||||
|  * The <structname>CallyActorClass</structname> structure contains |  * The <structname>CallyActorClass</structname> structure contains | ||||||
|  * only private data |  * only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyActorClass | struct _CallyActorClass | ||||||
| { | { | ||||||
| @@ -96,6 +110,9 @@ struct _CallyActorClass | |||||||
|   void     (*notify_clutter) (GObject    *object, |   void     (*notify_clutter) (GObject    *object, | ||||||
|                               GParamSpec *pspec); |                               GParamSpec *pspec); | ||||||
|  |  | ||||||
|  |   gboolean (*focus_clutter)  (ClutterActor *actor, | ||||||
|  |                               gpointer      data); | ||||||
|  |  | ||||||
|   gint     (*add_actor)      (ClutterActor *container, |   gint     (*add_actor)      (ClutterActor *container, | ||||||
|                               ClutterActor *actor, |                               ClutterActor *actor, | ||||||
|                               gpointer      data); |                               gpointer      data); | ||||||
| @@ -103,21 +120,25 @@ struct _CallyActorClass | |||||||
|   gint     (*remove_actor)   (ClutterActor *container, |   gint     (*remove_actor)   (ClutterActor *container, | ||||||
|                               ClutterActor *actor, |                               ClutterActor *actor, | ||||||
|                               gpointer      data); |                               gpointer      data); | ||||||
|  |  | ||||||
|  |   /*< private >*/ | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[32]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType      cally_actor_get_type              (void) G_GNUC_CONST; | GType      cally_actor_get_type              (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| AtkObject* cally_actor_new                   (ClutterActor        *actor); | AtkObject* cally_actor_new                   (ClutterActor        *actor); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| guint      cally_actor_add_action            (CallyActor          *cally_actor, | guint      cally_actor_add_action            (CallyActor          *cally_actor, | ||||||
|                                               const gchar         *action_name, |                                               const gchar         *action_name, | ||||||
|                                               const gchar         *action_description, |                                               const gchar         *action_description, | ||||||
|                                               const gchar         *action_keybinding, |                                               const gchar         *action_keybinding, | ||||||
|                                               CallyActionFunc      action_func); |                                               CallyActionFunc      action_func); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_6 | ||||||
| guint      cally_actor_add_action_full       (CallyActor          *cally_actor, | guint      cally_actor_add_action_full       (CallyActor          *cally_actor, | ||||||
|                                               const gchar         *action_name, |                                               const gchar         *action_name, | ||||||
|                                               const gchar         *action_description, |                                               const gchar         *action_description, | ||||||
| @@ -126,12 +147,14 @@ guint      cally_actor_add_action_full       (CallyActor          *cally_actor, | |||||||
|                                               gpointer             user_data, |                                               gpointer             user_data, | ||||||
|                                               GDestroyNotify       notify); |                                               GDestroyNotify       notify); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gboolean   cally_actor_remove_action         (CallyActor          *cally_actor, | gboolean   cally_actor_remove_action         (CallyActor          *cally_actor, | ||||||
|                                               gint                 action_id); |                                               gint                 action_id); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gboolean   cally_actor_remove_action_by_name (CallyActor          *cally_actor, | gboolean   cally_actor_remove_action_by_name (CallyActor          *cally_actor, | ||||||
|                                               const gchar         *action_name); |                                               const gchar         *action_name); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_ACTOR_H__ */ | ||||||
|   | |||||||
| @@ -15,15 +15,18 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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: |  * SECTION:cally-clone | ||||||
|  *  |  * @Title: CallyClone | ||||||
|  * Implementation of the ATK interfaces for a #ClutterClone |  * @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, |  * In particular it sets a proper role for the clone, as just a image, | ||||||
|  * as it is the sanest and simplest approach. |  * 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 |  * In the old times, it was just ClutterCloneTexture. So, from a a11y POV | ||||||
|  * CallyCloneTexture was just another image, like ClutterTexture, and if |  * 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 |  * expose a object with role ATK_ROLE_IMAGE. But now, ClutterClone is more | ||||||
|  * general. You can clone any object, including groups, and made things |  * general. You can clone any object, including groups, and made things | ||||||
|  * like have one text entry, and a clone with different properties in the |  * 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, |  * a11y POV should still be managed as a image (with the proper properties, | ||||||
|  * position, size, etc.). |  * position, size, etc.). | ||||||
|  */ |  */ | ||||||
| #include "clutter/clutter-build-config.h" | #include "clutter-build-config.h" | ||||||
|  |  | ||||||
| #include "cally/cally-clone.h" | #include "cally-clone.h" | ||||||
| #include "cally/cally-actor-private.h" | #include "cally-actor-private.h" | ||||||
|  |  | ||||||
| /* AtkObject */ | /* AtkObject */ | ||||||
| static void                  cally_clone_real_initialize (AtkObject *obj, | static void                  cally_clone_real_initialize (AtkObject *obj, | ||||||
| @@ -97,9 +100,11 @@ cally_clone_init (CallyClone *clone) | |||||||
|  * @actor: a #ClutterActor |  * @actor: a #ClutterActor | ||||||
|  * |  * | ||||||
|  * Creates a new #CallyClone for the given @actor. @actor must be a |  * Creates a new #CallyClone for the given @actor. @actor must be a | ||||||
|  * [class@Clutter.Clone]. |  * #ClutterClone. | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #AtkObject |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| AtkObject* | AtkObject* | ||||||
| cally_clone_new (ClutterActor *actor) | cally_clone_new (ClutterActor *actor) | ||||||
|   | |||||||
| @@ -18,14 +18,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter.h" | #include <clutter/clutter.h> | ||||||
| #include "cally/cally-actor.h" | #include <cally/cally-actor.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -40,6 +41,14 @@ typedef struct _CallyClone        CallyClone; | |||||||
| typedef struct _CallyCloneClass   CallyCloneClass; | typedef struct _CallyCloneClass   CallyCloneClass; | ||||||
| typedef struct _CallyClonePrivate CallyClonePrivate; | 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 | struct _CallyClone | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -53,16 +62,23 @@ struct _CallyClone | |||||||
|  * |  * | ||||||
|  * The <structname>CallyCloneClass</structname> structure contains only |  * The <structname>CallyCloneClass</structname> structure contains only | ||||||
|  * private data |  * private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyCloneClass | struct _CallyCloneClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   CallyActorClass parent_class; |   CallyActorClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[8]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType      cally_clone_get_type (void) G_GNUC_CONST; | GType      cally_clone_get_type (void) G_GNUC_CONST; | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| AtkObject *cally_clone_new      (ClutterActor *actor); | AtkObject *cally_clone_new      (ClutterActor *actor); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_CLONE_H__ */ | ||||||
|   | |||||||
| @@ -18,10 +18,13 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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 <glib-object.h> | ||||||
| #include <atk/atkobject.h> | #include <atk/atkobject.h> | ||||||
| @@ -39,6 +42,8 @@ | |||||||
|  * It assumes that the accessibility object provides a |  * It assumes that the accessibility object provides a | ||||||
|  * @opt_create_accessible method in order to create the accessibility |  * @opt_create_accessible method in order to create the accessibility | ||||||
|  * object. It returns a @type GType object. |  * object. It returns a @type GType object. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| #define CALLY_ACCESSIBLE_FACTORY(type, type_as_function, opt_create_accessible)	\ | #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 |  * Sets the #AtkObjectFactory to be used in order to instantiate | ||||||
|  * accessibility objects for the actor which GType is @widget_type. |  * accessibility objects for the actor which GType is @widget_type. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| #define CALLY_ACTOR_SET_FACTORY(widget_type, type_as_function)			\ | #define CALLY_ACTOR_SET_FACTORY(widget_type, type_as_function)			\ | ||||||
| 	atk_registry_set_factory_type (atk_get_default_registry (),		\ | 	atk_registry_set_factory_type (atk_get_default_registry (),		\ | ||||||
| 				       widget_type,				\ | 				       widget_type,				\ | ||||||
| 				       type_as_function ## _factory_get_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_AVAILABLE_IN_1_4 | ||||||
|  | GType      cally_group_get_type (void) G_GNUC_CONST; | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | 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/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| @@ -33,9 +34,11 @@ | |||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gboolean cally_get_cally_initialized (void); | gboolean cally_get_cally_initialized (void); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gboolean cally_accessibility_init    (void); | gboolean cally_accessibility_init    (void); | ||||||
|  |  | ||||||
| G_END_DECLS | 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_AVAILABLE_IN_1_4 | ||||||
|  | GType      cally_rectangle_get_type (void) G_GNUC_CONST; | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | AtkObject* cally_rectangle_new      (ClutterActor *actor); | ||||||
|  |  | ||||||
|  | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_RECTANGLE_H__ */ | ||||||
| @@ -15,31 +15,33 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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: |  * SECTION:cally-root | ||||||
|  *  |  * @short_description: Root object for the Cally toolkit | ||||||
|  * Root object for the Cally toolkit |  * @see_also: #ClutterStage | ||||||
|  * |  * | ||||||
|  * #CallyRoot is the root object of the accessibility tree-like |  * #CallyRoot is the root object of the accessibility tree-like | ||||||
|  * hierarchy, exposing the application level. |  * hierarchy, exposing the application level. | ||||||
|  * |  * | ||||||
|  * Somewhat equivalent to #GailTopLevel. We consider that this class |  * Somewhat equivalent to #GailTopLevel. We consider that this class | ||||||
|  * expose the a11y information of the [class@Clutter.StageManager], as the |  * expose the a11y information of the #ClutterStageManager, as the | ||||||
|  * children of this object are the different [class@Clutter.Stage] managed (so |  * children of this object are the different ClutterStage managed (so | ||||||
|  * the [class@GObject.Object] used in the atk_object_initialize() is the |  * the #GObject used in the atk_object_initialize() is the | ||||||
|  * [class@Clutter.StageManager]). |  * #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-actor.h" | ||||||
| #include "clutter/clutter-stage-private.h" | #include "clutter-stage-private.h" | ||||||
| #include "clutter/clutter-stage-manager.h" | #include "clutter-stage-manager.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| /* GObject */ | /* GObject */ | ||||||
| @@ -73,8 +75,8 @@ struct _CallyRootPrivate | |||||||
|   GSList *stage_list; |   GSList *stage_list; | ||||||
|  |  | ||||||
|   /* signals id */ |   /* signals id */ | ||||||
|   gulong stage_added_id; |   guint stage_added_id; | ||||||
|   gulong stage_removed_id; |   guint stage_removed_id; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root,  ATK_TYPE_GOBJECT_ACCESSIBLE) | G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root,  ATK_TYPE_GOBJECT_ACCESSIBLE) | ||||||
| @@ -111,6 +113,8 @@ cally_root_init (CallyRoot *root) | |||||||
|  * Creates a new #CallyRoot object. |  * Creates a new #CallyRoot object. | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #AtkObject |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| AtkObject* | AtkObject* | ||||||
| cally_root_new (void) | cally_root_new (void) | ||||||
| @@ -145,9 +149,11 @@ cally_root_finalize (GObject *object) | |||||||
|  |  | ||||||
|   stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root)); |   stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root)); | ||||||
|  |  | ||||||
|   g_clear_signal_handler (&root->priv->stage_added_id, stage_manager); |   g_signal_handler_disconnect (stage_manager, | ||||||
|  |                                root->priv->stage_added_id); | ||||||
|  |  | ||||||
|   g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager); |   g_signal_handler_disconnect (stage_manager, | ||||||
|  |                                root->priv->stage_added_id); | ||||||
|  |  | ||||||
|   G_OBJECT_CLASS (cally_root_parent_class)->finalize (object); |   G_OBJECT_CLASS (cally_root_parent_class)->finalize (object); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -18,15 +18,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <atk/atk.h> | #include <atk/atk.h> | ||||||
|  | #include <clutter/clutter.h> | ||||||
| #include "clutter/clutter.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -41,6 +41,14 @@ typedef struct _CallyRoot        CallyRoot; | |||||||
| typedef struct _CallyRootClass   CallyRootClass; | typedef struct _CallyRootClass   CallyRootClass; | ||||||
| typedef struct _CallyRootPrivate CallyRootPrivate; | 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 | struct _CallyRoot | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -54,16 +62,23 @@ struct _CallyRoot | |||||||
|  * |  * | ||||||
|  * The <structname>CallyRootClass</structname> structure contains only |  * The <structname>CallyRootClass</structname> structure contains only | ||||||
|  * private data |  * private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyRootClass | struct _CallyRootClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   AtkGObjectAccessibleClass parent_class; |   AtkGObjectAccessibleClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[16]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType      cally_root_get_type (void) G_GNUC_CONST; | GType      cally_root_get_type (void) G_GNUC_CONST; | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| AtkObject *cally_root_new      (void); | AtkObject *cally_root_new      (void); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_ROOT_H__ */ | ||||||
|   | |||||||
| @@ -15,26 +15,29 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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: |  * SECTION:cally-stage | ||||||
|  *  |  * @Title: CallyStage | ||||||
|  * Implementation of the ATK interfaces for a #ClutterStage |  * @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 |  * Some implementation details: at this moment #CallyStage is used as | ||||||
|  * the most similar Window object in this toolkit (ie: emitting window |  * 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 |  * 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-stage.h" | ||||||
| #include "cally/cally-actor-private.h" | #include "cally-actor-private.h" | ||||||
|  |  | ||||||
| /* AtkObject.h */ | /* AtkObject.h */ | ||||||
| static void                  cally_stage_real_initialize (AtkObject *obj, | static void                  cally_stage_real_initialize (AtkObject *obj, | ||||||
| @@ -44,7 +47,7 @@ static AtkStateSet*          cally_stage_ref_state_set   (AtkObject *obj); | |||||||
| /* AtkWindow */ | /* AtkWindow */ | ||||||
| static void                  cally_stage_window_interface_init (AtkWindowIface *iface); | static void                  cally_stage_window_interface_init (AtkWindowIface *iface); | ||||||
|  |  | ||||||
| /* Auxiliary */ | /* Auxiliar */ | ||||||
| static void                  cally_stage_activate_cb     (ClutterStage *stage, | static void                  cally_stage_activate_cb     (ClutterStage *stage, | ||||||
|                                                           gpointer      data); |                                                           gpointer      data); | ||||||
| static void                  cally_stage_deactivate_cb   (ClutterStage *stage, | static void                  cally_stage_deactivate_cb   (ClutterStage *stage, | ||||||
| @@ -60,7 +63,7 @@ struct _CallyStagePrivate | |||||||
|  |  | ||||||
| G_DEFINE_TYPE_WITH_CODE (CallyStage, | G_DEFINE_TYPE_WITH_CODE (CallyStage, | ||||||
|                          cally_stage, |                          cally_stage, | ||||||
|                          CALLY_TYPE_ACTOR, |                          CALLY_TYPE_GROUP, | ||||||
|                          G_ADD_PRIVATE (CallyStage) |                          G_ADD_PRIVATE (CallyStage) | ||||||
|                          G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, |                          G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, | ||||||
|                                                 cally_stage_window_interface_init)); |                                                 cally_stage_window_interface_init)); | ||||||
| @@ -90,9 +93,11 @@ cally_stage_init (CallyStage *cally_stage) | |||||||
|  * @actor: a #ClutterActor |  * @actor: a #ClutterActor | ||||||
|  * |  * | ||||||
|  * Creates a new #CallyStage for the given @actor. @actor should be a |  * Creates a new #CallyStage for the given @actor. @actor should be a | ||||||
|  * [class@Clutter.Stage]. |  * #ClutterStage. | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #AtkObject |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| AtkObject* | AtkObject* | ||||||
| cally_stage_new (ClutterActor *actor) | 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 != 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); |           old = clutter_actor_get_accessible (self->priv->key_focus); | ||||||
|         } |         } | ||||||
|       else |       else | ||||||
| @@ -158,11 +160,8 @@ cally_stage_notify_key_focus_cb (ClutterStage *stage, | |||||||
|        * |        * | ||||||
|        * we remove the weak pointer above. |        * 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); |       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 */ |   /* At this moment AtkWindow is just about signals */ | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Auxiliary */ | /* Auxiliar */ | ||||||
| static void | static void | ||||||
| cally_stage_activate_cb     (ClutterStage *stage, | cally_stage_activate_cb     (ClutterStage *stage, | ||||||
|                              gpointer      data) |                              gpointer      data) | ||||||
|   | |||||||
| @@ -18,14 +18,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "cally/cally-actor.h" | #include <cally/cally-group.h> | ||||||
| #include "clutter/clutter.h" | #include <clutter/clutter.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -40,10 +41,18 @@ typedef struct _CallyStage        CallyStage; | |||||||
| typedef struct _CallyStageClass   CallyStageClass; | typedef struct _CallyStageClass   CallyStageClass; | ||||||
| typedef struct _CallyStagePrivate CallyStagePrivate; | 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 | struct _CallyStage | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   CallyActor parent; |   CallyGroup parent; | ||||||
|  |  | ||||||
|   CallyStagePrivate *priv; |   CallyStagePrivate *priv; | ||||||
| }; | }; | ||||||
| @@ -53,16 +62,23 @@ struct _CallyStage | |||||||
|  * |  * | ||||||
|  * The <structname>CallyStageClass</structname> structure contains only |  * The <structname>CallyStageClass</structname> structure contains only | ||||||
|  * private data |  * private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyStageClass | struct _CallyStageClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   CallyActorClass parent_class; |   CallyGroupClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[16]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType      cally_stage_get_type (void) G_GNUC_CONST; | GType      cally_stage_get_type (void) G_GNUC_CONST; | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| AtkObject *cally_stage_new      (ClutterActor *actor); | AtkObject *cally_stage_new      (ClutterActor *actor); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_STAGE_H__ */ | ||||||
|   | |||||||
| @@ -23,26 +23,32 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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: |  * SECTION:cally-text | ||||||
|  *  |  * @short_description: Implementation of the ATK interfaces for a #ClutterText | ||||||
|  * Implementation of the ATK interfaces for a [class@Clutter.Text] |  * @see_also: #ClutterText | ||||||
|  * |  * | ||||||
|  * #CallyText implements the required ATK interfaces of |  * #CallyText implements the required ATK interfaces of | ||||||
|  * [class@Clutter.Text], #AtkText and #AtkEditableText |  * #ClutterText, #AtkText and #AtkEditableText | ||||||
|  |  * | ||||||
|  |  * | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "cally/cally-text.h" | #include "cally-text.h" | ||||||
| #include "cally/cally-actor-private.h" | #include "cally-actor-private.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-color.h" | #include "clutter-color.h" | ||||||
| #include "clutter/clutter-main.h" | #include "clutter-main.h" | ||||||
| #include "clutter/clutter-text.h" | #include "clutter-text.h" | ||||||
|  |  | ||||||
| static void cally_text_finalize   (GObject *obj); | static void cally_text_finalize   (GObject *obj); | ||||||
|  |  | ||||||
| @@ -243,7 +249,11 @@ cally_text_finalize   (GObject *obj) | |||||||
| /*   g_object_unref (cally_text->priv->textutil); */ | /*   g_object_unref (cally_text->priv->textutil); */ | ||||||
| /*   cally_text->priv->textutil = NULL; */ | /*   cally_text->priv->textutil = NULL; */ | ||||||
|  |  | ||||||
|   g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove); |   if (cally_text->priv->insert_idle_handler) | ||||||
|  |     { | ||||||
|  |       g_source_remove (cally_text->priv->insert_idle_handler); | ||||||
|  |       cally_text->priv->insert_idle_handler = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj); |   G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj); | ||||||
| } | } | ||||||
| @@ -253,9 +263,11 @@ cally_text_finalize   (GObject *obj) | |||||||
|  * @actor: a #ClutterActor |  * @actor: a #ClutterActor | ||||||
|  * |  * | ||||||
|  * Creates a new #CallyText for the given @actor. @actor must be a |  * Creates a new #CallyText for the given @actor. @actor must be a | ||||||
|  * [class@Clutter.Text]. |  * #ClutterText. | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #AtkObject |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| AtkObject* | AtkObject* | ||||||
| cally_text_new (ClutterActor *actor) | cally_text_new (ClutterActor *actor) | ||||||
| @@ -1428,7 +1440,7 @@ static void cally_text_get_character_extents (AtkText *text, | |||||||
|   PangoLayout *layout; |   PangoLayout *layout; | ||||||
|   PangoRectangle extents; |   PangoRectangle extents; | ||||||
|   const gchar *text_value; |   const gchar *text_value; | ||||||
|   graphene_point3d_t verts[4]; |   ClutterVertex verts[4]; | ||||||
|  |  | ||||||
|   actor = CALLY_GET_CLUTTER_ACTOR (text); |   actor = CALLY_GET_CLUTTER_ACTOR (text); | ||||||
|   if (actor == NULL) /* State is defunct */ |   if (actor == NULL) /* State is defunct */ | ||||||
| @@ -1507,7 +1519,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 | /* ClutterText only maintains the current cursor position and a extra selection | ||||||
|    bound, but this could be before or after the cursor. This method returns |    bound, but this could be before or after the cursor. This method returns | ||||||
| @@ -1546,7 +1558,7 @@ _cally_text_delete_text_cb (ClutterText *clutter_text, | |||||||
|  |  | ||||||
|   g_return_if_fail (CALLY_IS_TEXT (data)); |   g_return_if_fail (CALLY_IS_TEXT (data)); | ||||||
|  |  | ||||||
|   /* Ignore zero length deletions */ |   /* Ignore zero lengh deletions */ | ||||||
|   if (end_pos - start_pos == 0) |   if (end_pos - start_pos == 0) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
| @@ -1647,7 +1659,7 @@ cally_text_insert_text (AtkEditableText *text, | |||||||
|   clutter_text_insert_text (CLUTTER_TEXT (actor), |   clutter_text_insert_text (CLUTTER_TEXT (actor), | ||||||
|                             string, *position); |                             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 |      clutter-text doesn't warn about it. A option would be search for | ||||||
|      the text, but it seems not really required */ |      the text, but it seems not really required */ | ||||||
|   *position += length; |   *position += length; | ||||||
| @@ -1860,7 +1872,7 @@ static gint | |||||||
| _cally_atk_attribute_lookup_func (gconstpointer data, | _cally_atk_attribute_lookup_func (gconstpointer data, | ||||||
|                                   gconstpointer user_data) |                                   gconstpointer user_data) | ||||||
| { | { | ||||||
|     AtkTextAttribute attr = (AtkTextAttribute) GPOINTER_TO_INT (user_data); |     AtkTextAttribute attr = (AtkTextAttribute) user_data; | ||||||
|     AtkAttribute *at = (AtkAttribute *) data; |     AtkAttribute *at = (AtkAttribute *) data; | ||||||
|     if (!g_strcmp0 (at->name, atk_text_attribute_get_name (attr))) |     if (!g_strcmp0 (at->name, atk_text_attribute_get_name (attr))) | ||||||
|         return 0; |         return 0; | ||||||
| @@ -2284,7 +2296,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text, | |||||||
|   gint index, x_window, y_window, x_toplevel, y_toplevel; |   gint index, x_window, y_window, x_toplevel, y_toplevel; | ||||||
|   gint x_temp, y_temp; |   gint x_temp, y_temp; | ||||||
|   gboolean ret; |   gboolean ret; | ||||||
|   graphene_point3d_t verts[4]; |   ClutterVertex verts[4]; | ||||||
|   PangoLayout *layout; |   PangoLayout *layout; | ||||||
|   gint x_layout, y_layout; |   gint x_layout, y_layout; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,14 +18,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter.h" | #include <clutter/clutter.h> | ||||||
| #include "cally/cally-actor.h" | #include <cally/cally-actor.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -40,6 +41,14 @@ typedef struct _CallyText               CallyText; | |||||||
| typedef struct _CallyTextClass          CallyTextClass; | typedef struct _CallyTextClass          CallyTextClass; | ||||||
| typedef struct _CallyTextPrivate        CallyTextPrivate; | 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 | struct _CallyText | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -53,16 +62,23 @@ struct _CallyText | |||||||
|  * |  * | ||||||
|  * The <structname>CallyTextClass</structname> structure contains only |  * The <structname>CallyTextClass</structname> structure contains only | ||||||
|  * private data |  * private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyTextClass | struct _CallyTextClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   CallyActorClass parent_class; |   CallyActorClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[8]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType      cally_text_get_type (void) G_GNUC_CONST; | GType      cally_text_get_type (void) G_GNUC_CONST; | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| AtkObject* cally_text_new      (ClutterActor *actor); | AtkObject* cally_text_new      (ClutterActor *actor); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_TEXT_H__ */ | ||||||
|   | |||||||
							
								
								
									
										98
									
								
								clutter/clutter/cally/cally-texture.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								clutter/clutter/cally/cally-texture.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-texture | ||||||
|  |  * @Title: CallyTexture | ||||||
|  |  * @short_description: Implementation of the ATK interfaces for a #ClutterTexture | ||||||
|  |  * @see_also: #ClutterTexture | ||||||
|  |  * | ||||||
|  |  * #CallyTexture implements the required ATK interfaces of #ClutterTexture | ||||||
|  |  * | ||||||
|  |  * In particular it sets a proper role for the texture. | ||||||
|  |  */ | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  |  | ||||||
|  | #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | ||||||
|  |  | ||||||
|  | #include "cally-texture.h" | ||||||
|  | #include "cally-actor-private.h" | ||||||
|  |  | ||||||
|  | #include "deprecated/clutter-texture.h" | ||||||
|  |  | ||||||
|  | /* AtkObject */ | ||||||
|  | static void                  cally_texture_real_initialize (AtkObject *obj, | ||||||
|  |                                                            gpointer   data); | ||||||
|  |  | ||||||
|  | G_DEFINE_TYPE (CallyTexture, cally_texture, CALLY_TYPE_ACTOR) | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | cally_texture_class_init (CallyTextureClass *klass) | ||||||
|  | { | ||||||
|  | /*   GObjectClass   *gobject_class = G_OBJECT_CLASS (klass); */ | ||||||
|  |   AtkObjectClass *class         = ATK_OBJECT_CLASS (klass); | ||||||
|  |  | ||||||
|  |   class->initialize      = cally_texture_real_initialize; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | cally_texture_init (CallyTexture *texture) | ||||||
|  | { | ||||||
|  |   /* nothing to do yet */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * cally_texture_new: | ||||||
|  |  * @actor: a #ClutterActor | ||||||
|  |  * | ||||||
|  |  * Creates a new #CallyTexture for the given @actor. @actor must be | ||||||
|  |  * a #ClutterTexture. | ||||||
|  |  * | ||||||
|  |  * Return value: the newly created #AtkObject | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | AtkObject* | ||||||
|  | cally_texture_new (ClutterActor *actor) | ||||||
|  | { | ||||||
|  |   GObject   *object     = NULL; | ||||||
|  |   AtkObject *accessible = NULL; | ||||||
|  |  | ||||||
|  |   g_return_val_if_fail (CLUTTER_IS_TEXTURE (actor), NULL); | ||||||
|  |  | ||||||
|  |   object = g_object_new (CALLY_TYPE_TEXTURE, NULL); | ||||||
|  |  | ||||||
|  |   accessible = ATK_OBJECT (object); | ||||||
|  |   atk_object_initialize (accessible, actor); | ||||||
|  |  | ||||||
|  |   return accessible; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | cally_texture_real_initialize (AtkObject *obj, | ||||||
|  |                               gpointer   data) | ||||||
|  | { | ||||||
|  |   ATK_OBJECT_CLASS (cally_texture_parent_class)->initialize (obj, data); | ||||||
|  |  | ||||||
|  |   /* default role */ | ||||||
|  |   obj->role = ATK_ROLE_IMAGE; | ||||||
|  | } | ||||||
							
								
								
									
										84
									
								
								clutter/clutter/cally/cally-texture.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								clutter/clutter/cally/cally-texture.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_TEXTURE_H__ | ||||||
|  | #define __CALLY_TEXTURE_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> | ||||||
|  |  | ||||||
|  | G_BEGIN_DECLS | ||||||
|  |  | ||||||
|  | #define CALLY_TYPE_TEXTURE            (cally_texture_get_type ()) | ||||||
|  | #define CALLY_TEXTURE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXTURE, CallyTexture)) | ||||||
|  | #define CALLY_TEXTURE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXTURE, CallyTextureClass)) | ||||||
|  | #define CALLY_IS_TEXTURE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXTURE)) | ||||||
|  | #define CALLY_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXTURE)) | ||||||
|  | #define CALLY_TEXTURE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXTURE, CallyTextureClass)) | ||||||
|  |  | ||||||
|  | typedef struct _CallyTexture        CallyTexture; | ||||||
|  | typedef struct _CallyTextureClass   CallyTextureClass; | ||||||
|  | typedef struct _CallyTexturePrivate CallyTexturePrivate; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * CallyTexture: | ||||||
|  |  * | ||||||
|  |  * The <structname>CallyTexture</structname> structure contains only | ||||||
|  |  * private data and should be accessed using the provided API | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | struct _CallyTexture | ||||||
|  | { | ||||||
|  |   /*< private >*/ | ||||||
|  |   CallyActor parent; | ||||||
|  |  | ||||||
|  |   CallyTexturePrivate *priv; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * CallyTextureClass: | ||||||
|  |  * | ||||||
|  |  * The <structname>CallyTextureClass</structname> structure contains | ||||||
|  |  * only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | struct _CallyTextureClass | ||||||
|  | { | ||||||
|  |   /*< private >*/ | ||||||
|  |   CallyActorClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[8]; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | GType      cally_texture_get_type (void) G_GNUC_CONST; | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | AtkObject *cally_texture_new      (ClutterActor *actor); | ||||||
|  |  | ||||||
|  | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_TEXTURE_H__ */ | ||||||
| @@ -18,13 +18,16 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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: |  * SECTION:cally-util | ||||||
|  *  |  * @Title: CallyUtil | ||||||
|  * #AtkUtil implementation |  * @short_description: #AtkUtil implementation | ||||||
|  |  * @see_also: #ClutterActor | ||||||
|  * |  * | ||||||
|  * #CallyUtil implements #AtkUtil abstract methods. Although it |  * #CallyUtil implements #AtkUtil abstract methods. Although it | ||||||
|  * includes the name "Util" it is in fact one of the most important |  * includes the name "Util" it is in fact one of the most important | ||||||
| @@ -35,15 +38,17 @@ | |||||||
|  * available any accessible object. |  * available any accessible object. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | #include <clutter/clutter.h> | ||||||
|  |  | ||||||
| #include "cally/cally-util.h" | #include "cally-util.h" | ||||||
| #include "cally/cally-root.h" | #include "cally-root.h" | ||||||
| #include "cally/cally-stage.h" | #include "cally-stage.h" | ||||||
| #include "clutter/clutter.h" |  | ||||||
|  |  | ||||||
| #define DEFAULT_PASSWORD_CHAR '*' | #define DEFAULT_PASSWORD_CHAR '*' | ||||||
|  |  | ||||||
| @@ -57,6 +62,17 @@ static const gchar *         cally_util_get_toolkit_name		    (void); | |||||||
| static const gchar *         cally_util_get_toolkit_version          (void); | static const gchar *         cally_util_get_toolkit_version          (void); | ||||||
|  |  | ||||||
| /* private */ | /* 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, | static gboolean              notify_hf                               (gpointer key, | ||||||
|                                                                       gpointer value, |                                                                       gpointer value, | ||||||
|                                                                       gpointer data); |                                                                       gpointer data); | ||||||
| @@ -128,7 +144,7 @@ cally_util_get_toolkit_name (void) | |||||||
| static const gchar * | static const gchar * | ||||||
| cally_util_get_toolkit_version (void) | cally_util_get_toolkit_version (void) | ||||||
| { | { | ||||||
|   return MUTTER_VERSION; |   return CLUTTER_VERSION_S; | ||||||
| } | } | ||||||
|  |  | ||||||
| static guint | static guint | ||||||
| @@ -139,8 +155,12 @@ cally_util_add_key_event_listener (AtkKeySnoopFunc  listener, | |||||||
|   CallyKeyEventInfo *event_info = NULL; |   CallyKeyEventInfo *event_info = NULL; | ||||||
|  |  | ||||||
|   if (!key_listener_list) |   if (!key_listener_list) | ||||||
|  |   { | ||||||
|     key_listener_list = g_hash_table_new_full (NULL, NULL, NULL, g_free); |     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 = g_new (CallyKeyEventInfo, 1); | ||||||
|   event_info->listener = listener; |   event_info->listener = listener; | ||||||
|   event_info->func_data = data; |   event_info->func_data = data; | ||||||
| @@ -161,11 +181,73 @@ cally_util_remove_key_event_listener (guint remove_listener) | |||||||
|     { |     { | ||||||
|       g_hash_table_destroy (key_listener_list); |       g_hash_table_destroy (key_listener_list); | ||||||
|       key_listener_list = NULL; |       key_listener_list = NULL; | ||||||
|  |       cally_util_simulate_snooper_remove (); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| /* ------------------------------ PRIVATE FUNCTIONS ------------------------- */ | /* ------------------------------ 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); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | 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 * | static AtkKeyEventStruct * | ||||||
| atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event, | atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event, | ||||||
|                                       gunichar         password_char) |                                       gunichar         password_char) | ||||||
| @@ -173,7 +255,7 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event, | |||||||
|   AtkKeyEventStruct *atk_event = g_new0 (AtkKeyEventStruct, 1); |   AtkKeyEventStruct *atk_event = g_new0 (AtkKeyEventStruct, 1); | ||||||
|   gunichar key_unichar; |   gunichar key_unichar; | ||||||
|  |  | ||||||
|   switch (clutter_event_type ((ClutterEvent *) clutter_event)) |   switch (clutter_event->type) | ||||||
|     { |     { | ||||||
|     case CLUTTER_KEY_PRESS: |     case CLUTTER_KEY_PRESS: | ||||||
|       atk_event->type = ATK_KEY_EVENT_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) |   if (password_char) | ||||||
|     atk_event->state = 0; |     atk_event->state = 0; | ||||||
|   else |   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 |   /* We emit the clutter keyval. This is not exactly the one expected | ||||||
|      by AtkKeyEventStruct, as it expects a Gdk-like event, with the |      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) |   if (password_char) | ||||||
|     atk_event->keyval = clutter_unicode_to_keysym (password_char); |     atk_event->keyval = clutter_unicode_to_keysym (password_char); | ||||||
|   else |   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 |   /* 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 |      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_new (""); | ||||||
|       new = g_string_insert_unichar (new, 0, key_unichar); |       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 |   else | ||||||
|     atk_event->string = NULL; |     atk_event->string = NULL; | ||||||
| @@ -236,9 +319,9 @@ atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event, | |||||||
|   if (password_char) |   if (password_char) | ||||||
|     atk_event->keycode = 0; |     atk_event->keycode = 0; | ||||||
|   else |   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 | #ifdef CALLY_DEBUG | ||||||
|  |  | ||||||
| @@ -276,13 +359,10 @@ insert_hf (gpointer key, gpointer value, gpointer data) | |||||||
|  * char |  * char | ||||||
|  */ |  */ | ||||||
| static gunichar | static gunichar | ||||||
| check_key_visibility (ClutterStage *stage) | check_key_visibility (ClutterEvent *event) | ||||||
| { | { | ||||||
|   AtkObject *accessible; |   ClutterKeyEvent *key_event = (ClutterKeyEvent *)event; | ||||||
|   ClutterActor *focus; |   AtkObject *accessible = clutter_actor_get_accessible (key_event->source); | ||||||
|  |  | ||||||
|   focus = clutter_stage_get_key_focus (stage); |  | ||||||
|   accessible = clutter_actor_get_accessible (focus); |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (accessible != NULL, 0); |   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 |      still better fill this with a default unichar that the original | ||||||
|      one */ |      one */ | ||||||
|  |  | ||||||
|   if (CLUTTER_IS_TEXT (focus)) |   if (CLUTTER_IS_TEXT (key_event->source)) | ||||||
|     return clutter_text_get_password_char (CLUTTER_TEXT (focus)); |     return clutter_text_get_password_char (CLUTTER_TEXT (key_event->source)); | ||||||
|   else |   else | ||||||
|     return DEFAULT_PASSWORD_CHAR; |     return DEFAULT_PASSWORD_CHAR; | ||||||
| } | } | ||||||
|  |  | ||||||
| gboolean | static gboolean | ||||||
| cally_snoop_key_event (ClutterStage    *stage, | cally_key_snooper (ClutterActor *actor, | ||||||
|                        ClutterKeyEvent *key) |                    ClutterEvent *event, | ||||||
|  |                    gpointer      user_data) | ||||||
| { | { | ||||||
|   ClutterEvent *event = (ClutterEvent *) key; |  | ||||||
|   AtkKeyEventStruct *key_event = NULL; |   AtkKeyEventStruct *key_event = NULL; | ||||||
|   ClutterEventType event_type; |   gint consumed = 0; | ||||||
|   gboolean consumed = FALSE; |  | ||||||
|   gunichar password_char = 0; |   gunichar password_char = 0; | ||||||
|  |  | ||||||
|   event_type = clutter_event_type (event); |  | ||||||
|  |  | ||||||
|   /* filter key events */ |   /* filter key events */ | ||||||
|   if ((event_type != CLUTTER_KEY_PRESS) && (event_type != CLUTTER_KEY_RELEASE)) |   if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE)) | ||||||
|     return FALSE; |     { | ||||||
|  |       return FALSE; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   password_char = check_key_visibility (event); | ||||||
|  |  | ||||||
|   if (key_listener_list) |   if (key_listener_list) | ||||||
|     { |     { | ||||||
|       GHashTable *new_hash = g_hash_table_new (NULL, NULL); |       GHashTable *new_hash = g_hash_table_new (NULL, NULL); | ||||||
|  |  | ||||||
|       g_hash_table_foreach (key_listener_list, insert_hf, new_hash); |       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 ((ClutterKeyEvent *)event, | ||||||
|       key_event = atk_key_event_from_clutter_event_key (key, password_char); |                                                         password_char); | ||||||
|       /* func data is inside the hash table */ |       /* 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_hash_table_destroy (new_hash); | ||||||
|  |  | ||||||
|       g_free (key_event->string); |       g_free (key_event->string); | ||||||
|       g_free (key_event); |       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 | void | ||||||
|   | |||||||
| @@ -18,13 +18,14 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <cally/cally.h> can be included directly." | #error "Only <cally/cally.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter.h" | #include <clutter/clutter.h> | ||||||
| #include <atk/atk.h> | #include <atk/atk.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
| @@ -40,6 +41,14 @@ typedef struct _CallyUtil        CallyUtil; | |||||||
| typedef struct _CallyUtilClass   CallyUtilClass; | typedef struct _CallyUtilClass   CallyUtilClass; | ||||||
| typedef struct _CallyUtilPrivate CallyUtilPrivate; | 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 | struct _CallyUtil | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -53,19 +62,23 @@ struct _CallyUtil | |||||||
|  * |  * | ||||||
|  * The <structname>CallyUtilClass</structname> structure contains only |  * The <structname>CallyUtilClass</structname> structure contains only | ||||||
|  * private data |  * private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _CallyUtilClass | struct _CallyUtilClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   AtkUtilClass parent_class; |   AtkUtilClass parent_class; | ||||||
|  |  | ||||||
|  |   /* padding for future expansion */ | ||||||
|  |   gpointer _padding_dummy[8]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType cally_util_get_type (void) G_GNUC_CONST; | GType cally_util_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| void _cally_util_override_atk_util (void); | void _cally_util_override_atk_util (void); | ||||||
|  |  | ||||||
| gboolean cally_snoop_key_event (ClutterStage    *stage, |  | ||||||
|                                 ClutterKeyEvent *key); |  | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_UTIL_H__ */ | ||||||
|   | |||||||
| @@ -15,7 +15,9 @@ | |||||||
|  * Lesser General Public License for more details. |  * Lesser General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU Lesser General Public |  * 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,37 @@ | |||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | ||||||
|  |  | ||||||
| #include "cally/cally.h" | #include "cally.h" | ||||||
|  |  | ||||||
| #include "cally/cally-actor.h" | #include "cally-actor.h" | ||||||
| #include "cally/cally-stage.h" | #include "cally-group.h" | ||||||
| #include "cally/cally-text.h" | #include "cally-stage.h" | ||||||
| #include "cally/cally-clone.h" | #include "cally-text.h" | ||||||
|  | #include "cally-texture.h" | ||||||
|  | #include "cally-rectangle.h" | ||||||
|  | #include "cally-clone.h" | ||||||
|  |  | ||||||
| #include "cally/cally-factory.h" | #include "cally-factory.h" | ||||||
| #include "cally/cally-util.h" | #include "cally-util.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter.h" | #include "clutter.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| /* factories initialization*/ | /* factories initialization*/ | ||||||
| CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new) | 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_STAGE, cally_stage, cally_stage_new) | ||||||
| CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new) | CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new) | ||||||
|  | CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new) | ||||||
|  | CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new) | ||||||
| CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new) | CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new) | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -59,14 +69,19 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new) | |||||||
|  * |  * | ||||||
|  * Return value: %TRUE if accessibility support has been correctly |  * Return value: %TRUE if accessibility support has been correctly | ||||||
|  * initialized. |  * initialized. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| cally_accessibility_init (void) | cally_accessibility_init (void) | ||||||
| { | { | ||||||
|   /* setting the factories */ |   /* setting the factories */ | ||||||
|   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor); |   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_STAGE, cally_stage); | ||||||
|   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text); |   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text); | ||||||
|  |   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture); | ||||||
|  |   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle); | ||||||
|   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone); |   CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone); | ||||||
|  |  | ||||||
|   /* Initialize the CallyUtility class */ |   /* Initialize the CallyUtility class */ | ||||||
| @@ -84,6 +99,8 @@ cally_accessibility_init (void) | |||||||
|  * |  * | ||||||
|  * Return value: %TRUE if accessibility support has been correctly |  * Return value: %TRUE if accessibility support has been correctly | ||||||
|  * initialized. |  * initialized. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| gboolean cally_get_cally_initialized (void) | gboolean cally_get_cally_initialized (void) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -18,17 +18,23 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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__ | #define __CALLY_H_INSIDE__ | ||||||
|  |  | ||||||
| #include "cally/cally-actor.h" | #include "cally-actor.h" | ||||||
| #include "cally/cally-clone.h" | #include "cally-clone.h" | ||||||
| #include "cally/cally-factory.h" | #include "cally-factory.h" | ||||||
| #include "cally/cally-main.h" | #include "cally-group.h" | ||||||
| #include "cally/cally-root.h" | #include "cally-main.h" | ||||||
| #include "cally/cally-stage.h" | #include "cally-rectangle.h" | ||||||
| #include "cally/cally-text.h" | #include "cally-root.h" | ||||||
| #include "cally/cally-util.h" | #include "cally-stage.h" | ||||||
|  | #include "cally-text.h" | ||||||
|  | #include "cally-texture.h" | ||||||
|  | #include "cally-util.h" | ||||||
|  |  | ||||||
| #undef __CALLY_H_INSIDE__ | #undef __CALLY_H_INSIDE__ | ||||||
|  |  | ||||||
|  | #endif /* __CALLY_H__ */ | ||||||
|   | |||||||
| @@ -23,92 +23,41 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterAction: |  * SECTION:clutter-action | ||||||
|  *  |  * @Title: ClutterAction | ||||||
|  * Abstract class for event-related logic |  * @Short_Description: Abstract class for event-related logic | ||||||
|  |  * @See_Also: #ClutterConstraint | ||||||
|  * |  * | ||||||
|  * #ClutterAction is an abstract base class for event-related actions that |  * #ClutterAction is an abstract base class for event-related actions that | ||||||
|  * modify the user interaction of a [class@Actor], just like |  * modify the user interaction of a #ClutterActor, just like | ||||||
|  * [class@Constraint] is an abstract class for modifiers of an actor's |  * #ClutterConstraint is an abstract class for modifiers of an actor's | ||||||
|  * position or size. |  * position or size. | ||||||
|  * |  * | ||||||
|  * Implementations of #ClutterAction are associated to an actor and can |  * Implementations of #ClutterAction are associated to an actor and can | ||||||
|  * provide behavioral changes when dealing with user input - for instance |  * provide behavioral changes when dealing with user input - for instance | ||||||
|  * drag and drop capabilities, or scrolling, or panning - by using the |  * 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" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-action.h" | #include "clutter-action.h" | ||||||
| #include "clutter/clutter-action-private.h" |  | ||||||
| #include "clutter/clutter-debug.h" |  | ||||||
| #include "clutter/clutter-private.h" |  | ||||||
|  |  | ||||||
| typedef struct _ClutterActionPrivate ClutterActionPrivate; | #include "clutter-debug.h" | ||||||
|  | #include "clutter-private.h" | ||||||
|  |  | ||||||
| struct _ClutterActionPrivate | G_DEFINE_ABSTRACT_TYPE (ClutterAction, clutter_action, CLUTTER_TYPE_ACTOR_META); | ||||||
| { |  | ||||||
|   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; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_action_class_init (ClutterActionClass *klass) | clutter_action_class_init (ClutterActionClass *klass) | ||||||
| { | { | ||||||
|   klass->handle_event = clutter_action_handle_event_default; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_action_init (ClutterAction *self) | 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,70 +22,90 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   Emmanuele Bassi <ebassi@linux.intel.com> | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #pragma once | #ifndef __CLUTTER_ACTION_H__ | ||||||
|  | #define __CLUTTER_ACTION_H__ | ||||||
|  |  | ||||||
| #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-meta.h" | #include <clutter/clutter-actor-meta.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| #define CLUTTER_TYPE_ACTION (clutter_action_get_type ()) | #define CLUTTER_TYPE_ACTION             (clutter_action_get_type ()) | ||||||
|  | #define CLUTTER_ACTION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTION, ClutterAction)) | ||||||
|  | #define CLUTTER_IS_ACTION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTION)) | ||||||
|  | #define CLUTTER_ACTION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTION, ClutterActionClass)) | ||||||
|  | #define CLUTTER_IS_ACTION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTION)) | ||||||
|  | #define CLUTTER_ACTION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTION, ClutterActionClass)) | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | typedef struct _ClutterActionClass      ClutterActionClass; | ||||||
| G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action, |  | ||||||
|                           CLUTTER, ACTION, ClutterActorMeta); | /** | ||||||
|  |  * ClutterAction: | ||||||
|  |  * | ||||||
|  |  * The #ClutterAction structure contains only private data and | ||||||
|  |  * should be accessed using the provided API. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | struct _ClutterAction | ||||||
|  | { | ||||||
|  |   /*< private >*/ | ||||||
|  |   ClutterActorMeta parent_instance; | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterActionClass: |  * ClutterActionClass: | ||||||
|  * |  * | ||||||
|  * The ClutterActionClass structure contains only private data |  * The ClutterActionClass structure contains only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _ClutterActionClass | struct _ClutterActionClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   ClutterActorMetaClass parent_class; |   ClutterActorMetaClass parent_class; | ||||||
|  |  | ||||||
|   gboolean (* handle_event) (ClutterAction      *action, |   void (* _clutter_action1) (void); | ||||||
|                              const ClutterEvent *event); |   void (* _clutter_action2) (void); | ||||||
|  |   void (* _clutter_action3) (void); | ||||||
|   void (* sequence_cancelled) (ClutterAction        *action, |   void (* _clutter_action4) (void); | ||||||
|                                ClutterInputDevice   *device, |   void (* _clutter_action5) (void); | ||||||
|                                ClutterEventSequence *sequence); |   void (* _clutter_action6) (void); | ||||||
|  |   void (* _clutter_action7) (void); | ||||||
|  |   void (* _clutter_action8) (void); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | GType clutter_action_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| /* ClutterActor API */ | /* ClutterActor API */ | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void           clutter_actor_add_action            (ClutterActor  *self, | void           clutter_actor_add_action            (ClutterActor  *self, | ||||||
|                                                     ClutterAction *action); |                                                     ClutterAction *action); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void           clutter_actor_add_action_with_name  (ClutterActor  *self, | void           clutter_actor_add_action_with_name  (ClutterActor  *self, | ||||||
|                                                     const gchar   *name, |                                                     const gchar   *name, | ||||||
|                                                     ClutterAction *action); |                                                     ClutterAction *action); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void           clutter_actor_add_action_full       (ClutterActor      *self, |  | ||||||
|                                                     const char        *name, |  | ||||||
|                                                     ClutterEventPhase  phase, |  | ||||||
|                                                     ClutterAction     *action); |  | ||||||
| CLUTTER_EXPORT |  | ||||||
| void           clutter_actor_remove_action         (ClutterActor  *self, | void           clutter_actor_remove_action         (ClutterActor  *self, | ||||||
|                                                     ClutterAction *action); |                                                     ClutterAction *action); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void           clutter_actor_remove_action_by_name (ClutterActor  *self, | void           clutter_actor_remove_action_by_name (ClutterActor  *self, | ||||||
|                                                     const gchar   *name); |                                                     const gchar   *name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterAction *clutter_actor_get_action            (ClutterActor  *self, | ClutterAction *clutter_actor_get_action            (ClutterActor  *self, | ||||||
|                                                     const gchar   *name); |                                                     const gchar   *name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GList *        clutter_actor_get_actions           (ClutterActor  *self); | GList *        clutter_actor_get_actions           (ClutterActor  *self); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void           clutter_actor_clear_actions         (ClutterActor  *self); | void           clutter_actor_clear_actions         (ClutterActor  *self); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| gboolean       clutter_actor_has_actions           (ClutterActor  *self); | gboolean       clutter_actor_has_actions           (ClutterActor  *self); | ||||||
|  |  | ||||||
| ClutterEventPhase clutter_action_get_phase (ClutterAction *action); |  | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_ACTION_H__ */ | ||||||
|   | |||||||
| @@ -1,9 +0,0 @@ | |||||||
| #pragma once |  | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS |  | ||||||
|  |  | ||||||
| void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box); |  | ||||||
|  |  | ||||||
| G_END_DECLS |  | ||||||
| @@ -1,11 +1,12 @@ | |||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" | #include "clutter-types.h" | ||||||
| #include "clutter/clutter-interval.h" | #include "clutter-interval.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
| #include "clutter/clutter-actor-box-private.h" |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * clutter_actor_box_new: |  * clutter_actor_box_new: | ||||||
| @@ -14,19 +15,21 @@ | |||||||
|  * @x_2: X coordinate of the bottom right point |  * @x_2: X coordinate of the bottom right point | ||||||
|  * @y_2: Y 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. |  * for the top left and bottom right points. | ||||||
|  * |  * | ||||||
|  * This function is the logical equivalent of: |  * This function is the logical equivalent of: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[ | ||||||
|  *   clutter_actor_box_init (clutter_actor_box_alloc (), |  *   clutter_actor_box_init (clutter_actor_box_alloc (), | ||||||
|  *                           x_1, y_1, |  *                           x_1, y_1, | ||||||
|  *                           x_2, y_2); |  *                           x_2, y_2); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * Return value: (transfer full): the newly allocated #ClutterActorBox. |  * 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 * | ClutterActorBox * | ||||||
| clutter_actor_box_new (gfloat x_1, | clutter_actor_box_new (gfloat x_1, | ||||||
| @@ -42,15 +45,17 @@ clutter_actor_box_new (gfloat x_1, | |||||||
| /** | /** | ||||||
|  * clutter_actor_box_alloc: |  * clutter_actor_box_alloc: | ||||||
|  * |  * | ||||||
|  * Allocates a new [struct@ActorBox]. |  * Allocates a new #ClutterActorBox. | ||||||
|  * |  * | ||||||
|  * Return value: (transfer full): the newly allocated #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 * | ClutterActorBox * | ||||||
| clutter_actor_box_alloc (void) | clutter_actor_box_alloc (void) | ||||||
| { | { | ||||||
|   return g_new0 (ClutterActorBox, 1); |   return g_slice_new0 (ClutterActorBox); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -64,6 +69,8 @@ clutter_actor_box_alloc (void) | |||||||
|  * Initializes @box with the given coordinates. |  * Initializes @box with the given coordinates. | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): the initialized #ClutterActorBox |  * Return value: (transfer none): the initialized #ClutterActorBox | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| ClutterActorBox * | ClutterActorBox * | ||||||
| clutter_actor_box_init (ClutterActorBox *box, | clutter_actor_box_init (ClutterActorBox *box, | ||||||
| @@ -91,6 +98,8 @@ clutter_actor_box_init (ClutterActorBox *box, | |||||||
|  * @height: height of the box |  * @height: height of the box | ||||||
|  * |  * | ||||||
|  * Initializes @box with the given origin and size. |  * Initializes @box with the given origin and size. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_init_rect (ClutterActorBox *box, | clutter_actor_box_init_rect (ClutterActorBox *box, | ||||||
| @@ -114,13 +123,15 @@ clutter_actor_box_init_rect (ClutterActorBox *box, | |||||||
|  * Copies @box |  * Copies @box | ||||||
|  * |  * | ||||||
|  * Return value: a newly allocated copy of #ClutterActorBox. Use |  * 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 * | ClutterActorBox * | ||||||
| clutter_actor_box_copy (const ClutterActorBox *box) | clutter_actor_box_copy (const ClutterActorBox *box) | ||||||
| { | { | ||||||
|   if (G_LIKELY (box != NULL)) |   if (G_LIKELY (box != NULL)) | ||||||
|     return g_memdup2 (box, sizeof (ClutterActorBox)); |     return g_slice_dup (ClutterActorBox, box); | ||||||
|  |  | ||||||
|   return NULL; |   return NULL; | ||||||
| } | } | ||||||
| @@ -129,14 +140,16 @@ clutter_actor_box_copy (const ClutterActorBox *box) | |||||||
|  * clutter_actor_box_free: |  * clutter_actor_box_free: | ||||||
|  * @box: a #ClutterActorBox |  * @box: a #ClutterActorBox | ||||||
|  * |  * | ||||||
|  * Frees a #ClutterActorBox allocated using [ctor@ActorBox.new] |  * Frees a #ClutterActorBox allocated using clutter_actor_box_new() | ||||||
|  * or [method@ActorBox.copy]. |  * or clutter_actor_box_copy() | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_free (ClutterActorBox *box) | clutter_actor_box_free (ClutterActorBox *box) | ||||||
| { | { | ||||||
|   if (G_LIKELY (box != NULL)) |   if (G_LIKELY (box != NULL)) | ||||||
|     g_free (box); |     g_slice_free (ClutterActorBox, box); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -147,6 +160,8 @@ clutter_actor_box_free (ClutterActorBox *box) | |||||||
|  * Checks @box_a and @box_b for equality |  * Checks @box_a and @box_b for equality | ||||||
|  * |  * | ||||||
|  * Return value: %TRUE if the passed #ClutterActorBox are equal |  * Return value: %TRUE if the passed #ClutterActorBox are equal | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_actor_box_equal (const ClutterActorBox *box_a, | clutter_actor_box_equal (const ClutterActorBox *box_a, | ||||||
| @@ -168,6 +183,8 @@ clutter_actor_box_equal (const ClutterActorBox *box_a, | |||||||
|  * Retrieves the X coordinate of the origin of @box |  * Retrieves the X coordinate of the origin of @box | ||||||
|  * |  * | ||||||
|  * Return value: the X coordinate of the origin |  * Return value: the X coordinate of the origin | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_actor_box_get_x (const ClutterActorBox *box) | clutter_actor_box_get_x (const ClutterActorBox *box) | ||||||
| @@ -184,6 +201,8 @@ clutter_actor_box_get_x (const ClutterActorBox *box) | |||||||
|  * Retrieves the Y coordinate of the origin of @box |  * Retrieves the Y coordinate of the origin of @box | ||||||
|  * |  * | ||||||
|  * Return value: the Y coordinate of the origin |  * Return value: the Y coordinate of the origin | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_actor_box_get_y (const ClutterActorBox *box) | clutter_actor_box_get_y (const ClutterActorBox *box) | ||||||
| @@ -200,6 +219,8 @@ clutter_actor_box_get_y (const ClutterActorBox *box) | |||||||
|  * Retrieves the width of the @box |  * Retrieves the width of the @box | ||||||
|  * |  * | ||||||
|  * Return value: the width of the box |  * Return value: the width of the box | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_actor_box_get_width (const ClutterActorBox *box) | clutter_actor_box_get_width (const ClutterActorBox *box) | ||||||
| @@ -216,6 +237,8 @@ clutter_actor_box_get_width (const ClutterActorBox *box) | |||||||
|  * Retrieves the height of the @box |  * Retrieves the height of the @box | ||||||
|  * |  * | ||||||
|  * Return value: the height of the box |  * Return value: the height of the box | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_actor_box_get_height (const ClutterActorBox *box) | clutter_actor_box_get_height (const ClutterActorBox *box) | ||||||
| @@ -232,6 +255,8 @@ clutter_actor_box_get_height (const ClutterActorBox *box) | |||||||
|  * @y: (out) (allow-none): return location for the Y coordinate, or %NULL |  * @y: (out) (allow-none): return location for the Y coordinate, or %NULL | ||||||
|  * |  * | ||||||
|  * Retrieves the origin of @box |  * Retrieves the origin of @box | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_get_origin (const ClutterActorBox *box, | clutter_actor_box_get_origin (const ClutterActorBox *box, | ||||||
| @@ -254,6 +279,8 @@ clutter_actor_box_get_origin (const ClutterActorBox *box, | |||||||
|  * @height: (out) (allow-none): return location for the height, or %NULL |  * @height: (out) (allow-none): return location for the height, or %NULL | ||||||
|  * |  * | ||||||
|  * Retrieves the size of @box |  * Retrieves the size of @box | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_get_size (const ClutterActorBox *box, | clutter_actor_box_get_size (const ClutterActorBox *box, | ||||||
| @@ -276,6 +303,8 @@ clutter_actor_box_get_size (const ClutterActorBox *box, | |||||||
|  * Retrieves the area of @box |  * Retrieves the area of @box | ||||||
|  * |  * | ||||||
|  * Return value: the area of a #ClutterActorBox, in pixels |  * Return value: the area of a #ClutterActorBox, in pixels | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_actor_box_get_area (const ClutterActorBox *box) | clutter_actor_box_get_area (const ClutterActorBox *box) | ||||||
| @@ -292,9 +321,11 @@ clutter_actor_box_get_area (const ClutterActorBox *box) | |||||||
|  * @y: Y coordinate of the point |  * @y: Y coordinate of the point | ||||||
|  * |  * | ||||||
|  * Checks whether a point with @x, @y coordinates is contained |  * 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 |  * Return value: %TRUE if the point is contained by the #ClutterActorBox | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_actor_box_contains (const ClutterActorBox *box, | clutter_actor_box_contains (const ClutterActorBox *box, | ||||||
| @@ -310,14 +341,16 @@ clutter_actor_box_contains (const ClutterActorBox *box, | |||||||
| /** | /** | ||||||
|  * clutter_actor_box_from_vertices: |  * clutter_actor_box_from_vertices: | ||||||
|  * @box: a #ClutterActorBox |  * @box: a #ClutterActorBox | ||||||
|  * @verts: (array fixed-size=4): array of four #graphene_point3d_t |  * @verts: (array fixed-size=4): array of four #ClutterVertex | ||||||
|  * |  * | ||||||
|  * Calculates the bounding box represented by the four vertices; for details |  * 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 | void | ||||||
| clutter_actor_box_from_vertices (ClutterActorBox          *box, | clutter_actor_box_from_vertices (ClutterActorBox     *box, | ||||||
|                                  const graphene_point3d_t  verts[]) |                                  const ClutterVertex  verts[]) | ||||||
| { | { | ||||||
|   gfloat x_1, x_2, y_1, y_2; |   gfloat x_1, x_2, y_1, y_2; | ||||||
|  |  | ||||||
| @@ -380,8 +413,10 @@ clutter_actor_box_from_vertices (ClutterActorBox          *box, | |||||||
|  * @progress: the interpolation progress |  * @progress: the interpolation progress | ||||||
|  * @result: (out): return location for the interpolation |  * @result: (out): return location for the interpolation | ||||||
|  * |  * | ||||||
|  * Interpolates between @initial and @final `ClutterActorBox`es |  * Interpolates between @initial and @final #ClutterActorBox<!-- -->es | ||||||
|  * using @progress |  * using @progress | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_interpolate (const ClutterActorBox *initial, | clutter_actor_box_interpolate (const ClutterActorBox *initial, | ||||||
| @@ -404,6 +439,8 @@ clutter_actor_box_interpolate (const ClutterActorBox *initial, | |||||||
|  * @box: (inout): the #ClutterActorBox to clamp |  * @box: (inout): the #ClutterActorBox to clamp | ||||||
|  * |  * | ||||||
|  * Clamps the components of @box to the nearest integer |  * Clamps the components of @box to the nearest integer | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_clamp_to_pixel (ClutterActorBox *box) | clutter_actor_box_clamp_to_pixel (ClutterActorBox *box) | ||||||
| @@ -424,6 +461,8 @@ clutter_actor_box_clamp_to_pixel (ClutterActorBox *box) | |||||||
|  *   of @a and @b |  *   of @a and @b | ||||||
|  * |  * | ||||||
|  * Unions the two boxes @a and @b and stores the result in @result. |  * Unions the two boxes @a and @b and stores the result in @result. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_union (const ClutterActorBox *a, | clutter_actor_box_union (const ClutterActorBox *a, | ||||||
| @@ -466,6 +505,8 @@ clutter_actor_box_progress (const GValue *a, | |||||||
|  * @y: the Y coordinate of the new origin |  * @y: the Y coordinate of the new origin | ||||||
|  * |  * | ||||||
|  * Changes the origin of @box, maintaining the size of the #ClutterActorBox. |  * Changes the origin of @box, maintaining the size of the #ClutterActorBox. | ||||||
|  |  * | ||||||
|  |  * Since: 1.6 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_set_origin (ClutterActorBox *box, | clutter_actor_box_set_origin (ClutterActorBox *box, | ||||||
| @@ -489,6 +530,8 @@ clutter_actor_box_set_origin (ClutterActorBox *box, | |||||||
|  * @height: the new height |  * @height: the new height | ||||||
|  * |  * | ||||||
|  * Sets the size of @box, maintaining the origin of the #ClutterActorBox. |  * Sets the size of @box, maintaining the origin of the #ClutterActorBox. | ||||||
|  |  * | ||||||
|  |  * Since: 1.6 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_box_set_size (ClutterActorBox *box, | clutter_actor_box_set_size (ClutterActorBox *box, | ||||||
| @@ -501,105 +544,6 @@ clutter_actor_box_set_size (ClutterActorBox *box, | |||||||
|   box->y2 = box->y1 + height; |   box->y2 = box->y1 + height; | ||||||
| } | } | ||||||
|  |  | ||||||
| void |  | ||||||
| _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 |  | ||||||
|    * 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. |  | ||||||
|    * |  | ||||||
|    * The other thing we consider is that the calculation of this box is |  | ||||||
|    * subject to floating point precision issues that might be slightly |  | ||||||
|    * different to the precision issues involved with actually painting the |  | ||||||
|    * actor, which might result in painting slightly leaking outside the |  | ||||||
|    * user's calculated paint-volume. For this we simply aim to pad out the |  | ||||||
|    * paint-volume by at least half a pixel all the way around. |  | ||||||
|    */ |  | ||||||
|   width = box->x2 - box->x1; |  | ||||||
|   height = box->y2 - box->y1; |  | ||||||
|   width = CLUTTER_NEARBYINT (width); |  | ||||||
|   height = CLUTTER_NEARBYINT (height); |  | ||||||
|   /* XXX: NB the width/height may now be up to 0.5px too small so we |  | ||||||
|    * must also pad by 0.25px all around to account for this. In total we |  | ||||||
|    * must padd by at least 0.75px around all sides. */ |  | ||||||
|  |  | ||||||
|   /* XXX: The furthest that we can overshoot the bottom right corner by |  | ||||||
|    * here is 1.75px in total if you consider that the 0.75 padding could |  | ||||||
|    * just cross an integer boundary and so ceil will effectively add 1. |  | ||||||
|    */ |  | ||||||
|   box->x2 = ceilf (box->x2 + 0.75); |  | ||||||
|   box->y2 = ceilf (box->y2 + 0.75); |  | ||||||
|  |  | ||||||
|   /* 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 |  | ||||||
|    * position. |  | ||||||
|    * |  | ||||||
|    * Adding 3px to the width/height will ensure we cover the maximum of |  | ||||||
|    * 1.75px padding on the bottom/right and still ensure we have > 0.75px |  | ||||||
|    * padding on the top/left. |  | ||||||
|    */ |  | ||||||
|   box->x1 = box->x2 - width - 3; |  | ||||||
|   box->y1 = box->y2 - height - 3; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * clutter_actor_box_scale: |  | ||||||
|  * @box: a #ClutterActorBox |  | ||||||
|  * @scale: scale factor for resizing this box |  | ||||||
|  * |  | ||||||
|  * Rescale the @box by provided @scale factor. |  | ||||||
|  */ |  | ||||||
| void |  | ||||||
| clutter_actor_box_scale (ClutterActorBox *box, |  | ||||||
|                          gfloat           scale) |  | ||||||
| { |  | ||||||
|   g_return_if_fail (box != NULL); |  | ||||||
|  |  | ||||||
|   box->x1 *= scale; |  | ||||||
|   box->x2 *= scale; |  | ||||||
|   box->y1 *= scale; |  | ||||||
|   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, | G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box, | ||||||
|                                clutter_actor_box_copy, |                                clutter_actor_box_copy, | ||||||
|                                clutter_actor_box_free, |                                clutter_actor_box_free, | ||||||
|   | |||||||
| @@ -22,9 +22,10 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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 | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -92,3 +93,5 @@ int                     _clutter_actor_meta_get_priority        (ClutterActorMet | |||||||
| gboolean                _clutter_actor_meta_is_internal         (ClutterActorMeta *meta); | gboolean                _clutter_actor_meta_is_internal         (ClutterActorMeta *meta); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_ACTOR_META_PRIVATE_H__ */ | ||||||
|   | |||||||
| @@ -23,32 +23,37 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterActorMeta: |  * SECTION:clutter-actor-meta | ||||||
|  *  |  * @Title: ClutterActorMeta | ||||||
|  * Base class of actor modifiers |  * @Short_Description: Base class of actor modifiers | ||||||
|  |  * @See_Also: #ClutterAction, #ClutterConstraint | ||||||
|  * |  * | ||||||
|  * #ClutterActorMeta is an abstract class providing a common API for |  * #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. |  * any time. | ||||||
|  * |  * | ||||||
|  * Every sub-class of #ClutterActorMeta should check if the |  * 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. |  * any kind of modification. | ||||||
|  |  * | ||||||
|  |  * #ClutterActorMeta is available since Clutter 1.4 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-meta-private.h" | #include "clutter-actor-meta-private.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| struct _ClutterActorMetaPrivate | struct _ClutterActorMetaPrivate | ||||||
| { | { | ||||||
|   ClutterActor *actor; |   ClutterActor *actor; | ||||||
|   gulong destroy_id; |   guint destroy_id; | ||||||
|  |  | ||||||
|   gchar *name; |   gchar *name; | ||||||
|  |  | ||||||
| @@ -78,51 +83,28 @@ static void | |||||||
| on_actor_destroy (ClutterActor     *actor, | on_actor_destroy (ClutterActor     *actor, | ||||||
|                   ClutterActorMeta *meta) |                   ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   meta->priv->actor = NULL; | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|   priv->actor = NULL; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_actor_meta_real_set_actor (ClutterActorMeta *meta, | clutter_actor_meta_real_set_actor (ClutterActorMeta *meta, | ||||||
|                                    ClutterActor     *actor) |                                    ClutterActor     *actor) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   if (meta->priv->actor == actor) | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|   g_warn_if_fail (!priv->actor || |  | ||||||
|                   !CLUTTER_ACTOR_IN_PAINT (priv->actor)); |  | ||||||
|   g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor)); |  | ||||||
|  |  | ||||||
|   if (priv->actor == actor) |  | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   g_clear_signal_handler (&priv->destroy_id, priv->actor); |   if (meta->priv->destroy_id != 0) | ||||||
|  |     { | ||||||
|  |       g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id); | ||||||
|  |       meta->priv->destroy_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   priv->actor = actor; |   meta->priv->actor = actor; | ||||||
|  |  | ||||||
|   if (priv->actor != NULL) |   if (meta->priv->actor != NULL) | ||||||
|     priv->destroy_id = g_signal_connect (priv->actor, "destroy", |     meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy", | ||||||
|                                          G_CALLBACK (on_actor_destroy), |                                                G_CALLBACK (on_actor_destroy), | ||||||
|                                          meta); |                                                meta); | ||||||
|  |  | ||||||
|   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ACTOR]); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta, |  | ||||||
|                                      gboolean          is_enabled) |  | ||||||
| { |  | ||||||
|   ClutterActorMetaPrivate *priv = |  | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|   g_warn_if_fail (!priv->actor || |  | ||||||
|                   !CLUTTER_ACTOR_IN_PAINT (priv->actor)); |  | ||||||
|  |  | ||||||
|   priv->is_enabled = is_enabled; |  | ||||||
|  |  | ||||||
|   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -155,21 +137,20 @@ clutter_actor_meta_get_property (GObject    *gobject, | |||||||
|                                  GValue     *value, |                                  GValue     *value, | ||||||
|                                  GParamSpec *pspec) |                                  GParamSpec *pspec) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject); | ||||||
|     clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject)); |  | ||||||
|  |  | ||||||
|   switch (prop_id) |   switch (prop_id) | ||||||
|     { |     { | ||||||
|     case PROP_ACTOR: |     case PROP_ACTOR: | ||||||
|       g_value_set_object (value, priv->actor); |       g_value_set_object (value, meta->priv->actor); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case PROP_NAME: |     case PROP_NAME: | ||||||
|       g_value_set_string (value, priv->name); |       g_value_set_string (value, meta->priv->name); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case PROP_ENABLED: |     case PROP_ENABLED: | ||||||
|       g_value_set_boolean (value, priv->is_enabled); |       g_value_set_boolean (value, meta->priv->is_enabled); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     default: |     default: | ||||||
| @@ -181,11 +162,10 @@ clutter_actor_meta_get_property (GObject    *gobject, | |||||||
| static void | static void | ||||||
| clutter_actor_meta_finalize (GObject *gobject) | clutter_actor_meta_finalize (GObject *gobject) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv; | ||||||
|     clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject)); |  | ||||||
|  |  | ||||||
|   if (priv->actor != NULL) |   if (priv->destroy_id != 0 && priv->actor != NULL) | ||||||
|     g_clear_signal_handler (&priv->destroy_id, priv->actor); |     g_signal_handler_disconnect (priv->actor, priv->destroy_id); | ||||||
|  |  | ||||||
|   g_free (priv->name); |   g_free (priv->name); | ||||||
|  |  | ||||||
| @@ -198,26 +178,32 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) | |||||||
|   GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |   GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | ||||||
|  |  | ||||||
|   klass->set_actor = clutter_actor_meta_real_set_actor; |   klass->set_actor = clutter_actor_meta_real_set_actor; | ||||||
|   klass->set_enabled = clutter_actor_meta_real_set_enabled; |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * ClutterActorMeta:actor: |    * ClutterActorMeta:actor: | ||||||
|    * |    * | ||||||
|    * The #ClutterActor attached to the #ClutterActorMeta instance |    * The #ClutterActor attached to the #ClutterActorMeta instance | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_ACTOR] = |   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_TYPE_ACTOR, | ||||||
|                          CLUTTER_PARAM_READABLE | |                          CLUTTER_PARAM_READABLE); | ||||||
|                          G_PARAM_EXPLICIT_NOTIFY); |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * ClutterActorMeta:name: |    * ClutterActorMeta:name: | ||||||
|    * |    * | ||||||
|    * The unique name to access the #ClutterActorMeta |    * The unique name to access the #ClutterActorMeta | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_NAME] = |   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, |                          NULL, | ||||||
|                          CLUTTER_PARAM_READWRITE); |                          CLUTTER_PARAM_READWRITE); | ||||||
|  |  | ||||||
| @@ -225,9 +211,13 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) | |||||||
|    * ClutterActorMeta:enabled: |    * ClutterActorMeta:enabled: | ||||||
|    * |    * | ||||||
|    * Whether or not the #ClutterActorMeta is enabled |    * Whether or not the #ClutterActorMeta is enabled | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_ENABLED] = |   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, |                           TRUE, | ||||||
|                           CLUTTER_PARAM_READWRITE); |                           CLUTTER_PARAM_READWRITE); | ||||||
|  |  | ||||||
| @@ -242,11 +232,9 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) | |||||||
| void | void | ||||||
| clutter_actor_meta_init (ClutterActorMeta *self) | clutter_actor_meta_init (ClutterActorMeta *self) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   self->priv = clutter_actor_meta_get_instance_private (self); | ||||||
|     clutter_actor_meta_get_instance_private (self); |   self->priv->is_enabled = TRUE; | ||||||
|  |   self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT; | ||||||
|   priv->is_enabled = TRUE; |  | ||||||
|   priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -257,22 +245,20 @@ clutter_actor_meta_init (ClutterActorMeta *self) | |||||||
|  * Sets the name of @meta |  * Sets the name of @meta | ||||||
|  * |  * | ||||||
|  * The name can be used to identify the #ClutterActorMeta instance |  * The name can be used to identify the #ClutterActorMeta instance | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_meta_set_name (ClutterActorMeta *meta, | clutter_actor_meta_set_name (ClutterActorMeta *meta, | ||||||
|                              const gchar      *name) |                              const gchar      *name) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); |   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |   if (g_strcmp0 (meta->priv->name, name) == 0) | ||||||
|  |  | ||||||
|   if (g_strcmp0 (priv->name, name) == 0) |  | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   g_free (priv->name); |   g_free (meta->priv->name); | ||||||
|   priv->name = g_strdup (name); |   meta->priv->name = g_strdup (name); | ||||||
|  |  | ||||||
|   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]); |   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]); | ||||||
| } | } | ||||||
| @@ -281,23 +267,21 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta, | |||||||
|  * clutter_actor_meta_get_name: |  * clutter_actor_meta_get_name: | ||||||
|  * @meta: a #ClutterActorMeta |  * @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 |  * Return value: (transfer none): the name of the #ClutterActorMeta | ||||||
|  *   instance, or %NULL if none was set. The returned string is owned |  *   instance, or %NULL if none was set. The returned string is owned | ||||||
|  *   by the #ClutterActorMeta instance and it should not be modified |  *   by the #ClutterActorMeta instance and it should not be modified | ||||||
|  *   or freed |  *   or freed | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| const gchar * | const gchar * | ||||||
| clutter_actor_meta_get_name (ClutterActorMeta *meta) | clutter_actor_meta_get_name (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL); |   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |   return meta->priv->name; | ||||||
|  |  | ||||||
|   return priv->name; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -306,22 +290,23 @@ clutter_actor_meta_get_name (ClutterActorMeta *meta) | |||||||
|  * @is_enabled: whether @meta is enabled |  * @is_enabled: whether @meta is enabled | ||||||
|  * |  * | ||||||
|  * Sets whether @meta should be enabled or not |  * Sets whether @meta should be enabled or not | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_actor_meta_set_enabled (ClutterActorMeta *meta, | clutter_actor_meta_set_enabled (ClutterActorMeta *meta, | ||||||
|                                 gboolean          is_enabled) |                                 gboolean          is_enabled) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); |   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |  | ||||||
|   is_enabled = !!is_enabled; |   is_enabled = !!is_enabled; | ||||||
|  |  | ||||||
|   if (priv->is_enabled == is_enabled) |   if (meta->priv->is_enabled == is_enabled) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled); |   meta->priv->is_enabled = is_enabled; | ||||||
|  |  | ||||||
|  |   g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -331,17 +316,15 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta, | |||||||
|  * Retrieves whether @meta is enabled |  * Retrieves whether @meta is enabled | ||||||
|  * |  * | ||||||
|  * Return value: %TRUE if the #ClutterActorMeta instance is enabled |  * Return value: %TRUE if the #ClutterActorMeta instance is enabled | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_actor_meta_get_enabled (ClutterActorMeta *meta) | clutter_actor_meta_get_enabled (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE); |   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |   return meta->priv->is_enabled; | ||||||
|  |  | ||||||
|   return priv->is_enabled; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -351,6 +334,8 @@ clutter_actor_meta_get_enabled (ClutterActorMeta *meta) | |||||||
|  * |  * | ||||||
|  * Sets or unsets a back pointer to the #ClutterActor that owns |  * Sets or unsets a back pointer to the #ClutterActor that owns | ||||||
|  * the @meta |  * the @meta | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| _clutter_actor_meta_set_actor (ClutterActorMeta *meta, | _clutter_actor_meta_set_actor (ClutterActorMeta *meta, | ||||||
| @@ -366,61 +351,49 @@ _clutter_actor_meta_set_actor (ClutterActorMeta *meta, | |||||||
|  * clutter_actor_meta_get_actor: |  * clutter_actor_meta_get_actor: | ||||||
|  * @meta: a #ClutterActorMeta |  * @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 |  * Return value: (transfer none): a pointer to a #ClutterActor or %NULL | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_actor_meta_get_actor (ClutterActorMeta *meta) | clutter_actor_meta_get_actor (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL); |   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |   return meta->priv->actor; | ||||||
|  |  | ||||||
|   return priv->actor; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| _clutter_actor_meta_set_priority (ClutterActorMeta *meta, | _clutter_actor_meta_set_priority (ClutterActorMeta *meta, | ||||||
|                                   gint priority) |                                   gint priority) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); |   g_return_if_fail (CLUTTER_IS_ACTOR_META (meta)); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|   /* This property shouldn't be modified after the actor meta is in |   /* This property shouldn't be modified after the actor meta is in | ||||||
|      use because ClutterMetaGroup doesn't resort the list when it |      use because ClutterMetaGroup doesn't resort the list when it | ||||||
|      changes. If we made the priority public then we could either make |      changes. If we made the priority public then we could either make | ||||||
|      the priority a construct-only property or listen for |      the priority a construct-only property or listen for | ||||||
|      notifications on the property from the ClutterMetaGroup and |      notifications on the property from the ClutterMetaGroup and | ||||||
|      resort. */ |      resort. */ | ||||||
|   g_return_if_fail (priv->actor == NULL); |   g_return_if_fail (meta->priv->actor == NULL); | ||||||
|  |  | ||||||
|   priv->priority = priority; |   meta->priv->priority = priority; | ||||||
| } | } | ||||||
|  |  | ||||||
| gint | gint | ||||||
| _clutter_actor_meta_get_priority (ClutterActorMeta *meta) | _clutter_actor_meta_get_priority (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0); |   g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0); | ||||||
|  |  | ||||||
|   priv = clutter_actor_meta_get_instance_private (meta); |   return meta->priv->priority; | ||||||
|  |  | ||||||
|   return priv->priority; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| gboolean | gboolean | ||||||
| _clutter_actor_meta_is_internal (ClutterActorMeta *meta) | _clutter_actor_meta_is_internal (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   gint priority = meta->priv->priority; | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|   gint priority = priv->priority; |  | ||||||
|  |  | ||||||
|   return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW || |   return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW || | ||||||
|           priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH); |           priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH); | ||||||
| @@ -467,21 +440,19 @@ void | |||||||
| _clutter_meta_group_add_meta (ClutterMetaGroup *group, | _clutter_meta_group_add_meta (ClutterMetaGroup *group, | ||||||
|                               ClutterActorMeta *meta) |                               ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |  | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|   GList *prev = NULL, *l; |   GList *prev = NULL, *l; | ||||||
|  |  | ||||||
|   if (priv->actor != NULL) |   if (meta->priv->actor != NULL) | ||||||
|     { |     { | ||||||
|       g_warning ("The meta of type '%s' with name '%s' is " |       g_warning ("The meta of type '%s' with name '%s' is " | ||||||
|                  "already attached to actor '%s'", |                  "already attached to actor '%s'", | ||||||
|                  G_OBJECT_TYPE_NAME (meta), |                  G_OBJECT_TYPE_NAME (meta), | ||||||
|                  priv->name != NULL |                  meta->priv->name != NULL | ||||||
|                    ? priv->name |                    ? meta->priv->name | ||||||
|                    : "<unknown>", |                    : "<unknown>", | ||||||
|                  clutter_actor_get_name (priv->actor) != NULL |                  clutter_actor_get_name (meta->priv->actor) != NULL | ||||||
|                    ? clutter_actor_get_name (priv->actor) |                    ? clutter_actor_get_name (meta->priv->actor) | ||||||
|                    : G_OBJECT_TYPE_NAME (priv->actor)); |                    : G_OBJECT_TYPE_NAME (meta->priv->actor)); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -517,16 +488,13 @@ void | |||||||
| _clutter_meta_group_remove_meta (ClutterMetaGroup *group, | _clutter_meta_group_remove_meta (ClutterMetaGroup *group, | ||||||
|                                  ClutterActorMeta *meta) |                                  ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   if (meta->priv->actor != group->actor) | ||||||
|     clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|   if (priv->actor != group->actor) |  | ||||||
|     { |     { | ||||||
|       g_warning ("The meta of type '%s' with name '%s' is not " |       g_warning ("The meta of type '%s' with name '%s' is not " | ||||||
|                  "attached to the actor '%s'", |                  "attached to the actor '%s'", | ||||||
|                  G_OBJECT_TYPE_NAME (meta), |                  G_OBJECT_TYPE_NAME (meta), | ||||||
|                  priv->name != NULL |                  meta->priv->name != NULL | ||||||
|                    ? priv->name |                    ? meta->priv->name | ||||||
|                    : "<unknown>", |                    : "<unknown>", | ||||||
|                  clutter_actor_get_name (group->actor) != NULL |                  clutter_actor_get_name (group->actor) != NULL | ||||||
|                    ? clutter_actor_get_name (group->actor) |                    ? clutter_actor_get_name (group->actor) | ||||||
| @@ -611,7 +579,8 @@ _clutter_meta_group_clear_metas (ClutterMetaGroup *group) | |||||||
| { | { | ||||||
|   g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL); |   g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL); | ||||||
|  |  | ||||||
|   g_list_free_full (group->meta, g_object_unref); |   g_list_foreach (group->meta, (GFunc) g_object_unref, NULL); | ||||||
|  |   g_list_free (group->meta); | ||||||
|   group->meta = NULL; |   group->meta = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -669,10 +638,8 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group, | |||||||
|   for (l = group->meta; l != NULL; l = l->next) |   for (l = group->meta; l != NULL; l = l->next) | ||||||
|     { |     { | ||||||
|       ClutterActorMeta *meta = l->data; |       ClutterActorMeta *meta = l->data; | ||||||
|       ClutterActorMetaPrivate *priv = |  | ||||||
|         clutter_actor_meta_get_instance_private (meta); |  | ||||||
|  |  | ||||||
|       if (g_strcmp0 (priv->name, name) == 0) |       if (g_strcmp0 (meta->priv->name, name) == 0) | ||||||
|         return meta; |         return meta; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -692,8 +659,6 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group, | |||||||
| const gchar * | const gchar * | ||||||
| _clutter_actor_meta_get_debug_name (ClutterActorMeta *meta) | _clutter_actor_meta_get_debug_name (ClutterActorMeta *meta) | ||||||
| { | { | ||||||
|   ClutterActorMetaPrivate *priv = |   return meta->priv->name != NULL ? meta->priv->name | ||||||
|     clutter_actor_meta_get_instance_private (meta); |                                   : G_OBJECT_TYPE_NAME (meta); | ||||||
|  |  | ||||||
|   return priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (meta); |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,23 +22,42 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" | #include <clutter/clutter-types.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| #define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ()) | #define CLUTTER_TYPE_ACTOR_META                 (clutter_actor_meta_get_type ()) | ||||||
|  | #define CLUTTER_ACTOR_META(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMeta)) | ||||||
|  | #define CLUTTER_IS_ACTOR_META(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_META)) | ||||||
|  | #define CLUTTER_ACTOR_META_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass)) | ||||||
|  | #define CLUTTER_IS_ACTOR_META_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR_META)) | ||||||
|  | #define CLUTTER_ACTOR_META_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass)) | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | typedef struct _ClutterActorMetaPrivate         ClutterActorMetaPrivate; | ||||||
| G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta, | typedef struct _ClutterActorMetaClass           ClutterActorMetaClass; | ||||||
|                           CLUTTER, ACTOR_META, GInitiallyUnowned); |  | ||||||
|  |  | ||||||
| typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate; | /** | ||||||
|  |  * ClutterActorMeta: | ||||||
|  |  * | ||||||
|  |  * The #ClutterActorMeta structure contains only | ||||||
|  |  * private data and should be accessed using the provided API | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | struct _ClutterActorMeta | ||||||
|  | { | ||||||
|  |   /*< private >*/ | ||||||
|  |   GInitiallyUnowned parent_instance; | ||||||
|  |  | ||||||
|  |   ClutterActorMetaPrivate *priv; | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterActorMetaClass: |  * ClutterActorMetaClass: | ||||||
| @@ -47,6 +66,8 @@ typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate; | |||||||
|  * |  * | ||||||
|  * The #ClutterActorMetaClass structure contains |  * The #ClutterActorMetaClass structure contains | ||||||
|  * only private data |  * only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _ClutterActorMetaClass | struct _ClutterActorMetaClass | ||||||
| { | { | ||||||
| @@ -66,22 +87,33 @@ struct _ClutterActorMetaClass | |||||||
|   void (* set_actor) (ClutterActorMeta *meta, |   void (* set_actor) (ClutterActorMeta *meta, | ||||||
|                       ClutterActor     *actor); |                       ClutterActor     *actor); | ||||||
|  |  | ||||||
|   void (* set_enabled) (ClutterActorMeta *meta, |   /*< private >*/ | ||||||
|                         gboolean          is_enabled); |   void (* _clutter_meta1) (void); | ||||||
|  |   void (* _clutter_meta2) (void); | ||||||
|  |   void (* _clutter_meta3) (void); | ||||||
|  |   void (* _clutter_meta4) (void); | ||||||
|  |   void (* _clutter_meta5) (void); | ||||||
|  |   void (* _clutter_meta6) (void); | ||||||
|  |   void (* _clutter_meta7) (void); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | GType clutter_actor_meta_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void            clutter_actor_meta_set_name     (ClutterActorMeta *meta, | void            clutter_actor_meta_set_name     (ClutterActorMeta *meta, | ||||||
|                                                  const gchar      *name); |                                                  const gchar      *name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| const gchar *   clutter_actor_meta_get_name     (ClutterActorMeta *meta); | const gchar *   clutter_actor_meta_get_name     (ClutterActorMeta *meta); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void            clutter_actor_meta_set_enabled  (ClutterActorMeta *meta, | void            clutter_actor_meta_set_enabled  (ClutterActorMeta *meta, | ||||||
|                                                  gboolean          is_enabled); |                                                  gboolean          is_enabled); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gboolean        clutter_actor_meta_get_enabled  (ClutterActorMeta *meta); | gboolean        clutter_actor_meta_get_enabled  (ClutterActorMeta *meta); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterActor *  clutter_actor_meta_get_actor    (ClutterActorMeta *meta); | ClutterActor *  clutter_actor_meta_get_actor    (ClutterActorMeta *meta); | ||||||
|  |  | ||||||
| G_END_DECLS | 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/>. |  * 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-actor.h> | ||||||
| #include "clutter/clutter-grab.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | 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 > | /*< private > | ||||||
|  * ClutterActorTraverseFlags: |  * ClutterActorTraverseFlags: | ||||||
|  * CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in |  * CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in | ||||||
| @@ -36,8 +53,7 @@ G_BEGIN_DECLS | |||||||
|  * Controls some options for how clutter_actor_traverse() iterates |  * Controls some options for how clutter_actor_traverse() iterates | ||||||
|  * through the graph. |  * through the graph. | ||||||
|  */ |  */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|   CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST   = 1L<<0, |   CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST   = 1L<<0, | ||||||
|   CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1 |   CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1 | ||||||
| } ClutterActorTraverseFlags; | } ClutterActorTraverseFlags; | ||||||
| @@ -58,8 +74,7 @@ typedef enum | |||||||
|  * the continuing traversal. It may stop traversal completely, just |  * the continuing traversal. It may stop traversal completely, just | ||||||
|  * skip over children for the current actor or continue as normal. |  * skip over children for the current actor or continue as normal. | ||||||
|  */ |  */ | ||||||
| typedef enum | typedef enum { | ||||||
| { |  | ||||||
|   CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE       = 1L<<0, |   CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE       = 1L<<0, | ||||||
|   CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN  = 1L<<1, |   CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN  = 1L<<1, | ||||||
|   CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK          = 1L<<2 |   CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK          = 1L<<2 | ||||||
| @@ -93,12 +108,35 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor | |||||||
| typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor, | typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor, | ||||||
|                                             gpointer      user_data); |                                             gpointer      user_data); | ||||||
|  |  | ||||||
|  | typedef struct _AnchorCoord             AnchorCoord; | ||||||
| typedef struct _SizeRequest             SizeRequest; | typedef struct _SizeRequest             SizeRequest; | ||||||
|  |  | ||||||
| typedef struct _ClutterLayoutInfo       ClutterLayoutInfo; | typedef struct _ClutterLayoutInfo       ClutterLayoutInfo; | ||||||
| typedef struct _ClutterTransformInfo    ClutterTransformInfo; | typedef struct _ClutterTransformInfo    ClutterTransformInfo; | ||||||
| typedef struct _ClutterAnimationInfo    ClutterAnimationInfo; | 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 */ | ||||||
|  |     ClutterVertex units; | ||||||
|  |   } v; | ||||||
|  | }; | ||||||
|  |  | ||||||
| struct _SizeRequest | struct _SizeRequest | ||||||
| { | { | ||||||
|   guint  age; |   guint  age; | ||||||
| @@ -123,7 +161,7 @@ struct _SizeRequest | |||||||
| struct _ClutterLayoutInfo | struct _ClutterLayoutInfo | ||||||
| { | { | ||||||
|   /* fixed position coordinates */ |   /* fixed position coordinates */ | ||||||
|   graphene_point_t fixed_pos; |   ClutterPoint fixed_pos; | ||||||
|  |  | ||||||
|   ClutterMargin margin; |   ClutterMargin margin; | ||||||
|  |  | ||||||
| @@ -133,8 +171,8 @@ struct _ClutterLayoutInfo | |||||||
|   guint x_expand : 1; |   guint x_expand : 1; | ||||||
|   guint y_expand : 1; |   guint y_expand : 1; | ||||||
|  |  | ||||||
|   graphene_size_t minimum; |   ClutterSize minimum; | ||||||
|   graphene_size_t natural; |   ClutterSize natural; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const ClutterLayoutInfo *       _clutter_actor_get_layout_info_or_defaults      (ClutterActor *self); | const ClutterLayoutInfo *       _clutter_actor_get_layout_info_or_defaults      (ClutterActor *self); | ||||||
| @@ -143,30 +181,39 @@ ClutterLayoutInfo *             _clutter_actor_peek_layout_info | |||||||
|  |  | ||||||
| struct _ClutterTransformInfo | struct _ClutterTransformInfo | ||||||
| { | { | ||||||
|   /* rotation */ |   /* rotation (angle and center) */ | ||||||
|   gdouble rx_angle; |   gdouble rx_angle; | ||||||
|  |   AnchorCoord rx_center; | ||||||
|  |  | ||||||
|   gdouble ry_angle; |   gdouble ry_angle; | ||||||
|  |   AnchorCoord ry_center; | ||||||
|  |  | ||||||
|   gdouble rz_angle; |   gdouble rz_angle; | ||||||
|  |   AnchorCoord rz_center; | ||||||
|  |  | ||||||
|   /* scaling */ |   /* scaling */ | ||||||
|   gdouble scale_x; |   gdouble scale_x; | ||||||
|   gdouble scale_y; |   gdouble scale_y; | ||||||
|   gdouble scale_z; |   gdouble scale_z; | ||||||
|  |   AnchorCoord scale_center; | ||||||
|  |  | ||||||
|  |   /* anchor point */ | ||||||
|  |   AnchorCoord anchor; | ||||||
|  |  | ||||||
|   /* translation */ |   /* translation */ | ||||||
|   graphene_point3d_t translation; |   ClutterVertex translation; | ||||||
|  |  | ||||||
|   /* z_position */ |   /* z_position */ | ||||||
|   gfloat z_position; |   gfloat z_position; | ||||||
|  |  | ||||||
|   /* transformation center */ |   /* transformation center */ | ||||||
|   graphene_point_t pivot; |   ClutterPoint pivot; | ||||||
|   gfloat pivot_z; |   gfloat pivot_z; | ||||||
|  |  | ||||||
|   graphene_matrix_t transform; |   CoglMatrix transform; | ||||||
|   guint transform_set : 1; |   guint transform_set : 1; | ||||||
|  |  | ||||||
|   graphene_matrix_t child_transform; |   CoglMatrix child_transform; | ||||||
|   guint child_transform_set : 1; |   guint child_transform_set : 1; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -193,6 +240,9 @@ ClutterAnimationInfo *          _clutter_actor_get_animation_info | |||||||
| ClutterTransition *             _clutter_actor_create_transition                        (ClutterActor *self, | ClutterTransition *             _clutter_actor_create_transition                        (ClutterActor *self, | ||||||
|                                                                                          GParamSpec   *pspec, |                                                                                          GParamSpec   *pspec, | ||||||
|                                                                                          ...); |                                                                                          ...); | ||||||
|  | ClutterTransition *             _clutter_actor_get_transition                           (ClutterActor *self, | ||||||
|  |                                                                                          GParamSpec   *pspec); | ||||||
|  |  | ||||||
| gboolean                        _clutter_actor_foreach_child                            (ClutterActor *self, | gboolean                        _clutter_actor_foreach_child                            (ClutterActor *self, | ||||||
|                                                                                          ClutterForeachCallback callback, |                                                                                          ClutterForeachCallback callback, | ||||||
|                                                                                          gpointer user_data); |                                                                                          gpointer user_data); | ||||||
| @@ -203,11 +253,11 @@ void                            _clutter_actor_traverse | |||||||
|                                                                                          gpointer user_data); |                                                                                          gpointer user_data); | ||||||
| ClutterActor *                  _clutter_actor_get_stage_internal                       (ClutterActor *actor); | ClutterActor *                  _clutter_actor_get_stage_internal                       (ClutterActor *actor); | ||||||
|  |  | ||||||
| void                            _clutter_actor_apply_modelview_transform                (ClutterActor      *self, | void                            _clutter_actor_apply_modelview_transform                (ClutterActor *self, | ||||||
|                                                                                          graphene_matrix_t *matrix); |                                                                                          CoglMatrix   *matrix); | ||||||
| void                            _clutter_actor_apply_relative_transformation_matrix     (ClutterActor      *self, | void                            _clutter_actor_apply_relative_transformation_matrix     (ClutterActor *self, | ||||||
|                                                                                          ClutterActor      *ancestor, |                                                                                          ClutterActor *ancestor, | ||||||
|                                                                                          graphene_matrix_t *matrix); |                                                                                          CoglMatrix   *matrix); | ||||||
|  |  | ||||||
| void                            _clutter_actor_rerealize                                (ClutterActor    *self, | void                            _clutter_actor_rerealize                                (ClutterActor    *self, | ||||||
|                                                                                          ClutterCallback  callback, |                                                                                          ClutterCallback  callback, | ||||||
| @@ -225,58 +275,53 @@ void                            _clutter_actor_set_enable_paint_unmapped | |||||||
| void                            _clutter_actor_set_has_pointer                          (ClutterActor *self, | void                            _clutter_actor_set_has_pointer                          (ClutterActor *self, | ||||||
|                                                                                          gboolean      has_pointer); |                                                                                          gboolean      has_pointer); | ||||||
|  |  | ||||||
| void                            _clutter_actor_set_has_key_focus                        (ClutterActor *self, | void                            _clutter_actor_queue_redraw_with_clip                   (ClutterActor       *self, | ||||||
|                                                                                          gboolean      has_key_focus); |                                                                                          ClutterRedrawFlags  flags, | ||||||
|  |                                                                                          ClutterPaintVolume *clip_volume); | ||||||
|  | void                            _clutter_actor_queue_redraw_full                        (ClutterActor       *self, | ||||||
|  |                                                                                          ClutterRedrawFlags  flags, | ||||||
|  |                                                                                          ClutterPaintVolume *volume, | ||||||
|  |                                                                                          ClutterEffect      *effect); | ||||||
|  |  | ||||||
| void                            _clutter_actor_queue_redraw_full                        (ClutterActor             *self, | ClutterPaintVolume *            _clutter_actor_get_queue_redraw_clip                    (ClutterActor       *self); | ||||||
|                                                                                          const ClutterPaintVolume *volume, | void                            _clutter_actor_set_queue_redraw_clip                    (ClutterActor       *self, | ||||||
|                                                                                          ClutterEffect            *effect); |                                                                                          ClutterPaintVolume *clip_volume); | ||||||
|  | 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, | gboolean                        _clutter_actor_set_default_paint_volume                 (ClutterActor       *self, | ||||||
|                                                                                          GType               check_gtype, |                                                                                          GType               check_gtype, | ||||||
|                                                                                          ClutterPaintVolume *volume); |                                                                                          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_push_clone_paint                         (void); | ||||||
| void                            _clutter_actor_pop_clone_paint                          (void); | void                            _clutter_actor_pop_clone_paint                          (void); | ||||||
|  |  | ||||||
|  | guint32                         _clutter_actor_get_pick_id                              (ClutterActor *self); | ||||||
|  |  | ||||||
|  | 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); | 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, | void                            _clutter_actor_attach_clone                             (ClutterActor *actor, | ||||||
|                                                                                          ClutterActor *clone); |                                                                                          ClutterActor *clone); | ||||||
| void                            _clutter_actor_detach_clone                             (ClutterActor *actor, | void                            _clutter_actor_detach_clone                             (ClutterActor *actor, | ||||||
|                                                                                          ClutterActor *clone); |                                                                                          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_queue_only_relayout                      (ClutterActor *actor); | ||||||
| void                            clutter_actor_clear_stage_views_recursive               (ClutterActor *actor, |  | ||||||
|                                                                                          gboolean      stop_transitions); |  | ||||||
|  |  | ||||||
| float                           clutter_actor_get_real_resource_scale                   (ClutterActor *actor); | CoglFramebuffer *               _clutter_actor_get_active_framebuffer                   (ClutterActor *actor); | ||||||
|  |  | ||||||
| ClutterPaintNode *              clutter_actor_create_texture_paint_node                 (ClutterActor *self, | ClutterPaintNode *              clutter_actor_create_texture_paint_node                 (ClutterActor *self, | ||||||
|                                                                                          CoglTexture  *texture); |                                                                                          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 | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_ACTOR_PRIVATE_H__ */ | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -23,25 +23,29 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterAlignConstraint: |  * SECTION:clutter-align-constraint | ||||||
|  *  |  * @Title: ClutterAlignConstraint | ||||||
|  * A constraint aligning the position of an actor |  * @Short_Description: A constraint aligning the position of an actor | ||||||
|  * |  * | ||||||
|  * #ClutterAlignConstraint is a [class@Constraint] that aligns the position |  * #ClutterAlignConstraint is a #ClutterConstraint that aligns the position | ||||||
|  * of the [class@Actor] to which it is applied to the size of another |  * of the #ClutterActor to which it is applied to the size of another | ||||||
|  * [class@Actor] using an alignment factor |  * #ClutterActor using an alignment factor | ||||||
|  |  * | ||||||
|  |  * #ClutterAlignConstraint is available since Clutter 1.4 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-align-constraint.h" | #include "clutter-align-constraint.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-meta-private.h" | #include "clutter-actor-meta-private.h" | ||||||
| #include "clutter/clutter-actor-private.h" | #include "clutter-actor-private.h" | ||||||
| #include "clutter/clutter-constraint.h" | #include "clutter-constraint.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-enum-types.h" | #include "clutter-enum-types.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| @@ -56,7 +60,6 @@ struct _ClutterAlignConstraint | |||||||
|   ClutterActor *actor; |   ClutterActor *actor; | ||||||
|   ClutterActor *source; |   ClutterActor *source; | ||||||
|   ClutterAlignAxis align_axis; |   ClutterAlignAxis align_axis; | ||||||
|   graphene_point_t pivot; |  | ||||||
|   gfloat factor; |   gfloat factor; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -71,7 +74,6 @@ enum | |||||||
|  |  | ||||||
|   PROP_SOURCE, |   PROP_SOURCE, | ||||||
|   PROP_ALIGN_AXIS, |   PROP_ALIGN_AXIS, | ||||||
|   PROP_PIVOT_POINT, |  | ||||||
|   PROP_FACTOR, |   PROP_FACTOR, | ||||||
|  |  | ||||||
|   PROP_LAST |   PROP_LAST | ||||||
| @@ -84,11 +86,13 @@ G_DEFINE_TYPE (ClutterAlignConstraint, | |||||||
|                CLUTTER_TYPE_CONSTRAINT); |                CLUTTER_TYPE_CONSTRAINT); | ||||||
|  |  | ||||||
| static void | static void | ||||||
| source_queue_relayout (ClutterActor           *actor, | source_position_changed (ClutterActor           *actor, | ||||||
|                        ClutterAlignConstraint *align) |                          const ClutterActorBox  *allocation, | ||||||
|  |                          ClutterAllocationFlags  flags, | ||||||
|  |                          ClutterAlignConstraint *align) | ||||||
| { | { | ||||||
|   if (align->actor != NULL) |   if (align->actor != NULL) | ||||||
|     _clutter_actor_queue_only_relayout (align->actor); |     clutter_actor_queue_relayout (align->actor); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -133,41 +137,35 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint, | |||||||
|   ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint); |   ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint); | ||||||
|   gfloat source_width, source_height; |   gfloat source_width, source_height; | ||||||
|   gfloat actor_width, actor_height; |   gfloat actor_width, actor_height; | ||||||
|   gfloat offset_x_start, offset_y_start; |   gfloat source_x, source_y; | ||||||
|   gfloat pivot_x, pivot_y; |  | ||||||
|  |  | ||||||
|   if (align->source == NULL) |   if (align->source == NULL) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   clutter_actor_box_get_size (allocation, &actor_width, &actor_height); |   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); |   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) |   switch (align->align_axis) | ||||||
|     { |     { | ||||||
|     case CLUTTER_ALIGN_X_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; |       allocation->x2 = allocation->x1 + actor_width; | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case CLUTTER_ALIGN_Y_AXIS: |     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; |       allocation->y2 = allocation->y1 + actor_height; | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case CLUTTER_ALIGN_BOTH: |     case CLUTTER_ALIGN_BOTH: | ||||||
|       allocation->x1 += offset_x_start + (source_width * align->factor); |       allocation->x1 = ((source_width - actor_width) * align->factor) | ||||||
|       allocation->y1 += offset_y_start + (source_height * align->factor); |                      + source_x; | ||||||
|  |       allocation->y1 = ((source_height - actor_height) * align->factor) | ||||||
|  |                      + source_y; | ||||||
|       allocation->x2 = allocation->x1 + actor_width; |       allocation->x2 = allocation->x1 + actor_width; | ||||||
|       allocation->y2 = allocation->y1 + actor_height; |       allocation->y2 = allocation->y1 + actor_height; | ||||||
|       break; |       break; | ||||||
| @@ -191,7 +189,7 @@ clutter_align_constraint_dispose (GObject *gobject) | |||||||
|                                             G_CALLBACK (source_destroyed), |                                             G_CALLBACK (source_destroyed), | ||||||
|                                             align); |                                             align); | ||||||
|       g_signal_handlers_disconnect_by_func (align->source, |       g_signal_handlers_disconnect_by_func (align->source, | ||||||
|                                             G_CALLBACK (source_queue_relayout), |                                             G_CALLBACK (source_position_changed), | ||||||
|                                             align); |                                             align); | ||||||
|       align->source = NULL; |       align->source = NULL; | ||||||
|     } |     } | ||||||
| @@ -217,10 +215,6 @@ clutter_align_constraint_set_property (GObject      *gobject, | |||||||
|       clutter_align_constraint_set_align_axis (align, g_value_get_enum (value)); |       clutter_align_constraint_set_align_axis (align, g_value_get_enum (value)); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case PROP_PIVOT_POINT: |  | ||||||
|       clutter_align_constraint_set_pivot_point (align, g_value_get_boxed (value)); |  | ||||||
|       break; |  | ||||||
|  |  | ||||||
|     case PROP_FACTOR: |     case PROP_FACTOR: | ||||||
|       clutter_align_constraint_set_factor (align, g_value_get_float (value)); |       clutter_align_constraint_set_factor (align, g_value_get_float (value)); | ||||||
|       break; |       break; | ||||||
| @@ -249,16 +243,6 @@ clutter_align_constraint_get_property (GObject    *gobject, | |||||||
|       g_value_set_enum (value, align->align_axis); |       g_value_set_enum (value, align->align_axis); | ||||||
|       break; |       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: |     case PROP_FACTOR: | ||||||
|       g_value_set_float (value, align->factor); |       g_value_set_float (value, align->factor); | ||||||
|       break; |       break; | ||||||
| @@ -287,9 +271,13 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) | |||||||
|    * |    * | ||||||
|    * The #ClutterActor must not be a child or a grandchild of the actor |    * The #ClutterActor must not be a child or a grandchild of the actor | ||||||
|    * using the constraint. |    * using the constraint. | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_SOURCE] = |   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_TYPE_ACTOR, | ||||||
|                            CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                            CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||||||
|  |  | ||||||
| @@ -297,35 +285,17 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) | |||||||
|    * ClutterAlignConstraint:align-axis: |    * ClutterAlignConstraint:align-axis: | ||||||
|    * |    * | ||||||
|    * The axis to be used to compute the alignment |    * The axis to be used to compute the alignment | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_ALIGN_AXIS] = |   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_TYPE_ALIGN_AXIS, | ||||||
|                        CLUTTER_ALIGN_X_AXIS, |                        CLUTTER_ALIGN_X_AXIS, | ||||||
|                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                        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: |    * ClutterAlignConstraint:factor: | ||||||
|    * |    * | ||||||
| @@ -335,9 +305,13 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) | |||||||
|    * with an align-axis value of %CLUTTER_ALIGN_X_AXIS, 0.0 means left and |    * 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 |    * 1.0 means right; with a value of %CLUTTER_ALIGN_Y_AXIS, 0.0 means top | ||||||
|    * and 1.0 means bottom. |    * and 1.0 means bottom. | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_FACTOR] = |   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, 1.0, | ||||||
|                         0.0, |                         0.0, | ||||||
|                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||||||
| @@ -354,8 +328,6 @@ clutter_align_constraint_init (ClutterAlignConstraint *self) | |||||||
|   self->actor = NULL; |   self->actor = NULL; | ||||||
|   self->source = NULL; |   self->source = NULL; | ||||||
|   self->align_axis = CLUTTER_ALIGN_X_AXIS; |   self->align_axis = CLUTTER_ALIGN_X_AXIS; | ||||||
|   self->pivot.x = -1.f; |  | ||||||
|   self->pivot.y = -1.f; |  | ||||||
|   self->factor = 0.0f; |   self->factor = 0.0f; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -371,6 +343,8 @@ clutter_align_constraint_init (ClutterAlignConstraint *self) | |||||||
|  * alignment @factor |  * alignment @factor | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #ClutterAlignConstraint |  * Return value: the newly created #ClutterAlignConstraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterConstraint * | ClutterConstraint * | ||||||
| clutter_align_constraint_new (ClutterActor     *source, | clutter_align_constraint_new (ClutterActor     *source, | ||||||
| @@ -392,6 +366,8 @@ clutter_align_constraint_new (ClutterActor     *source, | |||||||
|  * @source: (allow-none): a #ClutterActor, or %NULL to unset the source |  * @source: (allow-none): a #ClutterActor, or %NULL to unset the source | ||||||
|  * |  * | ||||||
|  * Sets the source of the alignment constraint |  * Sets the source of the alignment constraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_align_constraint_set_source (ClutterAlignConstraint *align, | clutter_align_constraint_set_source (ClutterAlignConstraint *align, | ||||||
| @@ -429,15 +405,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align, | |||||||
|                                             G_CALLBACK (source_destroyed), |                                             G_CALLBACK (source_destroyed), | ||||||
|                                             align); |                                             align); | ||||||
|       g_signal_handlers_disconnect_by_func (old_source, |       g_signal_handlers_disconnect_by_func (old_source, | ||||||
|                                             G_CALLBACK (source_queue_relayout), |                                             G_CALLBACK (source_position_changed), | ||||||
|                                             align); |                                             align); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   align->source = source; |   align->source = source; | ||||||
|   if (align->source != NULL) |   if (align->source != NULL) | ||||||
|     { |     { | ||||||
|       g_signal_connect (align->source, "queue-relayout", |       g_signal_connect (align->source, "allocation-changed", | ||||||
|                         G_CALLBACK (source_queue_relayout), |                         G_CALLBACK (source_position_changed), | ||||||
|                         align); |                         align); | ||||||
|       g_signal_connect (align->source, "destroy", |       g_signal_connect (align->source, "destroy", | ||||||
|                         G_CALLBACK (source_destroyed), |                         G_CALLBACK (source_destroyed), | ||||||
| @@ -458,6 +434,8 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align, | |||||||
|  * |  * | ||||||
|  * Return value: (transfer none): the #ClutterActor used as the source |  * Return value: (transfer none): the #ClutterActor used as the source | ||||||
|  *   of the alignment |  *   of the alignment | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_align_constraint_get_source (ClutterAlignConstraint *align) | clutter_align_constraint_get_source (ClutterAlignConstraint *align) | ||||||
| @@ -473,6 +451,8 @@ clutter_align_constraint_get_source (ClutterAlignConstraint *align) | |||||||
|  * @axis: the axis to which the alignment refers to |  * @axis: the axis to which the alignment refers to | ||||||
|  * |  * | ||||||
|  * Sets the axis to which the alignment refers to |  * Sets the axis to which the alignment refers to | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, | clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, | ||||||
| @@ -498,6 +478,8 @@ clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, | |||||||
|  * Retrieves the value set using clutter_align_constraint_set_align_axis() |  * Retrieves the value set using clutter_align_constraint_set_align_axis() | ||||||
|  * |  * | ||||||
|  * Return value: the alignment axis |  * Return value: the alignment axis | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterAlignAxis | ClutterAlignAxis | ||||||
| clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align) | clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align) | ||||||
| @@ -508,60 +490,6 @@ clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align) | |||||||
|   return align->align_axis; |   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: |  * clutter_align_constraint_set_factor: | ||||||
|  * @align: a #ClutterAlignConstraint |  * @align: a #ClutterAlignConstraint | ||||||
| @@ -578,6 +506,8 @@ clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align, | |||||||
|  * meaning bottom, when #ClutterAlignConstraint:align-axis is set to |  * meaning bottom, when #ClutterAlignConstraint:align-axis is set to | ||||||
|  * %CLUTTER_ALIGN_Y_AXIS). A value of 0.5 aligns in the middle in either |  * %CLUTTER_ALIGN_Y_AXIS). A value of 0.5 aligns in the middle in either | ||||||
|  * cases |  * cases | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_align_constraint_set_factor (ClutterAlignConstraint *align, | clutter_align_constraint_set_factor (ClutterAlignConstraint *align, | ||||||
| @@ -600,6 +530,8 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align, | |||||||
|  * Retrieves the factor set using clutter_align_constraint_set_factor() |  * Retrieves the factor set using clutter_align_constraint_set_factor() | ||||||
|  * |  * | ||||||
|  * Return value: the alignment factor |  * Return value: the alignment factor | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_align_constraint_get_factor (ClutterAlignConstraint *align) | clutter_align_constraint_get_factor (ClutterAlignConstraint *align) | ||||||
|   | |||||||
| @@ -22,13 +22,14 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-constraint.h" | #include <clutter/clutter-constraint.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -36,37 +37,41 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_ALIGN_CONSTRAINT(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraint)) | #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)) | #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 _ClutterAlignConstraint          ClutterAlignConstraint; | ||||||
| typedef struct _ClutterAlignConstraintClass     ClutterAlignConstraintClass; | typedef struct _ClutterAlignConstraintClass     ClutterAlignConstraintClass; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType clutter_align_constraint_get_type (void) G_GNUC_CONST; | GType clutter_align_constraint_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterConstraint *clutter_align_constraint_new            (ClutterActor           *source, | ClutterConstraint *clutter_align_constraint_new            (ClutterActor           *source, | ||||||
|                                                             ClutterAlignAxis        axis, |                                                             ClutterAlignAxis        axis, | ||||||
|                                                             gfloat                  factor); |                                                             gfloat                  factor); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void               clutter_align_constraint_set_source     (ClutterAlignConstraint *align, | void               clutter_align_constraint_set_source     (ClutterAlignConstraint *align, | ||||||
|                                                             ClutterActor           *source); |                                                             ClutterActor           *source); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterActor *     clutter_align_constraint_get_source     (ClutterAlignConstraint *align); | ClutterActor *     clutter_align_constraint_get_source     (ClutterAlignConstraint *align); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void               clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, | void               clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, | ||||||
|                                                             ClutterAlignAxis        axis); |                                                             ClutterAlignAxis        axis); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterAlignAxis   clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align); | ClutterAlignAxis   clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| 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, | void               clutter_align_constraint_set_factor     (ClutterAlignConstraint *align, | ||||||
|                                                             gfloat                  factor); |                                                             gfloat                  factor); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gfloat             clutter_align_constraint_get_factor     (ClutterAlignConstraint *align); | gfloat             clutter_align_constraint_get_factor     (ClutterAlignConstraint *align); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_ALIGN_CONSTRAINT_H__ */ | ||||||
|   | |||||||
| @@ -23,26 +23,43 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterAnimatable: |  * SECTION:clutter-animatable | ||||||
|  *  |  * @short_description: Interface for animatable classes | ||||||
|  * 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. |  * to control how a #ClutterAnimation will animate a property. | ||||||
|  * |  * | ||||||
|  * Each #ClutterAnimatable should implement the |  * Each #ClutterAnimatable should implement the | ||||||
|  * [vfunc@Animatable.interpolate_value] virtual function of the |  * #ClutterAnimatableIface.interpolate_property() virtual function of the | ||||||
|  * interface to compute the animation state between two values of an interval |  * interface to compute the animation state between two values of an interval | ||||||
|  * depending on a progress factor, expressed as a floating point value. |  * depending on a progress factor, expressed as a floating point value. | ||||||
|  |  * | ||||||
|  |  * If a #ClutterAnimatable is animated by a #ClutterAnimation | ||||||
|  |  * instance, the #ClutterAnimation will call | ||||||
|  |  * clutter_animatable_interpolate_property() passing the name of the | ||||||
|  |  * currently animated property; the values interval; and the progress factor. | ||||||
|  |  * The #ClutterAnimatable implementation should return the computed value for | ||||||
|  |  * the animated | ||||||
|  |  * property. | ||||||
|  |  * | ||||||
|  |  * #ClutterAnimatable is available since Clutter 1.0 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-animatable.h" | #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | ||||||
| #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" | ||||||
|  |  | ||||||
|  | #include "deprecated/clutter-animatable.h" | ||||||
|  | #include "deprecated/clutter-animation.h" | ||||||
|  |  | ||||||
|  | typedef ClutterAnimatableIface  ClutterAnimatableInterface; | ||||||
| G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT); | G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT); | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -50,21 +67,97 @@ clutter_animatable_default_init (ClutterAnimatableInterface *iface) | |||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * clutter_animatable_animate_property: | ||||||
|  |  * @animatable: a #ClutterAnimatable | ||||||
|  |  * @animation: a #ClutterAnimation | ||||||
|  |  * @property_name: the name of the animated property | ||||||
|  |  * @initial_value: the initial value of the animation interval | ||||||
|  |  * @final_value: the final value of the animation interval | ||||||
|  |  * @progress: the progress factor | ||||||
|  |  * @value: return location for the animation value | ||||||
|  |  * | ||||||
|  |  * Calls the animate_property() virtual function for @animatable. | ||||||
|  |  * | ||||||
|  |  * The @initial_value and @final_value #GValue<!-- -->s must contain | ||||||
|  |  * the same type; @value must have been initialized to the same | ||||||
|  |  * type of @initial_value and @final_value. | ||||||
|  |  * | ||||||
|  |  * All implementation of the #ClutterAnimatable interface must | ||||||
|  |  * implement this function. | ||||||
|  |  * | ||||||
|  |  * Return value: %TRUE if the value has been validated and can | ||||||
|  |  *   be applied to the #ClutterAnimatable, and %FALSE otherwise | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  |  * | ||||||
|  |  * Deprecated: 1.8: Use clutter_animatable_interpolate_value() | ||||||
|  |  *   instead | ||||||
|  |  */ | ||||||
|  | gboolean | ||||||
|  | clutter_animatable_animate_property (ClutterAnimatable *animatable, | ||||||
|  |                                      ClutterAnimation  *animation, | ||||||
|  |                                      const gchar       *property_name, | ||||||
|  |                                      const GValue      *initial_value, | ||||||
|  |                                      const GValue      *final_value, | ||||||
|  |                                      gdouble            progress, | ||||||
|  |                                      GValue            *value) | ||||||
|  | { | ||||||
|  |   ClutterAnimatableIface *iface; | ||||||
|  |   gboolean res; | ||||||
|  |  | ||||||
|  |   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE); | ||||||
|  |   g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE); | ||||||
|  |   g_return_val_if_fail (property_name != NULL, FALSE); | ||||||
|  |   g_return_val_if_fail (initial_value != NULL && final_value != NULL, FALSE); | ||||||
|  |   g_return_val_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID, FALSE); | ||||||
|  |   g_return_val_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID, FALSE); | ||||||
|  |   g_return_val_if_fail (value != NULL, FALSE); | ||||||
|  |   g_return_val_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) && | ||||||
|  |                         G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value), | ||||||
|  |                         FALSE); | ||||||
|  |  | ||||||
|  |   iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable); | ||||||
|  |   if (iface->animate_property == NULL) | ||||||
|  |     { | ||||||
|  |       ClutterInterval *interval; | ||||||
|  |  | ||||||
|  |       interval = clutter_animation_get_interval (animation, property_name); | ||||||
|  |       if (interval == NULL) | ||||||
|  |         return FALSE; | ||||||
|  |  | ||||||
|  |       res = clutter_animatable_interpolate_value (animatable, property_name, | ||||||
|  |                                                   interval, | ||||||
|  |                                                   progress, | ||||||
|  |                                                   value); | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     res = iface->animate_property (animatable, animation, | ||||||
|  |                                    property_name, | ||||||
|  |                                    initial_value, final_value, | ||||||
|  |                                    progress, | ||||||
|  |                                    value); | ||||||
|  |  | ||||||
|  |   return res; | ||||||
|  | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * clutter_animatable_find_property: |  * clutter_animatable_find_property: | ||||||
|  * @animatable: a #ClutterAnimatable |  * @animatable: a #ClutterAnimatable | ||||||
|  * @property_name: the name of the animatable property to find |  * @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 |  * Return value: (transfer none): The #GParamSpec for the given property | ||||||
|  *   or %NULL |  *   or %NULL | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| GParamSpec * | GParamSpec * | ||||||
| clutter_animatable_find_property (ClutterAnimatable *animatable, | clutter_animatable_find_property (ClutterAnimatable *animatable, | ||||||
|                                   const gchar       *property_name) |                                   const gchar       *property_name) | ||||||
| { | { | ||||||
|   ClutterAnimatableInterface *iface; |   ClutterAnimatableIface *iface; | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL); |   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL); | ||||||
|   g_return_val_if_fail (property_name != NULL, NULL); |   g_return_val_if_fail (property_name != NULL, NULL); | ||||||
| @@ -86,13 +179,15 @@ clutter_animatable_find_property (ClutterAnimatable *animatable, | |||||||
|  * @value: a #GValue initialized to the type of the property to retrieve |  * @value: a #GValue initialized to the type of the property to retrieve | ||||||
|  * |  * | ||||||
|  * Retrieves the current state of @property_name and sets @value with it |  * Retrieves the current state of @property_name and sets @value with it | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_animatable_get_initial_state (ClutterAnimatable *animatable, | clutter_animatable_get_initial_state (ClutterAnimatable *animatable, | ||||||
|                                       const gchar       *property_name, |                                       const gchar       *property_name, | ||||||
|                                       GValue            *value) |                                       GValue            *value) | ||||||
| { | { | ||||||
|   ClutterAnimatableInterface *iface; |   ClutterAnimatableIface *iface; | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable)); |   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable)); | ||||||
|   g_return_if_fail (property_name != NULL); |   g_return_if_fail (property_name != NULL); | ||||||
| @@ -113,13 +208,15 @@ clutter_animatable_get_initial_state (ClutterAnimatable *animatable, | |||||||
|  * @value: the value of the animatable property to set |  * @value: the value of the animatable property to set | ||||||
|  * |  * | ||||||
|  * Sets the current state of @property_name to @value |  * Sets the current state of @property_name to @value | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_animatable_set_final_state (ClutterAnimatable *animatable, | clutter_animatable_set_final_state (ClutterAnimatable *animatable, | ||||||
|                                     const gchar       *property_name, |                                     const gchar       *property_name, | ||||||
|                                     const GValue      *value) |                                     const GValue      *value) | ||||||
| { | { | ||||||
|   ClutterAnimatableInterface *iface; |   ClutterAnimatableIface *iface; | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable)); |   g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable)); | ||||||
|   g_return_if_fail (property_name != NULL); |   g_return_if_fail (property_name != NULL); | ||||||
| @@ -149,12 +246,14 @@ clutter_animatable_set_final_state (ClutterAnimatable *animatable, | |||||||
|  * value, and store the result inside @value. |  * value, and store the result inside @value. | ||||||
|  * |  * | ||||||
|  * This function should be used for every property animation |  * This function should be used for every property animation | ||||||
|  * involving `ClutterAnimatable`s. |  * involving #ClutterAnimatable<!-- -->s. | ||||||
|  * |  * | ||||||
|  * This function replaces clutter_animatable_animate_property(). |  * This function replaces clutter_animatable_animate_property(). | ||||||
|  * |  * | ||||||
|  * Return value: %TRUE if the interpolation was successful, |  * Return value: %TRUE if the interpolation was successful, | ||||||
|  *   and %FALSE otherwise |  *   and %FALSE otherwise | ||||||
|  |  * | ||||||
|  |  * Since: 1.8 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | ||||||
| @@ -163,7 +262,7 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | |||||||
|                                       gdouble            progress, |                                       gdouble            progress, | ||||||
|                                       GValue            *value) |                                       GValue            *value) | ||||||
| { | { | ||||||
|   ClutterAnimatableInterface *iface; |   ClutterAnimatableIface *iface; | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE); |   g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE); | ||||||
|   g_return_val_if_fail (property_name != NULL, FALSE); |   g_return_val_if_fail (property_name != NULL, FALSE); | ||||||
| @@ -185,25 +284,3 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | |||||||
|   else |   else | ||||||
|     return clutter_interval_compute_value (interval, progress, value); |     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,25 +22,37 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   Emmanuele Bassi <ebassi@linux.intel.com> | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #pragma once | #ifndef __CLUTTER_ANIMATABLE_H__ | ||||||
|  | #define __CLUTTER_ANIMATABLE_H__ | ||||||
|  |  | ||||||
| #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" | #include <clutter/clutter-types.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| #define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ()) | #define CLUTTER_TYPE_ANIMATABLE                 (clutter_animatable_get_type ()) | ||||||
|  | #define CLUTTER_ANIMATABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATABLE, ClutterAnimatable)) | ||||||
|  | #define CLUTTER_IS_ANIMATABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATABLE)) | ||||||
|  | #define CLUTTER_ANIMATABLE_GET_IFACE(obj)       (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_ANIMATABLE, ClutterAnimatableIface)) | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | typedef struct _ClutterAnimatableIface          ClutterAnimatableIface; | ||||||
| G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable, |  | ||||||
|                      CLUTTER, ANIMATABLE, |  | ||||||
|                      GObject) |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterAnimatableInterface: |  * ClutterAnimatable: | ||||||
|  |  * | ||||||
|  |  * #ClutterAnimatable is an opaque structure whose members cannot be directly | ||||||
|  |  * accessed | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ClutterAnimatableIface: | ||||||
|  |  * @animate_property: virtual function for custom interpolation of a | ||||||
|  |  *   property. This virtual function is deprecated | ||||||
|  * @find_property: virtual function for retrieving the #GParamSpec of |  * @find_property: virtual function for retrieving the #GParamSpec of | ||||||
|  *   an animatable property |  *   an animatable property | ||||||
|  * @get_initial_state: virtual function for retrieving the initial |  * @get_initial_state: virtual function for retrieving the initial | ||||||
| @@ -49,14 +61,25 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable, | |||||||
|  *   animatable property |  *   animatable property | ||||||
|  * @interpolate_value: virtual function for interpolating the progress |  * @interpolate_value: virtual function for interpolating the progress | ||||||
|  *   of a property |  *   of a property | ||||||
|  * @get_actor: virtual function for getting associated actor |  * | ||||||
|  |  * Base interface for #GObject<!-- -->s that can be animated by a | ||||||
|  |  * a #ClutterAnimation. | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| struct _ClutterAnimatableInterface | struct _ClutterAnimatableIface | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   GTypeInterface parent_iface; |   GTypeInterface parent_iface; | ||||||
|  |  | ||||||
|   /*< public >*/ |   /*< public >*/ | ||||||
|  |   gboolean    (* animate_property)  (ClutterAnimatable *animatable, | ||||||
|  |                                      ClutterAnimation  *animation, | ||||||
|  |                                      const gchar       *property_name, | ||||||
|  |                                      const GValue      *initial_value, | ||||||
|  |                                      const GValue      *final_value, | ||||||
|  |                                      gdouble            progress, | ||||||
|  |                                      GValue            *value); | ||||||
|   GParamSpec *(* find_property)     (ClutterAnimatable *animatable, |   GParamSpec *(* find_property)     (ClutterAnimatable *animatable, | ||||||
|                                      const gchar       *property_name); |                                      const gchar       *property_name); | ||||||
|   void        (* get_initial_state) (ClutterAnimatable *animatable, |   void        (* get_initial_state) (ClutterAnimatable *animatable, | ||||||
| @@ -70,28 +93,29 @@ struct _ClutterAnimatableInterface | |||||||
|                                      ClutterInterval   *interval, |                                      ClutterInterval   *interval, | ||||||
|                                      gdouble            progress, |                                      gdouble            progress, | ||||||
|                                      GValue            *value); |                                      GValue            *value); | ||||||
|   ClutterActor * (* get_actor)      (ClutterAnimatable *animatable); |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
|  | GType clutter_animatable_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| GParamSpec *clutter_animatable_find_property     (ClutterAnimatable *animatable, | GParamSpec *clutter_animatable_find_property     (ClutterAnimatable *animatable, | ||||||
|                                                   const gchar       *property_name); |                                                   const gchar       *property_name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void        clutter_animatable_get_initial_state (ClutterAnimatable *animatable, | void        clutter_animatable_get_initial_state (ClutterAnimatable *animatable, | ||||||
|                                                   const gchar       *property_name, |                                                   const gchar       *property_name, | ||||||
|                                                   GValue            *value); |                                                   GValue            *value); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void        clutter_animatable_set_final_state   (ClutterAnimatable *animatable, | void        clutter_animatable_set_final_state   (ClutterAnimatable *animatable, | ||||||
|                                                   const gchar       *property_name, |                                                   const gchar       *property_name, | ||||||
|                                                   const GValue      *value); |                                                   const GValue      *value); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_8 | ||||||
| gboolean    clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | gboolean    clutter_animatable_interpolate_value (ClutterAnimatable *animatable, | ||||||
|                                                   const gchar       *property_name, |                                                   const gchar       *property_name, | ||||||
|                                                   ClutterInterval   *interval, |                                                   ClutterInterval   *interval, | ||||||
|                                                   gdouble            progress, |                                                   gdouble            progress, | ||||||
|                                                   GValue            *value); |                                                   GValue            *value); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT |  | ||||||
| ClutterActor * clutter_animatable_get_actor      (ClutterAnimatable *animatable); |  | ||||||
|  |  | ||||||
| G_END_DECLS | 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| @@ -29,8 +30,11 @@ | |||||||
|  |  | ||||||
| #ifndef __GI_SCANNER__ | #ifndef __GI_SCANNER__ | ||||||
|  |  | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAnimatable, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref) | ||||||
| @@ -40,16 +44,23 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref) | |||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClickAction, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContent, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGestureAction, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (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 (ClutterInputDevice, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref) | ||||||
| @@ -81,9 +92,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterZoomAction, g_object_unref) | |||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_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 (ClutterPaintVolume, clutter_paint_volume_free) | ||||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free) | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free) | ||||||
|  | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free) | ||||||
|  |  | ||||||
| #endif /* __GI_SCANNER__ */ | #endif /* __GI_SCANNER__ */ | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_AUTO_CLEANUPS_H__ */ | ||||||
|   | |||||||
| @@ -19,11 +19,14 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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-backend.h> | ||||||
| #include "clutter/clutter-seat.h" | #include <clutter/clutter-device-manager.h> | ||||||
| #include "clutter/clutter-stage-window.h" | #include <clutter/clutter-stage-window.h> | ||||||
|  |  | ||||||
|  | #include "clutter-event-translator.h" | ||||||
|  |  | ||||||
| #define CLUTTER_BACKEND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass)) | #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)) | #define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND)) | ||||||
| @@ -45,6 +48,8 @@ struct _ClutterBackend | |||||||
|  |  | ||||||
|   CoglOnscreen *dummy_onscreen; |   CoglOnscreen *dummy_onscreen; | ||||||
|  |  | ||||||
|  |   ClutterDeviceManager *device_manager; | ||||||
|  |  | ||||||
|   cairo_font_options_t *font_options; |   cairo_font_options_t *font_options; | ||||||
|  |  | ||||||
|   gchar *font_name; |   gchar *font_name; | ||||||
| @@ -52,11 +57,7 @@ struct _ClutterBackend | |||||||
|   gfloat units_per_em; |   gfloat units_per_em; | ||||||
|   gint32 units_serial; |   gint32 units_serial; | ||||||
|  |  | ||||||
|   float fallback_resource_scale; |   GList *event_translators; | ||||||
|  |  | ||||||
|   ClutterStageWindow *stage_window; |  | ||||||
|  |  | ||||||
|   ClutterInputMethod *input_method; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| struct _ClutterBackendClass | struct _ClutterBackendClass | ||||||
| @@ -65,11 +66,18 @@ struct _ClutterBackendClass | |||||||
|   GObjectClass parent_class; |   GObjectClass parent_class; | ||||||
|  |  | ||||||
|   /* vfuncs */ |   /* vfuncs */ | ||||||
|   gboolean              (* finish_init)        (ClutterBackend  *backend, |   gboolean              (* pre_parse)          (ClutterBackend  *backend, | ||||||
|  |                                                 GError         **error); | ||||||
|  |   gboolean              (* post_parse)         (ClutterBackend  *backend, | ||||||
|                                                 GError         **error); |                                                 GError         **error); | ||||||
|   ClutterStageWindow *  (* create_stage)       (ClutterBackend  *backend, |   ClutterStageWindow *  (* create_stage)       (ClutterBackend  *backend, | ||||||
|                                                 ClutterStage    *wrapper, |                                                 ClutterStage    *wrapper, | ||||||
|                                                 GError         **error); |                                                 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, |   CoglRenderer *        (* get_renderer)       (ClutterBackend  *backend, | ||||||
|                                                 GError         **error); |                                                 GError         **error); | ||||||
|   CoglDisplay *         (* get_display)        (ClutterBackend  *backend, |   CoglDisplay *         (* get_display)        (ClutterBackend  *backend, | ||||||
| @@ -78,10 +86,19 @@ struct _ClutterBackendClass | |||||||
|                                                 GError         **error); |                                                 GError         **error); | ||||||
|   gboolean              (* create_context)     (ClutterBackend  *backend, |   gboolean              (* create_context)     (ClutterBackend  *backend, | ||||||
|                                                 GError         **error); |                                                 GError         **error); | ||||||
|  |   ClutterDeviceManager *(* get_device_manager) (ClutterBackend  *backend); | ||||||
|  |  | ||||||
|   ClutterSeat *         (* get_default_seat)   (ClutterBackend *backend); |   void                  (* copy_event_data)    (ClutterBackend     *backend, | ||||||
|  |                                                 const ClutterEvent *src, | ||||||
|  |                                                 ClutterEvent       *dest); | ||||||
|  |   void                  (* free_event_data)    (ClutterBackend     *backend, | ||||||
|  |                                                 ClutterEvent       *event); | ||||||
|  |  | ||||||
|   gboolean              (* is_display_server)  (ClutterBackend *backend); |   gboolean              (* translate_event)    (ClutterBackend     *backend, | ||||||
|  |                                                 gpointer            native, | ||||||
|  |                                                 ClutterEvent       *event); | ||||||
|  |  | ||||||
|  |   PangoDirection        (* get_keymap_direction) (ClutterBackend   *backend); | ||||||
|  |  | ||||||
|   /* signals */ |   /* signals */ | ||||||
|   void (* resolution_changed) (ClutterBackend *backend); |   void (* resolution_changed) (ClutterBackend *backend); | ||||||
| @@ -89,33 +106,53 @@ struct _ClutterBackendClass | |||||||
|   void (* settings_changed)   (ClutterBackend *backend); |   void (* settings_changed)   (ClutterBackend *backend); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | ClutterBackend *        _clutter_create_backend                         (void); | ||||||
|  |  | ||||||
| ClutterStageWindow *    _clutter_backend_create_stage                   (ClutterBackend         *backend, | ClutterStageWindow *    _clutter_backend_create_stage                   (ClutterBackend         *backend, | ||||||
|                                                                          ClutterStage           *wrapper, |                                                                          ClutterStage           *wrapper, | ||||||
|                                                                          GError                **error); |                                                                          GError                **error); | ||||||
| gboolean                _clutter_backend_create_context                 (ClutterBackend         *backend, | gboolean                _clutter_backend_create_context                 (ClutterBackend         *backend, | ||||||
|                                                                          GError                **error); |                                                                          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); |                                                                          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); | ||||||
|  | gboolean                _clutter_backend_translate_event                (ClutterBackend         *backend, | ||||||
|  |                                                                          gpointer                native, | ||||||
|  |                                                                          ClutterEvent           *event); | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_MUTTER | ||||||
|  | void                    _clutter_backend_add_event_translator           (ClutterBackend         *backend, | ||||||
|  |                                                                          ClutterEventTranslator *translator); | ||||||
|  |  | ||||||
|  | void                    _clutter_backend_remove_event_translator        (ClutterBackend         *backend, | ||||||
|  |                                                                          ClutterEventTranslator *translator); | ||||||
|  |  | ||||||
|  | ClutterFeatureFlags     _clutter_backend_get_features                   (ClutterBackend         *backend); | ||||||
|  |  | ||||||
| gfloat                  _clutter_backend_get_units_per_em               (ClutterBackend         *backend, | gfloat                  _clutter_backend_get_units_per_em               (ClutterBackend         *backend, | ||||||
|                                                                          PangoFontDescription   *font_desc); |                                                                          PangoFontDescription   *font_desc); | ||||||
| gint32                  _clutter_backend_get_units_serial               (ClutterBackend         *backend); | gint32                  _clutter_backend_get_units_serial               (ClutterBackend         *backend); | ||||||
|  |  | ||||||
|  | PangoDirection          _clutter_backend_get_keymap_direction           (ClutterBackend         *backend); | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_MUTTER | ||||||
|  | void                    _clutter_backend_reset_cogl_framebuffer         (ClutterBackend         *backend); | ||||||
|  |  | ||||||
| void                    clutter_set_allowed_drivers                     (const char             *drivers); | void                    clutter_set_allowed_drivers                     (const char             *drivers); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | void                    clutter_try_set_windowing_backend               (const char             *drivers); | ||||||
| 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 | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BACKEND_PRIVATE_H__ */ | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -21,7 +21,8 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| @@ -30,11 +31,10 @@ | |||||||
| #include <cairo.h> | #include <cairo.h> | ||||||
| #include <pango/pango.h> | #include <pango/pango.h> | ||||||
|  |  | ||||||
| #include "cogl/cogl.h" | #include <cogl/cogl.h> | ||||||
|  |  | ||||||
| #include "clutter/clutter-keymap.h" | #include <clutter/clutter-config.h> | ||||||
| #include "clutter/clutter-types.h" | #include <clutter/clutter-types.h> | ||||||
| #include "clutter/clutter-seat.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -42,34 +42,38 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_BACKEND(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND, ClutterBackend)) | #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)) | #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 _ClutterBackend          ClutterBackend; | ||||||
| typedef struct _ClutterBackendClass     ClutterBackendClass; | typedef struct _ClutterBackendClass     ClutterBackendClass; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| GType clutter_backend_get_type (void) G_GNUC_CONST; | GType clutter_backend_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| ClutterBackend *                clutter_get_default_backend             (void); | ClutterBackend *                clutter_get_default_backend             (void); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_16 | ||||||
|  | void                            clutter_set_windowing_backend           (const char *backend_type); | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_ALL | ||||||
| gdouble                         clutter_backend_get_resolution          (ClutterBackend             *backend); | gdouble                         clutter_backend_get_resolution          (ClutterBackend             *backend); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| void                            clutter_backend_set_font_options        (ClutterBackend             *backend, | void                            clutter_backend_set_font_options        (ClutterBackend             *backend, | ||||||
|                                                                          const cairo_font_options_t *options); |                                                                          const cairo_font_options_t *options); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| const cairo_font_options_t *    clutter_backend_get_font_options        (ClutterBackend             *backend); | const cairo_font_options_t *    clutter_backend_get_font_options        (ClutterBackend             *backend); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_8 | ||||||
| CoglContext *                   clutter_backend_get_cogl_context        (ClutterBackend             *backend); | CoglContext *                   clutter_backend_get_cogl_context        (ClutterBackend             *backend); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT |  | ||||||
| ClutterInputMethod *            clutter_backend_get_input_method        (ClutterBackend             *backend); |  | ||||||
|  |  | ||||||
| CLUTTER_EXPORT |  | ||||||
| void                            clutter_backend_set_input_method        (ClutterBackend             *backend, |  | ||||||
|                                                                          ClutterInputMethod         *method); |  | ||||||
| CLUTTER_EXPORT |  | ||||||
| ClutterSeat *                   clutter_backend_get_default_seat        (ClutterBackend             *backend); |  | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BACKEND_H__ */ | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -21,13 +21,12 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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 <glib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | #include "clutter-bezier.h" | ||||||
| #include "clutter/clutter-bezier.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-debug.h" |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * We have some experimental code here to allow for constant velocity |  * We have some experimental code here to allow for constant velocity | ||||||
| @@ -36,7 +35,7 @@ | |||||||
| #undef CBZ_L2T_INTERPOLATION | #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)                * |  * (private; a building block for the public bspline object)                * | ||||||
|  ****************************************************************************/ |  ****************************************************************************/ | ||||||
|  |  | ||||||
| @@ -105,7 +104,7 @@ struct _ClutterBezier | |||||||
| ClutterBezier * | ClutterBezier * | ||||||
| _clutter_bezier_new (void) | _clutter_bezier_new (void) | ||||||
| { | { | ||||||
|   return g_new0 (ClutterBezier, 1); |   return g_slice_new0 (ClutterBezier); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| @@ -113,7 +112,7 @@ _clutter_bezier_free (ClutterBezier * b) | |||||||
| { | { | ||||||
|   if (G_LIKELY (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' |      * 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 |      * below), which is only at the end turned to the inverse value. In order | ||||||
|      * for the algorithm to produce satisfactory results, the reciprocal value |      * 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. |      * elsewhere in clutter is not good enough, and 10.22 is used instead. | ||||||
|      */ |      */ | ||||||
|     _FixedT x; |     _FixedT x; | ||||||
| @@ -237,7 +236,7 @@ sqrti (int number) | |||||||
|     /* Now, we convert the float to 10.22 fixed. We exploit the mechanism |     /* Now, we convert the float to 10.22 fixed. We exploit the mechanism | ||||||
|      * described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf. |      * 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 |      * 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). |      * multiplier as we are only dealing with positive numbers). | ||||||
|      * |      * | ||||||
| @@ -257,7 +256,7 @@ sqrti (int number) | |||||||
|     flt2.i = (flt2.i >> 11) * (y_1 >> 11); |     flt2.i = (flt2.i >> 11) * (y_1 >> 11); | ||||||
|  |  | ||||||
|     /* If the original argument is less than 342, we do another |     /* 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). |      * iteration produces generally better results). | ||||||
|      */ |      */ | ||||||
|     if (x < 171) |     if (x < 171) | ||||||
| @@ -325,7 +324,7 @@ _clutter_bezier_init (ClutterBezier *b, | |||||||
|    * triggers, we need to change those two functions a bit. |    * triggers, we need to change those two functions a bit. | ||||||
|    */ |    */ | ||||||
|   if (b->ax > 0x1fff || b->bx > 0x1fff || b->cx > 0x1fff) |   if (b->ax > 0x1fff || b->bx > 0x1fff || b->cx > 0x1fff) | ||||||
|     g_warning ("Calculated coefficients will result in multiplication " |     g_warning ("Calculated coefficents will result in multiplication " | ||||||
|                "overflow in clutter_bezier_t2x and clutter_bezier_t2y."); |                "overflow in clutter_bezier_t2x and clutter_bezier_t2y."); | ||||||
|  |  | ||||||
|   /* |   /* | ||||||
|   | |||||||
| @@ -21,11 +21,11 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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 <glib.h> | ||||||
|  | #include "clutter-types.h" | ||||||
| #include "clutter/clutter-types.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -36,7 +36,7 @@ G_BEGIN_DECLS | |||||||
|  |  | ||||||
| typedef struct _ClutterBezier ClutterBezier; | typedef struct _ClutterBezier ClutterBezier; | ||||||
|  |  | ||||||
| ClutterBezier *_clutter_bezier_new (void); | ClutterBezier *_clutter_bezier_new (); | ||||||
|  |  | ||||||
| void           _clutter_bezier_free (ClutterBezier * b); | void           _clutter_bezier_free (ClutterBezier * b); | ||||||
|  |  | ||||||
| @@ -61,3 +61,5 @@ void           _clutter_bezier_adjust (ClutterBezier *b, | |||||||
| guint          _clutter_bezier_get_length (const ClutterBezier *b); | guint          _clutter_bezier_get_length (const ClutterBezier *b); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BEZIER_H__ */ | ||||||
|   | |||||||
| @@ -23,9 +23,8 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterBinLayout: |  * SECTION:clutter-bin-layout | ||||||
|  *  |  * @short_description: A simple layout manager | ||||||
|  * A simple layout manager |  | ||||||
|  * |  * | ||||||
|  * #ClutterBinLayout is a layout manager which implements the following |  * #ClutterBinLayout is a layout manager which implements the following | ||||||
|  * policy: |  * policy: | ||||||
| @@ -40,23 +39,27 @@ | |||||||
|  * |  * | ||||||
|  * The [bin-layout example](https://git.gnome.org/browse/clutter/tree/examples/bin-layout.c?h=clutter-1.18) |  * 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. |  * shows how to pack actors inside a #ClutterBinLayout. | ||||||
|  |  * | ||||||
|  |  * #ClutterBinLayout is available since Clutter 1.2 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | #define CLUTTER_DISABLE_DEPRECATION_WARNINGS | ||||||
| #include "clutter/deprecated/clutter-container.h" | #include "deprecated/clutter-container.h" | ||||||
|  | #include "deprecated/clutter-bin-layout.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-private.h" | #include "clutter-actor-private.h" | ||||||
| #include "clutter/clutter-animatable.h" | #include "clutter-animatable.h" | ||||||
| #include "clutter/clutter-bin-layout.h" | #include "clutter-child-meta.h" | ||||||
| #include "clutter/clutter-child-meta.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-enum-types.h" | ||||||
| #include "clutter/clutter-enum-types.h" | #include "clutter-layout-meta.h" | ||||||
| #include "clutter/clutter-layout-meta.h" | #include "clutter-private.h" | ||||||
| #include "clutter/clutter-private.h" |  | ||||||
|  |  | ||||||
| #define CLUTTER_TYPE_BIN_LAYER          (clutter_bin_layer_get_type ()) | #define CLUTTER_TYPE_BIN_LAYER          (clutter_bin_layer_get_type ()) | ||||||
| #define CLUTTER_BIN_LAYER(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYER, ClutterBinLayer)) | #define CLUTTER_BIN_LAYER(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYER, ClutterBinLayer)) | ||||||
| @@ -213,13 +216,19 @@ clutter_bin_layer_class_init (ClutterBinLayerClass *klass) | |||||||
|   gobject_class->get_property = clutter_bin_layer_get_property; |   gobject_class->get_property = clutter_bin_layer_get_property; | ||||||
|  |  | ||||||
|   layer_props[PROP_LAYER_X_ALIGN] = |   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_TYPE_BIN_ALIGNMENT, | ||||||
|                        CLUTTER_BIN_ALIGNMENT_CENTER, |                        CLUTTER_BIN_ALIGNMENT_CENTER, | ||||||
|                        CLUTTER_PARAM_READWRITE); |                        CLUTTER_PARAM_READWRITE); | ||||||
|  |  | ||||||
|   layer_props[PROP_LAYER_Y_ALIGN] = |   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_TYPE_BIN_ALIGNMENT, | ||||||
|                        CLUTTER_BIN_ALIGNMENT_CENTER, |                        CLUTTER_BIN_ALIGNMENT_CENTER, | ||||||
|                        CLUTTER_PARAM_READWRITE); |                        CLUTTER_PARAM_READWRITE); | ||||||
| @@ -399,7 +408,8 @@ get_actor_align_factor (ClutterActorAlign alignment) | |||||||
| static void | static void | ||||||
| clutter_bin_layout_allocate (ClutterLayoutManager   *manager, | clutter_bin_layout_allocate (ClutterLayoutManager   *manager, | ||||||
|                              ClutterContainer       *container, |                              ClutterContainer       *container, | ||||||
|                              const ClutterActorBox  *allocation) |                              const ClutterActorBox  *allocation, | ||||||
|  |                              ClutterAllocationFlags  flags) | ||||||
| { | { | ||||||
|   gfloat allocation_x, allocation_y; |   gfloat allocation_x, allocation_y; | ||||||
|   gfloat available_w, available_h; |   gfloat available_w, available_h; | ||||||
| @@ -507,7 +517,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager   *manager, | |||||||
|  |  | ||||||
|       clutter_actor_allocate_align_fill (child, &child_alloc, |       clutter_actor_allocate_align_fill (child, &child_alloc, | ||||||
|                                          x_align, y_align, |                                          x_align, y_align, | ||||||
|                                          x_fill, y_fill); |                                          x_fill, y_fill, | ||||||
|  |                                          flags); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -612,11 +623,16 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) | |||||||
|    * The default horizontal alignment policy for actors managed |    * The default horizontal alignment policy for actors managed | ||||||
|    * by the #ClutterBinLayout |    * by the #ClutterBinLayout | ||||||
|    * |    * | ||||||
|  |    * Since: 1.2 | ||||||
|  |    * | ||||||
|    * Deprecated: 1.12: Use the #ClutterActor:x-expand and the |    * Deprecated: 1.12: Use the #ClutterActor:x-expand and the | ||||||
|    *   #ClutterActor:x-align properties on #ClutterActor instead. |    *   #ClutterActor:x-align properties on #ClutterActor instead. | ||||||
|    */ |    */ | ||||||
|   bin_props[PROP_X_ALIGN] = |   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_TYPE_BIN_ALIGNMENT, | ||||||
|                        CLUTTER_BIN_ALIGNMENT_CENTER, |                        CLUTTER_BIN_ALIGNMENT_CENTER, | ||||||
|                        CLUTTER_PARAM_READWRITE); |                        CLUTTER_PARAM_READWRITE); | ||||||
| @@ -627,11 +643,16 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) | |||||||
|    * The default vertical alignment policy for actors managed |    * The default vertical alignment policy for actors managed | ||||||
|    * by the #ClutterBinLayout |    * by the #ClutterBinLayout | ||||||
|    * |    * | ||||||
|  |    * Since: 1.2 | ||||||
|  |    * | ||||||
|    * Deprecated: 1.12: Use the #ClutterActor:y-expand and the |    * Deprecated: 1.12: Use the #ClutterActor:y-expand and the | ||||||
|    *   #ClutterActor:y-align properties on #ClutterActor instead. |    *   #ClutterActor:y-align properties on #ClutterActor instead. | ||||||
|    */ |    */ | ||||||
|   bin_props[PROP_Y_ALIGN] = |   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_TYPE_BIN_ALIGNMENT, | ||||||
|                        CLUTTER_BIN_ALIGNMENT_CENTER, |                        CLUTTER_BIN_ALIGNMENT_CENTER, | ||||||
|                        CLUTTER_PARAM_READWRITE); |                        CLUTTER_PARAM_READWRITE); | ||||||
| @@ -667,6 +688,8 @@ clutter_bin_layout_init (ClutterBinLayout *self) | |||||||
|  * Creates a new #ClutterBinLayout layout manager |  * Creates a new #ClutterBinLayout layout manager | ||||||
|  * |  * | ||||||
|  * Return value: the newly created layout manager |  * Return value: the newly created layout manager | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  */ |  */ | ||||||
| ClutterLayoutManager * | ClutterLayoutManager * | ||||||
| clutter_bin_layout_new (ClutterBinAlignment x_align, | clutter_bin_layout_new (ClutterBinAlignment x_align, | ||||||
| @@ -677,3 +700,187 @@ clutter_bin_layout_new (ClutterBinAlignment x_align, | |||||||
|                        "y-align", y_align, |                        "y-align", y_align, | ||||||
|                        NULL); |                        NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * clutter_bin_layout_set_alignment: | ||||||
|  |  * @self: a #ClutterBinLayout | ||||||
|  |  * @child: (allow-none): a child of @container | ||||||
|  |  * @x_align: the horizontal alignment policy to be used for the @child | ||||||
|  |  *   inside @container | ||||||
|  |  * @y_align: the vertical aligment policy to be used on the @child | ||||||
|  |  *   inside @container | ||||||
|  |  * | ||||||
|  |  * Sets the horizontal and vertical alignment policies to be applied | ||||||
|  |  * to a @child of @self | ||||||
|  |  * | ||||||
|  |  * If @child is %NULL then the @x_align and @y_align values will | ||||||
|  |  * be set as the default alignment policies | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  |  * | ||||||
|  |  * Deprecated: 1.12: Use the #ClutterActor:x-align and | ||||||
|  |  *   #ClutterActor:y-align properties of #ClutterActor instead. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | clutter_bin_layout_set_alignment (ClutterBinLayout    *self, | ||||||
|  |                                   ClutterActor        *child, | ||||||
|  |                                   ClutterBinAlignment  x_align, | ||||||
|  |                                   ClutterBinAlignment  y_align) | ||||||
|  | { | ||||||
|  |   ClutterBinLayoutPrivate *priv; | ||||||
|  |   ClutterLayoutManager *manager; | ||||||
|  |   ClutterLayoutMeta *meta; | ||||||
|  |  | ||||||
|  |   g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self)); | ||||||
|  |   g_return_if_fail (child == NULL || CLUTTER_IS_ACTOR (child)); | ||||||
|  |  | ||||||
|  |   priv = self->priv; | ||||||
|  |  | ||||||
|  |   if (priv->container == NULL) | ||||||
|  |     { | ||||||
|  |       if (child == NULL) | ||||||
|  |         { | ||||||
|  |           set_x_align (self, x_align); | ||||||
|  |           set_y_align (self, y_align); | ||||||
|  |         } | ||||||
|  |       else | ||||||
|  |         g_warning ("The layout of type '%s' must be associated to " | ||||||
|  |                    "a ClutterContainer before setting the alignment " | ||||||
|  |                    "on its children", | ||||||
|  |                    G_OBJECT_TYPE_NAME (self)); | ||||||
|  |  | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   manager = CLUTTER_LAYOUT_MANAGER (self); | ||||||
|  |   meta = clutter_layout_manager_get_child_meta (manager, | ||||||
|  |                                                 priv->container, | ||||||
|  |                                                 child); | ||||||
|  |   g_assert (CLUTTER_IS_BIN_LAYER (meta)); | ||||||
|  |  | ||||||
|  |   set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align); | ||||||
|  |   set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * clutter_bin_layout_get_alignment: | ||||||
|  |  * @self: a #ClutterBinLayout | ||||||
|  |  * @child: (allow-none): a child of @container | ||||||
|  |  * @x_align: (out) (allow-none): return location for the horizontal | ||||||
|  |  *   alignment policy | ||||||
|  |  * @y_align: (out) (allow-none): return location for the vertical | ||||||
|  |  *   alignment policy | ||||||
|  |  * | ||||||
|  |  * Retrieves the horizontal and vertical alignment policies for | ||||||
|  |  * a child of @self | ||||||
|  |  * | ||||||
|  |  * If @child is %NULL the default alignment policies will be returned | ||||||
|  |  * instead | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  |  * | ||||||
|  |  * Deprecated: 1.12: Use the #ClutterActor:x-align and the | ||||||
|  |  *   #ClutterActor:y-align properties of #ClutterActor instead. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | clutter_bin_layout_get_alignment (ClutterBinLayout    *self, | ||||||
|  |                                   ClutterActor        *child, | ||||||
|  |                                   ClutterBinAlignment *x_align, | ||||||
|  |                                   ClutterBinAlignment *y_align) | ||||||
|  | { | ||||||
|  |   ClutterBinLayoutPrivate *priv; | ||||||
|  |   ClutterLayoutManager *manager; | ||||||
|  |   ClutterLayoutMeta *meta; | ||||||
|  |   ClutterBinLayer *layer; | ||||||
|  |  | ||||||
|  |   g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self)); | ||||||
|  |  | ||||||
|  |   priv = self->priv; | ||||||
|  |  | ||||||
|  |   if (priv->container == NULL) | ||||||
|  |     { | ||||||
|  |       if (child == NULL) | ||||||
|  |         { | ||||||
|  |           if (x_align) | ||||||
|  |             *x_align = priv->x_align; | ||||||
|  |  | ||||||
|  |           if (y_align) | ||||||
|  |             *y_align = priv->y_align; | ||||||
|  |         } | ||||||
|  |       else | ||||||
|  |         g_warning ("The layout of type '%s' must be associated to " | ||||||
|  |                    "a ClutterContainer before getting the alignment " | ||||||
|  |                    "of its children", | ||||||
|  |                    G_OBJECT_TYPE_NAME (self)); | ||||||
|  |  | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   manager = CLUTTER_LAYOUT_MANAGER (self); | ||||||
|  |   meta = clutter_layout_manager_get_child_meta (manager, | ||||||
|  |                                                 priv->container, | ||||||
|  |                                                 child); | ||||||
|  |   g_assert (CLUTTER_IS_BIN_LAYER (meta)); | ||||||
|  |  | ||||||
|  |   layer = CLUTTER_BIN_LAYER (meta); | ||||||
|  |  | ||||||
|  |   if (x_align) | ||||||
|  |     *x_align = layer->x_align; | ||||||
|  |  | ||||||
|  |   if (y_align) | ||||||
|  |     *y_align = layer->y_align; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * clutter_bin_layout_add: | ||||||
|  |  * @self: a #ClutterBinLayout | ||||||
|  |  * @child: a #ClutterActor | ||||||
|  |  * @x_align: horizontal alignment policy for @child | ||||||
|  |  * @y_align: vertical alignment policy for @child | ||||||
|  |  * | ||||||
|  |  * Adds a #ClutterActor to the container using @self and | ||||||
|  |  * sets the alignment policies for it | ||||||
|  |  * | ||||||
|  |  * This function is equivalent to clutter_container_add_actor() | ||||||
|  |  * and clutter_layout_manager_child_set_property() but it does not | ||||||
|  |  * require a pointer to the #ClutterContainer associated to the | ||||||
|  |  * #ClutterBinLayout | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  |  * | ||||||
|  |  * Deprecated: 1.12: Use clutter_actor_add_child() instead. | ||||||
|  |  */ | ||||||
|  | void | ||||||
|  | clutter_bin_layout_add (ClutterBinLayout    *self, | ||||||
|  |                         ClutterActor        *child, | ||||||
|  |                         ClutterBinAlignment  x_align, | ||||||
|  |                         ClutterBinAlignment  y_align) | ||||||
|  | { | ||||||
|  |   ClutterBinLayoutPrivate *priv; | ||||||
|  |   ClutterLayoutManager *manager; | ||||||
|  |   ClutterLayoutMeta *meta; | ||||||
|  |  | ||||||
|  |   g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self)); | ||||||
|  |   g_return_if_fail (CLUTTER_IS_ACTOR (child)); | ||||||
|  |  | ||||||
|  |   priv = self->priv; | ||||||
|  |  | ||||||
|  |   if (priv->container == NULL) | ||||||
|  |     { | ||||||
|  |       g_warning ("The layout of type '%s' must be associated to " | ||||||
|  |                  "a ClutterContainer before adding children", | ||||||
|  |                  G_OBJECT_TYPE_NAME (self)); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   clutter_container_add_actor (priv->container, child); | ||||||
|  |  | ||||||
|  |   manager = CLUTTER_LAYOUT_MANAGER (self); | ||||||
|  |   meta = clutter_layout_manager_get_child_meta (manager, | ||||||
|  |                                                 priv->container, | ||||||
|  |                                                 child); | ||||||
|  |   g_assert (CLUTTER_IS_BIN_LAYER (meta)); | ||||||
|  |  | ||||||
|  |   set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align); | ||||||
|  |   set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align); | ||||||
|  | } | ||||||
|   | |||||||
| @@ -22,13 +22,14 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-layout-manager.h" | #include <clutter/clutter-layout-manager.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -43,6 +44,14 @@ typedef struct _ClutterBinLayout                ClutterBinLayout; | |||||||
| typedef struct _ClutterBinLayoutPrivate         ClutterBinLayoutPrivate; | typedef struct _ClutterBinLayoutPrivate         ClutterBinLayoutPrivate; | ||||||
| typedef struct _ClutterBinLayoutClass           ClutterBinLayoutClass; | 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 | struct _ClutterBinLayout | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -56,6 +65,8 @@ struct _ClutterBinLayout | |||||||
|  * |  * | ||||||
|  * The #ClutterBinLayoutClass structure contains only private |  * The #ClutterBinLayoutClass structure contains only private | ||||||
|  * data and should be accessed using the provided API |  * data and should be accessed using the provided API | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  */ |  */ | ||||||
| struct _ClutterBinLayoutClass | struct _ClutterBinLayoutClass | ||||||
| { | { | ||||||
| @@ -63,11 +74,13 @@ struct _ClutterBinLayoutClass | |||||||
|   ClutterLayoutManagerClass parent_class; |   ClutterLayoutManagerClass parent_class; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| GType clutter_bin_layout_get_type (void) G_GNUC_CONST; | GType clutter_bin_layout_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| ClutterLayoutManager *  clutter_bin_layout_new  (ClutterBinAlignment x_align, | ClutterLayoutManager *  clutter_bin_layout_new  (ClutterBinAlignment x_align, | ||||||
|                                                  ClutterBinAlignment y_align); |                                                  ClutterBinAlignment y_align); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BIN_LAYOUT_H__ */ | ||||||
|   | |||||||
| @@ -23,29 +23,27 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterBindConstraint: |  * SECTION:clutter-bind-constraint | ||||||
|  *  |  * @Title: ClutterBindConstraint | ||||||
|  * A constraint binding the position or size of an actor |  * @Short_Description: A constraint binding the position or size of an actor | ||||||
|  * |  * | ||||||
|  * #ClutterBindConstraint is a [class@Constraint] that binds the |  * #ClutterBindConstraint is a #ClutterConstraint that binds the | ||||||
|  * position or the size of the [class@Actor] to which it is applied |  * position or the size of the #ClutterActor to which it is applied | ||||||
|  * to the the position or the size of another [class@Actor], or |  * to the the position or the size of another #ClutterActor, or | ||||||
|  * "source". |  * "source". | ||||||
|  * |  * | ||||||
|  * An offset can be applied to the constraint, to avoid overlapping. The offset |  * 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 |  * can also be animated. For instance, the following code will set up three | ||||||
|  * actors to be bound to the same origin: |  * actors to be bound to the same origin: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[<!-- language="C" --> | ||||||
|  * // source |  * // source | ||||||
|  * rect[0] = clutter_actor_new (); |  * rect[0] = clutter_rectangle_new_with_color (&red_color); | ||||||
|  * clutter_actor_set_background_color (rect[0], &red_color); |  | ||||||
|  * clutter_actor_set_position (rect[0], x_pos, y_pos); |  * clutter_actor_set_position (rect[0], x_pos, y_pos); | ||||||
|  * clutter_actor_set_size (rect[0], 100, 100); |  * clutter_actor_set_size (rect[0], 100, 100); | ||||||
|  * |  * | ||||||
|  * // second rectangle |  * // second rectangle | ||||||
|  * rect[1] = clutter_actor_new (); |  * rect[1] = clutter_rectangle_new_with_color (&green_color); | ||||||
|  * clutter_actor_set_background_color (rect[1], &green_color); |  | ||||||
|  * clutter_actor_set_size (rect[1], 100, 100); |  * clutter_actor_set_size (rect[1], 100, 100); | ||||||
|  * clutter_actor_set_opacity (rect[1], 0); |  * clutter_actor_set_opacity (rect[1], 0); | ||||||
|  * |  * | ||||||
| @@ -55,8 +53,7 @@ | |||||||
|  * clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint); |  * clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint); | ||||||
|  * |  * | ||||||
|  * // third rectangle |  * // third rectangle | ||||||
|  * rect[2] = clutter_actor_new (); |  * rect[2] = clutter_rectangle_new_with_color (&blue_color); | ||||||
|  * clutter_actor_set_background_color (rect[2], &blue_color); |  | ||||||
|  * clutter_actor_set_size (rect[2], 100, 100); |  * clutter_actor_set_size (rect[2], 100, 100); | ||||||
|  * clutter_actor_set_opacity (rect[2], 0); |  * clutter_actor_set_opacity (rect[2], 0); | ||||||
|  * |  * | ||||||
| @@ -64,12 +61,12 @@ | |||||||
|  * clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint); |  * clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint); | ||||||
|  * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0); |  * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0); | ||||||
|  * clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint); |  * clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * The following code animates the second and third rectangles to "expand" |  * The following code animates the second and third rectangles to "expand" | ||||||
|  * them horizontally from underneath the first rectangle: |  * them horizontally from underneath the first rectangle: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[<!-- language="C" --> | ||||||
|  * clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250, |  * clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250, | ||||||
|  *                        "@constraints.green-x.offset", 100.0, |  *                        "@constraints.green-x.offset", 100.0, | ||||||
|  *                        "opacity", 255, |  *                        "opacity", 255, | ||||||
| @@ -78,21 +75,25 @@ | |||||||
|  *                        "@constraints.blue-x.offset", 200.0, |  *                        "@constraints.blue-x.offset", 200.0, | ||||||
|  *                        "opacity", 255, |  *                        "opacity", 255, | ||||||
|  *                        NULL); |  *                        NULL); | ||||||
|  * ``` |  * ]| | ||||||
|  |  * | ||||||
|  |  * #ClutterBindConstraint is available since Clutter 1.4 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| #include "clutter/clutter-bind-constraint.h" | #include "clutter-bind-constraint.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-meta-private.h" | #include "clutter-actor-meta-private.h" | ||||||
| #include "clutter/clutter-actor-private.h" | #include "clutter-actor-private.h" | ||||||
| #include "clutter/clutter-constraint.h" | #include "clutter-constraint.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-enum-types.h" | #include "clutter-enum-types.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| #define CLUTTER_BIND_CONSTRAINT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass)) | #define CLUTTER_BIND_CONSTRAINT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass)) | ||||||
| #define CLUTTER_IS_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIND_CONSTRAINT)) | #define CLUTTER_IS_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIND_CONSTRAINT)) | ||||||
| @@ -145,58 +146,6 @@ source_destroyed (ClutterActor          *actor, | |||||||
|   bind->source = NULL; |   bind->source = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| static void |  | ||||||
| clutter_bind_constraint_update_preferred_size (ClutterConstraint  *constraint, |  | ||||||
|                                                ClutterActor       *actor, |  | ||||||
|                                                ClutterOrientation  direction, |  | ||||||
|                                                float               for_size, |  | ||||||
|                                                float              *minimum_size, |  | ||||||
|                                                float              *natural_size) |  | ||||||
| { |  | ||||||
|   ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint); |  | ||||||
|   float source_min, source_nat; |  | ||||||
|  |  | ||||||
|   if (bind->source == NULL) |  | ||||||
|     return; |  | ||||||
|  |  | ||||||
|   /* only these bindings affect the preferred size */ |  | ||||||
|   if (!(bind->coordinate == CLUTTER_BIND_WIDTH || |  | ||||||
|         bind->coordinate == CLUTTER_BIND_HEIGHT || |  | ||||||
|         bind->coordinate == CLUTTER_BIND_SIZE || |  | ||||||
|         bind->coordinate == CLUTTER_BIND_ALL)) |  | ||||||
|     return; |  | ||||||
|  |  | ||||||
|   if (clutter_actor_contains (bind->source, actor)) |  | ||||||
|     return; |  | ||||||
|  |  | ||||||
|   switch (direction) |  | ||||||
|     { |  | ||||||
|     case CLUTTER_ORIENTATION_HORIZONTAL: |  | ||||||
|       if (bind->coordinate != CLUTTER_BIND_HEIGHT) |  | ||||||
|         { |  | ||||||
|           clutter_actor_get_preferred_width (bind->source, for_size, |  | ||||||
|                                              &source_min, |  | ||||||
|                                              &source_nat); |  | ||||||
|  |  | ||||||
|           *minimum_size = source_min; |  | ||||||
|           *natural_size = source_nat; |  | ||||||
|         } |  | ||||||
|       break; |  | ||||||
|  |  | ||||||
|     case CLUTTER_ORIENTATION_VERTICAL: |  | ||||||
|       if (bind->coordinate != CLUTTER_BIND_WIDTH) |  | ||||||
|         { |  | ||||||
|           clutter_actor_get_preferred_height (bind->source, for_size, |  | ||||||
|                                               &source_min, |  | ||||||
|                                               &source_nat); |  | ||||||
|  |  | ||||||
|           *minimum_size = source_min; |  | ||||||
|           *natural_size = source_nat; |  | ||||||
|         } |  | ||||||
|       break; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_bind_constraint_update_allocation (ClutterConstraint *constraint, | clutter_bind_constraint_update_allocation (ClutterConstraint *constraint, | ||||||
|                                            ClutterActor      *actor, |                                            ClutterActor      *actor, | ||||||
| @@ -205,9 +154,7 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint, | |||||||
|   ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint); |   ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint); | ||||||
|   gfloat source_width, source_height; |   gfloat source_width, source_height; | ||||||
|   gfloat actor_width, actor_height; |   gfloat actor_width, actor_height; | ||||||
|   graphene_point3d_t source_position; |   ClutterVertex source_position = { 0., }; | ||||||
|  |  | ||||||
|   source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f); |  | ||||||
|  |  | ||||||
|   if (bind->source == NULL) |   if (bind->source == NULL) | ||||||
|     return; |     return; | ||||||
| @@ -381,8 +328,6 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) | |||||||
|   meta_class->set_actor = clutter_bind_constraint_set_actor; |   meta_class->set_actor = clutter_bind_constraint_set_actor; | ||||||
|  |  | ||||||
|   constraint_class->update_allocation = clutter_bind_constraint_update_allocation; |   constraint_class->update_allocation = clutter_bind_constraint_update_allocation; | ||||||
|   constraint_class->update_preferred_size = clutter_bind_constraint_update_preferred_size; |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * ClutterBindConstraint:source: |    * ClutterBindConstraint:source: | ||||||
|    * |    * | ||||||
| @@ -390,9 +335,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) | |||||||
|    * |    * | ||||||
|    * The #ClutterActor must not be contained inside the actor associated |    * The #ClutterActor must not be contained inside the actor associated | ||||||
|    * to the constraint. |    * to the constraint. | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_SOURCE] = |   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_TYPE_ACTOR, | ||||||
|                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||||||
|  |  | ||||||
| @@ -400,9 +349,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) | |||||||
|    * ClutterBindConstraint:coordinate: |    * ClutterBindConstraint:coordinate: | ||||||
|    * |    * | ||||||
|    * The coordinate to be bound |    * The coordinate to be bound | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_COORDINATE] = |   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_TYPE_BIND_COORDINATE, | ||||||
|                        CLUTTER_BIND_X, |                        CLUTTER_BIND_X, | ||||||
|                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||||||
| @@ -411,9 +364,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) | |||||||
|    * ClutterBindConstraint:offset: |    * ClutterBindConstraint:offset: | ||||||
|    * |    * | ||||||
|    * The offset, in pixels, to be applied to the binding |    * The offset, in pixels, to be applied to the binding | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_OFFSET] = |   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, |                         -G_MAXFLOAT, G_MAXFLOAT, | ||||||
|                         0.0f, |                         0.0f, | ||||||
|                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); |                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); | ||||||
| @@ -443,6 +400,8 @@ clutter_bind_constraint_init (ClutterBindConstraint *self) | |||||||
|  * the given @coordinate of the position of @source |  * the given @coordinate of the position of @source | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #ClutterBindConstraint |  * Return value: the newly created #ClutterBindConstraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterConstraint * | ClutterConstraint * | ||||||
| clutter_bind_constraint_new (ClutterActor          *source, | clutter_bind_constraint_new (ClutterActor          *source, | ||||||
| @@ -464,6 +423,8 @@ clutter_bind_constraint_new (ClutterActor          *source, | |||||||
|  * @source: (allow-none): a #ClutterActor, or %NULL to unset the source |  * @source: (allow-none): a #ClutterActor, or %NULL to unset the source | ||||||
|  * |  * | ||||||
|  * Sets the source #ClutterActor for the constraint |  * Sets the source #ClutterActor for the constraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_bind_constraint_set_source (ClutterBindConstraint *constraint, | clutter_bind_constraint_set_source (ClutterBindConstraint *constraint, | ||||||
| @@ -529,6 +490,8 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint, | |||||||
|  * Retrieves the #ClutterActor set using clutter_bind_constraint_set_source() |  * Retrieves the #ClutterActor set using clutter_bind_constraint_set_source() | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): a pointer to the source actor |  * Return value: (transfer none): a pointer to the source actor | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_bind_constraint_get_source (ClutterBindConstraint *constraint) | clutter_bind_constraint_get_source (ClutterBindConstraint *constraint) | ||||||
| @@ -544,6 +507,8 @@ clutter_bind_constraint_get_source (ClutterBindConstraint *constraint) | |||||||
|  * @coordinate: the coordinate to bind |  * @coordinate: the coordinate to bind | ||||||
|  * |  * | ||||||
|  * Sets the coordinate to bind in the constraint |  * Sets the coordinate to bind in the constraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, | clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, | ||||||
| @@ -569,6 +534,8 @@ clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, | |||||||
|  * Retrieves the bound coordinate of the constraint |  * Retrieves the bound coordinate of the constraint | ||||||
|  * |  * | ||||||
|  * Return value: the bound coordinate |  * Return value: the bound coordinate | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterBindCoordinate | ClutterBindCoordinate | ||||||
| clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint) | clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint) | ||||||
| @@ -585,6 +552,8 @@ clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint) | |||||||
|  * @offset: the offset to apply, in pixels |  * @offset: the offset to apply, in pixels | ||||||
|  * |  * | ||||||
|  * Sets the offset to be applied to the constraint |  * Sets the offset to be applied to the constraint | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint, | clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint, | ||||||
| @@ -610,6 +579,8 @@ clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint, | |||||||
|  * Retrieves the offset set using clutter_bind_constraint_set_offset() |  * Retrieves the offset set using clutter_bind_constraint_set_offset() | ||||||
|  * |  * | ||||||
|  * Return value: the offset, in pixels |  * Return value: the offset, in pixels | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| gfloat | gfloat | ||||||
| clutter_bind_constraint_get_offset (ClutterBindConstraint *bind) | clutter_bind_constraint_get_offset (ClutterBindConstraint *bind) | ||||||
|   | |||||||
| @@ -22,13 +22,14 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-constraint.h" | #include <clutter/clutter-constraint.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -36,31 +37,41 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_BIND_CONSTRAINT(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraint)) | #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)) | #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 _ClutterBindConstraint           ClutterBindConstraint; | ||||||
| typedef struct _ClutterBindConstraintClass      ClutterBindConstraintClass; | typedef struct _ClutterBindConstraintClass      ClutterBindConstraintClass; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType clutter_bind_constraint_get_type (void) G_GNUC_CONST; | GType clutter_bind_constraint_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterConstraint *   clutter_bind_constraint_new            (ClutterActor          *source, | ClutterConstraint *   clutter_bind_constraint_new            (ClutterActor          *source, | ||||||
|                                                               ClutterBindCoordinate  coordinate, |                                                               ClutterBindCoordinate  coordinate, | ||||||
|                                                               gfloat                 offset); |                                                               gfloat                 offset); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void                  clutter_bind_constraint_set_source     (ClutterBindConstraint *constraint, | void                  clutter_bind_constraint_set_source     (ClutterBindConstraint *constraint, | ||||||
|                                                               ClutterActor          *source); |                                                               ClutterActor          *source); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterActor *        clutter_bind_constraint_get_source     (ClutterBindConstraint *constraint); | ClutterActor *        clutter_bind_constraint_get_source     (ClutterBindConstraint *constraint); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void                  clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, | void                  clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, | ||||||
|                                                               ClutterBindCoordinate  coordinate); |                                                               ClutterBindCoordinate  coordinate); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterBindCoordinate clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint); | ClutterBindCoordinate clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void                  clutter_bind_constraint_set_offset     (ClutterBindConstraint *constraint, | void                  clutter_bind_constraint_set_offset     (ClutterBindConstraint *constraint, | ||||||
|                                                               gfloat                 offset); |                                                               gfloat                 offset); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| gfloat                clutter_bind_constraint_get_offset     (ClutterBindConstraint *constraint); | gfloat                clutter_bind_constraint_get_offset     (ClutterBindConstraint *constraint); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BIND_CONSTRAINT_H__ */ | ||||||
|   | |||||||
| @@ -22,9 +22,8 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterBindingPool |  * SECTION:clutter-binding-pool | ||||||
|  *  |  * @short_description: Pool for key bindings | ||||||
|  * Pool for key bindings |  | ||||||
|  * |  * | ||||||
|  * #ClutterBindingPool is a data structure holding a set of key bindings. |  * #ClutterBindingPool is a data structure holding a set of key bindings. | ||||||
|  * Each key binding associates a key symbol (eventually with modifiers) |  * Each key binding associates a key symbol (eventually with modifiers) | ||||||
| @@ -39,7 +38,7 @@ | |||||||
|  * inside their class initialization function and then install actions |  * inside their class initialization function and then install actions | ||||||
|  * like this: |  * like this: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[<!-- language="C" --> | ||||||
|  * static void |  * static void | ||||||
|  * foo_class_init (FooClass *klass) |  * foo_class_init (FooClass *klass) | ||||||
|  * { |  * { | ||||||
| @@ -56,23 +55,23 @@ | |||||||
|  *                                        G_CALLBACK (foo_action_move_up), |  *                                        G_CALLBACK (foo_action_move_up), | ||||||
|  *                                        NULL, NULL); |  *                                        NULL, NULL); | ||||||
|  * } |  * } | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * The callback has a signature of: |  * The callback has a signature of: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[<!-- language="C" --> | ||||||
|  *    gboolean (* callback) (GObject             *instance, |  *    gboolean (* callback) (GObject             *instance, | ||||||
|  *                           const gchar         *action_name, |  *                           const gchar         *action_name, | ||||||
|  *                           guint                key_val, |  *                           guint                key_val, | ||||||
|  *                           ClutterModifierType  modifiers, |  *                           ClutterModifierType  modifiers, | ||||||
|  *                           gpointer             user_data); |  *                           gpointer             user_data); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * The actor should then override the [signal@Actor::key-press-event] and |  * The actor should then override the #ClutterActor::key-press-event and | ||||||
|  * use [method@BindingPool.activate] to match a [struct@Event] key event |  * use clutter_binding_pool_activate() to match a #ClutterKeyEvent structure | ||||||
|  * structure to one of the actions: |  * to one of the actions: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[<!-- language="C" --> | ||||||
|  *   ClutterBindingPool *pool; |  *   ClutterBindingPool *pool; | ||||||
|  * |  * | ||||||
|  *   // retrieve the binding pool for the type of the actor |  *   // retrieve the binding pool for the type of the actor | ||||||
| @@ -85,21 +84,25 @@ | |||||||
|  *                                         key_event->keyval, |  *                                         key_event->keyval, | ||||||
|  *                                         key_event->modifier_state, |  *                                         key_event->modifier_state, | ||||||
|  *                                         G_OBJECT (actor)); |  *                                         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 |  * 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. |  * key binding handler returned %FALSE. | ||||||
|  |  * | ||||||
|  |  * #ClutterBindingPool is available since Clutter 1.0 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-binding-pool.h" | #include "clutter-binding-pool.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-enum-types.h" | #include "clutter-enum-types.h" | ||||||
| #include "clutter/clutter-marshal.h" | #include "clutter-marshal.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| #define CLUTTER_BINDING_POOL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass)) | #define CLUTTER_BINDING_POOL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass)) | ||||||
| #define CLUTTER_IS_BINDING_POOL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_BINDING_POOL)) | #define CLUTTER_IS_BINDING_POOL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_BINDING_POOL)) | ||||||
| @@ -188,7 +191,7 @@ binding_entry_new (const gchar         *name, | |||||||
|  |  | ||||||
|   modifiers = modifiers & BINDING_MOD_MASK; |   modifiers = modifiers & BINDING_MOD_MASK; | ||||||
|  |  | ||||||
|   entry = g_new0 (ClutterBindingEntry, 1); |   entry = g_slice_new (ClutterBindingEntry); | ||||||
|   entry->key_val = key_val; |   entry->key_val = key_val; | ||||||
|   entry->modifiers = modifiers; |   entry->modifiers = modifiers; | ||||||
|   entry->name = (gchar *) g_intern_string (name); |   entry->name = (gchar *) g_intern_string (name); | ||||||
| @@ -220,7 +223,7 @@ binding_entry_free (gpointer data) | |||||||
|  |  | ||||||
|       g_closure_unref (entry->closure); |       g_closure_unref (entry->closure); | ||||||
|  |  | ||||||
|       g_free (entry); |       g_slice_free (ClutterBindingEntry, entry); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -234,7 +237,8 @@ clutter_binding_pool_finalize (GObject *gobject) | |||||||
|  |  | ||||||
|   g_hash_table_destroy (pool->entries_hash); |   g_hash_table_destroy (pool->entries_hash); | ||||||
|  |  | ||||||
|   g_slist_free_full (pool->entries, (GDestroyNotify) binding_entry_free); |   g_slist_foreach (pool->entries, (GFunc) binding_entry_free, NULL); | ||||||
|  |   g_slist_free (pool->entries); | ||||||
|  |  | ||||||
|   G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject); |   G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject); | ||||||
| } | } | ||||||
| @@ -306,9 +310,13 @@ clutter_binding_pool_class_init (ClutterBindingPoolClass *klass) | |||||||
|    * ClutterBindingPool:name: |    * ClutterBindingPool:name: | ||||||
|    * |    * | ||||||
|    * The unique name of the #ClutterBindingPool. |    * The unique name of the #ClutterBindingPool. | ||||||
|  |    * | ||||||
|  |    * Since: 1.0 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_NAME] = |   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, |                          NULL, | ||||||
|                          CLUTTER_PARAM_READWRITE | |                          CLUTTER_PARAM_READWRITE | | ||||||
|                          G_PARAM_CONSTRUCT_ONLY); |                          G_PARAM_CONSTRUCT_ONLY); | ||||||
| @@ -340,6 +348,8 @@ clutter_binding_pool_init (ClutterBindingPool *pool) | |||||||
|  * |  * | ||||||
|  * Return value: the newly created binding pool with the given |  * Return value: the newly created binding pool with the given | ||||||
|  *   name. Use g_object_unref() when done. |  *   name. Use g_object_unref() when done. | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| ClutterBindingPool * | ClutterBindingPool * | ||||||
| clutter_binding_pool_new (const gchar *name) | clutter_binding_pool_new (const gchar *name) | ||||||
| @@ -375,13 +385,15 @@ clutter_binding_pool_new (const gchar *name) | |||||||
|  * A binding pool for a class can also be retrieved using |  * A binding pool for a class can also be retrieved using | ||||||
|  * clutter_binding_pool_find() with the class type name: |  * clutter_binding_pool_find() with the class type name: | ||||||
|  * |  * | ||||||
|  * ``` |  * |[ | ||||||
|  *   pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance)); |  *   pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance)); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): the binding pool for the given class. |  * Return value: (transfer none): the binding pool for the given class. | ||||||
|  *   The returned #ClutterBindingPool is owned by Clutter and should not |  *   The returned #ClutterBindingPool is owned by Clutter and should not | ||||||
|  *   be freed directly |  *   be freed directly | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| ClutterBindingPool * | ClutterBindingPool * | ||||||
| clutter_binding_pool_get_for_class (gpointer klass) | clutter_binding_pool_get_for_class (gpointer klass) | ||||||
| @@ -412,6 +424,8 @@ clutter_binding_pool_get_for_class (gpointer klass) | |||||||
|  * Finds the #ClutterBindingPool with @name. |  * Finds the #ClutterBindingPool with @name. | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): a pointer to the #ClutterBindingPool, or %NULL |  * Return value: (transfer none): a pointer to the #ClutterBindingPool, or %NULL | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| ClutterBindingPool * | ClutterBindingPool * | ||||||
| clutter_binding_pool_find (const gchar *name) | clutter_binding_pool_find (const gchar *name) | ||||||
| @@ -454,6 +468,8 @@ clutter_binding_pool_find (const gchar *name) | |||||||
|  * |  * | ||||||
|  * Actions can be blocked with clutter_binding_pool_block_action() |  * Actions can be blocked with clutter_binding_pool_block_action() | ||||||
|  * and then unblocked using clutter_binding_pool_unblock_action(). |  * and then unblocked using clutter_binding_pool_unblock_action(). | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_install_action (ClutterBindingPool  *pool, | clutter_binding_pool_install_action (ClutterBindingPool  *pool, | ||||||
| @@ -522,6 +538,8 @@ clutter_binding_pool_install_action (ClutterBindingPool  *pool, | |||||||
|  * |  * | ||||||
|  * Actions can be blocked with clutter_binding_pool_block_action() |  * Actions can be blocked with clutter_binding_pool_block_action() | ||||||
|  * and then unblocked using clutter_binding_pool_unblock_action(). |  * and then unblocked using clutter_binding_pool_unblock_action(). | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_install_closure (ClutterBindingPool  *pool, | clutter_binding_pool_install_closure (ClutterBindingPool  *pool, | ||||||
| @@ -583,6 +601,8 @@ clutter_binding_pool_install_closure (ClutterBindingPool  *pool, | |||||||
|  * |  * | ||||||
|  * Actions can be blocked with clutter_binding_pool_block_action() |  * Actions can be blocked with clutter_binding_pool_block_action() | ||||||
|  * and then unblocked using clutter_binding_pool_unblock_action(). |  * and then unblocked using clutter_binding_pool_unblock_action(). | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_override_action (ClutterBindingPool  *pool, | clutter_binding_pool_override_action (ClutterBindingPool  *pool, | ||||||
| @@ -645,6 +665,8 @@ clutter_binding_pool_override_action (ClutterBindingPool  *pool, | |||||||
|  * |  * | ||||||
|  * Actions can be blocked with clutter_binding_pool_block_action() |  * Actions can be blocked with clutter_binding_pool_block_action() | ||||||
|  * and then unblocked using clutter_binding_pool_unblock_action(). |  * and then unblocked using clutter_binding_pool_unblock_action(). | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_override_closure (ClutterBindingPool  *pool, | clutter_binding_pool_override_closure (ClutterBindingPool  *pool, | ||||||
| @@ -698,6 +720,8 @@ clutter_binding_pool_override_closure (ClutterBindingPool  *pool, | |||||||
|  * Return value: the name of the action, if found, or %NULL. The |  * Return value: the name of the action, if found, or %NULL. The | ||||||
|  *   returned string is owned by the binding pool and should never |  *   returned string is owned by the binding pool and should never | ||||||
|  *   be modified or freed |  *   be modified or freed | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| const gchar * | const gchar * | ||||||
| clutter_binding_pool_find_action (ClutterBindingPool  *pool, | clutter_binding_pool_find_action (ClutterBindingPool  *pool, | ||||||
| @@ -724,6 +748,8 @@ clutter_binding_pool_find_action (ClutterBindingPool  *pool, | |||||||
|  * |  * | ||||||
|  * Removes the action matching the given @key_val, @modifiers pair, |  * Removes the action matching the given @key_val, @modifiers pair, | ||||||
|  * if any exists. |  * if any exists. | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_remove_action (ClutterBindingPool  *pool, | clutter_binding_pool_remove_action (ClutterBindingPool  *pool, | ||||||
| @@ -809,13 +835,13 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry, | |||||||
|  * |  * | ||||||
|  * The callback has the following signature: |  * The callback has the following signature: | ||||||
|  * |  * | ||||||
|  * ``` |  * |[ | ||||||
|  *   void (* callback) (GObject             *gobject, |  *   void (* callback) (GObject             *gobject, | ||||||
|  *                      const gchar         *action_name, |  *                      const gchar         *action_name, | ||||||
|  *                      guint                key_val, |  *                      guint                key_val, | ||||||
|  *                      ClutterModifierType  modifiers, |  *                      ClutterModifierType  modifiers, | ||||||
|  *                      gpointer             user_data); |  *                      gpointer             user_data); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * Where the #GObject instance is @gobject and the user data |  * Where the #GObject instance is @gobject and the user data | ||||||
|  * is the one passed when installing the action with |  * is the one passed when installing the action with | ||||||
| @@ -826,6 +852,8 @@ clutter_binding_entry_invoke (ClutterBindingEntry *entry, | |||||||
|  * will not be invoked, and this function will return %FALSE. |  * will not be invoked, and this function will return %FALSE. | ||||||
|  * |  * | ||||||
|  * Return value: %TRUE if an action was found and was activated |  * Return value: %TRUE if an action was found and was activated | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_binding_pool_activate (ClutterBindingPool  *pool, | clutter_binding_pool_activate (ClutterBindingPool  *pool, | ||||||
| @@ -857,6 +885,8 @@ clutter_binding_pool_activate (ClutterBindingPool  *pool, | |||||||
|  * @action_name: an action name |  * @action_name: an action name | ||||||
|  * |  * | ||||||
|  * Blocks all the actions with name @action_name inside @pool. |  * Blocks all the actions with name @action_name inside @pool. | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_block_action (ClutterBindingPool *pool, | clutter_binding_pool_block_action (ClutterBindingPool *pool, | ||||||
| @@ -886,6 +916,8 @@ clutter_binding_pool_block_action (ClutterBindingPool *pool, | |||||||
|  * Unblocking an action does not cause the callback bound to it to |  * Unblocking an action does not cause the callback bound to it to | ||||||
|  * be invoked in case clutter_binding_pool_activate() was called on |  * be invoked in case clutter_binding_pool_activate() was called on | ||||||
|  * an action previously blocked with clutter_binding_pool_block_action(). |  * an action previously blocked with clutter_binding_pool_block_action(). | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_binding_pool_unblock_action (ClutterBindingPool *pool, | clutter_binding_pool_unblock_action (ClutterBindingPool *pool, | ||||||
|   | |||||||
| @@ -21,15 +21,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <glib-object.h> | #include <glib-object.h> | ||||||
|  | #include <clutter/clutter-event.h> | ||||||
| #include "clutter/clutter-event.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | 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_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)) | #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 _ClutterBindingPool      ClutterBindingPool; | ||||||
| typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass; | typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass; | ||||||
|  |  | ||||||
| @@ -54,6 +62,8 @@ typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass; | |||||||
|  * |  * | ||||||
|  * Return value: the function should return %TRUE if the key |  * Return value: the function should return %TRUE if the key | ||||||
|  *   binding has been handled, and return %FALSE otherwise |  *   binding has been handled, and return %FALSE otherwise | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| typedef gboolean (* ClutterBindingActionFunc) (GObject             *gobject, | typedef gboolean (* ClutterBindingActionFunc) (GObject             *gobject, | ||||||
|                                                const gchar         *action_name, |                                                const gchar         *action_name, | ||||||
| @@ -61,17 +71,17 @@ typedef gboolean (* ClutterBindingActionFunc) (GObject             *gobject, | |||||||
|                                                ClutterModifierType  modifiers, |                                                ClutterModifierType  modifiers, | ||||||
|                                                gpointer             user_data); |                                                gpointer             user_data); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| GType clutter_binding_pool_get_type (void) G_GNUC_CONST; | GType clutter_binding_pool_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| ClutterBindingPool *  clutter_binding_pool_new              (const gchar         *name); | ClutterBindingPool *  clutter_binding_pool_new              (const gchar         *name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| ClutterBindingPool *  clutter_binding_pool_get_for_class    (gpointer             klass); | ClutterBindingPool *  clutter_binding_pool_get_for_class    (gpointer             klass); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| ClutterBindingPool *  clutter_binding_pool_find             (const gchar         *name); | ClutterBindingPool *  clutter_binding_pool_find             (const gchar         *name); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_install_action   (ClutterBindingPool  *pool, | void                  clutter_binding_pool_install_action   (ClutterBindingPool  *pool, | ||||||
|                                                              const gchar         *action_name, |                                                              const gchar         *action_name, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
| @@ -79,45 +89,47 @@ void                  clutter_binding_pool_install_action   (ClutterBindingPool | |||||||
|                                                              GCallback            callback, |                                                              GCallback            callback, | ||||||
|                                                              gpointer             data, |                                                              gpointer             data, | ||||||
|                                                              GDestroyNotify       notify); |                                                              GDestroyNotify       notify); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_install_closure  (ClutterBindingPool  *pool, | void                  clutter_binding_pool_install_closure  (ClutterBindingPool  *pool, | ||||||
|                                                              const gchar         *action_name, |                                                              const gchar         *action_name, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers, |                                                              ClutterModifierType  modifiers, | ||||||
|                                                              GClosure            *closure); |                                                              GClosure            *closure); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_override_action  (ClutterBindingPool  *pool, | void                  clutter_binding_pool_override_action  (ClutterBindingPool  *pool, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers, |                                                              ClutterModifierType  modifiers, | ||||||
|                                                              GCallback            callback, |                                                              GCallback            callback, | ||||||
|                                                              gpointer             data, |                                                              gpointer             data, | ||||||
|                                                              GDestroyNotify       notify); |                                                              GDestroyNotify       notify); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_override_closure (ClutterBindingPool  *pool, | void                  clutter_binding_pool_override_closure (ClutterBindingPool  *pool, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers, |                                                              ClutterModifierType  modifiers, | ||||||
|                                                              GClosure            *closure); |                                                              GClosure            *closure); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| const gchar *         clutter_binding_pool_find_action      (ClutterBindingPool  *pool, | const gchar *         clutter_binding_pool_find_action      (ClutterBindingPool  *pool, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers); |                                                              ClutterModifierType  modifiers); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_remove_action    (ClutterBindingPool  *pool, | void                  clutter_binding_pool_remove_action    (ClutterBindingPool  *pool, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers); |                                                              ClutterModifierType  modifiers); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| gboolean              clutter_binding_pool_activate         (ClutterBindingPool  *pool, | gboolean              clutter_binding_pool_activate         (ClutterBindingPool  *pool, | ||||||
|                                                              guint                key_val, |                                                              guint                key_val, | ||||||
|                                                              ClutterModifierType  modifiers, |                                                              ClutterModifierType  modifiers, | ||||||
|                                                              GObject             *gobject); |                                                              GObject             *gobject); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_block_action     (ClutterBindingPool  *pool, | void                  clutter_binding_pool_block_action     (ClutterBindingPool  *pool, | ||||||
|                                                              const gchar         *action_name); |                                                              const gchar         *action_name); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void                  clutter_binding_pool_unblock_action   (ClutterBindingPool  *pool, | void                  clutter_binding_pool_unblock_action   (ClutterBindingPool  *pool, | ||||||
|                                                              const gchar         *action_name); |                                                              const gchar         *action_name); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BINDING_POOL_H__ */ | ||||||
|   | |||||||
| @@ -23,27 +23,33 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterBlurEffect: |  * SECTION:clutter-blur-effect | ||||||
|  *  |  * @short_description: A blur effect | ||||||
|  * A blur effect |  * @see_also: #ClutterEffect, #ClutterOffscreenEffect | ||||||
|  * |  * | ||||||
|  * #ClutterBlurEffect is a sub-class of #ClutterEffect that allows blurring a |  * #ClutterBlurEffect is a sub-class of #ClutterEffect that allows blurring a | ||||||
|  * actor and its contents. |  * 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_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_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)) | #define CLUTTER_BLUR_EFFECT_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass)) | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-blur-effect.h" | #define CLUTTER_ENABLE_EXPERIMENTAL_API | ||||||
|  |  | ||||||
|  | #include "clutter-blur-effect.h" | ||||||
|  |  | ||||||
| #include "cogl/cogl.h" | #include "cogl/cogl.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-offscreen-effect.h" | #include "clutter-offscreen-effect.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| #define BLUR_PADDING    2 | #define BLUR_PADDING    2 | ||||||
|  |  | ||||||
| @@ -77,6 +83,9 @@ struct _ClutterBlurEffect | |||||||
|  |  | ||||||
|   gint pixel_step_uniform; |   gint pixel_step_uniform; | ||||||
|  |  | ||||||
|  |   gint tex_width; | ||||||
|  |   gint tex_height; | ||||||
|  |  | ||||||
|   CoglPipeline *pipeline; |   CoglPipeline *pipeline; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -91,41 +100,90 @@ G_DEFINE_TYPE (ClutterBlurEffect, | |||||||
|                clutter_blur_effect, |                clutter_blur_effect, | ||||||
|                CLUTTER_TYPE_OFFSCREEN_EFFECT); |                CLUTTER_TYPE_OFFSCREEN_EFFECT); | ||||||
|  |  | ||||||
| static CoglPipeline * | static gboolean | ||||||
| clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect, | clutter_blur_effect_pre_paint (ClutterEffect *effect) | ||||||
|                                      CoglTexture            *texture) |  | ||||||
| { | { | ||||||
|   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]; |       /* if we don't have support for GLSL shaders then we | ||||||
|       int tex_width, tex_height; |        * forcibly disable the ActorMeta | ||||||
|  |        */ | ||||||
|       tex_width = cogl_texture_get_width (texture); |       g_warning ("Unable to use the ShaderEffect: the graphics hardware " | ||||||
|       tex_height = cogl_texture_get_height (texture); |                  "or the current GL driver does not implement support " | ||||||
|  |                  "for the GLSL shading language."); | ||||||
|       pixel_step[0] = 1.0f / tex_width; |       clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE); | ||||||
|       pixel_step[1] = 1.0f / tex_height; |       return FALSE; | ||||||
|  |  | ||||||
|       cogl_pipeline_set_uniform_float (blur_effect->pipeline, |  | ||||||
|                                        blur_effect->pixel_step_uniform, |  | ||||||
|                                        2, /* n_components */ |  | ||||||
|                                        1, /* count */ |  | ||||||
|                                        pixel_step); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   cogl_pipeline_set_layer_texture (blur_effect->pipeline, 0, texture); |   parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class); | ||||||
|  |   if (parent_class->pre_paint (effect)) | ||||||
|  |     { | ||||||
|  |       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) | ||||||
|  | { | ||||||
|  |   ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect); | ||||||
|  |   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_push_source (self->pipeline); | ||||||
|  |  | ||||||
|  |   cogl_rectangle (0, 0, self->tex_width, self->tex_height); | ||||||
|  |  | ||||||
|  |   cogl_pop_source (); | ||||||
| } | } | ||||||
|  |  | ||||||
| static gboolean | static gboolean | ||||||
| clutter_blur_effect_modify_paint_volume (ClutterEffect      *effect, | clutter_blur_effect_get_paint_volume (ClutterEffect      *effect, | ||||||
|                                          ClutterPaintVolume *volume) |                                       ClutterPaintVolume *volume) | ||||||
| { | { | ||||||
|   gfloat cur_width, cur_height; |   gfloat cur_width, cur_height; | ||||||
|   graphene_point3d_t origin; |   ClutterVertex origin; | ||||||
|  |  | ||||||
|   clutter_paint_volume_get_origin (volume, &origin); |   clutter_paint_volume_get_origin (volume, &origin); | ||||||
|   cur_width = clutter_paint_volume_get_width (volume); |   cur_width = clutter_paint_volume_get_width (volume); | ||||||
| @@ -165,10 +223,11 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass) | |||||||
|  |  | ||||||
|   gobject_class->dispose = clutter_blur_effect_dispose; |   gobject_class->dispose = clutter_blur_effect_dispose; | ||||||
|  |  | ||||||
|   effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume; |   effect_class->pre_paint = clutter_blur_effect_pre_paint; | ||||||
|  |   effect_class->get_paint_volume = clutter_blur_effect_get_paint_volume; | ||||||
|  |  | ||||||
|   offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); |   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 | static void | ||||||
| @@ -191,7 +250,9 @@ clutter_blur_effect_init (ClutterBlurEffect *self) | |||||||
|       cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet); |       cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet); | ||||||
|       cogl_object_unref (snippet); |       cogl_object_unref (snippet); | ||||||
|  |  | ||||||
|       cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); |       cogl_pipeline_set_layer_null_texture (klass->base_pipeline, | ||||||
|  |                                             0, /* layer number */ | ||||||
|  |                                             COGL_TEXTURE_TYPE_2D); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   self->pipeline = cogl_pipeline_copy (klass->base_pipeline); |   self->pipeline = cogl_pipeline_copy (klass->base_pipeline); | ||||||
| @@ -207,6 +268,8 @@ clutter_blur_effect_init (ClutterBlurEffect *self) | |||||||
|  * clutter_actor_add_effect() |  * clutter_actor_add_effect() | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #ClutterBlurEffect or %NULL |  * Return value: the newly created #ClutterBlurEffect or %NULL | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterEffect * | ClutterEffect * | ||||||
| clutter_blur_effect_new (void) | clutter_blur_effect_new (void) | ||||||
|   | |||||||
| @@ -22,13 +22,14 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-effect.h" | #include <clutter/clutter-effect.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -36,13 +37,23 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_BLUR_EFFECT(obj)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffect)) | #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)) | #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 _ClutterBlurEffect       ClutterBlurEffect; | ||||||
| typedef struct _ClutterBlurEffectClass  ClutterBlurEffectClass; | typedef struct _ClutterBlurEffectClass  ClutterBlurEffectClass; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| GType clutter_blur_effect_get_type (void) G_GNUC_CONST; | GType clutter_blur_effect_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterEffect *clutter_blur_effect_new (void); | ClutterEffect *clutter_blur_effect_new (void); | ||||||
|  |  | ||||||
| G_END_DECLS | 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); |  | ||||||
| } |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -25,13 +25,14 @@ | |||||||
|  *   Thomas Wood <thomas.wood@intel.com> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-layout-manager.h" | #include <clutter/clutter-layout-manager.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -46,6 +47,14 @@ typedef struct _ClutterBoxLayout                ClutterBoxLayout; | |||||||
| typedef struct _ClutterBoxLayoutPrivate         ClutterBoxLayoutPrivate; | typedef struct _ClutterBoxLayoutPrivate         ClutterBoxLayoutPrivate; | ||||||
| typedef struct _ClutterBoxLayoutClass           ClutterBoxLayoutClass; | 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 | struct _ClutterBoxLayout | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -59,6 +68,8 @@ struct _ClutterBoxLayout | |||||||
|  * |  * | ||||||
|  * The #ClutterBoxLayoutClass structure contains only private |  * The #ClutterBoxLayoutClass structure contains only private | ||||||
|  * data and should be accessed using the provided API |  * data and should be accessed using the provided API | ||||||
|  |  * | ||||||
|  |  * Since: 1.2 | ||||||
|  */ |  */ | ||||||
| struct _ClutterBoxLayoutClass | struct _ClutterBoxLayoutClass | ||||||
| { | { | ||||||
| @@ -66,27 +77,92 @@ struct _ClutterBoxLayoutClass | |||||||
|   ClutterLayoutManagerClass parent_class; |   ClutterLayoutManagerClass parent_class; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| GType clutter_box_layout_get_type (void) G_GNUC_CONST; | GType clutter_box_layout_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| ClutterLayoutManager *  clutter_box_layout_new                 (void); | ClutterLayoutManager *  clutter_box_layout_new                 (void); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_12 | ||||||
| void                    clutter_box_layout_set_orientation      (ClutterBoxLayout    *layout, | void                    clutter_box_layout_set_orientation      (ClutterBoxLayout    *layout, | ||||||
|                                                                  ClutterOrientation   orientation); |                                                                  ClutterOrientation   orientation); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_12 | ||||||
| ClutterOrientation      clutter_box_layout_get_orientation      (ClutterBoxLayout    *layout); | ClutterOrientation      clutter_box_layout_get_orientation      (ClutterBoxLayout    *layout); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| void                    clutter_box_layout_set_spacing          (ClutterBoxLayout    *layout, | void                    clutter_box_layout_set_spacing          (ClutterBoxLayout    *layout, | ||||||
|                                                                  guint                spacing); |                                                                  guint                spacing); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| guint                   clutter_box_layout_get_spacing          (ClutterBoxLayout    *layout); | guint                   clutter_box_layout_get_spacing          (ClutterBoxLayout    *layout); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| void                    clutter_box_layout_set_homogeneous      (ClutterBoxLayout    *layout, | void                    clutter_box_layout_set_homogeneous      (ClutterBoxLayout    *layout, | ||||||
|                                                                  gboolean             homogeneous); |                                                                  gboolean             homogeneous); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_2 | ||||||
| gboolean                clutter_box_layout_get_homogeneous      (ClutterBoxLayout    *layout); | gboolean                clutter_box_layout_get_homogeneous      (ClutterBoxLayout    *layout); | ||||||
|  | CLUTTER_AVAILABLE_IN_1_2 | ||||||
|  | void                    clutter_box_layout_set_pack_start       (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  gboolean             pack_start); | ||||||
|  | CLUTTER_AVAILABLE_IN_1_2 | ||||||
|  | gboolean                clutter_box_layout_get_pack_start       (ClutterBoxLayout    *layout); | ||||||
|  |  | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_box_layout_set_orientation) | ||||||
|  | void                    clutter_box_layout_set_vertical         (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  gboolean             vertical); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12_FOR(clutter_box_layout_get_orientation) | ||||||
|  | gboolean                clutter_box_layout_get_vertical         (ClutterBoxLayout    *layout); | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_2 | ||||||
|  | void                    clutter_box_layout_pack                 (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  gboolean             expand, | ||||||
|  |                                                                  gboolean             x_fill, | ||||||
|  |                                                                  gboolean             y_fill, | ||||||
|  |                                                                  ClutterBoxAlignment  x_align, | ||||||
|  |                                                                  ClutterBoxAlignment  y_align); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_alignment        (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  ClutterBoxAlignment  x_align, | ||||||
|  |                                                                  ClutterBoxAlignment  y_align); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_get_alignment        (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  ClutterBoxAlignment *x_align, | ||||||
|  |                                                                  ClutterBoxAlignment *y_align); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_fill             (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  gboolean             x_fill, | ||||||
|  |                                                                  gboolean             y_fill); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_get_fill             (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  gboolean            *x_fill, | ||||||
|  |                                                                  gboolean            *y_fill); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_expand           (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor, | ||||||
|  |                                                                  gboolean             expand); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | gboolean                clutter_box_layout_get_expand           (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  ClutterActor        *actor); | ||||||
|  |  | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_use_animations   (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  gboolean             animate); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | gboolean                clutter_box_layout_get_use_animations   (ClutterBoxLayout    *layout); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_easing_mode      (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  gulong               mode); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | gulong                  clutter_box_layout_get_easing_mode      (ClutterBoxLayout    *layout); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | void                    clutter_box_layout_set_easing_duration  (ClutterBoxLayout    *layout, | ||||||
|  |                                                                  guint                msecs); | ||||||
|  | CLUTTER_DEPRECATED_IN_1_12 | ||||||
|  | guint                   clutter_box_layout_get_easing_duration  (ClutterBoxLayout    *layout); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BOX_LAYOUT_H__ */ | ||||||
|   | |||||||
| @@ -23,29 +23,36 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterBrightnessContrastEffect: |  * SECTION:clutter-brightness-contrast-effect | ||||||
|  *  |  * @short_description: Increase/decrease brightness and/or contrast of actor. | ||||||
|  * Increase/decrease brightness and/or contrast of actor. |  * @see_also: #ClutterEffect, #ClutterOffscreenEffect | ||||||
|  * |  * | ||||||
|  * #ClutterBrightnessContrastEffect is a sub-class of #ClutterEffect that |  * #ClutterBrightnessContrastEffect is a sub-class of #ClutterEffect that | ||||||
|  * changes the overall brightness of a #ClutterActor. |  * 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_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_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)) | #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" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <math.h> | ||||||
|  |  | ||||||
| #include "cogl/cogl.h" | #define CLUTTER_ENABLE_EXPERIMENTAL_API | ||||||
|  |  | ||||||
| #include "clutter/clutter-brightness-contrast-effect.h" | #include "clutter-brightness-contrast-effect.h" | ||||||
| #include "clutter/clutter-debug.h" |  | ||||||
| #include "clutter/clutter-enum-types.h" | #include <cogl/cogl.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 _ClutterBrightnessContrastEffect | struct _ClutterBrightnessContrastEffect | ||||||
| { | { | ||||||
| @@ -64,6 +71,9 @@ struct _ClutterBrightnessContrastEffect | |||||||
|   gint brightness_offset_uniform; |   gint brightness_offset_uniform; | ||||||
|   gint contrast_uniform; |   gint contrast_uniform; | ||||||
|  |  | ||||||
|  |   gint tex_width; | ||||||
|  |   gint tex_height; | ||||||
|  |  | ||||||
|   CoglPipeline *pipeline; |   CoglPipeline *pipeline; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -113,41 +123,79 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect, | |||||||
| static gboolean | static gboolean | ||||||
| will_have_no_effect (ClutterBrightnessContrastEffect *self) | will_have_no_effect (ClutterBrightnessContrastEffect *self) | ||||||
| { | { | ||||||
|   return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) && |   return (self->brightness_red == no_change && | ||||||
|           G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) && |           self->brightness_green == no_change && | ||||||
|           G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) && |           self->brightness_blue == no_change && | ||||||
|           G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) && |           self->contrast_red == no_change && | ||||||
|           G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) && |           self->contrast_green == no_change && | ||||||
|           G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON)); |           self->contrast_blue == no_change); | ||||||
| } |  | ||||||
|  |  | ||||||
| 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 | static gboolean | ||||||
| clutter_brightness_contrast_effect_pre_paint (ClutterEffect       *effect, | clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect) | ||||||
|                                               ClutterPaintNode    *node, |  | ||||||
|                                               ClutterPaintContext *paint_context) |  | ||||||
| { | { | ||||||
|   ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect); |   ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect); | ||||||
|   ClutterEffectClass *parent_class; |   ClutterEffectClass *parent_class; | ||||||
|  |  | ||||||
|  |   if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect))) | ||||||
|  |     return FALSE; | ||||||
|  |  | ||||||
|   if (will_have_no_effect (self)) |   if (will_have_no_effect (self)) | ||||||
|     return FALSE; |     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 = |   parent_class = | ||||||
|     CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class); |     CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class); | ||||||
|  |   if (parent_class->pre_paint (effect)) | ||||||
|  |     { | ||||||
|  |       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) | ||||||
|  | { | ||||||
|  |   ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect); | ||||||
|  |   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_push_source (self->pipeline); | ||||||
|  |  | ||||||
|  |   cogl_rectangle (0, 0, self->tex_width, self->tex_height); | ||||||
|  |  | ||||||
|  |   cogl_pop_source (); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -247,7 +295,7 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl | |||||||
|   ClutterOffscreenEffectClass *offscreen_class; |   ClutterOffscreenEffectClass *offscreen_class; | ||||||
|  |  | ||||||
|   offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); |   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; |   effect_class->pre_paint = clutter_brightness_contrast_effect_pre_paint; | ||||||
|  |  | ||||||
| @@ -265,9 +313,13 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl | |||||||
|    * to indicate no change; values smaller than 127 indicate a decrease |    * to indicate no change; values smaller than 127 indicate a decrease | ||||||
|    * in brightness, and values larger than 127 indicate an increase in |    * in brightness, and values larger than 127 indicate an increase in | ||||||
|    * brightness. |    * brightness. | ||||||
|  |    * | ||||||
|  |    * Since: 1.10 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_BRIGHTNESS] = |   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, |                               &no_brightness_change, | ||||||
|                               CLUTTER_PARAM_READWRITE); |                               CLUTTER_PARAM_READWRITE); | ||||||
|  |  | ||||||
| @@ -281,9 +333,13 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl | |||||||
|    * to indicate no change; values smaller than 127 indicate a decrease |    * to indicate no change; values smaller than 127 indicate a decrease | ||||||
|    * in contrast, and values larger than 127 indicate an increase in |    * in contrast, and values larger than 127 indicate an increase in | ||||||
|    * contrast. |    * contrast. | ||||||
|  |    * | ||||||
|  |    * Since: 1.10 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_CONTRAST] = |   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, |                               &no_contrast_change, | ||||||
|                               CLUTTER_PARAM_READWRITE); |                               CLUTTER_PARAM_READWRITE); | ||||||
|  |  | ||||||
| @@ -383,7 +439,9 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self) | |||||||
|       cogl_pipeline_add_snippet (klass->base_pipeline, snippet); |       cogl_pipeline_add_snippet (klass->base_pipeline, snippet); | ||||||
|       cogl_object_unref (snippet); |       cogl_object_unref (snippet); | ||||||
|  |  | ||||||
|       cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); |       cogl_pipeline_set_layer_null_texture (klass->base_pipeline, | ||||||
|  |                                             0, /* layer number */ | ||||||
|  |                                             COGL_TEXTURE_TYPE_2D); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   self->pipeline = cogl_pipeline_copy (klass->base_pipeline); |   self->pipeline = cogl_pipeline_copy (klass->base_pipeline); | ||||||
| @@ -409,6 +467,8 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self) | |||||||
|  * Return value: (transfer full): the newly created |  * Return value: (transfer full): the newly created | ||||||
|  *   #ClutterBrightnessContrastEffect or %NULL.  Use g_object_unref() when |  *   #ClutterBrightnessContrastEffect or %NULL.  Use g_object_unref() when | ||||||
|  *   done. |  *   done. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| ClutterEffect * | ClutterEffect * | ||||||
| clutter_brightness_contrast_effect_new (void) | 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, |  * 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 |  * values below 0.0 mean a decrease in brightness, and values above indicate | ||||||
|  * an increase. |  * an increase. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect, | clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect, | ||||||
| @@ -435,9 +497,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras | |||||||
| { | { | ||||||
|   g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); |   g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); | ||||||
|  |  | ||||||
|   if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) && |   if (red == effect->brightness_red && | ||||||
|       G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) && |       green == effect->brightness_green && | ||||||
|       G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON)) |       blue == effect->brightness_blue) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   effect->brightness_red = red; |   effect->brightness_red = red; | ||||||
| @@ -462,6 +524,8 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras | |||||||
|  *    change in brightness |  *    change in brightness | ||||||
|  * |  * | ||||||
|  * Retrieves the change in brightness used by @effect. |  * Retrieves the change in brightness used by @effect. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffect *effect, | 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; |  * 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 |  * a value below 0.0 indicates a decrease in brightness; and a value | ||||||
|  * above 0.0 indicates an increase of brightness. |  * above 0.0 indicates an increase of brightness. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffect *effect, | 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, |  * 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 |  * values below 0.0 mean a decrease in contrast, and values above indicate | ||||||
|  * an increase. |  * an increase. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect, | clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect, | ||||||
| @@ -519,9 +587,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE | |||||||
| { | { | ||||||
|   g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); |   g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); | ||||||
|  |  | ||||||
|   if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) && |   if (red == effect->contrast_red && | ||||||
|       G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) && |       green == effect->contrast_green && | ||||||
|       G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON)) |       blue == effect->contrast_blue) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   effect->contrast_red = red; |   effect->contrast_red = red; | ||||||
| @@ -546,6 +614,8 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE | |||||||
|  *    change in contrast |  *    change in contrast | ||||||
|  * |  * | ||||||
|  * Retrieves the contrast value used by @effect. |  * Retrieves the contrast value used by @effect. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect *effect, | 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; |  * 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 |  * a value below 0.0 indicates a decrease in contrast; and a value above | ||||||
|  * 0.0 indicates an increase. |  * 0.0 indicates an increase. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect, | clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect, | ||||||
|   | |||||||
| @@ -22,14 +22,15 @@ | |||||||
|  *   Joseph Scheuhammer <clown@alum.mit.edu> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-color.h" | #include <clutter/clutter-color.h> | ||||||
| #include "clutter/clutter-effect.h" | #include <clutter/clutter-effect.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -37,41 +38,51 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffect)) | #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)) | #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 _ClutterBrightnessContrastEffect         ClutterBrightnessContrastEffect; | ||||||
| typedef struct _ClutterBrightnessContrastEffectClass    ClutterBrightnessContrastEffectClass; | typedef struct _ClutterBrightnessContrastEffectClass    ClutterBrightnessContrastEffectClass; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| GType clutter_brightness_contrast_effect_get_type (void) G_GNUC_CONST; | GType clutter_brightness_contrast_effect_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| ClutterEffect * clutter_brightness_contrast_effect_new                          (void); | ClutterEffect * clutter_brightness_contrast_effect_new                          (void); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_set_brightness_full          (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_set_brightness_full          (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                            red, |                                                                                  float                            red, | ||||||
|                                                                                  float                            green, |                                                                                  float                            green, | ||||||
|                                                                                  float                            blue); |                                                                                  float                            blue); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_set_brightness               (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_set_brightness               (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                            brightness); |                                                                                  float                            brightness); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_get_brightness               (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_get_brightness               (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                           *red, |                                                                                  float                           *red, | ||||||
|                                                                                  float                           *green, |                                                                                  float                           *green, | ||||||
|                                                                                  float                           *blue); |                                                                                  float                           *blue); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_set_contrast_full            (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_set_contrast_full            (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                            red, |                                                                                  float                            red, | ||||||
|                                                                                  float                            green, |                                                                                  float                            green, | ||||||
|                                                                                  float                            blue); |                                                                                  float                            blue); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_set_contrast                 (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_set_contrast                 (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                            contrast); |                                                                                  float                            contrast); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| void            clutter_brightness_contrast_effect_get_contrast                 (ClutterBrightnessContrastEffect *effect, | void            clutter_brightness_contrast_effect_get_contrast                 (ClutterBrightnessContrastEffect *effect, | ||||||
|                                                                                  float                           *red, |                                                                                  float                           *red, | ||||||
|                                                                                  float                           *green, |                                                                                  float                           *green, | ||||||
|                                                                                  float                           *blue); |                                                                                  float                           *blue); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__ */ | ||||||
|   | |||||||
| @@ -1,11 +0,0 @@ | |||||||
| /* The prefix for our gettext translation domains. */ |  | ||||||
| #mesondefine GETTEXT_PACKAGE |  | ||||||
|  |  | ||||||
| /* Mutter version */ |  | ||||||
| #mesondefine MUTTER_VERSION |  | ||||||
|  |  | ||||||
| /* List of Cogl drivers */ |  | ||||||
| #mesondefine CLUTTER_DRIVERS |  | ||||||
|  |  | ||||||
| /* Supports PangoFt2 */ |  | ||||||
| #mesondefine HAVE_PANGO_FT2 |  | ||||||
| @@ -27,10 +27,12 @@ | |||||||
|  * Clutter provides some utility functions for using Cairo. |  * Clutter provides some utility functions for using Cairo. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-cairo.h" | #include "clutter-cairo.h" | ||||||
| #include "clutter/clutter-color.h" | #include "clutter-color.h" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * clutter_cairo_set_source_color: |  * clutter_cairo_set_source_color: | ||||||
| @@ -40,13 +42,15 @@ | |||||||
|  * Utility function for setting the source color of @cr using |  * Utility function for setting the source color of @cr using | ||||||
|  * a #ClutterColor. This function is the equivalent of: |  * a #ClutterColor. This function is the equivalent of: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[ | ||||||
|  *   cairo_set_source_rgba (cr, |  *   cairo_set_source_rgba (cr, | ||||||
|  *                          color->red / 255.0, |  *                          color->red / 255.0, | ||||||
|  *                          color->green / 255.0, |  *                          color->green / 255.0, | ||||||
|  *                          color->blue / 255.0, |  *                          color->blue / 255.0, | ||||||
|  *                          color->alpha / 255.0); |  *                          color->alpha / 255.0); | ||||||
|  * ``` |  * ]| | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_cairo_set_source_color (cairo_t            *cr, | clutter_cairo_set_source_color (cairo_t            *cr, | ||||||
| @@ -73,6 +77,8 @@ clutter_cairo_set_source_color (cairo_t            *cr, | |||||||
|  * @cr: a Cairo context |  * @cr: a Cairo context | ||||||
|  * |  * | ||||||
|  * Utility function to clear a Cairo context. |  * Utility function to clear a Cairo context. | ||||||
|  |  * | ||||||
|  |  * Since: 1.12 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_cairo_clear (cairo_t *cr) | clutter_cairo_clear (cairo_t *cr) | ||||||
|   | |||||||
| @@ -19,13 +19,14 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" | #include <clutter/clutter-types.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -35,6 +36,8 @@ G_BEGIN_DECLS | |||||||
|  * The #CoglPixelFormat to be used when uploading image data from |  * The #CoglPixelFormat to be used when uploading image data from | ||||||
|  * and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and |  * and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and | ||||||
|  * %CAIRO_FORMAT_RGB24 as #cairo_format_t. |  * %CAIRO_FORMAT_RGB24 as #cairo_format_t. | ||||||
|  |  * | ||||||
|  |  * Since: 1.8 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* Cairo stores the data in native byte order as ARGB but Cogl's pixel | /* Cairo stores the data in native byte order as ARGB but Cogl's pixel | ||||||
| @@ -47,10 +50,12 @@ G_BEGIN_DECLS | |||||||
| #define CLUTTER_CAIRO_FORMAT_ARGB32     (COGL_PIXEL_FORMAT_ARGB_8888_PRE) | #define CLUTTER_CAIRO_FORMAT_ARGB32     (COGL_PIXEL_FORMAT_ARGB_8888_PRE) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_12 | ||||||
| void    clutter_cairo_clear             (cairo_t               *cr); | void    clutter_cairo_clear             (cairo_t               *cr); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void    clutter_cairo_set_source_color  (cairo_t               *cr, | void    clutter_cairo_set_source_color  (cairo_t               *cr, | ||||||
|                                          const ClutterColor    *color); |                                          const ClutterColor    *color); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_CAIRO_H__ */ | ||||||
|   | |||||||
| @@ -23,9 +23,10 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterCanvas: |  * SECTION:clutter-canvas | ||||||
|  *  |  * @Title: ClutterCanvas | ||||||
|  * Content for 2D painting |  * @Short_Description: Content for 2D painting | ||||||
|  |  * @See_Also: #ClutterContent | ||||||
|  * |  * | ||||||
|  * The #ClutterCanvas class is a #ClutterContent implementation that allows |  * The #ClutterCanvas class is a #ClutterContent implementation that allows | ||||||
|  * drawing using the Cairo API on a 2D surface. |  * drawing using the Cairo API on a 2D surface. | ||||||
| @@ -36,27 +37,33 @@ | |||||||
|  * signal when invalidated using clutter_content_invalidate(). |  * signal when invalidated using clutter_content_invalidate(). | ||||||
|  * |  * | ||||||
|  * See [canvas.c](https://git.gnome.org/browse/clutter/tree/examples/canvas.c?h=clutter-1.18) |  * 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" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <math.h> | #include <cogl/cogl.h> | ||||||
| #include <cairo-gobject.h> | #include <cairo-gobject.h> | ||||||
|  |  | ||||||
| #include "cogl/cogl.h" | #include "clutter-canvas.h" | ||||||
| #include "clutter/clutter-canvas.h" |  | ||||||
| #include "clutter/clutter-actor-private.h" | #define CLUTTER_ENABLE_EXPERIMENTAL_API | ||||||
| #include "clutter/clutter-backend.h" |  | ||||||
| #include "clutter/clutter-cairo.h" | #include "clutter-actor-private.h" | ||||||
| #include "clutter/clutter-color.h" | #include "clutter-backend.h" | ||||||
| #include "clutter/clutter-content-private.h" | #include "clutter-cairo.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-color.h" | ||||||
| #include "clutter/clutter-marshal.h" | #include "clutter-content-private.h" | ||||||
| #include "clutter/clutter-paint-node.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-paint-nodes.h" | #include "clutter-marshal.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-paint-node.h" | ||||||
| #include "clutter/clutter-settings.h" | #include "clutter-paint-nodes.h" | ||||||
|  | #include "clutter-private.h" | ||||||
|  | #include "clutter-settings.h" | ||||||
|  |  | ||||||
| struct _ClutterCanvasPrivate | struct _ClutterCanvasPrivate | ||||||
| { | { | ||||||
| @@ -64,12 +71,14 @@ struct _ClutterCanvasPrivate | |||||||
|  |  | ||||||
|   int width; |   int width; | ||||||
|   int height; |   int height; | ||||||
|   float scale_factor; |  | ||||||
|  |  | ||||||
|   CoglTexture *texture; |   CoglTexture *texture; | ||||||
|   gboolean dirty; |   gboolean dirty; | ||||||
|  |  | ||||||
|   CoglBitmap *buffer; |   CoglBitmap *buffer; | ||||||
|  |  | ||||||
|  |   int scale_factor; | ||||||
|  |   guint scale_factor_set : 1; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| enum | enum | ||||||
| @@ -79,6 +88,7 @@ enum | |||||||
|   PROP_WIDTH, |   PROP_WIDTH, | ||||||
|   PROP_HEIGHT, |   PROP_HEIGHT, | ||||||
|   PROP_SCALE_FACTOR, |   PROP_SCALE_FACTOR, | ||||||
|  |   PROP_SCALE_FACTOR_SET, | ||||||
|  |  | ||||||
|   LAST_PROP |   LAST_PROP | ||||||
| }; | }; | ||||||
| @@ -94,7 +104,7 @@ enum | |||||||
|  |  | ||||||
| static guint canvas_signals[LAST_SIGNAL] = { 0, }; | static guint canvas_signals[LAST_SIGNAL] = { 0, }; | ||||||
|  |  | ||||||
| static void clutter_content_iface_init (ClutterContentInterface *iface); | static void clutter_content_iface_init (ClutterContentIface *iface); | ||||||
|  |  | ||||||
| G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT, | G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT, | ||||||
|                          G_ADD_PRIVATE (ClutterCanvas) |                          G_ADD_PRIVATE (ClutterCanvas) | ||||||
| @@ -176,16 +186,8 @@ clutter_canvas_set_property (GObject      *gobject, | |||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case PROP_SCALE_FACTOR: |     case PROP_SCALE_FACTOR: | ||||||
|       { |       clutter_canvas_set_scale_factor (CLUTTER_CANVAS (gobject), | ||||||
|         gfloat new_scale_factor = g_value_get_float (value); |                                        g_value_get_int (value)); | ||||||
|  |  | ||||||
|         if (priv->scale_factor != new_scale_factor) |  | ||||||
|           { |  | ||||||
|             priv->scale_factor = new_scale_factor; |  | ||||||
|  |  | ||||||
|             clutter_content_invalidate (CLUTTER_CONTENT (gobject)); |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     default: |     default: | ||||||
| @@ -213,7 +215,14 @@ clutter_canvas_get_property (GObject    *gobject, | |||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case PROP_SCALE_FACTOR: |     case PROP_SCALE_FACTOR: | ||||||
|       g_value_set_float (value, priv->scale_factor); |       if (priv->scale_factor_set) | ||||||
|  |         g_value_set_int (value, priv->scale_factor); | ||||||
|  |       else | ||||||
|  |         g_value_set_int (value, -1); | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     case PROP_SCALE_FACTOR_SET: | ||||||
|  |       g_value_set_boolean (value, priv->scale_factor_set); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     default: |     default: | ||||||
| @@ -231,9 +240,13 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) | |||||||
|    * ClutterCanvas:width: |    * ClutterCanvas:width: | ||||||
|    * |    * | ||||||
|    * The width of the canvas. |    * The width of the canvas. | ||||||
|  |    * | ||||||
|  |    * Since: 1.10 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_WIDTH] = |   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_MAXINT, | ||||||
|                       -1, |                       -1, | ||||||
|                       G_PARAM_READWRITE | |                       G_PARAM_READWRITE | | ||||||
| @@ -243,25 +256,58 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) | |||||||
|    * ClutterCanvas:height: |    * ClutterCanvas:height: | ||||||
|    * |    * | ||||||
|    * The height of the canvas. |    * The height of the canvas. | ||||||
|  |    * | ||||||
|  |    * Since: 1.10 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_HEIGHT] = |   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_MAXINT, | ||||||
|                       -1, |                       -1, | ||||||
|                       G_PARAM_READWRITE | |                       G_PARAM_READWRITE | | ||||||
|                       G_PARAM_STATIC_STRINGS); |                       G_PARAM_STATIC_STRINGS); | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * ClutterCanvas:scale-factor-set: | ||||||
|  |    * | ||||||
|  |    * Whether the #ClutterCanvas:scale-factor property is set. | ||||||
|  |    * | ||||||
|  |    * If the #ClutterCanvas:scale-factor-set property is %FALSE | ||||||
|  |    * then #ClutterCanvas will use the #ClutterSettings:window-scaling-factor | ||||||
|  |    * property. | ||||||
|  |    * | ||||||
|  |    * Since: 1.18 | ||||||
|  |    */ | ||||||
|  |   obj_props[PROP_SCALE_FACTOR_SET] = | ||||||
|  |     g_param_spec_boolean ("scale-factor-set", | ||||||
|  |                           P_("Scale Factor Set"), | ||||||
|  |                           P_("Whether the scale-factor property is set"), | ||||||
|  |                           FALSE, | ||||||
|  |                           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * ClutterCanvas:scale-factor: |    * ClutterCanvas:scale-factor: | ||||||
|    * |    * | ||||||
|    * The height of the canvas. |    * The scaling factor to be applied to the Cairo surface used for | ||||||
|  |    * drawing. | ||||||
|  |    * | ||||||
|  |    * If #ClutterCanvas:scale-factor is set to a negative value, the | ||||||
|  |    * value of the #ClutterSettings:window-scaling-factor property is | ||||||
|  |    * used instead. | ||||||
|  |    * | ||||||
|  |    * Use #ClutterCanvas:scale-factor-set to check if the scale factor | ||||||
|  |    * is set. | ||||||
|  |    * | ||||||
|  |    * Since: 1.18 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_SCALE_FACTOR] = |   obj_props[PROP_SCALE_FACTOR] = | ||||||
|     g_param_spec_float ("scale-factor", NULL, NULL, |     g_param_spec_int ("scale-factor", | ||||||
|                         0.01f, G_MAXFLOAT, |                       P_("Scale Factor"), | ||||||
|                         1.0f, |                       P_("The scaling factor for the surface"), | ||||||
|                         G_PARAM_READWRITE | |                       -1, 1000, | ||||||
|                         G_PARAM_STATIC_STRINGS); |                       -1, | ||||||
|  |                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * ClutterCanvas::draw: |    * ClutterCanvas::draw: | ||||||
| @@ -279,6 +325,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) | |||||||
|    * |    * | ||||||
|    * Return value: %TRUE if the signal emission should stop, and |    * Return value: %TRUE if the signal emission should stop, and | ||||||
|    *   %FALSE otherwise |    *   %FALSE otherwise | ||||||
|  |    * | ||||||
|  |    * Since: 1.10 | ||||||
|    */ |    */ | ||||||
|   canvas_signals[DRAW] = |   canvas_signals[DRAW] = | ||||||
|     g_signal_new (I_("draw"), |     g_signal_new (I_("draw"), | ||||||
| @@ -306,14 +354,13 @@ clutter_canvas_init (ClutterCanvas *self) | |||||||
|  |  | ||||||
|   self->priv->width = -1; |   self->priv->width = -1; | ||||||
|   self->priv->height = -1; |   self->priv->height = -1; | ||||||
|   self->priv->scale_factor = 1.0f; |   self->priv->scale_factor = -1; | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_canvas_paint_content (ClutterContent      *content, | clutter_canvas_paint_content (ClutterContent   *content, | ||||||
|                               ClutterActor        *actor, |                               ClutterActor     *actor, | ||||||
|                               ClutterPaintNode    *root, |                               ClutterPaintNode *root) | ||||||
|                               ClutterPaintContext *paint_context) |  | ||||||
| { | { | ||||||
|   ClutterCanvas *self = CLUTTER_CANVAS (content); |   ClutterCanvas *self = CLUTTER_CANVAS (content); | ||||||
|   ClutterCanvasPrivate *priv = self->priv; |   ClutterCanvasPrivate *priv = self->priv; | ||||||
| @@ -326,13 +373,15 @@ clutter_canvas_paint_content (ClutterContent      *content, | |||||||
|     g_clear_pointer (&priv->texture, cogl_object_unref); |     g_clear_pointer (&priv->texture, cogl_object_unref); | ||||||
|  |  | ||||||
|   if (priv->texture == NULL) |   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) |   if (priv->texture == NULL) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   node = clutter_actor_create_texture_paint_node (actor, priv->texture); |   node = clutter_actor_create_texture_paint_node (actor, priv->texture); | ||||||
|   clutter_paint_node_set_static_name (node, "Canvas Content"); |   clutter_paint_node_set_name (node, "Canvas Content"); | ||||||
|   clutter_paint_node_add_child (root, node); |   clutter_paint_node_add_child (root, node); | ||||||
|   clutter_paint_node_unref (node); |   clutter_paint_node_unref (node); | ||||||
|  |  | ||||||
| @@ -348,18 +397,28 @@ clutter_canvas_emit_draw (ClutterCanvas *self) | |||||||
|   gboolean mapped_buffer; |   gboolean mapped_buffer; | ||||||
|   unsigned char *data; |   unsigned char *data; | ||||||
|   CoglBuffer *buffer; |   CoglBuffer *buffer; | ||||||
|  |   int window_scale = 1; | ||||||
|   gboolean res; |   gboolean res; | ||||||
|   cairo_t *cr; |   cairo_t *cr; | ||||||
|  |  | ||||||
|   g_assert (priv->height > 0 && priv->width > 0); |   g_assert (priv->width > 0 && priv->width > 0); | ||||||
|  |  | ||||||
|   priv->dirty = TRUE; |   priv->dirty = TRUE; | ||||||
|  |  | ||||||
|   real_width = ceilf (priv->width * priv->scale_factor); |   if (priv->scale_factor_set) | ||||||
|   real_height = ceilf (priv->height * priv->scale_factor); |     window_scale = priv->scale_factor; | ||||||
|  |   else | ||||||
|  |     g_object_get (clutter_settings_get_default (), | ||||||
|  |                   "window-scaling-factor", &window_scale, | ||||||
|  |                   NULL); | ||||||
|  |  | ||||||
|   CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d", |   real_width = priv->width * window_scale; | ||||||
|                 priv->width, priv->height); |   real_height = priv->height * window_scale; | ||||||
|  |  | ||||||
|  |   CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d (real: %d x %d, scale: %d)", | ||||||
|  |                 priv->width, priv->height, | ||||||
|  |                 real_width, real_height, | ||||||
|  |                 window_scale); | ||||||
|  |  | ||||||
|   if (priv->buffer == NULL) |   if (priv->buffer == NULL) | ||||||
|     { |     { | ||||||
| @@ -402,9 +461,7 @@ clutter_canvas_emit_draw (ClutterCanvas *self) | |||||||
|       mapped_buffer = FALSE; |       mapped_buffer = FALSE; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   cairo_surface_set_device_scale (surface, |   cairo_surface_set_device_scale (surface, window_scale, window_scale); | ||||||
|                                   priv->scale_factor, |  | ||||||
|                                   priv->scale_factor); |  | ||||||
|  |  | ||||||
|   self->priv->cr = cr = cairo_create (surface); |   self->priv->cr = cr = cairo_create (surface); | ||||||
|  |  | ||||||
| @@ -467,16 +524,16 @@ clutter_canvas_get_preferred_size (ClutterContent *content, | |||||||
|     return FALSE; |     return FALSE; | ||||||
|  |  | ||||||
|   if (width != NULL) |   if (width != NULL) | ||||||
|     *width = ceilf (priv->width * priv->scale_factor); |     *width = priv->width; | ||||||
|  |  | ||||||
|   if (height != NULL) |   if (height != NULL) | ||||||
|     *height = ceilf (priv->height * priv->scale_factor); |     *height = priv->height; | ||||||
|  |  | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_content_iface_init (ClutterContentInterface *iface) | clutter_content_iface_init (ClutterContentIface *iface) | ||||||
| { | { | ||||||
|   iface->invalidate = clutter_canvas_invalidate; |   iface->invalidate = clutter_canvas_invalidate; | ||||||
|   iface->paint_content = clutter_canvas_paint_content; |   iface->paint_content = clutter_canvas_paint_content; | ||||||
| @@ -495,6 +552,8 @@ clutter_content_iface_init (ClutterContentInterface *iface) | |||||||
|  * |  * | ||||||
|  * Return value: (transfer full): The newly allocated instance of |  * Return value: (transfer full): The newly allocated instance of | ||||||
|  *   #ClutterCanvas. Use g_object_unref() when done. |  *   #ClutterCanvas. Use g_object_unref() when done. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| ClutterContent * | ClutterContent * | ||||||
| clutter_canvas_new (void) | clutter_canvas_new (void) | ||||||
| @@ -557,13 +616,15 @@ clutter_canvas_invalidate_internal (ClutterCanvas *canvas, | |||||||
|  * the size, you can use the return value of the function to conditionally |  * the size, you can use the return value of the function to conditionally | ||||||
|  * call clutter_content_invalidate(): |  * call clutter_content_invalidate(): | ||||||
|  * |  * | ||||||
|  * ```c |  * |[ | ||||||
|  *   if (!clutter_canvas_set_size (canvas, width, height)) |  *   if (!clutter_canvas_set_size (canvas, width, height)) | ||||||
|  *     clutter_content_invalidate (CLUTTER_CONTENT (canvas)); |  *     clutter_content_invalidate (CLUTTER_CONTENT (canvas)); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * Return value: this function returns %TRUE if the size change |  * Return value: this function returns %TRUE if the size change | ||||||
|  *   caused a content invalidation, and %FALSE otherwise |  *   caused a content invalidation, and %FALSE otherwise | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| gboolean | gboolean | ||||||
| clutter_canvas_set_size (ClutterCanvas *canvas, | clutter_canvas_set_size (ClutterCanvas *canvas, | ||||||
| @@ -579,44 +640,77 @@ clutter_canvas_set_size (ClutterCanvas *canvas, | |||||||
| /** | /** | ||||||
|  * clutter_canvas_set_scale_factor: |  * clutter_canvas_set_scale_factor: | ||||||
|  * @canvas: a #ClutterCanvas |  * @canvas: a #ClutterCanvas | ||||||
|  * @scale: the integer scaling factor of the canvas |  * @scale: the scale factor, or -1 for the default | ||||||
|  * |  * | ||||||
|  * Sets the scaling factor of the @canvas, and invalidates the content. |  * Sets the scaling factor for the Cairo surface used by @canvas. | ||||||
|  * |  * | ||||||
|  * This function will cause the @canvas to be invalidated only |  * This function should rarely be used. | ||||||
|  * if the scale factor of the canvas surface has changed. |  * | ||||||
|  |  * The default scaling factor of a #ClutterCanvas content uses the | ||||||
|  |  * #ClutterSettings:window-scaling-factor property, which is set by | ||||||
|  |  * the windowing system. By using this function it is possible to | ||||||
|  |  * override that setting. | ||||||
|  |  * | ||||||
|  |  * Changing the scale factor will invalidate the @canvas. | ||||||
|  |  * | ||||||
|  |  * Since: 1.18 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_canvas_set_scale_factor (ClutterCanvas *canvas, | clutter_canvas_set_scale_factor (ClutterCanvas *canvas, | ||||||
|                                  float          scale) |                                  int            scale) | ||||||
| { | { | ||||||
|  |   ClutterCanvasPrivate *priv; | ||||||
|  |   GObject *obj; | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_CANVAS (canvas)); |   g_return_if_fail (CLUTTER_IS_CANVAS (canvas)); | ||||||
|   g_return_if_fail (scale > 0.0f); |   g_return_if_fail (scale != 0); | ||||||
|  |  | ||||||
|   if (canvas->priv->scale_factor != scale) |   priv = canvas->priv; | ||||||
|  |  | ||||||
|  |   if (scale < 0) | ||||||
|     { |     { | ||||||
|       canvas->priv->scale_factor = scale; |       if (!priv->scale_factor_set) | ||||||
|  |         return; | ||||||
|  |  | ||||||
|       g_object_freeze_notify (G_OBJECT (canvas)); |       priv->scale_factor_set = FALSE; | ||||||
|       clutter_content_invalidate (CLUTTER_CONTENT (canvas)); |       priv->scale_factor = -1; | ||||||
|       g_object_thaw_notify (G_OBJECT (canvas)); |  | ||||||
|  |  | ||||||
|       g_object_notify_by_pspec (G_OBJECT (canvas), obj_props[PROP_SCALE_FACTOR]); |  | ||||||
|     } |     } | ||||||
|  |   else | ||||||
|  |     { | ||||||
|  |       if (priv->scale_factor_set && priv->scale_factor == scale) | ||||||
|  |         return; | ||||||
|  |  | ||||||
|  |       priv->scale_factor_set = TRUE; | ||||||
|  |       priv->scale_factor = scale; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   clutter_content_invalidate (CLUTTER_CONTENT (canvas)); | ||||||
|  |  | ||||||
|  |   obj = G_OBJECT (canvas); | ||||||
|  |  | ||||||
|  |   g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR]); | ||||||
|  |   g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR_SET]); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * clutter_canvas_get_scale_factor: |  * clutter_canvas_get_scale_factor: | ||||||
|  * @canvas: a #ClutterCanvas |  * @canvas: a #ClutterCanvas | ||||||
|  * |  * | ||||||
|  * Gets the scale factor of the @canvas. |  * Retrieves the scaling factor of @canvas, as set using | ||||||
|  |  * clutter_canvas_set_scale_factor(). | ||||||
|  * |  * | ||||||
|  * Return value: the current @canvas scale factor or -1 if invalid |  * Return value: the scaling factor, or -1 if the @canvas | ||||||
|  |  *   uses the default from #ClutterSettings | ||||||
|  |  * | ||||||
|  |  * Since: 1.18 | ||||||
|  */ |  */ | ||||||
| float | int | ||||||
| clutter_canvas_get_scale_factor (ClutterCanvas *canvas) | clutter_canvas_get_scale_factor (ClutterCanvas *canvas) | ||||||
| { | { | ||||||
|   g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1.0f); |   g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1); | ||||||
|  |  | ||||||
|  |   if (!canvas->priv->scale_factor_set) | ||||||
|  |     return -1; | ||||||
|  |  | ||||||
|   return canvas->priv->scale_factor; |   return canvas->priv->scale_factor; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,13 +22,14 @@ | |||||||
|  *   Emmanuele Bassi <ebassi@linux.intel.com> |  *   Emmanuele Bassi <ebassi@linux.intel.com> | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #pragma once | #ifndef __CLUTTER_CANVAS_H__ | ||||||
|  | #define __CLUTTER_CANVAS_H__ | ||||||
|  |  | ||||||
| #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-types.h" | #include <clutter/clutter-types.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -43,6 +44,15 @@ typedef struct _ClutterCanvas           ClutterCanvas; | |||||||
| typedef struct _ClutterCanvasPrivate    ClutterCanvasPrivate; | typedef struct _ClutterCanvasPrivate    ClutterCanvasPrivate; | ||||||
| typedef struct _ClutterCanvasClass      ClutterCanvasClass; | 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 | struct _ClutterCanvas | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -57,6 +67,8 @@ struct _ClutterCanvas | |||||||
|  * |  * | ||||||
|  * The #ClutterCanvasClass structure contains |  * The #ClutterCanvasClass structure contains | ||||||
|  * private data. |  * private data. | ||||||
|  |  * | ||||||
|  |  * Since: 1.10 | ||||||
|  */ |  */ | ||||||
| struct _ClutterCanvasClass | struct _ClutterCanvasClass | ||||||
| { | { | ||||||
| @@ -68,22 +80,27 @@ struct _ClutterCanvasClass | |||||||
|                      cairo_t       *cr, |                      cairo_t       *cr, | ||||||
|                      int            width, |                      int            width, | ||||||
|                      int            height); |                      int            height); | ||||||
|  |  | ||||||
|  |   /*< private >*/ | ||||||
|  |   gpointer _padding[16]; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| GType clutter_canvas_get_type (void) G_GNUC_CONST; | GType clutter_canvas_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| ClutterContent *        clutter_canvas_new                      (void); | ClutterContent *        clutter_canvas_new                      (void); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_10 | ||||||
| gboolean                clutter_canvas_set_size                 (ClutterCanvas *canvas, | gboolean                clutter_canvas_set_size                 (ClutterCanvas *canvas, | ||||||
|                                                                  int            width, |                                                                  int            width, | ||||||
|                                                                  int            height); |                                                                  int            height); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_18 | ||||||
| void                    clutter_canvas_set_scale_factor         (ClutterCanvas *canvas, | void                    clutter_canvas_set_scale_factor         (ClutterCanvas *canvas, | ||||||
|                                                                  float          scale); |                                                                  int            scale); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_18 | ||||||
| float                   clutter_canvas_get_scale_factor         (ClutterCanvas *canvas); | int                     clutter_canvas_get_scale_factor         (ClutterCanvas *canvas); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_CANVAS_H__ */ | ||||||
|   | |||||||
| @@ -25,51 +25,25 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterChildMeta: |  * SECTION:clutter-child-meta | ||||||
|  *  |  * @short_description: Wrapper for actors inside a container | ||||||
|  * 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 is a wrapper object created by #ClutterContainer | ||||||
|  * #ClutterChildMeta and set the #ClutterContainerIface child_meta_type |  * implementations in order to store child-specific data and properties. | ||||||
|  * interface member to your subclass type, like: |  | ||||||
|  * |  * | ||||||
|  * ```c |  * A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer. | ||||||
|  * static void |  | ||||||
|  * my_container_iface_init (ClutterContainerIface *iface) |  | ||||||
|  * { |  | ||||||
|  *   // set the rest of the #ClutterContainer vtable |  | ||||||
|  * |  * | ||||||
|  *   container_iface->child_meta_type  = MY_TYPE_CHILD_META; |  * #ClutterChildMeta is available since Clutter 0.8 | ||||||
|  * } |  | ||||||
|  * ``` |  | ||||||
|  * |  | ||||||
|  * 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(). |  | ||||||
|  */ |  */ | ||||||
|  | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #include "clutter-child-meta.h" | ||||||
|  | #include "clutter-container.h" | ||||||
| #include "clutter/clutter-child-meta.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-container.h" | #include "clutter-private.h" | ||||||
| #include "clutter/clutter-debug.h" |  | ||||||
| #include "clutter/clutter-private.h" |  | ||||||
|  |  | ||||||
| G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT); | G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT); | ||||||
|  |  | ||||||
| @@ -145,9 +119,13 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) | |||||||
|    * ClutterChildMeta:container: |    * ClutterChildMeta:container: | ||||||
|    * |    * | ||||||
|    * The #ClutterContainer that created this #ClutterChildMeta. |    * The #ClutterContainer that created this #ClutterChildMeta. | ||||||
|  |    * | ||||||
|  |    * Since: 0.8 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_CONTAINER] = |   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, |                          CLUTTER_TYPE_CONTAINER, | ||||||
|                          G_PARAM_CONSTRUCT_ONLY | |                          G_PARAM_CONSTRUCT_ONLY | | ||||||
|                          CLUTTER_PARAM_READWRITE); |                          CLUTTER_PARAM_READWRITE); | ||||||
| @@ -156,9 +134,13 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) | |||||||
|    * ClutterChildMeta:actor: |    * ClutterChildMeta:actor: | ||||||
|    * |    * | ||||||
|    * The #ClutterActor being wrapped by this #ClutterChildMeta |    * The #ClutterActor being wrapped by this #ClutterChildMeta | ||||||
|  |    * | ||||||
|  |    * Since: 0.8 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_ACTOR] = |   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, |                          CLUTTER_TYPE_ACTOR, | ||||||
|                          G_PARAM_CONSTRUCT_ONLY | |                          G_PARAM_CONSTRUCT_ONLY | | ||||||
|                          CLUTTER_PARAM_READWRITE); |                          CLUTTER_PARAM_READWRITE); | ||||||
| @@ -180,6 +162,8 @@ clutter_child_meta_init (ClutterChildMeta *self) | |||||||
|  * Retrieves the container using @data |  * Retrieves the container using @data | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): a #ClutterContainer |  * Return value: (transfer none): a #ClutterContainer | ||||||
|  |  * | ||||||
|  |  * Since: 0.8 | ||||||
|  */ |  */ | ||||||
| ClutterContainer * | ClutterContainer * | ||||||
| clutter_child_meta_get_container (ClutterChildMeta *data) | clutter_child_meta_get_container (ClutterChildMeta *data) | ||||||
| @@ -196,6 +180,8 @@ clutter_child_meta_get_container (ClutterChildMeta *data) | |||||||
|  * Retrieves the actor wrapped by @data |  * Retrieves the actor wrapped by @data | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): a #ClutterActor |  * Return value: (transfer none): a #ClutterActor | ||||||
|  |  * | ||||||
|  |  * Since: 0.8 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_child_meta_get_actor (ClutterChildMeta *data) | clutter_child_meta_get_actor (ClutterChildMeta *data) | ||||||
|   | |||||||
| @@ -25,15 +25,15 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <glib-object.h> | #include <glib-object.h> | ||||||
|  | #include <clutter/clutter-types.h> | ||||||
| #include "clutter/clutter-types.h" |  | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -46,6 +46,46 @@ G_BEGIN_DECLS | |||||||
|  |  | ||||||
| typedef struct _ClutterChildMetaClass           ClutterChildMetaClass; | typedef struct _ClutterChildMetaClass           ClutterChildMetaClass; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ClutterChildMeta: | ||||||
|  |  * @container: the container handling this data | ||||||
|  |  * @actor: the actor wrapped by this data | ||||||
|  |  *  | ||||||
|  |  * Base interface for container specific state for child actors. A child | ||||||
|  |  * data is meant to be used when you need to keep track of information | ||||||
|  |  * about each individual child added to a container. | ||||||
|  |  * | ||||||
|  |  * In order to use it you should create your own subclass of | ||||||
|  |  * #ClutterChildMeta and set the #ClutterContainerIface child_meta_type | ||||||
|  |  * interface member to your subclass type, like: | ||||||
|  |  * | ||||||
|  |  * |[ | ||||||
|  |  * static void | ||||||
|  |  * my_container_iface_init (ClutterContainerIface *iface) | ||||||
|  |  * { | ||||||
|  |  *   // set the rest of the #ClutterContainer vtable | ||||||
|  |  * | ||||||
|  |  *   container_iface->child_meta_type  = MY_TYPE_CHILD_META; | ||||||
|  |  * } | ||||||
|  |  * ]| | ||||||
|  |  * | ||||||
|  |  * This will automatically create a #ClutterChildMeta of type | ||||||
|  |  * `MY_TYPE_CHILD_META` for every actor that is added to the container. | ||||||
|  |  * | ||||||
|  |  * The child data for an actor can be retrieved using the | ||||||
|  |  * clutter_container_get_child_meta() function. | ||||||
|  |  *  | ||||||
|  |  * The properties of the data and your subclass can be manipulated with | ||||||
|  |  * clutter_container_child_set() and clutter_container_child_get() which | ||||||
|  |  * act like g_object_set() and g_object_get(). | ||||||
|  |  * | ||||||
|  |  * You can provide hooks for your own storage as well as control the | ||||||
|  |  * instantiation by overriding the #ClutterContainerIface virtual functions | ||||||
|  |  * #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(), | ||||||
|  |  * and #ClutterContainerIface.get_child_meta(). | ||||||
|  |  * | ||||||
|  |  * Since: 0.8 | ||||||
|  |  */ | ||||||
| struct _ClutterChildMeta | struct _ClutterChildMeta | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -60,6 +100,8 @@ struct _ClutterChildMeta | |||||||
|  * ClutterChildMetaClass: |  * ClutterChildMetaClass: | ||||||
|  * |  * | ||||||
|  * The #ClutterChildMetaClass contains only private data |  * The #ClutterChildMetaClass contains only private data | ||||||
|  |  * | ||||||
|  |  * Since: 0.8 | ||||||
|  */ |  */ | ||||||
| struct _ClutterChildMetaClass | struct _ClutterChildMetaClass | ||||||
| { | { | ||||||
| @@ -67,12 +109,14 @@ struct _ClutterChildMetaClass | |||||||
|   GObjectClass parent_class; |   GObjectClass parent_class; | ||||||
| };  | };  | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| GType clutter_child_meta_get_type (void) G_GNUC_CONST; | GType clutter_child_meta_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| ClutterContainer *      clutter_child_meta_get_container        (ClutterChildMeta *data); | ClutterContainer *      clutter_child_meta_get_container        (ClutterChildMeta *data); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_ALL | ||||||
| ClutterActor     *      clutter_child_meta_get_actor            (ClutterChildMeta *data); | ClutterActor     *      clutter_child_meta_get_actor            (ClutterChildMeta *data); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_CHILD_META_H__ */ | ||||||
|   | |||||||
| @@ -23,39 +23,39 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterClickAction: |  * SECTION:clutter-click-action | ||||||
|  *  |  * @Title: ClutterClickAction | ||||||
|  * Action for clickable actors |  * @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 |  * the logic for clickable actors, by using the low level events of | ||||||
|  * [class@Actor], such as [signal@Actor::button-press-event] and |  * #ClutterActor, such as #ClutterActor::button-press-event and | ||||||
|  * [signal@Actor::button-release-event], to synthesize the high level |  * #ClutterActor::button-release-event, to synthesize the high level | ||||||
|  * [signal@ClickAction::clicked] signal. |  * #ClutterClickAction::clicked signal. | ||||||
|  * |  * | ||||||
|  * To use #ClutterClickAction you just need to apply it to a [class@Actor] |  * To use #ClutterClickAction you just need to apply it to a #ClutterActor | ||||||
|  * using [method@Actor.add_action] and connect to the |  * using clutter_actor_add_action() and connect to the | ||||||
|  * [signal@ClickAction::clicked] signal: |  * #ClutterClickAction::clicked signal: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[ | ||||||
|  *   ClutterAction *action = clutter_click_action_new (); |  *   ClutterAction *action = clutter_click_action_new (); | ||||||
|  * |  * | ||||||
|  *   clutter_actor_add_action (actor, action); |  *   clutter_actor_add_action (actor, action); | ||||||
|  * |  * | ||||||
|  *   g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL); |  *   g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL); | ||||||
|  * ``` |  * ]| | ||||||
|  * |  * | ||||||
|  * #ClutterClickAction also supports long press gestures: a long press is |  * #ClutterClickAction also supports long press gestures: a long press is | ||||||
|  * activated if the pointer remains pressed within a certain threshold (as |  * 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 |  * minimum amount of time (as the defined by the | ||||||
|  * [property@ClickAction:long-press-duration] property). |  * #ClutterClickAction:long-press-duration property). | ||||||
|  * The [signal@ClickAction::long-press] signal is emitted multiple times, |  * The #ClutterClickAction::long-press signal is emitted multiple times, | ||||||
|  * using different [enum@LongPressState] values; to handle long presses |  * using different #ClutterLongPressState values; to handle long presses | ||||||
|  * you should connect to the [signal@ClickAction::long-press] signal and |  * you should connect to the #ClutterClickAction::long-press signal and | ||||||
|  * handle the different states: |  * handle the different states: | ||||||
|  * |  * | ||||||
|  * ```c |  * |[ | ||||||
|  *   static gboolean |  *   static gboolean | ||||||
|  *   on_long_press (ClutterClickAction    *action, |  *   on_long_press (ClutterClickAction    *action, | ||||||
|  *                  ClutterActor          *actor, |  *                  ClutterActor          *actor, | ||||||
| @@ -64,42 +64,51 @@ | |||||||
|  *     switch (state) |  *     switch (state) | ||||||
|  *       { |  *       { | ||||||
|  *       case CLUTTER_LONG_PRESS_QUERY: |  *       case CLUTTER_LONG_PRESS_QUERY: | ||||||
|  *         // return TRUE if the actor should support long press |  *         /* return TRUE if the actor should support long press | ||||||
|  *         // gestures, and FALSE otherwise; this state will be |  *          * gestures, and FALSE otherwise; this state will be | ||||||
|  *         // emitted on button presses |  *          * emitted on button presses | ||||||
|  |  *          */ | ||||||
|  *         return TRUE; |  *         return TRUE; | ||||||
|  * |  * | ||||||
|  *       case CLUTTER_LONG_PRESS_ACTIVATE: |  *       case CLUTTER_LONG_PRESS_ACTIVATE: | ||||||
|  *         // this state is emitted if the minimum duration has |  *         /* this state is emitted if the minimum duration has | ||||||
|  *         // been reached without the gesture being cancelled. |  *          * been reached without the gesture being cancelled. | ||||||
|  *         // the return value is not used |  *          * the return value is not used | ||||||
|  |  *          */ | ||||||
|  *         return TRUE; |  *         return TRUE; | ||||||
|  * |  * | ||||||
|  *       case CLUTTER_LONG_PRESS_CANCEL: |  *       case CLUTTER_LONG_PRESS_CANCEL: | ||||||
|  *         // this state is emitted if the long press was cancelled; |  *         /* this state is emitted if the long press was cancelled; | ||||||
|  *         // for instance, the pointer went outside the actor or the |  *          * for instance, the pointer went outside the actor or the | ||||||
|  *         // allowed threshold, or the button was released before |  *          * allowed threshold, or the button was released before | ||||||
|  *         // the minimum duration was reached. the return value is |  *          * the minimum duration was reached. the return value is | ||||||
|  *         // not used |  *          * not used | ||||||
|  |  *          */ | ||||||
|  *         return FALSE; |  *         return FALSE; | ||||||
|  *       } |  *       } | ||||||
|  *   } |  *   } | ||||||
|  * ``` |  * ]| | ||||||
|  |  * | ||||||
|  |  * #ClutterClickAction is available since Clutter 1.4 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-click-action.h" | #include "clutter-click-action.h" | ||||||
|  |  | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-enum-types.h" | #include "clutter-enum-types.h" | ||||||
| #include "clutter/clutter-marshal.h" | #include "clutter-marshal.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-private.h" | ||||||
|  |  | ||||||
| struct _ClutterClickActionPrivate | struct _ClutterClickActionPrivate | ||||||
| { | { | ||||||
|   ClutterActor *stage; |   ClutterActor *stage; | ||||||
|  |  | ||||||
|  |   guint event_id; | ||||||
|  |   guint capture_id; | ||||||
|   guint long_press_id; |   guint long_press_id; | ||||||
|  |  | ||||||
|   gint long_press_threshold; |   gint long_press_threshold; | ||||||
| @@ -107,7 +116,7 @@ struct _ClutterClickActionPrivate | |||||||
|   gint drag_threshold; |   gint drag_threshold; | ||||||
|  |  | ||||||
|   guint press_button; |   guint press_button; | ||||||
|   ClutterInputDevice *press_device; |   gint press_device_id; | ||||||
|   ClutterEventSequence *press_sequence; |   ClutterEventSequence *press_sequence; | ||||||
|   ClutterModifierType modifier_state; |   ClutterModifierType modifier_state; | ||||||
|   gfloat press_x; |   gfloat press_x; | ||||||
| @@ -143,12 +152,16 @@ static guint click_signals[LAST_SIGNAL] = { 0, }; | |||||||
|  |  | ||||||
| G_DEFINE_TYPE_WITH_PRIVATE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION) | 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 | static inline void | ||||||
| click_action_set_pressed (ClutterClickAction *action, | click_action_set_pressed (ClutterClickAction *action, | ||||||
|                           gboolean            is_pressed) |                           gboolean            is_pressed) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|  |  | ||||||
|   is_pressed = !!is_pressed; |   is_pressed = !!is_pressed; | ||||||
|  |  | ||||||
| @@ -163,8 +176,7 @@ static inline void | |||||||
| click_action_set_held (ClutterClickAction *action, | click_action_set_held (ClutterClickAction *action, | ||||||
|                        gboolean            is_held) |                        gboolean            is_held) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|  |  | ||||||
|   is_held = !!is_held; |   is_held = !!is_held; | ||||||
|  |  | ||||||
| @@ -179,8 +191,7 @@ static gboolean | |||||||
| click_action_emit_long_press (gpointer data) | click_action_emit_long_press (gpointer data) | ||||||
| { | { | ||||||
|   ClutterClickAction *action = data; |   ClutterClickAction *action = data; | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|   ClutterActor *actor; |   ClutterActor *actor; | ||||||
|   gboolean result; |   gboolean result; | ||||||
|  |  | ||||||
| @@ -193,6 +204,12 @@ click_action_emit_long_press (gpointer data) | |||||||
|                  CLUTTER_LONG_PRESS_ACTIVATE, |                  CLUTTER_LONG_PRESS_ACTIVATE, | ||||||
|                  &result); |                  &result); | ||||||
|  |  | ||||||
|  |   if (priv->capture_id != 0) | ||||||
|  |     { | ||||||
|  |       g_signal_handler_disconnect (priv->stage, priv->capture_id); | ||||||
|  |       priv->capture_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   click_action_set_pressed (action, FALSE); |   click_action_set_pressed (action, FALSE); | ||||||
|   click_action_set_held (action, FALSE); |   click_action_set_held (action, FALSE); | ||||||
|  |  | ||||||
| @@ -202,8 +219,7 @@ click_action_emit_long_press (gpointer data) | |||||||
| static inline void | static inline void | ||||||
| click_action_query_long_press (ClutterClickAction *action) | click_action_query_long_press (ClutterClickAction *action) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|   ClutterActor *actor; |   ClutterActor *actor; | ||||||
|   gboolean result = FALSE; |   gboolean result = FALSE; | ||||||
|   gint timeout; |   gint timeout; | ||||||
| @@ -228,7 +244,6 @@ click_action_query_long_press (ClutterClickAction *action) | |||||||
|  |  | ||||||
|   if (result) |   if (result) | ||||||
|     { |     { | ||||||
|       g_clear_handle_id (&priv->long_press_id, g_source_remove); |  | ||||||
|       priv->long_press_id = |       priv->long_press_id = | ||||||
|         clutter_threads_add_timeout (timeout, |         clutter_threads_add_timeout (timeout, | ||||||
|                                      click_action_emit_long_press, |                                      click_action_emit_long_press, | ||||||
| @@ -239,8 +254,7 @@ click_action_query_long_press (ClutterClickAction *action) | |||||||
| static inline void | static inline void | ||||||
| click_action_cancel_long_press (ClutterClickAction *action) | click_action_cancel_long_press (ClutterClickAction *action) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|  |  | ||||||
|   if (priv->long_press_id != 0) |   if (priv->long_press_id != 0) | ||||||
|     { |     { | ||||||
| @@ -249,7 +263,8 @@ click_action_cancel_long_press (ClutterClickAction *action) | |||||||
|  |  | ||||||
|       actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); |       actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); | ||||||
|  |  | ||||||
|       g_clear_handle_id (&priv->long_press_id, g_source_remove); |       g_source_remove (priv->long_press_id); | ||||||
|  |       priv->long_press_id = 0; | ||||||
|  |  | ||||||
|       g_signal_emit (action, click_signals[LONG_PRESS], 0, |       g_signal_emit (action, click_signals[LONG_PRESS], 0, | ||||||
|                      actor, |                      actor, | ||||||
| @@ -258,66 +273,33 @@ click_action_cancel_long_press (ClutterClickAction *action) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| static inline gboolean |  | ||||||
| event_within_drag_threshold (ClutterClickAction *click_action, |  | ||||||
|                              const ClutterEvent *event) |  | ||||||
| { |  | ||||||
|   ClutterClickActionPrivate *priv = |  | ||||||
|     clutter_click_action_get_instance_private (click_action); |  | ||||||
|   float motion_x, motion_y; |  | ||||||
|   float delta_x, delta_y; |  | ||||||
|  |  | ||||||
|   clutter_event_get_coords (event, &motion_x, &motion_y); |  | ||||||
|  |  | ||||||
|   delta_x = ABS (motion_x - priv->press_x); |  | ||||||
|   delta_y = ABS (motion_y - priv->press_y); |  | ||||||
|  |  | ||||||
|   return delta_x <= priv->drag_threshold && delta_y <= priv->drag_threshold; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static gboolean | static gboolean | ||||||
| clutter_click_action_handle_event (ClutterAction      *action, | on_event (ClutterActor       *actor, | ||||||
|                                    const ClutterEvent *event) |           ClutterEvent       *event, | ||||||
|  |           ClutterClickAction *action) | ||||||
| { | { | ||||||
|   ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (action); |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|   ClutterClickActionPrivate *priv = |  | ||||||
|     clutter_click_action_get_instance_private (click_action); |  | ||||||
|   ClutterActor *actor = |  | ||||||
|     clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); |  | ||||||
|   gboolean has_button = TRUE; |   gboolean has_button = TRUE; | ||||||
|   ClutterModifierType modifier_state; |  | ||||||
|   ClutterActor *target; |  | ||||||
|  |  | ||||||
|   if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action))) |   if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action))) | ||||||
|     return CLUTTER_EVENT_PROPAGATE; |     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)) |   switch (clutter_event_type (event)) | ||||||
|     { |     { | ||||||
|     case CLUTTER_TOUCH_BEGIN: |     case CLUTTER_TOUCH_BEGIN: | ||||||
|       has_button = FALSE; |       has_button = FALSE; | ||||||
|  |  | ||||||
|       G_GNUC_FALLTHROUGH; |  | ||||||
|     case CLUTTER_BUTTON_PRESS: |     case CLUTTER_BUTTON_PRESS: | ||||||
|  |       if (has_button && clutter_event_get_click_count (event) != 1) | ||||||
|  |         return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|       if (priv->is_held) |       if (priv->is_held) | ||||||
|         return CLUTTER_EVENT_STOP; |         return CLUTTER_EVENT_STOP; | ||||||
|  |  | ||||||
|       target = clutter_stage_get_device_actor (CLUTTER_STAGE (clutter_actor_get_stage (actor)), |       if (!clutter_actor_contains (actor, clutter_event_get_source (event))) | ||||||
|                                                clutter_event_get_device (event), |  | ||||||
|                                                clutter_event_get_event_sequence (event)); |  | ||||||
|  |  | ||||||
|       if (!clutter_actor_contains (actor, target)) |  | ||||||
|         return CLUTTER_EVENT_PROPAGATE; |         return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|       priv->press_button = has_button ? clutter_event_get_button (event) : 0; |       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->press_sequence = clutter_event_get_event_sequence (event); | ||||||
|       priv->modifier_state = clutter_event_get_state (event); |       priv->modifier_state = clutter_event_get_state (event); | ||||||
|       clutter_event_get_coords (event, &priv->press_x, &priv->press_y); |       clutter_event_get_coords (event, &priv->press_x, &priv->press_y); | ||||||
| @@ -336,47 +318,74 @@ clutter_click_action_handle_event (ClutterAction      *action, | |||||||
|       if (priv->stage == NULL) |       if (priv->stage == NULL) | ||||||
|         priv->stage = clutter_actor_get_stage (actor); |         priv->stage = clutter_actor_get_stage (actor); | ||||||
|  |  | ||||||
|       click_action_set_pressed (click_action, TRUE); |       priv->capture_id = g_signal_connect_after (priv->stage, "captured-event", | ||||||
|       click_action_set_held (click_action, TRUE); |                                                  G_CALLBACK (on_captured_event), | ||||||
|       click_action_query_long_press (click_action); |                                                  action); | ||||||
|  |  | ||||||
|  |       click_action_set_pressed (action, TRUE); | ||||||
|  |       click_action_set_held (action, TRUE); | ||||||
|  |       click_action_query_long_press (action); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case CLUTTER_ENTER: |     case CLUTTER_ENTER: | ||||||
|       click_action_set_pressed (click_action, priv->is_held); |       click_action_set_pressed (action, priv->is_held); | ||||||
|       return CLUTTER_EVENT_PROPAGATE; |  | ||||||
|  |  | ||||||
|     case CLUTTER_LEAVE: |  | ||||||
|       click_action_set_pressed (click_action, FALSE); |  | ||||||
|       click_action_cancel_long_press (click_action); |  | ||||||
|       return CLUTTER_EVENT_PROPAGATE; |  | ||||||
|  |  | ||||||
|     case CLUTTER_TOUCH_CANCEL: |  | ||||||
|       clutter_click_action_release (click_action); |  | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|  |     case CLUTTER_LEAVE: | ||||||
|  |       click_action_set_pressed (action, priv->is_held); | ||||||
|  |       click_action_cancel_long_press (action); | ||||||
|  |       break; | ||||||
|  |  | ||||||
|  |     default: | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   return CLUTTER_EVENT_PROPAGATE; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static gboolean | ||||||
|  | on_captured_event (ClutterActor       *stage, | ||||||
|  |                    ClutterEvent       *event, | ||||||
|  |                    ClutterClickAction *action) | ||||||
|  | { | ||||||
|  |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|  |   ClutterActor *actor; | ||||||
|  |   ClutterModifierType modifier_state; | ||||||
|  |   gboolean has_button = TRUE; | ||||||
|  |  | ||||||
|  |   actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); | ||||||
|  |  | ||||||
|  |   switch (clutter_event_type (event)) | ||||||
|  |     { | ||||||
|     case CLUTTER_TOUCH_END: |     case CLUTTER_TOUCH_END: | ||||||
|       has_button = FALSE; |       has_button = FALSE; | ||||||
|  |  | ||||||
|       G_GNUC_FALLTHROUGH; |  | ||||||
|     case CLUTTER_BUTTON_RELEASE: |     case CLUTTER_BUTTON_RELEASE: | ||||||
|       if (!priv->is_held) |       if (!priv->is_held) | ||||||
|         return CLUTTER_EVENT_PROPAGATE; |         return CLUTTER_EVENT_STOP; | ||||||
|  |  | ||||||
|       if ((has_button && clutter_event_get_button (event) != priv->press_button) || |       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) |           clutter_event_get_event_sequence (event) != priv->press_sequence) | ||||||
|         return CLUTTER_EVENT_PROPAGATE; |         return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|       click_action_set_held (click_action, FALSE); |       click_action_set_held (action, FALSE); | ||||||
|       click_action_cancel_long_press (click_action); |       click_action_cancel_long_press (action); | ||||||
|  |  | ||||||
|       g_clear_handle_id (&priv->long_press_id, g_source_remove); |       /* disconnect the capture */ | ||||||
|  |       if (priv->capture_id != 0) | ||||||
|  |         { | ||||||
|  |           g_signal_handler_disconnect (priv->stage, priv->capture_id); | ||||||
|  |           priv->capture_id = 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|       target = clutter_stage_get_device_actor (CLUTTER_STAGE (clutter_actor_get_stage (actor)), |       if (priv->long_press_id != 0) | ||||||
|                                                clutter_event_get_device (event), |         { | ||||||
|                                                clutter_event_get_event_sequence (event)); |           g_source_remove (priv->long_press_id); | ||||||
|  |           priv->long_press_id = 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|       if (!clutter_actor_contains (actor, target)) |       if (!clutter_actor_contains (actor, clutter_event_get_source (event))) | ||||||
|         return CLUTTER_EVENT_PROPAGATE; |         return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|       /* exclude any button-mask so that we can compare |       /* exclude any button-mask so that we can compare | ||||||
| @@ -395,24 +404,31 @@ clutter_click_action_handle_event (ClutterAction      *action, | |||||||
|       if (modifier_state != priv->modifier_state) |       if (modifier_state != priv->modifier_state) | ||||||
|         priv->modifier_state = 0; |         priv->modifier_state = 0; | ||||||
|  |  | ||||||
|       click_action_set_pressed (click_action, FALSE); |       click_action_set_pressed (action, FALSE); | ||||||
|  |       g_signal_emit (action, click_signals[CLICKED], 0, actor); | ||||||
|       if (event_within_drag_threshold (click_action, event)) |  | ||||||
|         g_signal_emit (click_action, click_signals[CLICKED], 0, actor); |  | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case CLUTTER_MOTION: |     case CLUTTER_MOTION: | ||||||
|     case CLUTTER_TOUCH_UPDATE: |     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) |             clutter_event_get_event_sequence (event) != priv->press_sequence) | ||||||
|           return CLUTTER_EVENT_PROPAGATE; |           return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|         if (!priv->is_held) |         if (!priv->is_held) | ||||||
|           return CLUTTER_EVENT_PROPAGATE; |           return CLUTTER_EVENT_PROPAGATE; | ||||||
|  |  | ||||||
|         if (!event_within_drag_threshold (click_action, event)) |         clutter_event_get_coords (event, &motion_x, &motion_y); | ||||||
|           clutter_click_action_release (click_action); |  | ||||||
|  |         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; |       break; | ||||||
|  |  | ||||||
| @@ -420,20 +436,7 @@ clutter_click_action_handle_event (ClutterAction      *action, | |||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   return priv->is_held ? CLUTTER_EVENT_STOP : CLUTTER_EVENT_PROPAGATE; |   return CLUTTER_EVENT_STOP; | ||||||
| } |  | ||||||
|  |  | ||||||
| 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); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| @@ -441,39 +444,51 @@ clutter_click_action_set_actor (ClutterActorMeta *meta, | |||||||
|                                 ClutterActor     *actor) |                                 ClutterActor     *actor) | ||||||
| { | { | ||||||
|   ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta); |   ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta); | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = action->priv; | ||||||
|     clutter_click_action_get_instance_private (action); |  | ||||||
|  |  | ||||||
|   g_clear_handle_id (&priv->long_press_id, g_source_remove); |   if (priv->event_id != 0) | ||||||
|  |     { | ||||||
|  |       ClutterActor *old_actor = clutter_actor_meta_get_actor (meta); | ||||||
|  |  | ||||||
|  |       if (old_actor != NULL) | ||||||
|  |         g_signal_handler_disconnect (old_actor, priv->event_id); | ||||||
|  |  | ||||||
|  |       priv->event_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (priv->capture_id != 0) | ||||||
|  |     { | ||||||
|  |       if (priv->stage != NULL) | ||||||
|  |         g_signal_handler_disconnect (priv->stage, priv->capture_id); | ||||||
|  |  | ||||||
|  |       priv->capture_id = 0; | ||||||
|  |       priv->stage = NULL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (priv->long_press_id != 0) | ||||||
|  |     { | ||||||
|  |       g_source_remove (priv->long_press_id); | ||||||
|  |       priv->long_press_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   click_action_set_pressed (action, FALSE); |   click_action_set_pressed (action, FALSE); | ||||||
|   click_action_set_held (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); |   CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void |  | ||||||
| clutter_click_action_set_enabled (ClutterActorMeta *meta, |  | ||||||
|                                   gboolean          is_enabled) |  | ||||||
| { |  | ||||||
|   ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (meta); |  | ||||||
|   ClutterActorMetaClass *parent_class = |  | ||||||
|     CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class); |  | ||||||
|  |  | ||||||
|   if (!is_enabled) |  | ||||||
|     clutter_click_action_release (click_action); |  | ||||||
|  |  | ||||||
|   parent_class->set_enabled (meta, is_enabled); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_click_action_set_property (GObject      *gobject, | clutter_click_action_set_property (GObject      *gobject, | ||||||
|                                    guint         prop_id, |                                    guint         prop_id, | ||||||
|                                    const GValue *value, |                                    const GValue *value, | ||||||
|                                    GParamSpec   *pspec) |                                    GParamSpec   *pspec) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv; | ||||||
|     clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject)); |  | ||||||
|  |  | ||||||
|   switch (prop_id) |   switch (prop_id) | ||||||
|     { |     { | ||||||
| @@ -497,8 +512,7 @@ clutter_click_action_get_property (GObject    *gobject, | |||||||
|                                    GValue     *value, |                                    GValue     *value, | ||||||
|                                    GParamSpec *pspec) |                                    GParamSpec *pspec) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv; | ||||||
|     clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject)); |  | ||||||
|  |  | ||||||
|   switch (prop_id) |   switch (prop_id) | ||||||
|     { |     { | ||||||
| @@ -527,26 +541,38 @@ clutter_click_action_get_property (GObject    *gobject, | |||||||
| static void | static void | ||||||
| clutter_click_action_dispose (GObject *gobject) | clutter_click_action_dispose (GObject *gobject) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv; | ||||||
|     clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject)); |  | ||||||
|  |  | ||||||
|   g_clear_handle_id (&priv->long_press_id, g_source_remove); |   if (priv->event_id) | ||||||
|  |     { | ||||||
|  |       g_signal_handler_disconnect (clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)), | ||||||
|  |                                    priv->event_id); | ||||||
|  |       priv->event_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (priv->capture_id) | ||||||
|  |     { | ||||||
|  |       g_signal_handler_disconnect (priv->stage, priv->capture_id); | ||||||
|  |       priv->capture_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (priv->long_press_id) | ||||||
|  |     { | ||||||
|  |       g_source_remove (priv->long_press_id); | ||||||
|  |       priv->long_press_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject); |   G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_click_action_class_init (ClutterClickActionClass *klass) | clutter_click_action_class_init (ClutterClickActionClass *klass) | ||||||
| { | { | ||||||
|   GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |   GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | ||||||
|   ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_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_actor = clutter_click_action_set_actor; | ||||||
|   meta_class->set_enabled = clutter_click_action_set_enabled; |  | ||||||
|  |  | ||||||
|   gobject_class->dispose = clutter_click_action_dispose; |   gobject_class->dispose = clutter_click_action_dispose; | ||||||
|   gobject_class->set_property = clutter_click_action_set_property; |   gobject_class->set_property = clutter_click_action_set_property; | ||||||
| @@ -556,9 +582,13 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * ClutterClickAction:pressed: |    * ClutterClickAction:pressed: | ||||||
|    * |    * | ||||||
|    * Whether the clickable actor should be in "pressed" state |    * Whether the clickable actor should be in "pressed" state | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_PRESSED] = |   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, |                           FALSE, | ||||||
|                           CLUTTER_PARAM_READABLE); |                           CLUTTER_PARAM_READABLE); | ||||||
|  |  | ||||||
| @@ -566,9 +596,13 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * ClutterClickAction:held: |    * ClutterClickAction:held: | ||||||
|    * |    * | ||||||
|    * Whether the clickable actor has the pointer grabbed |    * Whether the clickable actor has the pointer grabbed | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_HELD] = |   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, |                           FALSE, | ||||||
|                           CLUTTER_PARAM_READABLE); |                           CLUTTER_PARAM_READABLE); | ||||||
|  |  | ||||||
| @@ -579,10 +613,14 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * press gesture, in milliseconds. |    * press gesture, in milliseconds. | ||||||
|    * |    * | ||||||
|    * A value of -1 will make the #ClutterClickAction use the value of |    * 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] = |   obj_props[PROP_LONG_PRESS_DURATION] = | ||||||
|     g_param_spec_int ("long-press-duration", NULL, NULL, |     g_param_spec_int ("long-press-duration", | ||||||
|  |                       P_("Long Press Duration"), | ||||||
|  |                       P_("The minimum duration of a long press to recognize the gesture"), | ||||||
|                       -1, G_MAXINT, |                       -1, G_MAXINT, | ||||||
|                       -1, |                       -1, | ||||||
|                       CLUTTER_PARAM_READWRITE); |                       CLUTTER_PARAM_READWRITE); | ||||||
| @@ -594,10 +632,14 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * a long press gesture is cancelled, in pixels. |    * a long press gesture is cancelled, in pixels. | ||||||
|    * |    * | ||||||
|    * A value of -1 will make the #ClutterClickAction use the value of |    * 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] = |   obj_props[PROP_LONG_PRESS_THRESHOLD] = | ||||||
|     g_param_spec_int ("long-press-threshold", NULL, NULL, |     g_param_spec_int ("long-press-threshold", | ||||||
|  |                       P_("Long Press Threshold"), | ||||||
|  |                       P_("The maximum threshold before a long press is cancelled"), | ||||||
|                       -1, G_MAXINT, |                       -1, G_MAXINT, | ||||||
|                       -1, |                       -1, | ||||||
|                       CLUTTER_PARAM_READWRITE); |                       CLUTTER_PARAM_READWRITE); | ||||||
| @@ -611,16 +653,19 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * @action: the #ClutterClickAction that emitted the signal |    * @action: the #ClutterClickAction that emitted the signal | ||||||
|    * @actor: the #ClutterActor attached to the @action |    * @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 |    * a #ClutterClickAction has been applied should respond to a | ||||||
|    * pointer button press and release events |    * pointer button press and release events | ||||||
|  |    * | ||||||
|  |    * Since: 1.4 | ||||||
|    */ |    */ | ||||||
|   click_signals[CLICKED] = |   click_signals[CLICKED] = | ||||||
|     g_signal_new (I_("clicked"), |     g_signal_new (I_("clicked"), | ||||||
|                   G_TYPE_FROM_CLASS (klass), |                   G_TYPE_FROM_CLASS (klass), | ||||||
|                   G_SIGNAL_RUN_LAST, |                   G_SIGNAL_RUN_LAST, | ||||||
|                   G_STRUCT_OFFSET (ClutterClickActionClass, clicked), |                   G_STRUCT_OFFSET (ClutterClickActionClass, clicked), | ||||||
|                   NULL, NULL, NULL, |                   NULL, NULL, | ||||||
|  |                   _clutter_marshal_VOID__OBJECT, | ||||||
|                   G_TYPE_NONE, 1, |                   G_TYPE_NONE, 1, | ||||||
|                   CLUTTER_TYPE_ACTOR); |                   CLUTTER_TYPE_ACTOR); | ||||||
|  |  | ||||||
| @@ -630,7 +675,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * @actor: the #ClutterActor attached to the @action |    * @actor: the #ClutterActor attached to the @action | ||||||
|    * @state: the long press state |    * @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. |    * handling. | ||||||
|    * |    * | ||||||
|    * This signal can be emitted multiple times with different states. |    * This signal can be emitted multiple times with different states. | ||||||
| @@ -644,10 +689,12 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
|    * %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled. |    * %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled. | ||||||
|    * |    * | ||||||
|    * It is possible to forcibly cancel a long press detection using |    * 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 |    * Return value: Only the %CLUTTER_LONG_PRESS_QUERY state uses the | ||||||
|    *   returned value of the handler; other states will ignore it |    *   returned value of the handler; other states will ignore it | ||||||
|  |    * | ||||||
|  |    * Since: 1.8 | ||||||
|    */ |    */ | ||||||
|   click_signals[LONG_PRESS] = |   click_signals[LONG_PRESS] = | ||||||
|     g_signal_new (I_("long-press"), |     g_signal_new (I_("long-press"), | ||||||
| @@ -664,11 +711,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | |||||||
| static void | static void | ||||||
| clutter_click_action_init (ClutterClickAction *self) | clutter_click_action_init (ClutterClickAction *self) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv = |   self->priv = clutter_click_action_get_instance_private (self); | ||||||
|     clutter_click_action_get_instance_private (self); |   self->priv->long_press_threshold = -1; | ||||||
|  |   self->priv->long_press_duration = -1; | ||||||
|   priv->long_press_threshold = -1; |  | ||||||
|   priv->long_press_duration = -1; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -677,6 +722,8 @@ clutter_click_action_init (ClutterClickAction *self) | |||||||
|  * Creates a new #ClutterClickAction instance |  * Creates a new #ClutterClickAction instance | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #ClutterClickAction |  * Return value: the newly created #ClutterClickAction | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| ClutterAction * | ClutterAction * | ||||||
| clutter_click_action_new (void) | clutter_click_action_new (void) | ||||||
| @@ -689,13 +736,15 @@ clutter_click_action_new (void) | |||||||
|  * @action: a #ClutterClickAction |  * @action: a #ClutterClickAction | ||||||
|  * |  * | ||||||
|  * Emulates a release of the pointer button, which ungrabs the pointer |  * 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 |  * This function will also cancel the long press gesture if one was | ||||||
|  * initiated. |  * initiated. | ||||||
|  * |  * | ||||||
|  * This function is useful to break a grab, for instance after a certain |  * This function is useful to break a grab, for instance after a certain | ||||||
|  * amount of time has passed. |  * amount of time has passed. | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_click_action_release (ClutterClickAction *action) | clutter_click_action_release (ClutterClickAction *action) | ||||||
| @@ -704,11 +753,18 @@ clutter_click_action_release (ClutterClickAction *action) | |||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action)); |   g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action)); | ||||||
|  |  | ||||||
|   priv = clutter_click_action_get_instance_private (action); |   priv = action->priv; | ||||||
|  |  | ||||||
|   if (!priv->is_held) |   if (!priv->is_held) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|  |   /* disconnect the capture */ | ||||||
|  |   if (priv->capture_id != 0) | ||||||
|  |     { | ||||||
|  |       g_signal_handler_disconnect (priv->stage, priv->capture_id); | ||||||
|  |       priv->capture_id = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   click_action_cancel_long_press (action); |   click_action_cancel_long_press (action); | ||||||
|   click_action_set_held (action, FALSE); |   click_action_set_held (action, FALSE); | ||||||
|   click_action_set_pressed (action, FALSE); |   click_action_set_pressed (action, FALSE); | ||||||
| @@ -721,17 +777,15 @@ clutter_click_action_release (ClutterClickAction *action) | |||||||
|  * Retrieves the button that was pressed. |  * Retrieves the button that was pressed. | ||||||
|  * |  * | ||||||
|  * Return value: the button value |  * Return value: the button value | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| guint | guint | ||||||
| clutter_click_action_get_button (ClutterClickAction *action) | clutter_click_action_get_button (ClutterClickAction *action) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0); |   g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0); | ||||||
|  |  | ||||||
|   priv = clutter_click_action_get_instance_private (action); |   return action->priv->press_button; | ||||||
|  |  | ||||||
|   return priv->press_button; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -741,17 +795,15 @@ clutter_click_action_get_button (ClutterClickAction *action) | |||||||
|  * Retrieves the modifier state of the click action. |  * Retrieves the modifier state of the click action. | ||||||
|  * |  * | ||||||
|  * Return value: the modifier state parameter, or 0 |  * Return value: the modifier state parameter, or 0 | ||||||
|  |  * | ||||||
|  |  * Since: 1.6 | ||||||
|  */ |  */ | ||||||
| ClutterModifierType | ClutterModifierType | ||||||
| clutter_click_action_get_state (ClutterClickAction *action) | clutter_click_action_get_state (ClutterClickAction *action) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0); |   g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0); | ||||||
|  |  | ||||||
|   priv = clutter_click_action_get_instance_private (action); |   return action->priv->modifier_state; | ||||||
|  |  | ||||||
|   return priv->modifier_state; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -761,21 +813,19 @@ clutter_click_action_get_state (ClutterClickAction *action) | |||||||
|  * @press_y: (out): return location for the Y coordinate, or %NULL |  * @press_y: (out): return location for the Y coordinate, or %NULL | ||||||
|  * |  * | ||||||
|  * Retrieves the screen coordinates of the button press. |  * Retrieves the screen coordinates of the button press. | ||||||
|  |  * | ||||||
|  |  * Since: 1.8 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_click_action_get_coords (ClutterClickAction *action, | clutter_click_action_get_coords (ClutterClickAction *action, | ||||||
|                                  gfloat             *press_x, |                                  gfloat             *press_x, | ||||||
|                                  gfloat             *press_y) |                                  gfloat             *press_y) | ||||||
| { | { | ||||||
|   ClutterClickActionPrivate *priv; |  | ||||||
|  |  | ||||||
|   g_return_if_fail (CLUTTER_IS_ACTION (action)); |   g_return_if_fail (CLUTTER_IS_ACTION (action)); | ||||||
|  |  | ||||||
|   priv = clutter_click_action_get_instance_private (action); |  | ||||||
|  |  | ||||||
|   if (press_x != NULL) |   if (press_x != NULL) | ||||||
|     *press_x = priv->press_x; |     *press_x = action->priv->press_x; | ||||||
|  |  | ||||||
|   if (press_y != NULL) |   if (press_y != NULL) | ||||||
|     *press_y = priv->press_y; |     *press_y = action->priv->press_y; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -25,24 +25,44 @@ | |||||||
|  *   Colin Walters <walters@verbum.org> |  *   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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-action.h" | #include <clutter/clutter-action.h> | ||||||
| #include "clutter/clutter-event.h" | #include <clutter/clutter-event.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| #define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ()) | #define CLUTTER_TYPE_CLICK_ACTION               (clutter_click_action_get_type ()) | ||||||
|  | #define CLUTTER_CLICK_ACTION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickAction)) | ||||||
|  | #define CLUTTER_IS_CLICK_ACTION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLICK_ACTION)) | ||||||
|  | #define CLUTTER_CLICK_ACTION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass)) | ||||||
|  | #define CLUTTER_IS_CLICK_ACTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLICK_ACTION)) | ||||||
|  | #define CLUTTER_CLICK_ACTION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass)) | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | typedef struct _ClutterClickAction              ClutterClickAction; | ||||||
| G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action, | typedef struct _ClutterClickActionPrivate       ClutterClickActionPrivate; | ||||||
|                           CLUTTER, CLICK_ACTION, ClutterAction); | typedef struct _ClutterClickActionClass         ClutterClickActionClass; | ||||||
|  |  | ||||||
| typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate; | /** | ||||||
|  |  * ClutterClickAction: | ||||||
|  |  * | ||||||
|  |  * The #ClutterClickAction structure contains | ||||||
|  |  * only private data and should be accessed using the provided API | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  |  */ | ||||||
|  | struct _ClutterClickAction | ||||||
|  | { | ||||||
|  |   /*< private >*/ | ||||||
|  |   ClutterAction parent_instance; | ||||||
|  |  | ||||||
|  |   ClutterClickActionPrivate *priv; | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterClickActionClass: |  * ClutterClickActionClass: | ||||||
| @@ -51,6 +71,8 @@ typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate; | |||||||
|  * |  * | ||||||
|  * The #ClutterClickActionClass structure |  * The #ClutterClickActionClass structure | ||||||
|  * contains only private data |  * contains only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.4 | ||||||
|  */ |  */ | ||||||
| struct _ClutterClickActionClass | struct _ClutterClickActionClass | ||||||
| { | { | ||||||
| @@ -64,21 +86,35 @@ struct _ClutterClickActionClass | |||||||
|   gboolean (* long_press) (ClutterClickAction    *action, |   gboolean (* long_press) (ClutterClickAction    *action, | ||||||
|                            ClutterActor          *actor, |                            ClutterActor          *actor, | ||||||
|                            ClutterLongPressState  state); |                            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 | CLUTTER_AVAILABLE_IN_1_4 | ||||||
|  | GType clutter_click_action_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
|  | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterAction *        clutter_click_action_new        (void); | ClutterAction *        clutter_click_action_new        (void); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| guint                  clutter_click_action_get_button (ClutterClickAction *action); | guint                  clutter_click_action_get_button (ClutterClickAction *action); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| ClutterModifierType    clutter_click_action_get_state  (ClutterClickAction *action); | ClutterModifierType    clutter_click_action_get_state  (ClutterClickAction *action); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_8 | ||||||
| void                   clutter_click_action_get_coords (ClutterClickAction *action, | void                   clutter_click_action_get_coords (ClutterClickAction *action, | ||||||
|                                                         gfloat             *press_x, |                                                         gfloat             *press_x, | ||||||
|                                                         gfloat             *press_y); |                                                         gfloat             *press_y); | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_4 | ||||||
| void                   clutter_click_action_release    (ClutterClickAction *action); | void                   clutter_click_action_release    (ClutterClickAction *action); | ||||||
|  |  | ||||||
| G_END_DECLS | G_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_CLICK_ACTION_H__ */ | ||||||
|   | |||||||
| @@ -22,9 +22,8 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ClutterClone: |  * SECTION:clutter-clone | ||||||
|  *  |  * @short_description: An actor that displays a clone of a source actor | ||||||
|  * An actor that displays a clone of a source actor |  | ||||||
|  * |  * | ||||||
|  * #ClutterClone is a #ClutterActor which draws with the paint |  * #ClutterClone is a #ClutterActor which draws with the paint | ||||||
|  * function of another actor, scaled to fit its own allocation. |  * function of another actor, scaled to fit its own allocation. | ||||||
| @@ -34,25 +33,27 @@ | |||||||
|  * Unlike clutter_texture_new_from_actor(), #ClutterClone does not require |  * Unlike clutter_texture_new_from_actor(), #ClutterClone does not require | ||||||
|  * the presence of support for FBOs in the underlying GL or GLES |  * the presence of support for FBOs in the underlying GL or GLES | ||||||
|  * implementation. |  * implementation. | ||||||
|  |  * | ||||||
|  |  * #ClutterClone is available since Clutter 1.0 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "clutter/clutter-build-config.h" | #ifdef HAVE_CONFIG_H | ||||||
|  | #include "clutter-build-config.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor-private.h" | #define CLUTTER_ENABLE_EXPERIMENTAL_API | ||||||
| #include "clutter/clutter-clone.h" | #include "clutter-actor-private.h" | ||||||
| #include "clutter/clutter-debug.h" | #include "clutter-clone.h" | ||||||
| #include "clutter/clutter-main.h" | #include "clutter-debug.h" | ||||||
| #include "clutter/clutter-paint-volume-private.h" | #include "clutter-main.h" | ||||||
| #include "clutter/clutter-private.h" | #include "clutter-paint-volume-private.h" | ||||||
|  | #include "clutter-private.h" | ||||||
|  |  | ||||||
| #include "cogl/cogl.h" | #include "cogl/cogl.h" | ||||||
|  |  | ||||||
| struct _ClutterClonePrivate | struct _ClutterClonePrivate | ||||||
| { | { | ||||||
|   ClutterActor *clone_source; |   ClutterActor *clone_source; | ||||||
|   float x_scale, y_scale; |  | ||||||
|  |  | ||||||
|   gulong source_destroy_id; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR) | G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR) | ||||||
| @@ -119,22 +120,40 @@ clutter_clone_get_preferred_height (ClutterActor *self, | |||||||
| } | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_clone_apply_transform (ClutterActor      *self, | clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix) | ||||||
|                                graphene_matrix_t *matrix) |  | ||||||
| { | { | ||||||
|   ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; |   ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; | ||||||
|  |   ClutterActorBox box, source_box; | ||||||
|  |   gfloat x_scale, y_scale; | ||||||
|  |  | ||||||
|  |   /* First chain up and apply all the standard ClutterActor | ||||||
|   if (priv->clone_source) |    * transformations... */ | ||||||
|     graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f); |  | ||||||
|  |  | ||||||
|   CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self, |   CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self, | ||||||
|                                                                      matrix); |                                                                      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 | static void | ||||||
| clutter_clone_paint (ClutterActor        *actor, | clutter_clone_paint (ClutterActor *actor) | ||||||
|                      ClutterPaintContext *paint_context) |  | ||||||
| { | { | ||||||
|   ClutterClone *self = CLUTTER_CLONE (actor); |   ClutterClone *self = CLUTTER_CLONE (actor); | ||||||
|   ClutterClonePrivate *priv = self->priv; |   ClutterClonePrivate *priv = self->priv; | ||||||
| @@ -171,7 +190,7 @@ clutter_clone_paint (ClutterActor        *actor, | |||||||
|   if (clutter_actor_is_realized (priv->clone_source)) |   if (clutter_actor_is_realized (priv->clone_source)) | ||||||
|     { |     { | ||||||
|       _clutter_actor_push_clone_paint (); |       _clutter_actor_push_clone_paint (); | ||||||
|       clutter_actor_paint (priv->clone_source, paint_context); |       clutter_actor_paint (priv->clone_source); | ||||||
|       _clutter_actor_pop_clone_paint (); |       _clutter_actor_pop_clone_paint (); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -194,7 +213,7 @@ clutter_clone_get_paint_volume (ClutterActor       *actor, | |||||||
|   if (priv->clone_source == NULL) |   if (priv->clone_source == NULL) | ||||||
|     return TRUE; |     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... */ |    * the clones volume... */ | ||||||
|   source_volume = clutter_actor_get_paint_volume (priv->clone_source); |   source_volume = clutter_actor_get_paint_volume (priv->clone_source); | ||||||
|   if (source_volume == NULL) |   if (source_volume == NULL) | ||||||
| @@ -221,51 +240,19 @@ clutter_clone_has_overlaps (ClutterActor *actor) | |||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_clone_allocate (ClutterActor           *self, | clutter_clone_allocate (ClutterActor           *self, | ||||||
|                         const ClutterActorBox  *box) |                         const ClutterActorBox  *box, | ||||||
|  |                         ClutterAllocationFlags  flags) | ||||||
| { | { | ||||||
|   ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; |   ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; | ||||||
|   ClutterActorClass *parent_class; |   ClutterActorClass *parent_class; | ||||||
|   ClutterActorBox source_box; |  | ||||||
|   float x_scale, y_scale; |  | ||||||
|  |  | ||||||
|   /* chain up */ |   /* chain up */ | ||||||
|   parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class); |   parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class); | ||||||
|   parent_class->allocate (self, box); |   parent_class->allocate (self, box, flags); | ||||||
|  |  | ||||||
|   if (priv->clone_source == NULL) |   if (priv->clone_source == NULL) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   /* ClutterActor delays allocating until the actor is shown; however |  | ||||||
|    * we cannot paint it correctly in that case, so force an allocation. |  | ||||||
|    */ |  | ||||||
|   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)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| #if 0 | #if 0 | ||||||
|   /* XXX - this is wrong: ClutterClone cannot clone unparented |   /* XXX - this is wrong: ClutterClone cannot clone unparented | ||||||
|    * actors, as it will break all invariants |    * actors, as it will break all invariants | ||||||
| @@ -279,7 +266,7 @@ clutter_clone_allocate (ClutterActor           *self, | |||||||
|    * paint cycle, we can safely give it as much size as it requires |    * paint cycle, we can safely give it as much size as it requires | ||||||
|    */ |    */ | ||||||
|   if (clutter_actor_get_parent (priv->clone_source) == NULL) |   if (clutter_actor_get_parent (priv->clone_source) == NULL) | ||||||
|     clutter_actor_allocate_preferred_size (priv->clone_source); |     clutter_actor_allocate_preferred_size (priv->clone_source, flags); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -353,9 +340,13 @@ clutter_clone_class_init (ClutterCloneClass *klass) | |||||||
|    * ClutterClone:source: |    * ClutterClone:source: | ||||||
|    * |    * | ||||||
|    * This property specifies the source actor being cloned. |    * This property specifies the source actor being cloned. | ||||||
|  |    * | ||||||
|  |    * Since: 1.0 | ||||||
|    */ |    */ | ||||||
|   obj_props[PROP_SOURCE] = |   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, |                          CLUTTER_TYPE_ACTOR, | ||||||
|                          G_PARAM_CONSTRUCT | |                          G_PARAM_CONSTRUCT | | ||||||
|                          CLUTTER_PARAM_READWRITE); |                          CLUTTER_PARAM_READWRITE); | ||||||
| @@ -367,9 +358,6 @@ static void | |||||||
| clutter_clone_init (ClutterClone *self) | clutter_clone_init (ClutterClone *self) | ||||||
| { | { | ||||||
|   self->priv = clutter_clone_get_instance_private (self); |   self->priv = clutter_clone_get_instance_private (self); | ||||||
|  |  | ||||||
|   self->priv->x_scale = 1.f; |  | ||||||
|   self->priv->y_scale = 1.f; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -379,6 +367,8 @@ clutter_clone_init (ClutterClone *self) | |||||||
|  * Creates a new #ClutterActor which clones @source/ |  * Creates a new #ClutterActor which clones @source/ | ||||||
|  * |  * | ||||||
|  * Return value: the newly created #ClutterClone |  * Return value: the newly created #ClutterClone | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_clone_new (ClutterActor *source) | clutter_clone_new (ClutterActor *source) | ||||||
| @@ -386,13 +376,6 @@ clutter_clone_new (ClutterActor *source) | |||||||
|   return g_object_new (CLUTTER_TYPE_CLONE, "source", source,  NULL); |   return g_object_new (CLUTTER_TYPE_CLONE, "source", source,  NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| static void |  | ||||||
| on_source_destroyed (ClutterActor *source, |  | ||||||
|                      ClutterClone *self) |  | ||||||
| { |  | ||||||
|   clutter_clone_set_source_internal (self, NULL); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| clutter_clone_set_source_internal (ClutterClone *self, | clutter_clone_set_source_internal (ClutterClone *self, | ||||||
| 				   ClutterActor *source) | 				   ClutterActor *source) | ||||||
| @@ -404,7 +387,6 @@ clutter_clone_set_source_internal (ClutterClone *self, | |||||||
|  |  | ||||||
|   if (priv->clone_source != NULL) |   if (priv->clone_source != NULL) | ||||||
|     { |     { | ||||||
|       g_clear_signal_handler (&priv->source_destroy_id, priv->clone_source); |  | ||||||
|       _clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self)); |       _clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self)); | ||||||
|       g_object_unref (priv->clone_source); |       g_object_unref (priv->clone_source); | ||||||
|       priv->clone_source = NULL; |       priv->clone_source = NULL; | ||||||
| @@ -414,8 +396,6 @@ clutter_clone_set_source_internal (ClutterClone *self, | |||||||
|     { |     { | ||||||
|       priv->clone_source = g_object_ref (source); |       priv->clone_source = g_object_ref (source); | ||||||
|       _clutter_actor_attach_clone (priv->clone_source, CLUTTER_ACTOR (self)); |       _clutter_actor_attach_clone (priv->clone_source, CLUTTER_ACTOR (self)); | ||||||
|       priv->source_destroy_id = g_signal_connect (priv->clone_source, "destroy", |  | ||||||
|                                                   G_CALLBACK (on_source_destroyed), self); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SOURCE]); |   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SOURCE]); | ||||||
| @@ -429,6 +409,8 @@ clutter_clone_set_source_internal (ClutterClone *self, | |||||||
|  * @source: (allow-none): a #ClutterActor, or %NULL |  * @source: (allow-none): a #ClutterActor, or %NULL | ||||||
|  * |  * | ||||||
|  * Sets @source as the source actor to be cloned by @self. |  * Sets @source as the source actor to be cloned by @self. | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| void | void | ||||||
| clutter_clone_set_source (ClutterClone *self, | clutter_clone_set_source (ClutterClone *self, | ||||||
| @@ -448,6 +430,8 @@ clutter_clone_set_source (ClutterClone *self, | |||||||
|  * Retrieves the source #ClutterActor being cloned by @self. |  * Retrieves the source #ClutterActor being cloned by @self. | ||||||
|  * |  * | ||||||
|  * Return value: (transfer none): the actor source for the clone |  * Return value: (transfer none): the actor source for the clone | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| ClutterActor * | ClutterActor * | ||||||
| clutter_clone_get_source (ClutterClone *self) | clutter_clone_get_source (ClutterClone *self) | ||||||
|   | |||||||
| @@ -21,13 +21,14 @@ | |||||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #error "Only <clutter/clutter.h> can be included directly." | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "clutter/clutter-actor.h" | #include <clutter/clutter-actor.h> | ||||||
|  |  | ||||||
| G_BEGIN_DECLS | G_BEGIN_DECLS | ||||||
|  |  | ||||||
| @@ -42,6 +43,14 @@ typedef struct _ClutterClone            ClutterClone; | |||||||
| typedef struct _ClutterCloneClass       ClutterCloneClass; | typedef struct _ClutterCloneClass       ClutterCloneClass; | ||||||
| typedef struct _ClutterClonePrivate     ClutterClonePrivate; | 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 | struct _ClutterClone | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
| @@ -54,22 +63,32 @@ struct _ClutterClone | |||||||
|  * ClutterCloneClass: |  * ClutterCloneClass: | ||||||
|  * |  * | ||||||
|  * The #ClutterCloneClass structure contains only private data |  * The #ClutterCloneClass structure contains only private data | ||||||
|  |  * | ||||||
|  |  * Since: 1.0 | ||||||
|  */ |  */ | ||||||
| struct _ClutterCloneClass | struct _ClutterCloneClass | ||||||
| { | { | ||||||
|   /*< private >*/ |   /*< private >*/ | ||||||
|   ClutterActorClass parent_class; |   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 | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| GType clutter_clone_get_type (void) G_GNUC_CONST; | GType clutter_clone_get_type (void) G_GNUC_CONST; | ||||||
|  |  | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| ClutterActor *  clutter_clone_new               (ClutterActor *source); | ClutterActor *  clutter_clone_new               (ClutterActor *source); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| void            clutter_clone_set_source        (ClutterClone *self, | void            clutter_clone_set_source        (ClutterClone *self, | ||||||
|                                                  ClutterActor *source); |                                                  ClutterActor *source); | ||||||
| CLUTTER_EXPORT | CLUTTER_AVAILABLE_IN_1_0 | ||||||
| ClutterActor *  clutter_clone_get_source        (ClutterClone *self); | ClutterActor *  clutter_clone_get_source        (ClutterClone *self); | ||||||
|  |  | ||||||
| G_END_DECLS | 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/>. |  * 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) | #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||||
| #error "Only <clutter/clutter.h> can be included directly." | #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_Aluminium6        (__CLUTTER_COLOR_SYM (ALUMINIUM_6)) | ||||||
|  |  | ||||||
| #define CLUTTER_COLOR_Transparent       (__CLUTTER_COLOR_SYM (TRANSPARENT)) | #define CLUTTER_COLOR_Transparent       (__CLUTTER_COLOR_SYM (TRANSPARENT)) | ||||||
|  |  | ||||||
|  | #endif /* __CLUTTER_COLOR_STATIC_H__ */ | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user