Compare commits
	
		
			275 Commits
		
	
	
		
			3.31.90
			...
			wip/nielsd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					620a9f5193 | ||
| 
						 | 
					0d50a37091 | ||
| 
						 | 
					1ca0fdc928 | ||
| 
						 | 
					23a8ea2821 | ||
| 
						 | 
					ee4bb2240b | ||
| 
						 | 
					81ae886dda | ||
| 
						 | 
					63c40a9711 | ||
| 
						 | 
					8374be46d2 | ||
| 
						 | 
					5d1a87d355 | ||
| 
						 | 
					34312c272b | ||
| 
						 | 
					2b8f5e65b6 | ||
| 
						 | 
					a934fa07b8 | ||
| 
						 | 
					c6d1cf4af4 | ||
| 
						 | 
					8dbe4210b4 | ||
| 
						 | 
					02c99524bf | ||
| 
						 | 
					17d00d49d4 | ||
| 
						 | 
					634f512bb0 | ||
| 
						 | 
					5c009c20ab | ||
| 
						 | 
					535ce00abb | ||
| 
						 | 
					37144f0609 | ||
| 
						 | 
					ab76576340 | ||
| 
						 | 
					09aa82db49 | ||
| 
						 | 
					c95db7c542 | ||
| 
						 | 
					a984622cd1 | ||
| 
						 | 
					156980eff9 | ||
| 
						 | 
					736cac43e9 | ||
| 
						 | 
					3ba79961fe | ||
| 
						 | 
					7718e67f5c | ||
| 
						 | 
					ba8f5a1178 | ||
| 
						 | 
					502da973eb | ||
| 
						 | 
					eccf7b105c | ||
| 
						 | 
					bcee890434 | ||
| 
						 | 
					251fa024c4 | ||
| 
						 | 
					471b61bd14 | ||
| 
						 | 
					7df86fb246 | ||
| 
						 | 
					3f29b47809 | ||
| 
						 | 
					9ab3a02a8a | ||
| 
						 | 
					ca2be8ef5b | ||
| 
						 | 
					1783ea5af1 | ||
| 
						 | 
					862e56f01d | ||
| 
						 | 
					2b9cd50e84 | ||
| 
						 | 
					e71f44dbd6 | ||
| 
						 | 
					c881b4970d | ||
| 
						 | 
					d79f176142 | ||
| 
						 | 
					ce6acf9dca | ||
| 
						 | 
					2a15e5f16a | ||
| 
						 | 
					fb40e2eefb | ||
| 
						 | 
					fc09fa50a5 | ||
| 
						 | 
					48f04c7968 | ||
| 
						 | 
					007297f1a6 | ||
| 
						 | 
					302a171c08 | ||
| 
						 | 
					893e894fff | ||
| 
						 | 
					2aaed7bdfc | ||
| 
						 | 
					249f9a4a2e | ||
| 
						 | 
					68166f33d9 | ||
| 
						 | 
					28954e8271 | ||
| 
						 | 
					22884b0b00 | ||
| 
						 | 
					d2415da0d4 | ||
| 
						 | 
					96f7bf28f1 | ||
| 
						 | 
					db486ad897 | ||
| 
						 | 
					8180927de2 | ||
| 
						 | 
					191c31b0f0 | ||
| 
						 | 
					a94841abf1 | ||
| 
						 | 
					b624e94ab1 | ||
| 
						 | 
					e3f3274bbf | ||
| 
						 | 
					d2ca5cc26b | ||
| 
						 | 
					3de6f7ebfe | ||
| 
						 | 
					38ff01d6d0 | ||
| 
						 | 
					40103d6f41 | ||
| 
						 | 
					ab7ef5f8bf | ||
| 
						 | 
					2c1a951b6e | ||
| 
						 | 
					6ec330ccfa | ||
| 
						 | 
					20c1295a33 | ||
| 
						 | 
					fa4a787386 | ||
| 
						 | 
					85b734fde8 | ||
| 
						 | 
					28419cdedf | ||
| 
						 | 
					3b46a8cd70 | ||
| 
						 | 
					b2d0184c6e | ||
| 
						 | 
					808a75b231 | ||
| 
						 | 
					88e4ff7409 | ||
| 
						 | 
					3cc3b7526c | ||
| 
						 | 
					53b59d8bff | ||
| 
						 | 
					40e7e5d356 | ||
| 
						 | 
					4cae9b5b11 | ||
| 
						 | 
					72aeeb8c37 | ||
| 
						 | 
					7b3dee2d97 | ||
| 
						 | 
					5199c7834d | ||
| 
						 | 
					afe8610b4a | ||
| 
						 | 
					9d49e8abd0 | ||
| 
						 | 
					4043d0b455 | ||
| 
						 | 
					34ee46022e | ||
| 
						 | 
					ee507d9ab2 | ||
| 
						 | 
					28e0a7bfb5 | ||
| 
						 | 
					58f7059ea4 | ||
| 
						 | 
					d15e11bfe7 | ||
| 
						 | 
					1eabaf12da | ||
| 
						 | 
					fe86694ddd | ||
| 
						 | 
					a1969c98cd | ||
| 
						 | 
					47663c7e0f | ||
| 
						 | 
					9843e21fff | ||
| 
						 | 
					5c27bf6a2b | ||
| 
						 | 
					f0b9654deb | ||
| 
						 | 
					a1e325f749 | ||
| 
						 | 
					00b4556051 | ||
| 
						 | 
					86b5247770 | ||
| 
						 | 
					23f31e518e | ||
| 
						 | 
					f580b28a27 | ||
| 
						 | 
					b4f1569640 | ||
| 
						 | 
					f2d7165a52 | ||
| 
						 | 
					1bd3c13fe1 | ||
| 
						 | 
					5d1eccfb6f | ||
| 
						 | 
					c96cf0608d | ||
| 
						 | 
					056c45fe0c | ||
| 
						 | 
					2ac7f7f1e5 | ||
| 
						 | 
					318164779c | ||
| 
						 | 
					7bd33e7b00 | ||
| 
						 | 
					f8d62da2dc | ||
| 
						 | 
					303e02bdac | ||
| 
						 | 
					e2525f286d | ||
| 
						 | 
					9b8510ac56 | ||
| 
						 | 
					8a87e87a05 | ||
| 
						 | 
					9aca31c814 | ||
| 
						 | 
					a555a2c8eb | ||
| 
						 | 
					32504ae917 | ||
| 
						 | 
					80ceeb2848 | ||
| 
						 | 
					1574099449 | ||
| 
						 | 
					efb1ee9730 | ||
| 
						 | 
					a871d56f88 | ||
| 
						 | 
					d83a325f98 | ||
| 
						 | 
					4f72099023 | ||
| 
						 | 
					8856a396fd | ||
| 
						 | 
					b0fb39bb54 | ||
| 
						 | 
					7abceb434d | ||
| 
						 | 
					3e472faf5c | ||
| 
						 | 
					eabb789381 | ||
| 
						 | 
					1f1f49dc79 | ||
| 
						 | 
					3fd0e23ed9 | ||
| 
						 | 
					033a771e8c | ||
| 
						 | 
					6cbaeae64d | ||
| 
						 | 
					6a5772c881 | ||
| 
						 | 
					ed17559f88 | ||
| 
						 | 
					58cc4c2433 | ||
| 
						 | 
					4a65897567 | ||
| 
						 | 
					e0811ce141 | ||
| 
						 | 
					d597449a0e | ||
| 
						 | 
					cbd3ad8585 | ||
| 
						 | 
					3d89b47757 | ||
| 
						 | 
					8b09542fd9 | ||
| 
						 | 
					e5a9e9c93b | ||
| 
						 | 
					a8c972cd6b | ||
| 
						 | 
					9d9d455bba | ||
| 
						 | 
					8bc8dc66f2 | ||
| 
						 | 
					ceb4fe2151 | ||
| 
						 | 
					412d5685ba | ||
| 
						 | 
					baf98bb205 | ||
| 
						 | 
					f2c033b1b4 | ||
| 
						 | 
					4be4d85f84 | ||
| 
						 | 
					c695471475 | ||
| 
						 | 
					97a3b88f25 | ||
| 
						 | 
					1e1cb4961b | ||
| 
						 | 
					e3966882e8 | ||
| 
						 | 
					af3662775e | ||
| 
						 | 
					9234777e36 | ||
| 
						 | 
					02813d74e1 | ||
| 
						 | 
					d3beb3ddb7 | ||
| 
						 | 
					ad5555bf42 | ||
| 
						 | 
					789a3ef029 | ||
| 
						 | 
					3512647419 | ||
| 
						 | 
					42953a50bb | ||
| 
						 | 
					f4c2b69934 | ||
| 
						 | 
					d7ec5d3022 | ||
| 
						 | 
					7442de81bb | ||
| 
						 | 
					f76b3edf9c | ||
| 
						 | 
					c67b0bd7e2 | ||
| 
						 | 
					5356cd3c7d | ||
| 
						 | 
					bc657c9feb | ||
| 
						 | 
					52e074b08a | ||
| 
						 | 
					f1b148e488 | ||
| 
						 | 
					df3d2389a9 | ||
| 
						 | 
					ac7ca3265e | ||
| 
						 | 
					cc07702386 | ||
| 
						 | 
					1f796f1fbf | ||
| 
						 | 
					65312be59d | ||
| 
						 | 
					5a6a602da8 | ||
| 
						 | 
					8d9a5e3c7e | ||
| 
						 | 
					1c6ea5d1db | ||
| 
						 | 
					ca0b6fc3ac | ||
| 
						 | 
					7c3a0d54cc | ||
| 
						 | 
					16a2eab290 | ||
| 
						 | 
					41a69f194d | ||
| 
						 | 
					b77e6f0c98 | ||
| 
						 | 
					b67394dcd1 | ||
| 
						 | 
					f9e33a89fd | ||
| 
						 | 
					39e9e53871 | ||
| 
						 | 
					7f3fda6df6 | ||
| 
						 | 
					73ce5b3a8d | ||
| 
						 | 
					53319a121f | ||
| 
						 | 
					cf2d06e9b9 | ||
| 
						 | 
					d39211f438 | ||
| 
						 | 
					909464f749 | ||
| 
						 | 
					5669b64021 | ||
| 
						 | 
					8f0b4767de | ||
| 
						 | 
					9e75ce2ad7 | ||
| 
						 | 
					c010a3b195 | ||
| 
						 | 
					7c807c6e2a | ||
| 
						 | 
					9a20271f90 | ||
| 
						 | 
					1760a6e560 | ||
| 
						 | 
					8c2b805d88 | ||
| 
						 | 
					2f01418d45 | ||
| 
						 | 
					a76107a19f | ||
| 
						 | 
					6372e3e4db | ||
| 
						 | 
					c80ba819e7 | ||
| 
						 | 
					14c6a347c1 | ||
| 
						 | 
					11bd847896 | ||
| 
						 | 
					870f38542d | ||
| 
						 | 
					c22edeff1f | ||
| 
						 | 
					183de60d91 | ||
| 
						 | 
					176b508029 | ||
| 
						 | 
					9be189daa7 | ||
| 
						 | 
					bf12a2497b | ||
| 
						 | 
					55d168d01a | ||
| 
						 | 
					8a9a78ec8a | ||
| 
						 | 
					803ffc19a4 | ||
| 
						 | 
					ddd2ce3a88 | ||
| 
						 | 
					979e689278 | ||
| 
						 | 
					2c1ab8b3cc | ||
| 
						 | 
					252e64a0ea | ||
| 
						 | 
					d2f1edd6c6 | ||
| 
						 | 
					944a4763f6 | ||
| 
						 | 
					22a296f971 | ||
| 
						 | 
					ef2153739c | ||
| 
						 | 
					9e1c8e2c22 | ||
| 
						 | 
					fca0e6abb1 | ||
| 
						 | 
					6975c8b424 | ||
| 
						 | 
					f4f823f238 | ||
| 
						 | 
					1c67260bd4 | ||
| 
						 | 
					79f90c147c | ||
| 
						 | 
					4e751a3b58 | ||
| 
						 | 
					1c2e8fcf06 | ||
| 
						 | 
					00ca387ec7 | ||
| 
						 | 
					5688f1cf6e | ||
| 
						 | 
					7bd668e6d0 | ||
| 
						 | 
					1dc602e289 | ||
| 
						 | 
					ec518c4f24 | ||
| 
						 | 
					0d9295523e | ||
| 
						 | 
					a4443885a3 | ||
| 
						 | 
					ef8f2876e3 | ||
| 
						 | 
					75071aba68 | ||
| 
						 | 
					a81435ab5f | ||
| 
						 | 
					6fe46cac60 | ||
| 
						 | 
					c3b9ef7bf5 | ||
| 
						 | 
					b70c0eb9a5 | ||
| 
						 | 
					f3dd97e67b | ||
| 
						 | 
					77fb0a0003 | ||
| 
						 | 
					58d2a674c4 | ||
| 
						 | 
					9e2ed4104d | ||
| 
						 | 
					3f9b4a1ab5 | ||
| 
						 | 
					2aa0ec004a | ||
| 
						 | 
					f798912cbd | ||
| 
						 | 
					3bf80a967c | ||
| 
						 | 
					6c3b0cfc36 | ||
| 
						 | 
					43633d6b2f | ||
| 
						 | 
					fdd531f307 | ||
| 
						 | 
					70c45f8941 | ||
| 
						 | 
					b82fa2c610 | ||
| 
						 | 
					eaacbb3289 | ||
| 
						 | 
					54fdd633fe | ||
| 
						 | 
					29ed84e921 | ||
| 
						 | 
					d587fc1ef4 | ||
| 
						 | 
					285d717ceb | ||
| 
						 | 
					616a149917 | ||
| 
						 | 
					f578c4daaa | ||
| 
						 | 
					830495b7c6 | ||
| 
						 | 
					4d02f68057 | ||
| 
						 | 
					31c5a0009f | 
@@ -1,9 +1,19 @@
 | 
			
		||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
 | 
			
		||||
 | 
			
		||||
stages:
 | 
			
		||||
 - review
 | 
			
		||||
 - build
 | 
			
		||||
 - test
 | 
			
		||||
 | 
			
		||||
check-commit-log:
 | 
			
		||||
  stage: review
 | 
			
		||||
  variables:
 | 
			
		||||
    GIT_DEPTH: "100"
 | 
			
		||||
  script:
 | 
			
		||||
    - ./.gitlab-ci/check-commit-log.sh
 | 
			
		||||
  only:
 | 
			
		||||
    - merge_requests
 | 
			
		||||
 | 
			
		||||
build-mutter:
 | 
			
		||||
  stage: build
 | 
			
		||||
  script:
 | 
			
		||||
@@ -14,20 +24,27 @@ build-mutter:
 | 
			
		||||
    expire_in: 1 day
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
  only:
 | 
			
		||||
    - merge_requests
 | 
			
		||||
    - /^.*$/
 | 
			
		||||
 | 
			
		||||
test-mutter:
 | 
			
		||||
  stage: test
 | 
			
		||||
  dependencies:
 | 
			
		||||
    - build-mutter
 | 
			
		||||
  artifacts:
 | 
			
		||||
    paths:
 | 
			
		||||
      - build
 | 
			
		||||
  variables:
 | 
			
		||||
    XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
 | 
			
		||||
    GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
 | 
			
		||||
  script:
 | 
			
		||||
    - mkdir -m 700 $XDG_RUNTIME_DIR
 | 
			
		||||
    - glib-compile-schemas $GSETTINGS_SCHEMA_DIR
 | 
			
		||||
    - >
 | 
			
		||||
      dbus-run-session -- xvfb-run -s '+iglx -noreset'
 | 
			
		||||
      meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --wrap catchsegv
 | 
			
		||||
    - bash -x ./.gitlab-ci/run-tests.sh
 | 
			
		||||
  only:
 | 
			
		||||
    - merge_requests
 | 
			
		||||
    - /^.*$/
 | 
			
		||||
  artifacts:
 | 
			
		||||
    reports:
 | 
			
		||||
      junit: "build/${CI_JOB_NAME}-report.xml"
 | 
			
		||||
    name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
 | 
			
		||||
    when: always
 | 
			
		||||
    paths:
 | 
			
		||||
      - "build/meson-logs"
 | 
			
		||||
      - "build/${CI_JOB_NAME}-report.xml"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										57
									
								
								.gitlab-ci/check-commit-log.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								.gitlab-ci/check-commit-log.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
 | 
			
		||||
  echo Cannot review non-merge request
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
 | 
			
		||||
 | 
			
		||||
branch_point=$(git merge-base HEAD FETCH_HEAD)
 | 
			
		||||
 | 
			
		||||
commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
 | 
			
		||||
 | 
			
		||||
if [ -z "$commits" ]; then
 | 
			
		||||
  echo Commit range empty
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
function commit_message_has_url() {
 | 
			
		||||
  commit=$1
 | 
			
		||||
  commit_message=$(git show -s --format='format:%b' $commit)
 | 
			
		||||
  echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
 | 
			
		||||
  return $?
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function commit_message_subject_is_compliant() {
 | 
			
		||||
  commit=$1
 | 
			
		||||
  commit_message_subject=$(git show -s --format='format:%s' $commit)
 | 
			
		||||
 | 
			
		||||
  if echo "$commit_message_subject" | grep -qe "\(^meta-\|^Meta\)"; then
 | 
			
		||||
    echo " - message subject should not be prefixed with 'meta-' or 'Meta'"
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if echo "$commit_message_subject" | grep -qe "\.[ch]:"; then
 | 
			
		||||
    echo " - message subject prefix should not include .c, .h, etc."
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
for commit in $commits; do
 | 
			
		||||
  commit_short=$(echo $commit | cut -c -8)
 | 
			
		||||
 | 
			
		||||
  if ! commit_message_has_url $commit; then
 | 
			
		||||
    echo "Missing merge request or issue URL on commit $commit_short"
 | 
			
		||||
    exit 1
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  errors=$(commit_message_subject_is_compliant $commit)
 | 
			
		||||
  if [ $? != 0 ]; then
 | 
			
		||||
    echo "Commit message for $commit_short is not compliant:"
 | 
			
		||||
    echo "$errors"
 | 
			
		||||
    exit 1
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										109
									
								
								.gitlab-ci/meson-junit-report.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										109
									
								
								.gitlab-ci/meson-junit-report.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,109 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
# Turns a Meson testlog.json file into a JUnit XML report
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2019  GNOME Foundation
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: LGPL-2.1-or-later
 | 
			
		||||
#
 | 
			
		||||
# Original author: Emmanuele Bassi
 | 
			
		||||
 | 
			
		||||
import argparse
 | 
			
		||||
import datetime
 | 
			
		||||
import json
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import xml.etree.ElementTree as ET
 | 
			
		||||
 | 
			
		||||
aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUnit report')
 | 
			
		||||
aparser.add_argument('--project-name', metavar='NAME',
 | 
			
		||||
                     help='The project name',
 | 
			
		||||
                     default='unknown')
 | 
			
		||||
aparser.add_argument('--job-id', metavar='ID',
 | 
			
		||||
                     help='The job ID for the report',
 | 
			
		||||
                     default='Unknown')
 | 
			
		||||
aparser.add_argument('--branch', metavar='NAME',
 | 
			
		||||
                     help='Branch of the project being tested',
 | 
			
		||||
                     default='master')
 | 
			
		||||
aparser.add_argument('--output', metavar='FILE',
 | 
			
		||||
                     help='The output file, stdout by default',
 | 
			
		||||
                     type=argparse.FileType('w', encoding='UTF-8'),
 | 
			
		||||
                     default=sys.stdout)
 | 
			
		||||
aparser.add_argument('infile', metavar='FILE',
 | 
			
		||||
                     help='The input testlog.json, stdin by default',
 | 
			
		||||
                     type=argparse.FileType('r', encoding='UTF-8'),
 | 
			
		||||
                     default=sys.stdin)
 | 
			
		||||
 | 
			
		||||
args = aparser.parse_args()
 | 
			
		||||
 | 
			
		||||
outfile = args.output
 | 
			
		||||
 | 
			
		||||
testsuites = ET.Element('testsuites')
 | 
			
		||||
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
 | 
			
		||||
testsuites.set('package', args.project_name)
 | 
			
		||||
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
 | 
			
		||||
 | 
			
		||||
suites = {}
 | 
			
		||||
for line in args.infile:
 | 
			
		||||
    data = json.loads(line)
 | 
			
		||||
    (full_suite, unit_name) = data['name'].split(' / ')
 | 
			
		||||
    (project_name, suite_name) = full_suite.split(':')
 | 
			
		||||
 | 
			
		||||
    duration = data['duration']
 | 
			
		||||
    return_code = data['returncode']
 | 
			
		||||
    log = data['stdout']
 | 
			
		||||
 | 
			
		||||
    unit = {
 | 
			
		||||
        'suite': suite_name,
 | 
			
		||||
        'name': unit_name,
 | 
			
		||||
        'duration': duration,
 | 
			
		||||
        'returncode': return_code,
 | 
			
		||||
        'stdout': log,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    units = suites.setdefault(suite_name, [])
 | 
			
		||||
    units.append(unit)
 | 
			
		||||
 | 
			
		||||
for name, units in suites.items():
 | 
			
		||||
    print('Processing suite {} (units: {})'.format(name, len(units)))
 | 
			
		||||
 | 
			
		||||
    def if_failed(unit):
 | 
			
		||||
        if unit['returncode'] != 0:
 | 
			
		||||
            return True
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
    def if_succeded(unit):
 | 
			
		||||
        if unit['returncode'] == 0:
 | 
			
		||||
            return True
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
    successes = list(filter(if_succeded, units))
 | 
			
		||||
    failures = list(filter(if_failed, units))
 | 
			
		||||
    print(' - {}: {} pass, {} fail'.format(name, len(successes), len(failures)))
 | 
			
		||||
 | 
			
		||||
    testsuite = ET.SubElement(testsuites, 'testsuite')
 | 
			
		||||
    testsuite.set('name', '{}/{}'.format(args.project_name, name))
 | 
			
		||||
    testsuite.set('tests', str(len(units)))
 | 
			
		||||
    testsuite.set('errors', str(len(failures)))
 | 
			
		||||
    testsuite.set('failures', str(len(failures)))
 | 
			
		||||
 | 
			
		||||
    for unit in successes:
 | 
			
		||||
        testcase = ET.SubElement(testsuite, 'testcase')
 | 
			
		||||
        testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
 | 
			
		||||
        testcase.set('name', unit['name'])
 | 
			
		||||
        testcase.set('time', str(unit['duration']))
 | 
			
		||||
 | 
			
		||||
    for unit in failures:
 | 
			
		||||
        testcase = ET.SubElement(testsuite, 'testcase')
 | 
			
		||||
        testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
 | 
			
		||||
        testcase.set('name', unit['name'])
 | 
			
		||||
        testcase.set('time', str(unit['duration']))
 | 
			
		||||
 | 
			
		||||
        failure = ET.SubElement(testcase, 'failure')
 | 
			
		||||
        failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
 | 
			
		||||
        failure.set('name', unit['name'])
 | 
			
		||||
        failure.set('type', 'error')
 | 
			
		||||
        failure.text = unit['stdout']
 | 
			
		||||
 | 
			
		||||
output = ET.tostring(testsuites, encoding='unicode')
 | 
			
		||||
outfile.write(output)
 | 
			
		||||
							
								
								
									
										20
									
								
								.gitlab-ci/run-tests.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								.gitlab-ci/run-tests.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
#!/usr/bin/bash
 | 
			
		||||
 | 
			
		||||
set +e
 | 
			
		||||
 | 
			
		||||
mkdir -m 700 $XDG_RUNTIME_DIR
 | 
			
		||||
glib-compile-schemas $GSETTINGS_SCHEMA_DIR
 | 
			
		||||
 | 
			
		||||
dbus-run-session -- \
 | 
			
		||||
    xvfb-run -s '+iglx -noreset' \
 | 
			
		||||
        meson test -C build --no-rebuild -t 10 --wrap catchsegv
 | 
			
		||||
 | 
			
		||||
exit_code=$?
 | 
			
		||||
 | 
			
		||||
python3 .gitlab-ci/meson-junit-report.py \
 | 
			
		||||
        --project-name=mutter \
 | 
			
		||||
        --job-id "${CI_JOB_NAME}" \
 | 
			
		||||
        --output "build/${CI_JOB_NAME}-report.xml" \
 | 
			
		||||
        build/meson-logs/testlog-catchsegv.json
 | 
			
		||||
 | 
			
		||||
exit $exit_code
 | 
			
		||||
							
								
								
									
										86
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										86
									
								
								NEWS
									
									
									
									
									
								
							@@ -1,3 +1,89 @@
 | 
			
		||||
3.32.1
 | 
			
		||||
======
 | 
			
		||||
* Fix fallback app menu on wayland [Florian; #493]
 | 
			
		||||
* Fix elogind support [Tom; !491]
 | 
			
		||||
* Fix startup notifications not timing out [Carlos; #501]
 | 
			
		||||
* Fix keyboard accessibility toggle from keys
 | 
			
		||||
  [Olivier, Carlos; !501, #529, !531]
 | 
			
		||||
* Fix touchscreen input on rotated displays [Carlos; #514]
 | 
			
		||||
* Work around hangul text input bug [Carlos; #1365]
 | 
			
		||||
* Fix blurry wallpaper scaling [Daniel; !505]
 | 
			
		||||
* Fix placement of window menu when using fractional scaling [Jan; #527]
 | 
			
		||||
* Fix repaint issues of offscreen effects on secondary monitors [Daniel; !511]
 | 
			
		||||
* Fix windows not getting focus after launch [Daniel; #505]
 | 
			
		||||
* Properly advertise support for 'underscan' property [Jonas; !507]
 | 
			
		||||
* Improve power-saving handling [Jonas; !506]
 | 
			
		||||
* Fix moving windows by super+touch [Jonas D.; !495]
 | 
			
		||||
* Misc. bug fixes and cleanups [Benjamin, Florian, Adam, Marco, Pablo,
 | 
			
		||||
  Erik, Jonas, Heiher, Pekka, Daniel, Olivier, Carlos; !478, !475, !480,
 | 
			
		||||
  !482, #490, !488, #491, #480, !477, !496, !492, !485, !515, !519, !521,
 | 
			
		||||
  !216, !538, #541, #523]
 | 
			
		||||
 | 
			
		||||
Contributors:
 | 
			
		||||
  Jonas Ådahl, Pablo Barciela, Benjamin Berg, Tom Briden, Jonas Dreßler,
 | 
			
		||||
  Olivier Fourdan, Carlos Garnacho, Jan Alexander Steffens (heftig), Heiher,
 | 
			
		||||
  Adam Jackson, Erik Kurzinger, Florian Müllner, Pekka Paalanen,
 | 
			
		||||
  Marco Trevisan (Treviño), Daniel van Vugt
 | 
			
		||||
 | 
			
		||||
Translators:
 | 
			
		||||
  Khaled Hosny [ar], Goran Vidović [hr], Daniel Mustieles [es]
 | 
			
		||||
 | 
			
		||||
3.32.0
 | 
			
		||||
======
 | 
			
		||||
* Fix deadlock when cancelling a theme sound [Andrea; !474]
 | 
			
		||||
* Stop swizzling BGRA buffers (bye-bye inverted colors in screenshots
 | 
			
		||||
  and animations) [Carlos; !486]
 | 
			
		||||
 | 
			
		||||
Contributors:
 | 
			
		||||
  Andrea Azzarone, Carlos Garnacho, Robert Mader
 | 
			
		||||
 | 
			
		||||
3.31.92
 | 
			
		||||
=======
 | 
			
		||||
* Fix flicker of apps that use multiple SHM buffers [Jonas Å.; #199]
 | 
			
		||||
* Don't disable page flips after temporary failues [Jonas Å.; #460]
 | 
			
		||||
* Improve redraw performance [Carlos; !196]
 | 
			
		||||
* Add cursor-mode support to window screencasting [Jonas Å.; !413]
 | 
			
		||||
* Add back support for system-wide monitor configurations [Jonas Å.; !253]
 | 
			
		||||
* Add fractional scaling support [Marco, Jonas Å.; !3]
 | 
			
		||||
* Consider remapped keys when guessing keycode from keysym [Andrea; #443]
 | 
			
		||||
* Stop turning on-screen-keyboard off on focus changes [Carlos; !432]
 | 
			
		||||
* Fix crashes [Robert, Carlos, Jonas D., Florian; !447, #361, !426, #479]
 | 
			
		||||
* Misc. bug fixes and cleanups [Benjamin, Adam, Olivier, Niels, Piotr; !457,
 | 
			
		||||
  !452, !459, !380, !361, !461, !464, !471, !473, !463]
 | 
			
		||||
 | 
			
		||||
Contributors:
 | 
			
		||||
  Jonas Ådahl, Andrea Azzarone, Benjamin Berg, Piotr Drąg, Jonas Dreßler,
 | 
			
		||||
  Olivier Fourdan, Carlos Garnacho, Niels De Graef, Adam Jackson, Robert Mader,
 | 
			
		||||
  Florian Müllner, Marco Trevisan (Treviño)
 | 
			
		||||
 | 
			
		||||
Translators:
 | 
			
		||||
  Milo Casagrande [it], Tim Sabsch [de], Trần Ngọc Quân [vi],
 | 
			
		||||
  Gwan-gyeong Mun [ko], Марко Костић [sr], Daniel Mustieles [es],
 | 
			
		||||
  Rūdolfs Mazurs [lv], Nathan Follens [nl]
 | 
			
		||||
 | 
			
		||||
3.31.91
 | 
			
		||||
=======
 | 
			
		||||
* Fix infinite loop in EDID matching [Marco; #459]
 | 
			
		||||
* wayland: Don't resetin text-input state prematurely [Carlos; !410]
 | 
			
		||||
* wayland: Don't maximize windows if minimum size is too big [Olivier; #463]
 | 
			
		||||
* Fix crash when using "restore shortcuts" without focus window [Olivier; #464]
 | 
			
		||||
* Add flag parameter to grab accelerator API [Andrea; !169]
 | 
			
		||||
* Reuse old CRTC if possible to avoid flicker on hotplug [Pekka, Emilio; #373]
 | 
			
		||||
* Misc. bug fixes and cleanups [Marco, Jonas, Niels, Adam, Olivier; !436,
 | 
			
		||||
  !421, #462, !439, !440, !444, !321, !445, !456]
 | 
			
		||||
 | 
			
		||||
Contributors:
 | 
			
		||||
  Jonas Ådahl, Andrea Azzarone, Olivier Fourdan, Carlos Garnacho,
 | 
			
		||||
  Niels De Graef, Adam Jackson, Emilio Pozuelo Monfort, Pekka Paalanen,
 | 
			
		||||
  Marco Trevisan (Treviño)
 | 
			
		||||
 | 
			
		||||
Translators:
 | 
			
		||||
  Jiri Grönroos [fi], Charles Monzat [fr], Claude Paroz [fr], Fran Dieguez [gl],
 | 
			
		||||
  Emin Tufan Çetin [tr], Aurimas Černius [lt], Anders Jonsson [sv],
 | 
			
		||||
  Matej Urbančič [sl], Marek Cernocky [cs], Daniel Șerbănescu [ro],
 | 
			
		||||
  Alan Mortensen [da], Baurzhan Muftakhidinov [kk], Yi-Jyun Pan [zh_TW],
 | 
			
		||||
  Daniel Mustieles [es], Rafael Fontenelle [pt_BR]
 | 
			
		||||
 | 
			
		||||
3.31.90
 | 
			
		||||
=======
 | 
			
		||||
* Fix support of extended characters in on-screen keyboard [Andrea; #109]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
									
									
									
									
								
							@@ -22,6 +22,20 @@ 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.
 | 
			
		||||
 | 
			
		||||
The coding style used is primarily the GNU flavor of the [GNOME coding
 | 
			
		||||
style](https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en)
 | 
			
		||||
with some minor additions such as preferring `stdint.h` types over GLib
 | 
			
		||||
fundamental types, and a soft 80 character line limit. However, in general,
 | 
			
		||||
look at the file you're editing for inspiration.
 | 
			
		||||
 | 
			
		||||
Commit messages should follow the [GNOME commit message
 | 
			
		||||
guidelines](https://wiki.gnome.org/Git/CommitMessages). We require an URL
 | 
			
		||||
to either an issue or a merge request in each commit.
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
Mutter is distributed under the terms of the GNU General Public License,
 | 
			
		||||
 
 | 
			
		||||
@@ -594,6 +594,27 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
 | 
			
		||||
  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.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.6
 | 
			
		||||
 */
 | 
			
		||||
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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
 | 
			
		||||
                               clutter_actor_box_copy,
 | 
			
		||||
                               clutter_actor_box_free,
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,8 @@ typedef enum
 | 
			
		||||
 * Controls some options for how clutter_actor_traverse() iterates
 | 
			
		||||
 * through the graph.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST   = 1L<<0,
 | 
			
		||||
  CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1
 | 
			
		||||
} ClutterActorTraverseFlags;
 | 
			
		||||
@@ -74,7 +75,8 @@ typedef enum {
 | 
			
		||||
 * the continuing traversal. It may stop traversal completely, just
 | 
			
		||||
 * 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_SKIP_CHILDREN  = 1L<<1,
 | 
			
		||||
  CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK          = 1L<<2
 | 
			
		||||
@@ -283,9 +285,6 @@ void                            _clutter_actor_queue_redraw_full
 | 
			
		||||
                                                                                         const ClutterPaintVolume *volume,
 | 
			
		||||
                                                                                         ClutterEffect            *effect);
 | 
			
		||||
 | 
			
		||||
ClutterPaintVolume *            _clutter_actor_get_queue_redraw_clip                    (ClutterActor       *self);
 | 
			
		||||
void                            _clutter_actor_set_queue_redraw_clip                    (ClutterActor       *self,
 | 
			
		||||
                                                                                         ClutterPaintVolume *clip_volume);
 | 
			
		||||
void                            _clutter_actor_finish_queue_redraw                      (ClutterActor       *self,
 | 
			
		||||
                                                                                         ClutterPaintVolume *clip);
 | 
			
		||||
 | 
			
		||||
@@ -316,8 +315,11 @@ void                            _clutter_actor_detach_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_update_resource_scale_recursive    (ClutterActor *actor);
 | 
			
		||||
 | 
			
		||||
CoglFramebuffer *               _clutter_actor_get_active_framebuffer                   (ClutterActor *actor);
 | 
			
		||||
gboolean                        _clutter_actor_get_real_resource_scale                  (ClutterActor *actor,
 | 
			
		||||
                                                                                         float        *resource_scale);
 | 
			
		||||
 | 
			
		||||
ClutterPaintNode *              clutter_actor_create_texture_paint_node                 (ClutterActor *self,
 | 
			
		||||
                                                                                         CoglTexture  *texture);
 | 
			
		||||
 
 | 
			
		||||
@@ -635,6 +635,7 @@
 | 
			
		||||
#include "clutter-interval.h"
 | 
			
		||||
#include "clutter-main.h"
 | 
			
		||||
#include "clutter-marshal.h"
 | 
			
		||||
#include "clutter-mutter.h"
 | 
			
		||||
#include "clutter-paint-nodes.h"
 | 
			
		||||
#include "clutter-paint-node-private.h"
 | 
			
		||||
#include "clutter-paint-volume-private.h"
 | 
			
		||||
@@ -655,7 +656,8 @@
 | 
			
		||||
 * which indicates when to do something other than just enforce
 | 
			
		||||
 * invariants.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  MAP_STATE_CHECK,           /* just enforce invariants. */
 | 
			
		||||
  MAP_STATE_MAKE_UNREALIZED, /* force unrealize, ignoring invariants,
 | 
			
		||||
                              * used when about to unparent.
 | 
			
		||||
@@ -697,6 +699,8 @@ struct _ClutterActorPrivate
 | 
			
		||||
  /* the cached transformation matrix; see apply_transform() */
 | 
			
		||||
  CoglMatrix transform;
 | 
			
		||||
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
 | 
			
		||||
  guint8 opacity;
 | 
			
		||||
  gint opacity_override;
 | 
			
		||||
 | 
			
		||||
@@ -803,6 +807,9 @@ struct _ClutterActorPrivate
 | 
			
		||||
  gpointer create_child_data;
 | 
			
		||||
  GDestroyNotify create_child_notify;
 | 
			
		||||
 | 
			
		||||
  guint resolution_changed_id;
 | 
			
		||||
  guint font_changed_id;
 | 
			
		||||
 | 
			
		||||
  /* bitfields: KEEP AT THE END */
 | 
			
		||||
 | 
			
		||||
  /* fixed position and sizes */
 | 
			
		||||
@@ -842,6 +849,7 @@ struct _ClutterActorPrivate
 | 
			
		||||
  guint needs_y_expand              : 1;
 | 
			
		||||
  guint needs_paint_volume_update   : 1;
 | 
			
		||||
  guint had_effects_on_last_paint_volume_update : 1;
 | 
			
		||||
  guint needs_compute_resource_scale : 1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
@@ -914,6 +922,7 @@ enum
 | 
			
		||||
  PROP_SCALE_CENTER_X, /* XXX:2.0 remove */
 | 
			
		||||
  PROP_SCALE_CENTER_Y, /* XXX:2.0 remove */
 | 
			
		||||
  PROP_SCALE_GRAVITY, /* XXX:2.0 remove */
 | 
			
		||||
  PROP_RESOURCE_SCALE,
 | 
			
		||||
 | 
			
		||||
  PROP_ROTATION_ANGLE_X, /* XXX:2.0 rename to rotation-x */
 | 
			
		||||
  PROP_ROTATION_ANGLE_Y, /* XXX:2.0 rename to rotation-y */
 | 
			
		||||
@@ -1022,7 +1031,7 @@ typedef struct _TransitionClosure
 | 
			
		||||
 | 
			
		||||
static void clutter_container_iface_init  (ClutterContainerIface  *iface);
 | 
			
		||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
 | 
			
		||||
static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
 | 
			
		||||
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 | 
			
		||||
static void atk_implementor_iface_init    (AtkImplementorIface    *iface);
 | 
			
		||||
 | 
			
		||||
/* These setters are all static for now, maybe they should be in the
 | 
			
		||||
@@ -1093,6 +1102,8 @@ static void clutter_actor_set_child_transform_internal (ClutterActor        *sel
 | 
			
		||||
 | 
			
		||||
static void     clutter_actor_realize_internal          (ClutterActor *self);
 | 
			
		||||
static void     clutter_actor_unrealize_internal        (ClutterActor *self);
 | 
			
		||||
static gboolean clutter_actor_update_resource_scale     (ClutterActor *self);
 | 
			
		||||
static void     clutter_actor_ensure_resource_scale     (ClutterActor *self);
 | 
			
		||||
 | 
			
		||||
static void clutter_actor_push_in_cloned_branch (ClutterActor *self,
 | 
			
		||||
                                                 gulong        count);
 | 
			
		||||
@@ -1108,7 +1119,6 @@ static void clutter_actor_pop_in_cloned_branch (ClutterActor *self,
 | 
			
		||||
  { _transform; }                                                      \
 | 
			
		||||
  cogl_matrix_translate ((m), -_tx, -_ty, -_tz);        } G_STMT_END
 | 
			
		||||
 | 
			
		||||
static GQuark quark_shader_data = 0;
 | 
			
		||||
static GQuark quark_actor_layout_info = 0;
 | 
			
		||||
static GQuark quark_actor_transform_info = 0;
 | 
			
		||||
static GQuark quark_actor_animation_info = 0;
 | 
			
		||||
@@ -1520,6 +1530,8 @@ clutter_actor_real_map (ClutterActor *self)
 | 
			
		||||
                priv->pick_id,
 | 
			
		||||
                _clutter_actor_get_debug_name (self));
 | 
			
		||||
 | 
			
		||||
  clutter_actor_ensure_resource_scale (self);
 | 
			
		||||
 | 
			
		||||
  /* notify on parent mapped before potentially mapping
 | 
			
		||||
   * children, so apps see a top-down notification.
 | 
			
		||||
   */
 | 
			
		||||
@@ -2689,9 +2701,12 @@ clutter_actor_real_allocate (ClutterActor           *self,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_clutter_actor_signal_queue_redraw (ClutterActor *self,
 | 
			
		||||
                                    ClutterActor *origin)
 | 
			
		||||
_clutter_actor_propagate_queue_redraw (ClutterActor       *self,
 | 
			
		||||
                                       ClutterActor       *origin,
 | 
			
		||||
                                       ClutterPaintVolume *pv)
 | 
			
		||||
{
 | 
			
		||||
  gboolean stop = FALSE;
 | 
			
		||||
 | 
			
		||||
  /* no point in queuing a redraw on a destroyed actor */
 | 
			
		||||
  if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
 | 
			
		||||
    return;
 | 
			
		||||
@@ -2700,27 +2715,33 @@ _clutter_actor_signal_queue_redraw (ClutterActor *self,
 | 
			
		||||
   * the actor bas been cloned. In this case the clone will need to
 | 
			
		||||
   * receive the signal so it can queue its own redraw.
 | 
			
		||||
   */
 | 
			
		||||
  while (self)
 | 
			
		||||
    {
 | 
			
		||||
      _clutter_actor_queue_redraw_on_clones (self);
 | 
			
		||||
 | 
			
		||||
  _clutter_actor_queue_redraw_on_clones (self);
 | 
			
		||||
 | 
			
		||||
  /* calls klass->queue_redraw in default handler */
 | 
			
		||||
  if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
 | 
			
		||||
      /* calls klass->queue_redraw in default handler */
 | 
			
		||||
      if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
 | 
			
		||||
                                    0, TRUE))
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin);
 | 
			
		||||
        {
 | 
			
		||||
          g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin, pv, &stop);
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
          stop = CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin, pv);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      if (stop)
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      self = clutter_actor_get_parent (self);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_actor_real_queue_redraw (ClutterActor *self,
 | 
			
		||||
                                 ClutterActor *origin)
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_actor_real_queue_redraw (ClutterActor       *self,
 | 
			
		||||
                                 ClutterActor       *origin,
 | 
			
		||||
                                 ClutterPaintVolume *paint_volume)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActor *parent;
 | 
			
		||||
 | 
			
		||||
  CLUTTER_NOTE (PAINT, "Redraw queued on '%s' (from: '%s')",
 | 
			
		||||
                _clutter_actor_get_debug_name (self),
 | 
			
		||||
                origin != NULL ? _clutter_actor_get_debug_name (origin)
 | 
			
		||||
@@ -2728,7 +2749,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
 | 
			
		||||
 | 
			
		||||
  /* no point in queuing a redraw on a destroyed actor */
 | 
			
		||||
  if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  /* If the queue redraw is coming from a child then the actor has
 | 
			
		||||
     become dirty and any queued effect is no longer valid */
 | 
			
		||||
@@ -2743,7 +2764,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
 | 
			
		||||
   * won't change so we don't have to propagate up the hierarchy.
 | 
			
		||||
   */
 | 
			
		||||
  if (!CLUTTER_ACTOR_IS_VISIBLE (self))
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  /* Although we could determine here that a full stage redraw
 | 
			
		||||
   * has already been queued and immediately bail out, we actually
 | 
			
		||||
@@ -2757,7 +2778,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
 | 
			
		||||
      ClutterActor *stage = _clutter_actor_get_stage_internal (self);
 | 
			
		||||
      if (stage != NULL &&
 | 
			
		||||
          _clutter_stage_has_full_redraw_queued (CLUTTER_STAGE (stage)))
 | 
			
		||||
        return;
 | 
			
		||||
        return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  self->priv->propagated_one_redraw = TRUE;
 | 
			
		||||
@@ -2765,12 +2786,17 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
 | 
			
		||||
  /* notify parents, if they are all visible eventually we'll
 | 
			
		||||
   * queue redraw on the stage, which queues the redraw idle.
 | 
			
		||||
   */
 | 
			
		||||
  parent = clutter_actor_get_parent (self);
 | 
			
		||||
  if (parent != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      /* this will go up recursively */
 | 
			
		||||
      _clutter_actor_signal_queue_redraw (parent, origin);
 | 
			
		||||
    }
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline gboolean
 | 
			
		||||
clutter_actor_needs_relayout (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  return (priv->needs_width_request ||
 | 
			
		||||
          priv->needs_height_request ||
 | 
			
		||||
          priv->needs_allocation);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -3561,12 +3587,6 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self)
 | 
			
		||||
  priv->last_paint_volume_valid = TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline gboolean
 | 
			
		||||
actor_has_shader_data (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  return g_object_get_qdata (G_OBJECT (self), quark_shader_data) != NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
guint32
 | 
			
		||||
_clutter_actor_get_pick_id (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
@@ -3808,7 +3828,6 @@ clutter_actor_paint (ClutterActor *self)
 | 
			
		||||
  ClutterActorPrivate *priv;
 | 
			
		||||
  ClutterPickMode pick_mode;
 | 
			
		||||
  gboolean clip_set = FALSE;
 | 
			
		||||
  gboolean shader_applied = FALSE;
 | 
			
		||||
  ClutterStage *stage;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_ACTOR (self));
 | 
			
		||||
@@ -3839,6 +3858,8 @@ clutter_actor_paint (ClutterActor *self)
 | 
			
		||||
  if (!CLUTTER_ACTOR_IS_MAPPED (self))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_ensure_resource_scale (self);
 | 
			
		||||
 | 
			
		||||
  stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
 | 
			
		||||
 | 
			
		||||
  /* mark that we are in the paint process */
 | 
			
		||||
@@ -3978,35 +3999,23 @@ clutter_actor_paint (ClutterActor *self)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->effects == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      if (pick_mode == CLUTTER_PICK_NONE &&
 | 
			
		||||
          actor_has_shader_data (self))
 | 
			
		||||
        {
 | 
			
		||||
          _clutter_actor_shader_pre_paint (self, FALSE);
 | 
			
		||||
          shader_applied = TRUE;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      priv->next_effect_to_paint = NULL;
 | 
			
		||||
    }
 | 
			
		||||
    priv->next_effect_to_paint = NULL;
 | 
			
		||||
  else
 | 
			
		||||
    priv->next_effect_to_paint =
 | 
			
		||||
      _clutter_meta_group_peek_metas (priv->effects);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_continue_paint (self);
 | 
			
		||||
 | 
			
		||||
  if (shader_applied)
 | 
			
		||||
    _clutter_actor_shader_post_paint (self);
 | 
			
		||||
 | 
			
		||||
  if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES &&
 | 
			
		||||
                  pick_mode == CLUTTER_PICK_NONE))
 | 
			
		||||
    _clutter_actor_draw_paint_volume (self);
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
  /* If we make it here then the actor has run through a complete
 | 
			
		||||
     paint run including all the effects so it's no longer dirty */
 | 
			
		||||
  if (pick_mode == CLUTTER_PICK_NONE)
 | 
			
		||||
    priv->is_dirty = FALSE;
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
  if (clip_set)
 | 
			
		||||
    {
 | 
			
		||||
      CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage);
 | 
			
		||||
@@ -4216,7 +4225,8 @@ remove_child (ClutterActor *self,
 | 
			
		||||
  child->priv->next_sibling = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  REMOVE_CHILD_DESTROY_META       = 1 << 0,
 | 
			
		||||
  REMOVE_CHILD_EMIT_PARENT_SET    = 1 << 1,
 | 
			
		||||
  REMOVE_CHILD_EMIT_ACTOR_REMOVED = 1 << 2,
 | 
			
		||||
@@ -4352,7 +4362,10 @@ clutter_actor_remove_child_internal (ClutterActor                 *self,
 | 
			
		||||
 | 
			
		||||
  /* clutter_actor_reparent() will emit ::parent-set for us */
 | 
			
		||||
  if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child))
 | 
			
		||||
    g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
 | 
			
		||||
    {
 | 
			
		||||
      child->priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
      g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* if the child was mapped then we need to relayout ourselves to account
 | 
			
		||||
   * for the removed child
 | 
			
		||||
@@ -5677,6 +5690,16 @@ clutter_actor_get_property (GObject    *object,
 | 
			
		||||
      g_value_set_enum (value, clutter_actor_get_scale_gravity (actor));
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_RESOURCE_SCALE:
 | 
			
		||||
      if (priv->needs_compute_resource_scale)
 | 
			
		||||
        {
 | 
			
		||||
          if (!clutter_actor_update_resource_scale (actor))
 | 
			
		||||
            g_warning ("Getting invalid resource scale property");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      g_value_set_float (value, priv->resource_scale);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_REACTIVE:
 | 
			
		||||
      g_value_set_boolean (value, clutter_actor_get_reactive (actor));
 | 
			
		||||
      break;
 | 
			
		||||
@@ -5963,6 +5986,7 @@ clutter_actor_dispose (GObject *object)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActor *self = CLUTTER_ACTOR (object);
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
  ClutterBackend *backend = clutter_get_default_backend ();
 | 
			
		||||
 | 
			
		||||
  CLUTTER_NOTE (MISC, "Dispose actor (name='%s', ref_count:%d) of type '%s'",
 | 
			
		||||
		_clutter_actor_get_debug_name (self),
 | 
			
		||||
@@ -5999,6 +6023,18 @@ clutter_actor_dispose (GObject *object)
 | 
			
		||||
      g_assert (!CLUTTER_ACTOR_IS_REALIZED (self));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->resolution_changed_id)
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_handler_disconnect (backend, priv->resolution_changed_id);
 | 
			
		||||
      priv->resolution_changed_id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->font_changed_id)
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_handler_disconnect (backend, priv->font_changed_id);
 | 
			
		||||
      priv->font_changed_id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_clear_object (&priv->pango_context);
 | 
			
		||||
  g_clear_object (&priv->actions);
 | 
			
		||||
  g_clear_object (&priv->constraints);
 | 
			
		||||
@@ -6337,7 +6373,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
 | 
			
		||||
  quark_shader_data = g_quark_from_static_string ("-clutter-actor-shader-data");
 | 
			
		||||
  quark_actor_layout_info = g_quark_from_static_string ("-clutter-actor-layout-info");
 | 
			
		||||
  quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info");
 | 
			
		||||
  quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info");
 | 
			
		||||
@@ -7131,6 +7166,19 @@ clutter_actor_class_init (ClutterActorClass *klass)
 | 
			
		||||
                       G_PARAM_STATIC_STRINGS |
 | 
			
		||||
                       G_PARAM_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterActor:resource-scale:
 | 
			
		||||
   *
 | 
			
		||||
   * The resource-scale of the #ClutterActor if any or -1 if not available
 | 
			
		||||
   */
 | 
			
		||||
  obj_props[PROP_RESOURCE_SCALE] =
 | 
			
		||||
    g_param_spec_float ("resource-scale",
 | 
			
		||||
                        P_("Resource Scale"),
 | 
			
		||||
                        P_("The Scaling factor for resources painting"),
 | 
			
		||||
                        -1.0f, G_MAXFLOAT,
 | 
			
		||||
                        1.0f,
 | 
			
		||||
                        CLUTTER_PARAM_READABLE);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterActor:rotation-angle-x:
 | 
			
		||||
   *
 | 
			
		||||
@@ -8010,6 +8058,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
 | 
			
		||||
   * ClutterActor::queue-redraw:
 | 
			
		||||
   * @actor: the actor we're bubbling the redraw request through
 | 
			
		||||
   * @origin: the actor which initiated the redraw request
 | 
			
		||||
   * @volume: paint volume to redraw
 | 
			
		||||
   *
 | 
			
		||||
   * The ::queue_redraw signal is emitted when clutter_actor_queue_redraw()
 | 
			
		||||
   * is called on @origin.
 | 
			
		||||
@@ -8063,10 +8112,12 @@ clutter_actor_class_init (ClutterActorClass *klass)
 | 
			
		||||
		  G_SIGNAL_RUN_LAST |
 | 
			
		||||
                  G_SIGNAL_NO_HOOKS,
 | 
			
		||||
		  G_STRUCT_OFFSET (ClutterActorClass, queue_redraw),
 | 
			
		||||
		  NULL, NULL,
 | 
			
		||||
		  _clutter_marshal_VOID__OBJECT,
 | 
			
		||||
		  G_TYPE_NONE, 1,
 | 
			
		||||
                  CLUTTER_TYPE_ACTOR);
 | 
			
		||||
                  g_signal_accumulator_true_handled,
 | 
			
		||||
		  NULL,
 | 
			
		||||
		  _clutter_marshal_BOOLEAN__OBJECT_BOXED,
 | 
			
		||||
		  G_TYPE_BOOLEAN, 2,
 | 
			
		||||
                  CLUTTER_TYPE_ACTOR,
 | 
			
		||||
                  CLUTTER_TYPE_PAINT_VOLUME);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterActor::queue-relayout:
 | 
			
		||||
@@ -8567,11 +8618,13 @@ clutter_actor_init (ClutterActor *self)
 | 
			
		||||
 | 
			
		||||
  priv->opacity = 0xff;
 | 
			
		||||
  priv->show_on_set_parent = TRUE;
 | 
			
		||||
  priv->resource_scale = -1.0f;
 | 
			
		||||
 | 
			
		||||
  priv->needs_width_request = TRUE;
 | 
			
		||||
  priv->needs_height_request = TRUE;
 | 
			
		||||
  priv->needs_allocation = TRUE;
 | 
			
		||||
  priv->needs_paint_volume_update = TRUE;
 | 
			
		||||
  priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
 | 
			
		||||
  priv->cached_width_age = 1;
 | 
			
		||||
  priv->cached_height_age = 1;
 | 
			
		||||
@@ -8665,8 +8718,7 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
 | 
			
		||||
                                    ClutterPaintVolume *clip)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
  ClutterPaintVolume *pv;
 | 
			
		||||
  gboolean clipped;
 | 
			
		||||
  ClutterPaintVolume *pv = NULL;
 | 
			
		||||
 | 
			
		||||
  /* Remove queue entry early in the process, otherwise a new
 | 
			
		||||
     queue_redraw() during signal handling could put back this
 | 
			
		||||
@@ -8693,8 +8745,7 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
 | 
			
		||||
   */
 | 
			
		||||
  if (clip)
 | 
			
		||||
    {
 | 
			
		||||
      _clutter_actor_set_queue_redraw_clip (self, clip);
 | 
			
		||||
      clipped = TRUE;
 | 
			
		||||
      pv = clip;
 | 
			
		||||
    }
 | 
			
		||||
  else if (G_LIKELY (priv->last_paint_volume_valid))
 | 
			
		||||
    {
 | 
			
		||||
@@ -8704,36 +8755,12 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
 | 
			
		||||
          ClutterActor *stage = _clutter_actor_get_stage_internal (self);
 | 
			
		||||
 | 
			
		||||
          /* make sure we redraw the actors old position... */
 | 
			
		||||
          _clutter_actor_set_queue_redraw_clip (stage,
 | 
			
		||||
                                                &priv->last_paint_volume);
 | 
			
		||||
          _clutter_actor_signal_queue_redraw (stage, stage);
 | 
			
		||||
          _clutter_actor_set_queue_redraw_clip (stage, NULL);
 | 
			
		||||
 | 
			
		||||
          /* XXX: Ideally the redraw signal would take a clip volume
 | 
			
		||||
           * argument, but that would be an ABI break. Until we can
 | 
			
		||||
           * break the ABI we pass the argument out-of-band
 | 
			
		||||
           */
 | 
			
		||||
 | 
			
		||||
          /* setup the clip for the actors new position... */
 | 
			
		||||
          _clutter_actor_set_queue_redraw_clip (self, pv);
 | 
			
		||||
          clipped = TRUE;
 | 
			
		||||
          _clutter_actor_propagate_queue_redraw (stage, stage,
 | 
			
		||||
                                                 &priv->last_paint_volume);
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
        clipped = FALSE;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    clipped = FALSE;
 | 
			
		||||
 | 
			
		||||
  _clutter_actor_signal_queue_redraw (self, self);
 | 
			
		||||
 | 
			
		||||
  /* Just in case anyone is manually firing redraw signals without
 | 
			
		||||
   * using the public queue_redraw() API we are careful to ensure that
 | 
			
		||||
   * our out-of-band clip member is cleared before returning...
 | 
			
		||||
   *
 | 
			
		||||
   * Note: A NULL clip denotes a full-stage, un-clipped redraw
 | 
			
		||||
   */
 | 
			
		||||
  if (G_LIKELY (clipped))
 | 
			
		||||
    _clutter_actor_set_queue_redraw_clip (self, NULL);
 | 
			
		||||
  _clutter_actor_propagate_queue_redraw (self, self, pv);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -8893,8 +8920,7 @@ _clutter_actor_queue_redraw_full (ClutterActor             *self,
 | 
			
		||||
        {
 | 
			
		||||
          /* NB: NULL denotes an undefined clip which will result in a
 | 
			
		||||
           * full redraw... */
 | 
			
		||||
          _clutter_actor_set_queue_redraw_clip (self, NULL);
 | 
			
		||||
          _clutter_actor_signal_queue_redraw (self, self);
 | 
			
		||||
          _clutter_actor_propagate_queue_redraw (self, self, NULL);
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -9558,6 +9584,8 @@ clutter_actor_get_preferred_width (ClutterActor *self,
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
 | 
			
		||||
 | 
			
		||||
  /* the remaining cases are:
 | 
			
		||||
   *
 | 
			
		||||
   *   - either min_width or natural_width have been set
 | 
			
		||||
@@ -9649,6 +9677,8 @@ clutter_actor_get_preferred_width (ClutterActor *self,
 | 
			
		||||
 | 
			
		||||
  if (natural_width_p)
 | 
			
		||||
    *natural_width_p = request_natural_width;
 | 
			
		||||
 | 
			
		||||
  CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -9702,6 +9732,8 @@ clutter_actor_get_preferred_height (ClutterActor *self,
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
 | 
			
		||||
 | 
			
		||||
  /* the remaining cases are:
 | 
			
		||||
   *
 | 
			
		||||
   *   - either min_height or natural_height have been set
 | 
			
		||||
@@ -9792,6 +9824,8 @@ clutter_actor_get_preferred_height (ClutterActor *self,
 | 
			
		||||
 | 
			
		||||
  if (natural_height_p)
 | 
			
		||||
    *natural_height_p = request_natural_height;
 | 
			
		||||
 | 
			
		||||
  CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -10134,6 +10168,9 @@ clutter_actor_allocate (ClutterActor           *self,
 | 
			
		||||
  if (CLUTTER_ACTOR_IS_MAPPED (self))
 | 
			
		||||
    self->priv->needs_paint_volume_update = TRUE;
 | 
			
		||||
 | 
			
		||||
  if (stage_allocation_changed)
 | 
			
		||||
    priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
 | 
			
		||||
  if (!stage_allocation_changed)
 | 
			
		||||
    {
 | 
			
		||||
      /* If the actor didn't move but needs_allocation is set, we just
 | 
			
		||||
@@ -12796,7 +12833,8 @@ typedef void (* ClutterActorAddChildFunc) (ClutterActor *parent,
 | 
			
		||||
                                           ClutterActor *child,
 | 
			
		||||
                                           gpointer      data);
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  ADD_CHILD_CREATE_META        = 1 << 0,
 | 
			
		||||
  ADD_CHILD_EMIT_PARENT_SET    = 1 << 1,
 | 
			
		||||
  ADD_CHILD_EMIT_ACTOR_ADDED   = 1 << 2,
 | 
			
		||||
@@ -12981,7 +13019,10 @@ clutter_actor_add_child_internal (ClutterActor              *self,
 | 
			
		||||
 | 
			
		||||
  /* clutter_actor_reparent() will emit ::parent-set for us */
 | 
			
		||||
  if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child))
 | 
			
		||||
    g_signal_emit (child, actor_signals[PARENT_SET], 0, NULL);
 | 
			
		||||
    {
 | 
			
		||||
      child->priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
      g_signal_emit (child, actor_signals[PARENT_SET], 0, NULL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (check_state)
 | 
			
		||||
    {
 | 
			
		||||
@@ -13014,9 +13055,7 @@ clutter_actor_add_child_internal (ClutterActor              *self,
 | 
			
		||||
  /* maintain the invariant that if an actor needs layout,
 | 
			
		||||
   * its parents do as well
 | 
			
		||||
   */
 | 
			
		||||
  if (child->priv->needs_width_request ||
 | 
			
		||||
      child->priv->needs_height_request ||
 | 
			
		||||
      child->priv->needs_allocation)
 | 
			
		||||
  if (clutter_actor_needs_relayout (child))
 | 
			
		||||
    {
 | 
			
		||||
      /* we work around the short-circuiting we do
 | 
			
		||||
       * in clutter_actor_queue_relayout() since we
 | 
			
		||||
@@ -13585,6 +13624,8 @@ clutter_actor_reparent (ClutterActor *self,
 | 
			
		||||
                                          insert_child_at_depth,
 | 
			
		||||
                                          NULL);
 | 
			
		||||
 | 
			
		||||
      priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
 | 
			
		||||
      /* we emit the ::parent-set signal once */
 | 
			
		||||
      g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent);
 | 
			
		||||
 | 
			
		||||
@@ -15159,7 +15200,7 @@ clutter_actor_set_final_state (ClutterAnimatable *animatable,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableIface *iface)
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  iface->find_property = clutter_actor_find_property;
 | 
			
		||||
  iface->get_initial_state = clutter_actor_get_initial_state;
 | 
			
		||||
@@ -15859,10 +15900,12 @@ clutter_actor_get_pango_context (ClutterActor *self)
 | 
			
		||||
    {
 | 
			
		||||
      priv->pango_context = clutter_actor_create_pango_context (self);
 | 
			
		||||
 | 
			
		||||
      g_signal_connect_object (backend, "resolution-changed",
 | 
			
		||||
                               G_CALLBACK (update_pango_context), priv->pango_context, 0);
 | 
			
		||||
      g_signal_connect_object (backend, "font-changed",
 | 
			
		||||
                               G_CALLBACK (update_pango_context), priv->pango_context, 0);
 | 
			
		||||
      priv->resolution_changed_id =
 | 
			
		||||
        g_signal_connect_object (backend, "resolution-changed",
 | 
			
		||||
                                 G_CALLBACK (update_pango_context), priv->pango_context, 0);
 | 
			
		||||
      priv->font_changed_id =
 | 
			
		||||
        g_signal_connect_object (backend, "font-changed",
 | 
			
		||||
                                 G_CALLBACK (update_pango_context), priv->pango_context, 0);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    update_pango_context (backend, priv->pango_context);
 | 
			
		||||
@@ -16487,6 +16530,12 @@ clutter_actor_is_in_clone_paint (ClutterActor *self)
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_actor_has_damage (ClutterActor *actor)
 | 
			
		||||
{
 | 
			
		||||
  return actor->priv->is_dirty;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
set_direction_recursive (ClutterActor *actor,
 | 
			
		||||
                         gpointer      user_data)
 | 
			
		||||
@@ -16704,26 +16753,6 @@ clutter_actor_has_pointer (ClutterActor *self)
 | 
			
		||||
  return self->priv->has_pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* XXX: This is a workaround for not being able to break the ABI of
 | 
			
		||||
 * the QUEUE_REDRAW signal. It is an out-of-band argument.  See
 | 
			
		||||
 * clutter_actor_queue_clipped_redraw() for details.
 | 
			
		||||
 */
 | 
			
		||||
ClutterPaintVolume *
 | 
			
		||||
_clutter_actor_get_queue_redraw_clip (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  return g_object_get_data (G_OBJECT (self),
 | 
			
		||||
                            "-clutter-actor-queue-redraw-clip");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_clutter_actor_set_queue_redraw_clip (ClutterActor       *self,
 | 
			
		||||
                                      ClutterPaintVolume *clip)
 | 
			
		||||
{
 | 
			
		||||
  g_object_set_data (G_OBJECT (self),
 | 
			
		||||
                     "-clutter-actor-queue-redraw-clip",
 | 
			
		||||
                     clip);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_has_allocation:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
@@ -17768,6 +17797,171 @@ clutter_actor_get_paint_box (ClutterActor    *self,
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
_clutter_actor_get_resource_scale_for_rect (ClutterActor *self,
 | 
			
		||||
                                            ClutterRect  *bounding_rect,
 | 
			
		||||
                                            float        *resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActor *stage;
 | 
			
		||||
  float max_scale = 0;
 | 
			
		||||
 | 
			
		||||
  stage = _clutter_actor_get_stage_internal (self);
 | 
			
		||||
  if (!stage)
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  if (!_clutter_stage_get_max_view_scale_factor_for_rect (CLUTTER_STAGE (stage),
 | 
			
		||||
                                                          bounding_rect,
 | 
			
		||||
                                                          &max_scale))
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  *resource_scale = max_scale;
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
_clutter_actor_compute_resource_scale (ClutterActor *self,
 | 
			
		||||
                                       float        *resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterRect bounding_rect;
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  if (CLUTTER_ACTOR_IN_DESTRUCTION (self) ||
 | 
			
		||||
      CLUTTER_ACTOR_IN_PREF_SIZE (self) ||
 | 
			
		||||
      !clutter_actor_is_mapped (self))
 | 
			
		||||
    {
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  clutter_actor_get_transformed_position (self,
 | 
			
		||||
                                          &bounding_rect.origin.x,
 | 
			
		||||
                                          &bounding_rect.origin.y);
 | 
			
		||||
  clutter_actor_get_transformed_size (self,
 | 
			
		||||
                                      &bounding_rect.size.width,
 | 
			
		||||
                                      &bounding_rect.size.height);
 | 
			
		||||
 | 
			
		||||
  if (bounding_rect.size.width == 0.0 ||
 | 
			
		||||
      bounding_rect.size.height == 0.0 ||
 | 
			
		||||
      !_clutter_actor_get_resource_scale_for_rect (self,
 | 
			
		||||
                                                   &bounding_rect,
 | 
			
		||||
                                                   resource_scale))
 | 
			
		||||
    {
 | 
			
		||||
      if (priv->parent)
 | 
			
		||||
        return _clutter_actor_compute_resource_scale (priv->parent,
 | 
			
		||||
                                                      resource_scale);
 | 
			
		||||
      else
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterActorTraverseVisitFlags
 | 
			
		||||
queue_update_resource_scale_cb (ClutterActor *actor,
 | 
			
		||||
                                int           depth,
 | 
			
		||||
                                void         *user_data)
 | 
			
		||||
{
 | 
			
		||||
  actor->priv->needs_compute_resource_scale = TRUE;
 | 
			
		||||
  return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_clutter_actor_queue_update_resource_scale_recursive (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  _clutter_actor_traverse (self,
 | 
			
		||||
                           CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
 | 
			
		||||
                           queue_update_resource_scale_cb,
 | 
			
		||||
                           NULL,
 | 
			
		||||
                           NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_actor_update_resource_scale (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActorPrivate *priv;
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
  float old_resource_scale;
 | 
			
		||||
  priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (priv->needs_compute_resource_scale, FALSE);
 | 
			
		||||
 | 
			
		||||
  old_resource_scale = priv->resource_scale;
 | 
			
		||||
  priv->resource_scale = -1.0f;
 | 
			
		||||
 | 
			
		||||
  if (_clutter_actor_compute_resource_scale (self, &resource_scale))
 | 
			
		||||
    {
 | 
			
		||||
      priv->resource_scale = resource_scale;
 | 
			
		||||
      priv->needs_compute_resource_scale = FALSE;
 | 
			
		||||
 | 
			
		||||
      return fabsf (old_resource_scale - resource_scale) > FLT_EPSILON;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_actor_ensure_resource_scale (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  if (!priv->needs_compute_resource_scale)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (clutter_actor_update_resource_scale (self))
 | 
			
		||||
    g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_RESOURCE_SCALE]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_actor_get_real_resource_scale (ClutterActor *self,
 | 
			
		||||
                                        gfloat       *resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterActorPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_ensure_resource_scale (self);
 | 
			
		||||
 | 
			
		||||
  if (!priv->needs_compute_resource_scale)
 | 
			
		||||
    {
 | 
			
		||||
      *resource_scale = priv->resource_scale;
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  *resource_scale = -1.0f;
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_get_resource_scale:
 | 
			
		||||
 * @self: A #ClutterActor
 | 
			
		||||
 * @resource_scale: (out): return location for the resource scale
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the resource scale for this actor, if available.
 | 
			
		||||
 *
 | 
			
		||||
 * The resource scale refers to the scale the actor should use for its resources.
 | 
			
		||||
 * For example if an actor draws a a picture of size 100 x 100 in the stage
 | 
			
		||||
 * coordinate space, it should use a texture of twice the size (i.e. 200 x 200)
 | 
			
		||||
 * if the resource scale is 2.
 | 
			
		||||
 *
 | 
			
		||||
 * The resource scale is determined by calculating the highest #ClutterStageView
 | 
			
		||||
 * scale the actor will get painted on.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: TRUE if resource scale is set for the actor, otherwise FALSE
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_actor_get_resource_scale (ClutterActor *self,
 | 
			
		||||
                                  gfloat       *resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
 | 
			
		||||
  g_return_val_if_fail (resource_scale != NULL, FALSE);
 | 
			
		||||
 | 
			
		||||
  if (_clutter_actor_get_real_resource_scale (self, resource_scale))
 | 
			
		||||
    {
 | 
			
		||||
      *resource_scale = ceilf (*resource_scale);
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_has_overlaps:
 | 
			
		||||
 * @self: A #ClutterActor
 | 
			
		||||
 
 | 
			
		||||
@@ -236,8 +236,9 @@ struct _ClutterActorClass
 | 
			
		||||
  void (* pick)                 (ClutterActor          *actor,
 | 
			
		||||
                                 const ClutterColor    *color);
 | 
			
		||||
 | 
			
		||||
  void (* queue_redraw)         (ClutterActor          *actor,
 | 
			
		||||
                                 ClutterActor          *leaf_that_queued);
 | 
			
		||||
  gboolean (* queue_redraw)     (ClutterActor          *actor,
 | 
			
		||||
                                 ClutterActor          *leaf_that_queued,
 | 
			
		||||
                                 ClutterPaintVolume    *paint_volume);
 | 
			
		||||
 | 
			
		||||
  /* size negotiation */
 | 
			
		||||
  void (* get_preferred_width)  (ClutterActor           *self,
 | 
			
		||||
@@ -583,6 +584,11 @@ gboolean                        clutter_actor_is_in_clone_paint
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean                        clutter_actor_get_paint_box                     (ClutterActor               *self,
 | 
			
		||||
                                                                                 ClutterActorBox            *box);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean                        clutter_actor_get_resource_scale                (ClutterActor *self,
 | 
			
		||||
                                                                                 gfloat       *resource_scale);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean                        clutter_actor_has_overlaps                      (ClutterActor               *self);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
 * to control how a #ClutterAnimation will animate a property.
 | 
			
		||||
 *
 | 
			
		||||
 * Each #ClutterAnimatable should implement the
 | 
			
		||||
 * #ClutterAnimatableIface.interpolate_property() virtual function of the
 | 
			
		||||
 * #ClutterAnimatableInterface.interpolate_property() virtual function of the
 | 
			
		||||
 * interface to compute the animation state between two values of an interval
 | 
			
		||||
 * depending on a progress factor, expressed as a floating point value.
 | 
			
		||||
 *
 | 
			
		||||
@@ -57,7 +57,6 @@
 | 
			
		||||
#include "deprecated/clutter-animatable.h"
 | 
			
		||||
#include "deprecated/clutter-animation.h"
 | 
			
		||||
 | 
			
		||||
typedef ClutterAnimatableIface  ClutterAnimatableInterface;
 | 
			
		||||
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -101,7 +100,7 @@ clutter_animatable_animate_property (ClutterAnimatable *animatable,
 | 
			
		||||
                                     gdouble            progress,
 | 
			
		||||
                                     GValue            *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterAnimatableIface *iface;
 | 
			
		||||
  ClutterAnimatableInterface *iface;
 | 
			
		||||
  gboolean res;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
 | 
			
		||||
@@ -155,7 +154,7 @@ GParamSpec *
 | 
			
		||||
clutter_animatable_find_property (ClutterAnimatable *animatable,
 | 
			
		||||
                                  const gchar       *property_name)
 | 
			
		||||
{
 | 
			
		||||
  ClutterAnimatableIface *iface;
 | 
			
		||||
  ClutterAnimatableInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
 | 
			
		||||
  g_return_val_if_fail (property_name != NULL, NULL);
 | 
			
		||||
@@ -185,7 +184,7 @@ clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
 | 
			
		||||
                                      const gchar       *property_name,
 | 
			
		||||
                                      GValue            *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterAnimatableIface *iface;
 | 
			
		||||
  ClutterAnimatableInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
 | 
			
		||||
  g_return_if_fail (property_name != NULL);
 | 
			
		||||
@@ -214,7 +213,7 @@ clutter_animatable_set_final_state (ClutterAnimatable *animatable,
 | 
			
		||||
                                    const gchar       *property_name,
 | 
			
		||||
                                    const GValue      *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterAnimatableIface *iface;
 | 
			
		||||
  ClutterAnimatableInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
 | 
			
		||||
  g_return_if_fail (property_name != NULL);
 | 
			
		||||
@@ -260,7 +259,7 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
 | 
			
		||||
                                      gdouble            progress,
 | 
			
		||||
                                      GValue            *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterAnimatableIface *iface;
 | 
			
		||||
  ClutterAnimatableInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
 | 
			
		||||
  g_return_val_if_fail (property_name != NULL, FALSE);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,24 +33,15 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#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))
 | 
			
		||||
#define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ())
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterAnimatableIface          ClutterAnimatableIface;
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
 | 
			
		||||
                     CLUTTER, ANIMATABLE,
 | 
			
		||||
                     GObject)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterAnimatable:
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterAnimatable is an opaque structure whose members cannot be directly
 | 
			
		||||
 * accessed
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterAnimatableIface:
 | 
			
		||||
 * ClutterAnimatableInterface:
 | 
			
		||||
 * @animate_property: virtual function for custom interpolation of a
 | 
			
		||||
 *   property. This virtual function is deprecated
 | 
			
		||||
 * @find_property: virtual function for retrieving the #GParamSpec of
 | 
			
		||||
@@ -67,7 +58,7 @@ typedef struct _ClutterAnimatableIface          ClutterAnimatableIface;
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterAnimatableIface
 | 
			
		||||
struct _ClutterAnimatableInterface
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GTypeInterface parent_iface;
 | 
			
		||||
@@ -95,9 +86,6 @@ struct _ClutterAnimatableIface
 | 
			
		||||
                                     GValue            *value);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
GType clutter_animatable_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
GParamSpec *clutter_animatable_find_property     (ClutterAnimatable *animatable,
 | 
			
		||||
                                                  const gchar       *property_name);
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAnimatable, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
 | 
			
		||||
@@ -49,7 +48,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
 | 
			
		||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContent, 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 (ClutterDeviceManager, g_object_unref)
 | 
			
		||||
 
 | 
			
		||||
@@ -160,8 +160,6 @@ void                    _clutter_backend_reset_cogl_framebuffer         (Clutter
 | 
			
		||||
 | 
			
		||||
void                    clutter_set_allowed_drivers                     (const char             *drivers);
 | 
			
		||||
 | 
			
		||||
void                    clutter_try_set_windowing_backend               (const char             *drivers);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -53,9 +53,6 @@
 | 
			
		||||
#include "clutter-stage-window.h"
 | 
			
		||||
#include "clutter-device-manager-private.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
#include "deprecated/clutter-backend.h"
 | 
			
		||||
 | 
			
		||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
 | 
			
		||||
#include "wayland/clutter-wayland-compositor.h"
 | 
			
		||||
#endif
 | 
			
		||||
@@ -903,129 +900,6 @@ clutter_get_default_backend (void)
 | 
			
		||||
  return clutter_context->backend;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_set_double_click_time:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 * @msec: milliseconds between two button press events
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the maximum time between two button press events, used to
 | 
			
		||||
 * verify whether it's a double click event or not.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_backend_set_double_click_time (ClutterBackend *backend,
 | 
			
		||||
                                       guint           msec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings = clutter_settings_get_default ();
 | 
			
		||||
 | 
			
		||||
  g_object_set (settings, "double-click-time", msec, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_get_double_click_time:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 *
 | 
			
		||||
 * Gets the maximum time between two button press events, as set
 | 
			
		||||
 * by clutter_backend_set_double_click_time().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: a time in milliseconds
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_backend_get_double_click_time (ClutterBackend *backend)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings = clutter_settings_get_default ();
 | 
			
		||||
  gint retval;
 | 
			
		||||
 | 
			
		||||
  g_object_get (settings, "double-click-time", &retval, NULL);
 | 
			
		||||
 | 
			
		||||
  return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_set_double_click_distance:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 * @distance: a distance, in pixels
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the maximum distance used to verify a double click event.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_backend_set_double_click_distance (ClutterBackend *backend,
 | 
			
		||||
                                           guint           distance)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings = clutter_settings_get_default ();
 | 
			
		||||
 | 
			
		||||
  g_object_set (settings, "double-click-distance", distance, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_get_double_click_distance:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the distance used to verify a double click event
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: a distance, in pixels.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_backend_get_double_click_distance (ClutterBackend *backend)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings = clutter_settings_get_default ();
 | 
			
		||||
  gint retval;
 | 
			
		||||
 | 
			
		||||
  g_object_get (settings, "double-click-distance", &retval, NULL);
 | 
			
		||||
 | 
			
		||||
  return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_set_resolution:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 * @dpi: the resolution in "dots per inch" (Physical inches aren't
 | 
			
		||||
 *   actually involved; the terminology is conventional).
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the resolution for font handling on the screen. This is a
 | 
			
		||||
 * scale factor between points specified in a #PangoFontDescription
 | 
			
		||||
 * and cairo units. The default value is 96, meaning that a 10 point
 | 
			
		||||
 * font will be 13 units high. (10 * 96. / 72. = 13.3).
 | 
			
		||||
 *
 | 
			
		||||
 * Applications should never need to call this function.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:font-dpi instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_backend_set_resolution (ClutterBackend *backend,
 | 
			
		||||
                                gdouble         dpi)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings;
 | 
			
		||||
  gint resolution;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BACKEND (backend));
 | 
			
		||||
 | 
			
		||||
  if (dpi < 0)
 | 
			
		||||
    resolution = -1;
 | 
			
		||||
  else
 | 
			
		||||
    resolution = dpi * 1024;
 | 
			
		||||
 | 
			
		||||
  settings = clutter_settings_get_default ();
 | 
			
		||||
  g_object_set (settings, "font-dpi", resolution, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_get_resolution:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
@@ -1131,61 +1005,6 @@ clutter_backend_get_font_options (ClutterBackend *backend)
 | 
			
		||||
  return backend->font_options;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_set_font_name:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 * @font_name: the name of the font
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the default font to be used by Clutter. The @font_name string
 | 
			
		||||
 * must either be %NULL, which means that the font name from the
 | 
			
		||||
 * default #ClutterBackend will be used; or be something that can
 | 
			
		||||
 * be parsed by the pango_font_description_from_string() function.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:font-name instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_backend_set_font_name (ClutterBackend *backend,
 | 
			
		||||
                               const gchar    *font_name)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings = clutter_settings_get_default ();
 | 
			
		||||
 | 
			
		||||
  g_object_set (settings, "font-name", font_name, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_backend_get_font_name:
 | 
			
		||||
 * @backend: a #ClutterBackend
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the default font name as set by
 | 
			
		||||
 * clutter_backend_set_font_name().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the font name for the backend. The returned string is
 | 
			
		||||
 *   owned by the #ClutterBackend and should never be modified or freed
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.4: Use #ClutterSettings:font-name instead
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
clutter_backend_get_font_name (ClutterBackend *backend)
 | 
			
		||||
{
 | 
			
		||||
  ClutterSettings *settings;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
 | 
			
		||||
 | 
			
		||||
  settings = clutter_settings_get_default ();
 | 
			
		||||
 | 
			
		||||
  /* XXX yuck. but we return a const pointer, so we need to
 | 
			
		||||
   * store it in the backend
 | 
			
		||||
   */
 | 
			
		||||
  g_free (backend->font_name);
 | 
			
		||||
  g_object_get (settings, "font-name", &backend->font_name, NULL);
 | 
			
		||||
 | 
			
		||||
  return backend->font_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gint32
 | 
			
		||||
_clutter_backend_get_units_serial (ClutterBackend *backend)
 | 
			
		||||
{
 | 
			
		||||
@@ -1275,61 +1094,6 @@ clutter_wayland_set_compositor_display (void *display)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_set_windowing_backend:
 | 
			
		||||
 * @backend_type: a comma separated list of windowing backends
 | 
			
		||||
 *
 | 
			
		||||
 * Restricts Clutter to only use the specified backend or list of backends.
 | 
			
		||||
 *
 | 
			
		||||
 * You can use one of the `CLUTTER_WINDOWING_*` symbols, e.g.
 | 
			
		||||
 *
 | 
			
		||||
 * |[<!-- language="C" -->
 | 
			
		||||
 *   clutter_set_windowing_backend (CLUTTER_WINDOWING_X11);
 | 
			
		||||
 * ]|
 | 
			
		||||
 *
 | 
			
		||||
 * Will force Clutter to use the X11 windowing and input backend, and terminate
 | 
			
		||||
 * if the X11 backend could not be initialized successfully.
 | 
			
		||||
 *
 | 
			
		||||
 * Since Clutter 1.26, you can also use a comma-separated list of windowing
 | 
			
		||||
 * system backends to provide a fallback in case backends are not available or
 | 
			
		||||
 * enabled, e.g.:
 | 
			
		||||
 *
 | 
			
		||||
 * |[<!-- language="C" -->
 | 
			
		||||
 *   clutter_set_windowing_backend ("gdk,wayland,x11");
 | 
			
		||||
 * ]|
 | 
			
		||||
 *
 | 
			
		||||
 * Will make Clutter test for the GDK, Wayland, and X11 backends in that order.
 | 
			
		||||
 *
 | 
			
		||||
 * You can use the `*` special value to ask Clutter to use the internally
 | 
			
		||||
 * defined list of backends. For instance:
 | 
			
		||||
 *
 | 
			
		||||
 * |[<!-- language="C" -->
 | 
			
		||||
 *   clutter_set_windowing_backend ("x11,wayland,*");
 | 
			
		||||
 * ]|
 | 
			
		||||
 *
 | 
			
		||||
 * Will make Clutter test the X11 and Wayland backends, and then fall back
 | 
			
		||||
 * to the internal list of available backends.
 | 
			
		||||
 *
 | 
			
		||||
 * This function must be called before the first API call to Clutter, including
 | 
			
		||||
 * clutter_get_option_context()
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.16
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_set_windowing_backend (const char *backend_type)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (backend_type != NULL);
 | 
			
		||||
 | 
			
		||||
  allowed_backends = g_strdup (backend_type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clutter_try_set_windowing_backend (const char *backend_type)
 | 
			
		||||
{
 | 
			
		||||
  if (allowed_backends == NULL)
 | 
			
		||||
    clutter_set_windowing_backend (backend_type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
PangoDirection
 | 
			
		||||
_clutter_backend_get_keymap_direction (ClutterBackend *backend)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -60,9 +60,6 @@ GType clutter_backend_get_type (void) G_GNUC_CONST;
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
ClutterBackend *                clutter_get_default_backend             (void);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void                            clutter_set_windowing_backend           (const char *backend_type);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gdouble                         clutter_backend_get_resolution          (ClutterBackend             *backend);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1146,29 +1146,60 @@ clutter_rect_inset (ClutterRect *rect,
 | 
			
		||||
    rect->size.height = 0.f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_rect_scale:
 | 
			
		||||
 * @rect: a #ClutterRect
 | 
			
		||||
 * @s_x: an horizontal scale value
 | 
			
		||||
 * @s_y: a vertical scale value
 | 
			
		||||
 *
 | 
			
		||||
 * Scale the rectangle coordinates and size by @s_x horizontally and
 | 
			
		||||
 * @s_y vertically.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_rect_scale (ClutterRect *rect,
 | 
			
		||||
                    float        s_x,
 | 
			
		||||
                    float        s_y)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (rect != NULL);
 | 
			
		||||
  g_return_if_fail (s_x > 0.f);
 | 
			
		||||
  g_return_if_fail (s_y > 0.f);
 | 
			
		||||
 | 
			
		||||
  clutter_rect_normalize_internal (rect);
 | 
			
		||||
 | 
			
		||||
  rect->origin.x *= s_x;
 | 
			
		||||
  rect->origin.y *= s_y;
 | 
			
		||||
  rect->size.width *= s_x;
 | 
			
		||||
  rect->size.height *= s_y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_rect_clamp_to_pixel:
 | 
			
		||||
 * @rect: a #ClutterRect
 | 
			
		||||
 *
 | 
			
		||||
 * Rounds the origin of @rect downwards to the nearest integer, and rounds
 | 
			
		||||
 * the size of @rect upwards to the nearest integer, so that @rect is
 | 
			
		||||
 * updated to the smallest rectangle capable of fully containing the
 | 
			
		||||
 * original, fractional rectangle.
 | 
			
		||||
 * Rounds the origin of @rect downwards to the nearest integer, and recompute the
 | 
			
		||||
 * the size using the @rect origin and size rounded upwards to the nearest integer,
 | 
			
		||||
 * so that @rect is updated to the smallest rectangle capable of fully containing
 | 
			
		||||
 * the original, fractional rectangle in the coordinates space.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_rect_clamp_to_pixel (ClutterRect *rect)
 | 
			
		||||
{
 | 
			
		||||
  float x2, y2;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (rect != NULL);
 | 
			
		||||
 | 
			
		||||
  clutter_rect_normalize_internal (rect);
 | 
			
		||||
 | 
			
		||||
  x2 = rect->origin.x + rect->size.width;
 | 
			
		||||
  y2 = rect->origin.y + rect->size.height;
 | 
			
		||||
 | 
			
		||||
  rect->origin.x = floorf (rect->origin.x);
 | 
			
		||||
  rect->origin.y = floorf (rect->origin.y);
 | 
			
		||||
 | 
			
		||||
  rect->size.width = ceilf (rect->size.width);
 | 
			
		||||
  rect->size.height = ceilf (rect->size.height);
 | 
			
		||||
  rect->size.width = ceilf (x2) - rect->origin.x;
 | 
			
		||||
  rect->size.height = ceilf (y2) - rect->origin.y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -249,9 +249,7 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
 | 
			
		||||
      cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
 | 
			
		||||
      cogl_object_unref (snippet);
 | 
			
		||||
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
 | 
			
		||||
                                            0, /* layer number */
 | 
			
		||||
                                            COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
 | 
			
		||||
 
 | 
			
		||||
@@ -438,9 +438,7 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
 | 
			
		||||
      cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
 | 
			
		||||
      cogl_object_unref (snippet);
 | 
			
		||||
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
 | 
			
		||||
                                            0, /* layer number */
 | 
			
		||||
                                            COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#include <cogl/cogl.h>
 | 
			
		||||
#include <cairo-gobject.h>
 | 
			
		||||
 | 
			
		||||
@@ -69,6 +70,7 @@ struct _ClutterCanvasPrivate
 | 
			
		||||
 | 
			
		||||
  int width;
 | 
			
		||||
  int height;
 | 
			
		||||
  float scale_factor;
 | 
			
		||||
 | 
			
		||||
  CoglTexture *texture;
 | 
			
		||||
  gboolean dirty;
 | 
			
		||||
@@ -82,6 +84,7 @@ enum
 | 
			
		||||
 | 
			
		||||
  PROP_WIDTH,
 | 
			
		||||
  PROP_HEIGHT,
 | 
			
		||||
  PROP_SCALE_FACTOR,
 | 
			
		||||
 | 
			
		||||
  LAST_PROP
 | 
			
		||||
};
 | 
			
		||||
@@ -97,7 +100,7 @@ enum
 | 
			
		||||
 | 
			
		||||
static guint canvas_signals[LAST_SIGNAL] = { 0, };
 | 
			
		||||
 | 
			
		||||
static void clutter_content_iface_init (ClutterContentIface *iface);
 | 
			
		||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
 | 
			
		||||
                         G_ADD_PRIVATE (ClutterCanvas)
 | 
			
		||||
@@ -178,6 +181,19 @@ clutter_canvas_set_property (GObject      *gobject,
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_SCALE_FACTOR:
 | 
			
		||||
      {
 | 
			
		||||
        gfloat new_scale_factor = g_value_get_float (value);
 | 
			
		||||
 | 
			
		||||
        if (priv->scale_factor != new_scale_factor)
 | 
			
		||||
          {
 | 
			
		||||
            priv->scale_factor = new_scale_factor;
 | 
			
		||||
 | 
			
		||||
            clutter_content_invalidate (CLUTTER_CONTENT (gobject));
 | 
			
		||||
          }
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
@@ -202,6 +218,10 @@ clutter_canvas_get_property (GObject    *gobject,
 | 
			
		||||
      g_value_set_int (value, priv->height);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_SCALE_FACTOR:
 | 
			
		||||
      g_value_set_float (value, priv->scale_factor);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
@@ -245,6 +265,19 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
 | 
			
		||||
                      G_PARAM_READWRITE |
 | 
			
		||||
                      G_PARAM_STATIC_STRINGS);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterCanvas:scale-factor:
 | 
			
		||||
   *
 | 
			
		||||
   * The height of the canvas.
 | 
			
		||||
   */
 | 
			
		||||
  obj_props[PROP_SCALE_FACTOR] =
 | 
			
		||||
    g_param_spec_float ("scale-factor",
 | 
			
		||||
                        P_("Scale Factor"),
 | 
			
		||||
                        P_("The Scale factor of the canvas"),
 | 
			
		||||
                        0.01f, G_MAXFLOAT,
 | 
			
		||||
                        1.0f,
 | 
			
		||||
                        G_PARAM_READWRITE |
 | 
			
		||||
                        G_PARAM_STATIC_STRINGS);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterCanvas::draw:
 | 
			
		||||
@@ -291,6 +324,7 @@ clutter_canvas_init (ClutterCanvas *self)
 | 
			
		||||
 | 
			
		||||
  self->priv->width = -1;
 | 
			
		||||
  self->priv->height = -1;
 | 
			
		||||
  self->priv->scale_factor = 1.0f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -340,8 +374,8 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
 | 
			
		||||
 | 
			
		||||
  priv->dirty = TRUE;
 | 
			
		||||
 | 
			
		||||
  real_width = priv->width;
 | 
			
		||||
  real_height = priv->height;
 | 
			
		||||
  real_width = ceilf (priv->width * priv->scale_factor);
 | 
			
		||||
  real_height = ceilf (priv->height * priv->scale_factor);
 | 
			
		||||
 | 
			
		||||
  CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
 | 
			
		||||
                priv->width, priv->height);
 | 
			
		||||
@@ -387,6 +421,10 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
 | 
			
		||||
      mapped_buffer = FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  cairo_surface_set_device_scale (surface,
 | 
			
		||||
                                  priv->scale_factor,
 | 
			
		||||
                                  priv->scale_factor);
 | 
			
		||||
 | 
			
		||||
  self->priv->cr = cr = cairo_create (surface);
 | 
			
		||||
 | 
			
		||||
  g_signal_emit (self, canvas_signals[DRAW], 0,
 | 
			
		||||
@@ -448,16 +486,16 @@ clutter_canvas_get_preferred_size (ClutterContent *content,
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  if (width != NULL)
 | 
			
		||||
    *width = priv->width;
 | 
			
		||||
    *width = ceilf (priv->width * priv->scale_factor);
 | 
			
		||||
 | 
			
		||||
  if (height != NULL)
 | 
			
		||||
    *height = priv->height;
 | 
			
		||||
    *height = ceilf (priv->height * priv->scale_factor);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_content_iface_init (ClutterContentIface *iface)
 | 
			
		||||
clutter_content_iface_init (ClutterContentInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  iface->invalidate = clutter_canvas_invalidate;
 | 
			
		||||
  iface->paint_content = clutter_canvas_paint_content;
 | 
			
		||||
@@ -560,3 +598,48 @@ clutter_canvas_set_size (ClutterCanvas *canvas,
 | 
			
		||||
 | 
			
		||||
  return clutter_canvas_invalidate_internal (canvas, width, height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_canvas_set_scale_factor:
 | 
			
		||||
 * @canvas: a #ClutterCanvas
 | 
			
		||||
 * @scale: the integer scaling factor of the canvas
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the scaling factor of the @canvas, and invalidates the content.
 | 
			
		||||
 *
 | 
			
		||||
 * This function will cause the @canvas to be invalidated only
 | 
			
		||||
 * if the scale factor of the canvas surface has changed.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
 | 
			
		||||
                                 float          scale)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
 | 
			
		||||
  g_return_if_fail (scale > 0.0f);
 | 
			
		||||
 | 
			
		||||
  if (canvas->priv->scale_factor != scale)
 | 
			
		||||
    {
 | 
			
		||||
      canvas->priv->scale_factor = scale;
 | 
			
		||||
 | 
			
		||||
      g_object_freeze_notify (G_OBJECT (canvas));
 | 
			
		||||
      clutter_content_invalidate (CLUTTER_CONTENT (canvas));
 | 
			
		||||
      g_object_thaw_notify (G_OBJECT (canvas));
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (canvas), obj_props[PROP_SCALE_FACTOR]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_canvas_get_scale_factor:
 | 
			
		||||
 * @canvas: a #ClutterCanvas
 | 
			
		||||
 *
 | 
			
		||||
 * Gets the scale factor of the @canvas.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the current @canvas scale factor or -1 if invalid
 | 
			
		||||
 */
 | 
			
		||||
float
 | 
			
		||||
clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1.0f);
 | 
			
		||||
 | 
			
		||||
  return canvas->priv->scale_factor;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -97,9 +97,9 @@ gboolean                clutter_canvas_set_size                 (ClutterCanvas *
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void                    clutter_canvas_set_scale_factor         (ClutterCanvas *canvas,
 | 
			
		||||
                                                                 int            scale);
 | 
			
		||||
                                                                 float          scale);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
int                     clutter_canvas_get_scale_factor         (ClutterCanvas *canvas);
 | 
			
		||||
float                   clutter_canvas_get_scale_factor         (ClutterCanvas *canvas);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -293,9 +293,7 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
 | 
			
		||||
      cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
 | 
			
		||||
      cogl_object_unref (snippet);
 | 
			
		||||
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
 | 
			
		||||
                                            0, /* layer number */
 | 
			
		||||
                                            COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,6 @@
 | 
			
		||||
#include "clutter-marshal.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterContentIface     ClutterContentInterface;
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  ATTACHED,
 | 
			
		||||
@@ -130,7 +128,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
 | 
			
		||||
    g_signal_new (I_("attached"),
 | 
			
		||||
                  G_TYPE_FROM_INTERFACE (iface),
 | 
			
		||||
                  G_SIGNAL_RUN_FIRST,
 | 
			
		||||
                  G_STRUCT_OFFSET (ClutterContentIface, attached),
 | 
			
		||||
                  G_STRUCT_OFFSET (ClutterContentInterface, attached),
 | 
			
		||||
                  NULL, NULL,
 | 
			
		||||
                  _clutter_marshal_VOID__OBJECT,
 | 
			
		||||
                  G_TYPE_NONE, 1,
 | 
			
		||||
@@ -150,7 +148,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
 | 
			
		||||
    g_signal_new (I_("detached"),
 | 
			
		||||
                  G_TYPE_FROM_INTERFACE (iface),
 | 
			
		||||
                  G_SIGNAL_RUN_FIRST,
 | 
			
		||||
                  G_STRUCT_OFFSET (ClutterContentIface, detached),
 | 
			
		||||
                  G_STRUCT_OFFSET (ClutterContentInterface, detached),
 | 
			
		||||
                  NULL, NULL,
 | 
			
		||||
                  _clutter_marshal_VOID__OBJECT,
 | 
			
		||||
                  G_TYPE_NONE, 1,
 | 
			
		||||
@@ -245,7 +243,7 @@ clutter_content_invalidate_size (ClutterContent *content)
 | 
			
		||||
 * is associated to a #ClutterContent, to set up a backpointer from
 | 
			
		||||
 * the @content to the @actor.
 | 
			
		||||
 *
 | 
			
		||||
 * This function will invoke the #ClutterContentIface.attached() virtual
 | 
			
		||||
 * This function will invoke the #ClutterContentInterface.attached() virtual
 | 
			
		||||
 * function.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
@@ -279,7 +277,7 @@ _clutter_content_attached (ClutterContent *content,
 | 
			
		||||
 * This function should be used internally every time a #ClutterActor
 | 
			
		||||
 * removes the association with a #ClutterContent.
 | 
			
		||||
 *
 | 
			
		||||
 * This function will invoke the #ClutterContentIface.detached() virtual
 | 
			
		||||
 * This function will invoke the #ClutterContentInterface.detached() virtual
 | 
			
		||||
 * function.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
@@ -308,7 +306,7 @@ _clutter_content_detached (ClutterContent *content,
 | 
			
		||||
 *
 | 
			
		||||
 * Creates the render tree for the @content and @actor.
 | 
			
		||||
 *
 | 
			
		||||
 * This function will invoke the #ClutterContentIface.paint_content()
 | 
			
		||||
 * This function will invoke the #ClutterContentInterface.paint_content()
 | 
			
		||||
 * virtual function.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -33,24 +33,13 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_CONTENT            (clutter_content_get_type ())
 | 
			
		||||
#define CLUTTER_CONTENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTENT, ClutterContent))
 | 
			
		||||
#define CLUTTER_IS_CONTENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTENT))
 | 
			
		||||
#define CLUTTER_CONTENT_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTENT, ClutterContentIface))
 | 
			
		||||
#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterContentIface     ClutterContentIface;
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterContent:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterContent structure is an opaque type
 | 
			
		||||
 * whose members cannot be acccessed directly.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterContentIface:
 | 
			
		||||
 * ClutterContentInterface:
 | 
			
		||||
 * @get_preferred_size: virtual function; should be overridden by subclasses
 | 
			
		||||
 *   of #ClutterContent that have a natural size
 | 
			
		||||
 * @paint_content: virtual function; called each time the content needs to
 | 
			
		||||
@@ -62,12 +51,12 @@ typedef struct _ClutterContentIface     ClutterContentIface;
 | 
			
		||||
 * @invalidate: virtual function; called each time a #ClutterContent state
 | 
			
		||||
 *   is changed.
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterContentIface structure contains only
 | 
			
		||||
 * The #ClutterContentInterface structure contains only
 | 
			
		||||
 * private data.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterContentIface
 | 
			
		||||
struct _ClutterContentInterface
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GTypeInterface g_iface;
 | 
			
		||||
@@ -90,9 +79,6 @@ struct _ClutterContentIface
 | 
			
		||||
  void          (* invalidate_size)     (ClutterContent   *content);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
GType clutter_content_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean        clutter_content_get_preferred_size      (ClutterContent *content,
 | 
			
		||||
                                                         gfloat         *width,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,8 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_DEBUG_MISC                = 1 << 0,
 | 
			
		||||
  CLUTTER_DEBUG_ACTOR               = 1 << 1,
 | 
			
		||||
  CLUTTER_DEBUG_TEXTURE             = 1 << 2,
 | 
			
		||||
@@ -26,12 +27,14 @@ typedef enum {
 | 
			
		||||
  CLUTTER_DEBUG_OOB_TRANSFORMS      = 1 << 16
 | 
			
		||||
} ClutterDebugFlag;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_DEBUG_NOP_PICKING         = 1 << 0,
 | 
			
		||||
  CLUTTER_DEBUG_DUMP_PICK_BUFFERS   = 1 << 1
 | 
			
		||||
} ClutterPickDebugFlag;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_DEBUG_DISABLE_SWAP_EVENTS     = 1 << 0,
 | 
			
		||||
  CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
 | 
			
		||||
  CLUTTER_DEBUG_REDRAWS                 = 1 << 2,
 | 
			
		||||
 
 | 
			
		||||
@@ -7,37 +7,24 @@
 | 
			
		||||
#include "deprecated/clutter-alpha.h"
 | 
			
		||||
#include "deprecated/clutter-animatable.h"
 | 
			
		||||
#include "deprecated/clutter-animation.h"
 | 
			
		||||
#include "deprecated/clutter-animator.h"
 | 
			
		||||
#include "deprecated/clutter-backend.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-depth.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-ellipse.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-opacity.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-path.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-rotate.h"
 | 
			
		||||
#include "deprecated/clutter-behaviour-scale.h"
 | 
			
		||||
#include "deprecated/clutter-bin-layout.h"
 | 
			
		||||
#include "deprecated/clutter-box.h"
 | 
			
		||||
#include "deprecated/clutter-cairo-texture.h"
 | 
			
		||||
#include "deprecated/clutter-container.h"
 | 
			
		||||
#include "deprecated/clutter-frame-source.h"
 | 
			
		||||
#include "deprecated/clutter-group.h"
 | 
			
		||||
#include "deprecated/clutter-input-device.h"
 | 
			
		||||
#include "deprecated/clutter-keysyms.h"
 | 
			
		||||
#include "deprecated/clutter-list-model.h"
 | 
			
		||||
#include "deprecated/clutter-main.h"
 | 
			
		||||
#include "deprecated/clutter-model.h"
 | 
			
		||||
#include "deprecated/clutter-rectangle.h"
 | 
			
		||||
#include "deprecated/clutter-score.h"
 | 
			
		||||
#include "deprecated/clutter-shader.h"
 | 
			
		||||
#include "deprecated/clutter-stage-manager.h"
 | 
			
		||||
#include "deprecated/clutter-stage.h"
 | 
			
		||||
#include "deprecated/clutter-state.h"
 | 
			
		||||
#include "deprecated/clutter-table-layout.h"
 | 
			
		||||
#include "deprecated/clutter-texture.h"
 | 
			
		||||
#include "deprecated/clutter-timeline.h"
 | 
			
		||||
#include "deprecated/clutter-timeout-pool.h"
 | 
			
		||||
#include "deprecated/clutter-util.h"
 | 
			
		||||
 | 
			
		||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -297,9 +297,7 @@ clutter_desaturate_effect_init (ClutterDesaturateEffect *self)
 | 
			
		||||
      cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
 | 
			
		||||
      cogl_object_unref (snippet);
 | 
			
		||||
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
 | 
			
		||||
                                            0, /* layer number */
 | 
			
		||||
                                            COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
 | 
			
		||||
 
 | 
			
		||||
@@ -167,10 +167,6 @@ struct _ClutterInputDeviceClass
 | 
			
		||||
  gboolean (* is_grouped) (ClutterInputDevice *device,
 | 
			
		||||
                           ClutterInputDevice *other_device);
 | 
			
		||||
 | 
			
		||||
  gboolean (* get_physical_size) (ClutterInputDevice *device,
 | 
			
		||||
                                  gdouble            *width,
 | 
			
		||||
                                  gdouble            *height);
 | 
			
		||||
 | 
			
		||||
  /* Keyboard accessbility */
 | 
			
		||||
  void (* process_kbd_a11y_event) (ClutterEvent               *event,
 | 
			
		||||
                                   ClutterInputDevice         *device,
 | 
			
		||||
 
 | 
			
		||||
@@ -550,13 +550,7 @@ static gboolean
 | 
			
		||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
 | 
			
		||||
                             ClutterKbdA11ySettings *b)
 | 
			
		||||
{
 | 
			
		||||
  return (a->controls == b->controls &&
 | 
			
		||||
          a->slowkeys_delay == b->slowkeys_delay &&
 | 
			
		||||
          a->debounce_delay == b->debounce_delay &&
 | 
			
		||||
          a->timeout_delay == b->timeout_delay &&
 | 
			
		||||
          a->mousekeys_init_delay == b->mousekeys_init_delay &&
 | 
			
		||||
          a->mousekeys_max_speed == b->mousekeys_max_speed &&
 | 
			
		||||
          a->mousekeys_accel_time == b->mousekeys_accel_time);
 | 
			
		||||
  return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,8 @@ G_BEGIN_DECLS
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.22: Use the normalized #ClutterActor pivot point instead
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_GRAVITY >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_GRAVITY_NONE       = 0,
 | 
			
		||||
  CLUTTER_GRAVITY_NORTH,
 | 
			
		||||
  CLUTTER_GRAVITY_NORTH_EAST,
 | 
			
		||||
@@ -74,7 +75,8 @@ typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_X_AXIS,
 | 
			
		||||
  CLUTTER_Y_AXIS,
 | 
			
		||||
  CLUTTER_Z_AXIS
 | 
			
		||||
@@ -91,7 +93,8 @@ typedef enum { /*< prefix=CLUTTER >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.22
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_ROTATE >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_ROTATE >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ROTATE_CW,
 | 
			
		||||
  CLUTTER_ROTATE_CCW
 | 
			
		||||
} ClutterRotateDirection;
 | 
			
		||||
@@ -107,7 +110,8 @@ typedef enum { /*< prefix=CLUTTER_ROTATE >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_REQUEST >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_REQUEST >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
 | 
			
		||||
  CLUTTER_REQUEST_WIDTH_FOR_HEIGHT,
 | 
			
		||||
  CLUTTER_REQUEST_CONTENT_SIZE
 | 
			
		||||
@@ -200,7 +204,8 @@ typedef enum { /*< prefix=CLUTTER_REQUEST >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_CUSTOM_MODE = 0,
 | 
			
		||||
 | 
			
		||||
  /* linear */
 | 
			
		||||
@@ -284,7 +289,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.22: Use #cairo_font_options_t instead
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_FONT >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_FONT >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_FONT_MIPMAPPING = (1 << 0),
 | 
			
		||||
  CLUTTER_FONT_HINTING    = (1 << 1)
 | 
			
		||||
} ClutterFontFlags;
 | 
			
		||||
@@ -300,7 +306,8 @@ typedef enum { /*< prefix=CLUTTER_FONT >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TEXT_DIRECTION_DEFAULT,
 | 
			
		||||
  CLUTTER_TEXT_DIRECTION_LTR,
 | 
			
		||||
  CLUTTER_TEXT_DIRECTION_RTL
 | 
			
		||||
@@ -315,7 +322,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_VERTEX_SHADER,
 | 
			
		||||
  CLUTTER_FRAGMENT_SHADER
 | 
			
		||||
} ClutterShaderType;
 | 
			
		||||
@@ -350,7 +358,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SHIFT_MASK    = 1 << 0,
 | 
			
		||||
  CLUTTER_LOCK_MASK     = 1 << 1,
 | 
			
		||||
  CLUTTER_CONTROL_MASK  = 1 << 2,
 | 
			
		||||
@@ -416,7 +425,8 @@ typedef enum {
 | 
			
		||||
 * Keyboard accessibility features applied to a ClutterInputDevice keyboard.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_A11Y_KEYBOARD_ENABLED          = 1 << 0,
 | 
			
		||||
  CLUTTER_A11Y_TIMEOUT_ENABLED           = 1 << 1,
 | 
			
		||||
  CLUTTER_A11Y_MOUSE_KEYS_ENABLED        = 1 << 2,
 | 
			
		||||
@@ -448,7 +458,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Flags used to signal the state of an actor.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_ACTOR >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_ACTOR >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ACTOR_MAPPED    = 1 << 1,
 | 
			
		||||
  CLUTTER_ACTOR_REALIZED  = 1 << 2,
 | 
			
		||||
  CLUTTER_ACTOR_REACTIVE  = 1 << 3,
 | 
			
		||||
@@ -468,7 +479,8 @@ typedef enum { /*< prefix=CLUTTER_ACTOR >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.8
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1<<0,
 | 
			
		||||
  CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1<<1
 | 
			
		||||
} ClutterOffscreenRedirect;
 | 
			
		||||
@@ -492,7 +504,8 @@ typedef enum { /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ALLOCATION_NONE         = 0,
 | 
			
		||||
  CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
 | 
			
		||||
  CLUTTER_DELEGATE_LAYOUT         = 1 << 2
 | 
			
		||||
@@ -509,7 +522,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_ALIGN >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_ALIGN >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ALIGN_X_AXIS,
 | 
			
		||||
  CLUTTER_ALIGN_Y_AXIS,
 | 
			
		||||
  CLUTTER_ALIGN_BOTH
 | 
			
		||||
@@ -526,7 +540,8 @@ typedef enum { /*< prefix=CLUTTER_ALIGN >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.22
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INTERPOLATION_LINEAR,
 | 
			
		||||
  CLUTTER_INTERPOLATION_CUBIC
 | 
			
		||||
} ClutterInterpolation;
 | 
			
		||||
@@ -551,7 +566,8 @@ typedef enum {
 | 
			
		||||
 * Deprecated: 1.12: Use #ClutterActorAlign and the #ClutterActor
 | 
			
		||||
 *   API instead
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_BIN_ALIGNMENT_FIXED,
 | 
			
		||||
  CLUTTER_BIN_ALIGNMENT_FILL,
 | 
			
		||||
  CLUTTER_BIN_ALIGNMENT_START,
 | 
			
		||||
@@ -576,7 +592,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_BIND >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_BIND >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_BIND_X,
 | 
			
		||||
  CLUTTER_BIND_Y,
 | 
			
		||||
  CLUTTER_BIND_WIDTH,
 | 
			
		||||
@@ -595,7 +612,8 @@ typedef enum { /*< prefix=CLUTTER_BIND >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Flags passed to the ‘paint’ or ‘pick’ method of #ClutterEffect.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_EFFECT_PAINT >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_EFFECT_PAINT >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0)
 | 
			
		||||
} ClutterEffectPaintFlags;
 | 
			
		||||
 | 
			
		||||
@@ -611,7 +629,8 @@ typedef enum { /*< prefix=CLUTTER_EFFECT_PAINT >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_BOX_ALIGNMENT_START,
 | 
			
		||||
  CLUTTER_BOX_ALIGNMENT_END,
 | 
			
		||||
  CLUTTER_BOX_ALIGNMENT_CENTER
 | 
			
		||||
@@ -628,7 +647,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.8
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_LONG_PRESS >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_LONG_PRESS >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_LONG_PRESS_QUERY,
 | 
			
		||||
  CLUTTER_LONG_PRESS_ACTIVATE,
 | 
			
		||||
  CLUTTER_LONG_PRESS_CANCEL
 | 
			
		||||
@@ -686,7 +706,8 @@ typedef enum { /*< prefix=CLUTTER_LONG_PRESS >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_COLOR >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_COLOR >*/
 | 
			
		||||
{
 | 
			
		||||
  /* CGA/EGA-like palette */
 | 
			
		||||
  CLUTTER_COLOR_WHITE           = 0,
 | 
			
		||||
  CLUTTER_COLOR_BLACK,
 | 
			
		||||
@@ -750,7 +771,8 @@ typedef enum { /*< prefix=CLUTTER_COLOR >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_DRAG >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_DRAG >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_DRAG_AXIS_NONE = 0,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_DRAG_X_AXIS,
 | 
			
		||||
@@ -767,7 +789,8 @@ typedef enum { /*< prefix=CLUTTER_DRAG >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
 | 
			
		||||
typedef enum /*< flags prefix=CLUTTER_EVENT >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_EVENT_NONE              = 0,
 | 
			
		||||
  CLUTTER_EVENT_FLAG_SYNTHETIC    = 1 << 0,
 | 
			
		||||
  CLUTTER_EVENT_FLAG_INPUT_METHOD = 1 << 1,
 | 
			
		||||
@@ -812,7 +835,8 @@ typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_NOTHING = 0,
 | 
			
		||||
  CLUTTER_KEY_PRESS,
 | 
			
		||||
  CLUTTER_KEY_RELEASE,
 | 
			
		||||
@@ -857,7 +881,8 @@ typedef enum { /*< prefix=CLUTTER >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCROLL_UP,
 | 
			
		||||
  CLUTTER_SCROLL_DOWN,
 | 
			
		||||
  CLUTTER_SCROLL_LEFT,
 | 
			
		||||
@@ -875,7 +900,8 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_STAGE_STATE_FULLSCREEN       = (1 << 1),
 | 
			
		||||
  CLUTTER_STAGE_STATE_OFFSCREEN        = (1 << 2),
 | 
			
		||||
  CLUTTER_STAGE_STATE_ACTIVATED        = (1 << 3)
 | 
			
		||||
@@ -883,7 +909,6 @@ typedef enum {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterFeatureFlags:
 | 
			
		||||
 * @CLUTTER_FEATURE_TEXTURE_NPOT: Set if NPOTS textures supported.
 | 
			
		||||
 * @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
 | 
			
		||||
 * @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
 | 
			
		||||
 * @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
 | 
			
		||||
@@ -902,7 +927,6 @@ typedef enum {
 | 
			
		||||
 */
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_FEATURE_TEXTURE_NPOT           = (1 << 2),
 | 
			
		||||
  CLUTTER_FEATURE_SWAP_THROTTLE          = (1 << 3),
 | 
			
		||||
  CLUTTER_FEATURE_TEXTURE_YUV            = (1 << 4),
 | 
			
		||||
  CLUTTER_FEATURE_TEXTURE_READ_PIXELS    = (1 << 5),
 | 
			
		||||
@@ -927,7 +951,8 @@ typedef enum
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_FLOW >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_FLOW >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_FLOW_HORIZONTAL,
 | 
			
		||||
  CLUTTER_FLOW_VERTICAL
 | 
			
		||||
} ClutterFlowOrientation;
 | 
			
		||||
@@ -954,7 +979,8 @@ typedef enum { /*< prefix=CLUTTER_FLOW >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_POINTER_DEVICE,
 | 
			
		||||
  CLUTTER_KEYBOARD_DEVICE,
 | 
			
		||||
  CLUTTER_EXTENSION_DEVICE,
 | 
			
		||||
@@ -982,7 +1008,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_MODE_MASTER,
 | 
			
		||||
  CLUTTER_INPUT_MODE_SLAVE,
 | 
			
		||||
  CLUTTER_INPUT_MODE_FLOATING
 | 
			
		||||
@@ -1007,7 +1034,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_AXIS_IGNORE,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_INPUT_AXIS_X,
 | 
			
		||||
@@ -1034,7 +1062,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SNAP_EDGE_TOP,
 | 
			
		||||
  CLUTTER_SNAP_EDGE_RIGHT,
 | 
			
		||||
  CLUTTER_SNAP_EDGE_BOTTOM,
 | 
			
		||||
@@ -1051,7 +1080,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_PICK_NONE = 0,
 | 
			
		||||
  CLUTTER_PICK_REACTIVE,
 | 
			
		||||
  CLUTTER_PICK_ALL
 | 
			
		||||
@@ -1068,7 +1098,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.8
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SWIPE_DIRECTION_UP    = 1 << 0,
 | 
			
		||||
  CLUTTER_SWIPE_DIRECTION_DOWN  = 1 << 1,
 | 
			
		||||
  CLUTTER_SWIPE_DIRECTION_LEFT  = 1 << 2,
 | 
			
		||||
@@ -1088,7 +1119,8 @@ typedef enum { /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_PAN >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_PAN >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_PAN_AXIS_NONE = 0,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_PAN_X_AXIS,
 | 
			
		||||
@@ -1113,7 +1145,8 @@ typedef enum { /*< prefix=CLUTTER_PAN >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.22: Use the alignment properties of #ClutterActor
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TABLE_ALIGNMENT_START,
 | 
			
		||||
  CLUTTER_TABLE_ALIGNMENT_CENTER,
 | 
			
		||||
  CLUTTER_TABLE_ALIGNMENT_END
 | 
			
		||||
@@ -1134,7 +1167,8 @@ typedef enum {
 | 
			
		||||
 * Deprecated: 1.22: The #ClutterTexture class was the only user of
 | 
			
		||||
 *   this API
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_TEXTURE >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_TEXTURE >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TEXTURE_NONE             = 0,
 | 
			
		||||
  CLUTTER_TEXTURE_RGB_FLAG_BGR     = 1 << 1,
 | 
			
		||||
  CLUTTER_TEXTURE_RGB_FLAG_PREMULT = 1 << 2, /* FIXME: not handled */
 | 
			
		||||
@@ -1158,7 +1192,8 @@ typedef enum { /*< prefix=CLUTTER_TEXTURE >*/
 | 
			
		||||
 *   this API; use #ClutterImage and clutter_actor_set_content_scaling_filters()
 | 
			
		||||
 *   instead.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TEXTURE_QUALITY_LOW,
 | 
			
		||||
  CLUTTER_TEXTURE_QUALITY_MEDIUM,
 | 
			
		||||
  CLUTTER_TEXTURE_QUALITY_HIGH
 | 
			
		||||
@@ -1173,7 +1208,8 @@ typedef enum { /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TIMELINE_FORWARD,
 | 
			
		||||
  CLUTTER_TIMELINE_BACKWARD
 | 
			
		||||
} ClutterTimelineDirection;
 | 
			
		||||
@@ -1192,7 +1228,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_UNIT >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_UNIT >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_UNIT_PIXEL,
 | 
			
		||||
  CLUTTER_UNIT_EM,
 | 
			
		||||
  CLUTTER_UNIT_MM,
 | 
			
		||||
@@ -1222,7 +1259,8 @@ typedef enum { /*< prefix=CLUTTER_UNIT >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_PATH_MOVE_TO      = 0,
 | 
			
		||||
  CLUTTER_PATH_LINE_TO      = 1,
 | 
			
		||||
  CLUTTER_PATH_CURVE_TO     = 2,
 | 
			
		||||
@@ -1253,7 +1291,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ACTOR_ALIGN_FILL,
 | 
			
		||||
  CLUTTER_ACTOR_ALIGN_START,
 | 
			
		||||
  CLUTTER_ACTOR_ALIGN_CENTER,
 | 
			
		||||
@@ -1273,7 +1312,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
 | 
			
		||||
  CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
 | 
			
		||||
  CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD = 1 << 2
 | 
			
		||||
@@ -1298,7 +1338,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_CONTENT_GRAVITY_TOP_LEFT,
 | 
			
		||||
  CLUTTER_CONTENT_GRAVITY_TOP,
 | 
			
		||||
  CLUTTER_CONTENT_GRAVITY_TOP_RIGHT,
 | 
			
		||||
@@ -1328,7 +1369,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCALING_FILTER_LINEAR,
 | 
			
		||||
  CLUTTER_SCALING_FILTER_NEAREST,
 | 
			
		||||
  CLUTTER_SCALING_FILTER_TRILINEAR
 | 
			
		||||
@@ -1343,7 +1385,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ORIENTATION_HORIZONTAL,
 | 
			
		||||
  CLUTTER_ORIENTATION_VERTICAL
 | 
			
		||||
} ClutterOrientation;
 | 
			
		||||
@@ -1359,7 +1402,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCROLL_NONE         = 0,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_SCROLL_HORIZONTALLY = 1 << 0,
 | 
			
		||||
@@ -1379,7 +1423,8 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_GRID_POSITION_LEFT,
 | 
			
		||||
  CLUTTER_GRID_POSITION_RIGHT,
 | 
			
		||||
  CLUTTER_GRID_POSITION_TOP,
 | 
			
		||||
@@ -1397,7 +1442,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_REPEAT_NONE   = 0,
 | 
			
		||||
  CLUTTER_REPEAT_X_AXIS = 1 << 0,
 | 
			
		||||
  CLUTTER_REPEAT_Y_AXIS = 1 << 1,
 | 
			
		||||
@@ -1419,7 +1465,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_STEP_MODE_START,
 | 
			
		||||
  CLUTTER_STEP_MODE_END
 | 
			
		||||
} ClutterStepMode;
 | 
			
		||||
@@ -1435,7 +1482,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_ZOOM >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_ZOOM >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ZOOM_X_AXIS,
 | 
			
		||||
  CLUTTER_ZOOM_Y_AXIS,
 | 
			
		||||
  CLUTTER_ZOOM_BOTH
 | 
			
		||||
@@ -1458,7 +1506,8 @@ typedef enum { /*< prefix=CLUTTER_ZOOM >*/
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.18
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_GESTURE_TRIGGER_EDGE_NONE  = 0,
 | 
			
		||||
  CLUTTER_GESTURE_TRIGGER_EDGE_AFTER,
 | 
			
		||||
  CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE
 | 
			
		||||
@@ -1494,7 +1543,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.24
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN,
 | 
			
		||||
  CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE,
 | 
			
		||||
  CLUTTER_TOUCHPAD_GESTURE_PHASE_END,
 | 
			
		||||
@@ -1516,7 +1566,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.26
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCROLL_SOURCE_UNKNOWN,
 | 
			
		||||
  CLUTTER_SCROLL_SOURCE_WHEEL,
 | 
			
		||||
  CLUTTER_SCROLL_SOURCE_FINGER,
 | 
			
		||||
@@ -1534,7 +1585,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.26
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCROLL_FINISHED_NONE       = 0,
 | 
			
		||||
  CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
 | 
			
		||||
  CLUTTER_SCROLL_FINISHED_VERTICAL   = 1 << 1
 | 
			
		||||
@@ -1555,7 +1607,8 @@ typedef enum {
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.28
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_TOOL_NONE,
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_TOOL_PEN,
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_TOOL_ERASER,
 | 
			
		||||
@@ -1566,17 +1619,20 @@ typedef enum {
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_TOOL_LENS
 | 
			
		||||
} ClutterInputDeviceToolType;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_PAD_SOURCE_UNKNOWN,
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
 | 
			
		||||
} ClutterInputDevicePadSource;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
 | 
			
		||||
  CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
 | 
			
		||||
} ClutterInputDeviceMapping;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_HINT_COMPLETION          = 1 << 0,
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_HINT_SPELLCHECK          = 1 << 1,
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION = 1 << 2,
 | 
			
		||||
@@ -1589,7 +1645,8 @@ typedef enum {
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_HINT_MULTILINE           = 1 << 9,
 | 
			
		||||
} ClutterInputContentHintFlags;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL,
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_PURPOSE_ALPHA,
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_PURPOSE_DIGITS,
 | 
			
		||||
@@ -1605,7 +1662,8 @@ typedef enum {
 | 
			
		||||
  CLUTTER_INPUT_CONTENT_PURPOSE_TERMINAL,
 | 
			
		||||
} ClutterInputContentPurpose;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INPUT_PANEL_STATE_OFF,
 | 
			
		||||
  CLUTTER_INPUT_PANEL_STATE_ON,
 | 
			
		||||
  CLUTTER_INPUT_PANEL_STATE_TOGGLE,
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,8 @@ G_BEGIN_DECLS
 | 
			
		||||
typedef struct _ClutterEventTranslator          ClutterEventTranslator;
 | 
			
		||||
typedef struct _ClutterEventTranslatorIface     ClutterEventTranslatorIface;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TRANSLATE_CONTINUE,
 | 
			
		||||
  CLUTTER_TRANSLATE_REMOVE,
 | 
			
		||||
  CLUTTER_TRANSLATE_QUEUE
 | 
			
		||||
 
 | 
			
		||||
@@ -64,17 +64,13 @@ clutter_features_from_cogl (guint cogl_flags)
 | 
			
		||||
{
 | 
			
		||||
  ClutterFeatureFlags clutter_flags = 0;
 | 
			
		||||
  
 | 
			
		||||
  if (cogl_flags & COGL_FEATURE_TEXTURE_NPOT)
 | 
			
		||||
    clutter_flags |= CLUTTER_FEATURE_TEXTURE_NPOT;
 | 
			
		||||
 | 
			
		||||
  if (cogl_flags & COGL_FEATURE_TEXTURE_YUV)
 | 
			
		||||
    clutter_flags |= CLUTTER_FEATURE_TEXTURE_YUV;
 | 
			
		||||
  
 | 
			
		||||
  if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
 | 
			
		||||
    clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
 | 
			
		||||
  
 | 
			
		||||
  if (cogl_flags & COGL_FEATURE_SHADERS_GLSL)
 | 
			
		||||
    clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
 | 
			
		||||
  clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
 | 
			
		||||
  
 | 
			
		||||
  if (cogl_flags & COGL_FEATURE_OFFSCREEN)
 | 
			
		||||
    clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ struct _ClutterImagePrivate
 | 
			
		||||
  gint height;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void clutter_content_iface_init (ClutterContentIface *iface);
 | 
			
		||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT,
 | 
			
		||||
                         G_ADD_PRIVATE (ClutterImage)
 | 
			
		||||
@@ -154,7 +154,7 @@ clutter_image_get_preferred_size (ClutterContent *content,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_content_iface_init (ClutterContentIface *iface)
 | 
			
		||||
clutter_content_iface_init (ClutterContentInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  iface->get_preferred_size = clutter_image_get_preferred_size;
 | 
			
		||||
  iface->paint_content = clutter_image_paint_content;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,8 @@ typedef struct _ClutterImageClass      ClutterImageClass;
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.10
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_IMAGE_ERROR_INVALID_DATA
 | 
			
		||||
} ClutterImageError;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,8 @@ struct _ClutterInputDeviceToolPrivate
 | 
			
		||||
  guint64 id;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
  PROP_TYPE,
 | 
			
		||||
  PROP_SERIAL,
 | 
			
		||||
 
 | 
			
		||||
@@ -2284,15 +2284,3 @@ clutter_input_device_is_grouped (ClutterInputDevice *device,
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_input_device_get_physical_size (ClutterInputDevice *device,
 | 
			
		||||
                                        gdouble            *width,
 | 
			
		||||
                                        gdouble            *height)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->get_physical_size (device,
 | 
			
		||||
                                                                     width,
 | 
			
		||||
                                                                     height);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -171,10 +171,6 @@ void                      clutter_input_device_set_mapping_mode (ClutterInputDev
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean                  clutter_input_device_is_grouped       (ClutterInputDevice *device,
 | 
			
		||||
                                                                 ClutterInputDevice *other_device);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean                  clutter_input_device_get_physical_size (ClutterInputDevice *device,
 | 
			
		||||
								  gdouble            *width,
 | 
			
		||||
								  gdouble            *height);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -175,7 +175,8 @@ clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
 | 
			
		||||
clutter_input_focus_set_input_panel_state (ClutterInputFocus      *focus,
 | 
			
		||||
                                           ClutterInputPanelState  state)
 | 
			
		||||
{
 | 
			
		||||
  ClutterInputFocusPrivate *priv;
 | 
			
		||||
 | 
			
		||||
@@ -184,7 +185,7 @@ clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
 | 
			
		||||
 | 
			
		||||
  priv = clutter_input_focus_get_instance_private (focus);
 | 
			
		||||
 | 
			
		||||
  clutter_input_method_toggle_input_panel (priv->im);
 | 
			
		||||
  clutter_input_method_set_input_panel_state (priv->im, state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -78,6 +78,7 @@ CLUTTER_EXPORT
 | 
			
		||||
void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
 | 
			
		||||
                                               gboolean           can_show_preedit);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus);
 | 
			
		||||
void clutter_input_focus_set_input_panel_state (ClutterInputFocus      *focus,
 | 
			
		||||
                                                ClutterInputPanelState  state);
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_INPUT_FOCUS_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,8 @@ struct _ClutterInputMethodPrivate
 | 
			
		||||
  gboolean can_show_preedit;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  COMMIT,
 | 
			
		||||
  DELETE_SURROUNDING,
 | 
			
		||||
  REQUEST_SURROUNDING,
 | 
			
		||||
@@ -46,7 +47,8 @@ enum {
 | 
			
		||||
  N_SIGNALS,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
  PROP_CONTENT_HINTS,
 | 
			
		||||
  PROP_CONTENT_PURPOSE,
 | 
			
		||||
@@ -264,9 +266,6 @@ clutter_input_method_focus_out (ClutterInputMethod *im)
 | 
			
		||||
 | 
			
		||||
  klass = CLUTTER_INPUT_METHOD_GET_CLASS (im);
 | 
			
		||||
  klass->focus_out (im);
 | 
			
		||||
 | 
			
		||||
  g_signal_emit (im, signals[INPUT_PANEL_STATE],
 | 
			
		||||
                 0, CLUTTER_INPUT_PANEL_STATE_OFF);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ClutterInputFocus *
 | 
			
		||||
@@ -361,12 +360,12 @@ clutter_input_method_notify_key_event (ClutterInputMethod *im,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clutter_input_method_toggle_input_panel (ClutterInputMethod *im)
 | 
			
		||||
clutter_input_method_set_input_panel_state (ClutterInputMethod     *im,
 | 
			
		||||
                                            ClutterInputPanelState  state)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
 | 
			
		||||
 | 
			
		||||
  g_signal_emit (im, signals[INPUT_PANEL_STATE], 0,
 | 
			
		||||
                 CLUTTER_INPUT_PANEL_STATE_TOGGLE);
 | 
			
		||||
  g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,8 @@ void clutter_input_method_notify_key_event (ClutterInputMethod *im,
 | 
			
		||||
                                            const ClutterEvent *event,
 | 
			
		||||
                                            gboolean            filtered);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void clutter_input_method_request_toggle_input_panel (ClutterInputMethod *im);
 | 
			
		||||
void clutter_input_method_set_input_panel_state (ClutterInputMethod     *im,
 | 
			
		||||
                                                 ClutterInputPanelState  state);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void clutter_input_method_forward_key (ClutterInputMethod *im,
 | 
			
		||||
 
 | 
			
		||||
@@ -193,17 +193,6 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
 | 
			
		||||
  if (!g_key_file_has_group (keyfile, ENVIRONMENT_GROUP))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  str_value =
 | 
			
		||||
    g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
 | 
			
		||||
                           "Backends",
 | 
			
		||||
                           &key_error);
 | 
			
		||||
  if (key_error != NULL)
 | 
			
		||||
    g_clear_error (&key_error);
 | 
			
		||||
  else
 | 
			
		||||
    clutter_try_set_windowing_backend (str_value);
 | 
			
		||||
 | 
			
		||||
  g_free (str_value);
 | 
			
		||||
 | 
			
		||||
  str_value =
 | 
			
		||||
    g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
 | 
			
		||||
                           "Drivers",
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,8 @@ G_BEGIN_DECLS
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.2
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_INIT_SUCCESS        =  1,
 | 
			
		||||
  CLUTTER_INIT_ERROR_UNKNOWN  =  0,
 | 
			
		||||
  CLUTTER_INIT_ERROR_THREADS  = -1,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
BOOLEAN:BOXED
 | 
			
		||||
BOOLEAN:BOXED,INT,INT
 | 
			
		||||
BOOLEAN:OBJECT,BOOLEAN
 | 
			
		||||
BOOLEAN:OBJECT,BOXED
 | 
			
		||||
BOOLEAN:OBJECT,BOXED,DOUBLE
 | 
			
		||||
BOOLEAN:OBJECT,DOUBLE
 | 
			
		||||
BOOLEAN:OBJECT,ENUM
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,8 @@ static GSourceFuncs clock_funcs = {
 | 
			
		||||
  NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void clutter_master_clock_iface_init (ClutterMasterClockIface *iface);
 | 
			
		||||
static void
 | 
			
		||||
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface);
 | 
			
		||||
 | 
			
		||||
#define clutter_master_clock_default_get_type   _clutter_master_clock_default_get_type
 | 
			
		||||
 | 
			
		||||
@@ -689,7 +690,7 @@ clutter_master_clock_default_set_paused (ClutterMasterClock *clock,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_master_clock_iface_init (ClutterMasterClockIface *iface)
 | 
			
		||||
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  iface->add_timeline = clutter_master_clock_default_add_timeline;
 | 
			
		||||
  iface->remove_timeline = clutter_master_clock_default_remove_timeline;
 | 
			
		||||
 
 | 
			
		||||
@@ -37,10 +37,6 @@
 | 
			
		||||
#include "clutter-master-clock-default.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
#define clutter_master_clock_get_type   _clutter_master_clock_get_type
 | 
			
		||||
 | 
			
		||||
typedef ClutterMasterClockIface ClutterMasterClockInterface;
 | 
			
		||||
 | 
			
		||||
G_DEFINE_INTERFACE (ClutterMasterClock, clutter_master_clock, G_TYPE_OBJECT)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
 
 | 
			
		||||
@@ -28,15 +28,12 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_MASTER_CLOCK               (_clutter_master_clock_get_type ())
 | 
			
		||||
#define CLUTTER_MASTER_CLOCK(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MASTER_CLOCK, ClutterMasterClock))
 | 
			
		||||
#define CLUTTER_IS_MASTER_CLOCK(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MASTER_CLOCK))
 | 
			
		||||
#define CLUTTER_MASTER_CLOCK_GET_IFACE(obj)     (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_MASTER_CLOCK, ClutterMasterClockIface))
 | 
			
		||||
#define CLUTTER_TYPE_MASTER_CLOCK (clutter_master_clock_get_type ())
 | 
			
		||||
G_DECLARE_INTERFACE (ClutterMasterClock, clutter_master_clock,
 | 
			
		||||
                     CLUTTER, MASTER_CLOCK,
 | 
			
		||||
                     GObject)
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterMasterClock      ClutterMasterClock; /* dummy */
 | 
			
		||||
typedef struct _ClutterMasterClockIface ClutterMasterClockIface;
 | 
			
		||||
 | 
			
		||||
struct _ClutterMasterClockIface
 | 
			
		||||
struct _ClutterMasterClockInterface
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GTypeInterface parent_iface;
 | 
			
		||||
@@ -51,8 +48,6 @@ struct _ClutterMasterClockIface
 | 
			
		||||
                                   gboolean            paused);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType _clutter_master_clock_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
ClutterMasterClock *    _clutter_master_clock_get_default               (void);
 | 
			
		||||
void                    _clutter_master_clock_add_timeline              (ClutterMasterClock *master_clock,
 | 
			
		||||
                                                                         ClutterTimeline    *timeline);
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,12 @@ void clutter_stage_freeze_updates (ClutterStage *stage);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void clutter_stage_thaw_updates (ClutterStage *stage);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void clutter_stage_update_resource_scales (ClutterStage *stage);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean clutter_actor_has_damage (ClutterActor *actor);
 | 
			
		||||
 | 
			
		||||
#undef __CLUTTER_H_INSIDE__
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_MUTTER_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,8 @@
 | 
			
		||||
 | 
			
		||||
#include "clutter-offscreen-effect.h"
 | 
			
		||||
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#include "cogl/cogl.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-actor-private.h"
 | 
			
		||||
@@ -93,8 +95,8 @@ struct _ClutterOffscreenEffectPrivate
 | 
			
		||||
     through create_texture(). This needs to be tracked separately so
 | 
			
		||||
     that we can detect when a different size is calculated and
 | 
			
		||||
     regenerate the fbo */
 | 
			
		||||
  int fbo_width;
 | 
			
		||||
  int fbo_height;
 | 
			
		||||
  int target_width;
 | 
			
		||||
  int target_height;
 | 
			
		||||
 | 
			
		||||
  gint old_opacity_override;
 | 
			
		||||
};
 | 
			
		||||
@@ -135,8 +137,35 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
 | 
			
		||||
                                     COGL_PIXEL_FORMAT_RGBA_8888_PRE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
 | 
			
		||||
                                  float                   resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  CoglPipelineFilter filter;
 | 
			
		||||
 | 
			
		||||
  if (!self->priv->target)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  /* If no fractional scaling is set, we're always going to render the texture
 | 
			
		||||
     at a 1:1 texel:pixel ratio so, in such case we can use 'nearest' filtering
 | 
			
		||||
     to decrease the effects of rounding errors in the geometry calculation;
 | 
			
		||||
     if instead we we're using a global fractional scaling we need to make sure
 | 
			
		||||
     that we're using the default linear effect, not to create artifacts when
 | 
			
		||||
     scaling down the texture */
 | 
			
		||||
  if (fmodf (resource_scale, 1.0f) == 0)
 | 
			
		||||
    filter = COGL_PIPELINE_FILTER_NEAREST;
 | 
			
		||||
  else
 | 
			
		||||
    filter = COGL_PIPELINE_FILTER_LINEAR;
 | 
			
		||||
 | 
			
		||||
  cogl_pipeline_set_layer_filters (self->priv->target, 0 /* layer_index */,
 | 
			
		||||
                                   filter, filter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
 | 
			
		||||
update_fbo (ClutterEffect *effect,
 | 
			
		||||
            int            target_width,
 | 
			
		||||
            int            target_height,
 | 
			
		||||
            float          resource_scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
 | 
			
		||||
  ClutterOffscreenEffectPrivate *priv = self->priv;
 | 
			
		||||
@@ -151,10 +180,13 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->fbo_width == fbo_width &&
 | 
			
		||||
      priv->fbo_height == fbo_height &&
 | 
			
		||||
  if (priv->target_width == target_width &&
 | 
			
		||||
      priv->target_height == target_height &&
 | 
			
		||||
      priv->offscreen != NULL)
 | 
			
		||||
  {
 | 
			
		||||
    ensure_pipeline_filter_for_scale (self, resource_scale);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (priv->target == NULL)
 | 
			
		||||
    {
 | 
			
		||||
@@ -162,14 +194,7 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
 | 
			
		||||
        clutter_backend_get_cogl_context (clutter_get_default_backend ());
 | 
			
		||||
 | 
			
		||||
      priv->target = cogl_pipeline_new (ctx);
 | 
			
		||||
 | 
			
		||||
      /* We're always going to render the texture at a 1:1 texel:pixel
 | 
			
		||||
         ratio so we can use 'nearest' filtering to decrease the
 | 
			
		||||
         effects of rounding errors in the geometry calculation */
 | 
			
		||||
      cogl_pipeline_set_layer_filters (priv->target,
 | 
			
		||||
                                       0, /* layer_index */
 | 
			
		||||
                                       COGL_PIPELINE_FILTER_NEAREST,
 | 
			
		||||
                                       COGL_PIPELINE_FILTER_NEAREST);
 | 
			
		||||
      ensure_pipeline_filter_for_scale (self, resource_scale);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->texture != NULL)
 | 
			
		||||
@@ -185,14 +210,14 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  priv->texture =
 | 
			
		||||
    clutter_offscreen_effect_create_texture (self, fbo_width, fbo_height);
 | 
			
		||||
    clutter_offscreen_effect_create_texture (self, target_width, target_height);
 | 
			
		||||
  if (priv->texture == NULL)
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  cogl_pipeline_set_layer_texture (priv->target, 0, priv->texture);
 | 
			
		||||
 | 
			
		||||
  priv->fbo_width = fbo_width;
 | 
			
		||||
  priv->fbo_height = fbo_height;
 | 
			
		||||
  priv->target_width = target_width;
 | 
			
		||||
  priv->target_height = target_height;
 | 
			
		||||
 | 
			
		||||
  priv->offscreen = cogl_offscreen_new_to_texture (priv->texture);
 | 
			
		||||
  if (priv->offscreen == NULL)
 | 
			
		||||
@@ -202,8 +227,8 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
 | 
			
		||||
      cogl_handle_unref (priv->target);
 | 
			
		||||
      priv->target = NULL;
 | 
			
		||||
 | 
			
		||||
      priv->fbo_width = 0;
 | 
			
		||||
      priv->fbo_height = 0;
 | 
			
		||||
      priv->target_width = 0;
 | 
			
		||||
      priv->target_height = 0;
 | 
			
		||||
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
@@ -222,7 +247,9 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
 | 
			
		||||
  const ClutterPaintVolume *volume;
 | 
			
		||||
  CoglColor transparent;
 | 
			
		||||
  gfloat stage_width, stage_height;
 | 
			
		||||
  gfloat fbo_width = -1, fbo_height = -1;
 | 
			
		||||
  gfloat target_width = -1, target_height = -1;
 | 
			
		||||
  gfloat resource_scale;
 | 
			
		||||
  gfloat ceiled_resource_scale;
 | 
			
		||||
  ClutterVertex local_offset = { 0.f, 0.f, 0.f };
 | 
			
		||||
  gfloat old_viewport[4];
 | 
			
		||||
 | 
			
		||||
@@ -235,6 +262,18 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
 | 
			
		||||
  stage = _clutter_actor_get_stage_internal (priv->actor);
 | 
			
		||||
  clutter_actor_get_size (stage, &stage_width, &stage_height);
 | 
			
		||||
 | 
			
		||||
  if (_clutter_actor_get_real_resource_scale (priv->actor, &resource_scale))
 | 
			
		||||
    {
 | 
			
		||||
      ceiled_resource_scale = ceilf (resource_scale);
 | 
			
		||||
      stage_width *= ceiled_resource_scale;
 | 
			
		||||
      stage_height *= ceiled_resource_scale;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      /* We are sure we have a resource scale set to a good value at paint */
 | 
			
		||||
      g_assert_not_reached ();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* Get the minimal bounding box for what we want to paint, relative to the
 | 
			
		||||
   * parent of priv->actor. Note that we may actually be painting a clone of
 | 
			
		||||
   * priv->actor so we need to be careful to avoid querying the transformation
 | 
			
		||||
@@ -261,10 +300,14 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
 | 
			
		||||
  priv->fbo_offset_x = box.x1 - raw_box.x1;
 | 
			
		||||
  priv->fbo_offset_y = box.y1 - raw_box.y1;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
 | 
			
		||||
  clutter_actor_box_scale (&box, ceiled_resource_scale);
 | 
			
		||||
  clutter_actor_box_get_size (&box, &target_width, &target_height);
 | 
			
		||||
 | 
			
		||||
  target_width = ceilf (target_width);
 | 
			
		||||
  target_height = ceilf (target_height);
 | 
			
		||||
 | 
			
		||||
  /* First assert that the framebuffer is the right size... */
 | 
			
		||||
  if (!update_fbo (effect, fbo_width, fbo_height))
 | 
			
		||||
  if (!update_fbo (effect, target_width, target_height, resource_scale))
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  cogl_get_modelview_matrix (&old_modelview);
 | 
			
		||||
@@ -366,6 +409,7 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
 | 
			
		||||
{
 | 
			
		||||
  ClutterOffscreenEffectPrivate *priv = effect->priv;
 | 
			
		||||
  CoglMatrix modelview;
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
 | 
			
		||||
  cogl_push_matrix ();
 | 
			
		||||
 | 
			
		||||
@@ -373,6 +417,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
 | 
			
		||||
   * missing a correction for the expanded FBO and offset rendering within...
 | 
			
		||||
   */
 | 
			
		||||
  cogl_get_modelview_matrix (&modelview);
 | 
			
		||||
 | 
			
		||||
  if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
 | 
			
		||||
      resource_scale != 1.0f)
 | 
			
		||||
    {
 | 
			
		||||
      float paint_scale = 1.0f / resource_scale;
 | 
			
		||||
      cogl_matrix_scale (&modelview, paint_scale, paint_scale, 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  cogl_matrix_translate (&modelview,
 | 
			
		||||
                         priv->fbo_offset_x,
 | 
			
		||||
                         priv->fbo_offset_y,
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,8 @@ struct _ClutterPaintNodeClass
 | 
			
		||||
 | 
			
		||||
#define PAINT_OP_INIT   { PAINT_OP_INVALID }
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  PAINT_OP_INVALID = 0,
 | 
			
		||||
  PAINT_OP_TEX_RECT,
 | 
			
		||||
  PAINT_OP_MULTITEX_RECT,
 | 
			
		||||
 
 | 
			
		||||
@@ -75,8 +75,7 @@ _clutter_paint_node_init_types (void)
 | 
			
		||||
  cogl_pipeline_set_color (default_color_pipeline, &cogl_color);
 | 
			
		||||
 | 
			
		||||
  default_texture_pipeline = cogl_pipeline_new (ctx);
 | 
			
		||||
  cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0,
 | 
			
		||||
                                        COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
  cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0);
 | 
			
		||||
  cogl_pipeline_set_color (default_texture_pipeline, &cogl_color);
 | 
			
		||||
  cogl_pipeline_set_layer_wrap_mode (default_texture_pipeline, 0,
 | 
			
		||||
                                     COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,9 @@ typedef struct _ClutterVertex4          ClutterVertex4;
 | 
			
		||||
#define CLUTTER_ACTOR_IN_REPARENT(a)            ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
 | 
			
		||||
#define CLUTTER_ACTOR_IN_PAINT(a)               ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
 | 
			
		||||
#define CLUTTER_ACTOR_IN_RELAYOUT(a)            ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
 | 
			
		||||
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a)          ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
 | 
			
		||||
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a)         ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
 | 
			
		||||
#define CLUTTER_ACTOR_IN_PREF_SIZE(a)           ((CLUTTER_PRIVATE_FLAGS (a) & (CLUTTER_IN_PREF_HEIGHT|CLUTTER_IN_PREF_WIDTH)) != FALSE)
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_PARAM_READABLE  (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
 | 
			
		||||
#define CLUTTER_PARAM_WRITABLE  (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
 | 
			
		||||
@@ -91,21 +94,24 @@ typedef struct _ClutterVertex4          ClutterVertex4;
 | 
			
		||||
 * because it will break for negative numbers. */
 | 
			
		||||
#define CLUTTER_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f))
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_ACTOR_UNUSED_FLAG = 0,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_IN_DESTRUCTION = 1 << 0,
 | 
			
		||||
  CLUTTER_IS_TOPLEVEL    = 1 << 1,
 | 
			
		||||
  CLUTTER_IN_REPARENT    = 1 << 2,
 | 
			
		||||
  CLUTTER_IN_PREF_WIDTH  = 1 << 3,
 | 
			
		||||
  CLUTTER_IN_PREF_HEIGHT = 1 << 4,
 | 
			
		||||
 | 
			
		||||
  /* Used to avoid recursion */
 | 
			
		||||
  CLUTTER_IN_PAINT       = 1 << 3,
 | 
			
		||||
  CLUTTER_IN_PAINT       = 1 << 5,
 | 
			
		||||
 | 
			
		||||
  /* Used to avoid recursion */
 | 
			
		||||
  CLUTTER_IN_RELAYOUT    = 1 << 4,
 | 
			
		||||
  CLUTTER_IN_RELAYOUT    = 1 << 6,
 | 
			
		||||
 | 
			
		||||
  /* a flag for internal children of Containers (DEPRECATED) */
 | 
			
		||||
  CLUTTER_INTERNAL_CHILD = 1 << 5
 | 
			
		||||
  CLUTTER_INTERNAL_CHILD = 1 << 7
 | 
			
		||||
} ClutterPrivateFlags;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -240,6 +246,17 @@ void  _clutter_util_fully_transform_vertices (const CoglMatrix    *modelview,
 | 
			
		||||
                                              ClutterVertex       *vertices_out,
 | 
			
		||||
                                              int                  n_vertices);
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
 | 
			
		||||
                                        ClutterRect                 *dest);
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rectangle_int_extents (const ClutterRect     *src,
 | 
			
		||||
                                          cairo_rectangle_int_t *dest);
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
 | 
			
		||||
                                     int                          x,
 | 
			
		||||
                                     int                          y,
 | 
			
		||||
                                     cairo_rectangle_int_t       *dest);
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
 | 
			
		||||
                                    const cairo_rectangle_int_t *src2,
 | 
			
		||||
                                    cairo_rectangle_int_t       *dest);
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,8 @@ typedef void (* ClutterScriptConnectFunc) (ClutterScript *script,
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_SCRIPT_ERROR_INVALID_TYPE_FUNCTION,
 | 
			
		||||
  CLUTTER_SCRIPT_ERROR_INVALID_PROPERTY,
 | 
			
		||||
  CLUTTER_SCRIPT_ERROR_INVALID_VALUE
 | 
			
		||||
 
 | 
			
		||||
@@ -84,9 +84,9 @@ enum
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
 | 
			
		||||
static GParamSpec *animatable_props[ANIM_PROP_LAST] = { NULL, };
 | 
			
		||||
 | 
			
		||||
static ClutterAnimatableIface *parent_animatable_iface = NULL;
 | 
			
		||||
static ClutterAnimatableInterface *parent_animatable_iface = NULL;
 | 
			
		||||
 | 
			
		||||
static void     clutter_animatable_iface_init   (ClutterAnimatableIface *iface);
 | 
			
		||||
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_ACTOR,
 | 
			
		||||
                         G_ADD_PRIVATE (ClutterScrollActor)
 | 
			
		||||
@@ -240,7 +240,7 @@ clutter_scroll_actor_get_initial_state (ClutterAnimatable *animatable,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableIface *iface)
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  parent_animatable_iface = g_type_interface_peek_parent (iface);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -124,11 +124,16 @@ gboolean                _clutter_stage_update_state     (ClutterStage      *stag
 | 
			
		||||
 | 
			
		||||
void                    _clutter_stage_set_scale_factor (ClutterStage      *stage,
 | 
			
		||||
                                                         int                factor);
 | 
			
		||||
gboolean                _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
 | 
			
		||||
                                                                           ClutterRect  *rect,
 | 
			
		||||
                                                                           float        *view_scale);
 | 
			
		||||
 | 
			
		||||
void            _clutter_stage_presented                (ClutterStage      *stage,
 | 
			
		||||
                                                         CoglFrameEvent     frame_event,
 | 
			
		||||
                                                         ClutterFrameInfo  *frame_info);
 | 
			
		||||
 | 
			
		||||
GList *         _clutter_stage_peek_stage_views         (ClutterStage *stage);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -14,10 +14,6 @@
 | 
			
		||||
 * #ClutterStage actor, abstracting away the specifics of the windowing system.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define clutter_stage_window_get_type   _clutter_stage_window_get_type
 | 
			
		||||
 | 
			
		||||
typedef ClutterStageWindowIface ClutterStageWindowInterface;
 | 
			
		||||
 | 
			
		||||
G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -60,7 +56,7 @@ void
 | 
			
		||||
_clutter_stage_window_set_title (ClutterStageWindow *window,
 | 
			
		||||
                                 const gchar        *title)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  if (iface->set_title)
 | 
			
		||||
    iface->set_title (window, title);
 | 
			
		||||
@@ -70,7 +66,7 @@ void
 | 
			
		||||
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
 | 
			
		||||
                                      gboolean            is_fullscreen)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  if (iface->set_fullscreen)
 | 
			
		||||
    iface->set_fullscreen (window, is_fullscreen);
 | 
			
		||||
@@ -80,7 +76,7 @@ void
 | 
			
		||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
 | 
			
		||||
                                          gboolean            is_visible)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  if (iface->set_cursor_visible)
 | 
			
		||||
    iface->set_cursor_visible (window, is_visible);
 | 
			
		||||
@@ -138,7 +134,7 @@ void
 | 
			
		||||
_clutter_stage_window_schedule_update  (ClutterStageWindow *window,
 | 
			
		||||
                                        int                 sync_delay)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
 | 
			
		||||
 | 
			
		||||
@@ -163,7 +159,7 @@ _clutter_stage_window_schedule_update  (ClutterStageWindow *window,
 | 
			
		||||
gint64
 | 
			
		||||
_clutter_stage_window_get_update_time (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0);
 | 
			
		||||
 | 
			
		||||
@@ -186,7 +182,7 @@ _clutter_stage_window_get_update_time (ClutterStageWindow *window)
 | 
			
		||||
void
 | 
			
		||||
_clutter_stage_window_clear_update_time (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
 | 
			
		||||
 | 
			
		||||
@@ -204,7 +200,7 @@ void
 | 
			
		||||
_clutter_stage_window_add_redraw_clip (ClutterStageWindow    *window,
 | 
			
		||||
                                       cairo_rectangle_int_t *stage_clip)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
 | 
			
		||||
 | 
			
		||||
@@ -224,7 +220,7 @@ _clutter_stage_window_add_redraw_clip (ClutterStageWindow    *window,
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
 | 
			
		||||
 | 
			
		||||
@@ -246,7 +242,7 @@ _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
 | 
			
		||||
 | 
			
		||||
@@ -261,7 +257,7 @@ gboolean
 | 
			
		||||
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow    *window,
 | 
			
		||||
                                              cairo_rectangle_int_t *stage_clip)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
 | 
			
		||||
 | 
			
		||||
@@ -276,7 +272,7 @@ void
 | 
			
		||||
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
 | 
			
		||||
                                        gboolean            accept_focus)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
 | 
			
		||||
 | 
			
		||||
@@ -288,7 +284,7 @@ _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
 | 
			
		||||
void
 | 
			
		||||
_clutter_stage_window_redraw (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
 | 
			
		||||
 | 
			
		||||
@@ -303,7 +299,7 @@ _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
 | 
			
		||||
                                       ClutterStageView   *view,
 | 
			
		||||
                                       int *x, int *y)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  *x = 0;
 | 
			
		||||
  *y = 0;
 | 
			
		||||
@@ -318,7 +314,7 @@ _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface;
 | 
			
		||||
  ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
 | 
			
		||||
 | 
			
		||||
@@ -332,7 +328,7 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
 | 
			
		||||
GList *
 | 
			
		||||
_clutter_stage_window_get_views (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  return iface->get_views (window);
 | 
			
		||||
}
 | 
			
		||||
@@ -340,7 +336,7 @@ _clutter_stage_window_get_views (ClutterStageWindow *window)
 | 
			
		||||
void
 | 
			
		||||
_clutter_stage_window_finish_frame (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  if (iface->finish_frame)
 | 
			
		||||
    iface->finish_frame (window);
 | 
			
		||||
@@ -349,7 +345,7 @@ _clutter_stage_window_finish_frame (ClutterStageWindow *window)
 | 
			
		||||
int64_t
 | 
			
		||||
_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
  ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
 | 
			
		||||
 | 
			
		||||
  if (iface->get_frame_counter)
 | 
			
		||||
    return iface->get_frame_counter (window);
 | 
			
		||||
 
 | 
			
		||||
@@ -7,30 +7,21 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_STAGE_WINDOW               (_clutter_stage_window_get_type ())
 | 
			
		||||
#define CLUTTER_STAGE_WINDOW(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindow))
 | 
			
		||||
#define CLUTTER_IS_STAGE_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_WINDOW))
 | 
			
		||||
#define CLUTTER_STAGE_WINDOW_GET_IFACE(obj)     (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindowIface))
 | 
			
		||||
#define CLUTTER_TYPE_STAGE_WINDOW (clutter_stage_window_get_type ())
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
G_DECLARE_INTERFACE (ClutterStageWindow, clutter_stage_window,
 | 
			
		||||
                     CLUTTER, STAGE_WINDOW,
 | 
			
		||||
                     GObject)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ClutterStageWindow: (skip)
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterStageWindow is an opaque structure
 | 
			
		||||
 * whose members should not be accessed directly
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 */
 | 
			
		||||
typedef struct _ClutterStageWindow      ClutterStageWindow; /* dummy */
 | 
			
		||||
typedef struct _ClutterStageWindowIface ClutterStageWindowIface;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ClutterStageWindowIface: (skip)
 | 
			
		||||
 * ClutterStageWindowInterface: (skip)
 | 
			
		||||
 *
 | 
			
		||||
 * The interface implemented by backends for stage windows
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterStageWindowIface
 | 
			
		||||
struct _ClutterStageWindowInterface
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GTypeInterface parent_iface;
 | 
			
		||||
@@ -88,9 +79,6 @@ struct _ClutterStageWindowIface
 | 
			
		||||
  void              (* finish_frame)            (ClutterStageWindow *stage_window);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
GType _clutter_stage_window_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
ClutterActor *    _clutter_stage_window_get_wrapper        (ClutterStageWindow *window);
 | 
			
		||||
 | 
			
		||||
void              _clutter_stage_window_set_title          (ClutterStageWindow *window,
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,8 @@
 | 
			
		||||
 *
 | 
			
		||||
 * A series of hints that enable or disable behaviours on the stage
 | 
			
		||||
 */
 | 
			
		||||
typedef enum { /*< prefix=CLUTTER_STAGE >*/
 | 
			
		||||
typedef enum /*< prefix=CLUTTER_STAGE >*/
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_STAGE_HINT_NONE = 0,
 | 
			
		||||
 | 
			
		||||
  CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0
 | 
			
		||||
@@ -201,6 +202,12 @@ static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
 | 
			
		||||
 | 
			
		||||
static void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
 | 
			
		||||
static void free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry);
 | 
			
		||||
static void capture_view_into (ClutterStage          *stage,
 | 
			
		||||
                               gboolean               paint,
 | 
			
		||||
                               ClutterStageView      *view,
 | 
			
		||||
                               cairo_rectangle_int_t *rect,
 | 
			
		||||
                               uint8_t               *data,
 | 
			
		||||
                               int                    stride);
 | 
			
		||||
 | 
			
		||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
 | 
			
		||||
 | 
			
		||||
@@ -1274,45 +1281,44 @@ clutter_stage_real_queue_relayout (ClutterActor *self)
 | 
			
		||||
  parent_class->queue_relayout (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_stage_real_queue_redraw (ClutterActor *actor,
 | 
			
		||||
                                 ClutterActor *leaf)
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_stage_real_queue_redraw (ClutterActor       *actor,
 | 
			
		||||
                                 ClutterActor       *leaf,
 | 
			
		||||
                                 ClutterPaintVolume *redraw_clip)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStage *stage = CLUTTER_STAGE (actor);
 | 
			
		||||
  ClutterStageWindow *stage_window;
 | 
			
		||||
  ClutterPaintVolume *redraw_clip;
 | 
			
		||||
  ClutterActorBox bounding_box;
 | 
			
		||||
  ClutterActorBox intersection_box;
 | 
			
		||||
  cairo_rectangle_int_t geom, stage_clip;
 | 
			
		||||
 | 
			
		||||
  if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  /* If the backend can't do anything with redraw clips (e.g. it already knows
 | 
			
		||||
   * it needs to redraw everything anyway) then don't spend time transforming
 | 
			
		||||
   * any clip volume into stage coordinates... */
 | 
			
		||||
  stage_window = _clutter_stage_get_window (stage);
 | 
			
		||||
  if (stage_window == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
 | 
			
		||||
    {
 | 
			
		||||
      _clutter_stage_window_add_redraw_clip (stage_window, NULL);
 | 
			
		||||
      return;
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* Convert the clip volume into stage coordinates and then into an
 | 
			
		||||
   * axis aligned stage coordinates bounding box...
 | 
			
		||||
   */
 | 
			
		||||
  redraw_clip = _clutter_actor_get_queue_redraw_clip (leaf);
 | 
			
		||||
  if (redraw_clip == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      _clutter_stage_window_add_redraw_clip (stage_window, NULL);
 | 
			
		||||
      return;
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (redraw_clip->is_empty)
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  _clutter_paint_volume_get_stage_paint_box (redraw_clip,
 | 
			
		||||
                                             stage,
 | 
			
		||||
@@ -1328,7 +1334,7 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
 | 
			
		||||
  /* There is no need to track degenerate/empty redraw clips */
 | 
			
		||||
  if (intersection_box.x2 <= intersection_box.x1 ||
 | 
			
		||||
      intersection_box.y2 <= intersection_box.y1)
 | 
			
		||||
    return;
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  /* when converting to integer coordinates make sure we round the edges of the
 | 
			
		||||
   * clip rectangle outwards... */
 | 
			
		||||
@@ -1338,6 +1344,7 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
 | 
			
		||||
  stage_clip.height = intersection_box.y2 - stage_clip.y;
 | 
			
		||||
 | 
			
		||||
  _clutter_stage_window_add_redraw_clip (stage_window, &stage_clip);
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
@@ -2742,7 +2749,7 @@ clutter_stage_set_fullscreen (ClutterStage *stage,
 | 
			
		||||
  if (priv->is_fullscreen != fullscreen)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
 | 
			
		||||
      ClutterStageWindowIface *iface;
 | 
			
		||||
      ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
      iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
 | 
			
		||||
 | 
			
		||||
@@ -2807,7 +2814,7 @@ clutter_stage_set_user_resizable (ClutterStage *stage,
 | 
			
		||||
      && priv->is_user_resizable != resizable)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
 | 
			
		||||
      ClutterStageWindowIface *iface;
 | 
			
		||||
      ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
      iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
 | 
			
		||||
      if (iface->set_user_resizable)
 | 
			
		||||
@@ -2856,7 +2863,7 @@ clutter_stage_show_cursor (ClutterStage *stage)
 | 
			
		||||
  if (!priv->is_cursor_visible)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
 | 
			
		||||
      ClutterStageWindowIface *iface;
 | 
			
		||||
      ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
      iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
 | 
			
		||||
      if (iface->set_cursor_visible)
 | 
			
		||||
@@ -2889,7 +2896,7 @@ clutter_stage_hide_cursor (ClutterStage *stage)
 | 
			
		||||
  if (priv->is_cursor_visible)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
 | 
			
		||||
      ClutterStageWindowIface *iface;
 | 
			
		||||
      ClutterStageWindowInterface *iface;
 | 
			
		||||
 | 
			
		||||
      iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
 | 
			
		||||
      if (iface->set_cursor_visible)
 | 
			
		||||
@@ -2937,6 +2944,9 @@ clutter_stage_read_pixels (ClutterStage *stage,
 | 
			
		||||
  cairo_region_t *clip;
 | 
			
		||||
  cairo_rectangle_int_t clip_rect;
 | 
			
		||||
  CoglFramebuffer *framebuffer;
 | 
			
		||||
  float view_scale;
 | 
			
		||||
  float pixel_width;
 | 
			
		||||
  float pixel_height;
 | 
			
		||||
  uint8_t *pixels;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
 | 
			
		||||
@@ -2979,10 +2989,15 @@ clutter_stage_read_pixels (ClutterStage *stage,
 | 
			
		||||
  cogl_push_framebuffer (framebuffer);
 | 
			
		||||
  clutter_stage_do_paint_view (stage, view, &clip_rect);
 | 
			
		||||
 | 
			
		||||
  pixels = g_malloc0 (clip_rect.width * clip_rect.height * 4);
 | 
			
		||||
  view_scale = clutter_stage_view_get_scale (view);
 | 
			
		||||
  pixel_width = roundf (clip_rect.width * view_scale);
 | 
			
		||||
  pixel_height = roundf (clip_rect.height * view_scale);
 | 
			
		||||
 | 
			
		||||
  pixels = g_malloc0 (pixel_width * pixel_height * 4);
 | 
			
		||||
  cogl_framebuffer_read_pixels (framebuffer,
 | 
			
		||||
                                clip_rect.x, clip_rect.y,
 | 
			
		||||
                                clip_rect.width, clip_rect.height,
 | 
			
		||||
                                clip_rect.x * view_scale,
 | 
			
		||||
                                clip_rect.y * view_scale,
 | 
			
		||||
                                pixel_width, pixel_height,
 | 
			
		||||
                                COGL_PIXEL_FORMAT_RGBA_8888,
 | 
			
		||||
                                pixels);
 | 
			
		||||
 | 
			
		||||
@@ -4756,62 +4771,33 @@ static void
 | 
			
		||||
capture_view (ClutterStage          *stage,
 | 
			
		||||
              gboolean               paint,
 | 
			
		||||
              ClutterStageView      *view,
 | 
			
		||||
              cairo_rectangle_int_t *rect,
 | 
			
		||||
              ClutterCapture        *capture)
 | 
			
		||||
{
 | 
			
		||||
  CoglFramebuffer *framebuffer;
 | 
			
		||||
  ClutterBackend *backend;
 | 
			
		||||
  CoglContext *context;
 | 
			
		||||
  cairo_surface_t *image;
 | 
			
		||||
  uint8_t *data;
 | 
			
		||||
  int stride;
 | 
			
		||||
  CoglBitmap *bitmap;
 | 
			
		||||
  cairo_rectangle_int_t view_layout;
 | 
			
		||||
  cairo_rectangle_int_t *rect;
 | 
			
		||||
  float view_scale;
 | 
			
		||||
  float texture_width;
 | 
			
		||||
  float texture_height;
 | 
			
		||||
 | 
			
		||||
  framebuffer = clutter_stage_view_get_framebuffer (view);
 | 
			
		||||
 | 
			
		||||
  if (paint)
 | 
			
		||||
    {
 | 
			
		||||
      cogl_push_framebuffer (framebuffer);
 | 
			
		||||
      _clutter_stage_maybe_setup_viewport (stage, view);
 | 
			
		||||
      clutter_stage_do_paint_view (stage, view, rect);
 | 
			
		||||
    }
 | 
			
		||||
  rect = &capture->rect;
 | 
			
		||||
 | 
			
		||||
  view_scale = clutter_stage_view_get_scale (view);
 | 
			
		||||
  texture_width = roundf (rect->width * view_scale);
 | 
			
		||||
  texture_height = roundf (rect->height * view_scale);
 | 
			
		||||
  image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
 | 
			
		||||
                                      rect->width * view_scale,
 | 
			
		||||
                                      rect->height * view_scale);
 | 
			
		||||
                                      texture_width, texture_height);
 | 
			
		||||
  cairo_surface_set_device_scale (image, view_scale, view_scale);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  data = cairo_image_surface_get_data (image);
 | 
			
		||||
  stride = cairo_image_surface_get_stride (image);
 | 
			
		||||
 | 
			
		||||
  backend = clutter_get_default_backend ();
 | 
			
		||||
  context = clutter_backend_get_cogl_context (backend);
 | 
			
		||||
  bitmap = cogl_bitmap_new_for_data (context,
 | 
			
		||||
                                     rect->width * view_scale,
 | 
			
		||||
                                     rect->height * view_scale,
 | 
			
		||||
                                     CLUTTER_CAIRO_FORMAT_ARGB32,
 | 
			
		||||
                                     stride,
 | 
			
		||||
                                     data);
 | 
			
		||||
 | 
			
		||||
  clutter_stage_view_get_layout (view, &view_layout);
 | 
			
		||||
 | 
			
		||||
  cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
 | 
			
		||||
                                            (rect->x - view_layout.x) * view_scale,
 | 
			
		||||
                                            (rect->y - view_layout.y) * view_scale,
 | 
			
		||||
                                            COGL_READ_PIXELS_COLOR_BUFFER,
 | 
			
		||||
                                            bitmap);
 | 
			
		||||
 | 
			
		||||
  if (paint)
 | 
			
		||||
    cogl_pop_framebuffer ();
 | 
			
		||||
 | 
			
		||||
  capture->rect = *rect;
 | 
			
		||||
  capture_view_into (stage, paint, view, rect, data, stride);
 | 
			
		||||
  capture->image = image;
 | 
			
		||||
 | 
			
		||||
  cairo_surface_mark_dirty (capture->image);
 | 
			
		||||
  cogl_object_unref (bitmap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
@@ -4827,34 +4813,91 @@ clutter_stage_capture (ClutterStage          *stage,
 | 
			
		||||
  ClutterCapture *captures;
 | 
			
		||||
  int n_captures;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
 | 
			
		||||
 | 
			
		||||
  captures = g_new0 (ClutterCapture, g_list_length (views));
 | 
			
		||||
  n_captures = 0;
 | 
			
		||||
 | 
			
		||||
  for (l = views; l; l = l->next)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageView *view = l->data;
 | 
			
		||||
      ClutterCapture *capture;
 | 
			
		||||
      cairo_rectangle_int_t view_layout;
 | 
			
		||||
      cairo_region_t *region;
 | 
			
		||||
      cairo_rectangle_int_t view_capture_rect;
 | 
			
		||||
 | 
			
		||||
      clutter_stage_view_get_layout (view, &view_layout);
 | 
			
		||||
      region = cairo_region_create_rectangle (&view_layout);
 | 
			
		||||
      cairo_region_intersect_rectangle (region, rect);
 | 
			
		||||
      cairo_region_get_extents (region, &view_capture_rect);
 | 
			
		||||
 | 
			
		||||
      capture = &captures[n_captures];
 | 
			
		||||
      cairo_region_get_extents (region, &capture->rect);
 | 
			
		||||
      cairo_region_destroy (region);
 | 
			
		||||
 | 
			
		||||
      if (view_capture_rect.width == 0 || view_capture_rect.height == 0)
 | 
			
		||||
      if (capture->rect.width == 0 || capture->rect.height == 0)
 | 
			
		||||
        continue;
 | 
			
		||||
 | 
			
		||||
      capture_view (stage, paint, view, &view_capture_rect,
 | 
			
		||||
                    &captures[n_captures]);
 | 
			
		||||
      capture_view (stage, paint, view, capture);
 | 
			
		||||
 | 
			
		||||
      n_captures++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (n_captures == 0)
 | 
			
		||||
    g_clear_pointer (&captures, g_free);
 | 
			
		||||
 | 
			
		||||
  *out_captures = captures;
 | 
			
		||||
  *out_n_captures = n_captures;
 | 
			
		||||
 | 
			
		||||
  return n_captures > 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_stage_get_capture_final_size (ClutterStage          *stage,
 | 
			
		||||
                                      cairo_rectangle_int_t *rect,
 | 
			
		||||
                                      int                   *out_width,
 | 
			
		||||
                                      int                   *out_height,
 | 
			
		||||
                                      float                 *out_scale)
 | 
			
		||||
{
 | 
			
		||||
  float max_scale;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
 | 
			
		||||
 | 
			
		||||
  if (rect)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterRect capture_rect;
 | 
			
		||||
 | 
			
		||||
      _clutter_util_rect_from_rectangle (rect, &capture_rect);
 | 
			
		||||
      if (!_clutter_stage_get_max_view_scale_factor_for_rect (stage,
 | 
			
		||||
                                                              &capture_rect,
 | 
			
		||||
                                                              &max_scale))
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
      if (out_width)
 | 
			
		||||
        *out_width = (gint) roundf (rect->width * max_scale);
 | 
			
		||||
 | 
			
		||||
      if (out_height)
 | 
			
		||||
        *out_height = (gint) roundf (rect->height * max_scale);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      ClutterActorBox alloc;
 | 
			
		||||
      float stage_width, stage_height;
 | 
			
		||||
 | 
			
		||||
      clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &alloc);
 | 
			
		||||
      clutter_actor_box_get_size (&alloc, &stage_width, &stage_height);
 | 
			
		||||
      if (!_clutter_actor_get_real_resource_scale (CLUTTER_ACTOR (stage),
 | 
			
		||||
                                                   &max_scale))
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
      if (out_width)
 | 
			
		||||
        *out_width = (gint) roundf (stage_width * max_scale);
 | 
			
		||||
 | 
			
		||||
      if (out_height)
 | 
			
		||||
        *out_height = (gint) roundf (stage_height * max_scale);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (out_scale)
 | 
			
		||||
    *out_scale = max_scale;
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -4871,6 +4914,11 @@ capture_view_into (ClutterStage          *stage,
 | 
			
		||||
  CoglContext *context;
 | 
			
		||||
  CoglBitmap *bitmap;
 | 
			
		||||
  cairo_rectangle_int_t view_layout;
 | 
			
		||||
  float view_scale;
 | 
			
		||||
  float texture_width;
 | 
			
		||||
  float texture_height;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STAGE (stage));
 | 
			
		||||
 | 
			
		||||
  framebuffer = clutter_stage_view_get_framebuffer (view);
 | 
			
		||||
 | 
			
		||||
@@ -4881,10 +4929,14 @@ capture_view_into (ClutterStage          *stage,
 | 
			
		||||
      clutter_stage_do_paint_view (stage, view, rect);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  view_scale = clutter_stage_view_get_scale (view);
 | 
			
		||||
  texture_width = roundf (rect->width * view_scale);
 | 
			
		||||
  texture_height = roundf (rect->height * view_scale);
 | 
			
		||||
 | 
			
		||||
  backend = clutter_get_default_backend ();
 | 
			
		||||
  context = clutter_backend_get_cogl_context (backend);
 | 
			
		||||
  bitmap = cogl_bitmap_new_for_data (context,
 | 
			
		||||
                                     rect->width, rect->height,
 | 
			
		||||
                                     texture_width, texture_height,
 | 
			
		||||
                                     CLUTTER_CAIRO_FORMAT_ARGB32,
 | 
			
		||||
                                     stride,
 | 
			
		||||
                                     data);
 | 
			
		||||
@@ -4892,8 +4944,8 @@ capture_view_into (ClutterStage          *stage,
 | 
			
		||||
  clutter_stage_view_get_layout (view, &view_layout);
 | 
			
		||||
 | 
			
		||||
  cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
 | 
			
		||||
                                            rect->x - view_layout.x,
 | 
			
		||||
                                            rect->y - view_layout.y,
 | 
			
		||||
                                            roundf ((rect->x - view_layout.x) * view_scale),
 | 
			
		||||
                                            roundf ((rect->y - view_layout.y) * view_scale),
 | 
			
		||||
                                            COGL_READ_PIXELS_COLOR_BUFFER,
 | 
			
		||||
                                            bitmap);
 | 
			
		||||
 | 
			
		||||
@@ -5002,3 +5054,46 @@ clutter_stage_thaw_updates (ClutterStage *stage)
 | 
			
		||||
      _clutter_master_clock_set_paused (master_clock, FALSE);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GList *
 | 
			
		||||
_clutter_stage_peek_stage_views (ClutterStage *stage)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStagePrivate *priv = stage->priv;
 | 
			
		||||
 | 
			
		||||
  return _clutter_stage_window_get_views (priv->impl);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
clutter_stage_update_resource_scales (ClutterStage *stage)
 | 
			
		||||
{
 | 
			
		||||
  _clutter_actor_queue_update_resource_scale_recursive (CLUTTER_ACTOR (stage));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
 | 
			
		||||
                                                   ClutterRect  *rect,
 | 
			
		||||
                                                   float        *view_scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStagePrivate *priv = stage->priv;
 | 
			
		||||
  float scale = 0.0f;
 | 
			
		||||
  GList *l;
 | 
			
		||||
 | 
			
		||||
  for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterStageView *view = l->data;
 | 
			
		||||
      cairo_rectangle_int_t view_layout;
 | 
			
		||||
      ClutterRect view_rect;
 | 
			
		||||
 | 
			
		||||
      clutter_stage_view_get_layout (view, &view_layout);
 | 
			
		||||
      _clutter_util_rect_from_rectangle (&view_layout, &view_rect);
 | 
			
		||||
 | 
			
		||||
      if (clutter_rect_intersection (&view_rect, rect, NULL))
 | 
			
		||||
        scale = MAX (clutter_stage_view_get_scale (view), scale);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (scale == 0.0)
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  *view_scale = scale;
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -261,6 +261,13 @@ CLUTTER_EXPORT
 | 
			
		||||
void            clutter_stage_skip_sync_delay                   (ClutterStage          *stage);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean clutter_stage_get_capture_final_size (ClutterStage          *stage,
 | 
			
		||||
                                               cairo_rectangle_int_t *rect,
 | 
			
		||||
                                               int                   *width,
 | 
			
		||||
                                               int                   *height,
 | 
			
		||||
                                               float                 *scale);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
gboolean clutter_stage_capture (ClutterStage          *stage,
 | 
			
		||||
                                gboolean               paint,
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,8 @@
 | 
			
		||||
/* Initial size of buffer, in bytes */
 | 
			
		||||
#define MIN_SIZE 16
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
  PROP_TEXT,
 | 
			
		||||
  PROP_LENGTH,
 | 
			
		||||
@@ -60,7 +61,8 @@ enum {
 | 
			
		||||
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  INSERTED_TEXT,
 | 
			
		||||
  DELETED_TEXT,
 | 
			
		||||
  LAST_SIGNAL
 | 
			
		||||
 
 | 
			
		||||
@@ -144,15 +144,17 @@ struct _ClutterTextPrivate
 | 
			
		||||
   */
 | 
			
		||||
  gint x_pos;
 | 
			
		||||
 | 
			
		||||
  /* the x position of the PangoLayout when in
 | 
			
		||||
   * single line mode, to scroll the contents of the
 | 
			
		||||
  /* the x position of the PangoLayout (in both physical and logical pixels)
 | 
			
		||||
   * when in single line mode, to scroll the contents of the
 | 
			
		||||
   * text actor
 | 
			
		||||
   */
 | 
			
		||||
  gint text_x;
 | 
			
		||||
  gint text_logical_x;
 | 
			
		||||
 | 
			
		||||
  /* the y position of the PangoLayout, fixed to 0 by
 | 
			
		||||
   * default for now */
 | 
			
		||||
  /* the y position of the PangoLayout (in both physical and logical pixels),
 | 
			
		||||
   * fixed to 0 by default for now */
 | 
			
		||||
  gint text_y;
 | 
			
		||||
  gint text_logical_y;
 | 
			
		||||
 | 
			
		||||
  /* Where to draw the cursor */
 | 
			
		||||
  ClutterRect cursor_rect;
 | 
			
		||||
@@ -185,6 +187,9 @@ struct _ClutterTextPrivate
 | 
			
		||||
  ClutterInputContentHintFlags input_hints;
 | 
			
		||||
  ClutterInputContentPurpose input_purpose;
 | 
			
		||||
 | 
			
		||||
  /* Signal handler for when the :resource-scale changes */
 | 
			
		||||
  guint resource_scale_changed_id;
 | 
			
		||||
 | 
			
		||||
  /* bitfields */
 | 
			
		||||
  guint alignment               : 2;
 | 
			
		||||
  guint wrap                    : 1;
 | 
			
		||||
@@ -279,7 +284,7 @@ static const ClutterColor default_selected_text_color = {   0,   0,   0, 255 };
 | 
			
		||||
 | 
			
		||||
static CoglPipeline *default_color_pipeline = NULL;
 | 
			
		||||
 | 
			
		||||
static ClutterAnimatableIface *parent_animatable_iface = NULL;
 | 
			
		||||
static ClutterAnimatableInterface *parent_animatable_iface = NULL;
 | 
			
		||||
static ClutterScriptableIface *parent_scriptable_iface = NULL;
 | 
			
		||||
 | 
			
		||||
/* ClutterTextInputFocus */
 | 
			
		||||
@@ -290,6 +295,33 @@ G_DECLARE_FINAL_TYPE (ClutterTextInputFocus, clutter_text_input_focus,
 | 
			
		||||
G_DEFINE_TYPE (ClutterTextInputFocus, clutter_text_input_focus,
 | 
			
		||||
               CLUTTER_TYPE_INPUT_FOCUS)
 | 
			
		||||
 | 
			
		||||
/* Utilities pango to (logical) pixels functions */
 | 
			
		||||
static float
 | 
			
		||||
pixels_to_pango (float px)
 | 
			
		||||
{
 | 
			
		||||
  return ceilf (px * (float) PANGO_SCALE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static float
 | 
			
		||||
logical_pixels_to_pango (float px,
 | 
			
		||||
                         float scale)
 | 
			
		||||
{
 | 
			
		||||
  return pixels_to_pango (px * scale);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static float
 | 
			
		||||
pango_to_pixels (float size)
 | 
			
		||||
{
 | 
			
		||||
  return ceilf (size / (float) PANGO_SCALE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static float
 | 
			
		||||
pango_to_logical_pixels (float size,
 | 
			
		||||
                         float scale)
 | 
			
		||||
{
 | 
			
		||||
  return pango_to_pixels (size / scale);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_text_input_focus_request_surrounding (ClutterInputFocus *focus)
 | 
			
		||||
{
 | 
			
		||||
@@ -389,7 +421,7 @@ clutter_text_input_focus_new (ClutterText *text)
 | 
			
		||||
 | 
			
		||||
/* ClutterText */
 | 
			
		||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
 | 
			
		||||
static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
 | 
			
		||||
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterText,
 | 
			
		||||
                         clutter_text,
 | 
			
		||||
@@ -550,6 +582,63 @@ clutter_text_get_display_text (ClutterText *self)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ensure_effective_pango_scale_attribute (ClutterText *self)
 | 
			
		||||
{
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
  ClutterTextPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale) ||
 | 
			
		||||
      resource_scale == 1.0)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (priv->effective_attrs != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      PangoAttrIterator *iter;
 | 
			
		||||
      PangoAttribute *scale_attrib;
 | 
			
		||||
      PangoAttrList *old_attributes;
 | 
			
		||||
 | 
			
		||||
      old_attributes = priv->effective_attrs;
 | 
			
		||||
      priv->effective_attrs = pango_attr_list_copy (priv->effective_attrs);
 | 
			
		||||
      pango_attr_list_unref (old_attributes);
 | 
			
		||||
 | 
			
		||||
      iter = pango_attr_list_get_iterator (priv->effective_attrs);
 | 
			
		||||
      scale_attrib = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
 | 
			
		||||
 | 
			
		||||
      if (scale_attrib != NULL)
 | 
			
		||||
        resource_scale *= ((PangoAttrFloat *) scale_attrib)->value;
 | 
			
		||||
 | 
			
		||||
      pango_attr_iterator_destroy (iter);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    priv->effective_attrs = pango_attr_list_new ();
 | 
			
		||||
 | 
			
		||||
  pango_attr_list_change (priv->effective_attrs,
 | 
			
		||||
                          pango_attr_scale_new (resource_scale));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
set_effective_pango_attributes (ClutterText   *self,
 | 
			
		||||
                                PangoAttrList *attributes)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTextPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  if (attributes != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      PangoAttrList *old_attributes = priv->effective_attrs;
 | 
			
		||||
      priv->effective_attrs = pango_attr_list_ref (attributes);
 | 
			
		||||
 | 
			
		||||
      if (old_attributes != NULL)
 | 
			
		||||
        pango_attr_list_unref (old_attributes);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  ensure_effective_pango_scale_attribute (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
clutter_text_ensure_effective_attributes (ClutterText *self)
 | 
			
		||||
{
 | 
			
		||||
@@ -563,21 +652,25 @@ clutter_text_ensure_effective_attributes (ClutterText *self)
 | 
			
		||||
  /* Same as if we don't have any attribute at all.
 | 
			
		||||
   * We also ignore markup attributes for editable. */
 | 
			
		||||
  if (priv->attrs == NULL && (priv->editable || priv->markup_attrs == NULL))
 | 
			
		||||
    return;
 | 
			
		||||
    {
 | 
			
		||||
      set_effective_pango_attributes (self, NULL);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->attrs != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      /* If there are no markup attributes, or if this is editable (in which
 | 
			
		||||
       * case we ignore markup), then we can just use these attrs directly */
 | 
			
		||||
      if (priv->editable || priv->markup_attrs == NULL)
 | 
			
		||||
        priv->effective_attrs = pango_attr_list_ref (priv->attrs);
 | 
			
		||||
        set_effective_pango_attributes (self, priv->attrs);
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
          /* Otherwise we need to merge the two lists */
 | 
			
		||||
          PangoAttrList *effective_attrs;
 | 
			
		||||
          PangoAttrIterator *iter;
 | 
			
		||||
          GSList *attributes, *l;
 | 
			
		||||
 | 
			
		||||
          priv->effective_attrs = pango_attr_list_copy (priv->markup_attrs);
 | 
			
		||||
          effective_attrs = pango_attr_list_copy (priv->markup_attrs);
 | 
			
		||||
 | 
			
		||||
          iter = pango_attr_list_get_iterator (priv->attrs);
 | 
			
		||||
          do
 | 
			
		||||
@@ -588,7 +681,7 @@ clutter_text_ensure_effective_attributes (ClutterText *self)
 | 
			
		||||
                {
 | 
			
		||||
                  PangoAttribute *attr = l->data;
 | 
			
		||||
 | 
			
		||||
                  pango_attr_list_insert (priv->effective_attrs, attr);
 | 
			
		||||
                  pango_attr_list_insert (effective_attrs, attr);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
              g_slist_free (attributes);
 | 
			
		||||
@@ -596,12 +689,14 @@ clutter_text_ensure_effective_attributes (ClutterText *self)
 | 
			
		||||
          while (pango_attr_iterator_next (iter));
 | 
			
		||||
 | 
			
		||||
          pango_attr_iterator_destroy (iter);
 | 
			
		||||
 | 
			
		||||
          set_effective_pango_attributes (self, effective_attrs);
 | 
			
		||||
          pango_attr_list_unref (effective_attrs);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
  else if (priv->markup_attrs != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      /* We can just use the markup attributes directly */
 | 
			
		||||
      priv->effective_attrs = pango_attr_list_ref (priv->markup_attrs);
 | 
			
		||||
      set_effective_pango_attributes (self, priv->markup_attrs);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -810,6 +905,18 @@ clutter_text_direction_changed_cb (GObject    *gobject,
 | 
			
		||||
  /* no need to queue a relayout: set_text_direction() will do that for us */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_text_resource_scale_changed_cb (GObject    *gobject,
 | 
			
		||||
                                        GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterText *self = CLUTTER_TEXT (gobject);
 | 
			
		||||
  ClutterTextPrivate *priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
 | 
			
		||||
  clutter_text_dirty_cache (self);
 | 
			
		||||
  clutter_actor_queue_relayout (CLUTTER_ACTOR (gobject));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * clutter_text_create_layout:
 | 
			
		||||
 * @text: a #ClutterText
 | 
			
		||||
@@ -877,7 +984,7 @@ clutter_text_create_layout (ClutterText *text,
 | 
			
		||||
       !((priv->editable && priv->single_line_mode) ||
 | 
			
		||||
         (priv->ellipsize == PANGO_ELLIPSIZE_NONE && !priv->wrap))))
 | 
			
		||||
    {
 | 
			
		||||
      width = allocation_width * 1024 + 0.5f;
 | 
			
		||||
      width = pixels_to_pango (allocation_width);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* Pango only uses height if ellipsization is enabled, so don't set
 | 
			
		||||
@@ -894,7 +1001,7 @@ clutter_text_create_layout (ClutterText *text,
 | 
			
		||||
      priv->ellipsize != PANGO_ELLIPSIZE_NONE &&
 | 
			
		||||
      !priv->single_line_mode)
 | 
			
		||||
    {
 | 
			
		||||
      height = allocation_height * 1024 + 0.5f;
 | 
			
		||||
      height = pixels_to_pango (allocation_height);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* Search for a cached layout with the same width and keep
 | 
			
		||||
@@ -991,6 +1098,37 @@ clutter_text_create_layout (ClutterText *text,
 | 
			
		||||
  return oldest_cache->layout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static PangoLayout *
 | 
			
		||||
create_text_layout_with_scale (ClutterText *text,
 | 
			
		||||
                               gfloat       allocation_width,
 | 
			
		||||
                               gfloat       allocation_height,
 | 
			
		||||
                               gfloat       scale)
 | 
			
		||||
{
 | 
			
		||||
  if (allocation_width > 0)
 | 
			
		||||
    allocation_width = roundf (allocation_width * scale);
 | 
			
		||||
 | 
			
		||||
  if (allocation_height > 0)
 | 
			
		||||
    allocation_height = roundf (allocation_height * scale);
 | 
			
		||||
 | 
			
		||||
  return clutter_text_create_layout (text, allocation_width, allocation_height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static PangoLayout *
 | 
			
		||||
maybe_create_text_layout_with_resource_scale (ClutterText *text,
 | 
			
		||||
                                              gfloat       allocation_width,
 | 
			
		||||
                                              gfloat       allocation_height)
 | 
			
		||||
{
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (text), &resource_scale))
 | 
			
		||||
    return NULL;
 | 
			
		||||
 | 
			
		||||
  return create_text_layout_with_scale (text,
 | 
			
		||||
                                        allocation_width,
 | 
			
		||||
                                        allocation_height,
 | 
			
		||||
                                        resource_scale);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_text_coords_to_position:
 | 
			
		||||
 * @self: a #ClutterText
 | 
			
		||||
@@ -1011,14 +1149,18 @@ clutter_text_coords_to_position (ClutterText *self,
 | 
			
		||||
  gint index_;
 | 
			
		||||
  gint px, py;
 | 
			
		||||
  gint trailing;
 | 
			
		||||
  gfloat resource_scale;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
 | 
			
		||||
    return 0;
 | 
			
		||||
 | 
			
		||||
  /* Take any offset due to scrolling into account, and normalize
 | 
			
		||||
   * the coordinates to PangoScale units
 | 
			
		||||
   */
 | 
			
		||||
  px = (x - self->priv->text_x) * PANGO_SCALE;
 | 
			
		||||
  py = (y - self->priv->text_y) * PANGO_SCALE;
 | 
			
		||||
  px = logical_pixels_to_pango (x - self->priv->text_logical_x, resource_scale);
 | 
			
		||||
  py = logical_pixels_to_pango (y - self->priv->text_logical_y, resource_scale);
 | 
			
		||||
 | 
			
		||||
  pango_layout_xy_to_index (clutter_text_get_layout (self),
 | 
			
		||||
                            px, py,
 | 
			
		||||
@@ -1027,26 +1169,12 @@ clutter_text_coords_to_position (ClutterText *self,
 | 
			
		||||
  return index_ + trailing;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_text_position_to_coords:
 | 
			
		||||
 * @self: a #ClutterText
 | 
			
		||||
 * @position: position in characters
 | 
			
		||||
 * @x: (out): return location for the X coordinate, or %NULL
 | 
			
		||||
 * @y: (out): return location for the Y coordinate, or %NULL
 | 
			
		||||
 * @line_height: (out): return location for the line height, or %NULL
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the coordinates of the given @position.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the conversion was successful
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_text_position_to_coords (ClutterText *self,
 | 
			
		||||
                                 gint         position,
 | 
			
		||||
                                 gfloat      *x,
 | 
			
		||||
                                 gfloat      *y,
 | 
			
		||||
                                 gfloat      *line_height)
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_text_position_to_coords_internal (ClutterText *self,
 | 
			
		||||
                                          gint         position,
 | 
			
		||||
                                          gfloat      *x,
 | 
			
		||||
                                          gfloat      *y,
 | 
			
		||||
                                          gfloat      *line_height)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTextPrivate *priv;
 | 
			
		||||
  PangoRectangle rect;
 | 
			
		||||
@@ -1112,7 +1240,7 @@ clutter_text_position_to_coords (ClutterText *self,
 | 
			
		||||
 | 
			
		||||
  if (x)
 | 
			
		||||
    {
 | 
			
		||||
      *x = (gfloat) rect.x / 1024.0f;
 | 
			
		||||
      *x = pango_to_pixels (rect.x);
 | 
			
		||||
 | 
			
		||||
      /* Take any offset due to scrolling into account */
 | 
			
		||||
      if (priv->single_line_mode)
 | 
			
		||||
@@ -1120,14 +1248,58 @@ clutter_text_position_to_coords (ClutterText *self,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (y)
 | 
			
		||||
    *y = (gfloat) rect.y / 1024.0f;
 | 
			
		||||
    *y = pango_to_pixels (rect.y);
 | 
			
		||||
 | 
			
		||||
  if (line_height)
 | 
			
		||||
    *line_height = (gfloat) rect.height / 1024.0f;
 | 
			
		||||
    *line_height = pango_to_pixels (rect.height);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_text_position_to_coords:
 | 
			
		||||
 * @self: a #ClutterText
 | 
			
		||||
 * @position: position in characters
 | 
			
		||||
 * @x: (out): return location for the X coordinate, or %NULL
 | 
			
		||||
 * @y: (out): return location for the Y coordinate, or %NULL
 | 
			
		||||
 * @line_height: (out): return location for the line height, or %NULL
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the coordinates of the given @position.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the conversion was successful
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_text_position_to_coords (ClutterText *self,
 | 
			
		||||
                                 gint         position,
 | 
			
		||||
                                 gfloat      *x,
 | 
			
		||||
                                 gfloat      *y,
 | 
			
		||||
                                 gfloat      *line_height)
 | 
			
		||||
{
 | 
			
		||||
  gfloat resource_scale;
 | 
			
		||||
  gboolean ret;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 | 
			
		||||
  ret = clutter_text_position_to_coords_internal (self, position,
 | 
			
		||||
                                                  x, y, line_height);
 | 
			
		||||
 | 
			
		||||
  if (x)
 | 
			
		||||
    *x /= resource_scale;
 | 
			
		||||
 | 
			
		||||
  if (y)
 | 
			
		||||
    *y /= resource_scale;
 | 
			
		||||
 | 
			
		||||
  if (line_height)
 | 
			
		||||
    *line_height /= resource_scale;
 | 
			
		||||
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
update_cursor_location (ClutterText *self)
 | 
			
		||||
{
 | 
			
		||||
@@ -1145,7 +1317,8 @@ update_cursor_location (ClutterText *self)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
clutter_text_ensure_cursor_position (ClutterText *self)
 | 
			
		||||
clutter_text_ensure_cursor_position (ClutterText *self,
 | 
			
		||||
                                     float        scale)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTextPrivate *priv = self->priv;
 | 
			
		||||
  gfloat x, y, cursor_height;
 | 
			
		||||
@@ -1168,15 +1341,15 @@ clutter_text_ensure_cursor_position (ClutterText *self)
 | 
			
		||||
                priv->preedit_set ? priv->preedit_cursor_pos : 0);
 | 
			
		||||
 | 
			
		||||
  x = y = cursor_height = 0;
 | 
			
		||||
  clutter_text_position_to_coords (self, position,
 | 
			
		||||
                                   &x, &y,
 | 
			
		||||
                                   &cursor_height);
 | 
			
		||||
  clutter_text_position_to_coords_internal (self, position,
 | 
			
		||||
                                            &x, &y,
 | 
			
		||||
                                            &cursor_height);
 | 
			
		||||
 | 
			
		||||
  clutter_rect_init (&cursor_rect,
 | 
			
		||||
                     x,
 | 
			
		||||
                     y + CURSOR_Y_PADDING,
 | 
			
		||||
                     priv->cursor_size,
 | 
			
		||||
                     cursor_height - 2 * CURSOR_Y_PADDING);
 | 
			
		||||
                     y + CURSOR_Y_PADDING * scale,
 | 
			
		||||
                     priv->cursor_size * scale,
 | 
			
		||||
                     cursor_height - 2 * CURSOR_Y_PADDING * scale);
 | 
			
		||||
 | 
			
		||||
  if (!clutter_rect_equals (&priv->cursor_rect, &cursor_rect))
 | 
			
		||||
    {
 | 
			
		||||
@@ -1599,6 +1772,12 @@ clutter_text_dispose (GObject *gobject)
 | 
			
		||||
      priv->direction_changed_id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->resource_scale_changed_id)
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_handler_disconnect (self, priv->resource_scale_changed_id);
 | 
			
		||||
      priv->resource_scale_changed_id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->settings_changed_id)
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_handler_disconnect (clutter_get_default_backend (),
 | 
			
		||||
@@ -1651,6 +1830,7 @@ typedef void (* ClutterTextSelectionFunc) (ClutterText           *text,
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_text_foreach_selection_rectangle (ClutterText              *self,
 | 
			
		||||
                                          float                     scale,
 | 
			
		||||
                                          ClutterTextSelectionFunc  func,
 | 
			
		||||
                                          gpointer                  user_data)
 | 
			
		||||
{
 | 
			
		||||
@@ -1702,9 +1882,9 @@ clutter_text_foreach_selection_rectangle (ClutterText              *self,
 | 
			
		||||
                                      &n_ranges);
 | 
			
		||||
      pango_layout_line_x_to_index (line, 0, &index_, NULL);
 | 
			
		||||
 | 
			
		||||
      clutter_text_position_to_coords (self,
 | 
			
		||||
                                       bytes_to_offset (utf8, index_),
 | 
			
		||||
                                       NULL, &y, &height);
 | 
			
		||||
      clutter_text_position_to_coords_internal (self,
 | 
			
		||||
                                                bytes_to_offset (utf8, index_),
 | 
			
		||||
                                                NULL, &y, &height);
 | 
			
		||||
 | 
			
		||||
      box.y1 = y;
 | 
			
		||||
      box.y2 = y + height;
 | 
			
		||||
@@ -1714,18 +1894,18 @@ clutter_text_foreach_selection_rectangle (ClutterText              *self,
 | 
			
		||||
          gfloat range_x;
 | 
			
		||||
          gfloat range_width;
 | 
			
		||||
 | 
			
		||||
          range_x = ranges[i * 2] / PANGO_SCALE;
 | 
			
		||||
          range_x = pango_to_pixels (ranges[i * 2]);
 | 
			
		||||
 | 
			
		||||
          /* Account for any scrolling in single line mode */
 | 
			
		||||
          if (priv->single_line_mode)
 | 
			
		||||
            range_x += priv->text_x;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
          range_width = ((gfloat) ranges[i * 2 + 1] - (gfloat) ranges[i * 2])
 | 
			
		||||
                      / PANGO_SCALE;
 | 
			
		||||
 | 
			
		||||
          range_width = pango_to_pixels (ranges[i * 2 + 1] - ranges[i * 2]);
 | 
			
		||||
          box.x1 = range_x;
 | 
			
		||||
          box.x2 = ceilf (range_x + range_width + .5f);
 | 
			
		||||
          box.x2 = ceilf (range_x + range_width);
 | 
			
		||||
 | 
			
		||||
          clutter_actor_box_scale (&box, scale);
 | 
			
		||||
 | 
			
		||||
          func (self, &box, user_data);
 | 
			
		||||
        }
 | 
			
		||||
@@ -1744,6 +1924,14 @@ add_selection_rectangle_to_path (ClutterText           *text,
 | 
			
		||||
  cogl_path_rectangle (user_data, box->x1, box->y1, box->x2, box->y2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_text_foreach_selection_rectangle_prescaled (ClutterText              *self,
 | 
			
		||||
                                                    ClutterTextSelectionFunc  func,
 | 
			
		||||
                                                    gpointer                  user_data)
 | 
			
		||||
{
 | 
			
		||||
  clutter_text_foreach_selection_rectangle (self, 1.0f, func, user_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Draws the selected text, its background, and the cursor */
 | 
			
		||||
static void
 | 
			
		||||
selection_paint (ClutterText     *self,
 | 
			
		||||
@@ -1799,9 +1987,9 @@ selection_paint (ClutterText     *self,
 | 
			
		||||
      else
 | 
			
		||||
        color = &priv->text_color;
 | 
			
		||||
 | 
			
		||||
      clutter_text_foreach_selection_rectangle (self,
 | 
			
		||||
                                                add_selection_rectangle_to_path,
 | 
			
		||||
                                                selection_path);
 | 
			
		||||
      clutter_text_foreach_selection_rectangle_prescaled (self,
 | 
			
		||||
                                                          add_selection_rectangle_to_path,
 | 
			
		||||
                                                          selection_path);
 | 
			
		||||
 | 
			
		||||
      cogl_path_fill (selection_path);
 | 
			
		||||
 | 
			
		||||
@@ -1998,7 +2186,8 @@ clutter_text_press (ClutterActor *actor,
 | 
			
		||||
    return CLUTTER_EVENT_PROPAGATE;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_grab_key_focus (actor);
 | 
			
		||||
  clutter_input_focus_request_toggle_input_panel (priv->input_focus);
 | 
			
		||||
  clutter_input_focus_set_input_panel_state (priv->input_focus,
 | 
			
		||||
                                             CLUTTER_INPUT_PANEL_STATE_TOGGLE);
 | 
			
		||||
 | 
			
		||||
  /* if the actor is empty we just reset everything and not
 | 
			
		||||
   * set up the dragging of the selection since there's nothing
 | 
			
		||||
@@ -2390,6 +2579,7 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
  guint n_chars;
 | 
			
		||||
  float alloc_width;
 | 
			
		||||
  float alloc_height;
 | 
			
		||||
  float resource_scale;
 | 
			
		||||
 | 
			
		||||
  fb = cogl_get_draw_framebuffer ();
 | 
			
		||||
 | 
			
		||||
@@ -2399,8 +2589,6 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
  n_chars = clutter_text_buffer_get_length (get_buffer (text));
 | 
			
		||||
 | 
			
		||||
  clutter_actor_get_allocation_box (self, &alloc);
 | 
			
		||||
  alloc_width = alloc.x2 - alloc.x1;
 | 
			
		||||
  alloc_height = alloc.y2 - alloc.y1;
 | 
			
		||||
 | 
			
		||||
  if (G_UNLIKELY (default_color_pipeline == NULL))
 | 
			
		||||
    {
 | 
			
		||||
@@ -2433,7 +2621,8 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
      cogl_framebuffer_draw_rectangle (fb,
 | 
			
		||||
                                       color_pipeline,
 | 
			
		||||
                                       0, 0,
 | 
			
		||||
                                       alloc_width, alloc_height);
 | 
			
		||||
                                       clutter_actor_box_get_width (&alloc),
 | 
			
		||||
                                       clutter_actor_box_get_height (&alloc));
 | 
			
		||||
 | 
			
		||||
      cogl_object_unref (color_pipeline);
 | 
			
		||||
    }
 | 
			
		||||
@@ -2446,6 +2635,12 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
      !clutter_text_should_draw_cursor (text))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_box_scale (&alloc, resource_scale);
 | 
			
		||||
  clutter_actor_box_get_size (&alloc, &alloc_width, &alloc_height);
 | 
			
		||||
 | 
			
		||||
  if (priv->editable && priv->single_line_mode)
 | 
			
		||||
    layout = clutter_text_create_layout (text, -1, -1);
 | 
			
		||||
  else
 | 
			
		||||
@@ -2477,8 +2672,15 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (resource_scale != 1.0f)
 | 
			
		||||
    {
 | 
			
		||||
      float paint_scale = 1.0f / resource_scale;
 | 
			
		||||
      cogl_framebuffer_push_matrix (fb);
 | 
			
		||||
      cogl_framebuffer_scale (fb, paint_scale, paint_scale, 1.0f);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (clutter_text_should_draw_cursor (text))
 | 
			
		||||
    clutter_text_ensure_cursor_position (text);
 | 
			
		||||
    clutter_text_ensure_cursor_position (text, resource_scale);
 | 
			
		||||
 | 
			
		||||
  if (priv->editable && priv->single_line_mode)
 | 
			
		||||
    {
 | 
			
		||||
@@ -2492,7 +2694,7 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
      clip_set = TRUE;
 | 
			
		||||
 | 
			
		||||
      actor_width = alloc_width - 2 * TEXT_PADDING;
 | 
			
		||||
      text_width  = logical_rect.width / PANGO_SCALE;
 | 
			
		||||
      text_width  = pango_to_pixels (logical_rect.width);
 | 
			
		||||
 | 
			
		||||
      rtl = priv->resolved_direction == PANGO_DIRECTION_RTL;
 | 
			
		||||
 | 
			
		||||
@@ -2549,8 +2751,10 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
    {
 | 
			
		||||
      priv->text_x = text_x;
 | 
			
		||||
      priv->text_y = text_y;
 | 
			
		||||
      priv->text_logical_x = roundf ((float) text_x / resource_scale);
 | 
			
		||||
      priv->text_logical_y = roundf ((float) text_y / resource_scale);
 | 
			
		||||
 | 
			
		||||
      clutter_text_ensure_cursor_position (text);
 | 
			
		||||
      clutter_text_ensure_cursor_position (text, resource_scale);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  real_opacity = clutter_actor_get_paint_opacity (self)
 | 
			
		||||
@@ -2569,6 +2773,9 @@ clutter_text_paint (ClutterActor *self)
 | 
			
		||||
 | 
			
		||||
  selection_paint (text, fb);
 | 
			
		||||
 | 
			
		||||
  if (resource_scale != 1.0f)
 | 
			
		||||
    cogl_framebuffer_pop_matrix (fb);
 | 
			
		||||
 | 
			
		||||
  if (clip_set)
 | 
			
		||||
    cogl_framebuffer_pop_clip (fb);
 | 
			
		||||
}
 | 
			
		||||
@@ -2598,26 +2805,32 @@ add_selection_to_paint_volume (ClutterText           *text,
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_text_get_paint_volume_for_cursor (ClutterText        *text,
 | 
			
		||||
                                          float               resource_scale,
 | 
			
		||||
                                          ClutterPaintVolume *volume)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTextPrivate *priv = text->priv;
 | 
			
		||||
  ClutterVertex origin;
 | 
			
		||||
 | 
			
		||||
  clutter_text_ensure_cursor_position (text);
 | 
			
		||||
  clutter_text_ensure_cursor_position (text, resource_scale);
 | 
			
		||||
 | 
			
		||||
  if (priv->position == priv->selection_bound)
 | 
			
		||||
    {
 | 
			
		||||
      origin.x = priv->cursor_rect.origin.x;
 | 
			
		||||
      origin.y = priv->cursor_rect.origin.y;
 | 
			
		||||
      float width, height;
 | 
			
		||||
 | 
			
		||||
      width = priv->cursor_rect.size.width / resource_scale;
 | 
			
		||||
      height = priv->cursor_rect.size.height / resource_scale;
 | 
			
		||||
      origin.x = priv->cursor_rect.origin.x / resource_scale;
 | 
			
		||||
      origin.y = priv->cursor_rect.origin.y / resource_scale;
 | 
			
		||||
      origin.z = 0;
 | 
			
		||||
 | 
			
		||||
      clutter_paint_volume_set_origin (volume, &origin);
 | 
			
		||||
      clutter_paint_volume_set_width (volume, priv->cursor_rect.size.width);
 | 
			
		||||
      clutter_paint_volume_set_height (volume, priv->cursor_rect.size.height);
 | 
			
		||||
      clutter_paint_volume_set_width (volume, width);
 | 
			
		||||
      clutter_paint_volume_set_height (volume, height);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      clutter_text_foreach_selection_rectangle (text,
 | 
			
		||||
                                                1.0f / resource_scale,
 | 
			
		||||
                                                add_selection_to_paint_volume,
 | 
			
		||||
                                                volume);
 | 
			
		||||
    }
 | 
			
		||||
@@ -2640,6 +2853,7 @@ clutter_text_get_paint_volume (ClutterActor       *self,
 | 
			
		||||
      PangoLayout *layout;
 | 
			
		||||
      PangoRectangle ink_rect;
 | 
			
		||||
      ClutterVertex origin;
 | 
			
		||||
      float resource_scale;
 | 
			
		||||
 | 
			
		||||
      /* If the text is single line editable then it gets clipped to
 | 
			
		||||
         the allocation anyway so we can just use that */
 | 
			
		||||
@@ -2654,19 +2868,24 @@ clutter_text_get_paint_volume (ClutterActor       *self,
 | 
			
		||||
      if (!clutter_actor_has_allocation (self))
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
      if (!clutter_actor_get_resource_scale (self, &resource_scale))
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
      _clutter_paint_volume_init_static (&priv->paint_volume, self);
 | 
			
		||||
 | 
			
		||||
      layout = clutter_text_get_layout (text);
 | 
			
		||||
      pango_layout_get_extents (layout, &ink_rect, NULL);
 | 
			
		||||
 | 
			
		||||
      origin.x = ink_rect.x / (float) PANGO_SCALE;
 | 
			
		||||
      origin.y = ink_rect.y / (float) PANGO_SCALE;
 | 
			
		||||
      origin.x = pango_to_logical_pixels (ink_rect.x, resource_scale);
 | 
			
		||||
      origin.y = pango_to_logical_pixels (ink_rect.y, resource_scale);
 | 
			
		||||
      origin.z = 0;
 | 
			
		||||
      clutter_paint_volume_set_origin (&priv->paint_volume, &origin);
 | 
			
		||||
      clutter_paint_volume_set_width (&priv->paint_volume,
 | 
			
		||||
                                      ink_rect.width / (float) PANGO_SCALE);
 | 
			
		||||
                                      pango_to_logical_pixels (ink_rect.width,
 | 
			
		||||
                                                               resource_scale));
 | 
			
		||||
      clutter_paint_volume_set_height (&priv->paint_volume,
 | 
			
		||||
                                       ink_rect.height / (float) PANGO_SCALE);
 | 
			
		||||
                                       pango_to_logical_pixels (ink_rect.height,
 | 
			
		||||
                                                                resource_scale));
 | 
			
		||||
 | 
			
		||||
      /* If the cursor is visible then that will likely be drawn
 | 
			
		||||
         outside of the ink rectangle so we should merge that in */
 | 
			
		||||
@@ -2676,7 +2895,8 @@ clutter_text_get_paint_volume (ClutterActor       *self,
 | 
			
		||||
 | 
			
		||||
          _clutter_paint_volume_init_static (&cursor_paint_volume, self);
 | 
			
		||||
 | 
			
		||||
          clutter_text_get_paint_volume_for_cursor (text, &cursor_paint_volume);
 | 
			
		||||
          clutter_text_get_paint_volume_for_cursor (text, resource_scale,
 | 
			
		||||
                                                    &cursor_paint_volume);
 | 
			
		||||
 | 
			
		||||
          clutter_paint_volume_union (&priv->paint_volume,
 | 
			
		||||
                                      &cursor_paint_volume);
 | 
			
		||||
@@ -2704,9 +2924,12 @@ clutter_text_get_preferred_width (ClutterActor *self,
 | 
			
		||||
  PangoLayout *layout;
 | 
			
		||||
  gint logical_width;
 | 
			
		||||
  gfloat layout_width;
 | 
			
		||||
  gfloat resource_scale;
 | 
			
		||||
 | 
			
		||||
  if (!clutter_actor_get_resource_scale (self, &resource_scale))
 | 
			
		||||
    resource_scale = 1;
 | 
			
		||||
 | 
			
		||||
  layout = clutter_text_create_layout (text, -1, -1);
 | 
			
		||||
 | 
			
		||||
  pango_layout_get_extents (layout, NULL, &logical_rect);
 | 
			
		||||
 | 
			
		||||
  /* the X coordinate of the logical rectangle might be non-zero
 | 
			
		||||
@@ -2716,7 +2939,7 @@ clutter_text_get_preferred_width (ClutterActor *self,
 | 
			
		||||
  logical_width = logical_rect.x + logical_rect.width;
 | 
			
		||||
 | 
			
		||||
  layout_width = logical_width > 0
 | 
			
		||||
    ? ceilf (logical_width / 1024.0f)
 | 
			
		||||
    ? pango_to_logical_pixels (logical_width, resource_scale)
 | 
			
		||||
    : 1;
 | 
			
		||||
 | 
			
		||||
  if (min_width_p)
 | 
			
		||||
@@ -2758,12 +2981,16 @@ clutter_text_get_preferred_height (ClutterActor *self,
 | 
			
		||||
      PangoRectangle logical_rect = { 0, };
 | 
			
		||||
      gint logical_height;
 | 
			
		||||
      gfloat layout_height;
 | 
			
		||||
      gfloat resource_scale;
 | 
			
		||||
 | 
			
		||||
      if (!clutter_actor_get_resource_scale (self, &resource_scale))
 | 
			
		||||
        resource_scale = 1;
 | 
			
		||||
 | 
			
		||||
      if (priv->single_line_mode)
 | 
			
		||||
        for_width = -1;
 | 
			
		||||
 | 
			
		||||
      layout = clutter_text_create_layout (CLUTTER_TEXT (self),
 | 
			
		||||
                                           for_width, -1);
 | 
			
		||||
      layout = create_text_layout_with_scale (CLUTTER_TEXT (self),
 | 
			
		||||
                                              for_width, -1, resource_scale);
 | 
			
		||||
 | 
			
		||||
      pango_layout_get_extents (layout, NULL, &logical_rect);
 | 
			
		||||
 | 
			
		||||
@@ -2772,7 +2999,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
 | 
			
		||||
       * the height accordingly
 | 
			
		||||
       */
 | 
			
		||||
      logical_height = logical_rect.y + logical_rect.height;
 | 
			
		||||
      layout_height = ceilf (logical_height / 1024.0f);
 | 
			
		||||
      layout_height = pango_to_logical_pixels (logical_height, resource_scale);
 | 
			
		||||
 | 
			
		||||
      if (min_height_p)
 | 
			
		||||
        {
 | 
			
		||||
@@ -2788,7 +3015,8 @@ clutter_text_get_preferred_height (ClutterActor *self,
 | 
			
		||||
              pango_layout_line_get_extents (line, NULL, &logical_rect);
 | 
			
		||||
 | 
			
		||||
              logical_height = logical_rect.y + logical_rect.height;
 | 
			
		||||
              line_height = ceilf (logical_height / 1024.0f);
 | 
			
		||||
              line_height = pango_to_logical_pixels (logical_height,
 | 
			
		||||
                                                     resource_scale);
 | 
			
		||||
 | 
			
		||||
              *min_height_p = line_height;
 | 
			
		||||
            }
 | 
			
		||||
@@ -2819,9 +3047,9 @@ clutter_text_allocate (ClutterActor           *self,
 | 
			
		||||
  if (text->priv->editable && text->priv->single_line_mode)
 | 
			
		||||
    clutter_text_create_layout (text, -1, -1);
 | 
			
		||||
  else
 | 
			
		||||
    clutter_text_create_layout (text,
 | 
			
		||||
                                box->x2 - box->x1,
 | 
			
		||||
                                box->y2 - box->y1);
 | 
			
		||||
    maybe_create_text_layout_with_resource_scale (text,
 | 
			
		||||
                                                  box->x2 - box->x1,
 | 
			
		||||
                                                  box->y2 - box->y1);
 | 
			
		||||
 | 
			
		||||
  parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
 | 
			
		||||
  parent_class->allocate (self, box, flags);
 | 
			
		||||
@@ -3547,7 +3775,7 @@ clutter_text_set_final_state (ClutterAnimatable *animatable,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableIface *iface)
 | 
			
		||||
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  parent_animatable_iface = g_type_interface_peek_parent (iface);
 | 
			
		||||
 | 
			
		||||
@@ -4392,6 +4620,11 @@ clutter_text_init (ClutterText *self)
 | 
			
		||||
                      NULL);
 | 
			
		||||
 | 
			
		||||
  priv->input_focus = clutter_text_input_focus_new (self);
 | 
			
		||||
 | 
			
		||||
  priv->resource_scale_changed_id =
 | 
			
		||||
    g_signal_connect (self, "notify::resource-scale",
 | 
			
		||||
                      G_CALLBACK (clutter_text_resource_scale_changed_cb),
 | 
			
		||||
                      NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -5502,6 +5735,7 @@ clutter_text_set_markup (ClutterText *self,
 | 
			
		||||
PangoLayout *
 | 
			
		||||
clutter_text_get_layout (ClutterText *self)
 | 
			
		||||
{
 | 
			
		||||
  PangoLayout *layout;
 | 
			
		||||
  gfloat width, height;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
 | 
			
		||||
@@ -5510,8 +5744,12 @@ clutter_text_get_layout (ClutterText *self)
 | 
			
		||||
    return clutter_text_create_layout (self, -1, -1);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_get_size (CLUTTER_ACTOR (self), &width, &height);
 | 
			
		||||
  layout = maybe_create_text_layout_with_resource_scale (self, width, height);
 | 
			
		||||
 | 
			
		||||
  return clutter_text_create_layout (self, width, height);
 | 
			
		||||
  if (!layout)
 | 
			
		||||
    layout = clutter_text_create_layout (self, width, height);
 | 
			
		||||
 | 
			
		||||
  return layout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -6515,10 +6753,10 @@ clutter_text_get_layout_offsets (ClutterText *self,
 | 
			
		||||
  priv = self->priv;
 | 
			
		||||
 | 
			
		||||
  if (x != NULL)
 | 
			
		||||
    *x = priv->text_x;
 | 
			
		||||
    *x = priv->text_logical_x;
 | 
			
		||||
 | 
			
		||||
  if (y != NULL)
 | 
			
		||||
    *y = priv->text_y;
 | 
			
		||||
    *y = priv->text_logical_y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,8 @@ G_BEGIN_DECLS
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY,
 | 
			
		||||
  CLUTTER_TEXTURE_ERROR_NO_YUV,
 | 
			
		||||
  CLUTTER_TEXTURE_ERROR_BAD_FORMAT
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,6 @@ typedef struct _ClutterVertex                   ClutterVertex;
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterAlpha            	ClutterAlpha;
 | 
			
		||||
typedef struct _ClutterAnimation                ClutterAnimation;
 | 
			
		||||
typedef struct _ClutterAnimator         	ClutterAnimator;
 | 
			
		||||
typedef struct _ClutterState            	ClutterState;
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterInputDeviceTool          ClutterInputDeviceTool;
 | 
			
		||||
@@ -362,6 +361,10 @@ void                    clutter_rect_inset              (ClutterRect       *rect
 | 
			
		||||
                                                         float              d_x,
 | 
			
		||||
                                                         float              d_y);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void                    clutter_rect_scale              (ClutterRect       *rect,
 | 
			
		||||
                                                         float              s_x,
 | 
			
		||||
                                                         float              s_y);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void                    clutter_rect_clamp_to_pixel     (ClutterRect       *rect);
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
float                   clutter_rect_get_x              (ClutterRect       *rect);
 | 
			
		||||
@@ -561,6 +564,10 @@ void             clutter_actor_box_set_size       (ClutterActorBox       *box,
 | 
			
		||||
                                                   gfloat                 width,
 | 
			
		||||
                                                   gfloat                 height);
 | 
			
		||||
 | 
			
		||||
CLUTTER_EXPORT
 | 
			
		||||
void             clutter_actor_box_scale          (ClutterActorBox       *box,
 | 
			
		||||
                                                   gfloat                 scale);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterGeometry:
 | 
			
		||||
 * @x: X coordinate of the top left corner of an actor
 | 
			
		||||
 
 | 
			
		||||
@@ -39,29 +39,6 @@
 | 
			
		||||
#include "clutter-interval.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
#include "deprecated/clutter-util.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_util_next_p2:
 | 
			
		||||
 * @a: Value to get the next power
 | 
			
		||||
 *
 | 
			
		||||
 * Calculates the nearest power of two, greater than or equal to @a.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: The nearest power of two, greater or equal to @a.
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.2
 | 
			
		||||
 */
 | 
			
		||||
gint
 | 
			
		||||
clutter_util_next_p2 (gint a)
 | 
			
		||||
{
 | 
			
		||||
  int rval = 1;
 | 
			
		||||
 | 
			
		||||
  while (rval < a)
 | 
			
		||||
    rval <<= 1;
 | 
			
		||||
 | 
			
		||||
  return rval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Help macros to scale from OpenGL <-1,1> coordinates system to
 | 
			
		||||
 * window coordinates ranging [0,window-size]
 | 
			
		||||
 */
 | 
			
		||||
@@ -128,6 +105,47 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
 | 
			
		||||
                                        ClutterRect                 *dest)
 | 
			
		||||
{
 | 
			
		||||
  *dest = (ClutterRect) {
 | 
			
		||||
    .origin = {
 | 
			
		||||
      .x = src->x,
 | 
			
		||||
      .y = src->y
 | 
			
		||||
    },
 | 
			
		||||
    .size = {
 | 
			
		||||
      .width = src->width,
 | 
			
		||||
      .height = src->height
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rectangle_int_extents (const  ClutterRect    *src,
 | 
			
		||||
                                          cairo_rectangle_int_t *dest)
 | 
			
		||||
{
 | 
			
		||||
  ClutterRect tmp = *src;
 | 
			
		||||
 | 
			
		||||
  clutter_rect_clamp_to_pixel (&tmp);
 | 
			
		||||
 | 
			
		||||
  *dest = (cairo_rectangle_int_t) {
 | 
			
		||||
    .x = tmp.origin.x,
 | 
			
		||||
    .y = tmp.origin.y,
 | 
			
		||||
    .width = tmp.size.width,
 | 
			
		||||
    .height = tmp.size.height,
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
 | 
			
		||||
                                     int                          x,
 | 
			
		||||
                                     int                          y,
 | 
			
		||||
                                     cairo_rectangle_int_t       *dest)
 | 
			
		||||
{
 | 
			
		||||
  *dest = *src;
 | 
			
		||||
 | 
			
		||||
  dest->x += x;
 | 
			
		||||
  dest->y += y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*< private >
 | 
			
		||||
 * _clutter_util_rectangle_union:
 | 
			
		||||
 * @src1: first rectangle to union
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,8 @@ typedef struct _ClutterStageViewCoglPrivate
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageViewCogl, clutter_stage_view_cogl,
 | 
			
		||||
                            CLUTTER_TYPE_STAGE_VIEW)
 | 
			
		||||
 | 
			
		||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
 | 
			
		||||
static void
 | 
			
		||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
 | 
			
		||||
                         _clutter_stage_cogl,
 | 
			
		||||
@@ -68,7 +69,8 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
 | 
			
		||||
                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
 | 
			
		||||
                                                clutter_stage_window_iface_init));
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
  PROP_WRAPPER,
 | 
			
		||||
  PROP_BACKEND,
 | 
			
		||||
@@ -549,31 +551,19 @@ calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
 | 
			
		||||
                          int                    fb_height,
 | 
			
		||||
                          cairo_rectangle_int_t *out_scissor_rect)
 | 
			
		||||
{
 | 
			
		||||
  int scissor_x;
 | 
			
		||||
  int scissor_y;
 | 
			
		||||
  int scissor_width;
 | 
			
		||||
  int scissor_height;
 | 
			
		||||
  *out_scissor_rect = *fb_clip_region;
 | 
			
		||||
 | 
			
		||||
  scissor_x = fb_clip_region->x;
 | 
			
		||||
  scissor_y = fb_clip_region->y;
 | 
			
		||||
  scissor_width = fb_clip_region->width;
 | 
			
		||||
  scissor_height = fb_clip_region->height;
 | 
			
		||||
  if (subpixel_compensation == 0)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (fb_clip_region->x > 0)
 | 
			
		||||
    scissor_x += subpixel_compensation;
 | 
			
		||||
    out_scissor_rect->x += subpixel_compensation;
 | 
			
		||||
  if (fb_clip_region->y > 0)
 | 
			
		||||
    scissor_y += subpixel_compensation;
 | 
			
		||||
    out_scissor_rect->y += subpixel_compensation;
 | 
			
		||||
  if (fb_clip_region->x + fb_clip_region->width < fb_width)
 | 
			
		||||
    scissor_width -= 2 * subpixel_compensation;
 | 
			
		||||
    out_scissor_rect->width -= 2 * subpixel_compensation;
 | 
			
		||||
  if (fb_clip_region->y + fb_clip_region->height < fb_height)
 | 
			
		||||
    scissor_height -= 2 * subpixel_compensation;
 | 
			
		||||
 | 
			
		||||
  *out_scissor_rect = (cairo_rectangle_int_t) {
 | 
			
		||||
    .x = scissor_x,
 | 
			
		||||
    .y = scissor_y,
 | 
			
		||||
    .width = scissor_width,
 | 
			
		||||
    .height = scissor_height
 | 
			
		||||
  };
 | 
			
		||||
    out_scissor_rect->height -= 2 * subpixel_compensation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline gboolean
 | 
			
		||||
@@ -585,6 +575,18 @@ is_buffer_age_enabled (void)
 | 
			
		||||
         cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
scale_and_clamp_rect (const ClutterRect     *rect,
 | 
			
		||||
                      float                  scale,
 | 
			
		||||
                      cairo_rectangle_int_t *dest)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  ClutterRect tmp = *rect;
 | 
			
		||||
 | 
			
		||||
  clutter_rect_scale (&tmp, scale, scale);
 | 
			
		||||
  _clutter_util_rectangle_int_extents (&tmp, dest);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
                                ClutterStageView   *view)
 | 
			
		||||
@@ -648,21 +650,22 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
       * frames when starting up... */
 | 
			
		||||
      cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterRect rect;
 | 
			
		||||
 | 
			
		||||
      may_use_clipped_redraw = TRUE;
 | 
			
		||||
 | 
			
		||||
      if (fb_scale != floorf (fb_scale))
 | 
			
		||||
        subpixel_compensation = ceilf (fb_scale);
 | 
			
		||||
      _clutter_util_rect_from_rectangle (&redraw_clip, &rect);
 | 
			
		||||
      clutter_rect_offset (&rect, -view_rect.x, -view_rect.y);
 | 
			
		||||
      scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
 | 
			
		||||
 | 
			
		||||
      fb_clip_region = (cairo_rectangle_int_t) {
 | 
			
		||||
        .x = (floorf ((redraw_clip.x - view_rect.x) * fb_scale) -
 | 
			
		||||
              subpixel_compensation),
 | 
			
		||||
        .y = (floorf ((redraw_clip.y - view_rect.y) * fb_scale) -
 | 
			
		||||
              subpixel_compensation),
 | 
			
		||||
        .width = (ceilf (redraw_clip.width * fb_scale) +
 | 
			
		||||
                  (2 * subpixel_compensation)),
 | 
			
		||||
        .height = (ceilf (redraw_clip.height * fb_scale) +
 | 
			
		||||
                   (2 * subpixel_compensation))
 | 
			
		||||
      };
 | 
			
		||||
      if (fb_scale != floorf (fb_scale))
 | 
			
		||||
        {
 | 
			
		||||
          subpixel_compensation = ceilf (fb_scale);
 | 
			
		||||
          fb_clip_region.x -= subpixel_compensation;
 | 
			
		||||
          fb_clip_region.y -= subpixel_compensation;
 | 
			
		||||
          fb_clip_region.width += 2 * subpixel_compensation;
 | 
			
		||||
          fb_clip_region.height += 2 * subpixel_compensation;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
@@ -690,6 +693,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
 | 
			
		||||
          if (valid_buffer_age (view_cogl, age))
 | 
			
		||||
            {
 | 
			
		||||
              ClutterRect rect;
 | 
			
		||||
              cairo_rectangle_int_t damage_region;
 | 
			
		||||
 | 
			
		||||
              *current_fb_damage = fb_clip_region;
 | 
			
		||||
@@ -705,12 +709,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
              /* Update the bounding redraw clip state with the extra damage. */
 | 
			
		||||
              damage_region = (cairo_rectangle_int_t) {
 | 
			
		||||
                .x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
 | 
			
		||||
                .y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
 | 
			
		||||
                .width = ceilf (fb_clip_region.width / fb_scale),
 | 
			
		||||
                .height = ceilf (fb_clip_region.height / fb_scale)
 | 
			
		||||
              };
 | 
			
		||||
              _clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
 | 
			
		||||
              scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
 | 
			
		||||
              _clutter_util_rectangle_offset (&damage_region,
 | 
			
		||||
                                              view_rect.x,
 | 
			
		||||
                                              view_rect.y,
 | 
			
		||||
                                              &damage_region);
 | 
			
		||||
              _clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
 | 
			
		||||
                                             &damage_region,
 | 
			
		||||
                                             &stage_cogl->bounding_redraw_clip);
 | 
			
		||||
@@ -749,7 +753,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
    }
 | 
			
		||||
  else if (use_clipped_redraw)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterRect rect;
 | 
			
		||||
      cairo_rectangle_int_t scissor_rect;
 | 
			
		||||
      cairo_rectangle_int_t paint_rect;
 | 
			
		||||
 | 
			
		||||
      calculate_scissor_region (&fb_clip_region,
 | 
			
		||||
                                subpixel_compensation,
 | 
			
		||||
@@ -770,13 +776,15 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
                                          scissor_rect.y,
 | 
			
		||||
                                          scissor_rect.width,
 | 
			
		||||
                                          scissor_rect.height);
 | 
			
		||||
      paint_stage (stage_cogl, view,
 | 
			
		||||
                   &(cairo_rectangle_int_t) {
 | 
			
		||||
                     .x = view_rect.x + floorf ((fb_clip_region.x - 0) / fb_scale),
 | 
			
		||||
                     .y = view_rect.y + floorf ((fb_clip_region.y - 0) / fb_scale),
 | 
			
		||||
                     .width = ceilf ((fb_clip_region.width + 0) / fb_scale),
 | 
			
		||||
                     .height = ceilf ((fb_clip_region.height + 0) / fb_scale)
 | 
			
		||||
                   });
 | 
			
		||||
 | 
			
		||||
      _clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
 | 
			
		||||
      scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
 | 
			
		||||
      _clutter_util_rectangle_offset (&paint_rect,
 | 
			
		||||
                                      view_rect.x,
 | 
			
		||||
                                      view_rect.y,
 | 
			
		||||
                                      &paint_rect);
 | 
			
		||||
 | 
			
		||||
      paint_stage (stage_cogl, view, &paint_rect);
 | 
			
		||||
      cogl_framebuffer_pop_clip (fb);
 | 
			
		||||
 | 
			
		||||
      stage_cogl->using_clipped_redraw = FALSE;
 | 
			
		||||
@@ -791,7 +799,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
          may_use_clipped_redraw &&
 | 
			
		||||
          !clip_region_empty)
 | 
			
		||||
        {
 | 
			
		||||
          ClutterRect rect;
 | 
			
		||||
          cairo_rectangle_int_t scissor_rect;
 | 
			
		||||
          cairo_rectangle_int_t paint_rect;
 | 
			
		||||
 | 
			
		||||
          calculate_scissor_region (&fb_clip_region,
 | 
			
		||||
                                    subpixel_compensation,
 | 
			
		||||
@@ -803,13 +813,15 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
 | 
			
		||||
                                              scissor_rect.y,
 | 
			
		||||
                                              scissor_rect.width,
 | 
			
		||||
                                              scissor_rect.height);
 | 
			
		||||
          paint_stage (stage_cogl, view,
 | 
			
		||||
                       &(cairo_rectangle_int_t) {
 | 
			
		||||
                         .x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
 | 
			
		||||
                         .y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
 | 
			
		||||
                         .width = ceilf (fb_clip_region.width / fb_scale),
 | 
			
		||||
                         .height = ceilf (fb_clip_region.height / fb_scale)
 | 
			
		||||
                       });
 | 
			
		||||
 | 
			
		||||
          _clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
 | 
			
		||||
          scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
 | 
			
		||||
          _clutter_util_rectangle_offset (&paint_rect,
 | 
			
		||||
                                          view_rect.x,
 | 
			
		||||
                                          view_rect.y,
 | 
			
		||||
                                          &paint_rect);
 | 
			
		||||
 | 
			
		||||
          paint_stage (stage_cogl, view, &paint_rect);
 | 
			
		||||
          cogl_framebuffer_pop_clip (fb);
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
@@ -994,7 +1006,7 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
 | 
			
		||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
 | 
			
		||||
{
 | 
			
		||||
  iface->realize = clutter_stage_cogl_realize;
 | 
			
		||||
  iface->unrealize = clutter_stage_cogl_unrealize;
 | 
			
		||||
 
 | 
			
		||||
@@ -7,371 +7,6 @@
 | 
			
		||||
 | 
			
		||||
#include "clutter-actor-private.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
#include "clutter-shader.h"
 | 
			
		||||
 | 
			
		||||
typedef struct _ShaderData ShaderData;
 | 
			
		||||
 | 
			
		||||
struct _ShaderData
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader *shader;
 | 
			
		||||
 | 
			
		||||
  /* back pointer to the actor */
 | 
			
		||||
  ClutterActor *actor;
 | 
			
		||||
 | 
			
		||||
  /* list of values that should be set on the shader
 | 
			
		||||
   * before each paint cycle
 | 
			
		||||
   */
 | 
			
		||||
  GHashTable *value_hash;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
shader_value_free (gpointer data)
 | 
			
		||||
{
 | 
			
		||||
  GValue *var = data;
 | 
			
		||||
  g_value_unset (var);
 | 
			
		||||
  g_slice_free (GValue, var);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
destroy_shader_data (gpointer data)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data = data;
 | 
			
		||||
 | 
			
		||||
  if (shader_data == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (shader_data->shader != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_object_unref (shader_data->shader);
 | 
			
		||||
      shader_data->shader = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (shader_data->value_hash != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_hash_table_destroy (shader_data->value_hash);
 | 
			
		||||
      shader_data->value_hash = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_slice_free (ShaderData, shader_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_get_shader:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
 *
 | 
			
		||||
 * Queries the currently set #ClutterShader on @self.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): The currently set #ClutterShader
 | 
			
		||||
 *   or %NULL if no shader is set.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use clutter_actor_get_effect() instead.
 | 
			
		||||
 */
 | 
			
		||||
ClutterShader *
 | 
			
		||||
clutter_actor_get_shader (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
 | 
			
		||||
 | 
			
		||||
  shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
 | 
			
		||||
  if (shader_data != NULL)
 | 
			
		||||
    return shader_data->shader;
 | 
			
		||||
 | 
			
		||||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_set_shader:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
 * @shader: (allow-none): a #ClutterShader or %NULL to unset the shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the #ClutterShader to be used when rendering @self.
 | 
			
		||||
 *
 | 
			
		||||
 * If @shader is %NULL this function will unset any currently set shader
 | 
			
		||||
 * for the actor.
 | 
			
		||||
 *
 | 
			
		||||
 * Any #ClutterEffect applied to @self will take the precedence
 | 
			
		||||
 * over the #ClutterShader set using this function.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the shader was successfully applied
 | 
			
		||||
 *   or removed
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect and
 | 
			
		||||
 *   clutter_actor_add_effect() instead.
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_actor_set_shader (ClutterActor  *self,
 | 
			
		||||
                          ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
 | 
			
		||||
  g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
 | 
			
		||||
 | 
			
		||||
  if (shader != NULL)
 | 
			
		||||
    g_object_ref (shader);
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      /* if shader passed in is NULL we destroy the shader */
 | 
			
		||||
      g_object_set_data (G_OBJECT (self), "-clutter-actor-shader-data", NULL);
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
 | 
			
		||||
  if (shader_data == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      shader_data = g_slice_new (ShaderData);
 | 
			
		||||
      shader_data->actor = self;
 | 
			
		||||
      shader_data->shader = NULL;
 | 
			
		||||
      shader_data->value_hash =
 | 
			
		||||
        g_hash_table_new_full (g_str_hash, g_str_equal,
 | 
			
		||||
                               g_free,
 | 
			
		||||
                               shader_value_free);
 | 
			
		||||
 | 
			
		||||
      g_object_set_data_full (G_OBJECT (self), "-clutter-actor-shader-data",
 | 
			
		||||
                              shader_data,
 | 
			
		||||
                              destroy_shader_data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (shader_data->shader != NULL)
 | 
			
		||||
    g_object_unref (shader_data->shader);
 | 
			
		||||
 | 
			
		||||
  shader_data->shader = shader;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_queue_redraw (self);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
set_each_param (gpointer key,
 | 
			
		||||
                gpointer value,
 | 
			
		||||
                gpointer user_data)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader *shader = user_data;
 | 
			
		||||
  const gchar *uniform = key;
 | 
			
		||||
  GValue *var = value;
 | 
			
		||||
 | 
			
		||||
  clutter_shader_set_uniform (shader, uniform, var);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_clutter_actor_shader_pre_paint (ClutterActor *actor,
 | 
			
		||||
                                 gboolean      repeat)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data;
 | 
			
		||||
  ClutterShader *shader;
 | 
			
		||||
 | 
			
		||||
  shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
 | 
			
		||||
  if (shader_data == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  shader = shader_data->shader;
 | 
			
		||||
  if (shader != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      clutter_shader_set_is_enabled (shader, TRUE);
 | 
			
		||||
 | 
			
		||||
      g_hash_table_foreach (shader_data->value_hash, set_each_param, shader);
 | 
			
		||||
 | 
			
		||||
      if (!repeat)
 | 
			
		||||
        _clutter_context_push_shader_stack (actor);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_clutter_actor_shader_post_paint (ClutterActor *actor)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data;
 | 
			
		||||
  ClutterShader *shader;
 | 
			
		||||
 | 
			
		||||
  shader_data = g_object_get_data (G_OBJECT (actor), "-clutter-actor-shader-data");
 | 
			
		||||
  if (G_LIKELY (shader_data == NULL))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  shader = shader_data->shader;
 | 
			
		||||
  if (shader != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterActor *head;
 | 
			
		||||
 | 
			
		||||
      clutter_shader_set_is_enabled (shader, FALSE);
 | 
			
		||||
 | 
			
		||||
      /* remove the actor from the shaders stack; if there is another
 | 
			
		||||
       * actor inside it, then call pre-paint again to set its shader
 | 
			
		||||
       * but this time with the second argument being TRUE, indicating
 | 
			
		||||
       * that we are re-applying an existing shader and thus should it
 | 
			
		||||
       * not be prepended to the stack
 | 
			
		||||
       */
 | 
			
		||||
      head = _clutter_context_pop_shader_stack (actor);
 | 
			
		||||
      if (head != NULL)
 | 
			
		||||
        _clutter_actor_shader_pre_paint (head, TRUE);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
clutter_actor_set_shader_param_internal (ClutterActor *self,
 | 
			
		||||
                                         const gchar  *param,
 | 
			
		||||
                                         const GValue *value)
 | 
			
		||||
{
 | 
			
		||||
  ShaderData *shader_data;
 | 
			
		||||
  GValue *var;
 | 
			
		||||
 | 
			
		||||
  shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data");
 | 
			
		||||
  if (shader_data == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  var = g_slice_new0 (GValue);
 | 
			
		||||
  g_value_init (var, G_VALUE_TYPE (value));
 | 
			
		||||
  g_value_copy (value, var);
 | 
			
		||||
  g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_queue_redraw (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_set_shader_param:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
 * @param: the name of the parameter
 | 
			
		||||
 * @value: the value of the parameter
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the value for a named parameter of the shader applied
 | 
			
		||||
 * to @actor.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use clutter_shader_effect_set_uniform_value() instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_actor_set_shader_param (ClutterActor *self,
 | 
			
		||||
                                const gchar  *param,
 | 
			
		||||
                                const GValue *value)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_ACTOR (self));
 | 
			
		||||
  g_return_if_fail (param != NULL);
 | 
			
		||||
  g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
 | 
			
		||||
                    CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
 | 
			
		||||
                    CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
 | 
			
		||||
                    G_VALUE_HOLDS_FLOAT (value) ||
 | 
			
		||||
                    G_VALUE_HOLDS_INT (value));
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_shader_param_internal (self, param, value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_set_shader_param_float:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
 * @param: the name of the parameter
 | 
			
		||||
 * @value: the value of the parameter
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the value for a named float parameter of the shader applied
 | 
			
		||||
 * to @actor.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_actor_set_shader_param_float (ClutterActor *self,
 | 
			
		||||
                                      const gchar  *param,
 | 
			
		||||
                                      gfloat        value)
 | 
			
		||||
{
 | 
			
		||||
  GValue var = { 0, };
 | 
			
		||||
 | 
			
		||||
  g_value_init (&var, G_TYPE_FLOAT);
 | 
			
		||||
  g_value_set_float (&var, value);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_shader_param_internal (self, param, &var);
 | 
			
		||||
 | 
			
		||||
  g_value_unset (&var);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_set_shader_param_int:
 | 
			
		||||
 * @self: a #ClutterActor
 | 
			
		||||
 * @param: the name of the parameter
 | 
			
		||||
 * @value: the value of the parameter
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the value for a named int parameter of the shader applied to
 | 
			
		||||
 * @actor.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_actor_set_shader_param_int (ClutterActor *self,
 | 
			
		||||
                                    const gchar  *param,
 | 
			
		||||
                                    gint          value)
 | 
			
		||||
{
 | 
			
		||||
  GValue var = { 0, };
 | 
			
		||||
 | 
			
		||||
  g_value_init (&var, G_TYPE_INT);
 | 
			
		||||
  g_value_set_int (&var, value);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_shader_param_internal (self, param, &var);
 | 
			
		||||
 | 
			
		||||
  g_value_unset (&var);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_set_geometry:
 | 
			
		||||
 * @self: A #ClutterActor
 | 
			
		||||
 * @geometry: A #ClutterGeometry
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the actor's fixed position and forces its minimum and natural
 | 
			
		||||
 * size, in pixels. This means the untransformed actor will have the
 | 
			
		||||
 * given geometry. This is the same as calling clutter_actor_set_position()
 | 
			
		||||
 * and clutter_actor_set_size().
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.10: Use clutter_actor_set_position() and
 | 
			
		||||
 *   clutter_actor_set_size() instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_actor_set_geometry (ClutterActor          *self,
 | 
			
		||||
			    const ClutterGeometry *geometry)
 | 
			
		||||
{
 | 
			
		||||
  g_object_freeze_notify (G_OBJECT (self));
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_position (self, geometry->x, geometry->y);
 | 
			
		||||
  clutter_actor_set_size (self, geometry->width, geometry->height);
 | 
			
		||||
 | 
			
		||||
  g_object_thaw_notify (G_OBJECT (self));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_get_geometry:
 | 
			
		||||
 * @self: A #ClutterActor
 | 
			
		||||
 * @geometry: (out caller-allocates): A location to store actors #ClutterGeometry
 | 
			
		||||
 *
 | 
			
		||||
 * Gets the size and position of an actor relative to its parent
 | 
			
		||||
 * actor. This is the same as calling clutter_actor_get_position() and
 | 
			
		||||
 * clutter_actor_get_size(). It tries to "do what you mean" and get the
 | 
			
		||||
 * requested size and position if the actor's allocation is invalid.
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.10: Use clutter_actor_get_position() and
 | 
			
		||||
 *   clutter_actor_get_size(), or clutter_actor_get_allocation_geometry()
 | 
			
		||||
 *   instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_actor_get_geometry (ClutterActor    *self,
 | 
			
		||||
			    ClutterGeometry *geometry)
 | 
			
		||||
{
 | 
			
		||||
  gfloat x, y, width, height;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_ACTOR (self));
 | 
			
		||||
  g_return_if_fail (geometry != NULL);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_get_position (self, &x, &y);
 | 
			
		||||
  clutter_actor_get_size (self, &width, &height);
 | 
			
		||||
 | 
			
		||||
  geometry->x = (int) x;
 | 
			
		||||
  geometry->y = (int) y;
 | 
			
		||||
  geometry->width = (int) width;
 | 
			
		||||
  geometry->height = (int) height;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_actor_get_allocation_geometry:
 | 
			
		||||
 
 | 
			
		||||
@@ -33,13 +33,6 @@
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void            clutter_actor_set_geometry                      (ClutterActor          *self,
 | 
			
		||||
                                                                 const ClutterGeometry *geometry);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_allocation_geometry)
 | 
			
		||||
void            clutter_actor_get_geometry                      (ClutterActor          *self,
 | 
			
		||||
                                                                 ClutterGeometry       *geometry);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint32         clutter_actor_get_gid                           (ClutterActor          *self);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,188 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2010 Intel Corporation
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * Author:
 | 
			
		||||
 *   Øyvind Kolås <pippin@linux.intel.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_ANIMATOR_H__
 | 
			
		||||
#define __CLUTTER_ANIMATOR_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
#include <clutter/clutter-timeline.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_ANIMATOR                   (clutter_animator_get_type ())
 | 
			
		||||
#define CLUTTER_TYPE_ANIMATOR_KEY               (clutter_animator_key_get_type ())
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_ANIMATOR(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimator))
 | 
			
		||||
#define CLUTTER_ANIMATOR_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
 | 
			
		||||
#define CLUTTER_IS_ANIMATOR(obj)                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATOR))
 | 
			
		||||
#define CLUTTER_IS_ANIMATOR_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATOR))
 | 
			
		||||
#define CLUTTER_ANIMATOR_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
 | 
			
		||||
 | 
			
		||||
/* ClutterAnimator is typedef in clutter-types.h */
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterAnimatorClass   ClutterAnimatorClass;
 | 
			
		||||
typedef struct _ClutterAnimatorPrivate ClutterAnimatorPrivate;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterAnimatorKey:
 | 
			
		||||
 *
 | 
			
		||||
 * A key frame inside a #ClutterAnimator
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.12
 | 
			
		||||
 */
 | 
			
		||||
typedef struct _ClutterAnimatorKey     ClutterAnimatorKey;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterAnimator:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterAnimator structure contains only private data and
 | 
			
		||||
 * should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.12
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterAnimator
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObject parent_instance;
 | 
			
		||||
 | 
			
		||||
  ClutterAnimatorPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterAnimatorClass:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterAnimatorClass structure contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.12
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterAnimatorClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObjectClass parent_class;
 | 
			
		||||
 | 
			
		||||
  /* padding for future expansion */
 | 
			
		||||
  gpointer _padding_dummy[16];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType                clutter_animator_get_type                   (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterAnimator *    clutter_animator_new                        (void);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterAnimator *    clutter_animator_set_key                    (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  guint                 mode,
 | 
			
		||||
                                                                  gdouble               progress,
 | 
			
		||||
                                                                  const GValue         *value);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_set                        (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  gpointer              first_object,
 | 
			
		||||
                                                                  const gchar          *first_property_name,
 | 
			
		||||
                                                                  guint                 first_mode,
 | 
			
		||||
                                                                  gdouble               first_progress,
 | 
			
		||||
                                                                  ...) G_GNUC_NULL_TERMINATED;
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GList              * clutter_animator_get_keys                   (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  gdouble               progress);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_remove_key                 (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object, 
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  gdouble               progress);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterTimeline *    clutter_animator_start                      (ClutterAnimator      *animator);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean             clutter_animator_compute_value              (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  gdouble               progress,
 | 
			
		||||
                                                                  GValue               *value);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterTimeline *    clutter_animator_get_timeline               (ClutterAnimator      *animator);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_set_timeline               (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  ClutterTimeline      *timeline);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint                clutter_animator_get_duration               (ClutterAnimator      *animator);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_set_duration               (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  guint                 duration);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean             clutter_animator_property_get_ease_in       (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_property_set_ease_in       (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  gboolean              ease_in);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                 clutter_animator_property_set_interpolation (ClutterAnimator      *animator,
 | 
			
		||||
                                                                  GObject              *object,
 | 
			
		||||
                                                                  const gchar          *property_name,
 | 
			
		||||
                                                                  ClutterInterpolation  interpolation);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType           clutter_animator_key_get_type           (void) G_GNUC_CONST;
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GObject *       clutter_animator_key_get_object         (const ClutterAnimatorKey *key);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
const gchar *   clutter_animator_key_get_property_name  (const ClutterAnimatorKey *key);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType           clutter_animator_key_get_property_type  (const ClutterAnimatorKey *key);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gulong          clutter_animator_key_get_mode           (const ClutterAnimatorKey *key);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gdouble         clutter_animator_key_get_progress       (const ClutterAnimatorKey *key);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean        clutter_animator_key_get_value          (const ClutterAnimatorKey *key,
 | 
			
		||||
                                                         GValue                   *value);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_ANIMATOR_H__ */
 | 
			
		||||
@@ -1,64 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
 | 
			
		||||
 * Copyright (C) 2009, 2010 Intel Corp
 | 
			
		||||
 *
 | 
			
		||||
 * 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_BACKEND_DEPRECATED_H__
 | 
			
		||||
#define __CLUTTER_BACKEND_DEPRECATED_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_dpi)
 | 
			
		||||
void            clutter_backend_set_resolution                  (ClutterBackend *backend,
 | 
			
		||||
                                                                 gdouble         dpi);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
 | 
			
		||||
void            clutter_backend_set_double_click_time           (ClutterBackend *backend,
 | 
			
		||||
                                                                 guint           msec);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
 | 
			
		||||
guint           clutter_backend_get_double_click_time           (ClutterBackend *backend);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
 | 
			
		||||
void            clutter_backend_set_double_click_distance       (ClutterBackend *backend,
 | 
			
		||||
                                                                 guint           distance);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
 | 
			
		||||
guint           clutter_backend_get_double_click_distance       (ClutterBackend *backend);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
 | 
			
		||||
void            clutter_backend_set_font_name                   (ClutterBackend *backend,
 | 
			
		||||
                                                                 const gchar    *font_name);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
 | 
			
		||||
const gchar *   clutter_backend_get_font_name                   (ClutterBackend *backend);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_BACKEND_DEPRECATED_H__ */
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,159 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Tomas Frydrych  <tf@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2007 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_BEHAVIOUR_ELLIPSE_H__
 | 
			
		||||
#define __CLUTTER_BEHAVIOUR_ELLIPSE_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_BEHAVIOUR_ELLIPSE (clutter_behaviour_ellipse_get_type ())
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ELLIPSE(obj) \
 | 
			
		||||
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipse))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ELLIPSE_CLASS(klass) \
 | 
			
		||||
  (G_TYPE_CHECK_CLASS_CAST ((klass), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipseClass))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_ELLIPSE(obj) \
 | 
			
		||||
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_ELLIPSE))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_ELLIPSE_CLASS(klass) \
 | 
			
		||||
  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_ELLIPSE))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ELLIPSE_GET_CLASS(obj) \
 | 
			
		||||
  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, ClutterBehaviourEllipseClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterBehaviourEllipse        ClutterBehaviourEllipse;
 | 
			
		||||
typedef struct _ClutterBehaviourEllipsePrivate ClutterBehaviourEllipsePrivate;
 | 
			
		||||
typedef struct _ClutterBehaviourEllipseClass   ClutterBehaviourEllipseClass;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourEllipse:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourEllipse struct contains only private data
 | 
			
		||||
 * and should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourEllipse
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviour parent_instance;
 | 
			
		||||
  ClutterBehaviourEllipsePrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourEllipseClass:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourEllipseClass struct contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourEllipseClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviourClass   parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType clutter_behaviour_ellipse_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate)
 | 
			
		||||
ClutterBehaviour *     clutter_behaviour_ellipse_new             (ClutterAlpha            *alpha,
 | 
			
		||||
								  gint                     x,
 | 
			
		||||
								  gint                     y,
 | 
			
		||||
								  gint                     width,
 | 
			
		||||
								  gint                     height,
 | 
			
		||||
								  ClutterRotateDirection   direction,
 | 
			
		||||
								  gdouble                  start,
 | 
			
		||||
								  gdouble                  end);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_center      (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gint                     x,
 | 
			
		||||
								  gint                     y);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_get_center      (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gint                    *x,
 | 
			
		||||
								  gint                    *y);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_width       (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gint                     width);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gint                   clutter_behaviour_ellipse_get_width       (ClutterBehaviourEllipse *self);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_height      (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gint                     height);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gint                   clutter_behaviour_ellipse_get_height      (ClutterBehaviourEllipse *self);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gdouble                  angle_start);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gdouble                clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_angle_end   (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gdouble                  angle_end);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gdouble                clutter_behaviour_ellipse_get_angle_end   (ClutterBehaviourEllipse *self);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_angle_tilt  (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  ClutterRotateAxis        axis,
 | 
			
		||||
								  gdouble                  angle_tilt);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gdouble                clutter_behaviour_ellipse_get_angle_tilt  (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  ClutterRotateAxis        axis);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_tilt        (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gdouble                  angle_tilt_x,
 | 
			
		||||
								  gdouble                  angle_tilt_y,
 | 
			
		||||
								  gdouble                  angle_tilt_z);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_get_tilt        (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  gdouble                 *angle_tilt_x,
 | 
			
		||||
								  gdouble                 *angle_tilt_y,
 | 
			
		||||
								  gdouble                 *angle_tilt_z);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterRotateDirection clutter_behaviour_ellipse_get_direction   (ClutterBehaviourEllipse *self);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_ellipse_set_direction   (ClutterBehaviourEllipse *self,
 | 
			
		||||
								  ClutterRotateDirection   direction);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_BEHAVIOUR_ELLIPSE_H__ */
 | 
			
		||||
@@ -1,465 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By:
 | 
			
		||||
 *      Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *      Neil Roberts  <neil@linux.intel.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
 | 
			
		||||
 * Copyright (C) 2009, 2010 Intel Corp
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:clutter-behaviour-path
 | 
			
		||||
 * @Title: ClutterBehaviourPath
 | 
			
		||||
 * @short_description: A behaviour for moving actors along a #ClutterPath
 | 
			
		||||
 * @Deprecated: 1.6: Use #ClutterPathConstraint and clutter_actor_animate()
 | 
			
		||||
 *   with the #ClutterPathConstraint:offset property instead.
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterBehaviourPath interpolates actors along a defined path.
 | 
			
		||||
 *
 | 
			
		||||
 * A path is described by a #ClutterPath object. The path can contain
 | 
			
		||||
 * straight line parts and bezier curves. If the path contains
 | 
			
		||||
 * %CLUTTER_PATH_MOVE_TO parts then the actors will jump to those
 | 
			
		||||
 * coordinates. This can be used make disjoint paths.
 | 
			
		||||
 *
 | 
			
		||||
 * When creating a path behaviour in a #ClutterScript, you can specify
 | 
			
		||||
 * the path property directly as a string. For example:
 | 
			
		||||
 *
 | 
			
		||||
 * |[
 | 
			
		||||
 * {
 | 
			
		||||
 *   "id"     : "spline-path",
 | 
			
		||||
 *   "type"   : "ClutterBehaviourPath",
 | 
			
		||||
 *   "path"   : "M 50 50 L 100 100",
 | 
			
		||||
 *   "alpha"  : {
 | 
			
		||||
 *      "timeline" : "main-timeline",
 | 
			
		||||
 *      "function" : "ramp
 | 
			
		||||
 *    }
 | 
			
		||||
 * }
 | 
			
		||||
 * ]|
 | 
			
		||||
 *
 | 
			
		||||
 * If the alpha function is a periodic function, i.e. it returns to
 | 
			
		||||
 * 0.0 after reaching 1.0, then the actors will walk the path back to the
 | 
			
		||||
 * starting #ClutterKnot.
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterBehaviourPath is available since Clutter 0.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use #ClutterPath and #ClutterPathConstraint with
 | 
			
		||||
 *   clutter_actor_animate() instead.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
 | 
			
		||||
#include "clutter-alpha.h"
 | 
			
		||||
#include "clutter-behaviour.h"
 | 
			
		||||
#include "clutter-behaviour-path.h"
 | 
			
		||||
#include "clutter-bezier.h"
 | 
			
		||||
#include "clutter-debug.h"
 | 
			
		||||
#include "clutter-enum-types.h"
 | 
			
		||||
#include "clutter-main.h"
 | 
			
		||||
#include "clutter-marshal.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
#include "clutter-script-private.h"
 | 
			
		||||
#include "clutter-scriptable.h"
 | 
			
		||||
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
struct _ClutterBehaviourPathPrivate
 | 
			
		||||
{
 | 
			
		||||
  ClutterPath *path;
 | 
			
		||||
  guint        last_knot_passed;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  KNOT_REACHED,
 | 
			
		||||
 | 
			
		||||
  LAST_SIGNAL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static guint path_signals[LAST_SIGNAL] = { 0, };
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
 | 
			
		||||
  PROP_PATH,
 | 
			
		||||
 | 
			
		||||
  PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST];
 | 
			
		||||
 | 
			
		||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (ClutterBehaviourPath,
 | 
			
		||||
                         clutter_behaviour_path,
 | 
			
		||||
                         CLUTTER_TYPE_BEHAVIOUR,
 | 
			
		||||
                         G_ADD_PRIVATE (ClutterBehaviourPath)
 | 
			
		||||
                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
 | 
			
		||||
                                                clutter_scriptable_iface_init))
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
actor_apply_knot_foreach (ClutterBehaviour *behaviour,
 | 
			
		||||
                          ClutterActor     *actor,
 | 
			
		||||
                          gpointer          data)
 | 
			
		||||
{
 | 
			
		||||
  ClutterKnot *knot = data;
 | 
			
		||||
 | 
			
		||||
  CLUTTER_NOTE (ANIMATION, "Setting actor to %ix%i", knot->x, knot->y);
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_position (actor, knot->x, knot->y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave,
 | 
			
		||||
                                     gdouble           alpha_value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (behave);
 | 
			
		||||
  ClutterBehaviourPathPrivate *priv = pathb->priv;
 | 
			
		||||
  ClutterKnot position;
 | 
			
		||||
  guint knot_num;
 | 
			
		||||
 | 
			
		||||
  if (priv->path)
 | 
			
		||||
    knot_num = clutter_path_get_position (priv->path, alpha_value, &position);
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      memset (&position, 0, sizeof (position));
 | 
			
		||||
      knot_num = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  clutter_behaviour_actors_foreach (behave,
 | 
			
		||||
                                    actor_apply_knot_foreach,
 | 
			
		||||
                                    &position);
 | 
			
		||||
 | 
			
		||||
  if (knot_num != priv->last_knot_passed)
 | 
			
		||||
    {
 | 
			
		||||
      g_signal_emit (behave, path_signals[KNOT_REACHED], 0, knot_num);
 | 
			
		||||
      priv->last_knot_passed = knot_num;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_get_property (GObject      *gobject,
 | 
			
		||||
                                     guint         prop_id,
 | 
			
		||||
                                     GValue       *value,
 | 
			
		||||
                                     GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_PATH:
 | 
			
		||||
      g_value_set_object (value, clutter_behaviour_path_get_path (pathb));
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_set_property (GObject      *gobject,
 | 
			
		||||
                                     guint         prop_id,
 | 
			
		||||
                                     const GValue *value,
 | 
			
		||||
                                     GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_PATH:
 | 
			
		||||
      clutter_behaviour_path_set_path (pathb, g_value_get_object (value));
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_dispose (GObject *gobject)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (gobject);
 | 
			
		||||
 | 
			
		||||
  clutter_behaviour_path_set_path (pathb, NULL);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (clutter_behaviour_path_parent_class)->dispose (gobject);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
  ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
 | 
			
		||||
  GParamSpec *pspec;
 | 
			
		||||
 | 
			
		||||
  gobject_class->get_property = clutter_behaviour_path_get_property;
 | 
			
		||||
  gobject_class->set_property = clutter_behaviour_path_set_property;
 | 
			
		||||
  gobject_class->dispose = clutter_behaviour_path_dispose;
 | 
			
		||||
 | 
			
		||||
  pspec = g_param_spec_object ("path",
 | 
			
		||||
                               P_("Path"),
 | 
			
		||||
                               P_("The ClutterPath object representing the path "
 | 
			
		||||
                                  "to animate along"),
 | 
			
		||||
                               CLUTTER_TYPE_PATH,
 | 
			
		||||
                               CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_PATH] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class, PROP_PATH, pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourPath::knot-reached:
 | 
			
		||||
   * @pathb: the object which received the signal
 | 
			
		||||
   * @knot_num: the index of the #ClutterKnot reached
 | 
			
		||||
   *
 | 
			
		||||
   * This signal is emitted each time a node defined inside the path
 | 
			
		||||
   * is reached.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.2
 | 
			
		||||
   *
 | 
			
		||||
   * Deprecated: 1.6
 | 
			
		||||
   */
 | 
			
		||||
  path_signals[KNOT_REACHED] =
 | 
			
		||||
    g_signal_new ("knot-reached",
 | 
			
		||||
                  G_TYPE_FROM_CLASS (gobject_class),
 | 
			
		||||
                  G_SIGNAL_RUN_LAST,
 | 
			
		||||
                  G_STRUCT_OFFSET (ClutterBehaviourPathClass, knot_reached),
 | 
			
		||||
                  NULL, NULL,
 | 
			
		||||
                  _clutter_marshal_VOID__UINT,
 | 
			
		||||
                  G_TYPE_NONE, 1,
 | 
			
		||||
                  G_TYPE_UINT);
 | 
			
		||||
 | 
			
		||||
  behave_class->alpha_notify = clutter_behaviour_path_alpha_notify;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterScriptableIface *parent_scriptable_iface = NULL;
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_behaviour_path_parse_custom_node (ClutterScriptable *scriptable,
 | 
			
		||||
                                          ClutterScript     *script,
 | 
			
		||||
                                          GValue            *value,
 | 
			
		||||
                                          const gchar       *name,
 | 
			
		||||
                                          JsonNode          *node)
 | 
			
		||||
{
 | 
			
		||||
  if (strcmp ("path", name) == 0)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterPath *path;
 | 
			
		||||
      GValue node_value = { 0 };
 | 
			
		||||
 | 
			
		||||
      path = g_object_ref_sink (clutter_path_new ());
 | 
			
		||||
 | 
			
		||||
      json_node_get_value (node, &node_value);
 | 
			
		||||
 | 
			
		||||
      if (!G_VALUE_HOLDS (&node_value, G_TYPE_STRING)
 | 
			
		||||
          || !clutter_path_set_description (path,
 | 
			
		||||
                                            g_value_get_string (&node_value)))
 | 
			
		||||
        g_warning ("Invalid path description");
 | 
			
		||||
 | 
			
		||||
      g_value_unset (&node_value);
 | 
			
		||||
 | 
			
		||||
      g_value_init (value, G_TYPE_OBJECT);
 | 
			
		||||
      g_value_take_object (value, path);
 | 
			
		||||
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  /* chain up */
 | 
			
		||||
  else if (parent_scriptable_iface->parse_custom_node)
 | 
			
		||||
    return parent_scriptable_iface->parse_custom_node (scriptable, script,
 | 
			
		||||
                                                       value, name, node);
 | 
			
		||||
  else
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
 | 
			
		||||
{
 | 
			
		||||
  parent_scriptable_iface = g_type_interface_peek_parent (iface);
 | 
			
		||||
 | 
			
		||||
  if (!parent_scriptable_iface)
 | 
			
		||||
    parent_scriptable_iface
 | 
			
		||||
      = g_type_default_interface_peek (CLUTTER_TYPE_SCRIPTABLE);
 | 
			
		||||
 | 
			
		||||
  iface->parse_custom_node = clutter_behaviour_path_parse_custom_node;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_path_init (ClutterBehaviourPath *self)
 | 
			
		||||
{
 | 
			
		||||
  self->priv = clutter_behaviour_path_get_instance_private (self);
 | 
			
		||||
  self->priv->last_knot_passed = G_MAXUINT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_path_new:
 | 
			
		||||
 * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
 | 
			
		||||
 * @path: a #ClutterPath or %NULL for an empty path
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new path behaviour. You can use this behaviour to drive
 | 
			
		||||
 * actors along the nodes of a path, described by @path.
 | 
			
		||||
 *
 | 
			
		||||
 * This will claim the floating reference on the #ClutterPath so you
 | 
			
		||||
 * do not need to unref if it.
 | 
			
		||||
 *
 | 
			
		||||
 * If @alpha is not %NULL, the #ClutterBehaviour will take ownership
 | 
			
		||||
 * of the #ClutterAlpha instance. In the case when @alpha is %NULL,
 | 
			
		||||
 * it can be set later with clutter_behaviour_set_alpha().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer full): a #ClutterBehaviour
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
ClutterBehaviour *
 | 
			
		||||
clutter_behaviour_path_new (ClutterAlpha *alpha,
 | 
			
		||||
                            ClutterPath  *path)
 | 
			
		||||
{
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
 | 
			
		||||
                       "alpha", alpha,
 | 
			
		||||
                       "path", path,
 | 
			
		||||
                       NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_path_new_with_description:
 | 
			
		||||
 * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
 | 
			
		||||
 * @desc: a string description of the path
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new path behaviour using the path described by @desc. See
 | 
			
		||||
 * clutter_path_add_string() for a description of the format.
 | 
			
		||||
 *
 | 
			
		||||
 * If @alpha is not %NULL, the #ClutterBehaviour will take ownership
 | 
			
		||||
 * of the #ClutterAlpha instance. In the case when @alpha is %NULL,
 | 
			
		||||
 * it can be set later with clutter_behaviour_set_alpha().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer full): a #ClutterBehaviour
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
ClutterBehaviour *
 | 
			
		||||
clutter_behaviour_path_new_with_description (ClutterAlpha *alpha,
 | 
			
		||||
                                             const gchar  *desc)
 | 
			
		||||
{
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
 | 
			
		||||
                       "alpha", alpha,
 | 
			
		||||
                       "path", clutter_path_new_with_description (desc),
 | 
			
		||||
                       NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_path_new_with_knots:
 | 
			
		||||
 * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
 | 
			
		||||
 * @knots: (array length=n_knots): an array of #ClutterKnot<!-- -->s
 | 
			
		||||
 * @n_knots: number of entries in @knots
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new path behaviour that will make the actors visit all of
 | 
			
		||||
 * the given knots in order with straight lines in between.
 | 
			
		||||
 *
 | 
			
		||||
 * A path will be created where the first knot is used in a
 | 
			
		||||
 * %CLUTTER_PATH_MOVE_TO and the subsequent knots are used in
 | 
			
		||||
 * %CLUTTER_PATH_LINE_TO<!-- -->s.
 | 
			
		||||
 *
 | 
			
		||||
 * If @alpha is not %NULL, the #ClutterBehaviour will take ownership
 | 
			
		||||
 * of the #ClutterAlpha instance. In the case when @alpha is %NULL,
 | 
			
		||||
 * it can be set later with clutter_behaviour_set_alpha().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer full): a #ClutterBehaviour
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
ClutterBehaviour *
 | 
			
		||||
clutter_behaviour_path_new_with_knots (ClutterAlpha      *alpha,
 | 
			
		||||
                                       const ClutterKnot *knots,
 | 
			
		||||
                                       guint              n_knots)
 | 
			
		||||
{
 | 
			
		||||
  ClutterPath *path = clutter_path_new ();
 | 
			
		||||
  guint i;
 | 
			
		||||
 | 
			
		||||
  if (n_knots > 0)
 | 
			
		||||
    {
 | 
			
		||||
      clutter_path_add_move_to (path, knots[0].x, knots[0].y);
 | 
			
		||||
 | 
			
		||||
      for (i = 1; i < n_knots; i++)
 | 
			
		||||
        clutter_path_add_line_to (path, knots[i].x, knots[i].y);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
 | 
			
		||||
                       "alpha", alpha,
 | 
			
		||||
                       "path", path,
 | 
			
		||||
                       NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_path_set_path:
 | 
			
		||||
 * @pathb: the path behaviour
 | 
			
		||||
 * @path: the new path to follow
 | 
			
		||||
 *
 | 
			
		||||
 * Change the path that the actors will follow. This will take the
 | 
			
		||||
 * floating reference on the #ClutterPath so you do not need to unref
 | 
			
		||||
 * it.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_path_set_path (ClutterBehaviourPath *pathb,
 | 
			
		||||
                                 ClutterPath          *path)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourPathPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb));
 | 
			
		||||
 | 
			
		||||
  priv = pathb->priv;
 | 
			
		||||
 | 
			
		||||
  if (path)
 | 
			
		||||
    g_object_ref_sink (path);
 | 
			
		||||
 | 
			
		||||
  if (priv->path)
 | 
			
		||||
    g_object_unref (priv->path);
 | 
			
		||||
 | 
			
		||||
  priv->path = path;
 | 
			
		||||
 | 
			
		||||
  g_object_notify_by_pspec (G_OBJECT (pathb), obj_props[PROP_PATH]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_path_get_path:
 | 
			
		||||
 * @pathb: a #ClutterBehaviourPath instance
 | 
			
		||||
 *
 | 
			
		||||
 * Get the current path of the behaviour
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): the path
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
ClutterPath *
 | 
			
		||||
clutter_behaviour_path_get_path (ClutterBehaviourPath *pathb)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_PATH (pathb), NULL);
 | 
			
		||||
 | 
			
		||||
  return pathb->priv->path;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,135 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Jorn Baayen  <jorn@openedhand.com>
 | 
			
		||||
 *             Emmanuele Bassi  <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_BEHAVIOUR_PATH_H__
 | 
			
		||||
#define __CLUTTER_BEHAVIOUR_PATH_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
#include <clutter/clutter-path.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_BEHAVIOUR_PATH (clutter_behaviour_path_get_type ())
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_PATH(obj) \
 | 
			
		||||
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPath))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_PATH_CLASS(klass) \
 | 
			
		||||
  (G_TYPE_CHECK_CLASS_CAST ((klass), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_PATH(obj) \
 | 
			
		||||
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_PATH))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_PATH_CLASS(klass) \
 | 
			
		||||
  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_PATH))
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_PATH_GET_CLASS(obj) \
 | 
			
		||||
  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
 | 
			
		||||
  CLUTTER_TYPE_BEHAVIOUR_PATH, ClutterBehaviourPathClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterBehaviourPath        ClutterBehaviourPath;
 | 
			
		||||
typedef struct _ClutterBehaviourPathPrivate ClutterBehaviourPathPrivate;
 | 
			
		||||
typedef struct _ClutterBehaviourPathClass   ClutterBehaviourPathClass;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourPath:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourPath structure contains only private data
 | 
			
		||||
 * and should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use #ClutterPathConstraint and clutter_actor_animate()
 | 
			
		||||
 *   instead.
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourPath
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviour             parent;
 | 
			
		||||
  ClutterBehaviourPathPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourPathClass:
 | 
			
		||||
 * @knot_reached: signal class handler for the
 | 
			
		||||
 *   ClutterBehaviourPath::knot_reached signal
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourPathClass struct contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourPathClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviourClass   parent_class;
 | 
			
		||||
 | 
			
		||||
  /*< public >*/
 | 
			
		||||
  void (*knot_reached) (ClutterBehaviourPath *pathb,
 | 
			
		||||
                        guint                 knot_num);
 | 
			
		||||
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  void (*_clutter_path_1) (void);
 | 
			
		||||
  void (*_clutter_path_2) (void);
 | 
			
		||||
  void (*_clutter_path_3) (void);
 | 
			
		||||
  void (*_clutter_path_4) (void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType clutter_behaviour_path_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate)
 | 
			
		||||
ClutterBehaviour *clutter_behaviour_path_new          (ClutterAlpha         *alpha,
 | 
			
		||||
                                                       ClutterPath          *path);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate)
 | 
			
		||||
ClutterBehaviour *clutter_behaviour_path_new_with_description
 | 
			
		||||
                                                      (ClutterAlpha         *alpha,
 | 
			
		||||
                                                       const gchar          *desc);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate)
 | 
			
		||||
ClutterBehaviour *clutter_behaviour_path_new_with_knots
 | 
			
		||||
                                                      (ClutterAlpha         *alpha,
 | 
			
		||||
                                                       const ClutterKnot    *knots,
 | 
			
		||||
                                                       guint                 n_knots);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_behaviour_path_set_path     (ClutterBehaviourPath *pathb,
 | 
			
		||||
                                                       ClutterPath          *path);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterPath *     clutter_behaviour_path_get_path     (ClutterBehaviourPath *pathb);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_BEHAVIOUR_PATH_H__ */
 | 
			
		||||
@@ -1,688 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2007 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:clutter-behaviour-rotate
 | 
			
		||||
 * @short_description: A behaviour controlling rotation
 | 
			
		||||
 *
 | 
			
		||||
 * A #ClutterBehaviourRotate rotate actors between a starting and ending
 | 
			
		||||
 * angle on a given axis.
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourRotate is available since version 0.4.
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use the #ClutterActor rotation properties and
 | 
			
		||||
 *   clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
 | 
			
		||||
 *   instead.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
#include "deprecated/clutter-actor.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-alpha.h"
 | 
			
		||||
#include "clutter-behaviour.h"
 | 
			
		||||
#include "clutter-behaviour-rotate.h"
 | 
			
		||||
#include "clutter-debug.h"
 | 
			
		||||
#include "clutter-enum-types.h"
 | 
			
		||||
#include "clutter-main.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
struct _ClutterBehaviourRotatePrivate
 | 
			
		||||
{
 | 
			
		||||
  gdouble angle_start;
 | 
			
		||||
  gdouble angle_end;
 | 
			
		||||
 | 
			
		||||
  ClutterRotateAxis axis;
 | 
			
		||||
  ClutterRotateDirection direction;
 | 
			
		||||
 | 
			
		||||
  gint center_x;
 | 
			
		||||
  gint center_y;
 | 
			
		||||
  gint center_z;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
 | 
			
		||||
  PROP_ANGLE_START,
 | 
			
		||||
  PROP_ANGLE_END,
 | 
			
		||||
  PROP_AXIS,
 | 
			
		||||
  PROP_DIRECTION,
 | 
			
		||||
  PROP_CENTER_X,
 | 
			
		||||
  PROP_CENTER_Y,
 | 
			
		||||
  PROP_CENTER_Z,
 | 
			
		||||
 | 
			
		||||
  PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST];
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourRotate,
 | 
			
		||||
                            clutter_behaviour_rotate,
 | 
			
		||||
                            CLUTTER_TYPE_BEHAVIOUR)
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  gdouble angle;
 | 
			
		||||
} RotateFrameClosure;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
alpha_notify_foreach (ClutterBehaviour *behaviour,
 | 
			
		||||
		      ClutterActor     *actor,
 | 
			
		||||
		      gpointer          data)
 | 
			
		||||
{
 | 
			
		||||
  RotateFrameClosure *closure = data;
 | 
			
		||||
  ClutterBehaviourRotate *rotate_behaviour;
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
 | 
			
		||||
  priv = rotate_behaviour->priv;
 | 
			
		||||
 | 
			
		||||
  clutter_actor_set_rotation (actor, priv->axis,
 | 
			
		||||
                              closure->angle,
 | 
			
		||||
                              priv->center_x,
 | 
			
		||||
                              priv->center_y,
 | 
			
		||||
                              priv->center_z);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline float
 | 
			
		||||
clamp_angle (float a)
 | 
			
		||||
{
 | 
			
		||||
  float a1, a2;
 | 
			
		||||
  gint rounds;
 | 
			
		||||
 | 
			
		||||
  rounds = a / 360.0;
 | 
			
		||||
  a1 = rounds * 360.0;
 | 
			
		||||
  a2 = a - a1;
 | 
			
		||||
 | 
			
		||||
  return a2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
 | 
			
		||||
                                       gdouble           alpha_value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotate *rotate_behaviour;
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
  RotateFrameClosure closure;
 | 
			
		||||
  gdouble start, end;
 | 
			
		||||
 | 
			
		||||
  rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
 | 
			
		||||
  priv = rotate_behaviour->priv;
 | 
			
		||||
 | 
			
		||||
  closure.angle = 0;
 | 
			
		||||
  start         = priv->angle_start;
 | 
			
		||||
  end           = priv->angle_end;
 | 
			
		||||
 | 
			
		||||
  if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
 | 
			
		||||
    end += 360.0;
 | 
			
		||||
  else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
 | 
			
		||||
    end -= 360.0;
 | 
			
		||||
 | 
			
		||||
  closure.angle = (end - start) * alpha_value + start;
 | 
			
		||||
 | 
			
		||||
  clutter_behaviour_actors_foreach (behaviour,
 | 
			
		||||
				    alpha_notify_foreach,
 | 
			
		||||
				    &closure);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_rotate_set_property (GObject      *gobject,
 | 
			
		||||
                                       guint         prop_id,
 | 
			
		||||
                                       const GValue *value,
 | 
			
		||||
                                       GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotate *rotate;
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  rotate = CLUTTER_BEHAVIOUR_ROTATE (gobject);
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_ANGLE_START:
 | 
			
		||||
      priv->angle_start = g_value_get_double (value);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_ANGLE_END:
 | 
			
		||||
      priv->angle_end = g_value_get_double (value);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_AXIS:
 | 
			
		||||
      priv->axis = g_value_get_enum (value);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_DIRECTION:
 | 
			
		||||
      priv->direction = g_value_get_enum (value);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_X:
 | 
			
		||||
      clutter_behaviour_rotate_set_center (rotate,
 | 
			
		||||
					   g_value_get_int (value),
 | 
			
		||||
					   priv->center_y,
 | 
			
		||||
					   priv->center_z);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_Y:
 | 
			
		||||
      clutter_behaviour_rotate_set_center (rotate,
 | 
			
		||||
					   priv->center_x,
 | 
			
		||||
					   g_value_get_int (value),
 | 
			
		||||
					   priv->center_z);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_Z:
 | 
			
		||||
      clutter_behaviour_rotate_set_center (rotate,
 | 
			
		||||
					   priv->center_x,
 | 
			
		||||
					   priv->center_y,
 | 
			
		||||
					   g_value_get_int (value));
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_rotate_get_property (GObject    *gobject,
 | 
			
		||||
                                       guint       prop_id,
 | 
			
		||||
                                       GValue     *value,
 | 
			
		||||
                                       GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  priv = CLUTTER_BEHAVIOUR_ROTATE (gobject)->priv;
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_ANGLE_START:
 | 
			
		||||
      g_value_set_double (value, priv->angle_start);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_ANGLE_END:
 | 
			
		||||
      g_value_set_double (value, priv->angle_end);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_AXIS:
 | 
			
		||||
      g_value_set_enum (value, priv->axis);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_DIRECTION:
 | 
			
		||||
      g_value_set_enum (value, priv->direction);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_X:
 | 
			
		||||
      g_value_set_int (value, priv->center_x);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_Y:
 | 
			
		||||
      g_value_set_int (value, priv->center_y);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case PROP_CENTER_Z:
 | 
			
		||||
      g_value_set_int (value, priv->center_z);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
  ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
 | 
			
		||||
  GParamSpec *pspec = NULL;
 | 
			
		||||
 | 
			
		||||
  gobject_class->set_property = clutter_behaviour_rotate_set_property;
 | 
			
		||||
  gobject_class->get_property = clutter_behaviour_rotate_get_property;
 | 
			
		||||
 | 
			
		||||
  behaviour_class->alpha_notify = clutter_behaviour_rotate_alpha_notify;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:angle-start:
 | 
			
		||||
   *
 | 
			
		||||
   * The initial angle from whence the rotation should start.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_double ("angle-start",
 | 
			
		||||
                               P_("Angle Begin"),
 | 
			
		||||
                               P_("Initial angle"),
 | 
			
		||||
                               0.0, 360.0,
 | 
			
		||||
                               0.0,
 | 
			
		||||
                               CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_ANGLE_START] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_ANGLE_START,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:angle-end:
 | 
			
		||||
   *
 | 
			
		||||
   * The final angle to where the rotation should end.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_double ("angle-end",
 | 
			
		||||
                               P_("Angle End"),
 | 
			
		||||
                               P_("Final angle"),
 | 
			
		||||
                               0.0, 360.0,
 | 
			
		||||
                               0.0,
 | 
			
		||||
                               CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_ANGLE_END] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_ANGLE_END,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:axis:
 | 
			
		||||
   *
 | 
			
		||||
   * The axis of rotation.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_enum ("axis",
 | 
			
		||||
                             P_("Axis"),
 | 
			
		||||
                             P_("Axis of rotation"),
 | 
			
		||||
                             CLUTTER_TYPE_ROTATE_AXIS,
 | 
			
		||||
                             CLUTTER_Z_AXIS,
 | 
			
		||||
                             CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_AXIS] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_AXIS,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:direction:
 | 
			
		||||
   *
 | 
			
		||||
   * The direction of the rotation.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_enum ("direction",
 | 
			
		||||
                             P_("Direction"),
 | 
			
		||||
                             P_("Direction of rotation"),
 | 
			
		||||
                             CLUTTER_TYPE_ROTATE_DIRECTION,
 | 
			
		||||
                             CLUTTER_ROTATE_CW,
 | 
			
		||||
                             CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_DIRECTION] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_DIRECTION,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:center-x:
 | 
			
		||||
   *
 | 
			
		||||
   * The x center of rotation.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_int ("center-x",
 | 
			
		||||
                            P_("Center X"),
 | 
			
		||||
                            P_("X coordinate of the center of rotation"),
 | 
			
		||||
                            -G_MAXINT, G_MAXINT,
 | 
			
		||||
                            0,
 | 
			
		||||
                            CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_CENTER_X] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_CENTER_X,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:center-y:
 | 
			
		||||
   *
 | 
			
		||||
   * The y center of rotation.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_int ("center-y",
 | 
			
		||||
                            P_("Center Y"),
 | 
			
		||||
                            P_("Y coordinate of the center of rotation"),
 | 
			
		||||
                            -G_MAXINT, G_MAXINT,
 | 
			
		||||
                            0,
 | 
			
		||||
                            CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_CENTER_Y] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_CENTER_Y,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterBehaviourRotate:center-z:
 | 
			
		||||
   *
 | 
			
		||||
   * The z center of rotation.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.4
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_int ("center-z",
 | 
			
		||||
                            P_("Center Z"),
 | 
			
		||||
                            P_("Z coordinate of the center of rotation"),
 | 
			
		||||
                            -G_MAXINT, G_MAXINT,
 | 
			
		||||
                            0,
 | 
			
		||||
                            CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_CENTER_Z] = pspec;
 | 
			
		||||
  g_object_class_install_property (gobject_class,
 | 
			
		||||
                                   PROP_CENTER_Z,
 | 
			
		||||
                                   pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_behaviour_rotate_init (ClutterBehaviourRotate *self)
 | 
			
		||||
{
 | 
			
		||||
  self->priv = clutter_behaviour_rotate_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
  self->priv->angle_start = 0.0;
 | 
			
		||||
  self->priv->angle_end = 0.0;
 | 
			
		||||
 | 
			
		||||
  self->priv->axis = CLUTTER_Z_AXIS;
 | 
			
		||||
  self->priv->direction = CLUTTER_ROTATE_CW;
 | 
			
		||||
 | 
			
		||||
  self->priv->center_x = 0;
 | 
			
		||||
  self->priv->center_y = 0;
 | 
			
		||||
  self->priv->center_z = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_new:
 | 
			
		||||
 * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
 | 
			
		||||
 * @axis: the rotation axis
 | 
			
		||||
 * @direction: the rotation direction
 | 
			
		||||
 * @angle_start: the starting angle in degrees, between 0 and 360.
 | 
			
		||||
 * @angle_end: the final angle in degrees, between 0 and 360.
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new #ClutterBehaviourRotate. This behaviour will rotate actors
 | 
			
		||||
 * bound to it on @axis, following @direction, between @angle_start and
 | 
			
		||||
 * @angle_end. Angles >= 360 degrees will be clamped to the canonical interval
 | 
			
		||||
 * <0, 360), if angle_start == angle_end, the behaviour will carry out a
 | 
			
		||||
 * single rotation of 360 degrees.
 | 
			
		||||
 *
 | 
			
		||||
 * If @alpha is not %NULL, the #ClutterBehaviour will take ownership
 | 
			
		||||
 * of the #ClutterAlpha instance. In the case when @alpha is %NULL,
 | 
			
		||||
 * it can be set later with clutter_behaviour_set_alpha().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the newly created #ClutterBehaviourRotate.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
ClutterBehaviour *
 | 
			
		||||
clutter_behaviour_rotate_new (ClutterAlpha           *alpha,
 | 
			
		||||
                              ClutterRotateAxis       axis,
 | 
			
		||||
                              ClutterRotateDirection  direction,
 | 
			
		||||
                              gdouble                 angle_start,
 | 
			
		||||
                              gdouble                 angle_end)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
 | 
			
		||||
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_BEHAVIOUR_ROTATE,
 | 
			
		||||
                       "alpha", alpha,
 | 
			
		||||
                       "axis", axis,
 | 
			
		||||
                       "direction", direction,
 | 
			
		||||
                       "angle-start", angle_start,
 | 
			
		||||
                       "angle-end", angle_end,
 | 
			
		||||
                       NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_get_axis:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the #ClutterRotateAxis used by the rotate behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the rotation axis
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
ClutterRotateAxis
 | 
			
		||||
clutter_behaviour_rotate_get_axis (ClutterBehaviourRotate *rotate)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate), CLUTTER_Z_AXIS);
 | 
			
		||||
 | 
			
		||||
  return rotate->priv->axis;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_set_axis:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @axis: a #ClutterRotateAxis
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the axis used by the rotate behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_set_axis (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                   ClutterRotateAxis       axis)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->axis != axis)
 | 
			
		||||
    {
 | 
			
		||||
      priv->axis = axis;
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_AXIS]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_get_direction:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the #ClutterRotateDirection used by the rotate behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the rotation direction
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
ClutterRotateDirection
 | 
			
		||||
clutter_behaviour_rotate_get_direction (ClutterBehaviourRotate *rotate)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate),
 | 
			
		||||
                        CLUTTER_ROTATE_CW);
 | 
			
		||||
 | 
			
		||||
  return rotate->priv->direction;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_set_direction:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @direction: the rotation direction
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the rotation direction used by the rotate behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                        ClutterRotateDirection  direction)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->direction != direction)
 | 
			
		||||
    {
 | 
			
		||||
      priv->direction = direction;
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_DIRECTION]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_get_bounds:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @angle_start: (out): return value for the initial angle
 | 
			
		||||
 * @angle_end: (out): return value for the final angle
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the rotation boundaries of the rotate behaviour.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_get_bounds (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                     gdouble                *angle_start,
 | 
			
		||||
                                     gdouble                *angle_end)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  if (angle_start)
 | 
			
		||||
    *angle_start = priv->angle_start;
 | 
			
		||||
 | 
			
		||||
  if (angle_end)
 | 
			
		||||
    *angle_end = priv->angle_end;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_set_bounds:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @angle_start: initial angle in degrees, between 0 and 360.
 | 
			
		||||
 * @angle_end: final angle in degrees, between 0 and 360.
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the initial and final angles of a rotation behaviour; angles >= 360
 | 
			
		||||
 * degrees get clamped to the canonical interval <0, 360).
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                     gdouble                 angle_start,
 | 
			
		||||
                                     gdouble                 angle_end)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  g_object_freeze_notify (G_OBJECT (rotate));
 | 
			
		||||
 | 
			
		||||
  if (priv->angle_start != angle_start)
 | 
			
		||||
    {
 | 
			
		||||
      priv->angle_start = clamp_angle (angle_start);
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_START]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->angle_end != angle_end)
 | 
			
		||||
    {
 | 
			
		||||
      priv->angle_end = clamp_angle (angle_end);
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_END]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_object_thaw_notify (G_OBJECT (rotate));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_set_center:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @x: X axis center of rotation
 | 
			
		||||
 * @y: Y axis center of rotation
 | 
			
		||||
 * @z: Z axis center of rotation
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the center of rotation. The coordinates are relative to the plane
 | 
			
		||||
 * normal to the rotation axis set with clutter_behaviour_rotate_set_axis().
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_set_center (ClutterBehaviourRotate *rotate,
 | 
			
		||||
				     gint                    x,
 | 
			
		||||
				     gint                    y,
 | 
			
		||||
				     gint                    z)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  g_object_freeze_notify (G_OBJECT (rotate));
 | 
			
		||||
 | 
			
		||||
  if (priv->center_x != x)
 | 
			
		||||
    {
 | 
			
		||||
      priv->center_x = x;
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_X]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->center_y != y)
 | 
			
		||||
    {
 | 
			
		||||
      priv->center_y = y;
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Y]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->center_z != z)
 | 
			
		||||
    {
 | 
			
		||||
      priv->center_z = z;
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Z]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_object_thaw_notify (G_OBJECT (rotate));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_behaviour_rotate_get_center:
 | 
			
		||||
 * @rotate: a #ClutterBehaviourRotate
 | 
			
		||||
 * @x: (out): return location for the X center of rotation
 | 
			
		||||
 * @y: (out): return location for the Y center of rotation
 | 
			
		||||
 * @z: (out): return location for the Z center of rotation
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the center of rotation set using
 | 
			
		||||
 * clutter_behaviour_rotate_set_center().
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_behaviour_rotate_get_center (ClutterBehaviourRotate *rotate,
 | 
			
		||||
				     gint                   *x,
 | 
			
		||||
				     gint                   *y,
 | 
			
		||||
				     gint                   *z)
 | 
			
		||||
{
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
 | 
			
		||||
 | 
			
		||||
  priv = rotate->priv;
 | 
			
		||||
 | 
			
		||||
  if (x)
 | 
			
		||||
    *x = priv->center_x;
 | 
			
		||||
 | 
			
		||||
  if (y)
 | 
			
		||||
    *y = priv->center_y;
 | 
			
		||||
 | 
			
		||||
  if (z)
 | 
			
		||||
    *z = priv->center_z;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,119 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2007 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_BEHAVIOUR_ROTATE_H__
 | 
			
		||||
#define __CLUTTER_BEHAVIOUR_ROTATE_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_BEHAVIOUR_ROTATE            (clutter_behaviour_rotate_get_type ())
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ROTATE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotate))
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_ROTATE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_ROTATE))
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ROTATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass))
 | 
			
		||||
#define CLUTTER_IS_BEHAVIOUR_ROTATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE))
 | 
			
		||||
#define CLUTTER_BEHAVIOUR_ROTATE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterBehaviourRotate          ClutterBehaviourRotate;
 | 
			
		||||
typedef struct _ClutterBehaviourRotatePrivate   ClutterBehaviourRotatePrivate;
 | 
			
		||||
typedef struct _ClutterBehaviourRotateClass     ClutterBehaviourRotateClass;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourRotate:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourRotate struct contains only private data and
 | 
			
		||||
 * should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use clutter_actor_animate() instead.
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourRotate
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviour parent_instance;
 | 
			
		||||
 | 
			
		||||
  ClutterBehaviourRotatePrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterBehaviourRotateClass:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterBehaviourRotateClass struct contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterBehaviourRotateClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterBehaviourClass parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType clutter_behaviour_rotate_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate)
 | 
			
		||||
ClutterBehaviour *     clutter_behaviour_rotate_new           (ClutterAlpha           *alpha,
 | 
			
		||||
                                                               ClutterRotateAxis       axis,
 | 
			
		||||
                                                               ClutterRotateDirection  direction,
 | 
			
		||||
                                                               gdouble                 angle_start,
 | 
			
		||||
                                                               gdouble                 angle_end);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_get_center    (ClutterBehaviourRotate *rotate,
 | 
			
		||||
							       gint                   *x,
 | 
			
		||||
							       gint                   *y,
 | 
			
		||||
							       gint                   *z);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_set_center    (ClutterBehaviourRotate *rotate,
 | 
			
		||||
							       gint                    x,
 | 
			
		||||
							       gint                    y,
 | 
			
		||||
							       gint                    z);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterRotateAxis      clutter_behaviour_rotate_get_axis      (ClutterBehaviourRotate *rotate);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_set_axis      (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                                               ClutterRotateAxis       axis);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterRotateDirection clutter_behaviour_rotate_get_direction (ClutterBehaviourRotate *rotate);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                                               ClutterRotateDirection  direction);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_get_bounds    (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                                               gdouble                *angle_start,
 | 
			
		||||
                                                               gdouble                *angle_end);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                   clutter_behaviour_rotate_set_bounds    (ClutterBehaviourRotate *rotate,
 | 
			
		||||
                                                               gdouble                 angle_start,
 | 
			
		||||
                                                               gdouble                 angle_end);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_BEHAVIOUR_ROTATE_H__ */
 | 
			
		||||
@@ -101,7 +101,8 @@ enum
 | 
			
		||||
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST];
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  APPLIED,
 | 
			
		||||
  REMOVED,
 | 
			
		||||
  LAST_SIGNAL
 | 
			
		||||
 
 | 
			
		||||
@@ -1,261 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Neil Roberts  <neil@linux.intel.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2008 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
 | 
			
		||||
#include "clutter-main.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
#include "deprecated/clutter-frame-source.h"
 | 
			
		||||
#include "deprecated/clutter-timeout-interval.h"
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterFrameSource ClutterFrameSource;
 | 
			
		||||
 | 
			
		||||
struct _ClutterFrameSource
 | 
			
		||||
{
 | 
			
		||||
  GSource source;
 | 
			
		||||
 | 
			
		||||
  ClutterTimeoutInterval timeout;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static gboolean clutter_frame_source_prepare  (GSource     *source,
 | 
			
		||||
                                               gint        *timeout);
 | 
			
		||||
static gboolean clutter_frame_source_check    (GSource     *source);
 | 
			
		||||
static gboolean clutter_frame_source_dispatch (GSource     *source,
 | 
			
		||||
                                               GSourceFunc  callback,
 | 
			
		||||
                                               gpointer     user_data);
 | 
			
		||||
 | 
			
		||||
static GSourceFuncs clutter_frame_source_funcs =
 | 
			
		||||
{
 | 
			
		||||
  clutter_frame_source_prepare,
 | 
			
		||||
  clutter_frame_source_check,
 | 
			
		||||
  clutter_frame_source_dispatch,
 | 
			
		||||
  NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_frame_source_add_full: (rename-to clutter_frame_source_add)
 | 
			
		||||
 * @priority: the priority of the frame source. Typically this will be in the
 | 
			
		||||
 *   range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
 | 
			
		||||
 * @fps: the number of times per second to call the function
 | 
			
		||||
 * @func: function to call
 | 
			
		||||
 * @data: data to pass to the function
 | 
			
		||||
 * @notify: function to call when the timeout source is removed
 | 
			
		||||
 *
 | 
			
		||||
 * Sets a function to be called at regular intervals with the given
 | 
			
		||||
 * priority.  The function is called repeatedly until it returns
 | 
			
		||||
 * %FALSE, at which point the timeout is automatically destroyed and
 | 
			
		||||
 * the function will not be called again.  The @notify function is
 | 
			
		||||
 * called when the timeout is destroyed.  The first call to the
 | 
			
		||||
 * function will be at the end of the first @interval.
 | 
			
		||||
 *
 | 
			
		||||
 * This function is similar to g_timeout_add_full() except that it
 | 
			
		||||
 * will try to compensate for delays. For example, if @func takes half
 | 
			
		||||
 * the interval time to execute then the function will be called again
 | 
			
		||||
 * half the interval time after it finished. In contrast
 | 
			
		||||
 * g_timeout_add_full() would not fire until a full interval after the
 | 
			
		||||
 * function completes so the delay between calls would be 1.0 / @fps *
 | 
			
		||||
 * 1.5. This function does not however try to invoke the function
 | 
			
		||||
 * multiple times to catch up missing frames if @func takes more than
 | 
			
		||||
 * @interval ms to execute.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the ID (greater than 0) of the event source.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API.
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_frame_source_add_full (gint           priority,
 | 
			
		||||
			       guint          fps,
 | 
			
		||||
			       GSourceFunc    func,
 | 
			
		||||
			       gpointer       data,
 | 
			
		||||
			       GDestroyNotify notify)
 | 
			
		||||
{
 | 
			
		||||
  guint ret;
 | 
			
		||||
  GSource *source = g_source_new (&clutter_frame_source_funcs,
 | 
			
		||||
				  sizeof (ClutterFrameSource));
 | 
			
		||||
  ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
 | 
			
		||||
 | 
			
		||||
  _clutter_timeout_interval_init (&frame_source->timeout, fps);
 | 
			
		||||
 | 
			
		||||
  if (priority != G_PRIORITY_DEFAULT)
 | 
			
		||||
    g_source_set_priority (source, priority);
 | 
			
		||||
 | 
			
		||||
  g_source_set_name (source, "Clutter frame timeout");
 | 
			
		||||
  g_source_set_callback (source, func, data, notify);
 | 
			
		||||
 | 
			
		||||
  ret = g_source_attach (source, NULL);
 | 
			
		||||
 | 
			
		||||
  g_source_unref (source);
 | 
			
		||||
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_frame_source_add: (skip)
 | 
			
		||||
 * @fps: the number of times per second to call the function
 | 
			
		||||
 * @func: function to call
 | 
			
		||||
 * @data: data to pass to the function
 | 
			
		||||
 *
 | 
			
		||||
 * Simple wrapper around clutter_frame_source_add_full().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the ID (greater than 0) of the event source.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_frame_source_add (guint          fps,
 | 
			
		||||
			  GSourceFunc    func,
 | 
			
		||||
			  gpointer       data)
 | 
			
		||||
{
 | 
			
		||||
  return clutter_frame_source_add_full (G_PRIORITY_DEFAULT,
 | 
			
		||||
					fps, func, data, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_frame_source_prepare (GSource *source,
 | 
			
		||||
                              gint    *delay)
 | 
			
		||||
{
 | 
			
		||||
  ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
 | 
			
		||||
  gint64 current_time;
 | 
			
		||||
 | 
			
		||||
#if GLIB_CHECK_VERSION (2, 27, 3)
 | 
			
		||||
  current_time = g_source_get_time (source) / 1000;
 | 
			
		||||
#else
 | 
			
		||||
  {
 | 
			
		||||
    GTimeVal source_time;
 | 
			
		||||
    g_source_get_current_time (source, &source_time);
 | 
			
		||||
    current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  return _clutter_timeout_interval_prepare (current_time,
 | 
			
		||||
                                            &frame_source->timeout,
 | 
			
		||||
                                            delay);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_frame_source_check (GSource *source)
 | 
			
		||||
{
 | 
			
		||||
  return clutter_frame_source_prepare (source, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_frame_source_dispatch (GSource     *source,
 | 
			
		||||
			       GSourceFunc  callback,
 | 
			
		||||
			       gpointer     user_data)
 | 
			
		||||
{
 | 
			
		||||
  ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
 | 
			
		||||
 | 
			
		||||
  return _clutter_timeout_interval_dispatch (&frame_source->timeout,
 | 
			
		||||
                                             callback, user_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_threads_add_frame_source_full: (rename-to clutter_threads_add_frame_source)
 | 
			
		||||
 * @priority: the priority of the frame source. Typically this will be in the
 | 
			
		||||
 *   range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
 | 
			
		||||
 * @fps: the number of times per second to call the function
 | 
			
		||||
 * @func: function to call
 | 
			
		||||
 * @data: data to pass to the function
 | 
			
		||||
 * @notify: function to call when the timeout source is removed
 | 
			
		||||
 *
 | 
			
		||||
 * Sets a function to be called at regular intervals holding the Clutter
 | 
			
		||||
 * threads lock, with the given priority. The function is called repeatedly
 | 
			
		||||
 * until it returns %FALSE, at which point the timeout is automatically
 | 
			
		||||
 * removed and the function will not be called again. The @notify function
 | 
			
		||||
 * is called when the timeout is removed.
 | 
			
		||||
 *
 | 
			
		||||
 * This function is similar to clutter_threads_add_timeout_full()
 | 
			
		||||
 * except that it will try to compensate for delays. For example, if
 | 
			
		||||
 * @func takes half the interval time to execute then the function
 | 
			
		||||
 * will be called again half the interval time after it finished. In
 | 
			
		||||
 * contrast clutter_threads_add_timeout_full() would not fire until a
 | 
			
		||||
 * full interval after the function completes so the delay between
 | 
			
		||||
 * calls would be @interval * 1.5. This function does not however try
 | 
			
		||||
 * to invoke the function multiple times to catch up missing frames if
 | 
			
		||||
 * @func takes more than @interval ms to execute.
 | 
			
		||||
 *
 | 
			
		||||
 * See also clutter_threads_add_idle_full().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the ID (greater than 0) of the event source.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_threads_add_frame_source_full (gint           priority,
 | 
			
		||||
                                       guint          fps,
 | 
			
		||||
                                       GSourceFunc    func,
 | 
			
		||||
                                       gpointer       data,
 | 
			
		||||
                                       GDestroyNotify notify)
 | 
			
		||||
{
 | 
			
		||||
  ClutterThreadsDispatch *dispatch;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (func != NULL, 0);
 | 
			
		||||
 | 
			
		||||
  dispatch = g_slice_new (ClutterThreadsDispatch);
 | 
			
		||||
  dispatch->func = func;
 | 
			
		||||
  dispatch->data = data;
 | 
			
		||||
  dispatch->notify = notify;
 | 
			
		||||
 | 
			
		||||
  return clutter_frame_source_add_full (priority,
 | 
			
		||||
                                        fps,
 | 
			
		||||
                                        _clutter_threads_dispatch, dispatch,
 | 
			
		||||
                                        _clutter_threads_dispatch_free);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_threads_add_frame_source: (skip)
 | 
			
		||||
 * @fps: the number of times per second to call the function
 | 
			
		||||
 * @func: function to call
 | 
			
		||||
 * @data: data to pass to the function
 | 
			
		||||
 *
 | 
			
		||||
 * Simple wrapper around clutter_threads_add_frame_source_full().
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the ID (greater than 0) of the event source.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_threads_add_frame_source (guint       fps,
 | 
			
		||||
                                  GSourceFunc func,
 | 
			
		||||
                                  gpointer    data)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (func != NULL, 0);
 | 
			
		||||
 | 
			
		||||
  return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
 | 
			
		||||
                                                fps,
 | 
			
		||||
                                                func, data,
 | 
			
		||||
                                                NULL);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2008 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_FRAME_SOURCE_H__
 | 
			
		||||
#define __CLUTTER_FRAME_SOURCE_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint clutter_frame_source_add (guint          fps,
 | 
			
		||||
				GSourceFunc    func,
 | 
			
		||||
				gpointer       data);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint clutter_frame_source_add_full (gint           priority,
 | 
			
		||||
				     guint          fps,
 | 
			
		||||
				     GSourceFunc    func,
 | 
			
		||||
				     gpointer       data,
 | 
			
		||||
				     GDestroyNotify notify);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_FRAME_SOURCE_H__ */
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
 | 
			
		||||
#include "clutter-device-manager-private.h"
 | 
			
		||||
#include "deprecated/clutter-input-device.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_input_device_get_device_coords:
 | 
			
		||||
 * @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
 | 
			
		||||
 * @x: (out): return location for the X coordinate
 | 
			
		||||
 * @y: (out): return location for the Y coordinate
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the latest coordinates of the pointer of @device
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.2
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.12: Use clutter_input_device_get_coords() instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_input_device_get_device_coords (ClutterInputDevice *device,
 | 
			
		||||
                                        gint               *x,
 | 
			
		||||
                                        gint               *y)
 | 
			
		||||
{
 | 
			
		||||
  ClutterPoint point;
 | 
			
		||||
 | 
			
		||||
  clutter_input_device_get_coords (device, NULL, &point);
 | 
			
		||||
 | 
			
		||||
  if (x)
 | 
			
		||||
    *x = point.x;
 | 
			
		||||
 | 
			
		||||
  if (y)
 | 
			
		||||
    *y = point.y;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright © 2009, 2010, 2011  Intel Corp.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Emmanuele Bassi <ebassi@linux.intel.com>
 | 
			
		||||
 */
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_INPUT_DEVICE_DEPRECATED_H__
 | 
			
		||||
#define __CLUTTER_INPUT_DEVICE_DEPRECATED_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-input-device.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_get_coords)
 | 
			
		||||
void clutter_input_device_get_device_coords  (ClutterInputDevice  *device,
 | 
			
		||||
                                              gint                *x,
 | 
			
		||||
                                              gint                *y);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_INPUT_DEVICE_DEPRECATED_H__ */
 | 
			
		||||
@@ -1,834 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Neil Jagdish Patel <njp@o-hand.com>
 | 
			
		||||
 *             Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:clutter-list-model
 | 
			
		||||
 * @short_description: List model implementation
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterListModel is a #ClutterModel implementation provided by
 | 
			
		||||
 * Clutter. #ClutterListModel uses a #GSequence for storing the
 | 
			
		||||
 * values for each row, so it's optimized for insertion and look up
 | 
			
		||||
 * in sorted lists.
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterListModel is available since Clutter 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use a #GListStore instance containing a custom
 | 
			
		||||
 *   object type with properties for each column instead.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
#include "clutter-list-model.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-model.h"
 | 
			
		||||
#include "clutter-model-private.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
#include "clutter-debug.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_LIST_MODEL_ITER                 \
 | 
			
		||||
        (clutter_list_model_iter_get_type())
 | 
			
		||||
#define CLUTTER_LIST_MODEL_ITER(obj)                 \
 | 
			
		||||
        (G_TYPE_CHECK_INSTANCE_CAST((obj),           \
 | 
			
		||||
         CLUTTER_TYPE_LIST_MODEL_ITER,               \
 | 
			
		||||
         ClutterListModelIter))
 | 
			
		||||
#define CLUTTER_IS_LIST_MODEL_ITER(obj)              \
 | 
			
		||||
        (G_TYPE_CHECK_INSTANCE_TYPE((obj),           \
 | 
			
		||||
         CLUTTER_TYPE_LIST_MODEL_ITER))
 | 
			
		||||
#define CLUTTER_LIST_MODEL_ITER_CLASS(klass)         \
 | 
			
		||||
        (G_TYPE_CHECK_CLASS_CAST ((klass),           \
 | 
			
		||||
         CLUTTER_TYPE_LIST_MODEL_ITER,               \
 | 
			
		||||
         ClutterListModelIterClass))
 | 
			
		||||
#define CLUTTER_IS_LIST_MODEL_ITER_CLASS(klass)      \
 | 
			
		||||
        (G_TYPE_CHECK_CLASS_TYPE ((klass),           \
 | 
			
		||||
         CLUTTER_TYPE_LIST_MODEL_ITER))
 | 
			
		||||
#define CLUTTER_LIST_MODEL_ITER_GET_CLASS(obj)       \
 | 
			
		||||
        (G_TYPE_INSTANCE_GET_CLASS ((obj),           \
 | 
			
		||||
         CLUTTER_TYPE_LIST_MODEL_ITER,               \
 | 
			
		||||
         ClutterListModelIterClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterListModelIter    ClutterListModelIter;
 | 
			
		||||
typedef struct _ClutterModelIterClass   ClutterListModelIterClass;
 | 
			
		||||
 | 
			
		||||
struct _ClutterListModelPrivate
 | 
			
		||||
{
 | 
			
		||||
  GSequence *sequence;
 | 
			
		||||
 | 
			
		||||
  ClutterModelIter *temp_iter;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _ClutterListModelIter
 | 
			
		||||
{
 | 
			
		||||
  ClutterModelIter parent_instance;
 | 
			
		||||
 | 
			
		||||
  GSequenceIter *seq_iter;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GType clutter_list_model_iter_get_type (void);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ClutterListModel
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE (ClutterListModelIter,
 | 
			
		||||
               clutter_list_model_iter,
 | 
			
		||||
               CLUTTER_TYPE_MODEL_ITER)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_iter_get_value (ClutterModelIter *iter,
 | 
			
		||||
                                   guint             column,
 | 
			
		||||
                                   GValue           *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  GValue *values;
 | 
			
		||||
  GValue *iter_value;
 | 
			
		||||
  GValue real_value = G_VALUE_INIT;
 | 
			
		||||
  gboolean converted = FALSE;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  values = g_sequence_get (iter_default->seq_iter);
 | 
			
		||||
  iter_value = &values[column];
 | 
			
		||||
  g_assert (iter_value != NULL);
 | 
			
		||||
 | 
			
		||||
  if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
 | 
			
		||||
    {
 | 
			
		||||
      if (!g_value_type_compatible (G_VALUE_TYPE (value), 
 | 
			
		||||
                                    G_VALUE_TYPE (iter_value)) &&
 | 
			
		||||
          !g_value_type_compatible (G_VALUE_TYPE (iter_value), 
 | 
			
		||||
                                    G_VALUE_TYPE (value)))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Unable to convert from %s to %s",
 | 
			
		||||
                     G_STRLOC,
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (value)),
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (iter_value)));
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      if (!g_value_transform (iter_value, &real_value))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Unable to make conversion from %s to %s",
 | 
			
		||||
                     G_STRLOC, 
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (value)),
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (iter_value)));
 | 
			
		||||
          g_value_unset (&real_value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      converted = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  
 | 
			
		||||
  if (converted)
 | 
			
		||||
    {
 | 
			
		||||
      g_value_copy (&real_value, value);
 | 
			
		||||
      g_value_unset (&real_value);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    g_value_copy (iter_value, value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_iter_set_value (ClutterModelIter *iter,
 | 
			
		||||
                                   guint             column,
 | 
			
		||||
                                   const GValue     *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  GValue *values;
 | 
			
		||||
  GValue *iter_value;
 | 
			
		||||
  GValue real_value = G_VALUE_INIT;
 | 
			
		||||
  gboolean converted = FALSE;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  values = g_sequence_get (iter_default->seq_iter);
 | 
			
		||||
  iter_value = &values[column];
 | 
			
		||||
  g_assert (iter_value != NULL);
 | 
			
		||||
 | 
			
		||||
  if (!g_type_is_a (G_VALUE_TYPE (value), G_VALUE_TYPE (iter_value)))
 | 
			
		||||
    {
 | 
			
		||||
      if (!g_value_type_compatible (G_VALUE_TYPE (value), 
 | 
			
		||||
                                    G_VALUE_TYPE (iter_value)) &&
 | 
			
		||||
          !g_value_type_compatible (G_VALUE_TYPE (iter_value), 
 | 
			
		||||
                                    G_VALUE_TYPE (value)))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Unable to convert from %s to %s\n",
 | 
			
		||||
                     G_STRLOC,
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (value)),
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (iter_value)));
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      if (!g_value_transform (value, &real_value))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Unable to make conversion from %s to %s\n",
 | 
			
		||||
                     G_STRLOC, 
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (value)),
 | 
			
		||||
                     g_type_name (G_VALUE_TYPE (iter_value)));
 | 
			
		||||
          g_value_unset (&real_value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      converted = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
  if (converted)
 | 
			
		||||
    {
 | 
			
		||||
      g_value_copy (&real_value, iter_value);
 | 
			
		||||
      g_value_unset (&real_value);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    g_value_copy (value, iter_value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_list_model_iter_is_first (ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  ClutterModelIter *temp_iter;
 | 
			
		||||
  GSequence *sequence;
 | 
			
		||||
  GSequenceIter *begin, *end;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  model = clutter_model_iter_get_model (iter);
 | 
			
		||||
 | 
			
		||||
  sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
 | 
			
		||||
 | 
			
		||||
  begin = g_sequence_get_begin_iter (sequence);
 | 
			
		||||
  end   = iter_default->seq_iter;
 | 
			
		||||
 | 
			
		||||
  temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
 | 
			
		||||
 | 
			
		||||
  while (!g_sequence_iter_is_begin (begin))
 | 
			
		||||
    {
 | 
			
		||||
      CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
 | 
			
		||||
 | 
			
		||||
      if (clutter_model_filter_iter (model, temp_iter))
 | 
			
		||||
        {
 | 
			
		||||
          end = begin;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      begin = g_sequence_iter_next (begin);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* This is because the 'begin_iter' is always *before* the last valid
 | 
			
		||||
   * iter, otherwise we'd have endless loops 
 | 
			
		||||
   */
 | 
			
		||||
  end = g_sequence_iter_prev (end);
 | 
			
		||||
 | 
			
		||||
  return iter_default->seq_iter == end;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_list_model_iter_is_last (ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  ClutterModelIter *temp_iter;
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  GSequence *sequence;
 | 
			
		||||
  GSequenceIter *begin, *end;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  if (g_sequence_iter_is_end (iter_default->seq_iter))
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  model = clutter_model_iter_get_model (iter);
 | 
			
		||||
 | 
			
		||||
  sequence = CLUTTER_LIST_MODEL (model)->priv->sequence;
 | 
			
		||||
 | 
			
		||||
  begin = g_sequence_get_end_iter (sequence);
 | 
			
		||||
  begin = g_sequence_iter_prev (begin);
 | 
			
		||||
  end   = iter_default->seq_iter;
 | 
			
		||||
 | 
			
		||||
  temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
 | 
			
		||||
 | 
			
		||||
  while (!g_sequence_iter_is_begin (begin))
 | 
			
		||||
    {
 | 
			
		||||
      CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = begin;
 | 
			
		||||
 | 
			
		||||
      if (clutter_model_filter_iter (model, temp_iter))
 | 
			
		||||
        {
 | 
			
		||||
          end = begin;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      begin = g_sequence_iter_prev (begin);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* This is because the 'end_iter' is always *after* the last valid iter.
 | 
			
		||||
   * Otherwise we'd have endless loops 
 | 
			
		||||
   */
 | 
			
		||||
  end = g_sequence_iter_next (end);
 | 
			
		||||
 | 
			
		||||
  return iter_default->seq_iter == end;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterModelIter *
 | 
			
		||||
clutter_list_model_iter_next (ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  ClutterModelIter *temp_iter;
 | 
			
		||||
  ClutterModel *model = NULL;
 | 
			
		||||
  GSequenceIter *filter_next;
 | 
			
		||||
  guint row;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  model = clutter_model_iter_get_model (iter);
 | 
			
		||||
  row   = clutter_model_iter_get_row (iter);
 | 
			
		||||
 | 
			
		||||
  filter_next = g_sequence_iter_next (iter_default->seq_iter);
 | 
			
		||||
  g_assert (filter_next != NULL);
 | 
			
		||||
 | 
			
		||||
  temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
 | 
			
		||||
 | 
			
		||||
  while (!g_sequence_iter_is_end (filter_next))
 | 
			
		||||
    {
 | 
			
		||||
      CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_next;
 | 
			
		||||
 | 
			
		||||
      if (clutter_model_filter_iter (model, temp_iter))
 | 
			
		||||
        {
 | 
			
		||||
          row += 1;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      filter_next = g_sequence_iter_next (filter_next);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (g_sequence_iter_is_end (filter_next))
 | 
			
		||||
    row += 1;
 | 
			
		||||
 | 
			
		||||
  /* update the iterator and return it */
 | 
			
		||||
  _clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
 | 
			
		||||
  iter_default->seq_iter = filter_next;
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_MODEL_ITER (iter_default);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterModelIter *
 | 
			
		||||
clutter_list_model_iter_prev (ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  ClutterModelIter *temp_iter;
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  GSequenceIter *filter_prev;
 | 
			
		||||
  guint row;
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
  g_assert (iter_default->seq_iter != NULL);
 | 
			
		||||
 | 
			
		||||
  model = clutter_model_iter_get_model (iter);
 | 
			
		||||
  row   = clutter_model_iter_get_row (iter);
 | 
			
		||||
 | 
			
		||||
  filter_prev = g_sequence_iter_prev (iter_default->seq_iter);
 | 
			
		||||
  g_assert (filter_prev != NULL);
 | 
			
		||||
 | 
			
		||||
  temp_iter = CLUTTER_LIST_MODEL (model)->priv->temp_iter;
 | 
			
		||||
 | 
			
		||||
  while (!g_sequence_iter_is_begin (filter_prev))
 | 
			
		||||
    {
 | 
			
		||||
      CLUTTER_LIST_MODEL_ITER (temp_iter)->seq_iter = filter_prev;
 | 
			
		||||
 | 
			
		||||
      if (clutter_model_filter_iter (model, temp_iter))
 | 
			
		||||
        {
 | 
			
		||||
          row -= 1;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      filter_prev = g_sequence_iter_prev (filter_prev);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (g_sequence_iter_is_begin (filter_prev))
 | 
			
		||||
    row -= 1;
 | 
			
		||||
 | 
			
		||||
  /* update the iterator and return it */
 | 
			
		||||
  _clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
 | 
			
		||||
  iter_default->seq_iter = filter_prev;
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_MODEL_ITER (iter_default);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterModelIter *
 | 
			
		||||
clutter_list_model_iter_copy (ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  ClutterListModelIter *iter_copy;
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  guint row;
 | 
			
		||||
 
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
 | 
			
		||||
  model = clutter_model_iter_get_model (iter);
 | 
			
		||||
  row   = clutter_model_iter_get_row (iter) - 1;
 | 
			
		||||
 | 
			
		||||
  iter_copy = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
 | 
			
		||||
                            "model", model,
 | 
			
		||||
                            "row", row,
 | 
			
		||||
                            NULL);
 | 
			
		||||
 | 
			
		||||
  /* this is safe, because the seq_iter pointer on the passed
 | 
			
		||||
   * iterator will be always be overwritten in ::next or ::prev
 | 
			
		||||
   */
 | 
			
		||||
  iter_copy->seq_iter = iter_default->seq_iter;
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_MODEL_ITER (iter_copy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_iter_class_init (ClutterListModelIterClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  ClutterModelIterClass *iter_class = CLUTTER_MODEL_ITER_CLASS (klass);
 | 
			
		||||
 | 
			
		||||
  iter_class->get_value = clutter_list_model_iter_get_value;
 | 
			
		||||
  iter_class->set_value = clutter_list_model_iter_set_value;
 | 
			
		||||
  iter_class->is_first  = clutter_list_model_iter_is_first;
 | 
			
		||||
  iter_class->is_last   = clutter_list_model_iter_is_last;
 | 
			
		||||
  iter_class->next      = clutter_list_model_iter_next;
 | 
			
		||||
  iter_class->prev      = clutter_list_model_iter_prev;
 | 
			
		||||
  iter_class->copy      = clutter_list_model_iter_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_iter_init (ClutterListModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  iter->seq_iter = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ClutterListModel
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterListModel, clutter_list_model, CLUTTER_TYPE_MODEL)
 | 
			
		||||
 | 
			
		||||
static ClutterModelIter *
 | 
			
		||||
clutter_list_model_get_iter_at_row (ClutterModel *model,
 | 
			
		||||
                                    guint         row)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
 | 
			
		||||
  GSequence *sequence = model_default->priv->sequence;
 | 
			
		||||
  GSequenceIter *filter_next;
 | 
			
		||||
  gint seq_length = g_sequence_get_length (sequence);
 | 
			
		||||
  ClutterListModelIter *retval;
 | 
			
		||||
  gint count = -1;
 | 
			
		||||
 | 
			
		||||
  if (row >= seq_length)
 | 
			
		||||
    return NULL;
 | 
			
		||||
 | 
			
		||||
  retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
 | 
			
		||||
                         "model", model,
 | 
			
		||||
                         "row", row,
 | 
			
		||||
                         NULL);
 | 
			
		||||
 | 
			
		||||
  /* short-circuit in case we don't have a filter in place */
 | 
			
		||||
  if (!clutter_model_get_filter_set (model))
 | 
			
		||||
    {
 | 
			
		||||
      retval->seq_iter = g_sequence_get_iter_at_pos (sequence, row);
 | 
			
		||||
 | 
			
		||||
      return CLUTTER_MODEL_ITER (retval);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  filter_next = g_sequence_get_begin_iter (sequence);
 | 
			
		||||
  g_assert (filter_next != NULL);
 | 
			
		||||
 | 
			
		||||
  while (!g_sequence_iter_is_end (filter_next))
 | 
			
		||||
    {
 | 
			
		||||
      retval->seq_iter = filter_next;
 | 
			
		||||
 | 
			
		||||
      if (clutter_model_filter_iter (model, CLUTTER_MODEL_ITER (retval)))
 | 
			
		||||
        {
 | 
			
		||||
          /* We've found a row that is valid under the filter */
 | 
			
		||||
          count++;
 | 
			
		||||
          if (count == row)
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      filter_next = g_sequence_iter_next (filter_next);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (count != row)
 | 
			
		||||
    {
 | 
			
		||||
      g_object_unref (retval);
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
  return CLUTTER_MODEL_ITER (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterModelIter *
 | 
			
		||||
clutter_list_model_insert_row (ClutterModel *model,
 | 
			
		||||
                               gint          index_)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
 | 
			
		||||
  GSequence *sequence = model_default->priv->sequence;
 | 
			
		||||
  ClutterListModelIter *retval;
 | 
			
		||||
  guint n_columns, i, pos;
 | 
			
		||||
  GValue *values;
 | 
			
		||||
  GSequenceIter *seq_iter;
 | 
			
		||||
 | 
			
		||||
  n_columns = clutter_model_get_n_columns (model);
 | 
			
		||||
  values = g_new0 (GValue, n_columns);
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < n_columns; i++)
 | 
			
		||||
    g_value_init (&values[i], clutter_model_get_column_type (model, i));
 | 
			
		||||
 | 
			
		||||
  if (index_ < 0)
 | 
			
		||||
    {
 | 
			
		||||
      seq_iter = g_sequence_append (sequence, values);
 | 
			
		||||
      pos = g_sequence_get_length (sequence) - 1;
 | 
			
		||||
    }
 | 
			
		||||
  else if (index_ == 0)
 | 
			
		||||
    {
 | 
			
		||||
      seq_iter = g_sequence_prepend (sequence, values);
 | 
			
		||||
      pos = 0;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      seq_iter = g_sequence_get_iter_at_pos (sequence, index_);
 | 
			
		||||
      seq_iter = g_sequence_insert_before (seq_iter, values);
 | 
			
		||||
      pos = index_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  retval = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
 | 
			
		||||
                         "model", model,
 | 
			
		||||
                         "row", pos,
 | 
			
		||||
                         NULL);
 | 
			
		||||
  retval->seq_iter = seq_iter;
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_MODEL_ITER (retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_remove_row (ClutterModel *model,
 | 
			
		||||
                               guint         row)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *model_default = CLUTTER_LIST_MODEL (model);
 | 
			
		||||
  GSequence *sequence = model_default->priv->sequence;
 | 
			
		||||
  GSequenceIter *seq_iter;
 | 
			
		||||
  guint pos = 0;
 | 
			
		||||
 | 
			
		||||
  seq_iter = g_sequence_get_begin_iter (sequence);
 | 
			
		||||
  while (!g_sequence_iter_is_end (seq_iter))
 | 
			
		||||
    {
 | 
			
		||||
      if (clutter_model_filter_row (model, pos))
 | 
			
		||||
        {
 | 
			
		||||
          if (pos == row)
 | 
			
		||||
            {  
 | 
			
		||||
              ClutterModelIter *iter;
 | 
			
		||||
 | 
			
		||||
              iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
 | 
			
		||||
                                   "model", model,
 | 
			
		||||
                                   "row", pos,
 | 
			
		||||
                                   NULL);
 | 
			
		||||
              CLUTTER_LIST_MODEL_ITER (iter)->seq_iter = seq_iter;
 | 
			
		||||
 | 
			
		||||
              /* the actual row is removed from the sequence inside
 | 
			
		||||
               * the ::row-removed signal class handler, so that every
 | 
			
		||||
               * handler connected to ::row-removed will still get
 | 
			
		||||
               * a valid iterator, and every signal connected to
 | 
			
		||||
               * ::row-removed with the AFTER flag will get an updated
 | 
			
		||||
               * model
 | 
			
		||||
               */
 | 
			
		||||
              g_signal_emit_by_name (model, "row-removed", iter);
 | 
			
		||||
 | 
			
		||||
              g_object_unref (iter);
 | 
			
		||||
 | 
			
		||||
              break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      pos += 1;
 | 
			
		||||
      seq_iter = g_sequence_iter_next (seq_iter);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  guint column;
 | 
			
		||||
  ClutterModelSortFunc func;
 | 
			
		||||
  gpointer data;
 | 
			
		||||
} SortClosure;
 | 
			
		||||
 | 
			
		||||
static gint
 | 
			
		||||
sort_model_default (gconstpointer a,
 | 
			
		||||
                    gconstpointer b,
 | 
			
		||||
                    gpointer      data)
 | 
			
		||||
{
 | 
			
		||||
  const GValue *row_a = a;
 | 
			
		||||
  const GValue *row_b = b;
 | 
			
		||||
  SortClosure *clos = data;
 | 
			
		||||
 | 
			
		||||
  return clos->func (clos->model,
 | 
			
		||||
                     &row_a[clos->column],
 | 
			
		||||
                     &row_b[clos->column],
 | 
			
		||||
                     clos->data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_resort (ClutterModel         *model,
 | 
			
		||||
                           ClutterModelSortFunc  func,
 | 
			
		||||
                           gpointer              data)
 | 
			
		||||
{
 | 
			
		||||
  SortClosure sort_closure = { NULL, 0, NULL, NULL };
 | 
			
		||||
 | 
			
		||||
  sort_closure.model  = model;
 | 
			
		||||
  sort_closure.column = clutter_model_get_sorting_column (model);
 | 
			
		||||
  sort_closure.func   = func;
 | 
			
		||||
  sort_closure.data   = data;
 | 
			
		||||
 | 
			
		||||
  g_sequence_sort (CLUTTER_LIST_MODEL (model)->priv->sequence,
 | 
			
		||||
                   sort_model_default,
 | 
			
		||||
                   &sort_closure);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static guint
 | 
			
		||||
clutter_list_model_get_n_rows (ClutterModel *model)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *list_model = CLUTTER_LIST_MODEL (model);
 | 
			
		||||
 | 
			
		||||
  /* short-circuit in case we don't have a filter in place */
 | 
			
		||||
  if (!clutter_model_get_filter_set (model))
 | 
			
		||||
    return g_sequence_get_length (list_model->priv->sequence);
 | 
			
		||||
 | 
			
		||||
  return CLUTTER_MODEL_CLASS (clutter_list_model_parent_class)->get_n_rows (model);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_row_removed (ClutterModel     *model,
 | 
			
		||||
                                ClutterModelIter *iter)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModelIter *iter_default;
 | 
			
		||||
  guint i, n_columns;
 | 
			
		||||
  GValue *values;
 | 
			
		||||
 | 
			
		||||
  n_columns = clutter_model_get_n_columns (model);
 | 
			
		||||
 | 
			
		||||
  iter_default = CLUTTER_LIST_MODEL_ITER (iter);
 | 
			
		||||
 | 
			
		||||
  values = g_sequence_get (iter_default->seq_iter);
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < n_columns; i++)
 | 
			
		||||
    g_value_unset (&values[i]);
 | 
			
		||||
 | 
			
		||||
  g_free (values);
 | 
			
		||||
 | 
			
		||||
  g_sequence_remove (iter_default->seq_iter);
 | 
			
		||||
  iter_default->seq_iter = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_finalize (GObject *gobject)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
 | 
			
		||||
  GSequence *sequence = model->priv->sequence;
 | 
			
		||||
  GSequenceIter *iter;
 | 
			
		||||
  guint n_columns, i;
 | 
			
		||||
 | 
			
		||||
  n_columns = clutter_model_get_n_columns (CLUTTER_MODEL (gobject));
 | 
			
		||||
 | 
			
		||||
  iter = g_sequence_get_begin_iter (sequence);
 | 
			
		||||
  while (!g_sequence_iter_is_end (iter))
 | 
			
		||||
    {
 | 
			
		||||
      GValue *values = g_sequence_get (iter);
 | 
			
		||||
 | 
			
		||||
      for (i = 0; i < n_columns; i++)
 | 
			
		||||
        g_value_unset (&values[i]);
 | 
			
		||||
 | 
			
		||||
      g_free (values);
 | 
			
		||||
 | 
			
		||||
      iter = g_sequence_iter_next (iter);
 | 
			
		||||
    }
 | 
			
		||||
  g_sequence_free (sequence);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (clutter_list_model_parent_class)->finalize (gobject);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_dispose (GObject *gobject)
 | 
			
		||||
{
 | 
			
		||||
  ClutterListModel *model = CLUTTER_LIST_MODEL (gobject);
 | 
			
		||||
 | 
			
		||||
  if (model->priv->temp_iter)
 | 
			
		||||
    {
 | 
			
		||||
      g_object_unref (model->priv->temp_iter);
 | 
			
		||||
      model->priv->temp_iter = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (clutter_list_model_parent_class)->dispose (gobject);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_class_init (ClutterListModelClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
  ClutterModelClass *model_class = CLUTTER_MODEL_CLASS (klass);
 | 
			
		||||
 | 
			
		||||
  gobject_class->finalize = clutter_list_model_finalize;
 | 
			
		||||
  gobject_class->dispose = clutter_list_model_dispose;
 | 
			
		||||
 | 
			
		||||
  model_class->get_iter_at_row = clutter_list_model_get_iter_at_row;
 | 
			
		||||
  model_class->insert_row = clutter_list_model_insert_row;
 | 
			
		||||
  model_class->remove_row = clutter_list_model_remove_row;
 | 
			
		||||
  model_class->resort = clutter_list_model_resort;
 | 
			
		||||
  model_class->get_n_rows = clutter_list_model_get_n_rows;
 | 
			
		||||
  model_class->row_removed = clutter_list_model_row_removed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_list_model_init (ClutterListModel *model)
 | 
			
		||||
{
 | 
			
		||||
  model->priv = clutter_list_model_get_instance_private (model);
 | 
			
		||||
 | 
			
		||||
  model->priv->sequence = g_sequence_new (NULL);
 | 
			
		||||
  model->priv->temp_iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER,
 | 
			
		||||
                                         "model",
 | 
			
		||||
                                         model,
 | 
			
		||||
                                         NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_list_model_new:
 | 
			
		||||
 * @n_columns: number of columns in the model
 | 
			
		||||
 * @...: @n_columns number of #GType and string pairs
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new default model with @n_columns columns with the types 
 | 
			
		||||
 * and names passed in.
 | 
			
		||||
 *
 | 
			
		||||
 * For example:
 | 
			
		||||
 * 
 | 
			
		||||
 * <informalexample><programlisting>
 | 
			
		||||
 * model = clutter_list_model_new (3,
 | 
			
		||||
 *                                 G_TYPE_INT,      "Score",
 | 
			
		||||
 *                                 G_TYPE_STRING,   "Team",
 | 
			
		||||
 *                                 GDK_TYPE_PIXBUF, "Logo");
 | 
			
		||||
 * </programlisting></informalexample>
 | 
			
		||||
 *
 | 
			
		||||
 * will create a new #ClutterModel with three columns of type int,
 | 
			
		||||
 * string and #GdkPixbuf respectively.
 | 
			
		||||
 *
 | 
			
		||||
 * Note that the name of the column can be set to %NULL, in which case
 | 
			
		||||
 * the canonical name of the type held by the column will be used as
 | 
			
		||||
 * the title.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: a new #ClutterListModel
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListStore instead
 | 
			
		||||
 */
 | 
			
		||||
ClutterModel *
 | 
			
		||||
clutter_list_model_new (guint n_columns,
 | 
			
		||||
                        ...)
 | 
			
		||||
{
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  va_list args;
 | 
			
		||||
  gint i;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (n_columns > 0, NULL);
 | 
			
		||||
 | 
			
		||||
  model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
 | 
			
		||||
  _clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
 | 
			
		||||
 | 
			
		||||
  va_start (args, n_columns);
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < n_columns; i++)
 | 
			
		||||
    { 
 | 
			
		||||
      GType type = va_arg (args, GType);
 | 
			
		||||
      const gchar *name = va_arg (args, gchar*);
 | 
			
		||||
 | 
			
		||||
      if (!_clutter_model_check_type (type))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
 | 
			
		||||
          g_object_unref (model);
 | 
			
		||||
          model = NULL;
 | 
			
		||||
          goto out;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      _clutter_model_set_column_type (model, i, type);
 | 
			
		||||
      _clutter_model_set_column_name (model, i, name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 out:
 | 
			
		||||
  va_end (args);
 | 
			
		||||
  return model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_list_model_newv:
 | 
			
		||||
 * @n_columns: number of columns in the model
 | 
			
		||||
 * @types: (array length=n_columns): an array of #GType types for the columns, from first to last
 | 
			
		||||
 * @names: (array length=n_columns): an array of names for the columns, from first to last
 | 
			
		||||
 *
 | 
			
		||||
 * Non-vararg version of clutter_list_model_new(). This function is
 | 
			
		||||
 * useful for language bindings.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer full): a new default #ClutterModel
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListStore instead
 | 
			
		||||
 */
 | 
			
		||||
ClutterModel *
 | 
			
		||||
clutter_list_model_newv (guint                n_columns,
 | 
			
		||||
                         GType               *types,
 | 
			
		||||
                         const gchar * const  names[])
 | 
			
		||||
{
 | 
			
		||||
  ClutterModel *model;
 | 
			
		||||
  gint i;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (n_columns > 0, NULL);
 | 
			
		||||
 | 
			
		||||
  model = g_object_new (CLUTTER_TYPE_LIST_MODEL, NULL);
 | 
			
		||||
  _clutter_model_set_n_columns (model, n_columns, TRUE, TRUE);
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < n_columns; i++)
 | 
			
		||||
    {
 | 
			
		||||
      if (!_clutter_model_check_type (types[i]))
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (types[i]));
 | 
			
		||||
          g_object_unref (model);
 | 
			
		||||
          return NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      _clutter_model_set_column_type (model, i, types[i]);
 | 
			
		||||
      _clutter_model_set_column_name (model, i, names[i]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return model;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,95 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Neil Jagdish Patel <njp@o-hand.com>
 | 
			
		||||
 *             Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * NB: Inspiration for column storage taken from GtkListStore
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_LIST_MODEL_H__
 | 
			
		||||
#define __CLUTTER_LIST_MODEL_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/deprecated/clutter-model.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_LIST_MODEL                 (clutter_list_model_get_type ())
 | 
			
		||||
#define CLUTTER_LIST_MODEL(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModel))
 | 
			
		||||
#define CLUTTER_IS_LIST_MODEL(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LIST_MODEL))
 | 
			
		||||
#define CLUTTER_LIST_MODEL_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
 | 
			
		||||
#define CLUTTER_IS_LIST_MODEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LIST_MODEL))
 | 
			
		||||
#define CLUTTER_LIST_MODEL_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModeClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterListModel                ClutterListModel;
 | 
			
		||||
typedef struct _ClutterListModelPrivate         ClutterListModelPrivate;
 | 
			
		||||
typedef struct _ClutterListModelClass           ClutterListModelClass;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterListModel:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterListModel struct contains only private data.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListStore instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterListModel
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterModel parent_instance;
 | 
			
		||||
 | 
			
		||||
  ClutterListModelPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterListModelClass:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterListModelClass struct contains only private data.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListStore instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterListModelClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  ClutterModelClass parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(g_list_store_get_type)
 | 
			
		||||
GType         clutter_list_model_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(g_list_store_new)
 | 
			
		||||
ClutterModel *clutter_list_model_new      (guint                n_columns,
 | 
			
		||||
                                              ...);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(g_list_store_new)
 | 
			
		||||
ClutterModel *clutter_list_model_newv     (guint                n_columns,
 | 
			
		||||
                                           GType               *types,
 | 
			
		||||
                                           const gchar * const  names[]);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_LIST_MODEL_H__ */
 | 
			
		||||
@@ -40,17 +40,6 @@ void                    clutter_threads_enter                   (void);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                    clutter_threads_leave                   (void);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint                   clutter_threads_add_frame_source        (guint             fps,
 | 
			
		||||
                                                                 GSourceFunc       func,
 | 
			
		||||
                                                                 gpointer          data);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint                   clutter_threads_add_frame_source_full   (gint              priority,
 | 
			
		||||
                                                                 guint             fps,
 | 
			
		||||
                                                                 GSourceFunc       func,
 | 
			
		||||
                                                                 gpointer          data,
 | 
			
		||||
                                                                 GDestroyNotify    notify);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
 | 
			
		||||
void                    clutter_set_motion_events_enabled       (gboolean          enable);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,52 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Neil Jagdish Patel <njp@o-hand.com>
 | 
			
		||||
 *             Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_MODEL_PRIVATE_H__
 | 
			
		||||
#define __CLUTTER_MODEL_PRIVATE_H__
 | 
			
		||||
 | 
			
		||||
#include "clutter-types.h"
 | 
			
		||||
#include "clutter-model.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
void            _clutter_model_set_n_columns    (ClutterModel *model,
 | 
			
		||||
                                                 gint          n_columns,
 | 
			
		||||
                                                 gboolean      set_types,
 | 
			
		||||
                                                 gboolean      set_names);
 | 
			
		||||
gboolean        _clutter_model_check_type       (GType         gtype);
 | 
			
		||||
 | 
			
		||||
void            _clutter_model_set_column_type  (ClutterModel *model,
 | 
			
		||||
                                                 gint          column,
 | 
			
		||||
                                                 GType         gtype);
 | 
			
		||||
void            _clutter_model_set_column_name  (ClutterModel *model,
 | 
			
		||||
                                                 gint          column,
 | 
			
		||||
                                                 const gchar  *name);
 | 
			
		||||
 | 
			
		||||
void            _clutter_model_iter_set_row     (ClutterModelIter *iter,
 | 
			
		||||
                                                 guint             row);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_MODEL_PRIVATE_H__ */
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,436 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Neil Jagdish Patel <njp@o-hand.com>
 | 
			
		||||
 *             Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_MODEL_H__
 | 
			
		||||
#define __CLUTTER_MODEL_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_MODEL              (clutter_model_get_type ())
 | 
			
		||||
#define CLUTTER_MODEL(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL, ClutterModel))
 | 
			
		||||
#define CLUTTER_MODEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL, ClutterModelClass))
 | 
			
		||||
#define CLUTTER_IS_MODEL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL))
 | 
			
		||||
#define CLUTTER_IS_MODEL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL))
 | 
			
		||||
#define CLUTTER_MODEL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL, ClutterModelClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterModel            ClutterModel;
 | 
			
		||||
typedef struct _ClutterModelClass       ClutterModelClass;
 | 
			
		||||
typedef struct _ClutterModelPrivate     ClutterModelPrivate;
 | 
			
		||||
typedef struct _ClutterModelIter        ClutterModelIter;
 | 
			
		||||
typedef struct _ClutterModelIterClass   ClutterModelIterClass;
 | 
			
		||||
typedef struct _ClutterModelIterPrivate ClutterModelIterPrivate;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelFilterFunc:
 | 
			
		||||
 * @model: a #ClutterModel
 | 
			
		||||
 * @iter: the iterator for the row
 | 
			
		||||
 * @user_data: data passed to clutter_model_set_filter()
 | 
			
		||||
 *
 | 
			
		||||
 * Filters the content of a row in the model.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: If the row should be displayed, return %TRUE
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Implement filters using a custom #GListModel instead
 | 
			
		||||
 */
 | 
			
		||||
typedef gboolean (*ClutterModelFilterFunc) (ClutterModel     *model,
 | 
			
		||||
                                            ClutterModelIter *iter,
 | 
			
		||||
                                            gpointer          user_data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelSortFunc:
 | 
			
		||||
 * @model: a #ClutterModel
 | 
			
		||||
 * @a: a #GValue representing the contents of the row
 | 
			
		||||
 * @b: a #GValue representing the contents of the second row
 | 
			
		||||
 * @user_data: data passed to clutter_model_set_sort()
 | 
			
		||||
 *
 | 
			
		||||
 * Compares the content of two rows in the model.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: a positive integer if @a is after @b, a negative integer if
 | 
			
		||||
 *   @a is before @b, or 0 if the rows are the same
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Implement sorting using a custom #GListModel instead
 | 
			
		||||
 */
 | 
			
		||||
typedef gint (*ClutterModelSortFunc) (ClutterModel *model,
 | 
			
		||||
                                      const GValue *a,
 | 
			
		||||
                                      const GValue *b,
 | 
			
		||||
                                      gpointer      user_data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelForeachFunc:
 | 
			
		||||
 * @model: a #ClutterModel
 | 
			
		||||
 * @iter: the iterator for the row
 | 
			
		||||
 * @user_data: data passed to clutter_model_foreach()
 | 
			
		||||
 *
 | 
			
		||||
 * Iterates on the content of a row in the model
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the iteration should continue, %FALSE otherwise
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListModel
 | 
			
		||||
 */
 | 
			
		||||
typedef gboolean (*ClutterModelForeachFunc) (ClutterModel     *model,
 | 
			
		||||
                                             ClutterModelIter *iter,
 | 
			
		||||
                                             gpointer          user_data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModel:
 | 
			
		||||
 *
 | 
			
		||||
 * Base class for list models. The #ClutterModel structure contains
 | 
			
		||||
 * only private data and should be manipulated using the provided
 | 
			
		||||
 * API.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListModel instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterModel
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObject parent_instance;
 | 
			
		||||
 | 
			
		||||
  ClutterModelPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelClass:
 | 
			
		||||
 * @row_added: signal class handler for ClutterModel::row-added
 | 
			
		||||
 * @row_removed: signal class handler for ClutterModel::row-removed
 | 
			
		||||
 * @row_changed: signal class handler for ClutterModel::row-changed
 | 
			
		||||
 * @sort_changed: signal class handler for ClutterModel::sort-changed
 | 
			
		||||
 * @filter_changed: signal class handler for ClutterModel::filter-changed
 | 
			
		||||
 * @get_column_name: virtual function for returning the name of a column
 | 
			
		||||
 * @get_column_type: virtual function for returning the type of a column
 | 
			
		||||
 * @get_iter_at_row: virtual function for returning an iterator for the
 | 
			
		||||
 *   given row
 | 
			
		||||
 * @get_n_rows: virtual function for returning the number of rows
 | 
			
		||||
 *   of the model
 | 
			
		||||
 * @get_n_columns: virtual function for retuning the number of columns
 | 
			
		||||
 *   of the model
 | 
			
		||||
 * @resort: virtual function for sorting the model using the passed
 | 
			
		||||
 *   sorting function
 | 
			
		||||
 * @insert_row: virtual function for inserting a row at the given index
 | 
			
		||||
 *   and returning an iterator pointing to it; if the index is a negative
 | 
			
		||||
 *   integer, the row should be appended to the model
 | 
			
		||||
 * @remove_row: virtual function for removing a row at the given index
 | 
			
		||||
 *
 | 
			
		||||
 * Class for #ClutterModel instances.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use #GListModel instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterModelClass 
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObjectClass parent_class;
 | 
			
		||||
 | 
			
		||||
  /*< public >*/
 | 
			
		||||
  /* vtable */
 | 
			
		||||
  guint             (* get_n_rows)      (ClutterModel         *model);
 | 
			
		||||
  guint             (* get_n_columns)   (ClutterModel         *model);
 | 
			
		||||
  const gchar *     (* get_column_name) (ClutterModel         *model,
 | 
			
		||||
                                         guint                 column);
 | 
			
		||||
  GType             (* get_column_type) (ClutterModel         *model,
 | 
			
		||||
                                         guint                 column);
 | 
			
		||||
  ClutterModelIter *(* insert_row)      (ClutterModel         *model,
 | 
			
		||||
                                         gint                  index_);
 | 
			
		||||
  void              (* remove_row)      (ClutterModel         *model,
 | 
			
		||||
                                         guint                 row);
 | 
			
		||||
  ClutterModelIter *(* get_iter_at_row) (ClutterModel         *model,
 | 
			
		||||
                                         guint                 row);
 | 
			
		||||
  void              (* resort)          (ClutterModel         *model,
 | 
			
		||||
                                         ClutterModelSortFunc  func,
 | 
			
		||||
                                         gpointer              data);
 | 
			
		||||
 | 
			
		||||
  /* signals */
 | 
			
		||||
  void              (* row_added)       (ClutterModel     *model,
 | 
			
		||||
                                         ClutterModelIter *iter);
 | 
			
		||||
  void              (* row_removed)     (ClutterModel     *model,
 | 
			
		||||
                                         ClutterModelIter *iter);
 | 
			
		||||
  void              (* row_changed)     (ClutterModel     *model,
 | 
			
		||||
                                         ClutterModelIter *iter);
 | 
			
		||||
  void              (* sort_changed)    (ClutterModel     *model);
 | 
			
		||||
  void              (* filter_changed)  (ClutterModel     *model);
 | 
			
		||||
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  /* padding for future expansion */
 | 
			
		||||
  void (*_clutter_model_1) (void);
 | 
			
		||||
  void (*_clutter_model_2) (void);
 | 
			
		||||
  void (*_clutter_model_3) (void);
 | 
			
		||||
  void (*_clutter_model_4) (void);
 | 
			
		||||
  void (*_clutter_model_5) (void);
 | 
			
		||||
  void (*_clutter_model_6) (void);
 | 
			
		||||
  void (*_clutter_model_7) (void);
 | 
			
		||||
  void (*_clutter_model_8) (void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(g_list_model_get_type)
 | 
			
		||||
GType                 clutter_model_get_type           (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_set_types          (ClutterModel     *model,
 | 
			
		||||
                                                        guint             n_columns,
 | 
			
		||||
                                                        GType            *types);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_set_names          (ClutterModel     *model,
 | 
			
		||||
                                                        guint             n_columns,
 | 
			
		||||
                                                        const gchar * const names[]);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_append             (ClutterModel     *model,
 | 
			
		||||
                                                        ...);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_appendv            (ClutterModel     *model,
 | 
			
		||||
                                                        guint             n_columns,
 | 
			
		||||
                                                        guint            *columns,
 | 
			
		||||
                                                        GValue           *values);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_prepend            (ClutterModel     *model,
 | 
			
		||||
                                                        ...);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_prependv           (ClutterModel     *model,
 | 
			
		||||
                                                        guint             n_columns,
 | 
			
		||||
                                                        guint            *columns,
 | 
			
		||||
                                                        GValue           *values);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_insert             (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row,
 | 
			
		||||
                                                        ...);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_insertv            (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row,
 | 
			
		||||
                                                        guint             n_columns,
 | 
			
		||||
                                                        guint            *columns,
 | 
			
		||||
                                                        GValue           *values);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_insert_value       (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row,
 | 
			
		||||
                                                        guint             column,
 | 
			
		||||
                                                        const GValue     *value);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_remove             (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
guint                 clutter_model_get_n_rows         (ClutterModel     *model);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
guint                 clutter_model_get_n_columns      (ClutterModel     *model);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
const gchar *         clutter_model_get_column_name    (ClutterModel     *model,
 | 
			
		||||
                                                        guint             column);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
GType                 clutter_model_get_column_type    (ClutterModel     *model,
 | 
			
		||||
                                                        guint             column);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
ClutterModelIter *    clutter_model_get_first_iter     (ClutterModel     *model);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
ClutterModelIter *    clutter_model_get_last_iter      (ClutterModel     *model);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
ClutterModelIter *    clutter_model_get_iter_at_row    (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_set_sorting_column (ClutterModel     *model,
 | 
			
		||||
                                                        gint              column);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
gint                  clutter_model_get_sorting_column (ClutterModel     *model);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_foreach            (ClutterModel     *model,
 | 
			
		||||
                                                        ClutterModelForeachFunc func, 
 | 
			
		||||
                                                        gpointer          user_data);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_set_sort           (ClutterModel     *model, 
 | 
			
		||||
                                                        gint              column,
 | 
			
		||||
                                                        ClutterModelSortFunc func, 
 | 
			
		||||
                                                        gpointer          user_data,
 | 
			
		||||
                                                        GDestroyNotify    notify);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_set_filter         (ClutterModel     *model, 
 | 
			
		||||
                                                        ClutterModelFilterFunc func, 
 | 
			
		||||
                                                        gpointer          user_data,
 | 
			
		||||
                                                        GDestroyNotify    notify);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
gboolean              clutter_model_get_filter_set     (ClutterModel     *model);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
void                  clutter_model_resort             (ClutterModel     *model);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
gboolean              clutter_model_filter_row         (ClutterModel     *model,
 | 
			
		||||
                                                        guint             row);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(GListModel)
 | 
			
		||||
gboolean              clutter_model_filter_iter        (ClutterModel     *model,
 | 
			
		||||
                                                        ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ClutterModelIter 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_MODEL_ITER                 (clutter_model_iter_get_type ())
 | 
			
		||||
#define CLUTTER_MODEL_ITER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIter))
 | 
			
		||||
#define CLUTTER_MODEL_ITER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
 | 
			
		||||
#define CLUTTER_IS_MODEL_ITER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MODEL_ITER))
 | 
			
		||||
#define CLUTTER_IS_MODEL_ITER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_MODEL_ITER))
 | 
			
		||||
#define CLUTTER_MODEL_ITER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MODEL_ITER, ClutterModelIterClass))
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelIter:
 | 
			
		||||
 *
 | 
			
		||||
 * Base class for list models iters. The #ClutterModelIter structure
 | 
			
		||||
 * contains only private data and should be manipulated using the
 | 
			
		||||
 * provided API.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use custom iterators for #GListModel
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterModelIter
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObject parent_instance;
 | 
			
		||||
 | 
			
		||||
  ClutterModelIterPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterModelIterClass:
 | 
			
		||||
 * @get_value: Virtual function for retrieving the value at the given
 | 
			
		||||
 *   column of the row pointed by the iterator
 | 
			
		||||
 * @set_value: Virtual function for setting the value at the given
 | 
			
		||||
 *   column of the row pointer by the iterator
 | 
			
		||||
 * @is_last: Virtual function for knowing whether the iterator points
 | 
			
		||||
 *   at the last row in the model
 | 
			
		||||
 * @is_first: Virtual function for knowing whether the iterator points
 | 
			
		||||
 *   at the first row in the model
 | 
			
		||||
 * @next: Virtual function for moving the iterator to the following
 | 
			
		||||
 *   row in the model
 | 
			
		||||
 * @prev: Virtual function for moving the iterator toe the previous
 | 
			
		||||
 *   row in the model
 | 
			
		||||
 * @get_model: Virtual function for getting the model to which the
 | 
			
		||||
 *   iterator belongs to
 | 
			
		||||
 * @get_row: Virtual function for getting the row to which the iterator
 | 
			
		||||
 *   points
 | 
			
		||||
 * @copy: Virtual function for copying a #ClutterModelIter.
 | 
			
		||||
 *
 | 
			
		||||
 * Class for #ClutterModelIter instances.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.24: Use custom iterators for #GListModel
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterModelIterClass 
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObjectClass parent_class;
 | 
			
		||||
 | 
			
		||||
  /*< public >*/
 | 
			
		||||
  /* vtable not signals */
 | 
			
		||||
  void              (* get_value) (ClutterModelIter *iter, 
 | 
			
		||||
                                   guint             column, 
 | 
			
		||||
                                   GValue           *value);
 | 
			
		||||
  void              (* set_value) (ClutterModelIter *iter, 
 | 
			
		||||
                                   guint             column, 
 | 
			
		||||
                                   const GValue     *value);
 | 
			
		||||
 | 
			
		||||
  gboolean          (* is_first)  (ClutterModelIter *iter);
 | 
			
		||||
  gboolean          (* is_last)   (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
  ClutterModelIter *(* next)      (ClutterModelIter *iter);
 | 
			
		||||
  ClutterModelIter *(* prev)      (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
  ClutterModel *    (* get_model) (ClutterModelIter *iter);
 | 
			
		||||
  guint             (* get_row)   (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
  ClutterModelIter *(* copy)      (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  /* padding for future expansion */
 | 
			
		||||
  void (*_clutter_model_iter_1) (void);
 | 
			
		||||
  void (*_clutter_model_iter_2) (void);
 | 
			
		||||
  void (*_clutter_model_iter_3) (void);
 | 
			
		||||
  void (*_clutter_model_iter_4) (void);
 | 
			
		||||
  void (*_clutter_model_iter_5) (void);
 | 
			
		||||
  void (*_clutter_model_iter_6) (void);
 | 
			
		||||
  void (*_clutter_model_iter_7) (void);
 | 
			
		||||
  void (*_clutter_model_iter_8) (void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType             clutter_model_iter_get_type   (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_get        (ClutterModelIter *iter,
 | 
			
		||||
                                                 ...);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_get_valist (ClutterModelIter *iter,
 | 
			
		||||
                                                 va_list          args);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_get_value  (ClutterModelIter *iter,
 | 
			
		||||
                                                 guint             column,
 | 
			
		||||
                                                 GValue           *value);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_set        (ClutterModelIter *iter,
 | 
			
		||||
                                                 ...);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_set_valist (ClutterModelIter *iter,
 | 
			
		||||
                                                 va_list          args);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_model_iter_set_value  (ClutterModelIter *iter,
 | 
			
		||||
                                                 guint             column,
 | 
			
		||||
                                                 const GValue     *value);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean          clutter_model_iter_is_first   (ClutterModelIter *iter);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean          clutter_model_iter_is_last    (ClutterModelIter *iter);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterModelIter *clutter_model_iter_next       (ClutterModelIter *iter);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterModelIter *clutter_model_iter_prev       (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterModel *    clutter_model_iter_get_model  (ClutterModelIter *iter);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint             clutter_model_iter_get_row    (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterModelIter *clutter_model_iter_copy       (ClutterModelIter *iter);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_MODEL_H__ */
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,144 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_SCORE_H__
 | 
			
		||||
#define __CLUTTER_SCORE_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-timeline.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_SCORE              (clutter_score_get_type ())
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_SCORE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCORE, ClutterScore))
 | 
			
		||||
#define CLUTTER_SCORE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCORE, ClutterScoreClass))
 | 
			
		||||
#define CLUTTER_IS_SCORE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCORE))
 | 
			
		||||
#define CLUTTER_IS_SCORE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCORE))
 | 
			
		||||
#define CLUTTER_SCORE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCORE, ClutterScoreClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterScore        ClutterScore;
 | 
			
		||||
typedef struct _ClutterScorePrivate ClutterScorePrivate;
 | 
			
		||||
typedef struct _ClutterScoreClass   ClutterScoreClass; 
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterScore:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterScore structure contains only private data
 | 
			
		||||
 * and should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterScore
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObject                 parent;
 | 
			
		||||
  ClutterScorePrivate    *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterScoreClass:
 | 
			
		||||
 * @timeline_started: handler for the #ClutterScore::timeline-started signal
 | 
			
		||||
 * @timeline_completed: handler for the #ClutterScore::timeline-completed
 | 
			
		||||
 *   signal
 | 
			
		||||
 * @started: handler for the #ClutterScore::started signal
 | 
			
		||||
 * @completed: handler for the #ClutterScore::completed signal
 | 
			
		||||
 * @paused: handler for the #ClutterScore::paused signal
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterScoreClass structure contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterScoreClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObjectClass parent_class;
 | 
			
		||||
 | 
			
		||||
  /*< public >*/
 | 
			
		||||
  void (* timeline_started)   (ClutterScore    *score,
 | 
			
		||||
                               ClutterTimeline *timeline);
 | 
			
		||||
  void (* timeline_completed) (ClutterScore    *score,
 | 
			
		||||
                               ClutterTimeline *timeline);
 | 
			
		||||
 | 
			
		||||
  void (* started)            (ClutterScore    *score);
 | 
			
		||||
  void (* completed)          (ClutterScore    *score);
 | 
			
		||||
  void (* paused)             (ClutterScore    *score);
 | 
			
		||||
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  /* padding for future expansion */
 | 
			
		||||
  void (*_clutter_score_1) (void);
 | 
			
		||||
  void (*_clutter_score_2) (void);
 | 
			
		||||
  void (*_clutter_score_3) (void);
 | 
			
		||||
  void (*_clutter_score_4) (void);
 | 
			
		||||
  void (*_clutter_score_5) (void);
 | 
			
		||||
}; 
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType clutter_score_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterScore *   clutter_score_new            (void);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_set_loop         (ClutterScore    *score,
 | 
			
		||||
                                                 gboolean         loop);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean         clutter_score_get_loop         (ClutterScore    *score);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gulong           clutter_score_append           (ClutterScore    *score,
 | 
			
		||||
                                                 ClutterTimeline *parent,
 | 
			
		||||
                                                 ClutterTimeline *timeline);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gulong           clutter_score_append_at_marker (ClutterScore    *score,
 | 
			
		||||
                                                 ClutterTimeline *parent,
 | 
			
		||||
                                                 const gchar     *marker_name,
 | 
			
		||||
                                                 ClutterTimeline *timeline);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_remove           (ClutterScore    *score,
 | 
			
		||||
                                                 gulong           id_);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_remove_all       (ClutterScore    *score);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterTimeline *clutter_score_get_timeline     (ClutterScore    *score,
 | 
			
		||||
                                                 gulong           id_);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GSList *         clutter_score_list_timelines   (ClutterScore    *score);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_start            (ClutterScore    *score);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_stop             (ClutterScore    *score);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_pause            (ClutterScore    *score);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void             clutter_score_rewind           (ClutterScore    *score);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gboolean         clutter_score_is_playing       (ClutterScore    *score);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_SCORE_H__ */
 | 
			
		||||
@@ -1,907 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By: Matthew Allum   <mallum@openedhand.com>
 | 
			
		||||
 *              Øyvind Kolås    <pippin@o-hand.com>
 | 
			
		||||
 *              Emmanuele Bassi <ebassi@linux.intel.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2007, 2008 OpenedHand
 | 
			
		||||
 * Copyright (C) 2009 Intel Corp
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:clutter-shader
 | 
			
		||||
 * @short_description: Programmable pipeline abstraction
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterShader is an object providing an abstraction over the
 | 
			
		||||
 * OpenGL programmable pipeline. By using #ClutterShader<!-- -->s is
 | 
			
		||||
 * possible to override the drawing pipeline by using small programs
 | 
			
		||||
 * also known as "shaders".
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterShader is available since Clutter 0.6.
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterShader is deprecated since Clutter 1.8; use #ClutterShaderEffect
 | 
			
		||||
 * in newly written code, instead.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
 | 
			
		||||
#include <glib.h>
 | 
			
		||||
 | 
			
		||||
#include <cogl/cogl.h>
 | 
			
		||||
 | 
			
		||||
#include "clutter-shader.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-debug.h"
 | 
			
		||||
#include "clutter-private.h"
 | 
			
		||||
 | 
			
		||||
/* global list of shaders */
 | 
			
		||||
static GList *clutter_shaders_list = NULL;
 | 
			
		||||
 | 
			
		||||
struct _ClutterShaderPrivate
 | 
			
		||||
{
 | 
			
		||||
  guint       compiled         : 1; /* Shader is bound to the GL context */
 | 
			
		||||
  guint       is_enabled       : 1;
 | 
			
		||||
 | 
			
		||||
  gchar      *vertex_source;        /* GLSL source for vertex shader */
 | 
			
		||||
  gchar      *fragment_source;      /* GLSL source for fragment shader */
 | 
			
		||||
 | 
			
		||||
  CoglHandle  program;
 | 
			
		||||
 | 
			
		||||
  CoglHandle  vertex_shader;
 | 
			
		||||
  CoglHandle  fragment_shader;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  PROP_0,
 | 
			
		||||
 | 
			
		||||
  PROP_VERTEX_SOURCE,
 | 
			
		||||
  PROP_FRAGMENT_SOURCE,
 | 
			
		||||
  PROP_COMPILED,
 | 
			
		||||
  PROP_ENABLED,
 | 
			
		||||
 | 
			
		||||
  PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static GParamSpec *obj_props[PROP_LAST];
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterShader, clutter_shader, G_TYPE_OBJECT)
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
clutter_shader_release_internal (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv = shader->priv;
 | 
			
		||||
 | 
			
		||||
  if (!priv->compiled)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  g_assert (priv->program != COGL_INVALID_HANDLE);
 | 
			
		||||
 | 
			
		||||
  if (priv->vertex_shader != COGL_INVALID_HANDLE)
 | 
			
		||||
    cogl_handle_unref (priv->vertex_shader);
 | 
			
		||||
 | 
			
		||||
  if (priv->fragment_shader != COGL_INVALID_HANDLE)
 | 
			
		||||
    cogl_handle_unref (priv->fragment_shader);
 | 
			
		||||
 | 
			
		||||
  if (priv->program != COGL_INVALID_HANDLE)
 | 
			
		||||
    cogl_handle_unref (priv->program);
 | 
			
		||||
 | 
			
		||||
  priv->vertex_shader = COGL_INVALID_HANDLE;
 | 
			
		||||
  priv->fragment_shader = COGL_INVALID_HANDLE;
 | 
			
		||||
  priv->program = COGL_INVALID_HANDLE;
 | 
			
		||||
  priv->compiled = FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_finalize (GObject *object)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader        *shader;
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  shader = CLUTTER_SHADER (object);
 | 
			
		||||
  priv   = shader->priv;
 | 
			
		||||
 | 
			
		||||
  clutter_shaders_list = g_list_remove (clutter_shaders_list, object);
 | 
			
		||||
 | 
			
		||||
  g_free (priv->fragment_source);
 | 
			
		||||
  g_free (priv->vertex_source);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_dispose (GObject *object)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader *shader = CLUTTER_SHADER (object);
 | 
			
		||||
 | 
			
		||||
  clutter_shader_release_internal (shader);
 | 
			
		||||
 | 
			
		||||
  G_OBJECT_CLASS (clutter_shader_parent_class)->finalize (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_set_property (GObject      *object,
 | 
			
		||||
                             guint         prop_id,
 | 
			
		||||
                             const GValue *value,
 | 
			
		||||
                             GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader *shader = CLUTTER_SHADER(object);
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_VERTEX_SOURCE:
 | 
			
		||||
      clutter_shader_set_vertex_source (shader,
 | 
			
		||||
					g_value_get_string (value), -1);
 | 
			
		||||
      break;
 | 
			
		||||
    case PROP_FRAGMENT_SOURCE:
 | 
			
		||||
      clutter_shader_set_fragment_source (shader,
 | 
			
		||||
					  g_value_get_string (value), -1);
 | 
			
		||||
      break;
 | 
			
		||||
    case PROP_ENABLED:
 | 
			
		||||
      clutter_shader_set_is_enabled (shader, g_value_get_boolean (value));
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_get_property (GObject    *object,
 | 
			
		||||
                             guint       prop_id,
 | 
			
		||||
                             GValue     *value,
 | 
			
		||||
                             GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShader        *shader;
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  shader = CLUTTER_SHADER(object);
 | 
			
		||||
  priv = shader->priv;
 | 
			
		||||
 | 
			
		||||
  switch (prop_id)
 | 
			
		||||
    {
 | 
			
		||||
    case PROP_VERTEX_SOURCE:
 | 
			
		||||
      g_value_set_string (value, priv->vertex_source);
 | 
			
		||||
      break;
 | 
			
		||||
    case PROP_FRAGMENT_SOURCE:
 | 
			
		||||
      g_value_set_string (value, priv->fragment_source);
 | 
			
		||||
      break;
 | 
			
		||||
    case PROP_COMPILED:
 | 
			
		||||
      g_value_set_boolean (value, priv->compiled);
 | 
			
		||||
      break;
 | 
			
		||||
    case PROP_ENABLED:
 | 
			
		||||
      g_value_set_boolean (value, priv->is_enabled);
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GObject *
 | 
			
		||||
clutter_shader_constructor (GType                  type,
 | 
			
		||||
                            guint                  n_params,
 | 
			
		||||
                            GObjectConstructParam *params)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *parent_class;
 | 
			
		||||
  GObject *object;
 | 
			
		||||
 | 
			
		||||
  parent_class = G_OBJECT_CLASS (clutter_shader_parent_class);
 | 
			
		||||
  object = parent_class->constructor (type, n_params, params);
 | 
			
		||||
 | 
			
		||||
  /* add this instance to the global list of shaders */
 | 
			
		||||
  clutter_shaders_list = g_list_prepend (clutter_shaders_list, object);
 | 
			
		||||
 | 
			
		||||
  return object;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_class_init (ClutterShaderClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
  GParamSpec *pspec = NULL;
 | 
			
		||||
 | 
			
		||||
  object_class->finalize      = clutter_shader_finalize;
 | 
			
		||||
  object_class->dispose       = clutter_shader_dispose;
 | 
			
		||||
  object_class->set_property  = clutter_shader_set_property;
 | 
			
		||||
  object_class->get_property  = clutter_shader_get_property;
 | 
			
		||||
  object_class->constructor   = clutter_shader_constructor;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterShader:vertex-source:
 | 
			
		||||
   *
 | 
			
		||||
   * GLSL source code for the vertex shader part of the shader
 | 
			
		||||
   * program, if any
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.6
 | 
			
		||||
   *
 | 
			
		||||
   * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_string ("vertex-source",
 | 
			
		||||
                               P_("Vertex Source"),
 | 
			
		||||
                               P_("Source of vertex shader"),
 | 
			
		||||
                               NULL,
 | 
			
		||||
                               CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_VERTEX_SOURCE] = pspec;
 | 
			
		||||
  g_object_class_install_property (object_class, PROP_VERTEX_SOURCE, pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterShader:fragment-source:
 | 
			
		||||
   *
 | 
			
		||||
   * GLSL source code for the fragment shader part of the shader program.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.6
 | 
			
		||||
   *
 | 
			
		||||
   * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_string ("fragment-source",
 | 
			
		||||
                               P_("Fragment Source"),
 | 
			
		||||
                               P_("Source of fragment shader"),
 | 
			
		||||
                               NULL,
 | 
			
		||||
                               CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_FRAGMENT_SOURCE] = pspec;
 | 
			
		||||
  g_object_class_install_property (object_class, PROP_FRAGMENT_SOURCE, pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterShader:compiled:
 | 
			
		||||
   *
 | 
			
		||||
   * Whether the shader is compiled and linked, ready for use
 | 
			
		||||
   * in the GL context.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.8
 | 
			
		||||
   *
 | 
			
		||||
   * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_boolean ("compiled",
 | 
			
		||||
                                P_("Compiled"),
 | 
			
		||||
                                P_("Whether the shader is compiled and linked"),
 | 
			
		||||
                                FALSE,
 | 
			
		||||
                                CLUTTER_PARAM_READABLE);
 | 
			
		||||
  obj_props[PROP_COMPILED] = pspec;
 | 
			
		||||
  g_object_class_install_property (object_class, PROP_COMPILED, pspec);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * ClutterShader:enabled:
 | 
			
		||||
   *
 | 
			
		||||
   * Whether the shader is currently used in the GL rendering pipeline.
 | 
			
		||||
   *
 | 
			
		||||
   * Since: 0.6
 | 
			
		||||
   *
 | 
			
		||||
   * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
   */
 | 
			
		||||
  pspec = g_param_spec_boolean ("enabled",
 | 
			
		||||
                                P_("Enabled"),
 | 
			
		||||
                                P_("Whether the shader is enabled"),
 | 
			
		||||
                                FALSE,
 | 
			
		||||
                                CLUTTER_PARAM_READWRITE);
 | 
			
		||||
  obj_props[PROP_ENABLED] = pspec;
 | 
			
		||||
  g_object_class_install_property (object_class, PROP_ENABLED, pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_shader_init (ClutterShader *self)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  priv = self->priv = clutter_shader_get_instance_private (self);
 | 
			
		||||
 | 
			
		||||
  priv->compiled = FALSE;
 | 
			
		||||
 | 
			
		||||
  priv->vertex_source = NULL;
 | 
			
		||||
  priv->fragment_source = NULL;
 | 
			
		||||
 | 
			
		||||
  priv->program = COGL_INVALID_HANDLE;
 | 
			
		||||
  priv->vertex_shader = COGL_INVALID_HANDLE;
 | 
			
		||||
  priv->fragment_shader = COGL_INVALID_HANDLE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_new:
 | 
			
		||||
 *
 | 
			
		||||
 * Create a new #ClutterShader instance.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: a new #ClutterShader.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
ClutterShader *
 | 
			
		||||
clutter_shader_new (void)
 | 
			
		||||
{
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_SHADER, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
clutter_shader_set_source (ClutterShader     *shader,
 | 
			
		||||
                           ClutterShaderType  shader_type,
 | 
			
		||||
                           const gchar       *data,
 | 
			
		||||
                           gssize             length)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv = shader->priv;
 | 
			
		||||
 | 
			
		||||
  if (length < 0)
 | 
			
		||||
    length = strlen (data);
 | 
			
		||||
 | 
			
		||||
  g_object_freeze_notify (G_OBJECT (shader));
 | 
			
		||||
 | 
			
		||||
  /* release shader if bound when changing the source, the shader will
 | 
			
		||||
   * automatically be rebound on the next use.
 | 
			
		||||
   */
 | 
			
		||||
  if (clutter_shader_is_compiled (shader))
 | 
			
		||||
    clutter_shader_release (shader);
 | 
			
		||||
 | 
			
		||||
  CLUTTER_NOTE (SHADER,
 | 
			
		||||
                "setting %s shader (len:%" G_GSSIZE_FORMAT ")",
 | 
			
		||||
                shader_type == CLUTTER_VERTEX_SHADER ? "vertex" : "fragment",
 | 
			
		||||
                length);
 | 
			
		||||
 | 
			
		||||
  switch (shader_type)
 | 
			
		||||
    {
 | 
			
		||||
    case CLUTTER_FRAGMENT_SHADER:
 | 
			
		||||
      g_free (priv->fragment_source);
 | 
			
		||||
 | 
			
		||||
      priv->fragment_source = g_strndup (data, length);
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_FRAGMENT_SOURCE]);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case CLUTTER_VERTEX_SHADER:
 | 
			
		||||
      g_free (priv->vertex_source);
 | 
			
		||||
 | 
			
		||||
      priv->vertex_source = g_strndup (data, length);
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_VERTEX_SOURCE]);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_object_thaw_notify (G_OBJECT (shader));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_set_fragment_source:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 * @data: GLSL source code.
 | 
			
		||||
 * @length: length of source buffer (currently ignored)
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the GLSL source code to be used by a #ClutterShader for the fragment
 | 
			
		||||
 * program.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_shader_set_fragment_source (ClutterShader      *shader,
 | 
			
		||||
                                    const gchar        *data,
 | 
			
		||||
                                    gssize              length)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_SHADER (shader));
 | 
			
		||||
  g_return_if_fail (data != NULL);
 | 
			
		||||
 | 
			
		||||
  clutter_shader_set_source (shader, CLUTTER_FRAGMENT_SHADER, data, length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_set_vertex_source:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 * @data: GLSL source code.
 | 
			
		||||
 * @length: length of source buffer (currently ignored)
 | 
			
		||||
 *
 | 
			
		||||
 * Sets the GLSL source code to be used by a #ClutterShader for the vertex
 | 
			
		||||
 * program.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_shader_set_vertex_source (ClutterShader      *shader,
 | 
			
		||||
                                  const gchar        *data,
 | 
			
		||||
                                  gssize              length)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_SHADER (shader));
 | 
			
		||||
  g_return_if_fail (data != NULL);
 | 
			
		||||
 | 
			
		||||
  clutter_shader_set_source (shader, CLUTTER_VERTEX_SHADER, data, length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const gchar *
 | 
			
		||||
clutter_shader_get_source (ClutterShader     *shader,
 | 
			
		||||
                           ClutterShaderType  shader_type)
 | 
			
		||||
{
 | 
			
		||||
  switch (shader_type)
 | 
			
		||||
    {
 | 
			
		||||
    case CLUTTER_FRAGMENT_SHADER:
 | 
			
		||||
      return shader->priv->fragment_source;
 | 
			
		||||
 | 
			
		||||
    case CLUTTER_VERTEX_SHADER:
 | 
			
		||||
      return shader->priv->vertex_source;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static CoglHandle
 | 
			
		||||
clutter_shader_get_cogl_shader (ClutterShader     *shader,
 | 
			
		||||
                                ClutterShaderType  shader_type)
 | 
			
		||||
{
 | 
			
		||||
  switch (shader_type)
 | 
			
		||||
    {
 | 
			
		||||
    case CLUTTER_FRAGMENT_SHADER:
 | 
			
		||||
      return shader->priv->fragment_shader;
 | 
			
		||||
 | 
			
		||||
    case CLUTTER_VERTEX_SHADER:
 | 
			
		||||
      return shader->priv->vertex_shader;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return COGL_INVALID_HANDLE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_shader_glsl_bind (ClutterShader      *self,
 | 
			
		||||
                          ClutterShaderType   shader_type,
 | 
			
		||||
                          GError            **error)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv = self->priv;
 | 
			
		||||
  CoglHandle shader = COGL_INVALID_HANDLE;
 | 
			
		||||
 | 
			
		||||
  switch (shader_type)
 | 
			
		||||
    {
 | 
			
		||||
    case CLUTTER_VERTEX_SHADER:
 | 
			
		||||
      shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
 | 
			
		||||
      cogl_shader_source (shader, priv->vertex_source);
 | 
			
		||||
 | 
			
		||||
      priv->vertex_shader = shader;
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case CLUTTER_FRAGMENT_SHADER:
 | 
			
		||||
      shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
 | 
			
		||||
      cogl_shader_source (shader, priv->fragment_source);
 | 
			
		||||
 | 
			
		||||
      priv->fragment_shader = shader;
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_assert (shader != COGL_INVALID_HANDLE);
 | 
			
		||||
 | 
			
		||||
  cogl_shader_compile (shader);
 | 
			
		||||
  if (!cogl_shader_is_compiled (shader))
 | 
			
		||||
    {
 | 
			
		||||
      gchar *log_buf;
 | 
			
		||||
 | 
			
		||||
      log_buf = cogl_shader_get_info_log (shader);
 | 
			
		||||
 | 
			
		||||
      /* translators: the first %s is the type of the shader, either
 | 
			
		||||
       * Vertex shader or Fragment shader; the second %s is the actual
 | 
			
		||||
       * error as reported by COGL
 | 
			
		||||
       */
 | 
			
		||||
      g_set_error (error, CLUTTER_SHADER_ERROR,
 | 
			
		||||
                   CLUTTER_SHADER_ERROR_COMPILE,
 | 
			
		||||
                   _("%s compilation failed: %s"),
 | 
			
		||||
                   shader_type == CLUTTER_VERTEX_SHADER ? _("Vertex shader")
 | 
			
		||||
                                                        : _("Fragment shader"),
 | 
			
		||||
                   log_buf);
 | 
			
		||||
 | 
			
		||||
      g_free (log_buf);
 | 
			
		||||
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  cogl_program_attach_shader (priv->program, shader);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
bind_glsl_shader (ClutterShader  *self,
 | 
			
		||||
                  GError        **error)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv = self->priv;
 | 
			
		||||
  GError *bind_error = NULL;
 | 
			
		||||
  gboolean res;
 | 
			
		||||
 | 
			
		||||
  priv->program = cogl_create_program ();
 | 
			
		||||
 | 
			
		||||
  if (priv->vertex_source != COGL_INVALID_HANDLE)
 | 
			
		||||
    {
 | 
			
		||||
      res = clutter_shader_glsl_bind (self,
 | 
			
		||||
                                      CLUTTER_VERTEX_SHADER,
 | 
			
		||||
                                      &bind_error);
 | 
			
		||||
 | 
			
		||||
      if (!res)
 | 
			
		||||
        {
 | 
			
		||||
          g_propagate_error (error, bind_error);
 | 
			
		||||
          return FALSE;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->fragment_source != COGL_INVALID_HANDLE)
 | 
			
		||||
    {
 | 
			
		||||
      res = clutter_shader_glsl_bind (self,
 | 
			
		||||
                                      CLUTTER_FRAGMENT_SHADER,
 | 
			
		||||
                                      &bind_error);
 | 
			
		||||
 | 
			
		||||
      if (!res)
 | 
			
		||||
        {
 | 
			
		||||
          g_propagate_error (error, bind_error);
 | 
			
		||||
          return FALSE;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  cogl_program_link (priv->program);
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_compile:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 * @error: return location for a #GError, or %NULL
 | 
			
		||||
 *
 | 
			
		||||
 * Compiles and links GLSL sources set for vertex and fragment shaders for
 | 
			
		||||
 * a #ClutterShader. If the compilation fails and a #GError return location is
 | 
			
		||||
 * provided the error will contain the errors from the compiler, if any.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: returns TRUE if the shader was succesfully compiled.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_shader_compile (ClutterShader  *shader,
 | 
			
		||||
                        GError        **error)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
 | 
			
		||||
 | 
			
		||||
  priv = shader->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->compiled)
 | 
			
		||||
    return priv->compiled;
 | 
			
		||||
 | 
			
		||||
  if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
 | 
			
		||||
    {
 | 
			
		||||
      g_set_error (error, CLUTTER_SHADER_ERROR,
 | 
			
		||||
                   CLUTTER_SHADER_ERROR_NO_GLSL,
 | 
			
		||||
                   "GLSL shaders not supported");
 | 
			
		||||
      priv->compiled = FALSE;
 | 
			
		||||
      return priv->compiled;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  priv->compiled = bind_glsl_shader (shader, error);
 | 
			
		||||
  g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
 | 
			
		||||
 | 
			
		||||
  return priv->compiled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_release:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Frees up any GL context resources held by the shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_shader_release (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_SHADER (shader));
 | 
			
		||||
 | 
			
		||||
  clutter_shader_release_internal (shader);
 | 
			
		||||
 | 
			
		||||
  g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_is_compiled:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Checks whether @shader is is currently compiled, linked and bound
 | 
			
		||||
 * to the GL context.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the shader is compiled, linked and ready for use.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.8
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_shader_is_compiled (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
 | 
			
		||||
 | 
			
		||||
  return shader->priv->compiled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_set_is_enabled:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 * @enabled: The new state of the shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Enables a shader. This function will attempt to compile and link
 | 
			
		||||
 * the shader, if it isn't already.
 | 
			
		||||
 *
 | 
			
		||||
 * When @enabled is %FALSE the default state of the GL pipeline will be
 | 
			
		||||
 * used instead.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_shader_set_is_enabled (ClutterShader *shader,
 | 
			
		||||
                               gboolean       enabled)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_SHADER (shader));
 | 
			
		||||
 | 
			
		||||
  priv = shader->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->is_enabled != enabled)
 | 
			
		||||
    {
 | 
			
		||||
      GError *error = NULL;
 | 
			
		||||
      gboolean res;
 | 
			
		||||
 | 
			
		||||
      res = clutter_shader_compile (shader, &error);
 | 
			
		||||
      if (!res)
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("Unable to bind the shader: %s",
 | 
			
		||||
                     error ? error->message : "unknown error");
 | 
			
		||||
          if (error)
 | 
			
		||||
            g_error_free (error);
 | 
			
		||||
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      priv->is_enabled = enabled;
 | 
			
		||||
 | 
			
		||||
      if (priv->is_enabled)
 | 
			
		||||
        cogl_program_use (priv->program);
 | 
			
		||||
      else
 | 
			
		||||
        cogl_program_use (COGL_INVALID_HANDLE);
 | 
			
		||||
 | 
			
		||||
      g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_ENABLED]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_is_enabled:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Checks whether @shader is enabled.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: %TRUE if the shader is enabled.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
clutter_shader_get_is_enabled (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), FALSE);
 | 
			
		||||
 | 
			
		||||
  return shader->priv->is_enabled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_set_uniform:
 | 
			
		||||
 * @shader: a #ClutterShader.
 | 
			
		||||
 * @name: name of uniform in GLSL shader program to set.
 | 
			
		||||
 * @value: a #ClutterShaderFloat, #ClutterShaderInt or #ClutterShaderMatrix
 | 
			
		||||
 *         #GValue.
 | 
			
		||||
 *
 | 
			
		||||
 * Sets a user configurable variable in the GLSL shader programs attached to
 | 
			
		||||
 * a #ClutterShader.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_shader_set_uniform (ClutterShader *shader,
 | 
			
		||||
                            const gchar   *name,
 | 
			
		||||
                            const GValue  *value)
 | 
			
		||||
{
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
  int                   location = 0;
 | 
			
		||||
  gsize                 size;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_SHADER (shader));
 | 
			
		||||
  g_return_if_fail (name != NULL);
 | 
			
		||||
  g_return_if_fail (value != NULL);
 | 
			
		||||
  g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
 | 
			
		||||
                    CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
 | 
			
		||||
                    CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
 | 
			
		||||
                    G_VALUE_HOLDS_FLOAT (value) ||
 | 
			
		||||
                    G_VALUE_HOLDS_INT (value));
 | 
			
		||||
 | 
			
		||||
  priv = shader->priv;
 | 
			
		||||
  g_return_if_fail (priv->program != COGL_INVALID_HANDLE);
 | 
			
		||||
 | 
			
		||||
  location = cogl_program_get_uniform_location (priv->program, name);
 | 
			
		||||
 | 
			
		||||
  if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value))
 | 
			
		||||
    {
 | 
			
		||||
      const float *floats;
 | 
			
		||||
 | 
			
		||||
      floats = clutter_value_get_shader_float (value, &size);
 | 
			
		||||
      cogl_program_set_uniform_float (priv->program,
 | 
			
		||||
                                      location, size, 1, floats);
 | 
			
		||||
    }
 | 
			
		||||
  else if (CLUTTER_VALUE_HOLDS_SHADER_INT (value))
 | 
			
		||||
    {
 | 
			
		||||
      const int *ints;
 | 
			
		||||
 | 
			
		||||
      ints = clutter_value_get_shader_int (value, &size);
 | 
			
		||||
      cogl_program_set_uniform_int (priv->program,
 | 
			
		||||
                                    location, size, 1, ints);
 | 
			
		||||
    }
 | 
			
		||||
  else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value))
 | 
			
		||||
    {
 | 
			
		||||
      const float *matrix;
 | 
			
		||||
 | 
			
		||||
      matrix = clutter_value_get_shader_matrix (value, &size);
 | 
			
		||||
      cogl_program_set_uniform_matrix (priv->program,
 | 
			
		||||
                                       location, size, 1, FALSE, matrix);
 | 
			
		||||
    }
 | 
			
		||||
  else if (G_VALUE_HOLDS_FLOAT (value))
 | 
			
		||||
    {
 | 
			
		||||
      float float_val = g_value_get_float (value);
 | 
			
		||||
 | 
			
		||||
      cogl_program_set_uniform_float (priv->program,
 | 
			
		||||
                                      location, 1, 1, &float_val);
 | 
			
		||||
    }
 | 
			
		||||
  else if (G_VALUE_HOLDS_INT (value))
 | 
			
		||||
    {
 | 
			
		||||
      int int_val = g_value_get_int (value);
 | 
			
		||||
 | 
			
		||||
      cogl_program_set_uniform_int (priv->program,
 | 
			
		||||
                                    location, 1, 1, &int_val);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    g_assert_not_reached ();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_fragment_source:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Query the current GLSL fragment source set on @shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the source of the fragment shader for this
 | 
			
		||||
 * ClutterShader object or %NULL. The returned string is owned by the
 | 
			
		||||
 * shader object and should never be modified or freed
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
clutter_shader_get_fragment_source (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
 | 
			
		||||
 | 
			
		||||
  return clutter_shader_get_source (shader, CLUTTER_FRAGMENT_SHADER);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_vertex_source:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Query the current GLSL vertex source set on @shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the source of the vertex shader for this
 | 
			
		||||
 * ClutterShader object or %NULL. The returned string is owned by the
 | 
			
		||||
 * shader object and should never be modified or freed
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
clutter_shader_get_vertex_source (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
 | 
			
		||||
 | 
			
		||||
  return clutter_shader_get_source (shader, CLUTTER_VERTEX_SHADER);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_cogl_program:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the underlying #CoglHandle for the shader program.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): A #CoglHandle for the shader program,
 | 
			
		||||
 *   or %NULL. The handle is owned by the #ClutterShader and it should
 | 
			
		||||
 *   not be unreferenced
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
CoglHandle
 | 
			
		||||
clutter_shader_get_cogl_program (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
 | 
			
		||||
 | 
			
		||||
  return shader->priv->program;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_cogl_fragment_shader:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the underlying #CoglHandle for the fragment shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): A #CoglHandle for the fragment
 | 
			
		||||
 *   shader, or %NULL. The handle is owned by the #ClutterShader
 | 
			
		||||
 *   and it should not be unreferenced
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
CoglHandle
 | 
			
		||||
clutter_shader_get_cogl_fragment_shader (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
 | 
			
		||||
 | 
			
		||||
  return clutter_shader_get_cogl_shader (shader, CLUTTER_FRAGMENT_SHADER);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_shader_get_cogl_vertex_shader:
 | 
			
		||||
 * @shader: a #ClutterShader
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the underlying #CoglHandle for the vertex shader.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): A #CoglHandle for the vertex
 | 
			
		||||
 *   shader, or %NULL. The handle is owned by the #ClutterShader
 | 
			
		||||
 *   and it should not be unreferenced
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.0
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead.
 | 
			
		||||
 */
 | 
			
		||||
CoglHandle
 | 
			
		||||
clutter_shader_get_cogl_vertex_shader (ClutterShader *shader)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_SHADER (shader), NULL);
 | 
			
		||||
 | 
			
		||||
  return clutter_shader_get_cogl_shader (shader, CLUTTER_VERTEX_SHADER);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GQuark
 | 
			
		||||
clutter_shader_error_quark (void)
 | 
			
		||||
{
 | 
			
		||||
  return g_quark_from_static_string ("clutter-shader-error");
 | 
			
		||||
}
 | 
			
		||||
@@ -1,182 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *             Øyvind Kolås   <pippin@o-hand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2007 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_SHADER_H__
 | 
			
		||||
#define __CLUTTER_SHADER_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
#include <clutter/clutter-shader-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_TYPE_SHADER         (clutter_shader_get_type ())
 | 
			
		||||
#define CLUTTER_SHADER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_SHADER, ClutterShader))
 | 
			
		||||
#define CLUTTER_SHADER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), CLUTTER_TYPE_SHADER, ClutterShaderClass))
 | 
			
		||||
#define CLUTTER_IS_SHADER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_SHADER))
 | 
			
		||||
#define CLUTTER_IS_SHADER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_SHADER))
 | 
			
		||||
#define CLUTTER_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_SHADER, ClutterShaderClass))
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * CLUTTER_SHADER_ERROR:
 | 
			
		||||
 *
 | 
			
		||||
 * Error domain for #ClutterShader errors
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8
 | 
			
		||||
 */
 | 
			
		||||
#define CLUTTER_SHADER_ERROR        (clutter_shader_error_quark ())
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterShaderError:
 | 
			
		||||
 * @CLUTTER_SHADER_ERROR_NO_ASM: No ASM shaders support
 | 
			
		||||
 * @CLUTTER_SHADER_ERROR_NO_GLSL: No GLSL shaders support
 | 
			
		||||
 * @CLUTTER_SHADER_ERROR_COMPILE: Compilation error
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterShader error enumeration
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
  CLUTTER_SHADER_ERROR_NO_ASM,
 | 
			
		||||
  CLUTTER_SHADER_ERROR_NO_GLSL,
 | 
			
		||||
  CLUTTER_SHADER_ERROR_COMPILE
 | 
			
		||||
} ClutterShaderError;
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterShaderPrivate ClutterShaderPrivate;
 | 
			
		||||
typedef struct _ClutterShaderClass   ClutterShaderClass;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterShader:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterShader structure contains only private data
 | 
			
		||||
 * and should be accessed using the provided API
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffect instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterShader
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObject               parent;
 | 
			
		||||
  ClutterShaderPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterShaderClass:
 | 
			
		||||
 *
 | 
			
		||||
 * The #ClutterShaderClass structure contains only private data
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.8: Use #ClutterShaderEffectClass instead
 | 
			
		||||
 */
 | 
			
		||||
struct _ClutterShaderClass
 | 
			
		||||
{
 | 
			
		||||
  /*< private >*/
 | 
			
		||||
  GObjectClass parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GQuark clutter_shader_error_quark (void);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
GType clutter_shader_get_type (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
ClutterShader *       clutter_shader_new                      (void);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
void                  clutter_shader_set_is_enabled           (ClutterShader      *shader,
 | 
			
		||||
                                                               gboolean            enabled);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
gboolean              clutter_shader_get_is_enabled           (ClutterShader      *shader);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
gboolean              clutter_shader_compile                  (ClutterShader      *shader,
 | 
			
		||||
                                                               GError            **error);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
void                  clutter_shader_release                  (ClutterShader      *shader);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
gboolean              clutter_shader_is_compiled              (ClutterShader      *shader);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
void                  clutter_shader_set_vertex_source        (ClutterShader      *shader,
 | 
			
		||||
                                                               const gchar        *data,
 | 
			
		||||
                                                               gssize              length);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
void                  clutter_shader_set_fragment_source      (ClutterShader      *shader,
 | 
			
		||||
                                                               const gchar        *data,
 | 
			
		||||
                                                               gssize              length);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
const gchar *         clutter_shader_get_vertex_source        (ClutterShader      *shader);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
const gchar *         clutter_shader_get_fragment_source      (ClutterShader      *shader);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
void                  clutter_shader_set_uniform              (ClutterShader      *shader,
 | 
			
		||||
                                                               const gchar        *name,
 | 
			
		||||
                                                               const GValue       *value);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
CoglHandle            clutter_shader_get_cogl_program         (ClutterShader      *shader);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
CoglHandle            clutter_shader_get_cogl_fragment_shader (ClutterShader      *shader);
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(ClutterShaderEffect)
 | 
			
		||||
CoglHandle            clutter_shader_get_cogl_vertex_shader   (ClutterShader      *shader);
 | 
			
		||||
 | 
			
		||||
/* ClutterActor methods */
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_effect)
 | 
			
		||||
gboolean              clutter_actor_set_shader                (ClutterActor       *self,
 | 
			
		||||
                                                               ClutterShader      *shader);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_effect)
 | 
			
		||||
ClutterShader *       clutter_actor_get_shader                (ClutterActor       *self);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform_value)
 | 
			
		||||
void                  clutter_actor_set_shader_param          (ClutterActor       *self,
 | 
			
		||||
                                                               const gchar        *param,
 | 
			
		||||
                                                               const GValue       *value);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
 | 
			
		||||
void                  clutter_actor_set_shader_param_int      (ClutterActor       *self,
 | 
			
		||||
                                                               const gchar        *param,
 | 
			
		||||
                                                               gint                value);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED_FOR(clutter_shader_effect_set_uniform)
 | 
			
		||||
void                  clutter_actor_set_shader_param_float    (ClutterActor       *self,
 | 
			
		||||
                                                               const gchar        *param,
 | 
			
		||||
                                                               gfloat              value);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_SHADER_H__ */
 | 
			
		||||
@@ -131,7 +131,6 @@
 | 
			
		||||
 *       "source" : "source-state",
 | 
			
		||||
 *       "target" : "target-state",
 | 
			
		||||
 *       "duration" : milliseconds,
 | 
			
		||||
 *       "animator" : "animator-definition"
 | 
			
		||||
 *     },
 | 
			
		||||
 *     ...
 | 
			
		||||
 *   ]
 | 
			
		||||
@@ -142,7 +141,7 @@
 | 
			
		||||
 * as clutter_state_set_key() function arguments.
 | 
			
		||||
 *
 | 
			
		||||
 * The source and target values control the source and target state of the
 | 
			
		||||
 * transition. The key and animator properties are mutually exclusive.
 | 
			
		||||
 * transition.
 | 
			
		||||
 *
 | 
			
		||||
 * The pre-delay and post-delay values are optional.
 | 
			
		||||
 *
 | 
			
		||||
@@ -189,7 +188,6 @@
 | 
			
		||||
 | 
			
		||||
#include "clutter-alpha.h"
 | 
			
		||||
#include "clutter-animatable.h"
 | 
			
		||||
#include "clutter-animator.h"
 | 
			
		||||
#include "clutter-enum-types.h"
 | 
			
		||||
#include "clutter-interval.h"
 | 
			
		||||
#include "clutter-marshal.h"
 | 
			
		||||
@@ -197,11 +195,6 @@
 | 
			
		||||
#include "clutter-scriptable.h"
 | 
			
		||||
#include "clutter-script-private.h"
 | 
			
		||||
 | 
			
		||||
typedef struct StateAnimator {
 | 
			
		||||
  const gchar     *source_state_name; /* interned string identifying entry */
 | 
			
		||||
  ClutterAnimator *animator;          /* pointer to animator itself */
 | 
			
		||||
} StateAnimator;
 | 
			
		||||
 | 
			
		||||
typedef struct State
 | 
			
		||||
{ 
 | 
			
		||||
  const gchar  *name;          /* interned string for this state name */
 | 
			
		||||
@@ -209,8 +202,6 @@ typedef struct State
 | 
			
		||||
                                  names */
 | 
			
		||||
  GList        *keys;          /* list of all keys pertaining to transitions
 | 
			
		||||
                                  from other states to this one */
 | 
			
		||||
  GArray       *animators;     /* list of animators for transitioning from
 | 
			
		||||
                                * specific source states */
 | 
			
		||||
  ClutterState *clutter_state; /* the ClutterState object this state belongs to
 | 
			
		||||
                                */
 | 
			
		||||
} State;
 | 
			
		||||
@@ -227,8 +218,6 @@ struct _ClutterStatePrivate
 | 
			
		||||
  State           *source_state;      /* current source_state */
 | 
			
		||||
  const gchar     *target_state_name; /* current target state */
 | 
			
		||||
  State           *target_state;      /* target state name */
 | 
			
		||||
  ClutterAnimator *current_animator;  /* !NULL if the current transition is
 | 
			
		||||
                                         overriden by an animator */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define SLAVE_TIMELINE_LENGTH 10000
 | 
			
		||||
@@ -496,7 +485,6 @@ state_free (gpointer data)
 | 
			
		||||
       state->keys = g_list_remove (state->keys, state->keys->data))
 | 
			
		||||
    clutter_state_key_free (state->keys->data);
 | 
			
		||||
 | 
			
		||||
  g_array_free (state->animators, TRUE);
 | 
			
		||||
  g_hash_table_destroy (state->durations);
 | 
			
		||||
  g_free (state);
 | 
			
		||||
}
 | 
			
		||||
@@ -510,7 +498,6 @@ state_new (ClutterState *clutter_state,
 | 
			
		||||
  state = g_new0 (State, 1);
 | 
			
		||||
  state->clutter_state = clutter_state;
 | 
			
		||||
  state->name = name;
 | 
			
		||||
  state->animators = g_array_new (TRUE, TRUE, sizeof (StateAnimator));
 | 
			
		||||
  state->durations = g_hash_table_new (g_direct_hash, g_direct_equal);
 | 
			
		||||
 | 
			
		||||
  return state;
 | 
			
		||||
@@ -533,14 +520,6 @@ static void
 | 
			
		||||
clutter_state_completed (ClutterTimeline *timeline,
 | 
			
		||||
                         ClutterState    *state)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStatePrivate *priv = state->priv;
 | 
			
		||||
 | 
			
		||||
  if (priv->current_animator)
 | 
			
		||||
    {
 | 
			
		||||
      clutter_animator_set_timeline (priv->current_animator, NULL);
 | 
			
		||||
      priv->current_animator = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_signal_emit (state, state_signals[COMPLETED], 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -556,9 +535,6 @@ clutter_state_new_frame (ClutterTimeline *timeline,
 | 
			
		||||
  GObject *curobj = NULL;
 | 
			
		||||
  gboolean found_specific = FALSE;
 | 
			
		||||
 | 
			
		||||
  if (priv->current_animator)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  progress = clutter_timeline_get_progress (timeline);
 | 
			
		||||
 | 
			
		||||
  for (k = priv->target_state->keys; k; k = k->next)
 | 
			
		||||
@@ -649,7 +625,6 @@ clutter_state_change (ClutterState *state,
 | 
			
		||||
                      gboolean      animate)
 | 
			
		||||
{
 | 
			
		||||
  ClutterStatePrivate *priv;
 | 
			
		||||
  ClutterAnimator     *animator;
 | 
			
		||||
  State               *new_state;
 | 
			
		||||
  guint                duration;
 | 
			
		||||
  GList               *k;
 | 
			
		||||
@@ -673,12 +648,6 @@ clutter_state_change (ClutterState *state,
 | 
			
		||||
      clutter_timeline_stop (priv->timeline);
 | 
			
		||||
      clutter_timeline_rewind (priv->timeline);
 | 
			
		||||
 | 
			
		||||
      if (priv->current_animator)
 | 
			
		||||
        {
 | 
			
		||||
          clutter_animator_set_timeline (priv->current_animator, NULL);
 | 
			
		||||
          priv->current_animator = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -694,12 +663,6 @@ clutter_state_change (ClutterState *state,
 | 
			
		||||
        return priv->timeline;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (priv->current_animator != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      clutter_animator_set_timeline (priv->current_animator, NULL);
 | 
			
		||||
      priv->current_animator = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  priv->source_state_name = priv->target_state_name;
 | 
			
		||||
  priv->target_state_name = target_state_name;
 | 
			
		||||
 | 
			
		||||
@@ -718,55 +681,37 @@ clutter_state_change (ClutterState *state,
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  animator = clutter_state_get_animator (state,
 | 
			
		||||
                                         priv->source_state_name,
 | 
			
		||||
                                         priv->target_state_name);
 | 
			
		||||
  priv->target_state = new_state;
 | 
			
		||||
 | 
			
		||||
  if (animator == NULL && new_state->keys == NULL)
 | 
			
		||||
    animator = clutter_state_get_animator (state, NULL,
 | 
			
		||||
                                           priv->target_state_name);
 | 
			
		||||
 | 
			
		||||
  if (animator != NULL)
 | 
			
		||||
  for (k = new_state->keys; k != NULL; k = k->next)
 | 
			
		||||
    {
 | 
			
		||||
      /* we've got an animator overriding the tweened animation */
 | 
			
		||||
      priv->current_animator = animator;
 | 
			
		||||
      clutter_animator_set_timeline (animator, priv->timeline);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      for (k = new_state->keys; k != NULL; k = k->next)
 | 
			
		||||
      ClutterStateKey *key = k->data;
 | 
			
		||||
      GValue initial = G_VALUE_INIT;
 | 
			
		||||
 | 
			
		||||
      /* Reset the pre-pre-delay - this is only used for setting keys
 | 
			
		||||
       * during transitions.
 | 
			
		||||
       */
 | 
			
		||||
      key->pre_pre_delay = 0;
 | 
			
		||||
 | 
			
		||||
      g_value_init (&initial, clutter_interval_get_value_type (key->interval));
 | 
			
		||||
 | 
			
		||||
      if (key->is_animatable)
 | 
			
		||||
        {
 | 
			
		||||
          ClutterStateKey *key = k->data;
 | 
			
		||||
          GValue initial = G_VALUE_INIT;
 | 
			
		||||
          ClutterAnimatable *animatable;
 | 
			
		||||
 | 
			
		||||
          /* Reset the pre-pre-delay - this is only used for setting keys
 | 
			
		||||
           * during transitions.
 | 
			
		||||
           */
 | 
			
		||||
          key->pre_pre_delay = 0;
 | 
			
		||||
 | 
			
		||||
          g_value_init (&initial, clutter_interval_get_value_type (key->interval));
 | 
			
		||||
 | 
			
		||||
          if (key->is_animatable)
 | 
			
		||||
            {
 | 
			
		||||
              ClutterAnimatable *animatable;
 | 
			
		||||
 | 
			
		||||
              animatable = CLUTTER_ANIMATABLE (key->object);
 | 
			
		||||
              clutter_animatable_get_initial_state (animatable,
 | 
			
		||||
                                                    key->property_name,
 | 
			
		||||
                                                    &initial);
 | 
			
		||||
            }
 | 
			
		||||
          else
 | 
			
		||||
            g_object_get_property (key->object, key->property_name, &initial);
 | 
			
		||||
 | 
			
		||||
          if (clutter_alpha_get_mode (key->alpha) != key->mode)
 | 
			
		||||
            clutter_alpha_set_mode (key->alpha, key->mode);
 | 
			
		||||
 | 
			
		||||
          clutter_interval_set_initial_value (key->interval, &initial);
 | 
			
		||||
          clutter_interval_set_final_value (key->interval, &key->value);
 | 
			
		||||
 | 
			
		||||
          g_value_unset (&initial);
 | 
			
		||||
          animatable = CLUTTER_ANIMATABLE (key->object);
 | 
			
		||||
          clutter_animatable_get_initial_state (animatable,
 | 
			
		||||
                                                key->property_name,
 | 
			
		||||
                                                &initial);
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
        g_object_get_property (key->object, key->property_name, &initial);
 | 
			
		||||
 | 
			
		||||
      if (clutter_alpha_get_mode (key->alpha) != key->mode)
 | 
			
		||||
        clutter_alpha_set_mode (key->alpha, key->mode);
 | 
			
		||||
 | 
			
		||||
      clutter_interval_set_initial_value (key->interval, &initial);
 | 
			
		||||
      clutter_interval_set_final_value (key->interval, &key->value);
 | 
			
		||||
 | 
			
		||||
      g_value_unset (&initial);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (!animate)
 | 
			
		||||
@@ -1549,126 +1494,6 @@ clutter_state_init (ClutterState *self)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_state_get_animator:
 | 
			
		||||
 * @state: a #ClutterState instance.
 | 
			
		||||
 * @source_state_name: the name of a source state
 | 
			
		||||
 * @target_state_name: the name of a target state
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the #ClutterAnimator that is being used for transitioning
 | 
			
		||||
 * between the two states, if any has been set
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: (transfer none): a #ClutterAnimator instance, or %NULL
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 * Deprecated: 1.12: Use #ClutterKeyframeTransition and
 | 
			
		||||
 *   #ClutterTransitionGroup instead
 | 
			
		||||
 */
 | 
			
		||||
ClutterAnimator *
 | 
			
		||||
clutter_state_get_animator (ClutterState *state,
 | 
			
		||||
                            const gchar  *source_state_name,
 | 
			
		||||
                            const gchar  *target_state_name)
 | 
			
		||||
{
 | 
			
		||||
  State *target_state;
 | 
			
		||||
  guint i;
 | 
			
		||||
 | 
			
		||||
  g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
 | 
			
		||||
 | 
			
		||||
  source_state_name = g_intern_string (source_state_name);
 | 
			
		||||
  if (source_state_name == g_intern_static_string (""))
 | 
			
		||||
    source_state_name = NULL;
 | 
			
		||||
 | 
			
		||||
  target_state_name = g_intern_string (target_state_name);
 | 
			
		||||
 | 
			
		||||
  target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
 | 
			
		||||
  if (target_state == NULL)
 | 
			
		||||
    return NULL;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < target_state->animators->len; i++)
 | 
			
		||||
    {
 | 
			
		||||
      const StateAnimator *animator;
 | 
			
		||||
 | 
			
		||||
      animator = &g_array_index (target_state->animators, StateAnimator, i);
 | 
			
		||||
      if (animator->source_state_name == source_state_name)
 | 
			
		||||
        return animator->animator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_state_set_animator:
 | 
			
		||||
 * @state: a #ClutterState instance.
 | 
			
		||||
 * @source_state_name: the name of a source state
 | 
			
		||||
 * @target_state_name: the name of a target state
 | 
			
		||||
 * @animator: (allow-none): a #ClutterAnimator instance, or %NULL to
 | 
			
		||||
 *   unset an existing #ClutterAnimator
 | 
			
		||||
 *
 | 
			
		||||
 * Specifies a #ClutterAnimator to be used when transitioning between
 | 
			
		||||
 * the two named states.
 | 
			
		||||
 *
 | 
			
		||||
 * The @animator allows specifying a transition between the state that is
 | 
			
		||||
 * more elaborate than the basic transitions allowed by the tweening of
 | 
			
		||||
 * properties defined in the #ClutterState keys.
 | 
			
		||||
 *
 | 
			
		||||
 * If @animator is %NULL it will unset an existing animator.
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterState will take a reference on the passed @animator, if any
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 1.4
 | 
			
		||||
 * Deprecated: 1.12: Use #ClutterKeyframeTransition and
 | 
			
		||||
 *   #ClutterTransitionGroup instead
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_state_set_animator (ClutterState    *state,
 | 
			
		||||
                            const gchar     *source_state_name,
 | 
			
		||||
                            const gchar     *target_state_name,
 | 
			
		||||
                            ClutterAnimator *animator)
 | 
			
		||||
{
 | 
			
		||||
  State *target_state;
 | 
			
		||||
  guint i;
 | 
			
		||||
 | 
			
		||||
  g_return_if_fail (CLUTTER_IS_STATE (state));
 | 
			
		||||
 | 
			
		||||
  source_state_name = g_intern_string (source_state_name);
 | 
			
		||||
  target_state_name = g_intern_string (target_state_name);
 | 
			
		||||
 | 
			
		||||
  target_state = clutter_state_fetch_state (state, target_state_name, TRUE);
 | 
			
		||||
  if (target_state == NULL)
 | 
			
		||||
    return;
 | 
			
		||||
  
 | 
			
		||||
  for (i = 0; target_state->animators->len; i++)
 | 
			
		||||
    {
 | 
			
		||||
      StateAnimator *a;
 | 
			
		||||
 | 
			
		||||
      a = &g_array_index (target_state->animators, StateAnimator, i);
 | 
			
		||||
      if (a->source_state_name == source_state_name)
 | 
			
		||||
        {
 | 
			
		||||
          g_object_unref (a->animator);
 | 
			
		||||
 | 
			
		||||
          if (animator != NULL)
 | 
			
		||||
            a->animator = g_object_ref (animator);
 | 
			
		||||
          else
 | 
			
		||||
            {
 | 
			
		||||
              /* remove the matched animator if passed NULL */
 | 
			
		||||
              g_array_remove_index (target_state->animators, i);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (animator != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      StateAnimator state_animator = {
 | 
			
		||||
        source_state_name,
 | 
			
		||||
        g_object_ref (animator)
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      g_array_append_val (target_state->animators, state_animator);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gpointer
 | 
			
		||||
clutter_state_key_copy (gpointer boxed)
 | 
			
		||||
{
 | 
			
		||||
@@ -2107,12 +1932,10 @@ parse_state_transition (JsonArray *array,
 | 
			
		||||
 | 
			
		||||
  if (!json_object_has_member (object, "source") ||
 | 
			
		||||
      !json_object_has_member (object, "target") ||
 | 
			
		||||
      !(json_object_has_member (object, "keys") ||
 | 
			
		||||
        json_object_has_member (object, "animator")))
 | 
			
		||||
      !(json_object_has_member (object, "keys")))
 | 
			
		||||
    {
 | 
			
		||||
      g_warning ("The transition description at index %d is missing one "
 | 
			
		||||
                 "of the mandatory members: source, target and keys or "
 | 
			
		||||
                 "animator", index_);
 | 
			
		||||
                 "of the mandatory members: source, target and keys", index_);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -2131,29 +1954,11 @@ parse_state_transition (JsonArray *array,
 | 
			
		||||
                                  duration);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (json_object_has_member (object, "animator"))
 | 
			
		||||
    {
 | 
			
		||||
      const gchar *id_ = json_object_get_string_member (object, "animator");
 | 
			
		||||
      GObject *animator;
 | 
			
		||||
 | 
			
		||||
      animator = clutter_script_get_object (clos->script, id_);
 | 
			
		||||
      if (animator == NULL)
 | 
			
		||||
        {
 | 
			
		||||
          g_warning ("No object with id '%s' has been defined.", id_);
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      clutter_state_set_animator (clos->state,
 | 
			
		||||
                                  source_name,
 | 
			
		||||
                                  target_name,
 | 
			
		||||
                                  CLUTTER_ANIMATOR (animator));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (!json_object_has_member (object, "keys"))
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  keys = json_object_get_array_member (object, "keys");
 | 
			
		||||
  if (keys == NULL && !json_object_has_member (object, "animator"))
 | 
			
		||||
  if (keys == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_warning ("The transition description at index %d has an invalid "
 | 
			
		||||
                 "key member of type '%s' when an array was expected.",
 | 
			
		||||
 
 | 
			
		||||
@@ -145,15 +145,6 @@ void              clutter_state_remove_key    (ClutterState    *state,
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterTimeline * clutter_state_get_timeline  (ClutterState    *state);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void              clutter_state_set_animator  (ClutterState    *state,
 | 
			
		||||
                                               const gchar     *source_state_name,
 | 
			
		||||
                                               const gchar     *target_state_name,
 | 
			
		||||
                                               ClutterAnimator *animator);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterAnimator * clutter_state_get_animator  (ClutterState    *state,
 | 
			
		||||
                                               const gchar     *source_state_name,
 | 
			
		||||
                                               const gchar     *target_state_name);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
const gchar *     clutter_state_get_state     (ClutterState    *state);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 
 | 
			
		||||
@@ -64,9 +64,7 @@
 | 
			
		||||
#include "clutter-stage-private.h"
 | 
			
		||||
#include "clutter-backend.h"
 | 
			
		||||
 | 
			
		||||
#include "deprecated/clutter-shader.h"
 | 
			
		||||
#include "deprecated/clutter-texture.h"
 | 
			
		||||
#include "deprecated/clutter-util.h"
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterTextureAsyncData ClutterTextureAsyncData;
 | 
			
		||||
 | 
			
		||||
@@ -480,22 +478,10 @@ update_fbo (ClutterActor *self)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTexture        *texture = CLUTTER_TEXTURE (self);
 | 
			
		||||
  ClutterTexturePrivate *priv = texture->priv;
 | 
			
		||||
  ClutterActor          *head;
 | 
			
		||||
  ClutterShader         *shader = NULL;
 | 
			
		||||
  ClutterActor          *stage = NULL;
 | 
			
		||||
  CoglMatrix             projection;
 | 
			
		||||
  CoglColor              transparent_col;
 | 
			
		||||
 | 
			
		||||
  head = _clutter_context_peek_shader_stack ();
 | 
			
		||||
  if (head != NULL)
 | 
			
		||||
    shader = clutter_actor_get_shader (head);
 | 
			
		||||
 | 
			
		||||
  /* Temporarily turn off the shader on the top of the context's
 | 
			
		||||
   * shader stack, to restore the GL pipeline to it's natural state.
 | 
			
		||||
   */
 | 
			
		||||
  if (shader != NULL)
 | 
			
		||||
    clutter_shader_set_is_enabled (shader, FALSE);
 | 
			
		||||
 | 
			
		||||
  /* Redirect drawing to the fbo */
 | 
			
		||||
  cogl_push_framebuffer (priv->fbo_handle);
 | 
			
		||||
 | 
			
		||||
@@ -554,10 +540,6 @@ update_fbo (ClutterActor *self)
 | 
			
		||||
 | 
			
		||||
  /* Restore drawing to the previous framebuffer */
 | 
			
		||||
  cogl_pop_framebuffer ();
 | 
			
		||||
 | 
			
		||||
  /* If there is a shader on top of the shader stack, turn it back on. */
 | 
			
		||||
  if (shader != NULL)
 | 
			
		||||
    clutter_shader_set_is_enabled (shader, TRUE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -1295,9 +1277,7 @@ clutter_texture_init (ClutterTexture *self)
 | 
			
		||||
 | 
			
		||||
      texture_template_pipeline = cogl_pipeline_new (ctx);
 | 
			
		||||
      pipeline = COGL_PIPELINE (texture_template_pipeline);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (pipeline,
 | 
			
		||||
                                            0, /* layer_index */
 | 
			
		||||
                                            COGL_TEXTURE_TYPE_2D);
 | 
			
		||||
      cogl_pipeline_set_layer_null_texture (pipeline, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_assert (texture_template_pipeline != NULL);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,140 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Neil Roberts  <neil@linux.intel.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2009  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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
 | 
			
		||||
/* This file contains the common code to check whether an interval has
 | 
			
		||||
   expired used in clutter-frame-source and clutter-timeout-pool. */
 | 
			
		||||
 | 
			
		||||
#include "clutter-timeout-interval.h"
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
 | 
			
		||||
                                guint                   fps)
 | 
			
		||||
{
 | 
			
		||||
#if GLIB_CHECK_VERSION (2, 27, 3)
 | 
			
		||||
  interval->start_time = g_get_monotonic_time () / 1000;
 | 
			
		||||
#else
 | 
			
		||||
  {
 | 
			
		||||
    GTimeVal start_time;
 | 
			
		||||
    g_get_current_time (&start_time);
 | 
			
		||||
    interval->start_time = start_time.tv_sec * 1000
 | 
			
		||||
                         + start_time.tv_usec / 1000;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  interval->fps = fps;
 | 
			
		||||
  interval->frame_count = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gint64
 | 
			
		||||
_clutter_timeout_interval_get_ticks (gint64                  current_time,
 | 
			
		||||
                                     ClutterTimeoutInterval *interval)
 | 
			
		||||
{
 | 
			
		||||
  return MAX (current_time - interval->start_time, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_timeout_interval_prepare (gint64                  current_time,
 | 
			
		||||
                                   ClutterTimeoutInterval *interval,
 | 
			
		||||
                                   gint                   *delay)
 | 
			
		||||
{
 | 
			
		||||
  gint elapsed_time, new_frame_num;
 | 
			
		||||
 | 
			
		||||
  elapsed_time = _clutter_timeout_interval_get_ticks (current_time, interval);
 | 
			
		||||
  new_frame_num = elapsed_time * interval->fps / 1000;
 | 
			
		||||
 | 
			
		||||
  /* If time has gone backwards or the time since the last frame is
 | 
			
		||||
     greater than the two frames worth then reset the time and do a
 | 
			
		||||
     frame now */
 | 
			
		||||
  if (new_frame_num < interval->frame_count ||
 | 
			
		||||
      new_frame_num - interval->frame_count > 2)
 | 
			
		||||
    {
 | 
			
		||||
      /* Get the frame time rounded up to the nearest ms */
 | 
			
		||||
      guint frame_time = (1000 + interval->fps - 1) / interval->fps;
 | 
			
		||||
 | 
			
		||||
      /* Reset the start time */
 | 
			
		||||
      interval->start_time = current_time;
 | 
			
		||||
 | 
			
		||||
      /* Move the start time as if one whole frame has elapsed */
 | 
			
		||||
      interval->start_time -= frame_time;
 | 
			
		||||
 | 
			
		||||
      interval->frame_count = 0;
 | 
			
		||||
 | 
			
		||||
      if (delay)
 | 
			
		||||
	*delay = 0;
 | 
			
		||||
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  else if (new_frame_num > interval->frame_count)
 | 
			
		||||
    {
 | 
			
		||||
      if (delay)
 | 
			
		||||
	*delay = 0;
 | 
			
		||||
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      if (delay)
 | 
			
		||||
	*delay = ((interval->frame_count + 1) * 1000 / interval->fps
 | 
			
		||||
               - elapsed_time);
 | 
			
		||||
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
_clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
 | 
			
		||||
                                    GSourceFunc             callback,
 | 
			
		||||
                                    gpointer                user_data)
 | 
			
		||||
{
 | 
			
		||||
  if ((* callback) (user_data))
 | 
			
		||||
    {
 | 
			
		||||
      interval->frame_count++;
 | 
			
		||||
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gint
 | 
			
		||||
_clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
 | 
			
		||||
                                              const ClutterTimeoutInterval *b)
 | 
			
		||||
{
 | 
			
		||||
  guint a_delay = 1000 / a->fps;
 | 
			
		||||
  guint b_delay = 1000 / b->fps;
 | 
			
		||||
  gint64 b_difference;
 | 
			
		||||
  gint comparison;
 | 
			
		||||
 | 
			
		||||
  b_difference = a->start_time - b->start_time;
 | 
			
		||||
 | 
			
		||||
  comparison = ((gint) ((a->frame_count + 1) * a_delay)
 | 
			
		||||
             - (gint) ((b->frame_count + 1) * b_delay + b_difference));
 | 
			
		||||
 | 
			
		||||
  return (comparison < 0 ? -1
 | 
			
		||||
                         : comparison > 0 ? 1
 | 
			
		||||
                                          : 0);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,58 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Neil Roberts  <neil@linux.intel.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2009  Intel Corporation.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_TIMEOUT_INTERVAL_H__
 | 
			
		||||
#define __CLUTTER_TIMEOUT_INTERVAL_H__
 | 
			
		||||
 | 
			
		||||
#include <glib.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterTimeoutInterval ClutterTimeoutInterval;
 | 
			
		||||
 | 
			
		||||
struct _ClutterTimeoutInterval
 | 
			
		||||
{
 | 
			
		||||
  /* milliseconds */
 | 
			
		||||
  gint64 start_time;
 | 
			
		||||
 | 
			
		||||
  guint frame_count;
 | 
			
		||||
  guint fps;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void     _clutter_timeout_interval_init               (ClutterTimeoutInterval       *interval,
 | 
			
		||||
                                                       guint                         fps);
 | 
			
		||||
 | 
			
		||||
gboolean _clutter_timeout_interval_prepare            (gint64 current_time,
 | 
			
		||||
                                                       ClutterTimeoutInterval       *interval,
 | 
			
		||||
                                                       gint                         *delay);
 | 
			
		||||
 | 
			
		||||
gboolean _clutter_timeout_interval_dispatch           (ClutterTimeoutInterval       *interval,
 | 
			
		||||
                                                       GSourceFunc                   callback,
 | 
			
		||||
                                                       gpointer                      user_data);
 | 
			
		||||
 | 
			
		||||
gint     _clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
 | 
			
		||||
                                                       const ClutterTimeoutInterval *b);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_TIMEOUT_INTERVAL_H__ */
 | 
			
		||||
@@ -1,498 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * ClutterTimeoutPool: pool of timeout functions using the same slice of
 | 
			
		||||
 *                     the GLib main loop
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Based on similar code by Tristan van Berkom
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "clutter-build-config.h"
 | 
			
		||||
 | 
			
		||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
 | 
			
		||||
#include "deprecated/clutter-main.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-timeout-pool.h"
 | 
			
		||||
 | 
			
		||||
#include "clutter-debug.h"
 | 
			
		||||
#include "clutter-timeout-interval.h"
 | 
			
		||||
 | 
			
		||||
typedef struct _ClutterTimeout  ClutterTimeout;
 | 
			
		||||
typedef enum {
 | 
			
		||||
  CLUTTER_TIMEOUT_NONE   = 0,
 | 
			
		||||
  CLUTTER_TIMEOUT_READY  = 1 << 1
 | 
			
		||||
} ClutterTimeoutFlags;
 | 
			
		||||
 | 
			
		||||
struct _ClutterTimeout
 | 
			
		||||
{
 | 
			
		||||
  guint id;
 | 
			
		||||
  ClutterTimeoutFlags flags;
 | 
			
		||||
  gint refcount;
 | 
			
		||||
 | 
			
		||||
  ClutterTimeoutInterval interval;
 | 
			
		||||
 | 
			
		||||
  GSourceFunc func;
 | 
			
		||||
  gpointer data;
 | 
			
		||||
  GDestroyNotify notify;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _ClutterTimeoutPool
 | 
			
		||||
{
 | 
			
		||||
  GSource source;
 | 
			
		||||
 | 
			
		||||
  guint next_id;
 | 
			
		||||
 | 
			
		||||
  GList *timeouts;
 | 
			
		||||
  GList *dispatched_timeouts;
 | 
			
		||||
 | 
			
		||||
  gint ready;
 | 
			
		||||
 | 
			
		||||
  guint id;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define TIMEOUT_READY(timeout)   (timeout->flags & CLUTTER_TIMEOUT_READY)
 | 
			
		||||
 | 
			
		||||
static gboolean clutter_timeout_pool_prepare  (GSource     *source,
 | 
			
		||||
                                               gint        *next_timeout);
 | 
			
		||||
static gboolean clutter_timeout_pool_check    (GSource     *source);
 | 
			
		||||
static gboolean clutter_timeout_pool_dispatch (GSource     *source,
 | 
			
		||||
                                               GSourceFunc  callback,
 | 
			
		||||
                                               gpointer     data);
 | 
			
		||||
static void clutter_timeout_pool_finalize     (GSource     *source);
 | 
			
		||||
 | 
			
		||||
static GSourceFuncs clutter_timeout_pool_funcs =
 | 
			
		||||
{
 | 
			
		||||
  clutter_timeout_pool_prepare,
 | 
			
		||||
  clutter_timeout_pool_check,
 | 
			
		||||
  clutter_timeout_pool_dispatch,
 | 
			
		||||
  clutter_timeout_pool_finalize
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static gint
 | 
			
		||||
clutter_timeout_sort (gconstpointer a,
 | 
			
		||||
                      gconstpointer b)
 | 
			
		||||
{
 | 
			
		||||
  const ClutterTimeout *t_a = a;
 | 
			
		||||
  const ClutterTimeout *t_b = b;
 | 
			
		||||
 | 
			
		||||
  /* Keep 'ready' timeouts at the front */
 | 
			
		||||
  if (TIMEOUT_READY (t_a))
 | 
			
		||||
    return -1;
 | 
			
		||||
 | 
			
		||||
  if (TIMEOUT_READY (t_b))
 | 
			
		||||
    return 1;
 | 
			
		||||
 | 
			
		||||
  return _clutter_timeout_interval_compare_expiration (&t_a->interval,
 | 
			
		||||
                                                       &t_b->interval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gint
 | 
			
		||||
clutter_timeout_find_by_id (gconstpointer a,
 | 
			
		||||
                            gconstpointer b)
 | 
			
		||||
{
 | 
			
		||||
  const ClutterTimeout *t_a = a;
 | 
			
		||||
 | 
			
		||||
  return t_a->id == GPOINTER_TO_UINT (b) ? 0 : 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ClutterTimeout *
 | 
			
		||||
clutter_timeout_new (guint fps)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeout *timeout;
 | 
			
		||||
 | 
			
		||||
  timeout = g_slice_new0 (ClutterTimeout);
 | 
			
		||||
  _clutter_timeout_interval_init (&timeout->interval, fps);
 | 
			
		||||
  timeout->flags = CLUTTER_TIMEOUT_NONE;
 | 
			
		||||
  timeout->refcount = 1;
 | 
			
		||||
 | 
			
		||||
  return timeout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_timeout_prepare (ClutterTimeoutPool *pool,
 | 
			
		||||
                         ClutterTimeout     *timeout,
 | 
			
		||||
                         gint               *next_timeout)
 | 
			
		||||
{
 | 
			
		||||
  GSource *source = (GSource *) pool;
 | 
			
		||||
  gint64 now;
 | 
			
		||||
 | 
			
		||||
#if GLIB_CHECK_VERSION (2, 27, 3)
 | 
			
		||||
  now = g_source_get_time (source) / 1000;
 | 
			
		||||
#else
 | 
			
		||||
  {
 | 
			
		||||
    GTimeVal source_time;
 | 
			
		||||
    g_source_get_current_time (source, &source_time);
 | 
			
		||||
    now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  return _clutter_timeout_interval_prepare (now,
 | 
			
		||||
                                            &timeout->interval,
 | 
			
		||||
                                            next_timeout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ref and unref are always called under the main Clutter lock, so there
 | 
			
		||||
 * is not need for us to use g_atomic_int_* API.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static ClutterTimeout *
 | 
			
		||||
clutter_timeout_ref (ClutterTimeout *timeout)
 | 
			
		||||
{
 | 
			
		||||
  g_return_val_if_fail (timeout != NULL, timeout);
 | 
			
		||||
  g_return_val_if_fail (timeout->refcount > 0, timeout);
 | 
			
		||||
 | 
			
		||||
  timeout->refcount += 1;
 | 
			
		||||
 | 
			
		||||
  return timeout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_timeout_unref (ClutterTimeout *timeout)
 | 
			
		||||
{
 | 
			
		||||
  g_return_if_fail (timeout != NULL);
 | 
			
		||||
  g_return_if_fail (timeout->refcount > 0);
 | 
			
		||||
 | 
			
		||||
  timeout->refcount -= 1;
 | 
			
		||||
 | 
			
		||||
  if (timeout->refcount == 0)
 | 
			
		||||
    {
 | 
			
		||||
      if (timeout->notify)
 | 
			
		||||
        timeout->notify (timeout->data);
 | 
			
		||||
 | 
			
		||||
      g_slice_free (ClutterTimeout, timeout);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_timeout_free (ClutterTimeout *timeout)
 | 
			
		||||
{
 | 
			
		||||
  if (G_LIKELY (timeout))
 | 
			
		||||
    {
 | 
			
		||||
      if (timeout->notify)
 | 
			
		||||
        timeout->notify (timeout->data);
 | 
			
		||||
 | 
			
		||||
      g_slice_free (ClutterTimeout, timeout);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_timeout_pool_prepare (GSource *source,
 | 
			
		||||
                              gint    *next_timeout)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
 | 
			
		||||
  GList *l = pool->timeouts;
 | 
			
		||||
 | 
			
		||||
  /* the pool is ready if the first timeout is ready */
 | 
			
		||||
  if (l && l->data)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterTimeout *timeout = l->data;
 | 
			
		||||
      return clutter_timeout_prepare (pool, timeout, next_timeout);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      *next_timeout = -1;
 | 
			
		||||
      return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_timeout_pool_check (GSource *source)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
 | 
			
		||||
  GList *l;
 | 
			
		||||
 | 
			
		||||
  clutter_threads_enter ();
 | 
			
		||||
 | 
			
		||||
  for (l = pool->timeouts; l; l = l->next)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterTimeout *timeout = l->data;
 | 
			
		||||
 | 
			
		||||
      /* since the timeouts are sorted by expiration, as soon
 | 
			
		||||
       * as we get a check returning FALSE we know that the
 | 
			
		||||
       * following timeouts are not expiring, so we break as
 | 
			
		||||
       * soon as possible
 | 
			
		||||
       */
 | 
			
		||||
      if (clutter_timeout_prepare (pool, timeout, NULL))
 | 
			
		||||
        {
 | 
			
		||||
          timeout->flags |= CLUTTER_TIMEOUT_READY;
 | 
			
		||||
          pool->ready += 1;
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  clutter_threads_leave ();
 | 
			
		||||
 | 
			
		||||
  return (pool->ready > 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
clutter_timeout_pool_dispatch (GSource     *source,
 | 
			
		||||
                               GSourceFunc  func,
 | 
			
		||||
                               gpointer     data)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
 | 
			
		||||
  GList *dispatched_timeouts;
 | 
			
		||||
 | 
			
		||||
  /* the main loop might have predicted this, so we repeat the
 | 
			
		||||
   * check for ready timeouts.
 | 
			
		||||
   */
 | 
			
		||||
  if (!pool->ready)
 | 
			
		||||
    clutter_timeout_pool_check (source);
 | 
			
		||||
 | 
			
		||||
  clutter_threads_enter ();
 | 
			
		||||
 | 
			
		||||
  /* Iterate by moving the actual start of the list along so that it
 | 
			
		||||
   * can cope with adds and removes while a timeout is being dispatched
 | 
			
		||||
   */
 | 
			
		||||
  while (pool->timeouts && pool->timeouts->data && pool->ready-- > 0)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterTimeout *timeout = pool->timeouts->data;
 | 
			
		||||
      GList *l;
 | 
			
		||||
 | 
			
		||||
      /* One of the ready timeouts may have been removed during dispatch,
 | 
			
		||||
       * in which case pool->ready will be wrong, but the ready timeouts
 | 
			
		||||
       * are always kept at the start of the list so we can stop once
 | 
			
		||||
       * we've reached the first non-ready timeout
 | 
			
		||||
       */
 | 
			
		||||
      if (!(TIMEOUT_READY (timeout)))
 | 
			
		||||
	break;
 | 
			
		||||
 | 
			
		||||
      /* Add a reference to the timeout so it can't disappear
 | 
			
		||||
       * while it's being dispatched
 | 
			
		||||
       */
 | 
			
		||||
      clutter_timeout_ref (timeout);
 | 
			
		||||
 | 
			
		||||
      timeout->flags &= ~CLUTTER_TIMEOUT_READY;
 | 
			
		||||
 | 
			
		||||
      /* Move the list node to a list of dispatched timeouts */
 | 
			
		||||
      l = pool->timeouts;
 | 
			
		||||
      if (l->next)
 | 
			
		||||
	l->next->prev = NULL;
 | 
			
		||||
 | 
			
		||||
      pool->timeouts = l->next;
 | 
			
		||||
 | 
			
		||||
      if (pool->dispatched_timeouts)
 | 
			
		||||
	pool->dispatched_timeouts->prev = l;
 | 
			
		||||
 | 
			
		||||
      l->prev = NULL;
 | 
			
		||||
      l->next = pool->dispatched_timeouts;
 | 
			
		||||
      pool->dispatched_timeouts = l;
 | 
			
		||||
 | 
			
		||||
      if (!_clutter_timeout_interval_dispatch (&timeout->interval,
 | 
			
		||||
                                               timeout->func, timeout->data))
 | 
			
		||||
	{
 | 
			
		||||
	  /* The timeout may have already been removed, but nothing
 | 
			
		||||
           * can be added to the dispatched_timeout list except in this
 | 
			
		||||
           * function so it will always either be at the head of the
 | 
			
		||||
           * dispatched list or have been removed
 | 
			
		||||
           */
 | 
			
		||||
          if (pool->dispatched_timeouts &&
 | 
			
		||||
              pool->dispatched_timeouts->data == timeout)
 | 
			
		||||
	    {
 | 
			
		||||
	      pool->dispatched_timeouts =
 | 
			
		||||
                g_list_delete_link (pool->dispatched_timeouts,
 | 
			
		||||
                                    pool->dispatched_timeouts);
 | 
			
		||||
 | 
			
		||||
	      /* Remove the reference that was held by it being in the list */
 | 
			
		||||
	      clutter_timeout_unref (timeout);
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      clutter_timeout_unref (timeout);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* Re-insert the dispatched timeouts in sorted order */
 | 
			
		||||
  dispatched_timeouts = pool->dispatched_timeouts;
 | 
			
		||||
  while (dispatched_timeouts)
 | 
			
		||||
    {
 | 
			
		||||
      ClutterTimeout *timeout = dispatched_timeouts->data;
 | 
			
		||||
      GList *next = dispatched_timeouts->next;
 | 
			
		||||
 | 
			
		||||
      if (timeout)
 | 
			
		||||
        pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
 | 
			
		||||
                                               clutter_timeout_sort);
 | 
			
		||||
 | 
			
		||||
      dispatched_timeouts = next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  g_list_free (pool->dispatched_timeouts);
 | 
			
		||||
  pool->dispatched_timeouts = NULL;
 | 
			
		||||
 | 
			
		||||
  pool->ready = 0;
 | 
			
		||||
 | 
			
		||||
  clutter_threads_leave ();
 | 
			
		||||
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
clutter_timeout_pool_finalize (GSource *source)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
 | 
			
		||||
 | 
			
		||||
  /* force destruction */
 | 
			
		||||
  g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
 | 
			
		||||
  g_list_free (pool->timeouts);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_timeout_pool_new:
 | 
			
		||||
 * @priority: the priority of the timeout pool. Typically this will
 | 
			
		||||
 *   be #G_PRIORITY_DEFAULT
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a new timeout pool source. A timeout pool should be used when
 | 
			
		||||
 * multiple timeout functions, running at the same priority, are needed and
 | 
			
		||||
 * the g_timeout_add() API might lead to starvation of the time slice of
 | 
			
		||||
 * the main loop. A timeout pool allocates a single time slice of the main
 | 
			
		||||
 * loop and runs every timeout function inside it. The timeout pool is
 | 
			
		||||
 * always sorted, so that the extraction of the next timeout function is
 | 
			
		||||
 * a constant time operation.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the newly created #ClutterTimeoutPool. The created pool
 | 
			
		||||
 *   is owned by the GLib default context and will be automatically
 | 
			
		||||
 *   destroyed when the context is destroyed. It is possible to force
 | 
			
		||||
 *   the destruction of the timeout pool using g_source_destroy()
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
ClutterTimeoutPool *
 | 
			
		||||
clutter_timeout_pool_new (gint priority)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeoutPool *pool;
 | 
			
		||||
  GSource *source;
 | 
			
		||||
 | 
			
		||||
  source = g_source_new (&clutter_timeout_pool_funcs,
 | 
			
		||||
                         sizeof (ClutterTimeoutPool));
 | 
			
		||||
  if (!source)
 | 
			
		||||
    return NULL;
 | 
			
		||||
 | 
			
		||||
  g_source_set_name (source, "Clutter timeout pool");
 | 
			
		||||
 | 
			
		||||
  if (priority != G_PRIORITY_DEFAULT)
 | 
			
		||||
    g_source_set_priority (source, priority);
 | 
			
		||||
 | 
			
		||||
  pool = (ClutterTimeoutPool *) source;
 | 
			
		||||
  pool->next_id = 1;
 | 
			
		||||
  pool->id = g_source_attach (source, NULL);
 | 
			
		||||
 | 
			
		||||
  /* let the default GLib context manage the pool */
 | 
			
		||||
  g_source_unref (source);
 | 
			
		||||
 | 
			
		||||
  return pool;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_timeout_pool_add:
 | 
			
		||||
 * @pool: a #ClutterTimeoutPool
 | 
			
		||||
 * @fps: the time between calls to the function, in frames per second
 | 
			
		||||
 * @func: function to call
 | 
			
		||||
 * @data: (closure): data to pass to the function, or %NULL
 | 
			
		||||
 * @notify: function to call when the timeout is removed, or %NULL
 | 
			
		||||
 *
 | 
			
		||||
 * Sets a function to be called at regular intervals, and puts it inside
 | 
			
		||||
 * the @pool. The function is repeatedly called until it returns %FALSE,
 | 
			
		||||
 * at which point the timeout is automatically destroyed and the function
 | 
			
		||||
 * won't be called again. If @notify is not %NULL, the @notify function
 | 
			
		||||
 * will be called. The first call to @func will be at the end of @interval.
 | 
			
		||||
 *
 | 
			
		||||
 * Since Clutter 0.8 this will try to compensate for delays. For
 | 
			
		||||
 * example, if @func takes half the interval time to execute then the
 | 
			
		||||
 * function will be called again half the interval time after it
 | 
			
		||||
 * finished. Before version 0.8 it would not fire until a full
 | 
			
		||||
 * interval after the function completes so the delay between calls
 | 
			
		||||
 * would be @interval * 1.5. This function does not however try to
 | 
			
		||||
 * invoke the function multiple times to catch up missing frames if
 | 
			
		||||
 * @func takes more than @interval ms to execute.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the ID (greater than 0) of the timeout inside the pool.
 | 
			
		||||
 *   Use clutter_timeout_pool_remove() to stop the timeout.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
guint
 | 
			
		||||
clutter_timeout_pool_add (ClutterTimeoutPool *pool,
 | 
			
		||||
                          guint               fps,
 | 
			
		||||
                          GSourceFunc         func,
 | 
			
		||||
                          gpointer            data,
 | 
			
		||||
                          GDestroyNotify      notify)
 | 
			
		||||
{
 | 
			
		||||
  ClutterTimeout *timeout;
 | 
			
		||||
  guint retval = 0;
 | 
			
		||||
 | 
			
		||||
  timeout = clutter_timeout_new (fps);
 | 
			
		||||
 | 
			
		||||
  retval = timeout->id = pool->next_id++;
 | 
			
		||||
 | 
			
		||||
  timeout->func = func;
 | 
			
		||||
  timeout->data = data;
 | 
			
		||||
  timeout->notify = notify;
 | 
			
		||||
 | 
			
		||||
  pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
 | 
			
		||||
                                         clutter_timeout_sort);
 | 
			
		||||
 | 
			
		||||
  return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_timeout_pool_remove:
 | 
			
		||||
 * @pool: a #ClutterTimeoutPool
 | 
			
		||||
 * @id_: the id of the timeout to remove
 | 
			
		||||
 *
 | 
			
		||||
 * Removes a timeout function with @id_ from the timeout pool. The id
 | 
			
		||||
 * is the same returned when adding a function to the timeout pool with
 | 
			
		||||
 * clutter_timeout_pool_add().
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.4
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: There is no direct replacement for this API
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
 | 
			
		||||
                             guint               id_)
 | 
			
		||||
{
 | 
			
		||||
  GList *l;
 | 
			
		||||
 | 
			
		||||
  if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
 | 
			
		||||
			       clutter_timeout_find_by_id)))
 | 
			
		||||
    {
 | 
			
		||||
      clutter_timeout_unref (l->data);
 | 
			
		||||
      pool->timeouts = g_list_delete_link (pool->timeouts, l);
 | 
			
		||||
    }
 | 
			
		||||
  else if ((l = g_list_find_custom (pool->dispatched_timeouts,
 | 
			
		||||
				    GUINT_TO_POINTER (id_),
 | 
			
		||||
				    clutter_timeout_find_by_id)))
 | 
			
		||||
    {
 | 
			
		||||
      clutter_timeout_unref (l->data);
 | 
			
		||||
 | 
			
		||||
      pool->dispatched_timeouts =
 | 
			
		||||
        g_list_delete_link (pool->dispatched_timeouts, l);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,69 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * ClutterTimeoutPool: pool of timeout functions using the same slice of
 | 
			
		||||
 *                     the GLib main loop
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Emmanuele Bassi <ebassi@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Based on similar code by Tristan van Berkom
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_TIMEOUT_POOL_H__
 | 
			
		||||
#define __CLUTTER_TIMEOUT_POOL_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClutterTimeoutPool: (skip)
 | 
			
		||||
 *
 | 
			
		||||
 * #ClutterTimeoutPool is an opaque structure
 | 
			
		||||
 * whose members cannot be directly accessed.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6
 | 
			
		||||
 */
 | 
			
		||||
typedef struct _ClutterTimeoutPool    ClutterTimeoutPool;
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
ClutterTimeoutPool *clutter_timeout_pool_new    (gint                priority);
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
guint               clutter_timeout_pool_add    (ClutterTimeoutPool *pool,
 | 
			
		||||
                                                 guint               fps,
 | 
			
		||||
                                                 GSourceFunc         func,
 | 
			
		||||
                                                 gpointer            data,
 | 
			
		||||
                                                 GDestroyNotify      notify);
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
void                clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
 | 
			
		||||
                                                 guint               id_);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_TIMEOUT_POOL_H__ */
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * An OpenGL based 'interactive canvas' library.
 | 
			
		||||
 *
 | 
			
		||||
 * Authored By Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2006 OpenedHand
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
 * License as published by the Free Software Foundation; either
 | 
			
		||||
 * version 2 of the License, or (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This library is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 | 
			
		||||
#error "Only <clutter/clutter.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CLUTTER_UTIL_H__
 | 
			
		||||
#define __CLUTTER_UTIL_H__
 | 
			
		||||
 | 
			
		||||
#include <clutter/clutter-types.h>
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
CLUTTER_DEPRECATED
 | 
			
		||||
gint clutter_util_next_p2 (gint a);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* __CLUTTER_UTIL_H__ */
 | 
			
		||||
@@ -264,40 +264,6 @@ clutter_backend_egl_native_new (void)
 | 
			
		||||
  return g_object_new (CLUTTER_TYPE_BACKEND_EGL_NATIVE, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_eglx_display:
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the EGL display used by Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the EGL display, or 0
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead.
 | 
			
		||||
 */
 | 
			
		||||
EGLDisplay
 | 
			
		||||
clutter_eglx_display (void)
 | 
			
		||||
{
 | 
			
		||||
  return clutter_egl_get_egl_display ();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_egl_display:
 | 
			
		||||
 *
 | 
			
		||||
 * Retrieves the EGL display used by Clutter.
 | 
			
		||||
 *
 | 
			
		||||
 * Return value: the EGL display used by Clutter, or 0
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.6
 | 
			
		||||
 *
 | 
			
		||||
 * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead.
 | 
			
		||||
 */
 | 
			
		||||
EGLDisplay
 | 
			
		||||
clutter_egl_display (void)
 | 
			
		||||
{
 | 
			
		||||
  return clutter_egl_get_egl_display ();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * clutter_egl_get_egl_display:
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user