Compare commits
	
		
			509 Commits
		
	
	
		
			wip/nielsd
			...
			gbsneto/fi
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | d841e0047f | ||
|   | 2e04d2c137 | ||
|   | 907a1f5e48 | ||
|   | 97140ab634 | ||
|   | dc9c5417bc | ||
|   | 556e7694de | ||
|   | 1a5cba5df5 | ||
|   | cd0990c581 | ||
|   | 96e831dd8a | ||
|   | 65fde269c6 | ||
|   | ad138210b3 | ||
|   | 6968f17f3f | ||
|   | 7e69d1400a | ||
|   | ccefa87351 | ||
|   | a3c97ee535 | ||
|   | 77229f99b8 | ||
|   | a51437ee2b | ||
|   | 78232fa3eb | ||
|   | 433e1b388d | ||
|   | 9b7d918537 | ||
|   | 4c59eb0910 | ||
|   | 5cfea4fee3 | ||
|   | 7275cf60bd | ||
|   | acbefa5263 | ||
|   | 2b64861ee1 | ||
|   | ea90b803fa | ||
|   | 56e8aab280 | ||
|   | 1b58341e50 | ||
|   | 634c31d7cb | ||
|   | b8dcd5f842 | ||
|   | 14e02635ff | ||
|   | 9b3b5badfb | ||
|   | 47c1558287 | ||
|   | cc7e843c44 | ||
|   | cfb8f18cef | ||
|   | c0a71720af | ||
|   | 8b03d9ecc3 | ||
|   | ea54ce7d96 | ||
|   | cb31e3e12a | ||
|   | c710a56903 | ||
|   | 96d5bde9b7 | ||
|   | ad72fa46b0 | ||
|   | fa4580de53 | ||
|   | 5e343e2c16 | ||
|   | ef93bb6471 | ||
|   | d6aaef9954 | ||
|   | 2ca351366e | ||
|   | f54bf022bd | ||
|   | e56df455ae | ||
|   | 54101b1948 | ||
|   | 829d9c863c | ||
|   | f304fa4869 | ||
|   | a32559e5ae | ||
|   | 8e13292d62 | ||
|   | 29ea5306eb | ||
|   | fb9e8768a3 | ||
|   | c747be84d9 | ||
|   | 2d7adb90c8 | ||
|   | 6b35a4901e | ||
|   | 4c1fde9deb | ||
|   | 425e65049b | ||
|   | d3f30d9ece | ||
|   | 75cffd0ec4 | ||
|   | e33d6b2908 | ||
|   | a50907513a | ||
|   | c0130ca8f7 | ||
|   | 9d4e4e2bd4 | ||
|   | bdc7cc8ab9 | ||
|   | 13deb22223 | ||
|   | 220e4caf36 | ||
|   | 5c617ac286 | ||
|   | bc08ad2fbb | ||
|   | 0947bc37d3 | ||
|   | 959eb98090 | ||
|   | 32dcf77a8f | ||
|   | 75349f8cde | ||
|   | eac227a203 | ||
|   | bc166aa6b4 | ||
|   | 5fa8b24b2b | ||
|   | 9d65eab549 | ||
|   | c4a9117ef8 | ||
|   | 0db38c4999 | ||
|   | 8ee00cee60 | ||
|   | 984aad4b86 | ||
|   | 9af90bf9c1 | ||
|   | 12ea2fcb51 | ||
|   | 55cd110c63 | ||
|   | f37a172dc7 | ||
|   | ad62a659eb | ||
|   | 15c9458e92 | ||
|   | a3baf14e72 | ||
|   | f57ce7254d | ||
|   | 4d8190972d | ||
|   | b7ef8796b2 | ||
|   | 7e8a864992 | ||
|   | f3660dc60e | ||
|   | 0eb355e29d | ||
|   | 3ccb7cf4b2 | ||
|   | 578ff22464 | ||
|   | 73db35c53c | ||
|   | 76445bcb97 | ||
|   | 6792903c4f | ||
|   | 17c217848d | ||
|   | 07de258f48 | ||
|   | ee3e195b79 | ||
|   | a0bdf44c2d | ||
|   | 3259c7e150 | ||
|   | e9e28baab7 | ||
|   | d20f6c7969 | ||
|   | 93c7d571af | ||
|   | d526283ab9 | ||
|   | 782056adab | ||
|   | 0521706617 | ||
|   | 989a281b5f | ||
|   | 18838bcefc | ||
|   | f780706f09 | ||
|   | 358911a049 | ||
|   | 1b9672b5db | ||
|   | 08c6b801d2 | ||
|   | 80c8a287ee | ||
|   | 7ab07b05e9 | ||
|   | 141373f0ba | ||
|   | 0c5866a9e1 | ||
|   | 879f5f0dbb | ||
|   | 123b40105d | ||
|   | 7ef32f747b | ||
|   | e8949292c1 | ||
|   | f5a2694eba | ||
|   | 319f7f5b63 | ||
|   | 9a10b8ff94 | ||
|   | 8b62f4884d | ||
|   | 500a692e3b | ||
|   | d3d1ff1aae | ||
|   | ca51cd8488 | ||
|   | 9109fa0eb8 | ||
|   | 79b5ece241 | ||
|   | cda9579034 | ||
|   | 82b222f218 | ||
|   | 56a5c5e4d1 | ||
|   | b95d7e8276 | ||
|   | 5b98cc7a3a | ||
|   | 4de892b02a | ||
|   | efe6c13d93 | ||
|   | aae9f3a3e6 | ||
|   | f501fdcc56 | ||
|   | 90a5582a73 | ||
|   | ac7aa11417 | ||
|   | cc5968109b | ||
|   | 0f6ab787ac | ||
|   | 2812338b7a | ||
|   | ddbdb5fa77 | ||
|   | 35007ebae0 | ||
|   | 09bab98b1e | ||
|   | aee8bfce3f | ||
|   | 92868182c9 | ||
|   | 08a3cbfc6c | ||
|   | 59fb26cb00 | ||
|   | 87c734cef9 | ||
|   | c755fb6995 | ||
|   | e9cc220c8e | ||
|   | 92f210039e | ||
|   | aef393efd0 | ||
|   | 6836317e41 | ||
|   | 61e51cdef6 | ||
|   | 7868ab761f | ||
|   | e6c8939c30 | ||
|   | ac5d9ec558 | ||
|   | 9c8ff5dbe8 | ||
|   | 7738316dff | ||
|   | 1c3d8defb5 | ||
|   | b2ae03c428 | ||
|   | 456698c814 | ||
|   | 9189b7b512 | ||
|   | 4259cfd4c6 | ||
|   | 4fdefb5b2e | ||
|   | 5ca0ef078d | ||
|   | a5265365dd | ||
|   | 62f576e15b | ||
|   | 73bc3c4426 | ||
|   | 57772e5850 | ||
|   | 7c8baf8ed9 | ||
|   | 0e3c062406 | ||
|   | 4bc7425332 | ||
|   | a2a8f0cdaa | ||
|   | faa7b2d4e5 | ||
|   | a95644dbdc | ||
|   | 720f363241 | ||
|   | 3794df608c | ||
|   | 2c893beff1 | ||
|   | a3c425ad89 | ||
|   | 1d144486d1 | ||
|   | 9cd3b07472 | ||
|   | 6061abbf90 | ||
|   | 55c084e6e1 | ||
|   | 45289b3d65 | ||
|   | 6df34eb4b7 | ||
|   | 3e68c9e8fa | ||
|   | fc0ce11fcd | ||
|   | c08a24bb40 | ||
|   | 78560b8426 | ||
|   | 0eab73dc2e | ||
|   | dd8c8e82f2 | ||
|   | 62f4e0501f | ||
|   | 6d8293a422 | ||
|   | b80250e483 | ||
|   | bd0f1bd338 | ||
|   | 2439255f32 | ||
|   | c327b2df95 | ||
|   | 9aee47daa9 | ||
|   | ecf7e53206 | ||
|   | 8038eaa99f | ||
|   | 9bcb50fa09 | ||
|   | c17af6c794 | ||
|   | 4a184d74d5 | ||
|   | 1f133b3ed2 | ||
|   | 84616bef27 | ||
|   | 040de396b2 | ||
|   | 5a4bc15d0b | ||
|   | 01e20a6ba9 | ||
|   | b0b1ff36ae | ||
|   | 5ed9abd51a | ||
|   | 65c5260312 | ||
|   | 7d9674149f | ||
|   | 25376b3b3c | ||
|   | b86a67c80a | ||
|   | 7419ab7de5 | ||
|   | 6b853ffdbd | ||
|   | ad220fc025 | ||
|   | 5bd85ef7e5 | ||
|   | 73f83f1ab6 | ||
|   | 5cb6286436 | ||
|   | 1c25b75571 | ||
|   | f2f4af0d50 | ||
|   | a8f8bc563e | ||
|   | 46248748a9 | ||
|   | da7372a2fa | ||
|   | de97b54595 | ||
|   | d7d97f2477 | ||
|   | 7776941b89 | ||
|   | 4061c8384b | ||
|   | b850f5a732 | ||
|   | 7645c51c54 | ||
|   | f1837b785b | ||
|   | 22978b9d07 | ||
|   | 1206879a20 | ||
|   | dc5925b7d1 | ||
|   | b138006bb7 | ||
|   | bca08c2c4e | ||
|   | 6541d49fe7 | ||
|   | c3c6668343 | ||
|   | 70de90ebce | ||
|   | 0756fd4636 | ||
|   | 8c339dac3e | ||
|   | 06a7c22bcd | ||
|   | ca88826ce9 | ||
|   | 7229a07b6c | ||
|   | 85f4772a4f | ||
|   | f2fb3945d1 | ||
|   | d7d75dd8e7 | ||
|   | 54fe0d311d | ||
|   | fefac75e96 | ||
|   | 5e46940332 | ||
|   | 1767672375 | ||
|   | 6fc4cd3c0c | ||
|   | feb9d129db | ||
|   | 2b519cba36 | ||
|   | 832fc798d5 | ||
|   | bd0743a421 | ||
|   | 20731887f2 | ||
|   | 980d9b1042 | ||
|   | bd7704f9e1 | ||
|   | 68f18f1fe9 | ||
|   | c655166398 | ||
|   | e14613e74e | ||
|   | f71151a5dd | ||
|   | 6022b23923 | ||
|   | d08763c18c | ||
|   | fcb408ad5d | ||
|   | 51f9e04ef1 | ||
|   | 2fc7760cee | ||
|   | f2d2d473b7 | ||
|   | e1f839f48f | ||
|   | eccc791f3b | ||
|   | 6055f04814 | ||
|   | 0185909ee3 | ||
|   | c35e56196a | ||
|   | 181c7cab32 | ||
|   | 740a62044e | ||
|   | 0bf0366933 | ||
|   | 70bacb9402 | ||
|   | 57dfe4696d | ||
|   | 22a91f23ad | ||
|   | 6aa1026600 | ||
|   | 75dff3e7c9 | ||
|   | bea7600471 | ||
|   | 8932388dda | ||
|   | 2238c9f180 | ||
|   | ca21ca6745 | ||
|   | 2bbd2e5563 | ||
|   | 691d58e69b | ||
|   | d84c7269b2 | ||
|   | aba689312f | ||
|   | f2d9a11013 | ||
|   | 596376c408 | ||
|   | 1f62a8dbd9 | ||
|   | f59d62bc8f | ||
|   | 5d5d296551 | ||
|   | 065bf752f4 | ||
|   | 4d3e804391 | ||
|   | 15a2ccd21b | ||
|   | fef5753a19 | ||
|   | f3fd7cf92b | ||
|   | 5c500ad402 | ||
|   | e7fd068a78 | ||
|   | 171e5fc3c2 | ||
|   | 7b7d881386 | ||
|   | 44905d96da | ||
|   | 73e8127d5d | ||
|   | 11e2005563 | ||
|   | 02fc0b4533 | ||
|   | 36155f72d0 | ||
|   | c63d0173b5 | ||
|   | 7fcdd60ac5 | ||
|   | a8984a81c2 | ||
|   | 769a02b630 | ||
|   | 576330edce | ||
|   | a2a114e79c | ||
|   | 79e22853ea | ||
|   | be72b22964 | ||
|   | 2464f00902 | ||
|   | 9b5d9f3cb3 | ||
|   | 088117a619 | ||
|   | 4a19628829 | ||
|   | 0cd54c5735 | ||
|   | cc2c670a5e | ||
|   | 769a01f4e9 | ||
|   | 9c1afbbb67 | ||
|   | 376725e30e | ||
|   | b836e661cf | ||
|   | 446e82e86d | ||
|   | f2020913fd | ||
|   | d9fb11b043 | ||
|   | 56ddaaa380 | ||
|   | 1efb32d300 | ||
|   | 6dba56223a | ||
|   | 2ff6beea35 | ||
|   | 689c7f4107 | ||
|   | 59bf1f4838 | ||
|   | db0f85ba5d | ||
|   | 425611eadf | ||
|   | 9213574870 | ||
|   | 3073acc3b0 | ||
|   | a61d525111 | ||
|   | 4064d9a7a7 | ||
|   | 8a06cfdd81 | ||
|   | d3e789e677 | ||
|   | c24d8e856b | ||
|   | 9db9793f33 | ||
|   | c237bc5f45 | ||
|   | 178b975d6a | ||
|   | 4abca411f3 | ||
|   | e48c7c009a | ||
|   | 36b361617d | ||
|   | 5eac1d696d | ||
|   | 9b53583945 | ||
|   | 1dbf25afa1 | ||
|   | e415cc538a | ||
|   | 67a3715ded | ||
|   | 35aa278194 | ||
|   | a76762a05e | ||
|   | ccf27e5f83 | ||
|   | 912a9ecfba | ||
|   | 0487d672ed | ||
|   | e94a0fced9 | ||
|   | a3b86447f7 | ||
|   | 1d76eace1e | ||
|   | c1303bd642 | ||
|   | db11a37a68 | ||
|   | 0d0b9da6f8 | ||
|   | ab0b407da4 | ||
|   | c33b330799 | ||
|   | 144b24bfcc | ||
|   | 4d21650d6d | ||
|   | a6fc656e91 | ||
|   | a38bae259e | ||
|   | c53aa89098 | ||
|   | 851b7d0639 | ||
|   | b4c78726cf | ||
|   | c9cc07fd3a | ||
|   | f6eb2a8cf8 | ||
|   | 08e5589836 | ||
|   | 4f5a5e84fc | ||
|   | 0786683189 | ||
|   | 4887de533c | ||
|   | 57945a730f | ||
|   | 78254146f3 | ||
|   | 3e2a2cf532 | ||
|   | 04b240b50c | ||
|   | 7810f0e276 | ||
|   | 9b8f9b65b8 | ||
|   | e741cab3f4 | ||
|   | 53748e3da7 | ||
|   | 17c5436f6e | ||
|   | 04fb6f7659 | ||
|   | e5e58f8075 | ||
|   | 1da0355528 | ||
|   | e5881156f6 | ||
|   | 60170cff70 | ||
|   | e2bea48073 | ||
|   | bbfaf8204b | ||
|   | b3e19ee669 | ||
|   | 75e2bfb062 | ||
|   | a859d76c72 | ||
|   | 2145333969 | ||
|   | 1b61b9cd73 | ||
|   | a2c545c321 | ||
|   | 3cd8f3b7dc | ||
|   | 033ce2d956 | ||
|   | 2b47e89405 | ||
|   | 80d11287eb | ||
|   | f869e4d54b | ||
|   | c1059df7f9 | ||
|   | e3d3df985f | ||
|   | 86ff3dfb3c | ||
|   | 7e0d185120 | ||
|   | 61c173b777 | ||
|   | f99cd18254 | ||
|   | 0405786573 | ||
|   | b016ff29f6 | ||
|   | 3f2e86f67c | ||
|   | 0aa4a526c6 | ||
|   | 85c2aef4bc | ||
|   | 76664ef891 | ||
|   | b1ea768949 | ||
|   | ea9d8a895b | ||
|   | 38432da328 | ||
|   | 430f354cd9 | ||
|   | 1cf4279745 | ||
|   | 7713006f5b | ||
|   | 465e13128b | ||
|   | 86de79cfc5 | ||
|   | 1d77641f0b | ||
|   | 2f217109aa | ||
|   | 5e0523cc8b | ||
|   | dbe6e01e12 | ||
|   | 103c469cc9 | ||
|   | ef074ea510 | ||
|   | 39bac6eabd | ||
|   | 0200f4fcd9 | ||
|   | 439afb3f19 | ||
|   | b01edc22f3 | ||
|   | e8bca5052a | ||
|   | 468882ecec | ||
|   | be3c89d823 | ||
|   | 7719e33e68 | ||
|   | deef9960a4 | ||
|   | 9305b6d8ee | ||
|   | 62de4b4f82 | ||
|   | ea0a89bde8 | ||
|   | 4faeb12731 | ||
|   | 91ac64bb44 | ||
|   | ed56edc7ba | ||
|   | 6eeba2434a | ||
|   | 7fb7b28cd6 | ||
|   | 08aec58c22 | ||
|   | 52945f383d | ||
|   | fecc57ddf0 | ||
|   | 0d7a929b83 | ||
|   | 991f9505ad | ||
|   | 358b67871f | ||
|   | 2b1acea1b0 | ||
|   | 91aee3d5c4 | ||
|   | 02812fb988 | ||
|   | 29211c9020 | ||
|   | 68fba458b3 | ||
|   | 9c2fdcdbb2 | ||
|   | d4a0893d76 | ||
|   | 7a6c755833 | ||
|   | 45244852ac | ||
|   | e96136e418 | ||
|   | eae6e7a889 | ||
|   | a48b6cc9ca | ||
|   | 786305f7d6 | ||
|   | 30a2483e6e | ||
|   | f5f0aa1023 | ||
|   | b86fba2f3c | ||
|   | f7ecf3b618 | ||
|   | 7a17e236f7 | ||
|   | df7d8e2cbf | ||
|   | 9e82f9af25 | ||
|   | 329c4bc5b3 | ||
|   | 706c5a7565 | ||
|   | 24b3467584 | ||
|   | 9e0e35d2a7 | ||
|   | dae2c1d420 | ||
|   | 01d0316fd7 | ||
|   | 7e2a0ede16 | ||
|   | 7738b5c00b | ||
|   | 454651f79f | ||
|   | bf8bc65cc9 | ||
|   | 6a89e7969f | ||
|   | 3ffc4f8876 | ||
|   | b4d973fbe4 | ||
|   | da1e917b38 | ||
|   | 160d2d56d9 | ||
|   | 3468144847 | ||
|   | ae6d9e35bd | ||
|   | ac15a8abca | ||
|   | 5480a3f238 | 
| @@ -1,4 +1,4 @@ | ||||
| image: registry.gitlab.gnome.org/gnome/mutter/master:v1 | ||||
| image: registry.gitlab.gnome.org/gnome/mutter/master:v2 | ||||
|  | ||||
| stages: | ||||
|  - review | ||||
| @@ -17,7 +17,21 @@ check-commit-log: | ||||
| build-mutter: | ||||
|   stage: build | ||||
|   script: | ||||
|     - meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror | ||||
|     - meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr | ||||
|     - ninja -C build | ||||
|     - ninja -C build install | ||||
|   artifacts: | ||||
|     expire_in: 1 day | ||||
|     paths: | ||||
|       - build | ||||
|   only: | ||||
|     - merge_requests | ||||
|     - /^.*$/ | ||||
|  | ||||
| build-without-native-backend: | ||||
|   stage: build | ||||
|   script: | ||||
|     - meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr | ||||
|     - ninja -C build | ||||
|     - ninja -C build install | ||||
|   artifacts: | ||||
| @@ -35,12 +49,31 @@ test-mutter: | ||||
|   variables: | ||||
|     XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir" | ||||
|     GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data" | ||||
|     G_SLICE: "always-malloc" | ||||
|     MALLOC_CHECK_: "3" | ||||
|     NO_AT_BRIDGE: "1" | ||||
|     MALLOC_PERTURB_: "123" | ||||
|   script: | ||||
|     - dconf update | ||||
|     - 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 | ||||
|       meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv | ||||
|   only: | ||||
|     - merge_requests | ||||
|     - /^.*$/ | ||||
|  | ||||
| can-build-gnome-shell: | ||||
|   stage: test | ||||
|   dependencies: | ||||
|     - build-mutter | ||||
|   before_script: | ||||
|     - meson install --no-rebuild -C build | ||||
|   script: | ||||
|     - .gitlab-ci/checkout-gnome-shell.sh | ||||
|     - meson gnome-shell gnome-shell/build --prefix /usr -Dman=false | ||||
|     - ninja -C gnome-shell/build install | ||||
|   only: | ||||
|     - merge_requests | ||||
|     - /^.*$/ | ||||
|   | ||||
| @@ -1,17 +1,40 @@ | ||||
| FROM fedora:29 | ||||
| # Rebuild and push with | ||||
| # | ||||
| #     cd .gitlab-ci/ | ||||
| #     docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 . | ||||
| #     docker push registry.gitlab.gnome.org/gnome/mutter/master:v2 | ||||
| # | ||||
|  | ||||
| FROM fedora:30 | ||||
|  | ||||
| RUN dnf -y update && dnf -y upgrade && \ | ||||
|     dnf install -y 'dnf-command(builddep)' && \ | ||||
|     dnf install -y 'dnf-command(copr)' && \ | ||||
|     dnf copr enable -y fmuellner/gnome-shell-ci && \ | ||||
|     dnf copr enable -y jadahl/mutter-ci && \ | ||||
|     dnf copr enable -y hergertme/sysprof-3 && \ | ||||
|     dnf -y update && dnf -y upgrade && \ | ||||
|  | ||||
|     dnf builddep -y mutter && \ | ||||
|  | ||||
|     # Until Fedora catches up with meson build-deps | ||||
|     dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \ | ||||
|  | ||||
|     # For running unit tests | ||||
|     dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 && \ | ||||
|     # Until Fedora catches up with mesa bug fixes | ||||
|     dnf upgrade -y mesa-dri-drivers mesa-libEGL && \ | ||||
|  | ||||
|     # Unpackaged versions | ||||
|     dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \ | ||||
|     # For running unit tests | ||||
|     dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \ | ||||
|  | ||||
|     dnf install -y sysprof-devel && \ | ||||
|  | ||||
|     dnf install -y intltool redhat-rpm-config make && \ | ||||
|  | ||||
|     # GNOME Shell | ||||
|     dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \ | ||||
|     # New dep this cycle | ||||
|     dnf install -y 'pkgconfig(gnome-autoar-0)' && \ | ||||
|     dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \ | ||||
|     dnf remove -y --noautoremove mutter mutter-devel && \ | ||||
|  | ||||
|     dnf clean all | ||||
|   | ||||
							
								
								
									
										35
									
								
								.gitlab-ci/checkout-gnome-shell.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								.gitlab-ci/checkout-gnome-shell.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| #!/usr/bin/bash | ||||
|  | ||||
| mutter_branch=$(git describe --contains --all HEAD) | ||||
| gnome_shell_target= | ||||
|  | ||||
| git clone https://gitlab.gnome.org/GNOME/gnome-shell.git | ||||
|  | ||||
| if [ $? -ne 0 ]; then | ||||
|   echo Checkout failed | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| cd gnome-shell | ||||
|  | ||||
| if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then | ||||
|   merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell} | ||||
|   merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME | ||||
|  | ||||
|   echo Looking for $merge_request_branch on remote ... | ||||
|   if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then | ||||
|     gnome_shell_target=FETCH_HEAD | ||||
|   else | ||||
|     gnome_shell_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | ||||
|     echo Using $gnome_shell_target instead | ||||
|   fi | ||||
| fi | ||||
|  | ||||
| if [ -z "$gnome_shell_target" ]; then | ||||
|   gnome_shell_target=$(git branch -r -l origin/$mutter_branch) | ||||
|   gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})} | ||||
|   gnome_shell_target=${gnome_shell_target:-origin/master} | ||||
|   echo Using $gnome_shell_target instead | ||||
| fi | ||||
|  | ||||
| git checkout -q $gnome_shell_target | ||||
							
								
								
									
										145
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										145
									
								
								NEWS
									
									
									
									
									
								
							| @@ -1,3 +1,148 @@ | ||||
| 3.33.91 | ||||
| ======= | ||||
| * Fix primary selection copy and paste between X11 and wayland [Hans; #702] | ||||
| * Improve monitor hotplug support [Hans; !713] | ||||
| * Remove a source of frame skips [Daniel; !719] | ||||
| * Fix windows being lowered after unmaximizing with double click [Olivier; #88] | ||||
| * Remove Clutter API for global grabs [Jonas D.; !536] | ||||
| * Improve processing of incompressible events [Daniel; !711] | ||||
| * Add xdg-output v3 support [Olivier; !704] | ||||
| * Misc. bug fixes and cleanups [Jonas Å., Marco, Carlos, Adam, Albert, Niels, | ||||
|   Olivier, Florian; !722, !385, !728, !726, !500, !731, !727, !700, !735, !738] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Albert Vaca Cintora, Jonas Dreßler, Olivier Fourdan, | ||||
|   Carlos Garnacho, Hans de Goede, Niels De Graef, Adam Jackson, Florian Müllner, | ||||
|   Marco Trevisan (Treviño), Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Asier Sarasua Garmendia [eu], Kukuh Syafaat [id], Florentina Mușat [ro], | ||||
|   Aurimas Černius [lt], Daniel Mustieles [es] | ||||
|  | ||||
| 3.33.90 | ||||
| ======= | ||||
| * Fix visibility of clones with hidden source [Florian; #683] | ||||
| * Reduce freezes when opening some popup windows [Carlos; #556] | ||||
| * Be more thorough when excluding obscured areas from painting [Carlos; !698] | ||||
| * Make it possible to start Xwayland on demand [Carlos; !709] | ||||
| * clutter: Expose layout_manager to transitions [Florian; !716] | ||||
| * Misc. bug fixes and cleanups [Mark, Florian, Iain, Niels, Carlos, Ray; !671, | ||||
|   !691, !694, !696, !703, !707, !697, !710, !708, !714, #719, !721] | ||||
|  | ||||
| Contributors: | ||||
|   Mark Blakeney, Carlos Garnacho, Niels De Graef, Iain Lane, Florian Müllner, | ||||
|   Ray Strode | ||||
|  | ||||
| Translators: | ||||
|   Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR], Fabio Tomat [fur], | ||||
|   Florentina Mușat [ro] | ||||
|  | ||||
| 3.33.4 | ||||
| ====== | ||||
| * Discard page flip retries on hotplug [Jonas; !630] | ||||
| * Add xdg-output v2 support [Olivier; #645] | ||||
| * Restore DRM format fallbacks [Jonas; !662] | ||||
| * Don't emit ::size-changed when only position changed [Daniel; !568] | ||||
| * Expose workspace layout properties [Florian; !618] | ||||
| * Don't use grab modifiers when shortcuts are inhibited [Olivier; #642] | ||||
| * Fix stuttering due to unchanged power save mode notifications [Georges; !674] | ||||
| * Add API to reorder workspaces [Adam; !670] | ||||
| * Make picking a new focus window more reliable [Marco; !669] | ||||
| * Defer actor allocation till shown [Carlos; !677] | ||||
| * Try to use primary GPU for copy instead of glReadPixels [Pekka; !615] | ||||
| * Unset pointer focus when the cursor is hidden [Jonas D.; !448] | ||||
| * Fix modifier-drag on wayland subsurfaces [Robert; !604] | ||||
| * Fix background corruption on Nvidia after resuming from suspend [Daniel; !600] | ||||
| * Only grab the locate-pointer key when necessary [Olivier; !685, #647] | ||||
| * Misc. bug fixes and cleanups [Florian, Jonas, Daniel, Robert, Olivier, | ||||
|   Georges, Marco, Carlos, Emmanuele; !648, !650, !647, !656, !658, !637, | ||||
|   !663, !660, !659, !665, !666, !668, !667, #667, !676, !678, #672, !680, | ||||
|   !683, !688, !689, !687] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Emmanuele Bassi, Adam Bieńkowski, Piotr Drąg, Jonas Dreßler, | ||||
|   Olivier Fourdan, Carlos Garnacho, Robert Mader, Florian Müllner, | ||||
|   Georges Basile Stavracas Neto, Pekka Paalanen, Marco Trevisan (Treviño), | ||||
|   Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Fabio Tomat [fur], Kukuh Syafaat [id] | ||||
|  | ||||
| 3.33.3 | ||||
| ====== | ||||
| * Prepare for running Xwayland on demand [Carlos; !420] | ||||
| * Fix text selection color rendering [Florian; #494] | ||||
| * Fix black shadows when using fractional scaling [Robert; #609] | ||||
| * Honor startup sequence workspace on wayland [Carlos; gnome-shell#674] | ||||
| * Only emit 'grab-op-end` signal after dropping grabs [Marco; !596] | ||||
| * Add a Sysprof-based profiler [Jonas, Georges; !197, !603] | ||||
| * Relax "xwayland-allow-grabs" setting [Olivier; #597] | ||||
| * Implement locate-pointer accessibility feature [Olivier; !453] | ||||
| * Implement mouse accessibility [Olivier; !512] | ||||
| * Consolidate frame throttling [Daniel, Georges; !363] | ||||
| * Fix setting blank cursor under wayland [Jonas; #630] | ||||
| * Pixel-align OpenGL cursors [Jonas; !610] | ||||
| * Handle returning from fullscreen/maximization better [Jonas; !621] | ||||
| * Improve screencast support on multi-monitor systems [Georges; !623] | ||||
| * Fix running X11 applications with sudo under wayland [Hans; #643] | ||||
| * Implement toggle-keys notification [Olivier; #637] | ||||
| * Add initial KMS transactional support [Jonas; !525] | ||||
| * Improve finding new focus window when the old one is closed [Marco; #308] | ||||
| * Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert, | ||||
|   Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin; | ||||
|   !591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601, | ||||
|   #568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627, | ||||
|   !628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede, | ||||
|   Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner, | ||||
|   Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno, | ||||
|   Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr] | ||||
|  | ||||
| 3.33.2 | ||||
| ====== | ||||
| * Fix rendering lag on Xorg [Daniel; !520, !281] | ||||
| * Misc. bug fixes and cleanups [Carlos, Marco, Jonas D., Florian, Niels, | ||||
|   Daniel, Benjamin, Jonas Å., Ignacio, Vasilis; #598, !576, !547, !578, | ||||
|   !583, !582, !469, !524, !119, !571, !584, !585, !586, #425] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Benjamin Berg, Jonas Dreßler, Carlos Garnacho, Niels De Graef, | ||||
|   Vasilis Liaskovitis, Florian Müllner, Ignacio Casal Quinteiro, | ||||
|   Marco Trevisan (Treviño), Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Daniel Mustieles [es] | ||||
|  | ||||
| 3.33.1 | ||||
| ====== | ||||
| * Remove unused APIs and outdated driver support | ||||
|   [Adam; !481, !468, !489, !487, !546] | ||||
| * Enable EGL_IMG_context_priority [Adam; !454] | ||||
| * Disable mouse keys with Numlock on [Olivier; #530] | ||||
| * Fix crash when restarting on X11 [Marco; #576] | ||||
| * Implement clipboard manager [Carlos; !320] | ||||
| * Fix spurious idle signals that prevent session unblank [Jonas Å.; !543] | ||||
| * Fix mapping of touchscreens that don't report dimensions [Carlos; #581] | ||||
| * Fix propagating fractional scaling factor [Robert; !537] | ||||
| * Add experimental RT scheduling support [Carlos; !460] | ||||
| * Misc. bug fixes and cleanups [Robert, Carlos, Olivier, Ray, Marco, Jonas D., | ||||
|   Georges, Daniel V., Daniel M; !467, !504, !551, !552, #575, #556, !557, !442, | ||||
|   !562, !535, !548, #586, !567, !396, !422, !507] | ||||
|  | ||||
| Contributors: | ||||
|   Jonas Ådahl, Piotr Drąg, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho, | ||||
|   Adam Jackson, Robert Mader, Daniel García Moreno, Florian Müllner, | ||||
|   Georges Basile Stavracas Neto, Ray Strode, Marco Trevisan (Treviño), | ||||
|   Daniel van Vugt | ||||
|  | ||||
| Translators: | ||||
|   Daniel Mustieles [es], Fabio Tomat [fur], Kukuh Syafaat [id] | ||||
|  | ||||
| 3.32.1 | ||||
| ====== | ||||
| * Fix fallback app menu on wayland [Florian; #493] | ||||
|   | ||||
| @@ -737,11 +737,7 @@ cally_actor_grab_focus (AtkComponent    *component) | ||||
|  * | ||||
|  * This gets the top level origin, it is, the position of the stage in | ||||
|  * the global screen. You can see it as the absolute display position | ||||
|  * of the stage. | ||||
|  * | ||||
|  * FIXME: only the case with x11 is implemented, other backends are | ||||
|  * required | ||||
|  * | ||||
|  * of the stage. This is 0,0 for a compositor. | ||||
|  */ | ||||
| void | ||||
| _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||
| @@ -749,54 +745,11 @@ _cally_actor_get_top_level_origin (ClutterActor *actor, | ||||
|                                    gint         *yp) | ||||
| { | ||||
|   /* default values */ | ||||
|   gint x = 0; | ||||
|   gint y = 0; | ||||
|  | ||||
| #ifdef CLUTTER_WINDOWING_X11 | ||||
|   if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) | ||||
|     { | ||||
|       ClutterActor *stage      = NULL; | ||||
|       Display *display    = NULL; | ||||
|       Window root_window; | ||||
|       Window stage_window; | ||||
|       Window child; | ||||
|       gint return_val = 0; | ||||
|  | ||||
|       stage = clutter_actor_get_stage (actor); | ||||
|  | ||||
|       /* FIXME: what happens if you use another display with | ||||
|          clutter_backend_x11_set_display ?*/ | ||||
|       display = clutter_x11_get_default_display (); | ||||
|       root_window = clutter_x11_get_root_window (); | ||||
|       stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage)); | ||||
|  | ||||
|       return_val = XTranslateCoordinates (display, stage_window, root_window, | ||||
|                                           0, 0, &x, &y, | ||||
|                                           &child); | ||||
|  | ||||
|       if (!return_val) | ||||
|         g_warning ("[x11] We were not able to get proper absolute " | ||||
|                    "position of the stage"); | ||||
|     } | ||||
|   else | ||||
| #endif | ||||
|     { | ||||
|       static gboolean yet_warned = FALSE; | ||||
|  | ||||
|       if (!yet_warned) | ||||
|         { | ||||
|           yet_warned = TRUE; | ||||
|  | ||||
|           g_warning ("The current Clutter backend does not support using " | ||||
|                      "atk_component_get_extents() with ATK_XY_SCREEN."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (xp) | ||||
|     *xp = x; | ||||
|     *xp = 0; | ||||
|  | ||||
|   if (yp) | ||||
|     *yp = y; | ||||
|     *yp = 0; | ||||
| } | ||||
|  | ||||
| /* AtkAction implementation */ | ||||
| @@ -1044,10 +997,8 @@ _cally_actor_clean_action_list (CallyActor *cally_actor) | ||||
|  | ||||
|   if (priv->action_list) | ||||
|     { | ||||
|       g_list_foreach (priv->action_list, | ||||
|                       (GFunc) _cally_actor_destroy_action_info, | ||||
|                       NULL); | ||||
|       g_list_free (priv->action_list); | ||||
|       g_list_free_full (priv->action_list, | ||||
|                         (GDestroyNotify) _cally_actor_destroy_action_info); | ||||
|       priv->action_list = NULL; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -577,8 +577,7 @@ _clutter_meta_group_clear_metas (ClutterMetaGroup *group) | ||||
| { | ||||
|   g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL); | ||||
|  | ||||
|   g_list_foreach (group->meta, (GFunc) g_object_unref, NULL); | ||||
|   g_list_free (group->meta); | ||||
|   g_list_free_full (group->meta, g_object_unref); | ||||
|   group->meta = NULL; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -297,8 +297,6 @@ const gchar *                   _clutter_actor_get_debug_name | ||||
| void                            _clutter_actor_push_clone_paint                         (void); | ||||
| void                            _clutter_actor_pop_clone_paint                          (void); | ||||
|  | ||||
| guint32                         _clutter_actor_get_pick_id                              (ClutterActor *self); | ||||
|  | ||||
| void                            _clutter_actor_shader_pre_paint                         (ClutterActor *actor, | ||||
|                                                                                          gboolean      repeat); | ||||
| void                            _clutter_actor_shader_post_paint                        (ClutterActor *actor); | ||||
|   | ||||
| @@ -433,7 +433,7 @@ | ||||
|  * | ||||
|  * #ClutterActor allows accessing properties of #ClutterAction, | ||||
|  * #ClutterEffect, and #ClutterConstraint instances associated to an actor | ||||
|  * instance for animation purposes. | ||||
|  * instance for animation purposes, as well as its #ClutterLayoutManager. | ||||
|  * | ||||
|  * In order to access a specific #ClutterAction or a #ClutterConstraint | ||||
|  * property it is necessary to set the #ClutterActorMeta:name property on the | ||||
| @@ -457,6 +457,13 @@ | ||||
|  * on the `origin` actor, and in its initial state is overlapping the actor | ||||
|  * to which is bound to. | ||||
|  * | ||||
|  * As the actor has only one #ClutterLayoutManager, the syntax for accessing its | ||||
|  * properties is simpler: | ||||
|  * | ||||
|  * |[ | ||||
|  *   @layout.<property-name> | ||||
|  * ]| | ||||
|  * | ||||
|  * |[<!-- language="C" --> | ||||
|  * constraint = clutter_bind_constraint_new (origin, CLUTTER_BIND_X, 0.0); | ||||
|  * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), "bind-x"); | ||||
| @@ -729,8 +736,6 @@ struct _ClutterActorPrivate | ||||
|  | ||||
|   gchar *name; /* a non-unique name, used for debugging */ | ||||
|  | ||||
|   gint32 pick_id; /* per-stage unique id, used for picking */ | ||||
|  | ||||
|   /* a back-pointer to the Pango context that we can use | ||||
|    * to create pre-configured PangoLayout | ||||
|    */ | ||||
| @@ -1283,6 +1288,106 @@ clutter_actor_verify_map_state (ClutterActor *self) | ||||
|  | ||||
| #endif /* CLUTTER_ENABLE_DEBUG */ | ||||
|  | ||||
| static gboolean | ||||
| _clutter_actor_transform_local_box_to_stage (ClutterActor          *self, | ||||
|                                              ClutterStage          *stage, | ||||
|                                              const ClutterActorBox *box, | ||||
|                                              ClutterPoint           vertices[4]) | ||||
| { | ||||
|   CoglFramebuffer *fb = cogl_get_draw_framebuffer (); | ||||
|   CoglMatrix stage_transform, inv_stage_transform; | ||||
|   CoglMatrix modelview, transform_to_stage; | ||||
|   int v; | ||||
|  | ||||
|   clutter_actor_get_transform (CLUTTER_ACTOR (stage), &stage_transform); | ||||
|   if (!cogl_matrix_get_inverse (&stage_transform, &inv_stage_transform)) | ||||
|     return FALSE; | ||||
|   cogl_framebuffer_get_modelview_matrix (fb, &modelview); | ||||
|   cogl_matrix_multiply (&transform_to_stage, &inv_stage_transform, &modelview); | ||||
|  | ||||
|   vertices[0].x = box->x1; | ||||
|   vertices[0].y = box->y1; | ||||
|  | ||||
|   vertices[1].x = box->x2; | ||||
|   vertices[1].y = box->y1; | ||||
|  | ||||
|   vertices[2].x = box->x2; | ||||
|   vertices[2].y = box->y2; | ||||
|  | ||||
|   vertices[3].x = box->x1; | ||||
|   vertices[3].y = box->y2; | ||||
|  | ||||
|   for (v = 0; v < 4; v++) | ||||
|     { | ||||
|       float z = 0.f; | ||||
|       float w = 1.f; | ||||
|  | ||||
|       cogl_matrix_transform_point (&transform_to_stage, | ||||
|                                    &vertices[v].x, | ||||
|                                    &vertices[v].y, | ||||
|                                    &z, | ||||
|                                    &w); | ||||
|     } | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_actor_pick_box: | ||||
|  * @self: The #ClutterActor being "pick" painted. | ||||
|  * @box: A rectangle in the actor's own local coordinates. | ||||
|  * | ||||
|  * Logs (does a virtual paint of) a rectangle for picking. Note that @box is | ||||
|  * in the actor's own local coordinates, so is usually {0,0,width,height} | ||||
|  * to include the whole actor. That is unless the actor has a shaped input | ||||
|  * region in which case you may wish to log the (multiple) smaller rectangles | ||||
|  * that make up the input region. | ||||
|  */ | ||||
| void | ||||
| clutter_actor_pick_box (ClutterActor          *self, | ||||
|                         const ClutterActorBox *box) | ||||
| { | ||||
|   ClutterStage *stage; | ||||
|   ClutterPoint vertices[4]; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_ACTOR (self)); | ||||
|   g_return_if_fail (box != NULL); | ||||
|  | ||||
|   /* An empty box to a "pick" paint means to paint nothing at all. */ | ||||
|   if (box->x1 >= box->x2 || box->y1 >= box->y2) | ||||
|     return; | ||||
|  | ||||
|   stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|   if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices)) | ||||
|     _clutter_stage_log_pick (stage, vertices, self); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| _clutter_actor_push_pick_clip (ClutterActor          *self, | ||||
|                                const ClutterActorBox *clip) | ||||
| { | ||||
|   ClutterStage *stage; | ||||
|   ClutterPoint vertices[4]; | ||||
|  | ||||
|   stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|   if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices)) | ||||
|     return FALSE; | ||||
|  | ||||
|   _clutter_stage_push_pick_clip (stage, vertices); | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| _clutter_actor_pop_pick_clip (ClutterActor *self) | ||||
| { | ||||
|   ClutterActor *stage; | ||||
|  | ||||
|   stage = _clutter_actor_get_stage_internal (self); | ||||
|   _clutter_stage_pop_pick_clip (CLUTTER_STAGE (stage)); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_actor_set_mapped (ClutterActor *self, | ||||
|                           gboolean      mapped) | ||||
| @@ -1511,8 +1616,7 @@ clutter_actor_update_map_state (ClutterActor  *self, | ||||
| static void | ||||
| clutter_actor_real_map (ClutterActor *self) | ||||
| { | ||||
|   ClutterActorPrivate *priv = self->priv; | ||||
|   ClutterActor *stage, *iter; | ||||
|   ClutterActor *iter; | ||||
|  | ||||
|   g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); | ||||
|  | ||||
| @@ -1523,13 +1627,6 @@ clutter_actor_real_map (ClutterActor *self) | ||||
|  | ||||
|   self->priv->needs_paint_volume_update = TRUE; | ||||
|  | ||||
|   stage = _clutter_actor_get_stage_internal (self); | ||||
|   priv->pick_id = _clutter_stage_acquire_pick_id (CLUTTER_STAGE (stage), self); | ||||
|  | ||||
|   CLUTTER_NOTE (ACTOR, "Pick id '%d' for actor '%s'", | ||||
|                 priv->pick_id, | ||||
|                 _clutter_actor_get_debug_name (self)); | ||||
|  | ||||
|   clutter_actor_ensure_resource_scale (self); | ||||
|  | ||||
|   /* notify on parent mapped before potentially mapping | ||||
| @@ -1634,11 +1731,6 @@ clutter_actor_real_unmap (ClutterActor *self) | ||||
|  | ||||
|       stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); | ||||
|  | ||||
|       if (stage != NULL) | ||||
|         _clutter_stage_release_pick_id (stage, priv->pick_id); | ||||
|  | ||||
|       priv->pick_id = -1; | ||||
|  | ||||
|       if (stage != NULL && | ||||
|           clutter_stage_get_key_focus (stage) == self) | ||||
|         { | ||||
| @@ -2257,46 +2349,16 @@ static void | ||||
| clutter_actor_real_pick (ClutterActor       *self, | ||||
| 			 const ClutterColor *color) | ||||
| { | ||||
|   CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); | ||||
|  | ||||
|   /* the default implementation is just to paint a rectangle | ||||
|    * with the same size of the actor using the passed color | ||||
|    */ | ||||
|   if (clutter_actor_should_pick_paint (self)) | ||||
|     { | ||||
|       static CoglPipeline *default_pick_pipeline = NULL; | ||||
|       ClutterActorBox box = { 0, }; | ||||
|       CoglPipeline *pick_pipeline; | ||||
|       float width, height; | ||||
|       ClutterActorBox box = { | ||||
|         .x1 = 0, | ||||
|         .y1 = 0, | ||||
|         .x2 = clutter_actor_get_width (self), | ||||
|         .y2 = clutter_actor_get_height (self), | ||||
|       }; | ||||
|  | ||||
|       if (G_UNLIKELY (default_pick_pipeline == NULL)) | ||||
|         { | ||||
|           CoglContext *ctx = | ||||
|             clutter_backend_get_cogl_context (clutter_get_default_backend ()); | ||||
|  | ||||
|           default_pick_pipeline = cogl_pipeline_new (ctx); | ||||
|         } | ||||
|  | ||||
|       g_assert (default_pick_pipeline != NULL); | ||||
|       pick_pipeline = cogl_pipeline_copy (default_pick_pipeline); | ||||
|  | ||||
|       clutter_actor_get_allocation_box (self, &box); | ||||
|  | ||||
|       width = box.x2 - box.x1; | ||||
|       height = box.y2 - box.y1; | ||||
|  | ||||
|       cogl_pipeline_set_color4ub (pick_pipeline, | ||||
|                                   color->red, | ||||
|                                   color->green, | ||||
|                                   color->blue, | ||||
|                                   color->alpha); | ||||
|  | ||||
|       cogl_framebuffer_draw_rectangle (framebuffer, | ||||
|                                        pick_pipeline, | ||||
|                                        0, 0, | ||||
|                                        width, height); | ||||
|  | ||||
|       cogl_object_unref (pick_pipeline); | ||||
|       clutter_actor_pick_box (self, &box); | ||||
|     } | ||||
|  | ||||
|   /* XXX - this thoroughly sucks, but we need to maintain compatibility | ||||
| @@ -3587,15 +3649,6 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self) | ||||
|   priv->last_paint_volume_valid = TRUE; | ||||
| } | ||||
|  | ||||
| guint32 | ||||
| _clutter_actor_get_pick_id (ClutterActor *self) | ||||
| { | ||||
|   if (self->priv->pick_id < 0) | ||||
|     return 0; | ||||
|  | ||||
|   return self->priv->pick_id; | ||||
| } | ||||
|  | ||||
| /* This is the same as clutter_actor_add_effect except that it doesn't | ||||
|    queue a redraw and it doesn't notify on the effect property */ | ||||
| static void | ||||
| @@ -3827,6 +3880,7 @@ clutter_actor_paint (ClutterActor *self) | ||||
| { | ||||
|   ClutterActorPrivate *priv; | ||||
|   ClutterPickMode pick_mode; | ||||
|   ClutterActorBox clip; | ||||
|   gboolean clip_set = FALSE; | ||||
|   ClutterStage *stage; | ||||
|  | ||||
| @@ -3920,26 +3974,40 @@ clutter_actor_paint (ClutterActor *self) | ||||
|  | ||||
|   if (priv->has_clip) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       cogl_framebuffer_push_rectangle_clip (fb, | ||||
|                                             priv->clip.origin.x, | ||||
|                                             priv->clip.origin.y, | ||||
|                                             priv->clip.origin.x + priv->clip.size.width, | ||||
|                                             priv->clip.origin.y + priv->clip.size.height); | ||||
|       clip.x1 = priv->clip.origin.x; | ||||
|       clip.y1 = priv->clip.origin.y; | ||||
|       clip.x2 = priv->clip.origin.x + priv->clip.size.width; | ||||
|       clip.y2 = priv->clip.origin.y + priv->clip.size.height; | ||||
|       clip_set = TRUE; | ||||
|     } | ||||
|   else if (priv->clip_to_allocation) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       gfloat width, height; | ||||
|  | ||||
|       width  = priv->allocation.x2 - priv->allocation.x1; | ||||
|       height = priv->allocation.y2 - priv->allocation.y1; | ||||
|  | ||||
|       cogl_framebuffer_push_rectangle_clip (fb, 0, 0, width, height); | ||||
|       clip.x1 = 0.f; | ||||
|       clip.y1 = 0.f; | ||||
|       clip.x2 = priv->allocation.x2 - priv->allocation.x1; | ||||
|       clip.y2 = priv->allocation.y2 - priv->allocation.y1; | ||||
|       clip_set = TRUE; | ||||
|     } | ||||
|  | ||||
|   if (clip_set) | ||||
|     { | ||||
|       if (pick_mode == CLUTTER_PICK_NONE) | ||||
|         { | ||||
|           CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|  | ||||
|           cogl_framebuffer_push_rectangle_clip (fb, | ||||
|                                                 clip.x1, | ||||
|                                                 clip.y1, | ||||
|                                                 clip.x2, | ||||
|                                                 clip.y2); | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           if (!_clutter_actor_push_pick_clip (self, &clip)) | ||||
|             clip_set = FALSE; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (pick_mode == CLUTTER_PICK_NONE) | ||||
|     { | ||||
|       /* We check whether we need to add the flatten effect before | ||||
| @@ -4018,9 +4086,16 @@ clutter_actor_paint (ClutterActor *self) | ||||
| done: | ||||
|   if (clip_set) | ||||
|     { | ||||
|       CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|       if (pick_mode == CLUTTER_PICK_NONE) | ||||
|         { | ||||
|           CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage); | ||||
|  | ||||
|       cogl_framebuffer_pop_clip (fb); | ||||
|           cogl_framebuffer_pop_clip (fb); | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           _clutter_actor_pop_pick_clip (self); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   cogl_pop_matrix (); | ||||
| @@ -4091,11 +4166,12 @@ clutter_actor_continue_paint (ClutterActor *self) | ||||
|         { | ||||
|           ClutterColor col = { 0, }; | ||||
|  | ||||
|           _clutter_id_to_color (_clutter_actor_get_pick_id (self), &col); | ||||
|  | ||||
|           /* Actor will then paint silhouette of itself in supplied | ||||
|            * color.  See clutter_stage_get_actor_at_pos() for where | ||||
|            * picking is enabled. | ||||
|           /* The actor will log a silhouette of itself to the stage pick log. | ||||
|            * Note that the picking color is no longer used as the "log" instead | ||||
|            * keeps a weak pointer to the actor itself. But we keep the color | ||||
|            * parameter for now so as to maintain ABI compatibility. The color | ||||
|            * parameter can be removed when someone feels like breaking the ABI | ||||
|            * along with gnome-shell. | ||||
|            * | ||||
|            * XXX:2.0 - Call the pick() virtual directly | ||||
|            */ | ||||
| @@ -7998,8 +8074,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, destroy), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::show: | ||||
| @@ -8015,8 +8090,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, show), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::hide: | ||||
| @@ -8032,8 +8106,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, hide), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::parent-set: | ||||
| @@ -8049,8 +8122,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, parent_set), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -8118,6 +8190,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_BOOLEAN, 2, | ||||
|                   CLUTTER_TYPE_ACTOR, | ||||
|                   CLUTTER_TYPE_PAINT_VOLUME); | ||||
|   g_signal_set_va_marshaller (actor_signals[QUEUE_REDRAW], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__OBJECT_BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::queue-relayout: | ||||
| @@ -8142,8 +8217,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_SIGNAL_RUN_LAST | | ||||
|                   G_SIGNAL_NO_HOOKS, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, queue_relayout), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8170,6 +8244,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::button-press-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8192,6 +8269,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[BUTTON_PRESS_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::button-release-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8214,6 +8294,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[BUTTON_RELEASE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::scroll-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8236,6 +8319,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[SCROLL_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::key-press-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8258,6 +8344,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[KEY_PRESS_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::key-release-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8281,6 +8370,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[KEY_RELEASE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|   /** | ||||
|    * ClutterActor::motion-event: | ||||
|    * @actor: the actor which received the event | ||||
| @@ -8303,6 +8395,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[MOTION_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::key-focus-in: | ||||
| @@ -8317,8 +8412,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, key_focus_in), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8334,8 +8428,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterActorClass, key_focus_out), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8359,6 +8452,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[ENTER_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::leave-event: | ||||
| @@ -8381,6 +8477,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[LEAVE_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::captured-event: | ||||
| @@ -8409,6 +8508,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[CAPTURED_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::paint: | ||||
| @@ -8439,8 +8541,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_SIGNAL_NO_HOOKS | | ||||
|                   G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, paint), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::realize: | ||||
| @@ -8459,8 +8560,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, realize), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterActor::unrealize: | ||||
| @@ -8479,8 +8579,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, unrealize), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8508,8 +8607,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
|                   G_STRUCT_OFFSET (ClutterActorClass, pick), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__BOXED, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|  | ||||
| @@ -8538,6 +8636,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   CLUTTER_TYPE_ACTOR_BOX | G_SIGNAL_TYPE_STATIC_SCOPE, | ||||
|                   CLUTTER_TYPE_ALLOCATION_FLAGS); | ||||
|   g_signal_set_va_marshaller (actor_signals[ALLOCATION_CHANGED], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_VOID__BOXED_FLAGSv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::transitions-completed: | ||||
| @@ -8553,8 +8654,7 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -8582,6 +8682,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   G_TYPE_STRING, | ||||
|                   G_TYPE_BOOLEAN); | ||||
|   g_signal_set_va_marshaller (actor_signals[TRANSITION_STOPPED], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_VOID__STRING_BOOLEANv); | ||||
|  | ||||
|   /** | ||||
|    * ClutterActor::touch-event: | ||||
| @@ -8605,6 +8708,9 @@ clutter_actor_class_init (ClutterActorClass *klass) | ||||
| 		  _clutter_marshal_BOOLEAN__BOXED, | ||||
| 		  G_TYPE_BOOLEAN, 1, | ||||
| 		  CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|   g_signal_set_va_marshaller (actor_signals[TOUCH_EVENT], | ||||
|                               G_TYPE_FROM_CLASS (object_class), | ||||
|                               _clutter_marshal_BOOLEAN__BOXEDv); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -8614,8 +8720,6 @@ clutter_actor_init (ClutterActor *self) | ||||
|  | ||||
|   self->priv = priv = clutter_actor_get_instance_private (self); | ||||
|  | ||||
|   priv->pick_id = -1; | ||||
|  | ||||
|   priv->opacity = 0xff; | ||||
|   priv->show_on_set_parent = TRUE; | ||||
|   priv->resource_scale = -1.0f; | ||||
| @@ -8849,9 +8953,9 @@ _clutter_actor_queue_redraw_full (ClutterActor             *self, | ||||
|    * | ||||
|    * later during _clutter_stage_do_update(), once relayouting is done | ||||
|    * and the scenegraph has been updated we will call: | ||||
|    * _clutter_stage_finish_queue_redraws(). | ||||
|    * clutter_stage_maybe_finish_queue_redraws(). | ||||
|    * | ||||
|    * _clutter_stage_finish_queue_redraws() will call | ||||
|    * clutter_stage_maybe_finish_queue_redraws() will call | ||||
|    * _clutter_actor_finish_queue_redraw() for each listed actor. | ||||
|    * | ||||
|    * Note: actors *are* allowed to queue further redraws during this | ||||
| @@ -10107,6 +10211,9 @@ clutter_actor_allocate (ClutterActor           *self, | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (!clutter_actor_is_visible (self)) | ||||
|     return; | ||||
|  | ||||
|   priv = self->priv; | ||||
|  | ||||
|   old_allocation = priv->allocation; | ||||
| @@ -14916,6 +15023,30 @@ clutter_scriptable_iface_init (ClutterScriptableIface *iface) | ||||
|   iface->set_custom_property = clutter_actor_set_custom_property; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| get_layout_from_animation_property (ClutterActor  *actor, | ||||
|                                     const gchar   *name, | ||||
|                                     gchar        **name_p) | ||||
| { | ||||
|   g_auto (GStrv) tokens = NULL; | ||||
|  | ||||
|   if (!g_str_has_prefix (name, "@layout")) | ||||
|     return FALSE; | ||||
|  | ||||
|   tokens = g_strsplit (name, ".", -1); | ||||
|   if (tokens == NULL || g_strv_length (tokens) != 2) | ||||
|     { | ||||
|       CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'", | ||||
|                     name + 1); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   if (name_p != NULL) | ||||
|     *name_p = g_strdup (tokens[1]); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static ClutterActorMeta * | ||||
| get_meta_from_animation_property (ClutterActor  *actor, | ||||
|                                   const gchar   *name, | ||||
| @@ -14978,19 +15109,32 @@ static GParamSpec * | ||||
| clutter_actor_find_property (ClutterAnimatable *animatable, | ||||
|                              const gchar       *property_name) | ||||
| { | ||||
|   ClutterActor *actor = CLUTTER_ACTOR (animatable); | ||||
|   ClutterActorMeta *meta = NULL; | ||||
|   GObjectClass *klass = NULL; | ||||
|   GParamSpec *pspec = NULL; | ||||
|   gchar *p_name = NULL; | ||||
|   gboolean use_layout; | ||||
|  | ||||
|   meta = get_meta_from_animation_property (CLUTTER_ACTOR (animatable), | ||||
|                                            property_name, | ||||
|                                            &p_name); | ||||
|   use_layout = get_layout_from_animation_property (actor, | ||||
|                                                    property_name, | ||||
|                                                    &p_name); | ||||
|  | ||||
|   if (!use_layout) | ||||
|     meta = get_meta_from_animation_property (actor, | ||||
|                                              property_name, | ||||
|                                              &p_name); | ||||
|  | ||||
|   if (meta != NULL) | ||||
|     { | ||||
|       klass = G_OBJECT_GET_CLASS (meta); | ||||
|  | ||||
|       pspec = g_object_class_find_property (klass, p_name); | ||||
|     } | ||||
|   else if (use_layout) | ||||
|     { | ||||
|       klass = G_OBJECT_GET_CLASS (actor->priv->layout_manager); | ||||
|  | ||||
|       pspec = g_object_class_find_property (klass, p_name); | ||||
|     } | ||||
|   else | ||||
| @@ -15010,15 +15154,24 @@ clutter_actor_get_initial_state (ClutterAnimatable *animatable, | ||||
|                                  const gchar       *property_name, | ||||
|                                  GValue            *initial) | ||||
| { | ||||
|   ClutterActor *actor = CLUTTER_ACTOR (animatable); | ||||
|   ClutterActorMeta *meta = NULL; | ||||
|   gchar *p_name = NULL; | ||||
|   gboolean use_layout; | ||||
|  | ||||
|   meta = get_meta_from_animation_property (CLUTTER_ACTOR (animatable), | ||||
|                                            property_name, | ||||
|                                            &p_name); | ||||
|   use_layout = get_layout_from_animation_property (actor, | ||||
|                                                    property_name, | ||||
|                                                    &p_name); | ||||
|  | ||||
|   if (!use_layout) | ||||
|     meta = get_meta_from_animation_property (actor, | ||||
|                                              property_name, | ||||
|                                              &p_name); | ||||
|  | ||||
|   if (meta != NULL) | ||||
|     g_object_get_property (G_OBJECT (meta), p_name, initial); | ||||
|   else if (use_layout) | ||||
|     g_object_get_property (G_OBJECT (actor->priv->layout_manager), p_name, initial); | ||||
|   else | ||||
|     g_object_get_property (G_OBJECT (animatable), property_name, initial); | ||||
|  | ||||
| @@ -15171,12 +15324,21 @@ clutter_actor_set_final_state (ClutterAnimatable *animatable, | ||||
|   ClutterActor *actor = CLUTTER_ACTOR (animatable); | ||||
|   ClutterActorMeta *meta = NULL; | ||||
|   gchar *p_name = NULL; | ||||
|   gboolean use_layout; | ||||
|  | ||||
|   use_layout = get_layout_from_animation_property (actor, | ||||
|                                                    property_name, | ||||
|                                                    &p_name); | ||||
|  | ||||
|   if (!use_layout) | ||||
|     meta = get_meta_from_animation_property (actor, | ||||
|                                              property_name, | ||||
|                                              &p_name); | ||||
|  | ||||
|   meta = get_meta_from_animation_property (actor, | ||||
|                                            property_name, | ||||
|                                            &p_name); | ||||
|   if (meta != NULL) | ||||
|     g_object_set_property (G_OBJECT (meta), p_name, final); | ||||
|   else if (use_layout) | ||||
|     g_object_set_property (G_OBJECT (actor->priv->layout_manager), p_name, final); | ||||
|   else | ||||
|     { | ||||
|       GObjectClass *obj_class = G_OBJECT_GET_CLASS (animatable); | ||||
| @@ -17551,7 +17713,7 @@ _clutter_actor_get_paint_volume_real (ClutterActor *self, | ||||
|                l != NULL && l->data != priv->current_effect; | ||||
|                l = l->next) | ||||
|             { | ||||
|               if (!_clutter_effect_get_paint_volume (l->data, pv)) | ||||
|               if (!_clutter_effect_modify_paint_volume (l->data, pv)) | ||||
|                 { | ||||
|                   clutter_paint_volume_free (pv); | ||||
|                   CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): " | ||||
| @@ -17569,7 +17731,7 @@ _clutter_actor_get_paint_volume_real (ClutterActor *self, | ||||
|           /* otherwise, get the cumulative volume */ | ||||
|           effects = _clutter_meta_group_peek_metas (priv->effects); | ||||
|           for (l = effects; l != NULL; l = l->next) | ||||
|             if (!_clutter_effect_get_paint_volume (l->data, pv)) | ||||
|             if (!_clutter_effect_modify_paint_volume (l->data, pv)) | ||||
|               { | ||||
|                 clutter_paint_volume_free (pv); | ||||
|                 CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): " | ||||
|   | ||||
| @@ -902,6 +902,10 @@ void                            clutter_actor_bind_model_with_properties | ||||
|                                                                                  const char                 *first_model_property, | ||||
|                                                                                  ...); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_actor_pick_box (ClutterActor          *self, | ||||
|                              const ClutterActorBox *box); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_ACTOR_H__ */ | ||||
|   | ||||
| @@ -50,7 +50,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref) | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref) | ||||
|   | ||||
| @@ -27,8 +27,6 @@ | ||||
| #include <clutter/clutter-keymap.h> | ||||
| #include <clutter/clutter-stage-window.h> | ||||
|  | ||||
| #include "clutter-event-translator.h" | ||||
|  | ||||
| #define CLUTTER_BACKEND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass)) | ||||
| #define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND)) | ||||
| #define CLUTTER_BACKEND_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendClass)) | ||||
| @@ -58,7 +56,7 @@ struct _ClutterBackend | ||||
|   gfloat units_per_em; | ||||
|   gint32 units_serial; | ||||
|  | ||||
|   GList *event_translators; | ||||
|   ClutterStageWindow *stage_window; | ||||
|  | ||||
|   ClutterInputMethod *input_method; | ||||
|  | ||||
| @@ -93,12 +91,6 @@ struct _ClutterBackendClass | ||||
|                                                 GError         **error); | ||||
|   ClutterDeviceManager *(* get_device_manager) (ClutterBackend  *backend); | ||||
|  | ||||
|   void                  (* copy_event_data)    (ClutterBackend     *backend, | ||||
|                                                 const ClutterEvent *src, | ||||
|                                                 ClutterEvent       *dest); | ||||
|   void                  (* free_event_data)    (ClutterBackend     *backend, | ||||
|                                                 ClutterEvent       *event); | ||||
|  | ||||
|   gboolean              (* translate_event)    (ClutterBackend     *backend, | ||||
|                                                 gpointer            native, | ||||
|                                                 ClutterEvent       *event); | ||||
| @@ -136,17 +128,11 @@ void                    _clutter_backend_copy_event_data                (Clutter | ||||
|                                                                          ClutterEvent           *dest); | ||||
| void                    _clutter_backend_free_event_data                (ClutterBackend         *backend, | ||||
|                                                                          ClutterEvent           *event); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_backend_translate_event                (ClutterBackend         *backend, | ||||
|                                                                          gpointer                native, | ||||
|                                                                          ClutterEvent           *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_backend_add_event_translator           (ClutterBackend         *backend, | ||||
|                                                                          ClutterEventTranslator *translator); | ||||
|  | ||||
| void                    _clutter_backend_remove_event_translator        (ClutterBackend         *backend, | ||||
|                                                                          ClutterEventTranslator *translator); | ||||
|  | ||||
| ClutterFeatureFlags     _clutter_backend_get_features                   (ClutterBackend         *backend); | ||||
|  | ||||
| gfloat                  _clutter_backend_get_units_per_em               (ClutterBackend         *backend, | ||||
| @@ -160,6 +146,9 @@ void                    _clutter_backend_reset_cogl_framebuffer         (Clutter | ||||
|  | ||||
| void                    clutter_set_allowed_drivers                     (const char             *drivers); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageWindow *    clutter_backend_get_stage_window                (ClutterBackend         *backend); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_BACKEND_PRIVATE_H__ */ | ||||
|   | ||||
| @@ -62,9 +62,6 @@ | ||||
| #ifdef CLUTTER_INPUT_X11 | ||||
| #include "x11/clutter-backend-x11.h" | ||||
| #endif | ||||
| #ifdef CLUTTER_INPUT_EVDEV | ||||
| #include "evdev/clutter-device-manager-evdev.h" | ||||
| #endif | ||||
| #ifdef CLUTTER_WINDOWING_EGL | ||||
| #include "egl/clutter-backend-eglnative.h" | ||||
| #endif | ||||
| @@ -104,10 +101,12 @@ clutter_backend_dispose (GObject *gobject) | ||||
|   /* clear the events still in the queue of the main context */ | ||||
|   _clutter_clear_events_queue (); | ||||
|  | ||||
|   /* remove all event translators */ | ||||
|   g_clear_pointer (&backend->event_translators, g_list_free); | ||||
|  | ||||
|   g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref); | ||||
|   if (backend->stage_window) | ||||
|     { | ||||
|       g_object_remove_weak_pointer (G_OBJECT (backend->stage_window), | ||||
|                                     (gpointer *) &backend->stage_window); | ||||
|     } | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject); | ||||
| } | ||||
| @@ -397,7 +396,7 @@ clutter_backend_real_create_context (ClutterBackend  *backend, | ||||
|       else | ||||
|         g_set_error_literal (error, CLUTTER_INIT_ERROR, | ||||
|                              CLUTTER_INIT_ERROR_BACKEND, | ||||
|                             _("Unable to initialize the Clutter backend: no available drivers found.")); | ||||
|                              "Unable to initialize the Clutter backend: no available drivers found."); | ||||
|  | ||||
|       return FALSE; | ||||
|     } | ||||
| @@ -526,40 +525,7 @@ _clutter_create_backend (void) | ||||
| static void | ||||
| clutter_backend_real_init_events (ClutterBackend *backend) | ||||
| { | ||||
|   const char *input_backend = NULL; | ||||
|  | ||||
|   input_backend = g_getenv ("CLUTTER_INPUT_BACKEND"); | ||||
|   if (input_backend != NULL) | ||||
|     input_backend = g_intern_string (input_backend); | ||||
|  | ||||
| #ifdef CLUTTER_INPUT_X11 | ||||
|   if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) && | ||||
|       (input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11))) | ||||
|     { | ||||
|       _clutter_backend_x11_events_init (backend); | ||||
|     } | ||||
|   else | ||||
| #endif | ||||
| #ifdef CLUTTER_INPUT_EVDEV | ||||
|   /* Evdev can be used regardless of the windowing system */ | ||||
|   if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0) | ||||
| #ifdef CLUTTER_WINDOWING_EGL | ||||
|       /* but we do want to always use it for EGL native */ | ||||
|       || clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL) | ||||
| #endif | ||||
|       ) | ||||
|     { | ||||
|       _clutter_events_evdev_init (backend); | ||||
|     } | ||||
|   else | ||||
| #endif | ||||
|   if (input_backend != NULL) | ||||
|     { | ||||
|       if (input_backend != I_(CLUTTER_INPUT_NULL)) | ||||
|         g_error ("Unrecognized input backend '%s'", input_backend); | ||||
|     } | ||||
|   else | ||||
|     g_error ("Unknown input backend"); | ||||
|   g_error ("Unknown input backend"); | ||||
| } | ||||
|  | ||||
| static ClutterDeviceManager * | ||||
| @@ -586,34 +552,6 @@ clutter_backend_real_get_keymap (ClutterBackend *backend) | ||||
|   return backend->keymap; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_backend_real_translate_event (ClutterBackend *backend, | ||||
|                                       gpointer        native, | ||||
|                                       ClutterEvent   *event) | ||||
| { | ||||
|   GList *l; | ||||
|  | ||||
|   for (l = backend->event_translators; | ||||
|        l != NULL; | ||||
|        l = l->next) | ||||
|     { | ||||
|       ClutterEventTranslator *translator = l->data; | ||||
|       ClutterTranslateReturn retval; | ||||
|  | ||||
|       retval = _clutter_event_translator_translate_event (translator, | ||||
|                                                           native, | ||||
|                                                           event); | ||||
|  | ||||
|       if (retval == CLUTTER_TRANSLATE_QUEUE) | ||||
|         return TRUE; | ||||
|  | ||||
|       if (retval == CLUTTER_TRANSLATE_REMOVE) | ||||
|         return FALSE; | ||||
|     } | ||||
|  | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_class_init (ClutterBackendClass *klass) | ||||
| { | ||||
| @@ -636,8 +574,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, resolution_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -654,8 +591,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, font_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -672,8 +608,7 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterBackendClass, settings_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   klass->resolution_changed = clutter_backend_real_resolution_changed; | ||||
| @@ -681,7 +616,6 @@ clutter_backend_class_init (ClutterBackendClass *klass) | ||||
|  | ||||
|   klass->init_events = clutter_backend_real_init_events; | ||||
|   klass->get_device_manager = clutter_backend_real_get_device_manager; | ||||
|   klass->translate_event = clutter_backend_real_translate_event; | ||||
|   klass->create_context = clutter_backend_real_create_context; | ||||
|   klass->get_features = clutter_backend_real_get_features; | ||||
|   klass->get_keymap = clutter_backend_real_get_keymap; | ||||
| @@ -761,6 +695,10 @@ _clutter_backend_create_stage (ClutterBackend  *backend, | ||||
|  | ||||
|   g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window)); | ||||
|  | ||||
|   backend->stage_window = stage_window; | ||||
|   g_object_add_weak_pointer (G_OBJECT (backend->stage_window), | ||||
|                              (gpointer *) &backend->stage_window); | ||||
|  | ||||
|   return stage_window; | ||||
| } | ||||
|  | ||||
| @@ -845,37 +783,24 @@ _clutter_backend_copy_event_data (ClutterBackend     *backend, | ||||
|                                   const ClutterEvent *src, | ||||
|                                   ClutterEvent       *dest) | ||||
| { | ||||
|   ClutterEventExtenderInterface *iface; | ||||
|   ClutterBackendClass *klass; | ||||
|   ClutterDeviceManagerClass *device_manager_class; | ||||
|   ClutterDeviceManager *device_manager; | ||||
|  | ||||
|   klass = CLUTTER_BACKEND_GET_CLASS (backend); | ||||
|   if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager)) | ||||
|     { | ||||
|       iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager); | ||||
|       iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager), | ||||
|                               src, dest); | ||||
|     } | ||||
|   else if (klass->copy_event_data != NULL) | ||||
|     klass->copy_event_data (backend, src, dest); | ||||
|   device_manager = clutter_device_manager_get_default (); | ||||
|   device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   device_manager_class->copy_event_data (device_manager, src, dest); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_free_event_data (ClutterBackend *backend, | ||||
|                                   ClutterEvent   *event) | ||||
| { | ||||
|   ClutterEventExtenderInterface *iface; | ||||
|   ClutterBackendClass *klass; | ||||
|   ClutterDeviceManagerClass *device_manager_class; | ||||
|   ClutterDeviceManager *device_manager; | ||||
|  | ||||
|   klass = CLUTTER_BACKEND_GET_CLASS (backend); | ||||
|  | ||||
|   if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager)) | ||||
|     { | ||||
|       iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager); | ||||
|       iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager), | ||||
|                               event); | ||||
|     } | ||||
|   else if (klass->free_event_data != NULL) | ||||
|     klass->free_event_data (backend, event); | ||||
|   device_manager = clutter_device_manager_get_default (); | ||||
|   device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   device_manager_class->free_event_data (device_manager, event); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -1021,28 +946,6 @@ _clutter_backend_translate_event (ClutterBackend *backend, | ||||
|                                                                event); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_add_event_translator (ClutterBackend         *backend, | ||||
|                                        ClutterEventTranslator *translator) | ||||
| { | ||||
|   if (g_list_find (backend->event_translators, translator) != NULL) | ||||
|     return; | ||||
|  | ||||
|   backend->event_translators = | ||||
|     g_list_prepend (backend->event_translators, translator); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_remove_event_translator (ClutterBackend         *backend, | ||||
|                                           ClutterEventTranslator *translator) | ||||
| { | ||||
|   if (g_list_find (backend->event_translators, translator) == NULL) | ||||
|     return; | ||||
|  | ||||
|   backend->event_translators = | ||||
|     g_list_remove (backend->event_translators, translator); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_backend_get_cogl_context: (skip) | ||||
|  * @backend: a #ClutterBackend | ||||
| @@ -1111,7 +1014,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend) | ||||
| { | ||||
|   if (backend->dummy_onscreen == COGL_INVALID_HANDLE) | ||||
|     { | ||||
|       CoglError *internal_error = NULL; | ||||
|       GError *internal_error = NULL; | ||||
|  | ||||
|       backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1); | ||||
|  | ||||
| @@ -1119,7 +1022,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend) | ||||
|                                       &internal_error)) | ||||
|         { | ||||
|           g_critical ("Unable to create dummy onscreen: %s", internal_error->message); | ||||
|           cogl_error_free (internal_error); | ||||
|           g_error_free (internal_error); | ||||
|           return; | ||||
|         } | ||||
|     } | ||||
| @@ -1190,3 +1093,9 @@ clutter_backend_get_keymap (ClutterBackend *backend) | ||||
| { | ||||
|   return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend); | ||||
| } | ||||
|  | ||||
| ClutterStageWindow * | ||||
| clutter_backend_get_stage_window (ClutterBackend *backend) | ||||
| { | ||||
|   return backend->stage_window; | ||||
| } | ||||
|   | ||||
| @@ -570,6 +570,68 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterPoint, clutter_point, | ||||
|                                clutter_point_free, | ||||
|                                CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_point_progress)) | ||||
|  | ||||
| static int | ||||
| clutter_point_compare_line (const ClutterPoint *p, | ||||
|                             const ClutterPoint *a, | ||||
|                             const ClutterPoint *b) | ||||
| { | ||||
|   float x1 = b->x - a->x; | ||||
|   float y1 = b->y - a->y; | ||||
|   float x2 = p->x - a->x; | ||||
|   float y2 = p->y - a->y; | ||||
|   float cross_z = x1 * y2 - y1 * x2; | ||||
|  | ||||
|   if (cross_z > 0.f) | ||||
|     return 1; | ||||
|   else if (cross_z < 0.f) | ||||
|     return -1; | ||||
|   else | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_point_inside_quadrilateral: | ||||
|  * @point: a #ClutterPoint to test | ||||
|  * @vertices: array of vertices of the quadrilateral, in clockwise order, | ||||
|  *            from top-left to bottom-left | ||||
|  * | ||||
|  * Determines whether a point is inside the convex quadrilateral provided, | ||||
|  * and not on any of its edges or vertices. | ||||
|  * | ||||
|  * Returns: %TRUE if @point is inside the quadrilateral | ||||
|  */ | ||||
| gboolean | ||||
| clutter_point_inside_quadrilateral (const ClutterPoint *point, | ||||
|                                     const ClutterPoint *vertices) | ||||
| { | ||||
|   unsigned int i; | ||||
|   int first_side; | ||||
|  | ||||
|   first_side = 0; | ||||
|  | ||||
|   for (i = 0; i < 4; i++) | ||||
|     { | ||||
|       int side; | ||||
|  | ||||
|       side = clutter_point_compare_line (point, | ||||
|                                          &vertices[i], | ||||
|                                          &vertices[(i + 1) % 4]); | ||||
|  | ||||
|       if (side) | ||||
|         { | ||||
|           if (first_side == 0) | ||||
|             first_side = side; | ||||
|           else if (side != first_side) | ||||
|             return FALSE; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (first_side == 0) | ||||
|     return FALSE; | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
|   | ||||
| @@ -235,8 +235,7 @@ clutter_binding_pool_finalize (GObject *gobject) | ||||
|  | ||||
|   g_hash_table_destroy (pool->entries_hash); | ||||
|  | ||||
|   g_slist_foreach (pool->entries, (GFunc) binding_entry_free, NULL); | ||||
|   g_slist_free (pool->entries); | ||||
|   g_slist_free_full (pool->entries, (GDestroyNotify) binding_entry_free); | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject); | ||||
| } | ||||
|   | ||||
| @@ -178,8 +178,8 @@ clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect) | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_blur_effect_get_paint_volume (ClutterEffect      *effect, | ||||
|                                       ClutterPaintVolume *volume) | ||||
| clutter_blur_effect_modify_paint_volume (ClutterEffect      *effect, | ||||
|                                          ClutterPaintVolume *volume) | ||||
| { | ||||
|   gfloat cur_width, cur_height; | ||||
|   ClutterVertex origin; | ||||
| @@ -223,7 +223,7 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass) | ||||
|   gobject_class->dispose = clutter_blur_effect_dispose; | ||||
|  | ||||
|   effect_class->pre_paint = clutter_blur_effect_pre_paint; | ||||
|   effect_class->get_paint_volume = clutter_blur_effect_get_paint_volume; | ||||
|   effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume; | ||||
|  | ||||
|   offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); | ||||
|   offscreen_class->paint_target = clutter_blur_effect_paint_target; | ||||
|   | ||||
| @@ -355,6 +355,10 @@ on_captured_event (ClutterActor       *stage, | ||||
|  | ||||
|   switch (clutter_event_type (event)) | ||||
|     { | ||||
|     case CLUTTER_TOUCH_CANCEL: | ||||
|       clutter_click_action_release (action); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_TOUCH_END: | ||||
|       has_button = FALSE; | ||||
|     case CLUTTER_BUTTON_RELEASE: | ||||
| @@ -662,8 +666,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterClickActionClass, clicked), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -252,6 +252,13 @@ clutter_clone_allocate (ClutterActor           *self, | ||||
|   if (priv->clone_source == NULL) | ||||
|     return; | ||||
|  | ||||
|   /* ClutterActor delays allocating until the actor is shown; however | ||||
|    * we cannot paint it correctly in that case, so force an allocation. | ||||
|    */ | ||||
|   if (clutter_actor_get_parent (priv->clone_source) != NULL && | ||||
|       !clutter_actor_has_allocation (priv->clone_source)) | ||||
|     clutter_actor_allocate_preferred_size (priv->clone_source, flags); | ||||
|  | ||||
| #if 0 | ||||
|   /* XXX - this is wrong: ClutterClone cannot clone unparented | ||||
|    * actors, as it will break all invariants | ||||
|   | ||||
| @@ -197,8 +197,7 @@ clutter_container_default_init (ClutterContainerInterface *iface) | ||||
|                   iface_type, | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContainerIface, actor_added), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|   /** | ||||
| @@ -216,8 +215,7 @@ clutter_container_default_init (ClutterContainerInterface *iface) | ||||
|                   iface_type, | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContainerIface, actor_removed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -129,8 +129,7 @@ clutter_content_default_init (ClutterContentInterface *iface) | ||||
|                   G_TYPE_FROM_INTERFACE (iface), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContentInterface, attached), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -149,8 +148,7 @@ clutter_content_default_init (ClutterContentInterface *iface) | ||||
|                   G_TYPE_FROM_INTERFACE (iface), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterContentInterface, detached), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -30,7 +30,6 @@ typedef enum | ||||
| typedef enum | ||||
| { | ||||
|   CLUTTER_DEBUG_NOP_PICKING         = 1 << 0, | ||||
|   CLUTTER_DEBUG_DUMP_PICK_BUFFERS   = 1 << 1 | ||||
| } ClutterPickDebugFlag; | ||||
|  | ||||
| typedef enum | ||||
|   | ||||
| @@ -282,6 +282,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect) | ||||
|   /* enable depth testing */ | ||||
|   cogl_depth_state_init (&depth_state); | ||||
|   cogl_depth_state_set_test_enabled (&depth_state, TRUE); | ||||
|   cogl_depth_state_set_test_function (&depth_state, COGL_DEPTH_TEST_FUNCTION_LEQUAL); | ||||
|   cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL); | ||||
|  | ||||
|   /* enable backface culling if we have a back material */ | ||||
|   | ||||
| @@ -17,7 +17,6 @@ | ||||
| #include "deprecated/clutter-container.h" | ||||
| #include "deprecated/clutter-group.h" | ||||
| #include "deprecated/clutter-keysyms.h" | ||||
| #include "deprecated/clutter-main.h" | ||||
| #include "deprecated/clutter-rectangle.h" | ||||
| #include "deprecated/clutter-stage-manager.h" | ||||
| #include "deprecated/clutter-stage.h" | ||||
|   | ||||
| @@ -69,6 +69,23 @@ typedef struct _ClutterTouchInfo | ||||
|   gfloat current_y; | ||||
| } ClutterTouchInfo; | ||||
|  | ||||
| typedef struct _ClutterPtrA11yData | ||||
| { | ||||
|   int n_btn_pressed; | ||||
|   float current_x; | ||||
|   float current_y; | ||||
|  | ||||
|   float dwell_x; | ||||
|   float dwell_y; | ||||
|   gboolean dwell_drag_started; | ||||
|   gboolean dwell_gesture_started; | ||||
|   guint dwell_timer; | ||||
|   guint dwell_position_timer; | ||||
|  | ||||
|   guint secondary_click_timer; | ||||
|   gboolean secondary_click_triggered; | ||||
| } ClutterPtrA11yData; | ||||
|  | ||||
| struct _ClutterInputDevice | ||||
| { | ||||
|   GObject parent_instance; | ||||
| @@ -143,6 +160,10 @@ struct _ClutterInputDevice | ||||
|  | ||||
|   guint has_cursor : 1; | ||||
|   guint is_enabled : 1; | ||||
|  | ||||
|   /* Accessiblity */ | ||||
|   ClutterVirtualInputDevice *accessibility_virtual_device; | ||||
|   ClutterPtrA11yData *ptr_a11y_data; | ||||
| }; | ||||
|  | ||||
| typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent       *event, | ||||
| @@ -173,34 +194,15 @@ struct _ClutterInputDeviceClass | ||||
|                                    ClutterEmitInputDeviceEvent emit_event_func); | ||||
| }; | ||||
|  | ||||
| /* Platform-dependent interface */ | ||||
| typedef struct _ClutterEventExtender ClutterEventExtender; | ||||
| typedef struct _ClutterEventExtenderInterface ClutterEventExtenderInterface; | ||||
|  | ||||
| #define CLUTTER_TYPE_EVENT_EXTENDER         (clutter_event_extender_get_type ()) | ||||
| #define CLUTTER_EVENT_EXTENDER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtender)) | ||||
| #define CLUTTER_IS_EVENT_EXTENDER(o)	     (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_EVENT_EXTENDER)) | ||||
| #define CLUTTER_EVENT_EXTENDER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtenderInterface)) | ||||
|  | ||||
| struct _ClutterEventExtenderInterface | ||||
| { | ||||
|   GTypeInterface g_iface; | ||||
|  | ||||
|   void (* copy_event_data) (ClutterEventExtender *event_extender, | ||||
|                             const ClutterEvent   *src, | ||||
|                             ClutterEvent         *dest); | ||||
|   void (* free_event_data) (ClutterEventExtender *event_extender, | ||||
|                             ClutterEvent         *event); | ||||
| }; | ||||
|  | ||||
| GType           clutter_event_extender_get_type        (void) G_GNUC_CONST; | ||||
|  | ||||
| /* device manager */ | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_add_device              (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_remove_device           (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterInputDevice   *device); | ||||
| void            _clutter_device_manager_update_devices          (ClutterDeviceManager *device_manager); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_device_manager_select_stage_events     (ClutterDeviceManager *device_manager, | ||||
|                                                                  ClutterStage         *stage); | ||||
| ClutterBackend *_clutter_device_manager_get_backend             (ClutterDeviceManager *device_manager); | ||||
| @@ -210,23 +212,31 @@ void            _clutter_device_manager_compress_motion         (ClutterDeviceMa | ||||
|                                                                  const ClutterEvent   *to_discard); | ||||
|  | ||||
| /* input device */ | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_has_sequence              (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_event_sequence        (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEvent         *event); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_remove_event_sequence     (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEvent         *event); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_coords                (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
|                                                                  gfloat                x, | ||||
|                                                                  gfloat                y, | ||||
|                                                                  ClutterStage         *stage); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_state                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterModifierType   state); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_time                  (ClutterInputDevice   *device, | ||||
|                                                                  guint32               time_); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_stage                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterStage         *stage); | ||||
| CLUTTER_EXPORT | ||||
| ClutterStage *  _clutter_input_device_get_stage                 (ClutterInputDevice   *device); | ||||
| void            _clutter_input_device_set_actor                 (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
| @@ -235,44 +245,57 @@ void            _clutter_input_device_set_actor                 (ClutterInputDev | ||||
| ClutterActor *  _clutter_input_device_update                    (ClutterInputDevice   *device, | ||||
|                                                                  ClutterEventSequence *sequence, | ||||
|                                                                  gboolean              emit_crossing); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_n_keys                (ClutterInputDevice   *device, | ||||
|                                                                  guint                 n_keys); | ||||
| CLUTTER_EXPORT | ||||
| guint           _clutter_input_device_add_axis                  (ClutterInputDevice   *device, | ||||
|                                                                  ClutterInputAxis      axis, | ||||
|                                                                  gdouble               min_value, | ||||
|                                                                  gdouble               max_value, | ||||
|                                                                  gdouble               resolution); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_reset_axes                (ClutterInputDevice   *device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_set_associated_device     (ClutterInputDevice   *device, | ||||
|                                                                  ClutterInputDevice   *associated); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_slave                 (ClutterInputDevice   *master, | ||||
|                                                                  ClutterInputDevice   *slave); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_remove_slave              (ClutterInputDevice   *master, | ||||
|                                                                  ClutterInputDevice   *slave); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_translate_axis            (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  gdouble               value, | ||||
|                                                                  gdouble              *axis_value); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_add_scroll_info           (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  ClutterScrollDirection direction, | ||||
|                                                                  gdouble               increment); | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_input_device_reset_scroll_info         (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_input_device_get_scroll_delta          (ClutterInputDevice   *device, | ||||
|                                                                  guint                 index_, | ||||
|                                                                  gdouble               value, | ||||
|                                                                  ClutterScrollDirection *direction_p, | ||||
|                                                                  gdouble                *delta_p); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterInputDeviceTool * clutter_input_device_lookup_tool       (ClutterInputDevice         *device, | ||||
|                                                                  guint64                     serial, | ||||
|                                                                  ClutterInputDeviceToolType  type); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_input_device_add_tool                   (ClutterInputDevice     *device, | ||||
|                                                                  ClutterInputDeviceTool *tool); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_input_device_update_from_tool           (ClutterInputDevice     *device, | ||||
|                                                                  ClutterInputDeviceTool *tool); | ||||
|  | ||||
|   | ||||
| @@ -47,6 +47,7 @@ | ||||
| #include "clutter-stage-private.h" | ||||
| #include "clutter-virtual-input-device.h" | ||||
| #include "clutter-input-device-tool.h" | ||||
| #include "clutter-input-pointer-a11y-private.h" | ||||
|  | ||||
| struct _ClutterDeviceManagerPrivate | ||||
| { | ||||
| @@ -55,6 +56,8 @@ struct _ClutterDeviceManagerPrivate | ||||
|  | ||||
|   /* Keyboard a11y */ | ||||
|   ClutterKbdA11ySettings kbd_a11y_settings; | ||||
|   /* Pointer a11y */ | ||||
|   ClutterPointerA11ySettings pointer_a11y_settings; | ||||
| }; | ||||
|  | ||||
| enum | ||||
| @@ -75,6 +78,9 @@ enum | ||||
|   TOOL_CHANGED, | ||||
|   KBD_A11Y_MASK_CHANGED, | ||||
|   KBD_A11Y_FLAGS_CHANGED, | ||||
|   PTR_A11Y_DWELL_CLICK_TYPE_CHANGED, | ||||
|   PTR_A11Y_TIMEOUT_STARTED, | ||||
|   PTR_A11Y_TIMEOUT_STOPPED, | ||||
|  | ||||
|   LAST_SIGNAL | ||||
| }; | ||||
| @@ -85,22 +91,14 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager, | ||||
|                                      clutter_device_manager, | ||||
|                                      G_TYPE_OBJECT) | ||||
|  | ||||
| G_DEFINE_INTERFACE (ClutterEventExtender, | ||||
|                     clutter_event_extender, | ||||
|                     CLUTTER_TYPE_DEVICE_MANAGER) | ||||
|  | ||||
| static void | ||||
| clutter_event_extender_default_init (ClutterEventExtenderInterface *iface) | ||||
| { | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_set_property (GObject      *gobject, | ||||
|                                      guint         prop_id, | ||||
|                                      const GValue *value, | ||||
|                                      GParamSpec   *pspec) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv; | ||||
|   ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject); | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self); | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
| @@ -119,7 +117,8 @@ clutter_device_manager_get_property (GObject    *gobject, | ||||
|                                      GValue     *value, | ||||
|                                      GParamSpec *pspec) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv; | ||||
|   ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject); | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self); | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
| @@ -165,8 +164,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE); | ||||
|  | ||||
| @@ -185,8 +183,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE); | ||||
|  | ||||
| @@ -239,12 +236,74 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) | ||||
|                   G_TYPE_NONE, 2, | ||||
|                   G_TYPE_UINT, | ||||
|                   G_TYPE_UINT); | ||||
|  | ||||
|   /** | ||||
|    * ClutterDeviceManager::ptr-a11y-dwell-click-type-changed: | ||||
|    * @manager: the #ClutterDeviceManager that emitted the signal | ||||
|    * @click_type: the new #ClutterPointerA11yDwellClickType mode | ||||
|    * | ||||
|    * The ::ptr-a11y-dwell-click-type-changed signal is emitted each time | ||||
|    * the ClutterPointerA11yDwellClickType mode is changed as the result | ||||
|    * of pointer accessibility operations. | ||||
|    */ | ||||
|   manager_signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] = | ||||
|     g_signal_new (I_("ptr-a11y-dwell-click-type-changed"), | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, NULL, NULL, | ||||
|                   g_cclosure_marshal_VOID__FLAGS, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE); | ||||
|  | ||||
|   /** | ||||
|    * ClutterDeviceManager::ptr-a11y-timeout-started: | ||||
|    * @manager: the #ClutterDeviceManager that emitted the signal | ||||
|    * @device: the core pointer #ClutterInputDevice | ||||
|    * @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType | ||||
|    * @delay: the delay in ms before secondary-click is triggered. | ||||
|    * | ||||
|    * The ::ptr-a11y-timeout-started signal is emitted when a | ||||
|    * pointer accessibility timeout delay is started, so that upper | ||||
|    * layers can notify the user with some visual feedback. | ||||
|    */ | ||||
|   manager_signals[PTR_A11Y_TIMEOUT_STARTED] = | ||||
|     g_signal_new (I_("ptr-a11y-timeout-started"), | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT_FLAGS_UINT, | ||||
|                   G_TYPE_NONE, 3, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE, | ||||
|                   CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE, | ||||
|                   G_TYPE_UINT); | ||||
|  | ||||
|   /** | ||||
|    * ClutterDeviceManager::ptr-a11y-timeout-stopped: | ||||
|    * @manager: the #ClutterDeviceManager that emitted the signal | ||||
|    * @device: the core pointer #ClutterInputDevice | ||||
|    * @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType | ||||
|    * @clicked: %TRUE if the timeout finished and triggered a click | ||||
|    * | ||||
|    * The ::ptr-a11y-timeout-stopped signal is emitted when a running | ||||
|    * pointer accessibility timeout delay is stopped, either because | ||||
|    * it's triggered at the end of the delay or cancelled, so that | ||||
|    * upper layers can notify the user with some visual feedback. | ||||
|    */ | ||||
|   manager_signals[PTR_A11Y_TIMEOUT_STOPPED] = | ||||
|     g_signal_new (I_("ptr-a11y-timeout-stopped"), | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   0, NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN, | ||||
|                   G_TYPE_NONE, 3, | ||||
|                   CLUTTER_TYPE_INPUT_DEVICE, | ||||
|                   CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE, | ||||
|                   G_TYPE_BOOLEAN); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_init (ClutterDeviceManager *self) | ||||
| { | ||||
|   self->priv = clutter_device_manager_get_instance_private (self); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -263,7 +322,7 @@ clutter_device_manager_get_default (void) | ||||
| { | ||||
|   ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   return backend->device_manager; | ||||
|   return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -487,9 +546,11 @@ _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager) | ||||
| ClutterBackend * | ||||
| _clutter_device_manager_get_backend (ClutterDeviceManager *manager) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager); | ||||
|  | ||||
|   g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL); | ||||
|  | ||||
|   return manager->priv->backend; | ||||
|   return priv->backend; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -558,13 +619,14 @@ clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager   *device_man | ||||
|                                               ClutterKbdA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerClass *manager_class; | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   if (are_kbd_a11y_settings_equal (&device_manager->priv->kbd_a11y_settings, settings)) | ||||
|   if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings)) | ||||
|     return; | ||||
|  | ||||
|   device_manager->priv->kbd_a11y_settings = *settings; | ||||
|   priv->kbd_a11y_settings = *settings; | ||||
|  | ||||
|   manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); | ||||
|   if (manager_class->apply_kbd_a11y_settings) | ||||
| @@ -575,7 +637,103 @@ void | ||||
| clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager   *device_manager, | ||||
|                                               ClutterKbdA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   *settings = device_manager->priv->kbd_a11y_settings; | ||||
|   *settings = priv->kbd_a11y_settings; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a, | ||||
|                                  ClutterPointerA11ySettings *b) | ||||
| { | ||||
|   return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_enable_pointer_a11y (ClutterDeviceManager *device_manager) | ||||
| { | ||||
|   ClutterInputDevice *core_pointer; | ||||
|  | ||||
|   core_pointer = clutter_device_manager_get_core_device (device_manager, | ||||
|                                                          CLUTTER_POINTER_DEVICE); | ||||
|  | ||||
|   _clutter_input_pointer_a11y_add_device (core_pointer); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_device_manager_disable_pointer_a11y (ClutterDeviceManager *device_manager) | ||||
| { | ||||
|   ClutterInputDevice *core_pointer; | ||||
|  | ||||
|   core_pointer = clutter_device_manager_get_core_device (device_manager, | ||||
|                                                          CLUTTER_POINTER_DEVICE); | ||||
|  | ||||
|   _clutter_input_pointer_a11y_remove_device (core_pointer); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_device_manager_set_pointer_a11y_settings: | ||||
|  * @device_manager: a #ClutterDeviceManager | ||||
|  * @settings: a pointer to a #ClutterPointerA11ySettings | ||||
|  * | ||||
|  * Sets the pointer accessibility settings | ||||
|  **/ | ||||
| void | ||||
| clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                   ClutterPointerA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings)) | ||||
|     return; | ||||
|  | ||||
|   if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0) | ||||
|     clutter_device_manager_enable_pointer_a11y (device_manager); | ||||
|   else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0) | ||||
|     clutter_device_manager_disable_pointer_a11y (device_manager); | ||||
|  | ||||
|   priv->pointer_a11y_settings = *settings; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_device_manager_get_pointer_a11y_settings: | ||||
|  * @device_manager: a #ClutterDeviceManager | ||||
|  * @settings: a pointer to a #ClutterPointerA11ySettings | ||||
|  * | ||||
|  * Gets the current pointer accessibility settings | ||||
|  **/ | ||||
| void | ||||
| clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                   ClutterPointerA11ySettings *settings) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   *settings = priv->pointer_a11y_settings; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_device_manager_set_pointer_a11y_dwell_click_type: | ||||
|  * @device_manager: a #ClutterDeviceManager | ||||
|  * @click_type: type of click as #ClutterPointerA11yDwellClickType | ||||
|  * | ||||
|  * Sets the dwell click type | ||||
|  **/ | ||||
| void | ||||
| clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager             *device_manager, | ||||
|                                                           ClutterPointerA11yDwellClickType  click_type) | ||||
| { | ||||
|   ClutterDeviceManagerPrivate *priv = | ||||
|     clutter_device_manager_get_instance_private (device_manager); | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager)); | ||||
|  | ||||
|   priv->pointer_a11y_settings.dwell_click_type = click_type; | ||||
| } | ||||
|   | ||||
| @@ -33,16 +33,12 @@ | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER             (clutter_device_manager_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManager)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER)) | ||||
| #define CLUTTER_DEVICE_MANAGER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER)) | ||||
| #define CLUTTER_DEVICE_MANAGER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass)) | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ()) | ||||
| CLUTTER_EXPORT | ||||
| G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager, | ||||
|                           CLUTTER, DEVICE_MANAGER, GObject) | ||||
|  | ||||
| typedef struct _ClutterDeviceManager            ClutterDeviceManager; | ||||
| typedef struct _ClutterDeviceManagerPrivate     ClutterDeviceManagerPrivate; | ||||
| typedef struct _ClutterDeviceManagerClass       ClutterDeviceManagerClass; | ||||
|  | ||||
| /** | ||||
|  * ClutterVirtualDeviceType: | ||||
| @@ -74,19 +70,25 @@ typedef struct _ClutterKbdA11ySettings | ||||
| } ClutterKbdA11ySettings; | ||||
|  | ||||
| /** | ||||
|  * ClutterDeviceManager: | ||||
|  * ClutterPointerA11ySettings: | ||||
|  * | ||||
|  * The #ClutterDeviceManager structure contains only private data | ||||
|  * The #ClutterPointerA11ySettings structure contains pointer accessibility | ||||
|  * settings | ||||
|  * | ||||
|  * Since: 1.2 | ||||
|  */ | ||||
| struct _ClutterDeviceManager | ||||
| typedef struct _ClutterPointerA11ySettings | ||||
| { | ||||
|   /*< private >*/ | ||||
|   GObject parent_instance; | ||||
|  | ||||
|   ClutterDeviceManagerPrivate *priv; | ||||
| }; | ||||
|   ClutterPointerA11yFlags controls; | ||||
|   ClutterPointerA11yDwellClickType dwell_click_type; | ||||
|   ClutterPointerA11yDwellMode dwell_mode; | ||||
|   ClutterPointerA11yDwellDirection dwell_gesture_single; | ||||
|   ClutterPointerA11yDwellDirection dwell_gesture_double; | ||||
|   ClutterPointerA11yDwellDirection dwell_gesture_drag; | ||||
|   ClutterPointerA11yDwellDirection dwell_gesture_secondary; | ||||
|   gint secondary_click_delay; | ||||
|   gint dwell_delay; | ||||
|   gint dwell_threshold; | ||||
| } ClutterPointerA11ySettings; | ||||
|  | ||||
| /** | ||||
|  * ClutterDeviceManagerClass: | ||||
| @@ -121,12 +123,17 @@ struct _ClutterDeviceManagerClass | ||||
|   /* Keyboard accessbility */ | ||||
|   void                (* apply_kbd_a11y_settings) (ClutterDeviceManager   *device_manger, | ||||
|                                                    ClutterKbdA11ySettings *settings); | ||||
|   /* padding */ | ||||
|   gpointer _padding[6]; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType clutter_device_manager_get_type (void) G_GNUC_CONST; | ||||
|   /* Event platform data */ | ||||
|   void (* copy_event_data) (ClutterDeviceManager *device_manager, | ||||
|                             const ClutterEvent   *src, | ||||
|                             ClutterEvent         *dest); | ||||
|   void (* free_event_data) (ClutterDeviceManager *device_manager, | ||||
|                             ClutterEvent         *event); | ||||
|  | ||||
|   /* padding */ | ||||
|   gpointer _padding[4]; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterDeviceManager *clutter_device_manager_get_default     (void); | ||||
| @@ -152,10 +159,23 @@ ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_typ | ||||
| CLUTTER_EXPORT | ||||
| void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager   *device_manager, | ||||
|                                                    ClutterKbdA11ySettings *settings); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager   *device_manager, | ||||
|                                                    ClutterKbdA11ySettings *settings); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                        ClutterPointerA11ySettings *settings); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager       *device_manager, | ||||
|                                                        ClutterPointerA11ySettings *settings); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager             *device_manager, | ||||
|                                                                ClutterPointerA11yDwellClickType  click_type); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_DEVICE_MANAGER_H__ */ | ||||
|   | ||||
| @@ -428,8 +428,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterDropActionClass, over_in), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -448,8 +447,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterDropActionClass, over_out), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ G_BEGIN_DECLS | ||||
|  | ||||
| gboolean        _clutter_effect_pre_paint               (ClutterEffect           *effect); | ||||
| void            _clutter_effect_post_paint              (ClutterEffect           *effect); | ||||
| gboolean        _clutter_effect_get_paint_volume        (ClutterEffect           *effect, | ||||
| gboolean        _clutter_effect_modify_paint_volume     (ClutterEffect           *effect, | ||||
|                                                          ClutterPaintVolume      *volume); | ||||
| gboolean        _clutter_effect_has_custom_paint_volume (ClutterEffect           *effect); | ||||
| void            _clutter_effect_paint                   (ClutterEffect           *effect, | ||||
|   | ||||
| @@ -188,8 +188,8 @@ clutter_effect_real_post_paint (ClutterEffect *effect) | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_effect_real_get_paint_volume (ClutterEffect      *effect, | ||||
|                                       ClutterPaintVolume *volume) | ||||
| clutter_effect_real_modify_paint_volume (ClutterEffect      *effect, | ||||
|                                          ClutterPaintVolume *volume) | ||||
| { | ||||
|   return TRUE; | ||||
| } | ||||
| @@ -252,7 +252,7 @@ clutter_effect_class_init (ClutterEffectClass *klass) | ||||
|  | ||||
|   klass->pre_paint = clutter_effect_real_pre_paint; | ||||
|   klass->post_paint = clutter_effect_real_post_paint; | ||||
|   klass->get_paint_volume = clutter_effect_real_get_paint_volume; | ||||
|   klass->modify_paint_volume = clutter_effect_real_modify_paint_volume; | ||||
|   klass->paint = clutter_effect_real_paint; | ||||
|   klass->pick = clutter_effect_real_pick; | ||||
| } | ||||
| @@ -297,13 +297,14 @@ _clutter_effect_pick (ClutterEffect           *effect, | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_effect_get_paint_volume (ClutterEffect      *effect, | ||||
|                                   ClutterPaintVolume *volume) | ||||
| _clutter_effect_modify_paint_volume (ClutterEffect      *effect, | ||||
|                                      ClutterPaintVolume *volume) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE); | ||||
|   g_return_val_if_fail (volume != NULL, FALSE); | ||||
|  | ||||
|   return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume (effect, volume); | ||||
|   return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume (effect, | ||||
|                                                                  volume); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| @@ -311,7 +312,7 @@ _clutter_effect_has_custom_paint_volume (ClutterEffect *effect) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE); | ||||
|  | ||||
|   return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume != clutter_effect_real_get_paint_volume; | ||||
|   return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume != clutter_effect_real_modify_paint_volume; | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -60,7 +60,7 @@ struct _ClutterEffect | ||||
|  * ClutterEffectClass: | ||||
|  * @pre_paint: virtual function | ||||
|  * @post_paint: virtual function | ||||
|  * @get_paint_volume: virtual function | ||||
|  * @modify_paint_volume: virtual function | ||||
|  * @paint: virtual function | ||||
|  * @pick: virtual function | ||||
|  * | ||||
| @@ -74,16 +74,16 @@ struct _ClutterEffectClass | ||||
|   ClutterActorMetaClass parent_class; | ||||
|  | ||||
|   /*< public >*/ | ||||
|   gboolean (* pre_paint)        (ClutterEffect           *effect); | ||||
|   void     (* post_paint)       (ClutterEffect           *effect); | ||||
|   gboolean (* pre_paint)           (ClutterEffect           *effect); | ||||
|   void     (* post_paint)          (ClutterEffect           *effect); | ||||
|  | ||||
|   gboolean (* get_paint_volume) (ClutterEffect           *effect, | ||||
|                                  ClutterPaintVolume      *volume); | ||||
|   gboolean (* modify_paint_volume) (ClutterEffect           *effect, | ||||
|                                     ClutterPaintVolume      *volume); | ||||
|  | ||||
|   void     (* paint)            (ClutterEffect           *effect, | ||||
|                                  ClutterEffectPaintFlags  flags); | ||||
|   void     (* pick)             (ClutterEffect           *effect, | ||||
|                                  ClutterEffectPaintFlags  flags); | ||||
|   void     (* paint)               (ClutterEffect           *effect, | ||||
|                                     ClutterEffectPaintFlags  flags); | ||||
|   void     (* pick)                (ClutterEffect           *effect, | ||||
|                                     ClutterEffectPaintFlags  flags); | ||||
|  | ||||
|   /*< private >*/ | ||||
|   void (* _clutter_effect4) (void); | ||||
|   | ||||
| @@ -13,7 +13,7 @@ G_BEGIN_DECLS | ||||
| /*** END file-header ***/ | ||||
|  | ||||
| /*** BEGIN file-production ***/ | ||||
| /* enumerations from "@filename@" */ | ||||
| /* enumerations from "@basename@" */ | ||||
| /*** END file-production ***/ | ||||
|  | ||||
| /*** BEGIN value-header ***/ | ||||
|   | ||||
| @@ -277,24 +277,6 @@ typedef enum | ||||
|   CLUTTER_ANIMATION_LAST | ||||
| } ClutterAnimationMode; | ||||
|  | ||||
| /** | ||||
|  * ClutterFontFlags: | ||||
|  * @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures. | ||||
|  * @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs. | ||||
|  * | ||||
|  * Runtime flags to change the font quality. To be used with | ||||
|  * clutter_set_font_flags(). | ||||
|  * | ||||
|  * Since: 1.0 | ||||
|  * | ||||
|  * Deprecated: 1.22: Use #cairo_font_options_t instead | ||||
|  */ | ||||
| typedef enum /*< prefix=CLUTTER_FONT >*/ | ||||
| { | ||||
|   CLUTTER_FONT_MIPMAPPING = (1 << 0), | ||||
|   CLUTTER_FONT_HINTING    = (1 << 1) | ||||
| } ClutterFontFlags; | ||||
|  | ||||
| /** | ||||
|  * ClutterTextDirection: | ||||
|  * @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned | ||||
| @@ -443,6 +425,88 @@ typedef enum | ||||
|   CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13, | ||||
| } ClutterKeyboardA11yFlags; | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerA11yFlags: | ||||
|  * @CLUTTER_A11Y_POINTER_ENABLED: | ||||
|  * @CLUTTER_A11Y_SECONDARY_CLICK_ENABLED: | ||||
|  * @CLUTTER_A11Y_DWELL_ENABLED: | ||||
|  * | ||||
|  * Pointer accessibility features applied to a ClutterInputDevice pointer. | ||||
|  * | ||||
|  */ | ||||
| typedef enum { | ||||
|   CLUTTER_A11Y_SECONDARY_CLICK_ENABLED   = 1 << 0, | ||||
|   CLUTTER_A11Y_DWELL_ENABLED             = 1 << 1, | ||||
| } ClutterPointerA11yFlags; | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerA11yDwellClickType: | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE: Internal use only | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY: | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY: | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE: | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE: | ||||
|  * @CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG: | ||||
|  * | ||||
|  * Dwell click types. | ||||
|  * | ||||
|  */ | ||||
| typedef enum { | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE, | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY, | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY, | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE, | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE, | ||||
|   CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG, | ||||
| } ClutterPointerA11yDwellClickType; | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerA11yDwellDirection: | ||||
|  * @CLUTTER_A11Y_DWELL_DIRECTION_NONE: | ||||
|  * @CLUTTER_A11Y_DWELL_DIRECTION_LEFT: | ||||
|  * @CLUTTER_A11Y_DWELL_DIRECTION_RIGHT: | ||||
|  * @CLUTTER_A11Y_DWELL_DIRECTION_UP: | ||||
|  * @CLUTTER_A11Y_DWELL_DIRECTION_DOWN: | ||||
|  * | ||||
|  * Dwell gesture directions. | ||||
|  * | ||||
|  */ | ||||
| typedef enum { | ||||
|   CLUTTER_A11Y_DWELL_DIRECTION_NONE, | ||||
|   CLUTTER_A11Y_DWELL_DIRECTION_LEFT, | ||||
|   CLUTTER_A11Y_DWELL_DIRECTION_RIGHT, | ||||
|   CLUTTER_A11Y_DWELL_DIRECTION_UP, | ||||
|   CLUTTER_A11Y_DWELL_DIRECTION_DOWN, | ||||
| } ClutterPointerA11yDwellDirection; | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerA11yDwellMode: | ||||
|  * @CLUTTER_A11Y_DWELL_MODE_WINDOW: | ||||
|  * @CLUTTER_A11Y_DWELL_MODE_GESTURE: | ||||
|  * | ||||
|  * Dwell mode. | ||||
|  * | ||||
|  */ | ||||
| typedef enum { | ||||
|   CLUTTER_A11Y_DWELL_MODE_WINDOW, | ||||
|   CLUTTER_A11Y_DWELL_MODE_GESTURE, | ||||
| } ClutterPointerA11yDwellMode; | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerA11yTimeoutType: | ||||
|  * @CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK: | ||||
|  * @CLUTTER_A11Y_TIMEOUT_TYPE_DWELL: | ||||
|  * @CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE: | ||||
|  * | ||||
|  * Pointer accessibility timeout type. | ||||
|  * | ||||
|  */ | ||||
| typedef enum { | ||||
|   CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|   CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|   CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE, | ||||
| } ClutterPointerA11yTimeoutType; | ||||
|  | ||||
| /** | ||||
|  * ClutterActorFlags: | ||||
|  * @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside | ||||
| @@ -892,8 +956,6 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/ | ||||
|  | ||||
| /** | ||||
|  * ClutterStageState: | ||||
|  * @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask | ||||
|  * @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask (deprecated) | ||||
|  * @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask | ||||
|  * | ||||
|  * Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE. | ||||
| @@ -902,8 +964,6 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/ | ||||
|  */ | ||||
| typedef enum | ||||
| { | ||||
|   CLUTTER_STAGE_STATE_FULLSCREEN       = (1 << 1), | ||||
|   CLUTTER_STAGE_STATE_OFFSCREEN        = (1 << 2), | ||||
|   CLUTTER_STAGE_STATE_ACTIVATED        = (1 << 3) | ||||
| } ClutterStageState; | ||||
|  | ||||
| @@ -913,7 +973,6 @@ typedef enum | ||||
|  * @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported. | ||||
|  * @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read. | ||||
|  * @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer) | ||||
|  * @CLUTTER_FEATURE_STAGE_USER_RESIZE: Set if stage is able to be user resized. | ||||
|  * @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor. | ||||
|  * @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders. | ||||
|  * @CLUTTER_FEATURE_OFFSCREEN: Set if the backend supports offscreen rendering. | ||||
| @@ -931,7 +990,6 @@ typedef enum | ||||
|   CLUTTER_FEATURE_TEXTURE_YUV            = (1 << 4), | ||||
|   CLUTTER_FEATURE_TEXTURE_READ_PIXELS    = (1 << 5), | ||||
|   CLUTTER_FEATURE_STAGE_STATIC           = (1 << 6), | ||||
|   CLUTTER_FEATURE_STAGE_USER_RESIZE      = (1 << 7), | ||||
|   CLUTTER_FEATURE_STAGE_CURSOR           = (1 << 8), | ||||
|   CLUTTER_FEATURE_SHADERS_GLSL           = (1 << 9), | ||||
|   CLUTTER_FEATURE_OFFSCREEN              = (1 << 10), | ||||
|   | ||||
| @@ -5,22 +5,28 @@ | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_pointer_emulated     (ClutterEvent       *event, | ||||
|                                                          gboolean            is_emulated); | ||||
|  | ||||
| /* Reinjecting queued events for processing */ | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_process_event                  (ClutterEvent       *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean        _clutter_event_process_filters          (ClutterEvent       *event); | ||||
|  | ||||
| /* clears the event queue inside the main context */ | ||||
| void            _clutter_clear_events_queue             (void); | ||||
| void            _clutter_clear_events_queue_for_stage   (ClutterStage       *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_platform_data        (ClutterEvent       *event, | ||||
|                                                          gpointer            data); | ||||
| CLUTTER_EXPORT | ||||
| gpointer        _clutter_event_get_platform_data        (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_set_state_full           (ClutterEvent        *event, | ||||
| 							 ClutterModifierType  button_state, | ||||
| 							 ClutterModifierType  base_state, | ||||
| @@ -28,6 +34,7 @@ void            _clutter_event_set_state_full           (ClutterEvent        *ev | ||||
| 							 ClutterModifierType  locked_state, | ||||
| 							 ClutterModifierType  effective_state); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_event_push                     (const ClutterEvent *event, | ||||
|                                                          gboolean            do_copy); | ||||
|  | ||||
|   | ||||
| @@ -1,38 +0,0 @@ | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-event-translator.h" | ||||
|  | ||||
| #include "clutter-backend.h" | ||||
| #include "clutter-private.h" | ||||
|  | ||||
| #define clutter_event_translator_get_type       _clutter_event_translator_get_type | ||||
|  | ||||
| typedef ClutterEventTranslatorIface     ClutterEventTranslatorInterface; | ||||
|  | ||||
| G_DEFINE_INTERFACE (ClutterEventTranslator, clutter_event_translator, G_TYPE_OBJECT); | ||||
|  | ||||
| static ClutterTranslateReturn | ||||
| default_translate_event (ClutterEventTranslator *translator, | ||||
|                          gpointer                native, | ||||
|                          ClutterEvent           *event) | ||||
| { | ||||
|   return CLUTTER_TRANSLATE_CONTINUE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_event_translator_default_init (ClutterEventTranslatorIface *iface) | ||||
| { | ||||
|   iface->translate_event = default_translate_event; | ||||
| } | ||||
|  | ||||
| ClutterTranslateReturn | ||||
| _clutter_event_translator_translate_event (ClutterEventTranslator *translator, | ||||
|                                            gpointer                native, | ||||
|                                            ClutterEvent           *translated) | ||||
| { | ||||
|   ClutterEventTranslatorIface *iface; | ||||
|  | ||||
|   iface = CLUTTER_EVENT_TRANSLATOR_GET_IFACE (translator); | ||||
|  | ||||
|   return iface->translate_event (translator, native, translated); | ||||
| } | ||||
| @@ -1,42 +0,0 @@ | ||||
| #ifndef __CLUTTER_EVENT_TRANSLATOR_H__ | ||||
| #define __CLUTTER_EVENT_TRANSLATOR_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <clutter/clutter-event.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_EVENT_TRANSLATOR           (_clutter_event_translator_get_type ()) | ||||
| #define CLUTTER_EVENT_TRANSLATOR(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslator)) | ||||
| #define CLUTTER_IS_EVENT_TRANSLATOR(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR)) | ||||
| #define CLUTTER_EVENT_TRANSLATOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslatorIface)) | ||||
|  | ||||
| typedef struct _ClutterEventTranslator          ClutterEventTranslator; | ||||
| typedef struct _ClutterEventTranslatorIface     ClutterEventTranslatorIface; | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|   CLUTTER_TRANSLATE_CONTINUE, | ||||
|   CLUTTER_TRANSLATE_REMOVE, | ||||
|   CLUTTER_TRANSLATE_QUEUE | ||||
| } ClutterTranslateReturn; | ||||
|  | ||||
| struct _ClutterEventTranslatorIface | ||||
| { | ||||
|   GTypeInterface g_iface; | ||||
|  | ||||
|   ClutterTranslateReturn (* translate_event) (ClutterEventTranslator *translator, | ||||
|                                               gpointer                native, | ||||
|                                               ClutterEvent           *translated); | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType _clutter_event_translator_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterTranslateReturn _clutter_event_translator_translate_event (ClutterEventTranslator *translator, | ||||
|                                                                   gpointer                native, | ||||
|                                                                   ClutterEvent           *translated); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_EVENT_TRANSLATOR_H__ */ | ||||
| @@ -1021,6 +1021,9 @@ clutter_event_get_event_sequence (const ClutterEvent *event) | ||||
|       event->type == CLUTTER_TOUCH_END || | ||||
|       event->type == CLUTTER_TOUCH_CANCEL) | ||||
|     return event->touch.sequence; | ||||
|   else if (event->type == CLUTTER_ENTER || | ||||
|            event->type == CLUTTER_LEAVE) | ||||
|     return event->crossing.sequence; | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|   | ||||
| @@ -269,6 +269,7 @@ struct _ClutterCrossingEvent | ||||
|   gfloat x; | ||||
|   gfloat y; | ||||
|   ClutterInputDevice *device; | ||||
|   ClutterEventSequence *sequence; | ||||
|   ClutterActor *related; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -804,8 +804,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
|  | ||||
| @@ -827,8 +826,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -256,7 +256,7 @@ clutter_image_set_data (ClutterImage     *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -325,7 +325,7 @@ clutter_image_set_bytes (ClutterImage     *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -419,7 +419,7 @@ clutter_image_set_area (ClutterImage                 *image, | ||||
|     { | ||||
|       g_set_error_literal (error, CLUTTER_IMAGE_ERROR, | ||||
|                            CLUTTER_IMAGE_ERROR_INVALID_DATA, | ||||
|                            _("Unable to load image data")); | ||||
|                            "Unable to load image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -107,6 +107,9 @@ clutter_input_device_dispose (GObject *gobject) | ||||
|       device->associated = NULL; | ||||
|     } | ||||
|  | ||||
|   if (device->accessibility_virtual_device) | ||||
|     g_clear_object (&device->accessibility_virtual_device); | ||||
|  | ||||
|   g_clear_pointer (&device->axes, g_array_unref); | ||||
|   g_clear_pointer (&device->keys, g_array_unref); | ||||
|   g_clear_pointer (&device->scroll_info, g_array_unref); | ||||
| @@ -834,6 +837,7 @@ _clutter_input_device_set_actor (ClutterInputDevice   *device, | ||||
|           event->crossing.x = device->current_x; | ||||
|           event->crossing.y = device->current_y; | ||||
|           event->crossing.related = actor; | ||||
|           event->crossing.sequence = sequence; | ||||
|           clutter_event_set_device (event, device); | ||||
|  | ||||
|           /* we need to make sure that this event is processed | ||||
| @@ -870,6 +874,7 @@ _clutter_input_device_set_actor (ClutterInputDevice   *device, | ||||
|           event->crossing.y = device->current_y; | ||||
|           event->crossing.source = actor; | ||||
|           event->crossing.related = old_actor; | ||||
|           event->crossing.sequence = sequence; | ||||
|           clutter_event_set_device (event, device); | ||||
|  | ||||
|           /* see above */ | ||||
| @@ -1034,9 +1039,10 @@ _clutter_input_device_update (ClutterInputDevice   *device, | ||||
|   ClutterActor *new_cursor_actor; | ||||
|   ClutterActor *old_cursor_actor; | ||||
|   ClutterPoint point = { -1, -1 }; | ||||
|   ClutterInputDeviceType device_type = device->device_type; | ||||
|  | ||||
|   if (device->device_type == CLUTTER_KEYBOARD_DEVICE) | ||||
|     return NULL; | ||||
|   g_assert (device_type != CLUTTER_KEYBOARD_DEVICE && | ||||
|             device_type != CLUTTER_PAD_DEVICE); | ||||
|  | ||||
|   stage = device->stage; | ||||
|   if (G_UNLIKELY (stage == NULL)) | ||||
| @@ -1919,6 +1925,157 @@ _clutter_input_device_reset_scroll_info (ClutterInputDevice *device) | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_grab_actor_destroy (ClutterActor       *actor, | ||||
|                        ClutterInputDevice *device) | ||||
| { | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       device->pointer_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       device->keyboard_grab_actor = NULL; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_assert_not_reached (); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_grab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * @actor: a #ClutterActor | ||||
|  * | ||||
|  * Acquires a grab on @actor for the given @device. | ||||
|  * | ||||
|  * Any event coming from @device will be delivered to @actor, bypassing | ||||
|  * the usual event delivery mechanism, until the grab is released by | ||||
|  * calling clutter_input_device_ungrab(). | ||||
|  * | ||||
|  * The grab is client-side: even if the windowing system used by the Clutter | ||||
|  * backend has the concept of "device grabs", Clutter will not use them. | ||||
|  * | ||||
|  * Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE, | ||||
|  * %CLUTTER_TABLET_DEVICE and %CLUTTER_KEYBOARD_DEVICE can hold a grab. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_grab (ClutterInputDevice *device, | ||||
|                            ClutterActor       *actor) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|   g_return_if_fail (CLUTTER_IS_ACTOR (actor)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &device->pointer_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &device->keyboard_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor != NULL) | ||||
|     { | ||||
|       g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                             G_CALLBACK (on_grab_actor_destroy), | ||||
|                                             device); | ||||
|     } | ||||
|  | ||||
|   *grab_actor = actor; | ||||
|  | ||||
|   g_signal_connect (*grab_actor, | ||||
|                     "destroy", | ||||
|                     G_CALLBACK (on_grab_actor_destroy), | ||||
|                     device); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_ungrab: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Releases the grab on the @device, if one is in place. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_input_device_ungrab (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterActor **grab_actor; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device)); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       grab_actor = &device->pointer_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       grab_actor = &device->keyboard_grab_actor; | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (*grab_actor == NULL) | ||||
|     return; | ||||
|  | ||||
|   g_signal_handlers_disconnect_by_func (*grab_actor, | ||||
|                                         G_CALLBACK (on_grab_actor_destroy), | ||||
|                                         device); | ||||
|  | ||||
|   *grab_actor = NULL; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_input_device_get_grabbed_actor: | ||||
|  * @device: a #ClutterInputDevice | ||||
|  * | ||||
|  * Retrieves a pointer to the #ClutterActor currently grabbing all | ||||
|  * the events coming from @device. | ||||
|  * | ||||
|  * Return value: (transfer none): a #ClutterActor, or %NULL | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_input_device_get_grabbed_actor (ClutterInputDevice *device) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL); | ||||
|  | ||||
|   switch (device->device_type) | ||||
|     { | ||||
|     case CLUTTER_POINTER_DEVICE: | ||||
|     case CLUTTER_TABLET_DEVICE: | ||||
|       return device->pointer_grab_actor; | ||||
|  | ||||
|     case CLUTTER_KEYBOARD_DEVICE: | ||||
|       return device->keyboard_grab_actor; | ||||
|  | ||||
|     default: | ||||
|       g_critical ("Only pointer and keyboard devices can grab an actor"); | ||||
|     } | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_grab_sequence_actor_destroy (ClutterActor       *actor, | ||||
|                                 ClutterInputDevice *device) | ||||
|   | ||||
							
								
								
									
										47
									
								
								clutter/clutter/clutter-input-pointer-a11y-private.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								clutter/clutter/clutter-input-pointer-a11y-private.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| /* | ||||
|  * Copyright (C) 2019 Red Hat | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU General Public License as | ||||
|  * published by the Free Software Foundation; either version 2 of the | ||||
|  * License, or (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, but | ||||
|  * WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
|  * 02111-1307, USA. | ||||
|  * | ||||
|  * Author: Olivier Fourdan <ofourdan@redhat.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_POINTER_A11Y_H__ | ||||
| #define __CLUTTER_INPUT_POINTER_A11Y_H__ | ||||
|  | ||||
| #include <clutter/clutter-types.h> | ||||
| #include "clutter-enum-types.h" | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_add_device      (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_remove_device   (ClutterInputDevice   *device); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice   *device, | ||||
|                                                   float                 x, | ||||
|                                                   float                 y); | ||||
| CLUTTER_EXPORT | ||||
| void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice   *device, | ||||
|                                                   int                   button, | ||||
|                                                   gboolean              pressed); | ||||
| CLUTTER_EXPORT | ||||
| gboolean _clutter_is_input_pointer_a11y_enabled  (ClutterInputDevice     *device); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_POINTER_A11Y_H__ */ | ||||
							
								
								
									
										710
									
								
								clutter/clutter/clutter-input-pointer-a11y.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										710
									
								
								clutter/clutter/clutter-input-pointer-a11y.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,710 @@ | ||||
| /* | ||||
|  * Copyright (C) 2019 Red Hat | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU General Public License as | ||||
|  * published by the Free Software Foundation; either version 2 of the | ||||
|  * License, or (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, but | ||||
|  * WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
|  * 02111-1307, USA. | ||||
|  * | ||||
|  * Author: Olivier Fourdan <ofourdan@redhat.com> | ||||
|  * | ||||
|  * This reimplements in Clutter the same behavior as mousetweaks original | ||||
|  * implementation by Gerd Kohlberger <gerdko gmail com> | ||||
|  * mousetweaks Copyright (C) 2007-2010 Gerd Kohlberger <gerdko gmail com> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-device-manager.h" | ||||
| #include "clutter-device-manager-private.h" | ||||
| #include "clutter-enum-types.h" | ||||
| #include "clutter-input-device.h" | ||||
| #include "clutter-input-pointer-a11y-private.h" | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-virtual-input-device.h" | ||||
|  | ||||
| static gboolean | ||||
| is_secondary_click_enabled (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_dwell_click_enabled (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED); | ||||
| } | ||||
|  | ||||
| static unsigned int | ||||
| get_secondary_click_delay (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return settings.secondary_click_delay; | ||||
| } | ||||
|  | ||||
| static unsigned int | ||||
| get_dwell_delay (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return settings.dwell_delay; | ||||
| } | ||||
|  | ||||
| static unsigned int | ||||
| get_dwell_threshold (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return settings.dwell_threshold; | ||||
| } | ||||
|  | ||||
| static ClutterPointerA11yDwellMode | ||||
| get_dwell_mode (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return settings.dwell_mode; | ||||
| } | ||||
|  | ||||
| static ClutterPointerA11yDwellClickType | ||||
| get_dwell_click_type (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   return settings.dwell_click_type; | ||||
| } | ||||
|  | ||||
| static ClutterPointerA11yDwellClickType | ||||
| get_dwell_click_type_for_direction (ClutterInputDevice               *device, | ||||
|                                     ClutterPointerA11yDwellDirection  direction) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   if (direction == settings.dwell_gesture_single) | ||||
|     return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY; | ||||
|   else if (direction == settings.dwell_gesture_double) | ||||
|     return CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE; | ||||
|   else if (direction == settings.dwell_gesture_drag) | ||||
|     return CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG; | ||||
|   else if (direction == settings.dwell_gesture_secondary) | ||||
|     return CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY; | ||||
|  | ||||
|   return CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| emit_button_press (ClutterInputDevice *device, | ||||
|                    gint                button) | ||||
| { | ||||
|   clutter_virtual_input_device_notify_button (device->accessibility_virtual_device, | ||||
|                                               g_get_monotonic_time (), | ||||
|                                               button, | ||||
|                                               CLUTTER_BUTTON_STATE_PRESSED); | ||||
| } | ||||
|  | ||||
| static void | ||||
| emit_button_release (ClutterInputDevice *device, | ||||
|                      gint                button) | ||||
| { | ||||
|   clutter_virtual_input_device_notify_button (device->accessibility_virtual_device, | ||||
|                                               g_get_monotonic_time (), | ||||
|                                               button, | ||||
|                                               CLUTTER_BUTTON_STATE_RELEASED); | ||||
| } | ||||
|  | ||||
| static void | ||||
| emit_button_click (ClutterInputDevice *device, | ||||
|                    gint                button) | ||||
| { | ||||
|   emit_button_press (device, button); | ||||
|   emit_button_release (device, button); | ||||
| } | ||||
|  | ||||
| static void | ||||
| restore_dwell_position (ClutterInputDevice *device) | ||||
| { | ||||
|   clutter_virtual_input_device_notify_absolute_motion (device->accessibility_virtual_device, | ||||
|                                                        g_get_monotonic_time (), | ||||
|                                                        device->ptr_a11y_data->dwell_x, | ||||
|                                                        device->ptr_a11y_data->dwell_y); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_secondary_click (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|  | ||||
|   device->ptr_a11y_data->secondary_click_triggered = TRUE; | ||||
|   device->ptr_a11y_data->secondary_click_timer = 0; | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|                          TRUE); | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| start_secondary_click_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   unsigned int delay = get_secondary_click_delay (device); | ||||
|  | ||||
|   device->ptr_a11y_data->secondary_click_timer = | ||||
|     clutter_threads_add_timeout (delay, trigger_secondary_click, device); | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-started", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|                          delay); | ||||
| } | ||||
|  | ||||
| static void | ||||
| stop_secondary_click_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   if (device->ptr_a11y_data->secondary_click_timer) | ||||
|     { | ||||
|       g_source_remove (device->ptr_a11y_data->secondary_click_timer); | ||||
|       device->ptr_a11y_data->secondary_click_timer = 0; | ||||
|  | ||||
|       g_signal_emit_by_name (device->device_manager, | ||||
|                              "ptr-a11y-timeout-stopped", | ||||
|                              device, | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK, | ||||
|                              FALSE); | ||||
|     } | ||||
|   device->ptr_a11y_data->secondary_click_triggered = FALSE; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| pointer_has_moved (ClutterInputDevice *device) | ||||
| { | ||||
|   float dx, dy; | ||||
|   gint threshold; | ||||
|  | ||||
|   dx = device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x; | ||||
|   dy = device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y; | ||||
|   threshold = get_dwell_threshold (device); | ||||
|  | ||||
|   /* Pythagorean theorem */ | ||||
|   return ((dx * dx) + (dy * dy)) > (threshold * threshold); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_secondary_click_pending (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->secondary_click_timer != 0; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_secondary_click_triggered (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->secondary_click_triggered; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_dwell_click_pending (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->dwell_timer != 0; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_dwell_dragging (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->dwell_drag_started; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_dwell_gesturing (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->dwell_gesture_started; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| has_button_pressed (ClutterInputDevice *device) | ||||
| { | ||||
|   return device->ptr_a11y_data->n_btn_pressed > 0; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| should_start_secondary_click_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   return !is_dwell_dragging (device); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| should_start_dwell (ClutterInputDevice *device) | ||||
| { | ||||
|   /* We should trigger a dwell if we've not already started one, and if | ||||
|    * no button is currently pressed or we are in the middle of a dwell | ||||
|    * drag action. | ||||
|    */ | ||||
|   return !is_dwell_click_pending (device) && | ||||
|          (is_dwell_dragging (device) || | ||||
|           !has_button_pressed (device)); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| should_stop_dwell (ClutterInputDevice *device) | ||||
| { | ||||
|   /* We should stop a dwell if the motion exceeds the threshold, unless | ||||
|    * we've started a gesture, because we want to keep the original dwell | ||||
|    * location to both detect a gesture and restore the original pointer | ||||
|    * location once the gesture is finished. | ||||
|    */ | ||||
|   return pointer_has_moved (device) && | ||||
|          !is_dwell_gesturing (device); | ||||
| } | ||||
|  | ||||
|  | ||||
| static gboolean | ||||
| should_update_dwell_position (ClutterInputDevice *device) | ||||
| { | ||||
|   return !is_dwell_gesturing (device) && | ||||
|          !is_dwell_click_pending (device) && | ||||
|          !is_secondary_click_pending (device); | ||||
| } | ||||
|  | ||||
| static void | ||||
| update_dwell_click_type (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterPointerA11ySettings settings; | ||||
|   ClutterPointerA11yDwellClickType dwell_click_type; | ||||
|  | ||||
|   clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings); | ||||
|  | ||||
|   dwell_click_type = settings.dwell_click_type; | ||||
|   switch (dwell_click_type) | ||||
|     { | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE: | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY: | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE: | ||||
|       dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG: | ||||
|       if (!is_dwell_dragging (device)) | ||||
|         dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY; | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY: | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE: | ||||
|     default: | ||||
|       break; | ||||
|     } | ||||
|  | ||||
|   if (dwell_click_type != settings.dwell_click_type) | ||||
|     { | ||||
|       settings.dwell_click_type = dwell_click_type; | ||||
|       clutter_device_manager_set_pointer_a11y_settings (device->device_manager, | ||||
|                                                         &settings); | ||||
|  | ||||
|       g_signal_emit_by_name (device->device_manager, | ||||
|                              "ptr-a11y-dwell-click-type-changed", | ||||
|                              dwell_click_type); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| emit_dwell_click (ClutterInputDevice               *device, | ||||
|                   ClutterPointerA11yDwellClickType  dwell_click_type) | ||||
| { | ||||
|   switch (dwell_click_type) | ||||
|     { | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY: | ||||
|       emit_button_click (device, CLUTTER_BUTTON_PRIMARY); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE: | ||||
|       emit_button_click (device, CLUTTER_BUTTON_PRIMARY); | ||||
|       emit_button_click (device, CLUTTER_BUTTON_PRIMARY); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG: | ||||
|       if (is_dwell_dragging (device)) | ||||
|         { | ||||
|           emit_button_release (device, CLUTTER_BUTTON_PRIMARY); | ||||
|           device->ptr_a11y_data->dwell_drag_started = FALSE; | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           emit_button_press (device, CLUTTER_BUTTON_PRIMARY); | ||||
|           device->ptr_a11y_data->dwell_drag_started = TRUE; | ||||
|         } | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY: | ||||
|       emit_button_click (device, CLUTTER_BUTTON_SECONDARY); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE: | ||||
|       emit_button_click (device, CLUTTER_BUTTON_MIDDLE); | ||||
|       break; | ||||
|  | ||||
|     case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE: | ||||
|     default: | ||||
|       break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static ClutterPointerA11yDwellDirection | ||||
| get_dwell_direction (ClutterInputDevice *device) | ||||
| { | ||||
|   float dx, dy; | ||||
|  | ||||
|   dx = ABS (device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x); | ||||
|   dy = ABS (device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y); | ||||
|  | ||||
|   /* The pointer hasn't moved */ | ||||
|   if (!pointer_has_moved (device)) | ||||
|     return CLUTTER_A11Y_DWELL_DIRECTION_NONE; | ||||
|  | ||||
|   if (device->ptr_a11y_data->dwell_x < device->ptr_a11y_data->current_x) | ||||
|     { | ||||
|       if (dx > dy) | ||||
|         return CLUTTER_A11Y_DWELL_DIRECTION_LEFT; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       if (dx > dy) | ||||
|         return CLUTTER_A11Y_DWELL_DIRECTION_RIGHT; | ||||
|     } | ||||
|  | ||||
|   if (device->ptr_a11y_data->dwell_y < device->ptr_a11y_data->current_y) | ||||
|     return CLUTTER_A11Y_DWELL_DIRECTION_UP; | ||||
|  | ||||
|   return CLUTTER_A11Y_DWELL_DIRECTION_DOWN; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_clear_dwell_gesture (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_timer = 0; | ||||
|   device->ptr_a11y_data->dwell_gesture_started = FALSE; | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_dwell_gesture (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|   ClutterPointerA11yDwellDirection direction; | ||||
|   unsigned int delay = get_dwell_delay (device); | ||||
|  | ||||
|   restore_dwell_position (device); | ||||
|   direction = get_dwell_direction (device); | ||||
|   emit_dwell_click (device, | ||||
|                     get_dwell_click_type_for_direction (device, | ||||
|                                                         direction)); | ||||
|  | ||||
|   /* Do not clear the gesture right away, otherwise we'll start another one */ | ||||
|   device->ptr_a11y_data->dwell_timer = | ||||
|     clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device); | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE, | ||||
|                          TRUE); | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| start_dwell_gesture_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   unsigned int delay = get_dwell_delay (device); | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_timer = | ||||
|     clutter_threads_add_timeout (delay, trigger_dwell_gesture, device); | ||||
|   device->ptr_a11y_data->dwell_gesture_started = TRUE; | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-started", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE, | ||||
|                          delay); | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_dwell_click (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_timer = 0; | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-stopped", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|                          TRUE); | ||||
|  | ||||
|   if (get_dwell_mode (device) == CLUTTER_A11Y_DWELL_MODE_GESTURE) | ||||
|     { | ||||
|       if (is_dwell_dragging (device)) | ||||
|         emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG); | ||||
|       else | ||||
|         start_dwell_gesture_timeout (device); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       emit_dwell_click (device, get_dwell_click_type (device)); | ||||
|       update_dwell_click_type (device); | ||||
|     } | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| start_dwell_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   unsigned int delay = get_dwell_delay (device); | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_timer = | ||||
|     clutter_threads_add_timeout (delay, trigger_dwell_click, device); | ||||
|  | ||||
|   g_signal_emit_by_name (device->device_manager, | ||||
|                          "ptr-a11y-timeout-started", | ||||
|                          device, | ||||
|                          CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|                          delay); | ||||
| } | ||||
|  | ||||
| static void | ||||
| stop_dwell_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   if (device->ptr_a11y_data->dwell_timer) | ||||
|     { | ||||
|       g_source_remove (device->ptr_a11y_data->dwell_timer); | ||||
|       device->ptr_a11y_data->dwell_timer = 0; | ||||
|       device->ptr_a11y_data->dwell_gesture_started = FALSE; | ||||
|  | ||||
|       g_signal_emit_by_name (device->device_manager, | ||||
|                              "ptr-a11y-timeout-stopped", | ||||
|                              device, | ||||
|                              CLUTTER_A11Y_TIMEOUT_TYPE_DWELL, | ||||
|                              FALSE); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| trigger_dwell_position_timeout (gpointer data) | ||||
| { | ||||
|   ClutterInputDevice *device = data; | ||||
|  | ||||
|   device->ptr_a11y_data->dwell_position_timer = 0; | ||||
|  | ||||
|   if (is_dwell_click_enabled (device)) | ||||
|     { | ||||
|       if (!pointer_has_moved (device)) | ||||
|         start_dwell_timeout (device); | ||||
|     } | ||||
|  | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| start_dwell_position_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   device->ptr_a11y_data->dwell_position_timer = | ||||
|     clutter_threads_add_timeout (100, trigger_dwell_position_timeout, device); | ||||
| } | ||||
|  | ||||
| static void | ||||
| stop_dwell_position_timeout (ClutterInputDevice *device) | ||||
| { | ||||
|   g_clear_handle_id (&device->ptr_a11y_data->dwell_position_timer, | ||||
|                      g_source_remove); | ||||
| } | ||||
|  | ||||
| static void | ||||
| update_dwell_position (ClutterInputDevice *device) | ||||
| { | ||||
|   device->ptr_a11y_data->dwell_x = device->ptr_a11y_data->current_x; | ||||
|   device->ptr_a11y_data->dwell_y = device->ptr_a11y_data->current_y; | ||||
| } | ||||
|  | ||||
| static void | ||||
| update_current_position (ClutterInputDevice *device, | ||||
|                          float               x, | ||||
|                          float               y) | ||||
| { | ||||
|   device->ptr_a11y_data->current_x = x; | ||||
|   device->ptr_a11y_data->current_y = y; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| is_device_core_pointer (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterInputDevice *core_pointer; | ||||
|  | ||||
|   core_pointer = clutter_device_manager_get_core_device (device->device_manager, | ||||
|                                                          CLUTTER_POINTER_DEVICE); | ||||
|   if (core_pointer == NULL) | ||||
|     return FALSE; | ||||
|  | ||||
|   return (core_pointer == device); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device) | ||||
| { | ||||
|   if (!is_device_core_pointer (device)) | ||||
|     return; | ||||
|  | ||||
|   device->accessibility_virtual_device = | ||||
|     clutter_device_manager_create_virtual_device (device->device_manager, | ||||
|                                                   CLUTTER_POINTER_DEVICE); | ||||
|  | ||||
|   device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device) | ||||
| { | ||||
|   if (!is_device_core_pointer (device)) | ||||
|     return; | ||||
|  | ||||
|   /* Terminate a drag if started */ | ||||
|   if (is_dwell_dragging (device)) | ||||
|     emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG); | ||||
|  | ||||
|   stop_dwell_position_timeout (device); | ||||
|   stop_dwell_timeout (device); | ||||
|   stop_secondary_click_timeout (device); | ||||
|  | ||||
|   g_clear_pointer (&device->ptr_a11y_data, g_free); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device, | ||||
|                                              float               x, | ||||
|                                              float               y) | ||||
| { | ||||
|   if (!is_device_core_pointer (device)) | ||||
|     return; | ||||
|  | ||||
|   if (!_clutter_is_input_pointer_a11y_enabled (device)) | ||||
|     return; | ||||
|  | ||||
|   update_current_position (device, x, y); | ||||
|  | ||||
|   if (is_secondary_click_enabled (device)) | ||||
|     { | ||||
|       if (pointer_has_moved (device)) | ||||
|         stop_secondary_click_timeout (device); | ||||
|     } | ||||
|  | ||||
|   if (is_dwell_click_enabled (device)) | ||||
|     { | ||||
|       stop_dwell_position_timeout (device); | ||||
|  | ||||
|       if (should_stop_dwell (device)) | ||||
|         stop_dwell_timeout (device); | ||||
|  | ||||
|       if (should_start_dwell (device)) | ||||
|         start_dwell_position_timeout (device); | ||||
|     } | ||||
|  | ||||
|   if (should_update_dwell_position (device)) | ||||
|     update_dwell_position (device); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device, | ||||
|                                              int                 button, | ||||
|                                              gboolean            pressed) | ||||
| { | ||||
|   if (!is_device_core_pointer (device)) | ||||
|     return; | ||||
|  | ||||
|   if (!_clutter_is_input_pointer_a11y_enabled (device)) | ||||
|     return; | ||||
|  | ||||
|   if (pressed) | ||||
|     { | ||||
|       device->ptr_a11y_data->n_btn_pressed++; | ||||
|  | ||||
|       stop_dwell_position_timeout (device); | ||||
|  | ||||
|       if (is_dwell_click_enabled (device)) | ||||
|         stop_dwell_timeout (device); | ||||
|  | ||||
|       if (is_dwell_dragging (device)) | ||||
|         stop_dwell_timeout (device); | ||||
|  | ||||
|       if (is_secondary_click_enabled (device)) | ||||
|         { | ||||
|           if (button == CLUTTER_BUTTON_PRIMARY) | ||||
|             { | ||||
|               if (should_start_secondary_click_timeout (device)) | ||||
|                 start_secondary_click_timeout (device); | ||||
|             } | ||||
|           else if (is_secondary_click_pending (device)) | ||||
|             { | ||||
|               stop_secondary_click_timeout (device); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       if (has_button_pressed (device)) | ||||
|         device->ptr_a11y_data->n_btn_pressed--; | ||||
|  | ||||
|       if (is_secondary_click_triggered (device)) | ||||
|         { | ||||
|           emit_button_click (device, CLUTTER_BUTTON_SECONDARY); | ||||
|           stop_secondary_click_timeout (device); | ||||
|         } | ||||
|  | ||||
|       if (is_secondary_click_pending (device)) | ||||
|         stop_secondary_click_timeout (device); | ||||
|  | ||||
|       if (is_dwell_dragging (device)) | ||||
|         emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG); | ||||
|     } | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE); | ||||
|  | ||||
|   return (is_secondary_click_enabled (device) || is_dwell_click_enabled (device)); | ||||
| } | ||||
| @@ -444,8 +444,7 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass) | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterLayoutManagerClass, | ||||
|                                    layout_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
| } | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -117,9 +117,6 @@ void                    clutter_disable_accessibility           (void); | ||||
|  | ||||
| /* Threading functions */ | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_threads_set_lock_functions      (GCallback enter_fn, | ||||
|                                                                  GCallback leave_fn); | ||||
| CLUTTER_EXPORT | ||||
| guint                   clutter_threads_add_idle                (GSourceFunc    func, | ||||
|                                                                  gpointer       data); | ||||
| CLUTTER_EXPORT | ||||
| @@ -149,19 +146,6 @@ guint                   clutter_threads_add_repaint_func_full   (ClutterRepaintF | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_threads_remove_repaint_func     (guint          handle_id); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_grab_pointer                    (ClutterActor  *actor); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_ungrab_pointer                  (void); | ||||
| CLUTTER_EXPORT | ||||
| ClutterActor *          clutter_get_pointer_grab                (void); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_grab_keyboard                   (ClutterActor  *actor); | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_ungrab_keyboard                 (void); | ||||
| CLUTTER_EXPORT | ||||
| ClutterActor *          clutter_get_keyboard_grab               (void); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| PangoFontMap *          clutter_get_font_map                    (void); | ||||
|  | ||||
|   | ||||
| @@ -12,29 +12,24 @@ BOOLEAN:OBJECT,FLOAT,FLOAT | ||||
| BOXED:UINT,UINT | ||||
| DOUBLE:VOID | ||||
| UINT:VOID | ||||
| VOID:BOOLEAN | ||||
| VOID:BOXED | ||||
| VOID:BOXED,FLAGS | ||||
| VOID:INT | ||||
| VOID:INT64,INT64,FLOAT,BOOLEAN | ||||
| VOID:INT,INT | ||||
| VOID:INT,POINTER | ||||
| VOID:FLOAT,FLOAT | ||||
| VOID:INT,INT,INT,INT | ||||
| VOID:OBJECT | ||||
| VOID:OBJECT,FLAGS | ||||
| VOID:OBJECT,FLAGS,BOOLEAN | ||||
| VOID:OBJECT,FLAGS,UINT | ||||
| VOID:OBJECT,FLOAT,FLOAT | ||||
| VOID:OBJECT,FLOAT,FLOAT,FLAGS | ||||
| VOID:OBJECT,OBJECT | ||||
| VOID:OBJECT,PARAM | ||||
| VOID:OBJECT,POINTER | ||||
| VOID:OBJECT,UINT | ||||
| VOID:POINTER | ||||
| VOID:STRING,BOOLEAN | ||||
| VOID:STRING,BOOLEAN,BOOLEAN | ||||
| VOID:STRING,INT | ||||
| VOID:UINT | ||||
| VOID:UINT,STRING,UINT | ||||
| VOID:UINT,UINT | ||||
| VOID:VOID | ||||
| VOID:STRING,INT,POINTER | ||||
|   | ||||
| @@ -64,9 +64,6 @@ struct _ClutterMasterClockDefault | ||||
|   /* the current state of the clock, in usecs */ | ||||
|   gint64 cur_tick; | ||||
|  | ||||
|   /* the previous state of the clock, in usecs, used to compute the delta */ | ||||
|   gint64 prev_tick; | ||||
|  | ||||
| #ifdef CLUTTER_ENABLE_DEBUG | ||||
|   gint64 frame_budget; | ||||
|   gint64 remaining_budget; | ||||
| @@ -77,12 +74,6 @@ struct _ClutterMasterClockDefault | ||||
|    */ | ||||
|   GSource *source; | ||||
|  | ||||
|   /* If the master clock is idle that means it has | ||||
|    * fallen back to idle polling for timeline | ||||
|    * progressions and it may have been some time since | ||||
|    * the last real stage update. | ||||
|    */ | ||||
|   guint idle : 1; | ||||
|   guint ensure_next_iteration : 1; | ||||
|  | ||||
|   guint paused : 1; | ||||
| @@ -275,78 +266,12 @@ master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock, | ||||
| static gint | ||||
| master_clock_next_frame_delay (ClutterMasterClockDefault *master_clock) | ||||
| { | ||||
|   gint64 now, next; | ||||
|   gint swap_delay; | ||||
|  | ||||
|   if (!master_clock_is_running (master_clock)) | ||||
|     return -1; | ||||
|  | ||||
|   /* If all of the stages are busy waiting for a swap-buffers to complete | ||||
|    * then we wait for one to be ready.. */ | ||||
|   swap_delay = master_clock_get_swap_wait_time (master_clock); | ||||
|   if (swap_delay != 0) | ||||
|     return swap_delay; | ||||
|  | ||||
|   /* When we have sync-to-vblank, we count on swap-buffer requests (or | ||||
|    * swap-buffer-complete events if supported in the backend) to throttle our | ||||
|    * frame rate so no additional delay is needed to start the next frame. | ||||
|    * | ||||
|    * If the master-clock has become idle due to no timeline progression causing | ||||
|    * redraws then we can no longer rely on vblank synchronization because the | ||||
|    * last real stage update/redraw may have happened a long time ago and so we | ||||
|    * fallback to polling for timeline progressions every 1/frame_rate seconds. | ||||
|    * | ||||
|    * (NB: if there aren't even any timelines running then the master clock will | ||||
|    * be completely stopped in master_clock_is_running()) | ||||
|    */ | ||||
|   if (clutter_feature_available (CLUTTER_FEATURE_SWAP_THROTTLE) && | ||||
|       !master_clock->idle) | ||||
|     { | ||||
|       CLUTTER_NOTE (SCHEDULER, "swap throttling available and updated stages"); | ||||
|       return 0; | ||||
|     } | ||||
|  | ||||
|   if (master_clock->prev_tick == 0) | ||||
|     { | ||||
|       /* If we weren't previously running, then draw the next frame | ||||
|        * immediately | ||||
|        */ | ||||
|       CLUTTER_NOTE (SCHEDULER, "draw the first frame immediately"); | ||||
|       return 0; | ||||
|     } | ||||
|  | ||||
|   /* Otherwise, wait at least 1/frame_rate seconds since we last | ||||
|    * started a frame | ||||
|    */ | ||||
|   now = g_source_get_time (master_clock->source); | ||||
|  | ||||
|   next = master_clock->prev_tick; | ||||
|  | ||||
|   /* If time has gone backwards then there's no way of knowing how | ||||
|      long we should wait so let's just dispatch immediately */ | ||||
|   if (now <= next) | ||||
|     { | ||||
|       CLUTTER_NOTE (SCHEDULER, "Time has gone backwards"); | ||||
|  | ||||
|       return 0; | ||||
|     } | ||||
|  | ||||
|   next += (1000000L / clutter_get_default_frame_rate ()); | ||||
|  | ||||
|   if (next <= now) | ||||
|     { | ||||
|       CLUTTER_NOTE (SCHEDULER, "Less than %lu microsecs", | ||||
|                     1000000L / (gulong) clutter_get_default_frame_rate ()); | ||||
|  | ||||
|       return 0; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       CLUTTER_NOTE (SCHEDULER, "Waiting %" G_GINT64_FORMAT " msecs", | ||||
|                    (next - now) / 1000); | ||||
|  | ||||
|       return (next - now) / 1000; | ||||
|     } | ||||
|   return master_clock_get_swap_wait_time (master_clock); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -412,8 +337,7 @@ master_clock_advance_timelines (ClutterMasterClockDefault *master_clock) | ||||
|   for (l = timelines; l != NULL; l = l->next) | ||||
|     _clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000); | ||||
|  | ||||
|   g_slist_foreach (timelines, (GFunc) g_object_unref, NULL); | ||||
|   g_slist_free (timelines); | ||||
|   g_slist_free_full (timelines, g_object_unref); | ||||
|  | ||||
| #ifdef CLUTTER_ENABLE_DEBUG | ||||
|   if (_clutter_diagnostic_enabled ()) | ||||
| @@ -531,7 +455,6 @@ clutter_clock_dispatch (GSource     *source, | ||||
| { | ||||
|   ClutterClockSource *clock_source = (ClutterClockSource *) source; | ||||
|   ClutterMasterClockDefault *master_clock = clock_source->master_clock; | ||||
|   gboolean stages_updated = FALSE; | ||||
|   GSList *stages; | ||||
|  | ||||
|   CLUTTER_NOTE (SCHEDULER, "Master clock [tick]"); | ||||
| @@ -551,8 +474,6 @@ clutter_clock_dispatch (GSource     *source, | ||||
|    */ | ||||
|   stages = master_clock_list_ready_stages (master_clock); | ||||
|  | ||||
|   master_clock->idle = FALSE; | ||||
|  | ||||
|   /* Each frame is split into three separate phases: */ | ||||
|  | ||||
|   /* 1. process all the events; each stage goes through its events queue | ||||
| @@ -565,19 +486,11 @@ clutter_clock_dispatch (GSource     *source, | ||||
|   master_clock_advance_timelines (master_clock); | ||||
|  | ||||
|   /* 3. relayout and redraw the stages */ | ||||
|   stages_updated = master_clock_update_stages (master_clock, stages); | ||||
|  | ||||
|   /* The master clock goes idle if no stages were updated and falls back | ||||
|    * to polling for timeline progressions... */ | ||||
|   if (!stages_updated) | ||||
|     master_clock->idle = TRUE; | ||||
|   master_clock_update_stages (master_clock, stages); | ||||
|  | ||||
|   master_clock_reschedule_stage_updates (master_clock, stages); | ||||
|  | ||||
|   g_slist_foreach (stages, (GFunc) g_object_unref, NULL); | ||||
|   g_slist_free (stages); | ||||
|  | ||||
|   master_clock->prev_tick = master_clock->cur_tick; | ||||
|   g_slist_free_full (stages, g_object_unref); | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
| @@ -610,7 +523,6 @@ clutter_master_clock_default_init (ClutterMasterClockDefault *self) | ||||
|   source = clutter_clock_source_new (self); | ||||
|   self->source = source; | ||||
|  | ||||
|   self->idle = FALSE; | ||||
|   self->ensure_next_iteration = FALSE; | ||||
|   self->paused = FALSE; | ||||
|  | ||||
|   | ||||
| @@ -26,10 +26,15 @@ | ||||
| #define __CLUTTER_H_INSIDE__ | ||||
|  | ||||
| #include "clutter-backend.h" | ||||
| #include "clutter-device-manager-private.h" | ||||
| #include "clutter-event-private.h" | ||||
| #include "clutter-input-pointer-a11y-private.h" | ||||
| #include "clutter-macros.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
| #include "clutter-stage-view.h" | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
| #include "x11/clutter-stage-x11.h" | ||||
| #include "clutter/x11/clutter-backend-x11.h" | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_set_custom_backend_func (ClutterBackend *(* func) (void)); | ||||
|   | ||||
| @@ -138,8 +138,6 @@ G_GNUC_INTERNAL | ||||
| ClutterPaintNode *      clutter_paint_node_get_last_child               (ClutterPaintNode      *node); | ||||
| G_GNUC_INTERNAL | ||||
| ClutterPaintNode *      clutter_paint_node_get_parent                   (ClutterPaintNode      *node); | ||||
| G_GNUC_INTERNAL | ||||
| CoglFramebuffer *       clutter_paint_node_get_framebuffer              (ClutterPaintNode      *node); | ||||
|  | ||||
| #define CLUTTER_TYPE_LAYER_NODE                 (_clutter_layer_node_get_type ()) | ||||
| #define CLUTTER_LAYER_NODE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode)) | ||||
|   | ||||
| @@ -1194,6 +1194,15 @@ clutter_paint_node_get_root (ClutterPaintNode *node) | ||||
|   return iter; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_paint_node_get_framebuffer: | ||||
|  * @node: a #ClutterPaintNode | ||||
|  * | ||||
|  * Retrieves the #CoglFramebuffer that @node will draw | ||||
|  * into. | ||||
|  * | ||||
|  * Returns: (transfer none): a #CoglFramebuffer | ||||
|  */ | ||||
| CoglFramebuffer * | ||||
| clutter_paint_node_get_framebuffer (ClutterPaintNode *node) | ||||
| { | ||||
|   | ||||
| @@ -56,6 +56,9 @@ CLUTTER_EXPORT | ||||
| void                    clutter_paint_node_set_name                     (ClutterPaintNode      *node, | ||||
|                                                                          const char            *name); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| CoglFramebuffer *       clutter_paint_node_get_framebuffer              (ClutterPaintNode      *node); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    clutter_paint_node_add_child                    (ClutterPaintNode      *node, | ||||
|                                                                          ClutterPaintNode      *child); | ||||
|   | ||||
| @@ -579,8 +579,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -295,8 +295,7 @@ clutter_path_clear (ClutterPath *path) | ||||
| { | ||||
|   ClutterPathPrivate *priv = path->priv; | ||||
|  | ||||
|   g_slist_foreach (priv->nodes, (GFunc) clutter_path_node_full_free, NULL); | ||||
|   g_slist_free (priv->nodes); | ||||
|   g_slist_free_full (priv->nodes, (GDestroyNotify) clutter_path_node_full_free); | ||||
|  | ||||
|   priv->nodes = priv->nodes_tail = NULL; | ||||
|   priv->nodes_dirty = TRUE; | ||||
| @@ -659,8 +658,7 @@ clutter_path_parse_description (const gchar  *p, | ||||
|   return TRUE; | ||||
|  | ||||
|  fail: | ||||
|   g_slist_foreach (nodes, (GFunc) clutter_path_node_full_free, NULL); | ||||
|   g_slist_free (nodes); | ||||
|   g_slist_free_full (nodes, (GDestroyNotify) clutter_path_node_full_free); | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -85,7 +85,6 @@ typedef struct _ClutterVertex4          ClutterVertex4; | ||||
| /* keep this for source compatibility with clutter */ | ||||
| #define P_(String) (String) | ||||
| #define N_(String) (String) | ||||
| #define _(String) (String) | ||||
|  | ||||
| /* This is a replacement for the nearbyint function which always rounds to the | ||||
|  * nearest integer. nearbyint is apparently a C99 function so it might not | ||||
| @@ -142,13 +141,6 @@ struct _ClutterMainContext | ||||
|   /* default FPS; this is only used if we cannot sync to vblank */ | ||||
|   guint frame_rate; | ||||
|  | ||||
|   /* actors with a grab on all devices */ | ||||
|   ClutterActor *pointer_grab_actor; | ||||
|   ClutterActor *keyboard_grab_actor; | ||||
|  | ||||
|   /* stack of actors with shaders during paint */ | ||||
|   GSList *shaders; | ||||
|  | ||||
|   /* fb bit masks for col<->id mapping in picking */ | ||||
|   gint fb_r_mask; | ||||
|   gint fb_g_mask; | ||||
| @@ -173,7 +165,6 @@ struct _ClutterMainContext | ||||
|  | ||||
|   /* boolean flags */ | ||||
|   guint is_initialized          : 1; | ||||
|   guint motion_events_per_actor : 1; | ||||
|   guint defer_display_setup     : 1; | ||||
|   guint options_parsed          : 1; | ||||
|   guint show_fps                : 1; | ||||
| @@ -190,7 +181,9 @@ typedef struct | ||||
| gboolean _clutter_threads_dispatch      (gpointer data); | ||||
| void     _clutter_threads_dispatch_free (gpointer data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_threads_acquire_lock                   (void); | ||||
| CLUTTER_EXPORT | ||||
| void                    _clutter_threads_release_lock                   (void); | ||||
|  | ||||
| ClutterMainContext *    _clutter_context_get_default                    (void); | ||||
| @@ -198,10 +191,6 @@ void                    _clutter_context_lock                           (void); | ||||
| void                    _clutter_context_unlock                         (void); | ||||
| gboolean                _clutter_context_is_initialized                 (void); | ||||
| ClutterPickMode         _clutter_context_get_pick_mode                  (void); | ||||
| void                    _clutter_context_push_shader_stack              (ClutterActor *actor); | ||||
| ClutterActor *          _clutter_context_pop_shader_stack               (ClutterActor *actor); | ||||
| ClutterActor *          _clutter_context_peek_shader_stack              (void); | ||||
| gboolean                _clutter_context_get_motion_events_enabled      (void); | ||||
| gboolean                _clutter_context_get_show_fps                   (void); | ||||
|  | ||||
| gboolean      _clutter_feature_init (GError **error); | ||||
| @@ -210,11 +199,7 @@ gboolean      _clutter_feature_init (GError **error); | ||||
| gboolean        _clutter_diagnostic_enabled     (void); | ||||
| void            _clutter_diagnostic_message     (const char *fmt, ...) G_GNUC_PRINTF (1, 2); | ||||
|  | ||||
| /* Picking code */ | ||||
| guint           _clutter_pixel_to_id            (guchar        pixel[4]); | ||||
| void            _clutter_id_to_color            (guint         id, | ||||
|                                                  ClutterColor *col); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            _clutter_set_sync_to_vblank     (gboolean      sync_to_vblank); | ||||
|  | ||||
| /* use this function as the accumulator if you have a signal with | ||||
| @@ -303,6 +288,12 @@ gboolean        _clutter_util_matrix_decompose  (const ClutterMatrix *src, | ||||
|                                                  ClutterVertex       *translate_p, | ||||
|                                                  ClutterVertex4      *perspective_p); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| PangoDirection _clutter_pango_unichar_direction (gunichar ch); | ||||
|  | ||||
| PangoDirection _clutter_pango_find_base_dir     (const gchar *text, | ||||
|                                                  gint         length); | ||||
|  | ||||
| typedef struct _ClutterPlane | ||||
| { | ||||
|   float v0[3]; | ||||
|   | ||||
| @@ -1636,14 +1636,17 @@ clutter_script_translate_parameters (ClutterScript  *script, | ||||
|                                      GObject        *object, | ||||
|                                      const gchar    *name, | ||||
|                                      GList          *properties, | ||||
|                                      GArray        **params) | ||||
|                                      GPtrArray     **param_names, | ||||
|                                      GArray        **param_values) | ||||
| { | ||||
|   ClutterScriptable *scriptable = NULL; | ||||
|   ClutterScriptableIface *iface = NULL; | ||||
|   GList *l, *unparsed; | ||||
|   gboolean parse_custom = FALSE; | ||||
|  | ||||
|   *params = g_array_new (FALSE, FALSE, sizeof (GParameter)); | ||||
|   *param_names = g_ptr_array_new_with_free_func (g_free); | ||||
|   *param_values = g_array_new (FALSE, FALSE, sizeof (GValue)); | ||||
|   g_array_set_clear_func (*param_values, (GDestroyNotify) g_value_unset); | ||||
|  | ||||
|   if (CLUTTER_IS_SCRIPTABLE (object)) | ||||
|     { | ||||
| @@ -1659,7 +1662,7 @@ clutter_script_translate_parameters (ClutterScript  *script, | ||||
|   for (l = properties; l != NULL; l = l->next) | ||||
|     { | ||||
|       PropertyInfo *pinfo = l->data; | ||||
|       GParameter param = { NULL }; | ||||
|       GValue value = G_VALUE_INIT; | ||||
|       gboolean res = FALSE; | ||||
|  | ||||
|       if (pinfo->is_child || pinfo->is_layout) | ||||
| @@ -1676,12 +1679,12 @@ clutter_script_translate_parameters (ClutterScript  *script, | ||||
|                     pinfo->name); | ||||
|  | ||||
|       if (parse_custom) | ||||
|         res = iface->parse_custom_node (scriptable, script, ¶m.value, | ||||
|         res = iface->parse_custom_node (scriptable, script, &value, | ||||
|                                         pinfo->name, | ||||
|                                         pinfo->node); | ||||
|  | ||||
|       if (!res) | ||||
|         res = _clutter_script_parse_node (script, ¶m.value, | ||||
|         res = _clutter_script_parse_node (script, &value, | ||||
|                                           pinfo->name, | ||||
|                                           pinfo->node, | ||||
|                                           pinfo->pspec); | ||||
| @@ -1693,9 +1696,8 @@ clutter_script_translate_parameters (ClutterScript  *script, | ||||
|           continue; | ||||
|         } | ||||
|  | ||||
|       param.name = g_strdup (pinfo->name); | ||||
|  | ||||
|       g_array_append_val (*params, param); | ||||
|       g_ptr_array_add (*param_names, g_strdup (pinfo->name)); | ||||
|       g_array_append_val (*param_values, value); | ||||
|  | ||||
|       property_info_free (pinfo); | ||||
|     } | ||||
| @@ -1710,7 +1712,8 @@ clutter_script_construct_parameters (ClutterScript  *script, | ||||
|                                      GType           gtype, | ||||
|                                      const gchar    *name, | ||||
|                                      GList          *properties, | ||||
|                                      GArray        **construct_params) | ||||
|                                      GPtrArray     **construct_param_names, | ||||
|                                      GArray        **construct_param_values) | ||||
| { | ||||
|   GObjectClass *klass; | ||||
|   GList *l, *unparsed; | ||||
| @@ -1718,14 +1721,17 @@ clutter_script_construct_parameters (ClutterScript  *script, | ||||
|   klass = g_type_class_ref (gtype); | ||||
|   g_assert (klass != NULL); | ||||
|  | ||||
|   *construct_params = g_array_new (FALSE, FALSE, sizeof (GParameter)); | ||||
|   *construct_param_names = g_ptr_array_new_with_free_func (g_free); | ||||
|   *construct_param_values = g_array_new (FALSE, FALSE, sizeof (GValue)); | ||||
|   g_array_set_clear_func (*construct_param_values, | ||||
|                           (GDestroyNotify) g_value_unset); | ||||
|  | ||||
|   unparsed = NULL; | ||||
|  | ||||
|   for (l = properties; l != NULL; l = l->next) | ||||
|     { | ||||
|       PropertyInfo *pinfo = l->data; | ||||
|       GParameter param = { NULL }; | ||||
|       GValue value = G_VALUE_INIT; | ||||
|       GParamSpec *pspec = NULL; | ||||
|  | ||||
|       /* we allow custom property names for classes, so if we | ||||
| @@ -1749,9 +1755,7 @@ clutter_script_construct_parameters (ClutterScript  *script, | ||||
|           continue; | ||||
|         } | ||||
|  | ||||
|       param.name = g_strdup (pinfo->name); | ||||
|  | ||||
|       if (!_clutter_script_parse_node (script, ¶m.value, | ||||
|       if (!_clutter_script_parse_node (script, &value, | ||||
|                                        pinfo->name, | ||||
|                                        pinfo->node, | ||||
|                                        pinfo->pspec)) | ||||
| @@ -1760,7 +1764,8 @@ clutter_script_construct_parameters (ClutterScript  *script, | ||||
|           continue; | ||||
|         } | ||||
|  | ||||
|       g_array_append_val (*construct_params, param); | ||||
|       g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name)); | ||||
|       g_array_append_val (*construct_param_values, value); | ||||
|  | ||||
|       property_info_free (pinfo); | ||||
|     } | ||||
| @@ -2021,8 +2026,7 @@ add_children (ClutterScript *script, | ||||
|       clutter_container_add_actor (container, CLUTTER_ACTOR (object)); | ||||
|     } | ||||
|  | ||||
|   g_list_foreach (oinfo->children, (GFunc) g_free, NULL); | ||||
|   g_list_free (oinfo->children); | ||||
|   g_list_free_full (oinfo->children, g_free); | ||||
|  | ||||
|   oinfo->children = unresolved; | ||||
| } | ||||
| @@ -2088,7 +2092,8 @@ _clutter_script_apply_properties (ClutterScript *script, | ||||
|   gboolean set_custom_property = FALSE; | ||||
|   GObject *object = oinfo->object; | ||||
|   GList *properties; | ||||
|   GArray *params; | ||||
|   g_autoptr (GPtrArray) param_names = NULL; | ||||
|   g_autoptr (GArray) param_values = NULL; | ||||
|   guint i; | ||||
|  | ||||
|   if (!oinfo->has_unresolved) | ||||
| @@ -2112,34 +2117,31 @@ _clutter_script_apply_properties (ClutterScript *script, | ||||
|                                                            object, | ||||
|                                                            oinfo->id, | ||||
|                                                            properties, | ||||
|                                                            ¶ms); | ||||
|                                                            ¶m_names, | ||||
|                                                            ¶m_values); | ||||
|  | ||||
|   /* consume all the properties we could translate in this pass */ | ||||
|   for (i = 0; i < params->len; i++) | ||||
|   for (i = 0; i < param_names->len; i++) | ||||
|     { | ||||
|       GParameter *param = &g_array_index (params, GParameter, i); | ||||
|       char *name = g_ptr_array_index (param_names, i); | ||||
|       GValue *value = &g_array_index (param_values, GValue, i); | ||||
|  | ||||
|       CLUTTER_NOTE (SCRIPT, | ||||
|                     "Setting %s property '%s' (type:%s) to object '%s' (id:%s)", | ||||
|                     set_custom_property ? "custom" : "regular", | ||||
|                     param->name, | ||||
|                     g_type_name (G_VALUE_TYPE (¶m->value)), | ||||
|                     name, | ||||
|                     g_type_name (G_VALUE_TYPE (value)), | ||||
|                     g_type_name (oinfo->gtype), | ||||
|                     oinfo->id); | ||||
|  | ||||
|       if (set_custom_property) | ||||
|         iface->set_custom_property (scriptable, script, | ||||
|                                     param->name, | ||||
|                                     ¶m->value); | ||||
|                                     name, | ||||
|                                     value); | ||||
|       else | ||||
|         g_object_set_property (object, param->name, ¶m->value); | ||||
|  | ||||
|       g_free ((gchar *) param->name); | ||||
|       g_value_unset (¶m->value); | ||||
|         g_object_set_property (object, name, value); | ||||
|     } | ||||
|  | ||||
|   g_array_free (params, TRUE); | ||||
|  | ||||
|   _clutter_script_check_unresolved (script, oinfo); | ||||
| } | ||||
|  | ||||
| @@ -2147,8 +2149,8 @@ void | ||||
| _clutter_script_construct_object (ClutterScript *script, | ||||
|                                   ObjectInfo    *oinfo) | ||||
| { | ||||
|   GArray *params = NULL; | ||||
|   guint i; | ||||
|   g_autoptr (GPtrArray) param_names = NULL; | ||||
|   g_autoptr (GArray) param_values = NULL; | ||||
|  | ||||
|   /* we have completely updated the object */ | ||||
|   if (oinfo->object != NULL) | ||||
| @@ -2191,25 +2193,14 @@ _clutter_script_construct_object (ClutterScript *script, | ||||
|                                              oinfo->gtype, | ||||
|                                              oinfo->id, | ||||
|                                              properties, | ||||
|                                              ¶ms); | ||||
|                                              ¶m_names, | ||||
|                                              ¶m_values); | ||||
|  | ||||
|       default_stage = clutter_stage_manager_get_default_stage (manager); | ||||
|       oinfo->object = G_OBJECT (default_stage); | ||||
|  | ||||
|       for (i = 0; i < params->len; i++) | ||||
|         { | ||||
|           GParameter *param = &g_array_index (params, GParameter, i); | ||||
|  | ||||
|           g_free ((gchar *) param->name); | ||||
|           g_value_unset (¶m->value); | ||||
|         } | ||||
|  | ||||
|       g_array_free (params, TRUE); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       g_autoptr (GPtrArray) param_names = NULL; | ||||
|       GArray *param_values; | ||||
|       GList *properties = oinfo->properties; | ||||
|  | ||||
|       /* every other object: first, we get the construction parameters */ | ||||
| @@ -2218,22 +2209,11 @@ _clutter_script_construct_object (ClutterScript *script, | ||||
|                                              oinfo->gtype, | ||||
|                                              oinfo->id, | ||||
|                                              properties, | ||||
|                                              ¶ms); | ||||
|  | ||||
|       /* Convert GParameter → (GStrv, GValue[]) */ | ||||
|       param_names = g_ptr_array_sized_new (params->len); | ||||
|       param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len); | ||||
|       for (i = 0; i < params->len; i++) | ||||
|         { | ||||
|           GParameter *param = &g_array_index (params, GParameter, i); | ||||
|  | ||||
|           g_ptr_array_add (param_names, (gchar *) param->name); | ||||
|           g_array_append_val (param_values, param->value); | ||||
|         } | ||||
|       g_ptr_array_add (param_names, NULL); | ||||
|                                              ¶m_names, | ||||
|                                              ¶m_values); | ||||
|  | ||||
|       oinfo->object = g_object_new_with_properties (oinfo->gtype, | ||||
|                                                     params->len, | ||||
|                                                     param_names->len, | ||||
|                                                     (const gchar **) param_names->pdata, | ||||
|                                                     (const GValue *) param_values->data); | ||||
|  | ||||
| @@ -2242,17 +2222,6 @@ _clutter_script_construct_object (ClutterScript *script, | ||||
|        * else too or only by this ClutterScript object. | ||||
|        */ | ||||
|       g_object_ref_sink (oinfo->object); | ||||
|  | ||||
|       for (i = 0; i < params->len; i++) | ||||
|         { | ||||
|           GParameter *param = &g_array_index (params, GParameter, i); | ||||
|  | ||||
|           g_free ((gchar *) param->name); | ||||
|           g_value_unset (¶m->value); | ||||
|         } | ||||
|  | ||||
|       g_array_free (param_values, FALSE); | ||||
|       g_array_free (params, TRUE); | ||||
|    } | ||||
|  | ||||
|   g_assert (oinfo->object != NULL); | ||||
|   | ||||
| @@ -263,8 +263,6 @@ enum | ||||
|  | ||||
| static GParamSpec *obj_props[PROP_LAST]; | ||||
|  | ||||
| #define CLUTTER_SCRIPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate)) | ||||
|  | ||||
| struct _ClutterScriptPrivate | ||||
| { | ||||
|   GHashTable *objects; | ||||
| @@ -346,15 +344,12 @@ object_info_free (gpointer data) | ||||
|       g_free (oinfo->class_name); | ||||
|       g_free (oinfo->type_func); | ||||
|  | ||||
|       g_list_foreach (oinfo->properties, (GFunc) property_info_free, NULL); | ||||
|       g_list_free (oinfo->properties); | ||||
|       g_list_free_full (oinfo->properties, property_info_free); | ||||
|  | ||||
|       g_list_foreach (oinfo->signals, (GFunc) signal_info_free, NULL); | ||||
|       g_list_free (oinfo->signals); | ||||
|       g_list_free_full (oinfo->signals, signal_info_free); | ||||
|  | ||||
|       /* these are ids */ | ||||
|       g_list_foreach (oinfo->children, (GFunc) g_free, NULL); | ||||
|       g_list_free (oinfo->children); | ||||
|       g_list_free_full (oinfo->children, g_free); | ||||
|  | ||||
|       /* we unref top-level objects and leave the actors alone, | ||||
|        * unless we are unmerging in which case we have to destroy | ||||
| @@ -380,7 +375,7 @@ object_info_free (gpointer data) | ||||
| static void | ||||
| clutter_script_finalize (GObject *gobject) | ||||
| { | ||||
|   ClutterScriptPrivate *priv = CLUTTER_SCRIPT_GET_PRIVATE (gobject); | ||||
|   ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv; | ||||
|  | ||||
|   g_object_unref (priv->parser); | ||||
|   g_hash_table_destroy (priv->objects); | ||||
| @@ -846,8 +841,7 @@ clutter_script_unmerge_objects (ClutterScript *script, | ||||
|   for (l = data.ids; l != NULL; l = l->next) | ||||
|     g_hash_table_remove (priv->objects, l->data); | ||||
|  | ||||
|   g_slist_foreach (data.ids, (GFunc) g_free, NULL); | ||||
|   g_slist_free (data.ids); | ||||
|   g_slist_free_full (data.ids, g_free); | ||||
|  | ||||
|   clutter_script_ensure_objects (script); | ||||
| } | ||||
|   | ||||
| @@ -89,8 +89,8 @@ clutter_stage_manager_dispose (GObject *gobject) | ||||
|  | ||||
|   stage_manager = CLUTTER_STAGE_MANAGER (gobject); | ||||
|  | ||||
|   g_slist_foreach (stage_manager->stages, (GFunc) clutter_actor_destroy, NULL); | ||||
|   g_slist_free (stage_manager->stages); | ||||
|   g_slist_free_full (stage_manager->stages, | ||||
|                      (GDestroyNotify) clutter_actor_destroy); | ||||
|   stage_manager->stages = NULL; | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject); | ||||
| @@ -134,8 +134,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass) | ||||
|                   G_OBJECT_CLASS_TYPE (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_STAGE); | ||||
|   /** | ||||
| @@ -153,8 +152,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass) | ||||
|                   G_OBJECT_CLASS_TYPE (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_STAGE); | ||||
| } | ||||
|   | ||||
| @@ -40,8 +40,12 @@ void                _clutter_stage_paint_view            (ClutterStage | ||||
|                                                           ClutterStageView            *view, | ||||
|                                                           const cairo_rectangle_int_t *clip); | ||||
|  | ||||
| void                _clutter_stage_emit_after_paint      (ClutterStage          *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void                _clutter_stage_set_window            (ClutterStage          *stage, | ||||
|                                                           ClutterStageWindow    *stage_window); | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageWindow *_clutter_stage_get_window            (ClutterStage          *stage); | ||||
| void                _clutter_stage_get_projection_matrix (ClutterStage          *stage, | ||||
|                                                           CoglMatrix            *projection); | ||||
| @@ -63,6 +67,7 @@ void                _clutter_stage_maybe_relayout        (ClutterActor | ||||
| gboolean            _clutter_stage_needs_update          (ClutterStage          *stage); | ||||
| gboolean            _clutter_stage_do_update             (ClutterStage          *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void     _clutter_stage_queue_event                       (ClutterStage *stage, | ||||
|                                                            ClutterEvent *event, | ||||
|                                                            gboolean      copy_event); | ||||
| @@ -74,6 +79,15 @@ gint64    _clutter_stage_get_update_time                  (ClutterStage *stage); | ||||
| void     _clutter_stage_clear_update_time                 (ClutterStage *stage); | ||||
| gboolean _clutter_stage_has_full_redraw_queued            (ClutterStage *stage); | ||||
|  | ||||
| void _clutter_stage_log_pick (ClutterStage       *stage, | ||||
|                               const ClutterPoint *vertices, | ||||
|                               ClutterActor       *actor); | ||||
|  | ||||
| void _clutter_stage_push_pick_clip (ClutterStage       *stage, | ||||
|                                     const ClutterPoint *vertices); | ||||
|  | ||||
| void _clutter_stage_pop_pick_clip (ClutterStage *stage); | ||||
|  | ||||
| ClutterActor *_clutter_stage_do_pick (ClutterStage    *stage, | ||||
|                                       gint             x, | ||||
|                                       gint             y, | ||||
| @@ -92,13 +106,6 @@ void                          _clutter_stage_queue_redraw_entry_invalidate (Clut | ||||
|  | ||||
| CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage); | ||||
|  | ||||
| gint32          _clutter_stage_acquire_pick_id          (ClutterStage *stage, | ||||
|                                                          ClutterActor *actor); | ||||
| void            _clutter_stage_release_pick_id          (ClutterStage *stage, | ||||
|                                                          gint32        pick_id); | ||||
| ClutterActor *  _clutter_stage_get_actor_by_pick_id     (ClutterStage *stage, | ||||
|                                                          gint32        pick_id); | ||||
|  | ||||
| void            _clutter_stage_add_pointer_drag_actor    (ClutterStage       *stage, | ||||
|                                                           ClutterInputDevice *device, | ||||
|                                                           ClutterActor       *actor); | ||||
| @@ -115,9 +122,11 @@ ClutterActor *  _clutter_stage_get_touch_drag_actor    (ClutterStage         *st | ||||
| void            _clutter_stage_remove_touch_drag_actor (ClutterStage         *stage, | ||||
|                                                         ClutterEventSequence *sequence); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageState       _clutter_stage_get_state        (ClutterStage      *stage); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_stage_is_activated     (ClutterStage      *stage); | ||||
| gboolean                _clutter_stage_is_fullscreen    (ClutterStage      *stage); | ||||
| CLUTTER_EXPORT | ||||
| gboolean                _clutter_stage_update_state     (ClutterStage      *stage, | ||||
|                                                          ClutterStageState  unset_state, | ||||
|                                                          ClutterStageState  set_state); | ||||
|   | ||||
							
								
								
									
										37
									
								
								clutter/clutter/clutter-stage-view-private.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								clutter/clutter/clutter-stage-view-private.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| /* | ||||
|  * Copyright (C) 2019 Red Hat Inc. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_STAGE_VIEW_PRIVATE_H__ | ||||
| #define __CLUTTER_STAGE_VIEW_PRIVATE_H__ | ||||
|  | ||||
| #include "clutter/clutter-stage-view.h" | ||||
|  | ||||
| void clutter_stage_view_blit_offscreen (ClutterStageView            *view, | ||||
|                                         const cairo_rectangle_int_t *clip); | ||||
|  | ||||
| gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view); | ||||
|  | ||||
| void clutter_stage_view_set_dirty_viewport (ClutterStageView *view, | ||||
|                                             gboolean          dirty); | ||||
|  | ||||
| gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view); | ||||
|  | ||||
| void clutter_stage_view_set_dirty_projection (ClutterStageView *view, | ||||
|                                               gboolean          dirty); | ||||
|  | ||||
|  | ||||
| #endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */ | ||||
| @@ -18,6 +18,7 @@ | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter/clutter-stage-view.h" | ||||
| #include "clutter/clutter-stage-view-private.h" | ||||
|  | ||||
| #include <cairo-gobject.h> | ||||
| #include <math.h> | ||||
| @@ -61,6 +62,14 @@ clutter_stage_view_get_layout (ClutterStageView      *view, | ||||
|   *rect = priv->layout; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_stage_view_get_framebuffer: | ||||
|  * @view: a #ClutterStageView | ||||
|  * | ||||
|  * Retrieves the framebuffer of @view to draw to. | ||||
|  * | ||||
|  * Returns: (transfer none): a #CoglFramebuffer | ||||
|  */ | ||||
| CoglFramebuffer * | ||||
| clutter_stage_view_get_framebuffer (ClutterStageView *view) | ||||
| { | ||||
| @@ -73,6 +82,14 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view) | ||||
|     return priv->framebuffer; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_stage_view_get_onscreen: | ||||
|  * @view: a #ClutterStageView | ||||
|  * | ||||
|  * Retrieves the onscreen framebuffer of @view if available. | ||||
|  * | ||||
|  * Returns: (transfer none): a #CoglFramebuffer | ||||
|  */ | ||||
| CoglFramebuffer * | ||||
| clutter_stage_view_get_onscreen (ClutterStageView *view) | ||||
| { | ||||
|   | ||||
| @@ -18,6 +18,10 @@ | ||||
| #ifndef __CLUTTER_STAGE_VIEW_H__ | ||||
| #define __CLUTTER_STAGE_VIEW_H__ | ||||
|  | ||||
| #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||
| #error "Only <clutter/clutter.h> can be included directly." | ||||
| #endif | ||||
|  | ||||
| #include <cairo.h> | ||||
| #include <glib-object.h> | ||||
| #include <cogl/cogl.h> | ||||
| @@ -57,22 +61,9 @@ void             clutter_stage_view_transform_to_onscreen (ClutterStageView *vie | ||||
|                                                            gfloat           *x, | ||||
|                                                            gfloat           *y); | ||||
|  | ||||
| void clutter_stage_view_blit_offscreen (ClutterStageView            *view, | ||||
| 					const cairo_rectangle_int_t *clip); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| float clutter_stage_view_get_scale (ClutterStageView *view); | ||||
|  | ||||
| gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view); | ||||
|  | ||||
| void clutter_stage_view_set_dirty_viewport (ClutterStageView *view, | ||||
|                                             gboolean          dirty); | ||||
|  | ||||
| gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view); | ||||
|  | ||||
| void clutter_stage_view_set_dirty_projection (ClutterStageView *view, | ||||
|                                               gboolean          dirty); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view, | ||||
|                                                              CoglMatrix       *matrix); | ||||
|   | ||||
| @@ -62,16 +62,6 @@ _clutter_stage_window_set_title (ClutterStageWindow *window, | ||||
|     iface->set_title (window, title); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_stage_window_set_fullscreen (ClutterStageWindow *window, | ||||
|                                       gboolean            is_fullscreen) | ||||
| { | ||||
|   ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window); | ||||
|  | ||||
|   if (iface->set_fullscreen) | ||||
|     iface->set_fullscreen (window, is_fullscreen); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window, | ||||
|                                           gboolean            is_visible) | ||||
| @@ -82,14 +72,6 @@ _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window, | ||||
|     iface->set_cursor_visible (window, is_visible); | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_stage_window_set_user_resizable (ClutterStageWindow *window, | ||||
|                                           gboolean            is_resizable) | ||||
| { | ||||
|   CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_user_resizable (window, | ||||
|                                                                is_resizable); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_stage_window_realize (ClutterStageWindow *window) | ||||
| { | ||||
| @@ -293,24 +275,6 @@ _clutter_stage_window_redraw (ClutterStageWindow *window) | ||||
|     iface->redraw (window); | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window, | ||||
|                                        ClutterStageView   *view, | ||||
|                                        int *x, int *y) | ||||
| { | ||||
|   ClutterStageWindowInterface *iface; | ||||
|  | ||||
|   *x = 0; | ||||
|   *y = 0; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window)); | ||||
|  | ||||
|   iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window); | ||||
|   if (iface->get_dirty_pixel) | ||||
|     iface->get_dirty_pixel (window, view, x, y); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window) | ||||
| { | ||||
|   | ||||
| @@ -30,12 +30,8 @@ struct _ClutterStageWindowInterface | ||||
|  | ||||
|   void              (* set_title)               (ClutterStageWindow *stage_window, | ||||
|                                                  const gchar        *title); | ||||
|   void              (* set_fullscreen)          (ClutterStageWindow *stage_window, | ||||
|                                                  gboolean            is_fullscreen); | ||||
|   void              (* set_cursor_visible)      (ClutterStageWindow *stage_window, | ||||
|                                                  gboolean            cursor_visible); | ||||
|   void              (* set_user_resizable)      (ClutterStageWindow *stage_window, | ||||
|                                                  gboolean            is_resizable); | ||||
|  | ||||
|   gboolean          (* realize)                 (ClutterStageWindow *stage_window); | ||||
|   void              (* unrealize)               (ClutterStageWindow *stage_window); | ||||
| @@ -68,10 +64,6 @@ struct _ClutterStageWindowInterface | ||||
|  | ||||
|   void              (* redraw)                  (ClutterStageWindow *stage_window); | ||||
|  | ||||
|   void              (* get_dirty_pixel)         (ClutterStageWindow *stage_window, | ||||
|                                                  ClutterStageView   *view, | ||||
|                                                  int *x, int *y); | ||||
|  | ||||
|   gboolean          (* can_clip_redraws)        (ClutterStageWindow *stage_window); | ||||
|  | ||||
|   GList            *(* get_views)               (ClutterStageWindow *stage_window); | ||||
| @@ -83,12 +75,8 @@ ClutterActor *    _clutter_stage_window_get_wrapper        (ClutterStageWindow * | ||||
|  | ||||
| void              _clutter_stage_window_set_title          (ClutterStageWindow *window, | ||||
|                                                             const gchar        *title); | ||||
| void              _clutter_stage_window_set_fullscreen     (ClutterStageWindow *window, | ||||
|                                                             gboolean            is_fullscreen); | ||||
| void              _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window, | ||||
|                                                             gboolean            is_visible); | ||||
| void              _clutter_stage_window_set_user_resizable (ClutterStageWindow *window, | ||||
|                                                             gboolean            is_resizable); | ||||
|  | ||||
| gboolean          _clutter_stage_window_realize                 (ClutterStageWindow *window); | ||||
| void              _clutter_stage_window_unrealize               (ClutterStageWindow *window); | ||||
| @@ -100,6 +88,7 @@ void              _clutter_stage_window_hide                    (ClutterStageWin | ||||
| void              _clutter_stage_window_resize                  (ClutterStageWindow *window, | ||||
|                                                                  gint                width, | ||||
|                                                                  gint                height); | ||||
| CLUTTER_EXPORT | ||||
| void              _clutter_stage_window_get_geometry            (ClutterStageWindow *window, | ||||
|                                                                  cairo_rectangle_int_t *geometry); | ||||
| void              _clutter_stage_window_schedule_update         (ClutterStageWindow *window, | ||||
| @@ -119,10 +108,6 @@ void              _clutter_stage_window_set_accept_focus        (ClutterStageWin | ||||
|  | ||||
| void              _clutter_stage_window_redraw                  (ClutterStageWindow *window); | ||||
|  | ||||
| void              _clutter_stage_window_get_dirty_pixel         (ClutterStageWindow *window, | ||||
|                                                                  ClutterStageView   *view, | ||||
|                                                                  int *x, int *y); | ||||
|  | ||||
| gboolean          _clutter_stage_window_can_clip_redraws        (ClutterStageWindow *window); | ||||
|  | ||||
| GList *           _clutter_stage_window_get_views               (ClutterStageWindow *window); | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -30,6 +30,7 @@ | ||||
|  | ||||
| #include <clutter/clutter-types.h> | ||||
| #include <clutter/clutter-group.h> | ||||
| #include <clutter/clutter-stage-view.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| @@ -61,8 +62,6 @@ struct _ClutterStage | ||||
| }; | ||||
| /** | ||||
|  * ClutterStageClass: | ||||
|  * @fullscreen: handler for the #ClutterStage::fullscreen signal | ||||
|  * @unfullscreen: handler for the #ClutterStage::unfullscreen signal | ||||
|  * @activate: handler for the #ClutterStage::activate signal | ||||
|  * @deactivate: handler for the #ClutterStage::deactivate signal | ||||
|  * @delete_event: handler for the #ClutterStage::delete-event signal | ||||
| @@ -79,17 +78,18 @@ struct _ClutterStageClass | ||||
|  | ||||
|   /*< public >*/ | ||||
|   /* signals */ | ||||
|   void (* fullscreen)   (ClutterStage *stage); | ||||
|   void (* unfullscreen) (ClutterStage *stage); | ||||
|   void (* activate)     (ClutterStage *stage); | ||||
|   void (* deactivate)   (ClutterStage *stage); | ||||
|  | ||||
|   gboolean (* delete_event) (ClutterStage *stage, | ||||
|                              ClutterEvent *event); | ||||
|  | ||||
|   void (* paint_view) (ClutterStage     *stage, | ||||
|                        ClutterStageView *view); | ||||
|  | ||||
|   /*< private >*/ | ||||
|   /* padding for future expansion */ | ||||
|   gpointer _padding_dummy[31]; | ||||
|   gpointer _padding_dummy[30]; | ||||
| }; | ||||
|  | ||||
| /** | ||||
| @@ -168,11 +168,6 @@ CLUTTER_EXPORT | ||||
| void            clutter_stage_get_perspective                   (ClutterStage          *stage, | ||||
| 			                                         ClutterPerspective    *perspective); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_stage_set_fullscreen                    (ClutterStage          *stage, | ||||
|                                                                  gboolean               fullscreen); | ||||
| CLUTTER_EXPORT | ||||
| gboolean        clutter_stage_get_fullscreen                    (ClutterStage          *stage); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_stage_show_cursor                       (ClutterStage          *stage); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_stage_hide_cursor                       (ClutterStage          *stage); | ||||
| @@ -181,11 +176,6 @@ void            clutter_stage_set_title                         (ClutterStage | ||||
|                                                                  const gchar           *title); | ||||
| CLUTTER_EXPORT | ||||
| const gchar *   clutter_stage_get_title                         (ClutterStage          *stage); | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_stage_set_user_resizable                (ClutterStage          *stage, | ||||
| 						                 gboolean               resizable); | ||||
| CLUTTER_EXPORT | ||||
| gboolean        clutter_stage_get_user_resizable                (ClutterStage          *stage); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void            clutter_stage_set_minimum_size                  (ClutterStage          *stage, | ||||
| @@ -274,6 +264,10 @@ gboolean clutter_stage_capture (ClutterStage          *stage, | ||||
|                                 cairo_rectangle_int_t *rect, | ||||
|                                 ClutterCapture       **captures, | ||||
|                                 int                   *n_captures); | ||||
| CLUTTER_EXPORT | ||||
| ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage, | ||||
|                                               float         x, | ||||
|                                               float         y); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
|   | ||||
| @@ -122,8 +122,7 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTapActionClass, tap), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__OBJECT, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 1, | ||||
|                   CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -171,7 +171,7 @@ clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer, | ||||
|  | ||||
|   /* Actual text insertion */ | ||||
|   at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text; | ||||
|   g_memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at); | ||||
|   memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at); | ||||
|   memcpy (pv->normal_text + at, chars, n_bytes); | ||||
|  | ||||
|   /* Book keeping */ | ||||
| @@ -201,7 +201,7 @@ clutter_text_buffer_normal_delete_text (ClutterTextBuffer *buffer, | ||||
|       start = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text; | ||||
|       end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text; | ||||
|  | ||||
|       g_memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end); | ||||
|       memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end); | ||||
|       pv->normal_text_chars -= n_chars; | ||||
|       pv->normal_text_bytes -= (end - start); | ||||
|  | ||||
| @@ -228,8 +228,8 @@ clutter_text_buffer_real_inserted_text (ClutterTextBuffer *buffer, | ||||
|                                      const gchar    *chars, | ||||
|                                      guint           n_chars) | ||||
| { | ||||
|   g_object_notify (G_OBJECT (buffer), "text"); | ||||
|   g_object_notify (G_OBJECT (buffer), "length"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_TEXT]); | ||||
|   g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_LENGTH]); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -237,8 +237,8 @@ clutter_text_buffer_real_deleted_text (ClutterTextBuffer *buffer, | ||||
|                                     guint           position, | ||||
|                                     guint           n_chars) | ||||
| { | ||||
|   g_object_notify (G_OBJECT (buffer), "text"); | ||||
|   g_object_notify (G_OBJECT (buffer), "length"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_TEXT]); | ||||
|   g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_LENGTH]); | ||||
| } | ||||
|  | ||||
| /* -------------------------------------------------------------------------------- | ||||
| @@ -598,7 +598,7 @@ clutter_text_buffer_set_max_length (ClutterTextBuffer *buffer, | ||||
|     clutter_text_buffer_delete_text (buffer, max_length, -1); | ||||
|  | ||||
|   buffer->priv->max_length = max_length; | ||||
|   g_object_notify (G_OBJECT (buffer), "max-length"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_MAX_LENGTH]); | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -751,7 +751,7 @@ clutter_text_create_layout_no_cache (ClutterText       *text, | ||||
|       if (priv->password_char != 0) | ||||
|         pango_dir = PANGO_DIRECTION_NEUTRAL; | ||||
|       else | ||||
|         pango_dir = pango_find_base_dir (contents, contents_len); | ||||
|         pango_dir = _clutter_pango_find_base_dir (contents, contents_len); | ||||
|  | ||||
|       if (pango_dir == PANGO_DIRECTION_NEUTRAL) | ||||
|         { | ||||
| @@ -1975,6 +1975,7 @@ selection_paint (ClutterText     *self, | ||||
|   else | ||||
|     { | ||||
|       /* Paint selection background first */ | ||||
|       CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline); | ||||
|       PangoLayout *layout = clutter_text_get_layout (self); | ||||
|       CoglPath *selection_path = cogl_path_new (); | ||||
|       CoglColor cogl_color = { 0, }; | ||||
| @@ -1987,11 +1988,19 @@ selection_paint (ClutterText     *self, | ||||
|       else | ||||
|         color = &priv->text_color; | ||||
|  | ||||
|       cogl_color_init_from_4ub (&cogl_color, | ||||
|                                 color->red, | ||||
|                                 color->green, | ||||
|                                 color->blue, | ||||
|                                 paint_opacity * color->alpha / 255); | ||||
|       cogl_color_premultiply (&cogl_color); | ||||
|       cogl_pipeline_set_color (color_pipeline, &cogl_color); | ||||
|  | ||||
|       clutter_text_foreach_selection_rectangle_prescaled (self, | ||||
|                                                           add_selection_rectangle_to_path, | ||||
|                                                           selection_path); | ||||
|  | ||||
|       cogl_path_fill (selection_path); | ||||
|       cogl_framebuffer_fill_path (fb, color_pipeline, selection_path); | ||||
|  | ||||
|       /* Paint selected text */ | ||||
|       cogl_framebuffer_push_path_clip (fb, selection_path); | ||||
| @@ -2251,7 +2260,10 @@ clutter_text_press (ClutterActor *actor, | ||||
|   priv->in_select_drag = TRUE; | ||||
|  | ||||
|   if (type == CLUTTER_BUTTON_PRESS) | ||||
|     clutter_grab_pointer (actor); | ||||
|     { | ||||
|       clutter_input_device_grab (clutter_event_get_device (event), | ||||
|                                  actor); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       clutter_input_device_sequence_grab (clutter_event_get_device (event), | ||||
| @@ -2309,7 +2321,7 @@ clutter_text_release (ClutterActor *actor, | ||||
|         { | ||||
|           if (!priv->in_select_touch) | ||||
|             { | ||||
|               clutter_ungrab_pointer (); | ||||
|               clutter_input_device_ungrab (clutter_event_get_device (event)); | ||||
|               priv->in_select_drag = FALSE; | ||||
|  | ||||
|               return CLUTTER_EVENT_STOP; | ||||
| @@ -4331,8 +4343,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, text_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -4404,8 +4415,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextClass, cursor_event), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOXED, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE); | ||||
|  | ||||
| @@ -4423,8 +4433,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, cursor_changed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -4442,8 +4451,7 @@ clutter_text_class_init (ClutterTextClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterTextClass, activate), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   binding_pool = clutter_binding_pool_get_for_class (klass); | ||||
| @@ -4812,7 +4820,7 @@ buffer_notify_max_length (ClutterTextBuffer *buffer, | ||||
|                           GParamSpec        *spec, | ||||
|                           ClutterText       *self) | ||||
| { | ||||
|   g_object_notify (G_OBJECT (self), "max-length"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAX_LENGTH]); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -4911,9 +4919,9 @@ clutter_text_set_buffer (ClutterText       *self, | ||||
|  | ||||
|   obj = G_OBJECT (self); | ||||
|   g_object_freeze_notify (obj); | ||||
|   g_object_notify (obj, "buffer"); | ||||
|   g_object_notify (obj, "text"); | ||||
|   g_object_notify (obj, "max-length"); | ||||
|   g_object_notify_by_pspec (obj, obj_props[PROP_BUFFER]); | ||||
|   g_object_notify_by_pspec (obj, obj_props[PROP_TEXT]); | ||||
|   g_object_notify_by_pspec (obj, obj_props[PROP_MAX_LENGTH]); | ||||
|   g_object_thaw_notify (obj); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -709,8 +709,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, new_frame), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__INT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  1, G_TYPE_INT); | ||||
|   /** | ||||
| @@ -733,8 +732,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, completed), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::started: | ||||
| @@ -750,8 +748,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, started), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::paused: | ||||
| @@ -764,8 +761,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, paused), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 0); | ||||
|   /** | ||||
|    * ClutterTimeline::marker-reached: | ||||
| @@ -832,8 +828,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (object_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTimelineClass, stopped), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOOLEAN, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
|                   G_TYPE_BOOLEAN); | ||||
| } | ||||
|   | ||||
| @@ -200,6 +200,9 @@ float                   clutter_point_distance  (const ClutterPoint *a, | ||||
|                                                  const ClutterPoint *b, | ||||
|                                                  float              *x_distance, | ||||
|                                                  float              *y_distance); | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_point_inside_quadrilateral     (const ClutterPoint *point, | ||||
|                                                  const ClutterPoint *vertices); | ||||
|  | ||||
| /** | ||||
|  * ClutterSize: | ||||
|   | ||||
| @@ -32,6 +32,7 @@ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include <fribidi.h> | ||||
| #include <math.h> | ||||
|  | ||||
| #include "clutter-debug.h" | ||||
| @@ -105,8 +106,9 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview, | ||||
|     } | ||||
| } | ||||
|  | ||||
| void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, | ||||
|                                         ClutterRect                 *dest) | ||||
| void | ||||
| _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, | ||||
|                                    ClutterRect                 *dest) | ||||
| { | ||||
|   *dest = (ClutterRect) { | ||||
|     .origin = { | ||||
| @@ -120,8 +122,9 @@ void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, | ||||
|   }; | ||||
| } | ||||
|  | ||||
| void _clutter_util_rectangle_int_extents (const  ClutterRect    *src, | ||||
|                                           cairo_rectangle_int_t *dest) | ||||
| void | ||||
| _clutter_util_rectangle_int_extents (const  ClutterRect    *src, | ||||
|                                      cairo_rectangle_int_t *dest) | ||||
| { | ||||
|   ClutterRect tmp = *src; | ||||
|  | ||||
| @@ -135,10 +138,11 @@ void _clutter_util_rectangle_int_extents (const  ClutterRect    *src, | ||||
|   }; | ||||
| } | ||||
|  | ||||
| void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, | ||||
|                                      int                          x, | ||||
|                                      int                          y, | ||||
|                                      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) | ||||
| { | ||||
|   *dest = *src; | ||||
|  | ||||
| @@ -696,3 +700,45 @@ clutter_interval_register_progress_func (GType               value_type, | ||||
|  | ||||
|   G_UNLOCK (progress_funcs); | ||||
| } | ||||
|  | ||||
| PangoDirection | ||||
| _clutter_pango_unichar_direction (gunichar ch) | ||||
| { | ||||
|   FriBidiCharType fribidi_ch_type; | ||||
|  | ||||
|   G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar)); | ||||
|  | ||||
|   fribidi_ch_type = fribidi_get_bidi_type (ch); | ||||
|  | ||||
|   if (!FRIBIDI_IS_STRONG (fribidi_ch_type)) | ||||
|     return PANGO_DIRECTION_NEUTRAL; | ||||
|   else if (FRIBIDI_IS_RTL (fribidi_ch_type)) | ||||
|     return PANGO_DIRECTION_RTL; | ||||
|   else | ||||
|     return PANGO_DIRECTION_LTR; | ||||
| } | ||||
|  | ||||
| PangoDirection | ||||
| _clutter_pango_find_base_dir (const gchar *text, | ||||
|                               gint         length) | ||||
| { | ||||
|   PangoDirection dir = PANGO_DIRECTION_NEUTRAL; | ||||
|   const gchar *p; | ||||
|  | ||||
|   g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL); | ||||
|  | ||||
|   p = text; | ||||
|   while ((length < 0 || p < text + length) && *p) | ||||
|     { | ||||
|       gunichar wc = g_utf8_get_char (p); | ||||
|  | ||||
|       dir = _clutter_pango_unichar_direction (wc); | ||||
|  | ||||
|       if (dir != PANGO_DIRECTION_NEUTRAL) | ||||
|         break; | ||||
|  | ||||
|       p = g_utf8_next_char (p); | ||||
|     } | ||||
|  | ||||
|   return dir; | ||||
| } | ||||
|   | ||||
| @@ -172,6 +172,7 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi | ||||
| CLUTTER_EXPORT | ||||
| ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device); | ||||
|  | ||||
| #endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */ | ||||
|   | ||||
| @@ -101,8 +101,8 @@ | ||||
| #include "clutter-snap-constraint.h" | ||||
| #include "clutter-stage.h" | ||||
| #include "clutter-stage-manager.h" | ||||
| #include "clutter-stage-view.h" | ||||
| #include "clutter-tap-action.h" | ||||
| #include "clutter-test-utils.h" | ||||
| #include "clutter-texture.h" | ||||
| #include "clutter-text.h" | ||||
| #include "clutter-timeline.h" | ||||
|   | ||||
| @@ -45,6 +45,9 @@ | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
| #include "clutter-stage-view-private.h" | ||||
|  | ||||
| #include "cogl/cogl-trace.h" | ||||
|  | ||||
| typedef struct _ClutterStageViewCoglPrivate | ||||
| { | ||||
| @@ -77,6 +80,10 @@ enum | ||||
|   PROP_LAST | ||||
| }; | ||||
|  | ||||
| static void | ||||
| clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window, | ||||
|                                     gint                sync_delay); | ||||
|  | ||||
| static void | ||||
| clutter_stage_cogl_unrealize (ClutterStageWindow *stage_window) | ||||
| { | ||||
| @@ -122,6 +129,16 @@ _clutter_stage_cogl_presented (ClutterStageCogl *stage_cogl, | ||||
|     } | ||||
|  | ||||
|   _clutter_stage_presented (stage_cogl->wrapper, frame_event, frame_info); | ||||
|  | ||||
|   if (frame_event == COGL_FRAME_EVENT_COMPLETE && | ||||
|       stage_cogl->update_time != -1) | ||||
|     { | ||||
|       ClutterStageWindow *stage_window = CLUTTER_STAGE_WINDOW (stage_cogl); | ||||
|  | ||||
|       stage_cogl->update_time = -1; | ||||
|       clutter_stage_cogl_schedule_update (stage_window, | ||||
|                                           stage_cogl->last_sync_delay); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| @@ -152,10 +169,15 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window, | ||||
|   gint64 now; | ||||
|   float refresh_rate; | ||||
|   gint64 refresh_interval; | ||||
|   int64_t min_render_time_allowed; | ||||
|   int64_t max_render_time_allowed; | ||||
|   int64_t next_presentation_time; | ||||
|  | ||||
|   if (stage_cogl->update_time != -1) | ||||
|     return; | ||||
|  | ||||
|   stage_cogl->last_sync_delay = sync_delay; | ||||
|  | ||||
|   now = g_get_monotonic_time (); | ||||
|  | ||||
|   if (sync_delay < 0) | ||||
| @@ -164,30 +186,56 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window, | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   /* We only extrapolate presentation times for 150ms  - this is somewhat | ||||
|    * arbitrary. The reasons it might not be accurate for larger times are | ||||
|    * that the refresh interval might be wrong or the vertical refresh | ||||
|    * might be downclocked if nothing is going on onscreen. | ||||
|    */ | ||||
|   if (stage_cogl->last_presentation_time == 0|| | ||||
|       stage_cogl->last_presentation_time < now - 150000) | ||||
|   refresh_rate = stage_cogl->refresh_rate; | ||||
|   if (refresh_rate <= 0.0) | ||||
|     refresh_rate = clutter_get_default_frame_rate (); | ||||
|  | ||||
|   refresh_interval = (gint64) (0.5 + G_USEC_PER_SEC / refresh_rate); | ||||
|   if (refresh_interval == 0) | ||||
|     { | ||||
|       stage_cogl->update_time = now; | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   refresh_rate = stage_cogl->refresh_rate; | ||||
|   if (refresh_rate == 0.0) | ||||
|     refresh_rate = 60.0; | ||||
|   min_render_time_allowed = refresh_interval / 2; | ||||
|   max_render_time_allowed = refresh_interval - 1000 * sync_delay; | ||||
|  | ||||
|   refresh_interval = (gint64) (0.5 + 1000000 / refresh_rate); | ||||
|   if (refresh_interval == 0) | ||||
|     refresh_interval = 16667; /* 1/60th second */ | ||||
|   /* Be robust in the case of incredibly bogus refresh rate */ | ||||
|   if (max_render_time_allowed <= 0) | ||||
|     { | ||||
|       g_warning ("Unsupported monitor refresh rate detected. " | ||||
|                  "(Refresh rate: %.3f, refresh interval: %ld)", | ||||
|                  refresh_rate, | ||||
|                  refresh_interval); | ||||
|       stage_cogl->update_time = now; | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   stage_cogl->update_time = stage_cogl->last_presentation_time + 1000 * sync_delay; | ||||
|   if (min_render_time_allowed > max_render_time_allowed) | ||||
|     min_render_time_allowed = max_render_time_allowed; | ||||
|  | ||||
|   while (stage_cogl->update_time < now) | ||||
|     stage_cogl->update_time += refresh_interval; | ||||
|   next_presentation_time = stage_cogl->last_presentation_time + refresh_interval; | ||||
|  | ||||
|   /* Get next_presentation_time closer to its final value, to reduce | ||||
|    * the number of while iterations below. | ||||
|    */ | ||||
|   if (next_presentation_time < now) | ||||
|     { | ||||
|       int64_t last_virtual_presentation_time = now - now % refresh_interval; | ||||
|       int64_t hardware_clock_phase = | ||||
|         stage_cogl->last_presentation_time % refresh_interval; | ||||
|  | ||||
|       next_presentation_time = | ||||
|         last_virtual_presentation_time + hardware_clock_phase; | ||||
|     } | ||||
|  | ||||
|   while (next_presentation_time < now + min_render_time_allowed) | ||||
|     next_presentation_time += refresh_interval; | ||||
|  | ||||
|   stage_cogl->update_time = next_presentation_time - max_render_time_allowed; | ||||
|  | ||||
|   if (stage_cogl->update_time == stage_cogl->last_update_time) | ||||
|     stage_cogl->update_time = stage_cogl->last_update_time + refresh_interval; | ||||
| } | ||||
|  | ||||
| static gint64 | ||||
| @@ -206,6 +254,7 @@ clutter_stage_cogl_clear_update_time (ClutterStageWindow *stage_window) | ||||
| { | ||||
|   ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); | ||||
|  | ||||
|   stage_cogl->last_update_time = stage_cogl->update_time; | ||||
|   stage_cogl->update_time = -1; | ||||
| } | ||||
|  | ||||
| @@ -273,7 +322,7 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window) | ||||
| } | ||||
|  | ||||
| /* A redraw clip represents (in stage coordinates) the bounding box of | ||||
|  * something that needs to be redraw. Typically they are added to the | ||||
|  * something that needs to be redrawn. Typically they are added to the | ||||
|  * StageWindow as a result of clutter_actor_queue_clipped_redraw() by | ||||
|  * actors such as ClutterGLXTexturePixmap. All redraw clips are | ||||
|  * discarded after the next paint. | ||||
| @@ -502,8 +551,8 @@ fill_current_damage_history_and_step (ClutterStageView *view) | ||||
|   *current_fb_damage = (cairo_rectangle_int_t) { | ||||
|     .x = 0, | ||||
|     .y = 0, | ||||
|     .width = view_rect.width * fb_scale, | ||||
|     .height = view_rect.height * fb_scale | ||||
|     .width = ceilf (view_rect.width * fb_scale), | ||||
|     .height = ceilf (view_rect.height * fb_scale) | ||||
|   }; | ||||
|   view_priv->damage_index++; | ||||
| } | ||||
| @@ -878,26 +927,16 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, | ||||
|    */ | ||||
|   if (use_clipped_redraw) | ||||
|     { | ||||
|       if (use_clipped_redraw && clip_region_empty) | ||||
|       if (clip_region_empty) | ||||
|         { | ||||
|           do_swap_buffer = FALSE; | ||||
|         } | ||||
|       else if (use_clipped_redraw) | ||||
|       else | ||||
|         { | ||||
|           swap_region = fb_clip_region; | ||||
|           g_assert (swap_region.width > 0); | ||||
|           do_swap_buffer = TRUE; | ||||
|         } | ||||
|       else | ||||
|         { | ||||
|           swap_region = (cairo_rectangle_int_t) { | ||||
|             .x = 0, | ||||
|             .y = 0, | ||||
|             .width = view_rect.width * fb_scale, | ||||
|             .height = view_rect.height * fb_scale, | ||||
|           }; | ||||
|           do_swap_buffer = TRUE; | ||||
|         } | ||||
|     } | ||||
|   else | ||||
|     { | ||||
| @@ -907,6 +946,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, | ||||
|  | ||||
|   if (do_swap_buffer) | ||||
|     { | ||||
|       COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer, | ||||
|                                "Paint (swap framebuffer)"); | ||||
|  | ||||
|       if (clutter_stage_view_get_onscreen (view) != | ||||
|           clutter_stage_view_get_framebuffer (view)) | ||||
|         { | ||||
| @@ -931,6 +973,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window) | ||||
|   gboolean swap_event = FALSE; | ||||
|   GList *l; | ||||
|  | ||||
|   COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)"); | ||||
|  | ||||
|   for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next) | ||||
|     { | ||||
|       ClutterStageView *view = l->data; | ||||
| @@ -939,6 +983,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window) | ||||
|         clutter_stage_cogl_redraw_view (stage_window, view) || swap_event; | ||||
|     } | ||||
|  | ||||
|   _clutter_stage_emit_after_paint (stage_cogl->wrapper); | ||||
|  | ||||
|   _clutter_stage_window_finish_frame (stage_window); | ||||
|  | ||||
|   if (swap_event) | ||||
| @@ -954,55 +1000,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window) | ||||
|   stage_cogl->initialized_redraw_clip = FALSE; | ||||
|  | ||||
|   stage_cogl->frame_count++; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window, | ||||
|                                     ClutterStageView   *view, | ||||
|                                     int                *x, | ||||
|                                     int                *y) | ||||
| { | ||||
|   CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); | ||||
|   gboolean has_buffer_age = | ||||
|     cogl_is_onscreen (framebuffer) && | ||||
|     is_buffer_age_enabled (); | ||||
|   float fb_scale; | ||||
|   gboolean scale_is_fractional; | ||||
|  | ||||
|   fb_scale = clutter_stage_view_get_scale (view); | ||||
|   if (fb_scale != floorf (fb_scale)) | ||||
|     scale_is_fractional = TRUE; | ||||
|   else | ||||
|     scale_is_fractional = FALSE; | ||||
|  | ||||
|   /* | ||||
|    * Buffer damage is tracked in the framebuffer coordinate space | ||||
|    * using the damage history. When fractional scaling is used, a | ||||
|    * coordinate on the stage might not correspond to the exact position of any | ||||
|    * physical pixel, which causes issues when painting using the pick mode. | ||||
|    * | ||||
|    * For now, always use the (0, 0) pixel for picking when using fractional | ||||
|    * framebuffer scaling. | ||||
|    */ | ||||
|   if (!has_buffer_age || scale_is_fractional) | ||||
|     { | ||||
|       *x = 0; | ||||
|       *y = 0; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view); | ||||
|       ClutterStageViewCoglPrivate *view_priv = | ||||
|         clutter_stage_view_cogl_get_instance_private (view_cogl); | ||||
|       cairo_rectangle_int_t view_layout; | ||||
|       cairo_rectangle_int_t *fb_damage; | ||||
|  | ||||
|       clutter_stage_view_get_layout (view, &view_layout); | ||||
|  | ||||
|       fb_damage = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)]; | ||||
|       *x = fb_damage->x / fb_scale; | ||||
|       *y = fb_damage->y / fb_scale; | ||||
|     } | ||||
|   COGL_TRACE_END (ClutterStageCoglRedraw); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -1022,7 +1021,6 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface) | ||||
|   iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips; | ||||
|   iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds; | ||||
|   iface->redraw = clutter_stage_cogl_redraw; | ||||
|   iface->get_dirty_pixel = clutter_stage_cogl_get_dirty_pixel; | ||||
| } | ||||
|  | ||||
| static void | ||||
|   | ||||
| @@ -53,12 +53,15 @@ struct _ClutterStageCogl | ||||
|  | ||||
|   gint64 last_presentation_time; | ||||
|   gint64 update_time; | ||||
|   int64_t last_update_time; | ||||
|  | ||||
|   /* We only enable clipped redraws after 2 frames, since we've seen | ||||
|    * a lot of drivers can struggle to get going and may output some | ||||
|    * junk frames to start with. */ | ||||
|   unsigned int frame_count; | ||||
|  | ||||
|   gint last_sync_delay; | ||||
|  | ||||
|   cairo_rectangle_int_t bounding_redraw_clip; | ||||
|  | ||||
|   guint initialized_redraw_clip : 1; | ||||
|   | ||||
| @@ -567,8 +567,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterAnimationClass, started), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
| @@ -589,8 +588,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (klass), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterAnimationClass, completed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -258,8 +258,7 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) | ||||
| 		  G_OBJECT_CLASS_TYPE (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterBehaviourClass, applied), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__OBJECT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_ACTOR); | ||||
|   /** | ||||
| @@ -279,8 +278,7 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) | ||||
| 		  G_OBJECT_CLASS_TYPE (object_class), | ||||
| 		  G_SIGNAL_RUN_FIRST, | ||||
| 		  G_STRUCT_OFFSET (ClutterBehaviourClass, removed), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__OBJECT, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, 1, | ||||
| 		  CLUTTER_TYPE_ACTOR); | ||||
| } | ||||
|   | ||||
| @@ -1,85 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 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/>. | ||||
|  */ | ||||
|  | ||||
| #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) | ||||
| #error "Only <clutter/clutter.h> can be included directly." | ||||
| #endif | ||||
|  | ||||
| #ifndef __CLUTTER_MAIN_DEPRECATED_H__ | ||||
| #define __CLUTTER_MAIN_DEPRECATED_H__ | ||||
|  | ||||
| #include <clutter/clutter-types.h> | ||||
| #include <clutter/clutter-input-device.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| void                    clutter_threads_init                    (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| void                    clutter_threads_enter                   (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| void                    clutter_threads_leave                   (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled) | ||||
| void                    clutter_set_motion_events_enabled       (gboolean          enable); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_stage_get_motion_events_enabled) | ||||
| gboolean                clutter_get_motion_events_enabled       (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_stage_ensure_redraw) | ||||
| void                    clutter_redraw                          (ClutterStage     *stage); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(cogl_pango_font_map_clear_glyph_cache) | ||||
| void                    clutter_clear_glyph_cache               (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_backend_set_font_options) | ||||
| void                    clutter_set_font_flags                  (ClutterFontFlags  flags); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_backend_get_font_options) | ||||
| ClutterFontFlags        clutter_get_font_flags                  (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device) | ||||
| ClutterInputDevice *    clutter_get_input_device_for_id         (gint id_); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_input_device_grab) | ||||
| void                    clutter_grab_pointer_for_device         (ClutterActor     *actor, | ||||
|                                                                  gint              id_); | ||||
|  | ||||
| CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab) | ||||
| void                    clutter_ungrab_pointer_for_device       (gint              id_); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| void                    clutter_set_default_frame_rate          (guint             frames_per_sec); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| gulong                  clutter_get_timestamp                   (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| gboolean                clutter_get_debug_enabled               (void); | ||||
|  | ||||
| CLUTTER_DEPRECATED | ||||
| gboolean                clutter_get_show_fps                    (void); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_MAIN_DEPRECATED_H__ */ | ||||
| @@ -1423,8 +1423,7 @@ clutter_state_class_init (ClutterStateClass *klass) | ||||
|                   G_TYPE_FROM_CLASS (gobject_class), | ||||
|                   G_SIGNAL_RUN_LAST, | ||||
|                   G_STRUCT_OFFSET (ClutterStateClass, completed), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__VOID, | ||||
|                   NULL, NULL, NULL, | ||||
|                   G_TYPE_NONE, 0); | ||||
|  | ||||
|   /** | ||||
|   | ||||
| @@ -572,83 +572,6 @@ gen_texcoords_and_draw_cogl_rectangle (ClutterActor    *self, | ||||
|                                             0, 0, t_w, t_h); | ||||
| } | ||||
|  | ||||
| static CoglPipeline * | ||||
| create_pick_pipeline (ClutterActor *self) | ||||
| { | ||||
|   ClutterTexture *texture = CLUTTER_TEXTURE (self); | ||||
|   ClutterTexturePrivate *priv = texture->priv; | ||||
|   CoglPipeline *pick_pipeline = cogl_pipeline_copy (texture_template_pipeline); | ||||
|   GError *error = NULL; | ||||
|  | ||||
|   if (!cogl_pipeline_set_layer_combine (pick_pipeline, 0, | ||||
|                                         "RGBA = " | ||||
|                                         "  MODULATE (CONSTANT, TEXTURE[A])", | ||||
|                                         &error)) | ||||
|     { | ||||
|       if (!priv->seen_create_pick_pipeline_warning) | ||||
|         g_warning ("Error setting up texture combine for shaped " | ||||
|                    "texture picking: %s", error->message); | ||||
|       priv->seen_create_pick_pipeline_warning = TRUE; | ||||
|       g_error_free (error); | ||||
|       cogl_object_unref (pick_pipeline); | ||||
|       return NULL; | ||||
|     } | ||||
|  | ||||
|   cogl_pipeline_set_blend (pick_pipeline, | ||||
|                            "RGBA = ADD (SRC_COLOR[RGBA], 0)", | ||||
|                            NULL); | ||||
|  | ||||
|   cogl_pipeline_set_alpha_test_function (pick_pipeline, | ||||
|                                          COGL_PIPELINE_ALPHA_FUNC_EQUAL, | ||||
|                                          1.0); | ||||
|  | ||||
|   return pick_pipeline; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_texture_pick (ClutterActor       *self, | ||||
|                       const ClutterColor *color) | ||||
| { | ||||
|   ClutterTexture *texture = CLUTTER_TEXTURE (self); | ||||
|   ClutterTexturePrivate *priv = texture->priv; | ||||
|   CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); | ||||
|  | ||||
|   if (!clutter_actor_should_pick_paint (self)) | ||||
|     return; | ||||
|  | ||||
|   if (G_LIKELY (priv->pick_with_alpha_supported) && priv->pick_with_alpha) | ||||
|     { | ||||
|       CoglColor pick_color; | ||||
|  | ||||
|       if (priv->pick_pipeline == NULL) | ||||
|         priv->pick_pipeline = create_pick_pipeline (self); | ||||
|  | ||||
|       if (priv->pick_pipeline == NULL) | ||||
|         { | ||||
|           priv->pick_with_alpha_supported = FALSE; | ||||
|           CLUTTER_ACTOR_CLASS (clutter_texture_parent_class)->pick (self, | ||||
|                                                                     color); | ||||
|           return; | ||||
|         } | ||||
|  | ||||
|       if (priv->fbo_handle != NULL) | ||||
|         update_fbo (self); | ||||
|  | ||||
|       cogl_color_init_from_4ub (&pick_color, | ||||
|                                 color->red, | ||||
|                                 color->green, | ||||
|                                 color->blue, | ||||
|                                 0xff); | ||||
|       cogl_pipeline_set_layer_combine_constant (priv->pick_pipeline, | ||||
|                                                 0, &pick_color); | ||||
|       cogl_pipeline_set_layer_texture (priv->pick_pipeline, 0, | ||||
|                                        clutter_texture_get_cogl_texture (texture)); | ||||
|       gen_texcoords_and_draw_cogl_rectangle (self, priv->pick_pipeline, framebuffer); | ||||
|     } | ||||
|   else | ||||
|     CLUTTER_ACTOR_CLASS (clutter_texture_parent_class)->pick (self, color); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_texture_paint (ClutterActor *self) | ||||
| { | ||||
| @@ -767,12 +690,6 @@ clutter_texture_dispose (GObject *object) | ||||
|       priv->pipeline = NULL; | ||||
|     } | ||||
|  | ||||
|   if (priv->pick_pipeline != NULL) | ||||
|     { | ||||
|       cogl_object_unref (priv->pick_pipeline); | ||||
|       priv->pick_pipeline = NULL; | ||||
|     } | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_texture_parent_class)->dispose (object); | ||||
| } | ||||
|  | ||||
| @@ -944,7 +861,6 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
|   GParamSpec *pspec; | ||||
|  | ||||
|   actor_class->paint            = clutter_texture_paint; | ||||
|   actor_class->pick             = clutter_texture_pick; | ||||
|   actor_class->get_paint_volume = clutter_texture_get_paint_volume; | ||||
|   actor_class->realize          = clutter_texture_realize; | ||||
|   actor_class->unrealize        = clutter_texture_unrealize; | ||||
| @@ -1166,8 +1082,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextureClass, pixbuf_change), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__VOID, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  0); | ||||
|   /** | ||||
| @@ -1188,8 +1103,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) | ||||
| 		  G_TYPE_FROM_CLASS (gobject_class), | ||||
| 		  G_SIGNAL_RUN_LAST, | ||||
| 		  G_STRUCT_OFFSET (ClutterTextureClass, load_finished), | ||||
| 		  NULL, NULL, | ||||
| 		  _clutter_marshal_VOID__BOXED, | ||||
| 		  NULL, NULL, NULL, | ||||
| 		  G_TYPE_NONE, | ||||
| 		  1, | ||||
|                   G_TYPE_ERROR); | ||||
| @@ -1263,11 +1177,9 @@ clutter_texture_init (ClutterTexture *self) | ||||
|   priv->repeat_y          = FALSE; | ||||
|   priv->sync_actor_size   = TRUE; | ||||
|   priv->fbo_handle        = NULL; | ||||
|   priv->pick_pipeline     = NULL; | ||||
|   priv->keep_aspect_ratio = FALSE; | ||||
|   priv->pick_with_alpha   = FALSE; | ||||
|   priv->pick_with_alpha_supported = TRUE; | ||||
|   priv->seen_create_pick_pipeline_warning = FALSE; | ||||
|  | ||||
|   if (G_UNLIKELY (texture_template_pipeline == NULL)) | ||||
|     { | ||||
| @@ -1565,7 +1477,7 @@ clutter_texture_set_from_data (ClutterTexture     *texture, | ||||
|  | ||||
|       g_set_error (&inner_error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
|                    _("Failed to load the image data")); | ||||
|                    "Failed to load the image data"); | ||||
|  | ||||
|       g_signal_emit (texture, texture_signals[LOAD_FINISHED], 0, inner_error); | ||||
|  | ||||
| @@ -1724,7 +1636,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_NO_YUV, | ||||
|                    _("YUV textures are not supported")); | ||||
|                    "YUV textures are not supported"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -1733,7 +1645,7 @@ clutter_texture_set_from_yuv_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("YUV2 textures are not supported")); | ||||
| 		   "YUV2 textures are not supported"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -1960,7 +1872,7 @@ clutter_texture_async_load (ClutterTexture *self, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
|                    _("Failed to load the image data")); | ||||
|                    "Failed to load the image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|   else | ||||
| @@ -2057,7 +1969,7 @@ clutter_texture_set_from_file (ClutterTexture *texture, | ||||
|     { | ||||
|       g_set_error (&internal_error, CLUTTER_TEXTURE_ERROR, | ||||
|                    CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("Failed to load the image data")); | ||||
| 		   "Failed to load the image data"); | ||||
|     } | ||||
|  | ||||
|   if (internal_error != NULL) | ||||
| @@ -2359,7 +2271,7 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture     *texture, | ||||
|     { | ||||
|       g_set_error (error, CLUTTER_TEXTURE_ERROR, | ||||
| 		   CLUTTER_TEXTURE_ERROR_BAD_FORMAT, | ||||
| 		   _("Failed to load the image data")); | ||||
| 		   "Failed to load the image data"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
| @@ -3050,13 +2962,8 @@ clutter_texture_set_pick_with_alpha (ClutterTexture *texture, | ||||
|   if (priv->pick_with_alpha == pick_with_alpha) | ||||
|     return; | ||||
|  | ||||
|   if (!pick_with_alpha && priv->pick_pipeline != NULL) | ||||
|     { | ||||
|       cogl_object_unref (priv->pick_pipeline); | ||||
|       priv->pick_pipeline = NULL; | ||||
|     } | ||||
|   g_assert (!pick_with_alpha);  /* No longer supported */ | ||||
|  | ||||
|   /* NB: the pick pipeline is created lazily when we first pick */ | ||||
|   priv->pick_with_alpha = pick_with_alpha; | ||||
|  | ||||
|   /* NB: actors are expected to call clutter_actor_queue_redraw when | ||||
|   | ||||
| @@ -40,10 +40,6 @@ | ||||
| /* This is a Cogl based backend */ | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
|  | ||||
| #ifdef HAVE_EVDEV | ||||
| #include "evdev/clutter-device-manager-evdev.h" | ||||
| #endif | ||||
|  | ||||
| #include "clutter-debug.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-main.h" | ||||
|   | ||||
| @@ -1,108 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 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/>. | ||||
|  * | ||||
|  * Author: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_DEVICE_MANAGER_EVDEV_H__ | ||||
| #define __CLUTTER_DEVICE_MANAGER_EVDEV_H__ | ||||
|  | ||||
| #include <clutter/clutter-backend.h> | ||||
| #include <clutter/clutter-device-manager.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER_EVDEV            (clutter_device_manager_evdev_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdev)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_EVDEV(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV)) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdevClass)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_EVDEV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV)) | ||||
| #define CLUTTER_DEVICE_MANAGER_EVDEV_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, ClutterDeviceManagerEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterDeviceManagerEvdev         ClutterDeviceManagerEvdev; | ||||
| typedef struct _ClutterDeviceManagerEvdevClass    ClutterDeviceManagerEvdevClass; | ||||
| typedef struct _ClutterDeviceManagerEvdevPrivate  ClutterDeviceManagerEvdevPrivate; | ||||
|  | ||||
| typedef struct _ClutterSeatEvdev ClutterSeatEvdev; | ||||
|  | ||||
| struct _ClutterDeviceManagerEvdev | ||||
| { | ||||
|   ClutterDeviceManager parent_instance; | ||||
|  | ||||
|   ClutterDeviceManagerEvdevPrivate *priv; | ||||
| }; | ||||
|  | ||||
| struct _ClutterDeviceManagerEvdevClass | ||||
| { | ||||
|   ClutterDeviceManagerClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType clutter_device_manager_evdev_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_events_evdev_init            (ClutterBackend *backend); | ||||
| void  _clutter_events_evdev_uninit          (ClutterBackend *backend); | ||||
|  | ||||
| gint  _clutter_device_manager_evdev_acquire_device_id (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void  _clutter_device_manager_evdev_release_device_id (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                        ClutterInputDevice        *device); | ||||
|  | ||||
| ClutterStage * _clutter_device_manager_evdev_get_stage (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                       ClutterInputDevice        *core_pointer, | ||||
|                                                       uint64_t                   time_us, | ||||
|                                                       float                      x, | ||||
|                                                       float                      y, | ||||
|                                                       float                     *new_x, | ||||
|                                                       float                     *new_y); | ||||
|  | ||||
| void _clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerEvdev *manager_evdev, | ||||
|                                                            ClutterInputDevice        *device, | ||||
|                                                            float                      x, | ||||
|                                                            float                      y, | ||||
|                                                            float                     *dx, | ||||
|                                                            float                     *dy); | ||||
|  | ||||
| void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| struct xkb_state * _clutter_device_manager_evdev_get_xkb_state (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| static inline guint64 | ||||
| us (guint64 us) | ||||
| { | ||||
|   return us; | ||||
| } | ||||
|  | ||||
| static inline guint64 | ||||
| ms2us (guint64 ms) | ||||
| { | ||||
|   return us (ms * 1000); | ||||
| } | ||||
|  | ||||
| static inline guint32 | ||||
| us2ms (guint64 us) | ||||
| { | ||||
|   return (guint32) (us / 1000); | ||||
| } | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_DEVICE_MANAGER_EVDEV_H__ */ | ||||
| @@ -1,181 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2012  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/>. | ||||
|  * | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_EVDEV_H__ | ||||
| #define __CLUTTER_EVDEV_H__ | ||||
|  | ||||
| #include <glib.h> | ||||
| #include <glib-object.h> | ||||
| #include <xkbcommon/xkbcommon.h> | ||||
| #include <clutter/clutter.h> | ||||
| #include <libinput.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #if !defined(CLUTTER_ENABLE_COMPOSITOR_API) && !defined(CLUTTER_COMPILATION) | ||||
| #error "You need to define CLUTTER_ENABLE_COMPOSITOR_API before including clutter-evdev.h" | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * ClutterOpenDeviceCallback: | ||||
|  * @path: the device path | ||||
|  * @flags: flags to be passed to open | ||||
|  * | ||||
|  * This callback will be called when Clutter needs to access an input | ||||
|  * device. It should return an open file descriptor for the file at @path, | ||||
|  * or -1 if opening failed. | ||||
|  */ | ||||
| typedef int (*ClutterOpenDeviceCallback) (const char  *path, | ||||
| 					  int          flags, | ||||
| 					  gpointer     user_data, | ||||
| 					  GError     **error); | ||||
| typedef void (*ClutterCloseDeviceCallback) (int          fd, | ||||
| 					    gpointer     user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback  open_callback, | ||||
|                                           ClutterCloseDeviceCallback close_callback, | ||||
|                                           gpointer                   user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_seat_id (const gchar *seat_id); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_release_devices (void); | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_reclaim_devices (void); | ||||
|  | ||||
| /** | ||||
|  * ClutterPointerConstrainCallback: | ||||
|  * @device: the core pointer device | ||||
|  * @time: the event time in milliseconds | ||||
|  * @x: (inout): the new X coordinate | ||||
|  * @y: (inout): the new Y coordinate | ||||
|  * @user_data: user data passed to this function | ||||
|  * | ||||
|  * This callback will be called for all pointer motion events, and should | ||||
|  * update (@x, @y) to constrain the pointer position appropriately. | ||||
|  * The subsequent motion event will use the updated values as the new coordinates. | ||||
|  * Note that the coordinates are not clamped to the stage size, and the callback | ||||
|  * must make sure that this happens before it returns. | ||||
|  * Also note that the event will be emitted even if the pointer is constrained | ||||
|  * to be in the same position. | ||||
|  * | ||||
|  * Since: 1.16 | ||||
|  */ | ||||
| typedef void (*ClutterPointerConstrainCallback) (ClutterInputDevice *device, | ||||
| 						 guint32             time, | ||||
| 						 float               prev_x, | ||||
| 						 float               prev_y, | ||||
| 						 float              *x, | ||||
| 						 float              *y, | ||||
| 						 gpointer            user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void  clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager            *evdev, | ||||
| 						    ClutterPointerConstrainCallback  callback, | ||||
| 						    gpointer                         user_data, | ||||
| 						    GDestroyNotify                   user_data_notify); | ||||
|  | ||||
| typedef void (*ClutterRelativeMotionFilter) (ClutterInputDevice *device, | ||||
|                                              float               x, | ||||
|                                              float               y, | ||||
|                                              float              *dx, | ||||
|                                              float              *dy, | ||||
|                                              gpointer            user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_relative_motion_filter (ClutterDeviceManager       *evdev, | ||||
|                                                ClutterRelativeMotionFilter filter, | ||||
|                                                gpointer                    user_data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void               clutter_evdev_set_keyboard_map   (ClutterDeviceManager *evdev, | ||||
| 						     struct xkb_keymap    *keymap); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| struct xkb_keymap * clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev, | ||||
|                                               xkb_layout_index_t    idx); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| xkb_layout_index_t clutter_evdev_get_keyboard_layout_index (ClutterDeviceManager *evdev); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_numlock (ClutterDeviceManager *evdev, | ||||
|                                          gboolean              numlock_state); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev, | ||||
|                                         gboolean              repeat, | ||||
|                                         guint32               delay, | ||||
|                                         guint32               interval); | ||||
|  | ||||
| typedef gboolean (* ClutterEvdevFilterFunc) (struct libinput_event *event, | ||||
|                                              gpointer               data); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_add_filter    (ClutterEvdevFilterFunc func, | ||||
|                                   gpointer               data, | ||||
|                                   GDestroyNotify         destroy_notify); | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_remove_filter (ClutterEvdevFilterFunc func, | ||||
|                                   gpointer               data); | ||||
| CLUTTER_EXPORT | ||||
| struct libinput_device * clutter_evdev_input_device_get_libinput_device (ClutterInputDevice *device); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gint32 clutter_evdev_event_sequence_get_slot (const ClutterEventSequence *sequence); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_warp_pointer (ClutterInputDevice   *pointer_device, | ||||
|                                  guint32               time_, | ||||
|                                  int                   x, | ||||
|                                  int                   y); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| guint32 clutter_evdev_event_get_event_code (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| guint64 clutter_evdev_event_get_time_usec (const ClutterEvent *event); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| gboolean clutter_evdev_event_get_relative_motion (const ClutterEvent *event, | ||||
|                                                   double             *dx, | ||||
|                                                   double             *dy, | ||||
|                                                   double             *dx_unaccel, | ||||
|                                                   double             *dy_unaccel); | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_input_device_tool_set_pressure_curve (ClutterInputDeviceTool *tool, | ||||
|                                                          gdouble                 curve[4]); | ||||
| CLUTTER_EXPORT | ||||
| void clutter_evdev_input_device_tool_set_button_code    (ClutterInputDeviceTool *tool, | ||||
|                                                          guint                   button, | ||||
|                                                          guint                   evcode); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_EVDEV_H__ */ | ||||
| @@ -1,191 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2015 Red Hat | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Authored by: | ||||
|  *      Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter/clutter-device-manager-private.h" | ||||
| #include "clutter/clutter-event-private.h" | ||||
| #include "clutter-input-device-evdev.h" | ||||
| #include "clutter-evdev.h" | ||||
|  | ||||
| typedef struct _ClutterEventEvdev ClutterEventEvdev; | ||||
|  | ||||
| struct _ClutterEventEvdev | ||||
| { | ||||
|   guint32 evcode; | ||||
|  | ||||
|   guint64 time_usec; | ||||
|  | ||||
|   gboolean has_relative_motion; | ||||
|   double dx; | ||||
|   double dy; | ||||
|   double dx_unaccel; | ||||
|   double dy_unaccel; | ||||
| }; | ||||
|  | ||||
| static ClutterEventEvdev * | ||||
| _clutter_event_evdev_new (void) | ||||
| { | ||||
|   return g_slice_new0 (ClutterEventEvdev); | ||||
| } | ||||
|  | ||||
| ClutterEventEvdev * | ||||
| _clutter_event_evdev_copy (ClutterEventEvdev *event_evdev) | ||||
| { | ||||
|   if (event_evdev != NULL) | ||||
|     return g_slice_dup (ClutterEventEvdev, event_evdev); | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_event_evdev_free (ClutterEventEvdev *event_evdev) | ||||
| { | ||||
|   if (event_evdev != NULL) | ||||
|     g_slice_free (ClutterEventEvdev, event_evdev); | ||||
| } | ||||
|  | ||||
| static ClutterEventEvdev * | ||||
| clutter_evdev_event_ensure_platform_data (ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (!event_evdev) | ||||
|     { | ||||
|       event_evdev = _clutter_event_evdev_new (); | ||||
|       _clutter_event_set_platform_data (event, event_evdev); | ||||
|     } | ||||
|  | ||||
|   return event_evdev; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_event_code (ClutterEvent *event, | ||||
|                                      guint32       evcode) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->evcode = evcode; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_time_usec       (ClutterEvent *event, | ||||
|                                           guint64       time_usec) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->time_usec = time_usec; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_evdev_event_set_relative_motion (ClutterEvent *event, | ||||
|                                           double        dx, | ||||
|                                           double        dy, | ||||
|                                           double        dx_unaccel, | ||||
|                                           double        dy_unaccel) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev; | ||||
|  | ||||
|   event_evdev = clutter_evdev_event_ensure_platform_data (event); | ||||
|   event_evdev->dx = dx; | ||||
|   event_evdev->dy = dy; | ||||
|   event_evdev->dx_unaccel = dx_unaccel; | ||||
|   event_evdev->dy_unaccel = dy_unaccel; | ||||
|   event_evdev->has_relative_motion = TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_event_code: | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * Returns the event code of the original event. See linux/input.h for more | ||||
|  * information. | ||||
|  * | ||||
|  * Returns: The event code. | ||||
|  **/ | ||||
| guint32 | ||||
| clutter_evdev_event_get_event_code (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev) | ||||
|     return event_evdev->evcode; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_time_usec: | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * Returns the time in microsecond granularity, or 0 if unavailable. | ||||
|  * | ||||
|  * Returns: The time in microsecond granularity, or 0 if unavailable. | ||||
|  */ | ||||
| guint64 | ||||
| clutter_evdev_event_get_time_usec (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev) | ||||
|     return event_evdev->time_usec; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_evdev_event_get_pointer_motion | ||||
|  * @event: a #ClutterEvent | ||||
|  * | ||||
|  * If available, the normal and unaccelerated motion deltas are written | ||||
|  * to the dx, dy, dx_unaccel and dy_unaccel and TRUE is returned. | ||||
|  * | ||||
|  * If unavailable, FALSE is returned. | ||||
|  * | ||||
|  * Returns: TRUE on success, otherwise FALSE. | ||||
|  **/ | ||||
| gboolean | ||||
| clutter_evdev_event_get_relative_motion (const ClutterEvent *event, | ||||
|                                          double             *dx, | ||||
|                                          double             *dy, | ||||
|                                          double             *dx_unaccel, | ||||
|                                          double             *dy_unaccel) | ||||
| { | ||||
|   ClutterEventEvdev *event_evdev = _clutter_event_get_platform_data (event); | ||||
|  | ||||
|   if (event_evdev && event_evdev->has_relative_motion) | ||||
|     { | ||||
|       if (dx) | ||||
|         *dx = event_evdev->dx; | ||||
|       if (dy) | ||||
|         *dy = event_evdev->dy; | ||||
|       if (dx_unaccel) | ||||
|         *dx_unaccel = event_evdev->dx_unaccel; | ||||
|       if (dy_unaccel) | ||||
|         *dy_unaccel = event_evdev->dy_unaccel; | ||||
|       return TRUE; | ||||
|     } | ||||
|   else | ||||
|     return FALSE; | ||||
| } | ||||
| @@ -1,157 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010 Intel Corp. | ||||
|  * Copyright (C) 2014 Jonas Ådahl | ||||
|  * | ||||
|  * 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: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  * Author: Jonas Ådahl <jadahl@gmail.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_EVDEV_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_EVDEV_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <libinput.h> | ||||
|  | ||||
| #include "clutter/clutter-device-manager-private.h" | ||||
| #include "evdev/clutter-seat-evdev.h" | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_EVDEV _clutter_input_device_evdev_get_type() | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV(obj) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdev)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV_CLASS(klass) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((klass), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdevClass)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_EVDEV(obj) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_EVDEV_CLASS(klass) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((klass), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_EVDEV_GET_CLASS(obj) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceEvdev ClutterInputDeviceEvdev; | ||||
| typedef struct _ClutterEventEvdev ClutterEventEvdev; | ||||
|  | ||||
| struct _ClutterInputDeviceEvdev | ||||
| { | ||||
|   ClutterInputDevice parent; | ||||
|  | ||||
|   struct libinput_device *libinput_device; | ||||
|   ClutterSeatEvdev *seat; | ||||
|   ClutterInputDeviceTool *last_tool; | ||||
|  | ||||
|   cairo_matrix_t device_matrix; | ||||
|   gdouble device_aspect_ratio; /* w:h */ | ||||
|   gdouble output_ratio;        /* w:h */ | ||||
|  | ||||
|   GHashTable *touches; | ||||
|  | ||||
|   /* Keyboard a11y */ | ||||
|   ClutterKeyboardA11yFlags a11y_flags; | ||||
|   GList *slow_keys_list; | ||||
|   guint debounce_timer; | ||||
|   guint16 debounce_key; | ||||
|   xkb_mod_mask_t stickykeys_depressed_mask; | ||||
|   xkb_mod_mask_t stickykeys_latched_mask; | ||||
|   xkb_mod_mask_t stickykeys_locked_mask; | ||||
|   guint toggle_slowkeys_timer; | ||||
|   guint16 shift_count; | ||||
|   guint32 last_shift_time; | ||||
|   gint mousekeys_btn; | ||||
|   gboolean mousekeys_btn_states[3]; | ||||
|   guint32 mousekeys_first_motion_time; /* ms */ | ||||
|   guint32 mousekeys_last_motion_time; /* ms */ | ||||
|   guint mousekeys_init_delay; | ||||
|   guint mousekeys_accel_time; | ||||
|   guint mousekeys_max_speed; | ||||
|   gdouble mousekeys_curve_factor; | ||||
|   guint move_mousekeys_timer; | ||||
|   guint16 last_mousekeys_key; | ||||
|   ClutterVirtualInputDevice *mousekeys_virtual_device; | ||||
| }; | ||||
|  | ||||
| GType                     _clutter_input_device_evdev_get_type        (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDevice *      _clutter_input_device_evdev_new             (ClutterDeviceManager    *manager, | ||||
|                                                                        ClutterSeatEvdev        *seat, | ||||
|                                                                        struct libinput_device  *libinput_device); | ||||
|  | ||||
| ClutterInputDevice *      _clutter_input_device_evdev_new_virtual     (ClutterDeviceManager    *manager, | ||||
|                                                                        ClutterSeatEvdev        *seat, | ||||
|                                                                        ClutterInputDeviceType   type, | ||||
|                                                                        ClutterInputMode         mode); | ||||
|  | ||||
| ClutterSeatEvdev *        _clutter_input_device_evdev_get_seat        (ClutterInputDeviceEvdev *device); | ||||
|  | ||||
| void                      _clutter_input_device_evdev_update_leds     (ClutterInputDeviceEvdev *device, | ||||
|                                                                        enum libinput_led        leds); | ||||
|  | ||||
| ClutterInputDeviceType    _clutter_input_device_evdev_determine_type  (struct libinput_device  *libinput_device); | ||||
|  | ||||
|  | ||||
| ClutterEventEvdev *       _clutter_event_evdev_copy                   (ClutterEventEvdev *event_evdev); | ||||
| void                      _clutter_event_evdev_free                   (ClutterEventEvdev *event_evdev); | ||||
|  | ||||
| void                      _clutter_evdev_event_set_event_code         (ClutterEvent      *event, | ||||
|                                                                        guint32            evcode); | ||||
|  | ||||
| void                      _clutter_evdev_event_set_time_usec       (ClutterEvent *event, | ||||
| 								    guint64       time_usec); | ||||
|  | ||||
| void  			  _clutter_evdev_event_set_relative_motion (ClutterEvent *event, | ||||
| 								    double        dx, | ||||
| 								    double        dy, | ||||
| 								    double        dx_unaccel, | ||||
| 								    double        dy_unaccel); | ||||
|  | ||||
| void                      clutter_input_device_evdev_translate_coordinates (ClutterInputDevice *device, | ||||
|                                                                             ClutterStage       *stage, | ||||
|                                                                             gfloat             *x, | ||||
|                                                                             gfloat             *y); | ||||
|  | ||||
| void                      clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device, | ||||
|                                                                               ClutterKbdA11ySettings  *settings); | ||||
|  | ||||
| ClutterTouchState *       clutter_input_device_evdev_acquire_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                           int                      device_slot); | ||||
|  | ||||
| ClutterTouchState *       clutter_input_device_evdev_lookup_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                          int                      device_slot); | ||||
|  | ||||
| void                      clutter_input_device_evdev_release_touch_state (ClutterInputDeviceEvdev *device, | ||||
|                                                                           ClutterTouchState       *touch_state); | ||||
|  | ||||
| void                      clutter_input_device_evdev_release_touch_slots (ClutterInputDeviceEvdev *device_evdev, | ||||
|                                                                           uint64_t                 time_us); | ||||
|  | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */ | ||||
| @@ -1,84 +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: Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ | ||||
|  | ||||
| #include <libinput.h> | ||||
|  | ||||
| #include <clutter/clutter-input-device-tool.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV (clutter_input_device_tool_evdev_get_type ()) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdev)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_EVDEV_GET_CLASS(o) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_EVDEV, ClutterInputDeviceToolEvdevClass)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceToolEvdev ClutterInputDeviceToolEvdev; | ||||
| typedef struct _ClutterInputDeviceToolEvdevClass ClutterInputDeviceToolEvdevClass; | ||||
|  | ||||
| struct _ClutterInputDeviceToolEvdev | ||||
| { | ||||
|   ClutterInputDeviceTool parent_instance; | ||||
|   struct libinput_tablet_tool *tool; | ||||
|   GHashTable *button_map; | ||||
|   gdouble pressure_curve[4]; | ||||
| }; | ||||
|  | ||||
| struct _ClutterInputDeviceToolEvdevClass | ||||
| { | ||||
|   ClutterInputDeviceToolClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType                    clutter_input_device_tool_evdev_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDeviceTool * clutter_input_device_tool_evdev_new      (struct libinput_tablet_tool *tool, | ||||
|                                                                    guint64                      serial, | ||||
|                                                                    ClutterInputDeviceToolType   type); | ||||
|  | ||||
| gdouble                  clutter_input_device_tool_evdev_translate_pressure (ClutterInputDeviceTool *tool, | ||||
|                                                                              gdouble                 pressure); | ||||
| guint                    clutter_input_device_tool_evdev_get_button_code    (ClutterInputDeviceTool *tool, | ||||
|                                                                              guint                   button); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ */ | ||||
| @@ -1,163 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2010  Intel Corp. | ||||
|  * Copyright (C) 2014  Jonas Ådahl | ||||
|  * Copyright (C) 2016  Red Hat Inc. | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Damien Lespiau <damien.lespiau@intel.com> | ||||
|  * Author: Jonas Ådahl <jadahl@gmail.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_SEAT_EVDEV_H__ | ||||
| #define __CLUTTER_SEAT_EVDEV_H__ | ||||
|  | ||||
| #include <libinput.h> | ||||
| #include <linux/input.h> | ||||
|  | ||||
| #include "clutter-input-device.h" | ||||
| #include "clutter-device-manager-evdev.h" | ||||
| #include "clutter-xkb-utils.h" | ||||
|  | ||||
| typedef struct _ClutterTouchState ClutterTouchState; | ||||
|  | ||||
| struct _ClutterTouchState | ||||
| { | ||||
|   ClutterSeatEvdev *seat; | ||||
|  | ||||
|   int device_slot; | ||||
|   int seat_slot; | ||||
|   ClutterPoint coords; | ||||
| }; | ||||
|  | ||||
| struct _ClutterSeatEvdev | ||||
| { | ||||
|   struct libinput_seat *libinput_seat; | ||||
|   ClutterDeviceManagerEvdev *manager_evdev; | ||||
|  | ||||
|   GSList *devices; | ||||
|  | ||||
|   ClutterInputDevice *core_pointer; | ||||
|   ClutterInputDevice *core_keyboard; | ||||
|  | ||||
|   ClutterTouchState **touch_states; | ||||
|   int n_alloc_touch_states; | ||||
|  | ||||
|   struct xkb_state *xkb; | ||||
|   xkb_led_index_t caps_lock_led; | ||||
|   xkb_led_index_t num_lock_led; | ||||
|   xkb_led_index_t scroll_lock_led; | ||||
|   xkb_layout_index_t layout_idx; | ||||
|   uint32_t button_state; | ||||
|   int button_count[KEY_CNT]; | ||||
|  | ||||
|   /* keyboard repeat */ | ||||
|   gboolean repeat; | ||||
|   guint32 repeat_delay; | ||||
|   guint32 repeat_interval; | ||||
|   guint32 repeat_key; | ||||
|   guint32 repeat_count; | ||||
|   guint32 repeat_timer; | ||||
|   ClutterInputDevice *repeat_device; | ||||
|  | ||||
|   gfloat pointer_x; | ||||
|   gfloat pointer_y; | ||||
|  | ||||
|   /* Emulation of discrete scroll events out of smooth ones */ | ||||
|   gfloat accum_scroll_dx; | ||||
|   gfloat accum_scroll_dy; | ||||
| }; | ||||
|  | ||||
| void clutter_seat_evdev_notify_key (ClutterSeatEvdev   *seat, | ||||
|                                     ClutterInputDevice *device, | ||||
|                                     uint64_t            time_us, | ||||
|                                     uint32_t            key, | ||||
|                                     uint32_t            state, | ||||
|                                     gboolean            update_keys); | ||||
|  | ||||
| void clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev   *seat_evdev, | ||||
|                                                 ClutterInputDevice *input_device, | ||||
|                                                 uint64_t            time_us, | ||||
|                                                 float               dx, | ||||
|                                                 float               dy, | ||||
|                                                 float               dx_unaccel, | ||||
|                                                 float               dy_unaccel); | ||||
|  | ||||
| void clutter_seat_evdev_notify_absolute_motion (ClutterSeatEvdev   *seat_evdev, | ||||
|                                                 ClutterInputDevice *input_device, | ||||
|                                                 uint64_t            time_us, | ||||
|                                                 float               x, | ||||
|                                                 float               y, | ||||
|                                                 double             *axes); | ||||
|  | ||||
| void clutter_seat_evdev_notify_button (ClutterSeatEvdev   *seat, | ||||
|                                        ClutterInputDevice *input_device, | ||||
|                                        uint64_t            time_us, | ||||
|                                        uint32_t            button, | ||||
|                                        uint32_t            state); | ||||
|  | ||||
| void clutter_seat_evdev_notify_scroll_continuous (ClutterSeatEvdev         *seat, | ||||
|                                                   ClutterInputDevice       *input_device, | ||||
|                                                   uint64_t                  time_us, | ||||
|                                                   double                    dx, | ||||
|                                                   double                    dy, | ||||
|                                                   ClutterScrollSource       source, | ||||
|                                                   ClutterScrollFinishFlags  flags); | ||||
|  | ||||
| void clutter_seat_evdev_notify_discrete_scroll (ClutterSeatEvdev    *seat, | ||||
|                                                 ClutterInputDevice  *input_device, | ||||
|                                                 uint64_t             time_us, | ||||
|                                                 double               discrete_dx, | ||||
|                                                 double               discrete_dy, | ||||
|                                                 ClutterScrollSource  source); | ||||
|  | ||||
| void clutter_seat_evdev_notify_touch_event (ClutterSeatEvdev   *seat, | ||||
|                                             ClutterInputDevice *input_device, | ||||
|                                             ClutterEventType    evtype, | ||||
|                                             uint64_t            time_us, | ||||
|                                             int                 slot, | ||||
|                                             double              x, | ||||
|                                             double              y); | ||||
|  | ||||
| void clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev     *seat, | ||||
|                                            struct libinput_seat *libinput_seat); | ||||
|  | ||||
| void clutter_seat_evdev_sync_leds (ClutterSeatEvdev *seat); | ||||
|  | ||||
| ClutterInputDevice * clutter_seat_evdev_get_device (ClutterSeatEvdev *seat, | ||||
|                                                     gint              id); | ||||
|  | ||||
| ClutterTouchState * clutter_seat_evdev_acquire_touch_state (ClutterSeatEvdev *seat, | ||||
|                                                             int               device_slot); | ||||
|  | ||||
| void clutter_seat_evdev_release_touch_state (ClutterSeatEvdev  *seat, | ||||
|                                              ClutterTouchState *touch_state); | ||||
|  | ||||
| ClutterTouchState * clutter_seat_evdev_get_touch (ClutterSeatEvdev *seat, | ||||
|                                                   guint32           id); | ||||
|  | ||||
| void clutter_seat_evdev_set_stage (ClutterSeatEvdev *seat, | ||||
|                                    ClutterStage     *stage); | ||||
|  | ||||
| void clutter_seat_evdev_clear_repeat_timer (ClutterSeatEvdev *seat); | ||||
|  | ||||
| ClutterSeatEvdev * clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev); | ||||
|  | ||||
| void clutter_seat_evdev_free (ClutterSeatEvdev *seat); | ||||
|  | ||||
| #endif /* __CLUTTER_SEAT_EVDEV_H__ */ | ||||
| @@ -1,46 +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/>. | ||||
|  | ||||
|  * Authors: | ||||
|  *  Damien Lespiau <damien.lespiau@intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_XKB_UTILS_H__ | ||||
| #define __CLUTTER_XKB_UTILS_H__ | ||||
|  | ||||
| #include <xkbcommon/xkbcommon.h> | ||||
|  | ||||
| #include "clutter-stage.h" | ||||
| #include "clutter-event.h" | ||||
| #include "clutter-input-device.h" | ||||
|  | ||||
| ClutterEvent *    _clutter_key_event_new_from_evdev (ClutterInputDevice *device, | ||||
| 						     ClutterInputDevice *core_keyboard, | ||||
|                                                      ClutterStage       *stage, | ||||
|                                                      struct xkb_state   *xkb_state, | ||||
| 						     uint32_t            button_state, | ||||
|                                                      uint32_t            _time, | ||||
|                                                      uint32_t            key, | ||||
|                                                      uint32_t            state); | ||||
| void               _clutter_xkb_translate_state     (ClutterEvent       *event, | ||||
| 						     struct xkb_state   *xkb_state, | ||||
| 						     uint32_t            button_state); | ||||
|  | ||||
| #endif /* __CLUTTER_XKB_UTILS_H__ */ | ||||
| @@ -75,8 +75,8 @@ clutter_headers = [ | ||||
|   'clutter-snap-constraint.h', | ||||
|   'clutter-stage.h', | ||||
|   'clutter-stage-manager.h', | ||||
|   'clutter-stage-view.h', | ||||
|   'clutter-tap-action.h', | ||||
|   'clutter-test-utils.h', | ||||
|   'clutter-texture.h', | ||||
|   'clutter-text.h', | ||||
|   'clutter-text-buffer.h', | ||||
| @@ -133,6 +133,7 @@ clutter_sources = [ | ||||
|   'clutter-input-device-tool.c', | ||||
|   'clutter-input-focus.c', | ||||
|   'clutter-input-method.c', | ||||
|   'clutter-input-pointer-a11y.c', | ||||
|   'clutter-virtual-input-device.c', | ||||
|   'clutter-interval.c', | ||||
|   'clutter-keyframe-transition.c', | ||||
| @@ -163,9 +164,9 @@ clutter_sources = [ | ||||
|   'clutter-snap-constraint.c', | ||||
|   'clutter-stage.c', | ||||
|   'clutter-stage-manager.c', | ||||
|   'clutter-stage-view.c', | ||||
|   'clutter-stage-window.c', | ||||
|   'clutter-tap-action.c', | ||||
|   'clutter-test-utils.c', | ||||
|   'clutter-text.c', | ||||
|   'clutter-text-buffer.c', | ||||
|   'clutter-transition-group.c', | ||||
| @@ -188,13 +189,13 @@ clutter_private_headers = [ | ||||
|   'clutter-device-manager-private.h', | ||||
|   'clutter-easing.h', | ||||
|   'clutter-effect-private.h', | ||||
|   'clutter-event-translator.h', | ||||
|   'clutter-event-private.h', | ||||
|   'clutter-flatten-effect.h', | ||||
|   'clutter-gesture-action-private.h', | ||||
|   'clutter-id-pool.h', | ||||
|   'clutter-input-focus-private.h', | ||||
|   'clutter-input-method-private.h', | ||||
|   'clutter-input-pointer-a11y-private.h', | ||||
|   'clutter-master-clock.h', | ||||
|   'clutter-master-clock-default.h', | ||||
|   'clutter-offscreen-effect-private.h', | ||||
| @@ -205,15 +206,13 @@ clutter_private_headers = [ | ||||
|   'clutter-settings-private.h', | ||||
|   'clutter-stage-manager-private.h', | ||||
|   'clutter-stage-private.h', | ||||
|   'clutter-stage-view.h', | ||||
|   'clutter-stage-view-private.h', | ||||
|   'clutter-stage-window.h', | ||||
| ] | ||||
|  | ||||
| clutter_nonintrospected_sources = [ | ||||
|   'clutter-easing.c', | ||||
|   'clutter-event-translator.c', | ||||
|   'clutter-id-pool.c', | ||||
|   'clutter-stage-view.c', | ||||
| ] | ||||
|  | ||||
| clutter_deprecated_headers = [ | ||||
| @@ -231,7 +230,6 @@ clutter_deprecated_headers = [ | ||||
|   'deprecated/clutter-container.h', | ||||
|   'deprecated/clutter-group.h', | ||||
|   'deprecated/clutter-keysyms.h', | ||||
|   'deprecated/clutter-main.h', | ||||
|   'deprecated/clutter-rectangle.h', | ||||
|   'deprecated/clutter-stage-manager.h', | ||||
|   'deprecated/clutter-stage.h', | ||||
| @@ -271,21 +269,9 @@ clutter_backend_private_headers = [ | ||||
| if have_x11 | ||||
|   clutter_x11_sources = [ | ||||
|     'x11/clutter-backend-x11.c', | ||||
|     'x11/clutter-device-manager-xi2.c', | ||||
|     'x11/clutter-event-x11.c', | ||||
|     'x11/clutter-input-device-tool-xi2.c', | ||||
|     'x11/clutter-input-device-xi2.c', | ||||
|     'x11/clutter-keymap-x11.c', | ||||
|     'x11/clutter-stage-x11.c', | ||||
|     'x11/clutter-virtual-input-device-x11.c', | ||||
|   ] | ||||
|   clutter_backend_sources += clutter_x11_sources | ||||
|  | ||||
|   clutter_x11_nonintrospected_sources = [ | ||||
|     'x11/clutter-xkb-a11y-x11.c', | ||||
|   ] | ||||
|   clutter_backend_nonintrospected_sources += clutter_x11_nonintrospected_sources | ||||
|  | ||||
|   clutter_x11_headers = [ | ||||
|     'x11/clutter-x11.h', | ||||
|   ] | ||||
| @@ -293,14 +279,7 @@ if have_x11 | ||||
|  | ||||
|   clutter_x11_private_headers = [ | ||||
|     'x11/clutter-backend-x11.h', | ||||
|     'x11/clutter-device-manager-xi2.h', | ||||
|     'x11/clutter-input-device-tool-xi2.h', | ||||
|     'x11/clutter-input-device-xi2.h', | ||||
|     'x11/clutter-keymap-x11.h', | ||||
|     'x11/clutter-settings-x11.h', | ||||
|     'x11/clutter-stage-x11.h', | ||||
|     'x11/clutter-virtual-input-device-x11.h', | ||||
|     'x11/clutter-xkb-a11y-x11.h', | ||||
|   ] | ||||
|   clutter_backend_private_headers += clutter_x11_private_headers | ||||
|  | ||||
| @@ -316,39 +295,13 @@ endif | ||||
| if have_native_backend | ||||
|   clutter_native_nonintrospected_sources = [ | ||||
|     'egl/clutter-backend-eglnative.c', | ||||
|     'evdev/clutter-device-manager-evdev.c', | ||||
|     'evdev/clutter-event-evdev.c', | ||||
|     'evdev/clutter-input-device-evdev.c', | ||||
|     'evdev/clutter-input-device-tool-evdev.c', | ||||
|     'evdev/clutter-keymap-evdev.c', | ||||
|     'evdev/clutter-seat-evdev.c', | ||||
|     'evdev/clutter-virtual-input-device-evdev.c', | ||||
|     'evdev/clutter-xkb-utils.c', | ||||
|   ] | ||||
|   clutter_backend_nonintrospected_sources += clutter_native_nonintrospected_sources | ||||
|  | ||||
|   clutter_native_private_headers = [ | ||||
|     'evdev/clutter-evdev.h', | ||||
|     'evdev/clutter-device-manager-evdev.h', | ||||
|     'evdev/clutter-input-device-evdev.h', | ||||
|     'evdev/clutter-input-device-tool-evdev.h', | ||||
|     'evdev/clutter-keymap-evdev.h', | ||||
|     'evdev/clutter-seat-evdev.h', | ||||
|     'evdev/clutter-virtual-input-device-evdev.h', | ||||
|     'evdev/clutter-xkb-utils.h', | ||||
|   ] | ||||
|   clutter_backend_private_headers += clutter_native_private_headers | ||||
| endif | ||||
|  | ||||
| if have_wayland | ||||
|   clutter_wayland_nonintrospected_sources = [ | ||||
|     'wayland/clutter-wayland-surface.c', | ||||
|   ] | ||||
|   clutter_backend_nonintrospected_sources += clutter_wayland_nonintrospected_sources | ||||
|  | ||||
|   clutter_wayland_private_headers = [ | ||||
|     'wayland/clutter-wayland-compositor.h', | ||||
|     'wayland/clutter-wayland-surface.h', | ||||
|   ] | ||||
|   clutter_backend_private_headers += clutter_wayland_private_headers | ||||
| endif | ||||
| @@ -504,7 +457,12 @@ libmutter_clutter_dep = declare_dependency( | ||||
| ) | ||||
|  | ||||
| if have_introspection | ||||
|   clutter_introspection_args = introspection_args + clutter_c_args | ||||
|   clutter_introspection_args = introspection_args + [ | ||||
|     '-DCLUTTER_SYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)), | ||||
|     '-DCLUTTER_COMPILATION=1', | ||||
|     '-DCOGL_DISABLE_DEPRECATION_WARNINGS', | ||||
|     '-DG_LOG_DOMAIN="Clutter"' | ||||
|   ] | ||||
|  | ||||
|   libmutter_clutter_gir = gnome.generate_gir(libmutter_clutter, | ||||
|     sources: [ | ||||
|   | ||||
| @@ -1,654 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2011 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/>. | ||||
|  * | ||||
|  * Authors: | ||||
|  *  Robert Bragg <robert@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * SECTION:clutter-wayland-surface | ||||
|  * @Title: ClutterWaylandSurface | ||||
|  * @short_description: An actor which displays the content of a client surface | ||||
|  * | ||||
|  * #ClutterWaylandSurface is an actor for displaying the contents of a client | ||||
|  * surface. It is intended to support developers implementing Clutter based | ||||
|  * wayland compositors. | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #define CLUTTER_ENABLE_EXPERIMENTAL_API | ||||
|  | ||||
| #include "clutter-wayland-surface.h" | ||||
|  | ||||
| #include "clutter-actor-private.h" | ||||
| #include "clutter-marshal.h" | ||||
| #include "clutter-paint-volume-private.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-backend.h" | ||||
|  | ||||
| #include <cogl/cogl.h> | ||||
| #include <cogl/cogl-wayland-server.h> | ||||
|  | ||||
| enum | ||||
| { | ||||
|   PROP_SURFACE = 1, | ||||
|   PROP_SURFACE_WIDTH, | ||||
|   PROP_SURFACE_HEIGHT, | ||||
|   PROP_COGL_TEXTURE, | ||||
|   PROP_LAST | ||||
| }; | ||||
|  | ||||
| static GParamSpec *obj_props[PROP_LAST]; | ||||
|  | ||||
| enum | ||||
| { | ||||
|   QUEUE_DAMAGE_REDRAW, | ||||
|  | ||||
|   LAST_SIGNAL | ||||
| }; | ||||
|  | ||||
| static guint signals[LAST_SIGNAL] = { 0, }; | ||||
|  | ||||
| struct _ClutterWaylandSurfacePrivate | ||||
| { | ||||
|   struct wl_surface *surface; | ||||
|   CoglTexture2D *buffer; | ||||
|   int width, height; | ||||
|   CoglPipeline *pipeline; | ||||
| }; | ||||
|  | ||||
| G_DEFINE_TYPE_WITH_PRIVATE (ClutterWaylandSurface, | ||||
|                             clutter_wayland_surface, | ||||
|                             CLUTTER_TYPE_ACTOR) | ||||
|  | ||||
| static gboolean | ||||
| clutter_wayland_surface_get_paint_volume (ClutterActor *self, | ||||
|                                           ClutterPaintVolume *volume) | ||||
| { | ||||
|   return clutter_paint_volume_set_from_allocation (volume, self); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_queue_damage_redraw (ClutterWaylandSurface *texture, | ||||
|                                              gint x, | ||||
|                                              gint y, | ||||
|                                              gint width, | ||||
|                                              gint height) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv = texture->priv; | ||||
|   ClutterActor *self = CLUTTER_ACTOR (texture); | ||||
|   ClutterActorBox allocation; | ||||
|   float scale_x; | ||||
|   float scale_y; | ||||
|   cairo_rectangle_int_t clip; | ||||
|  | ||||
|   /* NB: clutter_actor_queue_redraw_with_clip expects a box in the actor's | ||||
|    * coordinate space so we need to convert from surface coordinates to | ||||
|    * actor coordinates... | ||||
|    */ | ||||
|  | ||||
|   /* Calling clutter_actor_get_allocation_box() is enormously expensive | ||||
|    * if the actor has an out-of-date allocation, since it triggers | ||||
|    * a full redraw. clutter_actor_queue_redraw_with_clip() would redraw | ||||
|    * the whole stage anyways in that case, so just go ahead and do | ||||
|    * it here. | ||||
|    */ | ||||
|   if (!clutter_actor_has_allocation (self)) | ||||
|     { | ||||
|       clutter_actor_queue_redraw (self); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   if (priv->width == 0 || priv->height == 0) | ||||
|     return; | ||||
|  | ||||
|   clutter_actor_get_allocation_box (self, &allocation); | ||||
|  | ||||
|   scale_x = (allocation.x2 - allocation.x1) / priv->width; | ||||
|   scale_y = (allocation.y2 - allocation.y1) / priv->height; | ||||
|  | ||||
|   clip.x = x * scale_x; | ||||
|   clip.y = y * scale_y; | ||||
|   clip.width = width * scale_x; | ||||
|   clip.height = height * scale_y; | ||||
|   clutter_actor_queue_redraw_with_clip (self, &clip); | ||||
| } | ||||
|  | ||||
| static void | ||||
| free_pipeline (ClutterWaylandSurface *self) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|  | ||||
|   if (priv->pipeline) | ||||
|     { | ||||
|       cogl_object_unref (priv->pipeline); | ||||
|       priv->pipeline = NULL; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| opacity_change_cb (ClutterWaylandSurface *self) | ||||
| { | ||||
|   free_pipeline (self); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_init (ClutterWaylandSurface *self) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|    | ||||
|   priv = clutter_wayland_surface_get_instance_private (self); | ||||
|   priv->surface = NULL; | ||||
|   priv->width = 0; | ||||
|   priv->height = 0; | ||||
|  | ||||
|   self->priv = priv; | ||||
|  | ||||
|   g_signal_connect (self, "notify::opacity", G_CALLBACK (opacity_change_cb), NULL); | ||||
| } | ||||
|  | ||||
| static void | ||||
| free_surface_buffers (ClutterWaylandSurface *self) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|  | ||||
|   if (priv->buffer) | ||||
|     { | ||||
|       cogl_object_unref (priv->buffer); | ||||
|       priv->buffer = NULL; | ||||
|       free_pipeline (self); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_dispose (GObject *object) | ||||
| { | ||||
|   ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object); | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|  | ||||
|   free_pipeline (self); | ||||
|   free_surface_buffers (self); | ||||
|   priv->surface = NULL; | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_wayland_surface_parent_class)->dispose (object); | ||||
| } | ||||
|  | ||||
| static void | ||||
| set_size (ClutterWaylandSurface *self, | ||||
|           int width, | ||||
|           int height) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|  | ||||
|   if (priv->width != width) | ||||
|     { | ||||
|       priv->width = width; | ||||
|       g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_WIDTH]); | ||||
|     } | ||||
|   if (priv->height != height) | ||||
|     { | ||||
|       priv->height = height; | ||||
|       g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_HEIGHT]); | ||||
|     } | ||||
|  | ||||
|   clutter_actor_set_size (CLUTTER_ACTOR (self), priv->width, priv->height); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_get_surface: | ||||
|  * @self: a #ClutterWaylandSurface | ||||
|  * | ||||
|  * Retrieves a point to the Wayland surface used by the actor. | ||||
|  * | ||||
|  * Return value: (transfer none): a wl_surface pointer, or %NULL | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| struct wl_surface * | ||||
| clutter_wayland_surface_get_surface (ClutterWaylandSurface *self) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|   return priv->surface; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_set_surface: | ||||
|  * @self: a #ClutterWaylandSurface | ||||
|  * @surface: a Wayland wl_surface pointer | ||||
|  * | ||||
|  * Sets the Wayland surface to be used by the actor. | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| void | ||||
| clutter_wayland_surface_set_surface (ClutterWaylandSurface *self, | ||||
|                                      struct wl_surface *surface) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); | ||||
|  | ||||
|   priv = self->priv; | ||||
|  | ||||
|   if (priv->surface == surface) | ||||
|     return; | ||||
|  | ||||
|   if (priv->surface) | ||||
|     { | ||||
|       free_pipeline (self); | ||||
|       free_surface_buffers (self); | ||||
|       g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW], | ||||
|                      0, | ||||
|                      0, 0, priv->width, priv->height); | ||||
|     } | ||||
|  | ||||
|   priv->surface = surface; | ||||
|  | ||||
|   /* XXX: should we freeze/thaw notifications? */ | ||||
|  | ||||
|   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE]); | ||||
|  | ||||
|   /* We have to wait until the next attach event to find out the surface | ||||
|    * geometry... */ | ||||
|   set_size (self, 0, 0); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_set_property (GObject *object, | ||||
|                                       guint prop_id, | ||||
|                                       const GValue *value, | ||||
|                                       GParamSpec *pspec) | ||||
| { | ||||
|   ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object); | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
|     case PROP_SURFACE: | ||||
|       clutter_wayland_surface_set_surface (self, g_value_get_pointer (value)); | ||||
|       break; | ||||
|     default: | ||||
|       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||||
|       break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_get_property (GObject *object, | ||||
|                                       guint prop_id, | ||||
|                                       GValue *value, | ||||
|                                       GParamSpec *pspec) | ||||
| { | ||||
|   ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object); | ||||
|   ClutterWaylandSurfacePrivate *priv = self->priv; | ||||
|  | ||||
|   switch (prop_id) | ||||
|     { | ||||
|     case PROP_SURFACE: | ||||
|       g_value_set_pointer (value, priv->surface); | ||||
|       break; | ||||
|     case PROP_SURFACE_WIDTH: | ||||
|       g_value_set_uint (value, priv->width); | ||||
|       break; | ||||
|     case PROP_SURFACE_HEIGHT: | ||||
|       g_value_set_uint (value, priv->height); | ||||
|       break; | ||||
|     default: | ||||
|       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||||
|       break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_paint (ClutterActor *self) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|   CoglFramebuffer *framebuffer; | ||||
|   ClutterActorBox box; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); | ||||
|  | ||||
|   priv = CLUTTER_WAYLAND_SURFACE (self)->priv; | ||||
|   framebuffer = cogl_get_draw_framebuffer (); | ||||
|  | ||||
|   if (G_UNLIKELY (priv->pipeline == NULL)) | ||||
|     { | ||||
|       CoglContext *ctx = | ||||
|         clutter_backend_get_cogl_context (clutter_get_default_backend ()); | ||||
|       guint8 paint_opacity = clutter_actor_get_paint_opacity (self); | ||||
|  | ||||
|       priv->pipeline = cogl_pipeline_new (ctx); | ||||
|       cogl_pipeline_set_color4ub (priv->pipeline, | ||||
|                                   paint_opacity, | ||||
|                                   paint_opacity, | ||||
|                                   paint_opacity, | ||||
|                                   paint_opacity); | ||||
|       cogl_pipeline_set_layer_texture (priv->pipeline, 0, | ||||
|                                        COGL_TEXTURE (priv->buffer)); | ||||
|     } | ||||
|  | ||||
|   clutter_actor_get_allocation_box (self, &box); | ||||
|   cogl_framebuffer_draw_rectangle (framebuffer, | ||||
|                                    priv->pipeline, | ||||
|                                    0, 0, | ||||
|                                    box.x2 - box.x1, box.y2 - box.y1); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_get_preferred_width (ClutterActor *self, | ||||
|                                              gfloat for_height, | ||||
|                                              gfloat *min_width_p, | ||||
|                                              gfloat *natural_width_p) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); | ||||
|  | ||||
|   priv = CLUTTER_WAYLAND_SURFACE (self)->priv; | ||||
|  | ||||
|   if (min_width_p) | ||||
|     *min_width_p = 0; | ||||
|  | ||||
|   if (natural_width_p) | ||||
|     *natural_width_p = priv->width; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_get_preferred_height (ClutterActor *self, | ||||
|                                               gfloat for_width, | ||||
|                                               gfloat *min_height_p, | ||||
|                                               gfloat *natural_height_p) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); | ||||
|  | ||||
|   priv = CLUTTER_WAYLAND_SURFACE (self)->priv; | ||||
|  | ||||
|   if (min_height_p) | ||||
|     *min_height_p = 0; | ||||
|  | ||||
|   if (natural_height_p) | ||||
|     *natural_height_p = priv->height; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_wayland_surface_has_overlaps (ClutterActor *self) | ||||
| { | ||||
|   /* Rectangles never need an offscreen redirect because there are | ||||
|      never any overlapping primitives */ | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass) | ||||
| { | ||||
|   GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||||
|   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); | ||||
|   GParamSpec *pspec; | ||||
|  | ||||
|   actor_class->get_paint_volume = clutter_wayland_surface_get_paint_volume; | ||||
|   actor_class->paint = clutter_wayland_surface_paint; | ||||
|   actor_class->get_preferred_width = | ||||
|     clutter_wayland_surface_get_preferred_width; | ||||
|   actor_class->get_preferred_height = | ||||
|     clutter_wayland_surface_get_preferred_height; | ||||
|   actor_class->has_overlaps = clutter_wayland_surface_has_overlaps; | ||||
|  | ||||
|   object_class->dispose      = clutter_wayland_surface_dispose; | ||||
|   object_class->set_property = clutter_wayland_surface_set_property; | ||||
|   object_class->get_property = clutter_wayland_surface_get_property; | ||||
|  | ||||
|   pspec = g_param_spec_pointer ("surface", | ||||
| 			        P_("Surface"), | ||||
| 			        P_("The underlying wayland surface"), | ||||
|                                 CLUTTER_PARAM_READWRITE| | ||||
|                                 G_PARAM_CONSTRUCT_ONLY); | ||||
|   obj_props[PROP_SURFACE] = pspec; | ||||
|   g_object_class_install_property (object_class, PROP_SURFACE, pspec); | ||||
|  | ||||
|   pspec = g_param_spec_uint ("surface-width", | ||||
|                              P_("Surface width"), | ||||
|                              P_("The width of the underlying wayland surface"), | ||||
|                              0, G_MAXUINT, | ||||
|                              0, | ||||
|                              G_PARAM_READABLE); | ||||
|   obj_props[PROP_SURFACE_WIDTH] = pspec; | ||||
|   g_object_class_install_property (object_class, PROP_SURFACE_WIDTH, pspec); | ||||
|  | ||||
|   pspec = g_param_spec_uint ("surface-height", | ||||
|                              P_("Surface height"), | ||||
|                              P_("The height of the underlying wayland surface"), | ||||
|                              0, G_MAXUINT, | ||||
|                              0, | ||||
|                              G_PARAM_READABLE); | ||||
|   obj_props[PROP_SURFACE_HEIGHT] = pspec; | ||||
|   g_object_class_install_property (object_class, PROP_SURFACE_HEIGHT, pspec); | ||||
|  | ||||
|   pspec = g_param_spec_boxed ("cogl-texture", | ||||
|                               P_("Cogl Texture"), | ||||
|                               P_("The underlying Cogl texture handle used to draw this actor"), | ||||
|                               COGL_TYPE_HANDLE, | ||||
|                               CLUTTER_PARAM_READWRITE); | ||||
|   obj_props[PROP_COGL_TEXTURE] = pspec; | ||||
|   g_object_class_install_property (object_class, PROP_COGL_TEXTURE, pspec); | ||||
|  | ||||
|   /** | ||||
|    * ClutterWaylandSurface::queue-damage-redraw: | ||||
|    * @texture: the object which received the signal | ||||
|    * @x: The top left x position of the damage region | ||||
|    * @y: The top left y position of the damage region | ||||
|    * @width: The width of the damage region | ||||
|    * @height: The height of the damage region | ||||
|    * | ||||
|    * ::queue-damage-redraw is emitted to notify that some sub-region | ||||
|    * of the texture has been changed. This usually means a redraw | ||||
|    * needs to be queued for the actor. | ||||
|    * | ||||
|    * The default handler will queue a clipped redraw in response to | ||||
|    * the damage, using the assumption that the pixmap is being painted | ||||
|    * to a rectangle covering the transformed allocation of the actor. | ||||
|    * If you sub-class and change the paint method so this isn't true | ||||
|    * then you must also provide your own damage signal handler to | ||||
|    * queue a redraw that blocks this default behaviour. | ||||
|    * | ||||
|    * Since: 1.10 | ||||
|    */ | ||||
|   signals[QUEUE_DAMAGE_REDRAW] = | ||||
|     g_signal_new (g_intern_static_string ("queue-damage-redraw"), | ||||
|                   G_TYPE_FROM_CLASS (object_class), | ||||
|                   G_SIGNAL_RUN_FIRST, | ||||
|                   G_STRUCT_OFFSET (ClutterWaylandSurfaceClass, queue_damage_redraw), | ||||
|                   NULL, NULL, | ||||
|                   _clutter_marshal_VOID__INT_INT_INT_INT, | ||||
|                   G_TYPE_NONE, 4, | ||||
|                   G_TYPE_INT, | ||||
|                   G_TYPE_INT, | ||||
|                   G_TYPE_INT, | ||||
|                   G_TYPE_INT); | ||||
|   klass->queue_damage_redraw = clutter_wayland_surface_queue_damage_redraw; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_new: | ||||
|  * @surface: the Wayland surface this actor should represent | ||||
|  * | ||||
|  * Creates a new #ClutterWaylandSurface for @surface | ||||
|  * | ||||
|  * Return value: A new #ClutterWaylandSurface representing @surface | ||||
|  * | ||||
|  * Since: 1.8 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| ClutterActor * | ||||
| clutter_wayland_surface_new (struct wl_surface *surface) | ||||
| { | ||||
|   ClutterActor *actor; | ||||
|  | ||||
|   actor = g_object_new (CLUTTER_WAYLAND_TYPE_SURFACE, | ||||
|                         "surface", surface, | ||||
|                         NULL); | ||||
|  | ||||
|   return actor; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_attach_buffer: | ||||
|  * @self: A #ClutterWaylandSurface actor | ||||
|  * @buffer: A compositor side resource representing a wl_buffer | ||||
|  * @error: A #GError | ||||
|  * | ||||
|  * This associates a client's buffer with the #ClutterWaylandSurface | ||||
|  * actor @self. This will automatically result in @self being re-drawn | ||||
|  * with the new buffer contents. | ||||
|  * | ||||
|  * Since: 1.8 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| gboolean | ||||
| clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, | ||||
|                                        struct wl_resource *buffer, | ||||
|                                        GError **error) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|   ClutterBackend *backend = clutter_get_default_backend (); | ||||
|   CoglContext *context = clutter_backend_get_cogl_context (backend); | ||||
|  | ||||
|   g_return_val_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self), TRUE); | ||||
|  | ||||
|   priv = self->priv; | ||||
|  | ||||
|   free_surface_buffers (self); | ||||
|  | ||||
|   priv->buffer = | ||||
|     cogl_wayland_texture_2d_new_from_buffer (context, buffer, error); | ||||
|  | ||||
|   g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_COGL_TEXTURE]); | ||||
|  | ||||
|   /* NB: We don't queue a redraw of the actor here because we don't | ||||
|    * know how much of the buffer has changed with respect to the | ||||
|    * previous buffer. We only ever queue a redraw in response to | ||||
|    * surface damage. */ | ||||
|  | ||||
|   if (!priv->buffer) | ||||
|     return FALSE; | ||||
|  | ||||
|   set_size (self, | ||||
|             cogl_texture_get_width (COGL_TEXTURE (priv->buffer)), | ||||
|             cogl_texture_get_height (COGL_TEXTURE (priv->buffer))); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_damage_buffer: | ||||
|  * @self: A #ClutterWaylandSurface actor | ||||
|  * @buffer: A wayland resource for a buffer | ||||
|  * @x: The x coordinate of the damaged rectangle | ||||
|  * @y: The y coordinate of the damaged rectangle | ||||
|  * @width: The width of the damaged rectangle | ||||
|  * @height: The height of the damaged rectangle | ||||
|  * | ||||
|  * This marks a region of the given @buffer has having been changed by | ||||
|  * the client. This will automatically result in the corresponding damaged | ||||
|  * region of the actor @self being redrawn. | ||||
|  * | ||||
|  * If multiple regions are changed then this should be called multiple | ||||
|  * times with different damage rectangles. | ||||
|  * | ||||
|  * Since: 1.8 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| void | ||||
| clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self, | ||||
|                                        struct wl_resource *buffer, | ||||
|                                        gint32 x, | ||||
|                                        gint32 y, | ||||
|                                        gint32 width, | ||||
|                                        gint32 height) | ||||
| { | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
|   struct wl_shm_buffer *shm_buffer; | ||||
|  | ||||
|   g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); | ||||
|  | ||||
|   priv = self->priv; | ||||
|  | ||||
|   shm_buffer = wl_shm_buffer_get (buffer); | ||||
|  | ||||
|   if (priv->buffer && shm_buffer) | ||||
|     { | ||||
|       CoglPixelFormat format; | ||||
|  | ||||
|       switch (wl_shm_buffer_get_format (shm_buffer)) | ||||
|         { | ||||
| #if G_BYTE_ORDER == G_BIG_ENDIAN | ||||
|           case WL_SHM_FORMAT_ARGB8888: | ||||
|             format = COGL_PIXEL_FORMAT_ARGB_8888_PRE; | ||||
|             break; | ||||
|           case WL_SHM_FORMAT_XRGB8888: | ||||
|             format = COGL_PIXEL_FORMAT_ARGB_8888; | ||||
|             break; | ||||
| #elif G_BYTE_ORDER == G_LITTLE_ENDIAN | ||||
|           case WL_SHM_FORMAT_ARGB8888: | ||||
|             format = COGL_PIXEL_FORMAT_BGRA_8888_PRE; | ||||
|             break; | ||||
|           case WL_SHM_FORMAT_XRGB8888: | ||||
|             format = COGL_PIXEL_FORMAT_BGRA_8888; | ||||
|             break; | ||||
| #endif | ||||
|           default: | ||||
|             g_warn_if_reached (); | ||||
|             format = COGL_PIXEL_FORMAT_ARGB_8888; | ||||
|         } | ||||
|  | ||||
|       cogl_texture_set_region (COGL_TEXTURE (priv->buffer), | ||||
|                                x, y, | ||||
|                                x, y, | ||||
|                                width, height, | ||||
|                                width, height, | ||||
|                                format, | ||||
|                                wl_shm_buffer_get_stride (shm_buffer), | ||||
|                                wl_shm_buffer_get_data (shm_buffer)); | ||||
|     } | ||||
|  | ||||
|   g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW], | ||||
|                  0, | ||||
|                  x, y, width, height); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_wayland_surface_get_cogl_texture: | ||||
|  * @self: a #ClutterWaylandSurface | ||||
|  * | ||||
|  * Retrieves the Cogl texture with the contents of the Wayland surface. | ||||
|  * | ||||
|  * Return value: (transfer none): a Cogl texture, or %NULL | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  */ | ||||
| CoglTexture * | ||||
| clutter_wayland_surface_get_cogl_texture (ClutterWaylandSurface *self) | ||||
| { | ||||
|   g_return_val_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self), NULL); | ||||
|  | ||||
|   return COGL_TEXTURE (self->priv->buffer); | ||||
| } | ||||
| @@ -1,117 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright (C) 2011 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/>. | ||||
|  * | ||||
|  * Authors: | ||||
|  *   Robert Bragg <robert@linux.intel.com> | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_WAYLAND_SURFACE_H__ | ||||
| #define __CLUTTER_WAYLAND_SURFACE_H__ | ||||
|  | ||||
| #include <glib.h> | ||||
| #include <glib-object.h> | ||||
| #include <clutter/clutter.h> | ||||
|  | ||||
| #include <wayland-server.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_WAYLAND_TYPE_SURFACE                 (clutter_wayland_surface_get_type ()) | ||||
| #define CLUTTER_WAYLAND_SURFACE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurface)) | ||||
| #define CLUTTER_WAYLAND_SURFACE_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurfaceClass)) | ||||
| #define CLUTTER_WAYLAND_IS_SURFACE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_WAYLAND_TYPE_SURFACE)) | ||||
| #define CLUTTER_WAYLAND_IS_SURFACE_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_WAYLAND_TYPE_SURFACE)) | ||||
| #define CLUTTER_WAYLAND_SURFACE_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurfaceClass)) | ||||
|  | ||||
| typedef struct _ClutterWaylandSurface        ClutterWaylandSurface; | ||||
| typedef struct _ClutterWaylandSurfaceClass   ClutterWaylandSurfaceClass; | ||||
| typedef struct _ClutterWaylandSurfacePrivate ClutterWaylandSurfacePrivate; | ||||
|  | ||||
| /** | ||||
|  * ClutterWaylandSurface: | ||||
|  * | ||||
|  * The #ClutterWaylandSurface structure contains only private data | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| struct _ClutterWaylandSurface | ||||
| { | ||||
|   /*< private >*/ | ||||
|   ClutterActor parent; | ||||
|  | ||||
|   ClutterWaylandSurfacePrivate *priv; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * ClutterWaylandSurfaceClass: | ||||
|  * @queue_damage_redraw: class handler of the #ClutterWaylandSurface::queue-damage-redraw signal | ||||
|  * | ||||
|  * The #ClutterWaylandSurfaceClass structure contains only private data | ||||
|  * | ||||
|  * Since: 1.10 | ||||
|  * Stability: unstable | ||||
|  */ | ||||
| struct _ClutterWaylandSurfaceClass | ||||
| { | ||||
|   /*< private >*/ | ||||
|   ClutterActorClass parent_class; | ||||
|  | ||||
|   /*< public >*/ | ||||
|   void (*queue_damage_redraw) (ClutterWaylandSurface *texture, | ||||
|                                gint x, | ||||
|                                gint y, | ||||
|                                gint width, | ||||
|                                gint height); | ||||
|  | ||||
|   /*< private >*/ | ||||
|   /* padding for future expansion */ | ||||
|   gpointer _padding_dummy[8]; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType clutter_wayland_surface_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| ClutterActor *clutter_wayland_surface_new               (struct wl_surface *surface); | ||||
| CLUTTER_EXPORT | ||||
| void          clutter_wayland_surface_set_surface       (ClutterWaylandSurface *self, | ||||
|                                                          struct wl_surface *surface); | ||||
| CLUTTER_EXPORT | ||||
| struct wl_surface *clutter_wayland_surface_get_surface  (ClutterWaylandSurface *self); | ||||
| CLUTTER_EXPORT | ||||
| gboolean      clutter_wayland_surface_attach_buffer     (ClutterWaylandSurface *self, | ||||
|                                                          struct wl_resource *buffer, | ||||
|                                                          GError **error); | ||||
| CLUTTER_EXPORT | ||||
| void          clutter_wayland_surface_damage_buffer     (ClutterWaylandSurface *self, | ||||
|                                                          struct wl_resource *buffer, | ||||
|                                                          gint32 x, | ||||
|                                                          gint32 y, | ||||
|                                                          gint32 width, | ||||
|                                                          gint32 height); | ||||
| CLUTTER_EXPORT | ||||
| CoglTexture  *clutter_wayland_surface_get_cogl_texture  (ClutterWaylandSurface *self); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif | ||||
| @@ -34,9 +34,7 @@ | ||||
| #include <errno.h> | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "clutter-device-manager-xi2.h" | ||||
| #include "clutter-settings-x11.h" | ||||
| #include "clutter-stage-x11.h" | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "xsettings/xsettings-common.h" | ||||
| @@ -54,7 +52,6 @@ | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-settings-private.h" | ||||
| #include "clutter-xkb-a11y-x11.h" | ||||
|  | ||||
| G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND) | ||||
|  | ||||
| @@ -89,7 +86,6 @@ static const gchar *atom_names[] = { | ||||
|   "_NET_WM_PID", | ||||
|   "_NET_WM_PING", | ||||
|   "_NET_WM_STATE", | ||||
|   "_NET_WM_STATE_FULLSCREEN", | ||||
|   "_NET_WM_USER_TIME", | ||||
|   "WM_PROTOCOLS", | ||||
|   "WM_DELETE_WINDOW", | ||||
| @@ -102,7 +98,6 @@ static const gchar *atom_names[] = { | ||||
| #define N_ATOM_NAMES G_N_ELEMENTS (atom_names) | ||||
|  | ||||
| /* various flags corresponding to pre init setup calls */ | ||||
| static gboolean _no_xevent_retrieval = FALSE; | ||||
| static gboolean clutter_enable_xinput = TRUE; | ||||
| static gboolean clutter_enable_argb = FALSE; | ||||
| static gboolean clutter_enable_stereo = FALSE; | ||||
| @@ -230,91 +225,6 @@ clutter_backend_x11_xsettings_notify (const char       *name, | ||||
|   g_object_thaw_notify (G_OBJECT (settings)); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   ClutterEventTranslator *translator; | ||||
|   ClutterBackend *backend; | ||||
|  | ||||
|   if (clutter_enable_xinput) | ||||
|     { | ||||
|       int event_base, first_event, first_error; | ||||
|  | ||||
|       if (XQueryExtension (backend_x11->xdpy, "XInputExtension", | ||||
|                            &event_base, | ||||
|                            &first_event, | ||||
|                            &first_error)) | ||||
|         { | ||||
|           int major = 2; | ||||
|           int minor = 3; | ||||
|  | ||||
|           if (XIQueryVersion (backend_x11->xdpy, &major, &minor) != BadRequest) | ||||
|             { | ||||
|               CLUTTER_NOTE (BACKEND, "Creating XI2 device manager"); | ||||
|               backend_x11->has_xinput = TRUE; | ||||
|               backend_x11->device_manager = | ||||
|                 g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_XI2, | ||||
|                               "backend", backend_x11, | ||||
|                               "opcode", event_base, | ||||
|                               NULL); | ||||
|  | ||||
|               backend_x11->xi_minor = minor; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   if (backend_x11->device_manager == NULL) | ||||
|     { | ||||
|       g_critical ("XI2 extension is missing."); | ||||
|       backend_x11->has_xinput = FALSE; | ||||
|       backend_x11->xi_minor = -1; | ||||
|     } | ||||
|  | ||||
|   backend = CLUTTER_BACKEND (backend_x11); | ||||
|   backend->device_manager = backend_x11->device_manager; | ||||
|  | ||||
|   translator = CLUTTER_EVENT_TRANSLATOR (backend_x11->device_manager); | ||||
|   _clutter_backend_add_event_translator (backend, translator); | ||||
| } | ||||
|  | ||||
| static void | ||||
| on_keymap_state_change (ClutterKeymapX11 *keymap_x11, | ||||
|                         gpointer          data) | ||||
| { | ||||
|   ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data); | ||||
|   ClutterKbdA11ySettings kbd_a11y_settings; | ||||
|  | ||||
|   /* On keymaps state change, just reapply the current settings, it'll | ||||
|    * take care of enabling/disabling mousekeys based on NumLock state. | ||||
|    */ | ||||
|   clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings); | ||||
|   clutter_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_create_keymap (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   if (backend_x11->keymap == NULL) | ||||
|     { | ||||
|       ClutterEventTranslator *translator; | ||||
|       ClutterBackend *backend; | ||||
|  | ||||
|       backend_x11->keymap = | ||||
|         g_object_new (CLUTTER_TYPE_KEYMAP_X11, | ||||
|                       "backend", backend_x11, | ||||
|                       NULL); | ||||
|  | ||||
|       backend = CLUTTER_BACKEND (backend_x11); | ||||
|       translator = CLUTTER_EVENT_TRANSLATOR (backend_x11->keymap); | ||||
|       _clutter_backend_add_event_translator (backend, translator); | ||||
|  | ||||
|       g_signal_connect (backend_x11->keymap, | ||||
|                         "state-changed", | ||||
|                         G_CALLBACK (on_keymap_state_change), | ||||
|                         backend->device_manager); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_backend_x11_pre_parse (ClutterBackend  *backend, | ||||
|                                GError         **error) | ||||
| @@ -441,14 +351,13 @@ clutter_backend_x11_post_parse (ClutterBackend  *backend, | ||||
|   backend_x11->atom_NET_WM_PID = atoms[0]; | ||||
|   backend_x11->atom_NET_WM_PING = atoms[1]; | ||||
|   backend_x11->atom_NET_WM_STATE = atoms[2]; | ||||
|   backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3]; | ||||
|   backend_x11->atom_NET_WM_USER_TIME = atoms[4]; | ||||
|   backend_x11->atom_WM_PROTOCOLS = atoms[5]; | ||||
|   backend_x11->atom_WM_DELETE_WINDOW = atoms[6]; | ||||
|   backend_x11->atom_XEMBED = atoms[7]; | ||||
|   backend_x11->atom_XEMBED_INFO = atoms[8]; | ||||
|   backend_x11->atom_NET_WM_NAME = atoms[9]; | ||||
|   backend_x11->atom_UTF8_STRING = atoms[10]; | ||||
|   backend_x11->atom_NET_WM_USER_TIME = atoms[3]; | ||||
|   backend_x11->atom_WM_PROTOCOLS = atoms[4]; | ||||
|   backend_x11->atom_WM_DELETE_WINDOW = atoms[5]; | ||||
|   backend_x11->atom_XEMBED = atoms[6]; | ||||
|   backend_x11->atom_XEMBED_INFO = atoms[7]; | ||||
|   backend_x11->atom_NET_WM_NAME = atoms[8]; | ||||
|   backend_x11->atom_UTF8_STRING = atoms[9]; | ||||
|  | ||||
|   g_free (clutter_display_name); | ||||
|  | ||||
| @@ -463,45 +372,6 @@ clutter_backend_x11_post_parse (ClutterBackend  *backend, | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_backend_x11_events_init (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   CLUTTER_NOTE (EVENT, "initialising the event loop"); | ||||
|  | ||||
|   /* the event source is optional */ | ||||
|   if (!_no_xevent_retrieval) | ||||
|     { | ||||
|       GSource *source; | ||||
|  | ||||
|       source = _clutter_x11_event_source_new (backend_x11); | ||||
|  | ||||
|       /* default priority for events | ||||
|        * | ||||
|        * XXX - at some point we'll have a common EventSource API that | ||||
|        * is created by the backend, and this code will most likely go | ||||
|        * into the default implementation of ClutterBackend | ||||
|        */ | ||||
|       g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS); | ||||
|  | ||||
|       /* attach the source to the default context, and transfer the | ||||
|        * ownership to the GMainContext itself | ||||
|        */ | ||||
|       g_source_attach (source, NULL); | ||||
|       g_source_unref (source); | ||||
|  | ||||
|       backend_x11->event_source = source; | ||||
|     } | ||||
|  | ||||
|   clutter_backend_x11_create_device_manager (backend_x11); | ||||
|  | ||||
|   /* register keymap; unless we create a generic Keymap object, I'm | ||||
|    * afraid this will have to stay | ||||
|    */ | ||||
|   clutter_backend_x11_create_keymap (backend_x11); | ||||
| } | ||||
|  | ||||
| static const GOptionEntry entries[] = | ||||
| { | ||||
|   { | ||||
| @@ -563,8 +433,7 @@ clutter_backend_x11_dispose (GObject *gobject) | ||||
| static ClutterFeatureFlags | ||||
| clutter_backend_x11_get_features (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE | ||||
|                             | CLUTTER_FEATURE_STAGE_CURSOR; | ||||
|   ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_CURSOR; | ||||
|  | ||||
|   flags |= CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->get_features (backend); | ||||
|  | ||||
| @@ -622,7 +491,6 @@ clutter_backend_x11_translate_event (ClutterBackend *backend, | ||||
|                                      ClutterEvent   *event) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|   ClutterBackendClass *parent_class; | ||||
|   XEvent *xevent = native; | ||||
|  | ||||
|   /* X11 filter functions have a higher priority */ | ||||
| @@ -658,11 +526,7 @@ clutter_backend_x11_translate_event (ClutterBackend *backend, | ||||
|    */ | ||||
|   update_last_event_time (backend_x11, xevent); | ||||
|  | ||||
|   /* chain up to the parent implementation, which will handle | ||||
|    * event translators | ||||
|    */ | ||||
|   parent_class = CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class); | ||||
|   return parent_class->translate_event (backend, native, event); | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static CoglRenderer * | ||||
| @@ -782,50 +646,6 @@ clutter_backend_x11_get_display (ClutterBackend  *backend, | ||||
|   return display; | ||||
| } | ||||
|  | ||||
| static ClutterStageWindow * | ||||
| clutter_backend_x11_create_stage (ClutterBackend  *backend, | ||||
| 				  ClutterStage    *wrapper, | ||||
| 				  GError         **error) | ||||
| { | ||||
|   ClutterEventTranslator *translator; | ||||
|   ClutterStageWindow *stage; | ||||
|  | ||||
|   stage = g_object_new (CLUTTER_TYPE_STAGE_X11, | ||||
| 			"backend", backend, | ||||
| 			"wrapper", wrapper, | ||||
| 			NULL); | ||||
|  | ||||
|   /* the X11 stage does event translation */ | ||||
|   translator = CLUTTER_EVENT_TRANSLATOR (stage); | ||||
|   _clutter_backend_add_event_translator (backend, translator); | ||||
|  | ||||
|   CLUTTER_NOTE (BACKEND, "X11 stage created (display:%p, screen:%d, root:%u)", | ||||
|                 CLUTTER_BACKEND_X11 (backend)->xdpy, | ||||
|                 CLUTTER_BACKEND_X11 (backend)->xscreen_num, | ||||
|                 (unsigned int) CLUTTER_BACKEND_X11 (backend)->xwin_root); | ||||
|  | ||||
|   return stage; | ||||
| } | ||||
|  | ||||
| static PangoDirection | ||||
| clutter_backend_x11_get_keymap_direction (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   if (G_UNLIKELY (backend_x11->keymap == NULL)) | ||||
|     return PANGO_DIRECTION_NEUTRAL; | ||||
|  | ||||
|   return _clutter_keymap_x11_get_direction (backend_x11->keymap); | ||||
| } | ||||
|  | ||||
| static ClutterKeymap * | ||||
| clutter_backend_x11_get_keymap (ClutterBackend *backend) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   return CLUTTER_KEYMAP (backend_x11->keymap); | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
| { | ||||
| @@ -835,8 +655,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
|   gobject_class->dispose = clutter_backend_x11_dispose; | ||||
|   gobject_class->finalize = clutter_backend_x11_finalize; | ||||
|  | ||||
|   backend_class->create_stage = clutter_backend_x11_create_stage; | ||||
|  | ||||
|   backend_class->pre_parse = clutter_backend_x11_pre_parse; | ||||
|   backend_class->post_parse = clutter_backend_x11_post_parse; | ||||
|   backend_class->add_options = clutter_backend_x11_add_options; | ||||
| @@ -846,9 +664,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass) | ||||
|  | ||||
|   backend_class->get_renderer = clutter_backend_x11_get_renderer; | ||||
|   backend_class->get_display = clutter_backend_x11_get_display; | ||||
|  | ||||
|   backend_class->get_keymap_direction = clutter_backend_x11_get_keymap_direction; | ||||
|   backend_class->get_keymap = clutter_backend_x11_get_keymap; | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -959,58 +774,6 @@ clutter_x11_set_display (Display *xdpy) | ||||
|   _foreign_dpy= xdpy; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_disable_event_retrieval: | ||||
|  * | ||||
|  * Disables the internal polling of X11 events in the main loop. | ||||
|  * | ||||
|  * Libraries or applications calling this function will be responsible of | ||||
|  * polling all X11 events. | ||||
|  * | ||||
|  * You also must call clutter_x11_handle_event() to let Clutter process | ||||
|  * events and maintain its internal state. | ||||
|  * | ||||
|  * This function can only be called before calling clutter_init(). | ||||
|  * | ||||
|  * Even with event handling disabled, Clutter will still select | ||||
|  * all the events required to maintain its internal state on the stage | ||||
|  * Window; compositors using Clutter and input regions to pass events | ||||
|  * through to application windows should not rely on an empty input | ||||
|  * region, and should instead clear it themselves explicitly using the | ||||
|  * XFixes extension. | ||||
|  * | ||||
|  * This function should not be normally used by applications. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| void | ||||
| clutter_x11_disable_event_retrieval (void) | ||||
| { | ||||
|   if (_clutter_context_is_initialized ()) | ||||
|     { | ||||
|       g_warning ("%s() can only be used before calling clutter_init()", | ||||
|                  G_STRFUNC); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   _no_xevent_retrieval = TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_event_retrieval: | ||||
|  * | ||||
|  * Queries the X11 backend to check if event collection has been disabled. | ||||
|  * | ||||
|  * Return value: TRUE if event retrival has been disabled. FALSE otherwise. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| gboolean | ||||
| clutter_x11_has_event_retrieval (void) | ||||
| { | ||||
|   return !_no_xevent_retrieval; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_default_screen: | ||||
|  * | ||||
| @@ -1167,36 +930,6 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func, | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_xinput: | ||||
|  * | ||||
|  * Gets whether Clutter has XInput support. | ||||
|  * | ||||
|  * Return value: %TRUE if Clutter was compiled with XInput support | ||||
|  *   and XInput support is available at run time. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| gboolean | ||||
| clutter_x11_has_xinput (void) | ||||
| { | ||||
|  ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   if (backend == NULL) | ||||
|     { | ||||
|       g_critical ("The Clutter backend has not been initialised"); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   if (!CLUTTER_IS_BACKEND_X11 (backend)) | ||||
|     { | ||||
|       g_critical ("The Clutter backend is not a X11 backend."); | ||||
|       return FALSE; | ||||
|     } | ||||
|  | ||||
|   return CLUTTER_BACKEND_X11 (backend)->has_xinput; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_has_composite_extension: | ||||
|  * | ||||
| @@ -1344,84 +1077,3 @@ clutter_x11_get_use_stereo_stage (void) | ||||
|   return clutter_enable_stereo; | ||||
| } | ||||
|  | ||||
| XVisualInfo * | ||||
| _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   return cogl_clutter_winsys_xlib_get_visual_info (); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_visual_info: (skip) | ||||
|  * | ||||
|  * Retrieves the `XVisualInfo` used by the Clutter X11 backend. | ||||
|  * | ||||
|  * Return value: (transfer full): a `XVisualInfo`, or `None`. | ||||
|  *   The returned value should be freed using `XFree()` when done | ||||
|  * | ||||
|  * Since: 1.2 | ||||
|  */ | ||||
| XVisualInfo * | ||||
| clutter_x11_get_visual_info (void) | ||||
| { | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   ClutterBackend *backend; | ||||
|  | ||||
|   backend = clutter_get_default_backend (); | ||||
|   if (!CLUTTER_IS_BACKEND_X11 (backend)) | ||||
|     { | ||||
|       g_critical ("The Clutter backend is not a X11 backend."); | ||||
|       return NULL; | ||||
|     } | ||||
|  | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|  | ||||
|   return _clutter_backend_x11_get_visual_info (backend_x11); | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device, | ||||
|                                                   gint                stage_root_x, | ||||
|                                                   gint                stage_root_y, | ||||
|                                                   guint               index_, | ||||
|                                                   gdouble             value, | ||||
|                                                   gdouble            *axis_value) | ||||
| { | ||||
|   ClutterAxisInfo *info; | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   gdouble width, scale, offset; | ||||
|    | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (device->backend); | ||||
|  | ||||
|   if (device->axes == NULL || index_ >= device->axes->len) | ||||
|     return FALSE; | ||||
|  | ||||
|   info = &g_array_index (device->axes, ClutterAxisInfo, index_); | ||||
|   if (!(info->axis == CLUTTER_INPUT_AXIS_X || info->axis == CLUTTER_INPUT_AXIS_Y)) | ||||
|     return FALSE; | ||||
|  | ||||
|   width = info->max_value - info->min_value; | ||||
|  | ||||
|   if (info->axis == CLUTTER_INPUT_AXIS_X) | ||||
|     { | ||||
|       if (width > 0) | ||||
|         scale = backend_x11->xscreen_width / width; | ||||
|       else | ||||
|         scale = 1; | ||||
|  | ||||
|       offset = - stage_root_x; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       if (width > 0) | ||||
|         scale = backend_x11->xscreen_height / width; | ||||
|       else | ||||
|         scale = 1; | ||||
|  | ||||
|       offset = - stage_root_y; | ||||
|     } | ||||
|  | ||||
|   if (axis_value) | ||||
|     *axis_value = offset + scale * (value - info->min_value); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|   | ||||
| @@ -30,7 +30,6 @@ | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "clutter-backend-private.h" | ||||
| #include "clutter-keymap-x11.h" | ||||
|  | ||||
| #include "xsettings/xsettings-client.h" | ||||
|  | ||||
| @@ -45,7 +44,6 @@ G_BEGIN_DECLS | ||||
|  | ||||
| typedef struct _ClutterBackendX11       ClutterBackendX11; | ||||
| typedef struct _ClutterBackendX11Class  ClutterBackendX11Class; | ||||
| typedef struct _ClutterEventX11         ClutterEventX11; | ||||
| typedef struct _ClutterX11EventFilter   ClutterX11EventFilter; | ||||
|  | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackendX11, g_object_unref) | ||||
| @@ -57,16 +55,6 @@ struct _ClutterX11EventFilter | ||||
|  | ||||
| }; | ||||
|  | ||||
| struct _ClutterEventX11 | ||||
| { | ||||
|   /* additional fields for Key events */ | ||||
|   gint key_group; | ||||
|  | ||||
|   guint key_is_modifier : 1; | ||||
|   guint num_lock_set    : 1; | ||||
|   guint caps_lock_set   : 1; | ||||
| }; | ||||
|  | ||||
| struct _ClutterBackendX11 | ||||
| { | ||||
|   ClutterBackend parent_instance; | ||||
| @@ -82,14 +70,12 @@ struct _ClutterBackendX11 | ||||
|   Window   xwin_root; | ||||
|  | ||||
|   /* event source */ | ||||
|   GSource *event_source; | ||||
|   GSList  *event_filters; | ||||
|  | ||||
|   /* props */ | ||||
|   Atom atom_NET_WM_PID; | ||||
|   Atom atom_NET_WM_PING; | ||||
|   Atom atom_NET_WM_STATE; | ||||
|   Atom atom_NET_WM_STATE_FULLSCREEN; | ||||
|   Atom atom_NET_WM_USER_TIME; | ||||
|   Atom atom_WM_PROTOCOLS; | ||||
|   Atom atom_WM_DELETE_WINDOW; | ||||
| @@ -101,16 +87,9 @@ struct _ClutterBackendX11 | ||||
|   Time last_event_time; | ||||
|  | ||||
|   ClutterDeviceManager *device_manager; | ||||
|   gboolean has_xinput; | ||||
|   int xi_minor; | ||||
|  | ||||
|   XSettingsClient *xsettings; | ||||
|   Window xsettings_xwin; | ||||
|  | ||||
|   ClutterKeymapX11 *keymap; | ||||
|   gboolean use_xkb; | ||||
|   gboolean have_xkb_autorepeat; | ||||
|   guint keymap_serial; | ||||
| }; | ||||
|  | ||||
| struct _ClutterBackendX11Class | ||||
| @@ -123,26 +102,9 @@ GType clutter_backend_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterBackend *clutter_backend_x11_new (void); | ||||
|  | ||||
| void            _clutter_backend_x11_events_init        (ClutterBackend *backend); | ||||
|  | ||||
| GSource *       _clutter_x11_event_source_new   (ClutterBackendX11 *backend_x11); | ||||
|  | ||||
| /* Private to glx/eglx backends */ | ||||
| XVisualInfo *   _clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11); | ||||
|  | ||||
| void            _clutter_x11_select_events (Window xwin); | ||||
|  | ||||
| ClutterEventX11 *       _clutter_event_x11_new          (void); | ||||
| ClutterEventX11 *       _clutter_event_x11_copy         (ClutterEventX11 *event_x11); | ||||
| void                    _clutter_event_x11_free         (ClutterEventX11 *event_x11); | ||||
|  | ||||
| gboolean        _clutter_x11_input_device_translate_screen_coord (ClutterInputDevice *device, | ||||
|                                                                   gint                stage_root_x, | ||||
|                                                                   gint                stage_root_y, | ||||
|                                                                   guint               index_, | ||||
|                                                                   gdouble             value, | ||||
|                                                                   gdouble            *axis_value); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_BACKEND_X11_H__ */ | ||||
|   | ||||
| @@ -1,73 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 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> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_DEVICE_MANAGER_XI2_H__ | ||||
| #define __CLUTTER_DEVICE_MANAGER_XI2_H__ | ||||
|  | ||||
| #include <clutter/clutter-device-manager.h> | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| #include <libwacom/libwacom.h> | ||||
| #endif | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_DEVICE_MANAGER_XI2            (_clutter_device_manager_xi2_get_type ()) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_XI2(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2)) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class)) | ||||
| #define CLUTTER_IS_DEVICE_MANAGER_XI2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_XI2)) | ||||
| #define CLUTTER_DEVICE_MANAGER_XI2_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_XI2, ClutterDeviceManagerXI2Class)) | ||||
|  | ||||
| typedef struct _ClutterDeviceManagerXI2         ClutterDeviceManagerXI2; | ||||
| typedef struct _ClutterDeviceManagerXI2Class    ClutterDeviceManagerXI2Class; | ||||
|  | ||||
| struct _ClutterDeviceManagerXI2 | ||||
| { | ||||
|   ClutterDeviceManager parent_instance; | ||||
|  | ||||
|   GHashTable *devices_by_id; | ||||
|   GHashTable *tools_by_serial; | ||||
|  | ||||
|   GSList *all_devices; | ||||
|  | ||||
|   GList *master_devices; | ||||
|   GList *slave_devices; | ||||
|  | ||||
|   int opcode; | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   WacomDeviceDatabase *wacom_db; | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| struct _ClutterDeviceManagerXI2Class | ||||
| { | ||||
|   ClutterDeviceManagerClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType _clutter_device_manager_xi2_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_DEVICE_MANAGER_XI2_H__ */ | ||||
| @@ -1,384 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * 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/>. | ||||
|  * | ||||
|  * | ||||
|  * | ||||
|  * Authored by: | ||||
|  *      Matthew Allum <mallum@openedhand.com> | ||||
|  *      Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "clutter-x11.h" | ||||
|  | ||||
| #include "clutter-backend-private.h" | ||||
| #include "clutter-debug.h" | ||||
| #include "clutter-event-private.h" | ||||
| #include "clutter-main.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
| #include <glib.h> | ||||
|  | ||||
| #if 0 | ||||
| /* XEMBED protocol support for toolkit embedding */ | ||||
| #define XEMBED_MAPPED                   (1 << 0) | ||||
| #define MAX_SUPPORTED_XEMBED_VERSION    1 | ||||
|  | ||||
| #define XEMBED_EMBEDDED_NOTIFY          0 | ||||
| #define XEMBED_WINDOW_ACTIVATE          1 | ||||
| #define XEMBED_WINDOW_DEACTIVATE        2 | ||||
| #define XEMBED_REQUEST_FOCUS            3 | ||||
| #define XEMBED_FOCUS_IN                 4 | ||||
| #define XEMBED_FOCUS_OUT                5 | ||||
| #define XEMBED_FOCUS_NEXT               6 | ||||
| #define XEMBED_FOCUS_PREV               7 | ||||
| /* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */ | ||||
| #define XEMBED_MODALITY_ON              10 | ||||
| #define XEMBED_MODALITY_OFF             11 | ||||
| #define XEMBED_REGISTER_ACCELERATOR     12 | ||||
| #define XEMBED_UNREGISTER_ACCELERATOR   13 | ||||
| #define XEMBED_ACTIVATE_ACCELERATOR     14 | ||||
|  | ||||
| static Window ParentEmbedderWin = None; | ||||
| #endif | ||||
|  | ||||
| typedef struct _ClutterEventSource      ClutterEventSource; | ||||
|  | ||||
| struct _ClutterEventSource | ||||
| { | ||||
|   GSource source; | ||||
|  | ||||
|   ClutterBackendX11 *backend; | ||||
|  | ||||
|   GPollFD event_poll_fd; | ||||
| }; | ||||
|  | ||||
| ClutterEventX11 * | ||||
| _clutter_event_x11_new (void) | ||||
| { | ||||
|   return g_slice_new0 (ClutterEventX11); | ||||
| } | ||||
|  | ||||
| ClutterEventX11 * | ||||
| _clutter_event_x11_copy (ClutterEventX11 *event_x11) | ||||
| { | ||||
|   if (event_x11 != NULL) | ||||
|     return g_slice_dup (ClutterEventX11, event_x11); | ||||
|  | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_event_x11_free (ClutterEventX11 *event_x11) | ||||
| { | ||||
|   if (event_x11 != NULL) | ||||
|     g_slice_free (ClutterEventX11, event_x11); | ||||
| } | ||||
|  | ||||
| static gboolean clutter_event_prepare  (GSource     *source, | ||||
|                                         gint        *timeout); | ||||
| static gboolean clutter_event_check    (GSource     *source); | ||||
| static gboolean clutter_event_dispatch (GSource     *source, | ||||
|                                         GSourceFunc  callback, | ||||
|                                         gpointer     user_data); | ||||
|  | ||||
| static GSourceFuncs event_funcs = { | ||||
|   clutter_event_prepare, | ||||
|   clutter_event_check, | ||||
|   clutter_event_dispatch, | ||||
|   NULL | ||||
| }; | ||||
|  | ||||
| GSource * | ||||
| _clutter_x11_event_source_new (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   ClutterEventSource *event_source; | ||||
|   int connection_number; | ||||
|   GSource *source; | ||||
|   gchar *name; | ||||
|  | ||||
|   connection_number = ConnectionNumber (backend_x11->xdpy); | ||||
|   CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number); | ||||
|  | ||||
|   source = g_source_new (&event_funcs, sizeof (ClutterEventSource)); | ||||
|   event_source = (ClutterEventSource *) source; | ||||
|  | ||||
|   name = g_strdup_printf ("Clutter X11 Event (connection: %d)", | ||||
|                           connection_number); | ||||
|   g_source_set_name (source, name); | ||||
|   g_free (name); | ||||
|  | ||||
|   event_source->backend = backend_x11; | ||||
|   event_source->event_poll_fd.fd = connection_number; | ||||
|   event_source->event_poll_fd.events = G_IO_IN; | ||||
|  | ||||
|   g_source_add_poll (source, &event_source->event_poll_fd); | ||||
|   g_source_set_can_recurse (source, TRUE); | ||||
|  | ||||
|   return source; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_handle_event: | ||||
|  * @xevent: pointer to XEvent structure | ||||
|  * | ||||
|  * This function processes a single X event; it can be used to hook | ||||
|  * into external X11 event processing (for example, a GDK filter | ||||
|  * function). | ||||
|  * | ||||
|  * If clutter_x11_disable_event_retrieval() has been called, you must | ||||
|  * let this function process events to update Clutter's internal state. | ||||
|  * | ||||
|  * Return value: #ClutterX11FilterReturn. %CLUTTER_X11_FILTER_REMOVE | ||||
|  *  indicates that Clutter has internally handled the event and the | ||||
|  *  caller should do no further processing. %CLUTTER_X11_FILTER_CONTINUE | ||||
|  *  indicates that Clutter is either not interested in the event, | ||||
|  *  or has used the event to update internal state without taking | ||||
|  *  any exclusive action. %CLUTTER_X11_FILTER_TRANSLATE will not | ||||
|  *  occur. | ||||
|  * | ||||
|  * Since: 0.8 | ||||
|  */ | ||||
| ClutterX11FilterReturn | ||||
| clutter_x11_handle_event (XEvent *xevent) | ||||
| { | ||||
|   ClutterX11FilterReturn result; | ||||
|   ClutterBackend *backend; | ||||
|   ClutterEvent *event; | ||||
|   gint spin = 1; | ||||
|   ClutterBackendX11 *backend_x11; | ||||
|   Display *xdisplay; | ||||
|   gboolean allocated_event; | ||||
|  | ||||
|   /* The return values here are someone approximate; we return | ||||
|    * CLUTTER_X11_FILTER_REMOVE if a clutter event is | ||||
|    * generated for the event. This mostly, but not entirely, | ||||
|    * corresponds to whether other event processing should be | ||||
|    * excluded. As long as the stage window is not shared with another | ||||
|    * toolkit it should be safe, and never return | ||||
|    * %CLUTTER_X11_FILTER_REMOVE when more processing is needed. | ||||
|    */ | ||||
|  | ||||
|   result = CLUTTER_X11_FILTER_CONTINUE; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   backend = clutter_get_default_backend (); | ||||
|  | ||||
|   event = clutter_event_new (CLUTTER_NOTHING); | ||||
|  | ||||
|   backend_x11 = CLUTTER_BACKEND_X11 (backend); | ||||
|   xdisplay = backend_x11->xdpy; | ||||
|  | ||||
|   allocated_event = XGetEventData (xdisplay, &xevent->xcookie); | ||||
|  | ||||
|   if (_clutter_backend_translate_event (backend, xevent, event)) | ||||
|     { | ||||
|       _clutter_event_push (event, FALSE); | ||||
|  | ||||
|       result = CLUTTER_X11_FILTER_REMOVE; | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       clutter_event_free (event); | ||||
|       goto out; | ||||
|     } | ||||
|  | ||||
|   /* | ||||
|    * Motion events can generate synthetic enter and leave events, so if we | ||||
|    * are processing a motion event, we need to spin the event loop at least | ||||
|    * two extra times to pump the enter/leave events through (otherwise they | ||||
|    * just get pushed down the queue and never processed). | ||||
|    */ | ||||
|   if (event->type == CLUTTER_MOTION) | ||||
|     spin += 2; | ||||
|  | ||||
|   while (spin > 0 && (event = clutter_event_get ())) | ||||
|     { | ||||
|       /* forward the event into clutter for emission etc. */ | ||||
|       _clutter_stage_queue_event (event->any.stage, event, FALSE); | ||||
|       --spin; | ||||
|     } | ||||
|  | ||||
| out: | ||||
|   if (allocated_event) | ||||
|     XFreeEventData (xdisplay, &xevent->xcookie); | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_prepare (GSource *source, | ||||
|                        gint    *timeout) | ||||
| { | ||||
|   ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; | ||||
|   gboolean retval; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   *timeout = -1; | ||||
|   retval = (clutter_events_pending () || XPending (backend->xdpy)); | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_check (GSource *source) | ||||
| { | ||||
|   ClutterEventSource *event_source = (ClutterEventSource *) source; | ||||
|   ClutterBackendX11 *backend = event_source->backend; | ||||
|   gboolean retval; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   if (event_source->event_poll_fd.revents & G_IO_IN) | ||||
|     retval = (clutter_events_pending () || XPending (backend->xdpy)); | ||||
|   else | ||||
|     retval = FALSE; | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
| static void | ||||
| events_queue (ClutterBackendX11 *backend_x11) | ||||
| { | ||||
|   ClutterBackend *backend = CLUTTER_BACKEND (backend_x11); | ||||
|   Display *xdisplay = backend_x11->xdpy; | ||||
|   ClutterEvent *event; | ||||
|   XEvent xevent; | ||||
|  | ||||
|   while (!clutter_events_pending () && XPending (xdisplay)) | ||||
|     { | ||||
|       XNextEvent (xdisplay, &xevent); | ||||
|  | ||||
|       event = clutter_event_new (CLUTTER_NOTHING); | ||||
|  | ||||
|       XGetEventData (xdisplay, &xevent.xcookie); | ||||
|  | ||||
|       if (_clutter_backend_translate_event (backend, &xevent, event)) | ||||
|         _clutter_event_push (event, FALSE); | ||||
|       else | ||||
|         clutter_event_free (event); | ||||
|  | ||||
|       XFreeEventData (xdisplay, &xevent.xcookie); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_event_dispatch (GSource     *source, | ||||
|                         GSourceFunc  callback, | ||||
|                         gpointer     user_data) | ||||
| { | ||||
|   ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; | ||||
|   ClutterEvent *event; | ||||
|  | ||||
|   _clutter_threads_acquire_lock (); | ||||
|  | ||||
|   /*  Grab the event(s), translate and figure out double click. | ||||
|    *  The push onto queue (stack) if valid. | ||||
|   */ | ||||
|   events_queue (backend); | ||||
|  | ||||
|   /* Pop an event off the queue if any */ | ||||
|   event = clutter_event_get (); | ||||
|   if (event != NULL) | ||||
|     { | ||||
|       /* forward the event into clutter for emission etc. */ | ||||
|       _clutter_stage_queue_event (event->any.stage, event, FALSE); | ||||
|     } | ||||
|  | ||||
|   _clutter_threads_release_lock (); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_get_current_event_time: (skip) | ||||
|  * | ||||
|  * Retrieves the timestamp of the last X11 event processed by | ||||
|  * Clutter. This might be different from the timestamp returned | ||||
|  * by clutter_get_current_event_time(), as Clutter may synthesize | ||||
|  * or throttle events. | ||||
|  * | ||||
|  * Return value: a timestamp, in milliseconds | ||||
|  * | ||||
|  * Since: 1.0 | ||||
|  */ | ||||
| Time | ||||
| clutter_x11_get_current_event_time (void) | ||||
| { | ||||
|   ClutterBackend *backend = clutter_get_default_backend (); | ||||
|  | ||||
|   return CLUTTER_BACKEND_X11 (backend)->last_event_time; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_event_get_key_group: | ||||
|  * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or %CLUTTER_KEY_RELEASE | ||||
|  * | ||||
|  * Retrieves the group for the modifiers set in @event | ||||
|  * | ||||
|  * Return value: the group id | ||||
|  * | ||||
|  * Since: 1.4 | ||||
|  */ | ||||
| gint | ||||
| clutter_x11_event_get_key_group (const ClutterEvent *event) | ||||
| { | ||||
|   ClutterEventX11 *event_x11; | ||||
|  | ||||
|   g_return_val_if_fail (event != NULL, 0); | ||||
|   g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS || | ||||
|                         event->type == CLUTTER_KEY_RELEASE, 0); | ||||
|  | ||||
|   event_x11 = _clutter_event_get_platform_data (event); | ||||
|   if (event_x11 == NULL) | ||||
|     return 0; | ||||
|  | ||||
|   return event_x11->key_group; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * clutter_x11_event_sequence_get_touch_detail: | ||||
|  * @sequence: a #ClutterEventSequence | ||||
|  * | ||||
|  * Retrieves the touch detail froma #ClutterEventSequence. | ||||
|  * | ||||
|  * Return value: the touch detail | ||||
|  * | ||||
|  * Since: 1.12 | ||||
|  */ | ||||
| guint | ||||
| clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence) | ||||
| { | ||||
|   g_return_val_if_fail (sequence != NULL, 0); | ||||
|  | ||||
|   return GPOINTER_TO_UINT (sequence); | ||||
| } | ||||
| @@ -1,74 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 2016 Red Hat | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * Author: Carlos Garnacho <carlosg@gnome.org> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ | ||||
|  | ||||
| #include <clutter/clutter-input-device-tool.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2 (clutter_input_device_tool_xi2_get_type ()) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_CAST ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2(o) \ | ||||
|   (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_CAST ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class)) | ||||
|  | ||||
| #define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2_CLASS(c) \ | ||||
|   (G_TYPE_CHECK_CLASS_TYPE ((c), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2)) | ||||
|  | ||||
| #define CLUTTER_INPUT_DEVICE_TOOL_XI2_GET_CLASS(o) \ | ||||
|   (G_TYPE_INSTANCE_GET_CLASS ((o), \ | ||||
|   CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceToolXI2 ClutterInputDeviceToolXI2; | ||||
| typedef struct _ClutterInputDeviceToolXI2Class ClutterInputDeviceToolXI2Class; | ||||
|  | ||||
| struct _ClutterInputDeviceToolXI2 | ||||
| { | ||||
|   ClutterInputDeviceTool parent_instance; | ||||
|   struct libinput_tablet_tool *tool; | ||||
| }; | ||||
|  | ||||
| struct _ClutterInputDeviceToolXI2Class | ||||
| { | ||||
|   ClutterInputDeviceToolClass parent_class; | ||||
| }; | ||||
|  | ||||
| GType                    clutter_input_device_tool_xi2_get_type  (void) G_GNUC_CONST; | ||||
|  | ||||
| ClutterInputDeviceTool * clutter_input_device_tool_xi2_new       (guint                        serial, | ||||
|                                                                   ClutterInputDeviceToolType   type); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ */ | ||||
| @@ -1,357 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 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> | ||||
|  */ | ||||
|  | ||||
| #include "clutter-build-config.h" | ||||
|  | ||||
| #include "clutter-input-device-xi2.h" | ||||
|  | ||||
| #include "clutter-debug.h" | ||||
| #include "clutter-device-manager-private.h" | ||||
| #include "clutter-event-private.h" | ||||
| #include "clutter-private.h" | ||||
| #include "clutter-stage-private.h" | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "clutter-stage-x11.h" | ||||
|  | ||||
| #include <X11/extensions/XInput2.h> | ||||
|  | ||||
| typedef struct _ClutterInputDeviceClass         ClutterInputDeviceXI2Class; | ||||
|  | ||||
| /* a specific XI2 input device */ | ||||
| struct _ClutterInputDeviceXI2 | ||||
| { | ||||
|   ClutterInputDevice device; | ||||
|  | ||||
|   gint device_id; | ||||
|   ClutterInputDeviceTool *current_tool; | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   WacomDevice *wacom_device; | ||||
|   GArray *group_modes; | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| #define N_BUTTONS       5 | ||||
|  | ||||
| #define clutter_input_device_xi2_get_type       _clutter_input_device_xi2_get_type | ||||
|  | ||||
| G_DEFINE_TYPE (ClutterInputDeviceXI2, | ||||
|                clutter_input_device_xi2, | ||||
|                CLUTTER_TYPE_INPUT_DEVICE); | ||||
|  | ||||
| static void | ||||
| clutter_input_device_xi2_constructed (GObject *gobject) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (gobject); | ||||
|  | ||||
|   g_object_get (gobject, "id", &device_xi2->device_id, NULL); | ||||
|  | ||||
|   if (G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->constructed) | ||||
|     G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->constructed (gobject); | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   if (clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (gobject)) == CLUTTER_PAD_DEVICE) | ||||
|     { | ||||
|       device_xi2->group_modes = g_array_new (FALSE, TRUE, sizeof (guint)); | ||||
|       g_array_set_size (device_xi2->group_modes, | ||||
|                         clutter_input_device_get_n_mode_groups (CLUTTER_INPUT_DEVICE (gobject))); | ||||
|     } | ||||
| #endif | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_input_device_xi2_keycode_to_evdev (ClutterInputDevice *device, | ||||
|                                            guint hardware_keycode, | ||||
|                                            guint *evdev_keycode) | ||||
| { | ||||
|   /* When using evdev under X11 the hardware keycodes are the evdev | ||||
|      keycodes plus 8. I haven't been able to find any documentation to | ||||
|      know what the +8 is for. FIXME: This should probably verify that | ||||
|      X server is using evdev. */ | ||||
|   *evdev_keycode = hardware_keycode - 8; | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
| static gboolean | ||||
| clutter_input_device_xi2_is_grouped (ClutterInputDevice *device, | ||||
|                                      ClutterInputDevice *other_device) | ||||
| { | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_input_device_xi2_finalize (GObject *object) | ||||
| { | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (object); | ||||
|  | ||||
|   if (device_xi2->wacom_device) | ||||
|     libwacom_destroy (device_xi2->wacom_device); | ||||
|  | ||||
|   if (device_xi2->group_modes) | ||||
|     g_array_unref (device_xi2->group_modes); | ||||
| #endif | ||||
|  | ||||
|   G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->finalize (object); | ||||
| } | ||||
|  | ||||
| static gint | ||||
| clutter_input_device_xi2_get_group_n_modes (ClutterInputDevice *device, | ||||
|                                             gint                group) | ||||
| { | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|  | ||||
|   if (device_xi2->wacom_device) | ||||
|     { | ||||
|       if (group == 0) | ||||
|         { | ||||
|           if (libwacom_has_ring (device_xi2->wacom_device)) | ||||
|             return libwacom_get_ring_num_modes (device_xi2->wacom_device); | ||||
|           else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 1) | ||||
|             return libwacom_get_strips_num_modes (device_xi2->wacom_device); | ||||
|         } | ||||
|       else if (group == 1) | ||||
|         { | ||||
|           if (libwacom_has_ring2 (device_xi2->wacom_device)) | ||||
|             return libwacom_get_ring2_num_modes (device_xi2->wacom_device); | ||||
|           else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 2) | ||||
|             return libwacom_get_strips_num_modes (device_xi2->wacom_device); | ||||
|         } | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| static int | ||||
| clutter_input_device_xi2_get_button_group (ClutterInputDevice *device, | ||||
|                                            guint               button) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|  | ||||
|   if (device_xi2->wacom_device) | ||||
|     { | ||||
|       if (button >= libwacom_get_num_buttons (device_xi2->wacom_device)) | ||||
|         return -1; | ||||
|  | ||||
|       return libwacom_get_button_led_group (device_xi2->wacom_device, | ||||
|                                             'A' + button); | ||||
|     } | ||||
|   else | ||||
|     return -1; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| static gboolean | ||||
| clutter_input_device_xi2_is_mode_switch_button (ClutterInputDevice *device, | ||||
|                                                 guint               group, | ||||
|                                                 guint               button) | ||||
| { | ||||
|   int button_group = -1; | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
|   button_group = clutter_input_device_xi2_get_button_group (device, button); | ||||
| #endif | ||||
|  | ||||
|   return button_group == (int) group; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_input_device_xi2_class_init (ClutterInputDeviceXI2Class *klass) | ||||
| { | ||||
|   GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | ||||
|   ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass); | ||||
|  | ||||
|   gobject_class->constructed = clutter_input_device_xi2_constructed; | ||||
|   gobject_class->finalize = clutter_input_device_xi2_finalize; | ||||
|  | ||||
|   device_class->keycode_to_evdev = clutter_input_device_xi2_keycode_to_evdev; | ||||
|   device_class->is_grouped = clutter_input_device_xi2_is_grouped; | ||||
|   device_class->get_group_n_modes = clutter_input_device_xi2_get_group_n_modes; | ||||
|   device_class->is_mode_switch_button = clutter_input_device_xi2_is_mode_switch_button; | ||||
| } | ||||
|  | ||||
| static void | ||||
| clutter_input_device_xi2_init (ClutterInputDeviceXI2 *self) | ||||
| { | ||||
| } | ||||
|  | ||||
| static ClutterModifierType | ||||
| get_modifier_for_button (int i) | ||||
| { | ||||
|   switch (i) | ||||
|     { | ||||
|     case 1: | ||||
|       return CLUTTER_BUTTON1_MASK; | ||||
|     case 2: | ||||
|       return CLUTTER_BUTTON2_MASK; | ||||
|     case 3: | ||||
|       return CLUTTER_BUTTON3_MASK; | ||||
|     case 4: | ||||
|       return CLUTTER_BUTTON4_MASK; | ||||
|     case 5: | ||||
|       return CLUTTER_BUTTON5_MASK; | ||||
|     default: | ||||
|       return 0; | ||||
|     } | ||||
| } | ||||
|  | ||||
| void | ||||
| _clutter_input_device_xi2_translate_state (ClutterEvent    *event, | ||||
| 					   XIModifierState *modifiers_state, | ||||
|                                            XIButtonState   *buttons_state, | ||||
|                                            XIGroupState    *group_state) | ||||
| { | ||||
|   guint button = 0; | ||||
|   guint base = 0; | ||||
|   guint latched = 0; | ||||
|   guint locked = 0; | ||||
|   guint effective; | ||||
|  | ||||
|   if (modifiers_state) | ||||
|     { | ||||
|       base = (guint) modifiers_state->base; | ||||
|       latched = (guint) modifiers_state->latched; | ||||
|       locked = (guint) modifiers_state->locked; | ||||
|     } | ||||
|  | ||||
|   if (buttons_state) | ||||
|     { | ||||
|       int len, i; | ||||
|  | ||||
|       len = MIN (N_BUTTONS, buttons_state->mask_len * 8); | ||||
|  | ||||
|       for (i = 0; i < len; i++) | ||||
|         { | ||||
|           if (!XIMaskIsSet (buttons_state->mask, i)) | ||||
|             continue; | ||||
|  | ||||
|           button |= get_modifier_for_button (i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   /* The XIButtonState sent in the event specifies the | ||||
|    * state of the buttons before the event. In order to | ||||
|    * get the current state of the buttons, we need to | ||||
|    * filter out the current button. | ||||
|    */ | ||||
|   switch (event->type) | ||||
|     { | ||||
|     case CLUTTER_BUTTON_PRESS: | ||||
|       button |=  (get_modifier_for_button (event->button.button)); | ||||
|       break; | ||||
|     case CLUTTER_BUTTON_RELEASE: | ||||
|       button &= ~(get_modifier_for_button (event->button.button)); | ||||
|       break; | ||||
|     default: | ||||
|       break; | ||||
|     } | ||||
|  | ||||
|   effective = button | base | latched | locked; | ||||
|   if (group_state) | ||||
|     effective |= (group_state->effective) << 13; | ||||
|  | ||||
|   _clutter_event_set_state_full (event, button, base, latched, locked, effective); | ||||
| } | ||||
|  | ||||
| void | ||||
| clutter_input_device_xi2_update_tool (ClutterInputDevice     *device, | ||||
|                                       ClutterInputDeviceTool *tool) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|   g_set_object (&device_xi2->current_tool, tool); | ||||
| } | ||||
|  | ||||
| ClutterInputDeviceTool * | ||||
| clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|   return device_xi2->current_tool; | ||||
| } | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| void | ||||
| clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice  *device, | ||||
|                                             WacomDeviceDatabase *wacom_db) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|   const gchar *node_path; | ||||
|  | ||||
|   node_path = clutter_input_device_get_device_node (device); | ||||
|   device_xi2->wacom_device = libwacom_new_from_path (wacom_db, node_path, | ||||
|                                                      WFALLBACK_NONE, NULL); | ||||
| } | ||||
|  | ||||
| guint | ||||
| clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device, | ||||
|                                              guint               group) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|  | ||||
|   if (group >= device_xi2->group_modes->len) | ||||
|     return 0; | ||||
|  | ||||
|   return g_array_index (device_xi2->group_modes, guint, group); | ||||
| } | ||||
|  | ||||
| void | ||||
| clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device, | ||||
|                                            guint               button, | ||||
|                                            guint               state, | ||||
|                                            guint              *group, | ||||
|                                            guint              *mode) | ||||
| { | ||||
|   ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device); | ||||
|   guint button_group, *group_mode; | ||||
|   gboolean is_mode_switch = FALSE; | ||||
|  | ||||
|   button_group = clutter_input_device_xi2_get_button_group (device, button); | ||||
|   is_mode_switch = button_group >= 0; | ||||
|  | ||||
|   /* Assign all non-mode-switch buttons to group 0 so far */ | ||||
|   button_group = MAX (0, button_group); | ||||
|  | ||||
|   if (button_group >= device_xi2->group_modes->len) | ||||
|     return; | ||||
|  | ||||
|   group_mode = &g_array_index (device_xi2->group_modes, guint, button_group); | ||||
|  | ||||
|   if (is_mode_switch && state) | ||||
|     { | ||||
|       guint next, n_modes; | ||||
|  | ||||
|       n_modes = clutter_input_device_get_group_n_modes (device, button_group); | ||||
|       next = (*group_mode + 1) % n_modes; | ||||
|       *group_mode = next; | ||||
|     } | ||||
|  | ||||
|   if (group) | ||||
|     *group = button_group; | ||||
|   if (mode) | ||||
|     *mode = *group_mode; | ||||
| } | ||||
| #endif | ||||
| @@ -1,69 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * Copyright © 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> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_INPUT_DEVICE_XI2_H__ | ||||
| #define __CLUTTER_INPUT_DEVICE_XI2_H__ | ||||
|  | ||||
| #include <clutter/clutter-input-device.h> | ||||
| #include <X11/extensions/XInput2.h> | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| #include <libwacom/libwacom.h> | ||||
| #endif | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_INPUT_DEVICE_XI2           (_clutter_input_device_xi2_get_type ()) | ||||
| #define CLUTTER_INPUT_DEVICE_XI2(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2, ClutterInputDeviceXI2)) | ||||
| #define CLUTTER_IS_INPUT_DEVICE_XI2(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_XI2)) | ||||
|  | ||||
| typedef struct _ClutterInputDeviceXI2           ClutterInputDeviceXI2; | ||||
|  | ||||
| GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_input_device_xi2_translate_state (ClutterEvent    *event, | ||||
| 						 XIModifierState *modifiers_state, | ||||
| 						 XIButtonState   *buttons_state, | ||||
| 						 XIGroupState    *group_state); | ||||
| void  clutter_input_device_xi2_update_tool      (ClutterInputDevice     *device, | ||||
|                                                  ClutterInputDeviceTool *tool); | ||||
| ClutterInputDeviceTool * clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device); | ||||
|  | ||||
| #ifdef HAVE_LIBWACOM | ||||
| void clutter_input_device_xi2_ensure_wacom_info (ClutterInputDevice  *device, | ||||
|                                                  WacomDeviceDatabase *wacom_db); | ||||
|  | ||||
| guint clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device, | ||||
|                                                    guint               group); | ||||
|  | ||||
| void clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device, | ||||
|                                                 guint               button, | ||||
|                                                 guint               state, | ||||
|                                                 guint              *group, | ||||
|                                                 guint              *mode); | ||||
|  | ||||
| #endif | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_INPUT_DEVICE_XI2_H__ */ | ||||
| @@ -1,68 +0,0 @@ | ||||
| /* | ||||
|  * Clutter. | ||||
|  * | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * | ||||
|  * 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/>. | ||||
|  * | ||||
|  * Author: Emmanuele Bassi <ebassi@linux.intel.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_KEYMAP_X11_H__ | ||||
| #define __CLUTTER_KEYMAP_X11_H__ | ||||
|  | ||||
| #include <glib-object.h> | ||||
| #include <pango/pango.h> | ||||
| #include <clutter/clutter-event.h> | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_KEYMAP_X11         (_clutter_keymap_x11_get_type ()) | ||||
| #define CLUTTER_KEYMAP_X11(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_KEYMAP_X11, ClutterKeymapX11)) | ||||
| #define CLUTTER_IS_KEYMAP_X11(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_KEYMAP_X11)) | ||||
|  | ||||
| typedef struct _ClutterKeymapX11        ClutterKeymapX11; | ||||
|  | ||||
| GType _clutter_keymap_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| gint     _clutter_keymap_x11_get_key_group       (ClutterKeymapX11    *keymap, | ||||
|                                                   ClutterModifierType  state); | ||||
| gboolean _clutter_keymap_x11_get_num_lock_state  (ClutterKeymapX11    *keymap); | ||||
| gboolean _clutter_keymap_x11_get_caps_lock_state (ClutterKeymapX11    *keymap); | ||||
| gint     _clutter_keymap_x11_translate_key_state (ClutterKeymapX11    *keymap, | ||||
|                                                   guint                hardware_keycode, | ||||
|                                                   ClutterModifierType *modifier_state_p, | ||||
|                                                   ClutterModifierType *mods_p); | ||||
| gboolean _clutter_keymap_x11_get_is_modifier     (ClutterKeymapX11    *keymap, | ||||
|                                                   gint                 keycode); | ||||
|  | ||||
| PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11    *keymap); | ||||
|  | ||||
| gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||||
|                                                 guint             keyval, | ||||
|                                                 guint            *keycode_out, | ||||
|                                                 guint            *level_out); | ||||
| void     clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||||
|                                              uint32_t          level, | ||||
|                                              gboolean          enable); | ||||
| gboolean clutter_keymap_x11_reserve_keycode (ClutterKeymapX11 *keymap_x11, | ||||
|                                              guint             keyval, | ||||
|                                              guint            *keycode_out); | ||||
| void     clutter_keymap_x11_release_keycode_if_needed (ClutterKeymapX11 *keymap_x11, | ||||
|                                                        guint             keycode); | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_KEYMAP_X11_H__ */ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,98 +0,0 @@ | ||||
| /* Clutter. | ||||
|  * An OpenGL based 'interactive canvas' library. | ||||
|  * Authored By Matthew Allum  <mallum@openedhand.com> | ||||
|  * Copyright (C) 2006-2007 OpenedHand | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #ifndef __CLUTTER_STAGE_X11_H__ | ||||
| #define __CLUTTER_STAGE_X11_H__ | ||||
|  | ||||
| #include <clutter/clutter-group.h> | ||||
| #include <clutter/clutter-stage.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/Xatom.h> | ||||
|  | ||||
| #include "clutter-backend-x11.h" | ||||
| #include "cogl/clutter-stage-cogl.h" | ||||
|  | ||||
| G_BEGIN_DECLS | ||||
|  | ||||
| #define CLUTTER_TYPE_STAGE_X11                  (_clutter_stage_x11_get_type ()) | ||||
| #define CLUTTER_STAGE_X11(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11)) | ||||
| #define CLUTTER_IS_STAGE_X11(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_X11)) | ||||
| #define CLUTTER_STAGE_X11_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class)) | ||||
| #define CLUTTER_IS_STAGE_X11_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_X11)) | ||||
| #define CLUTTER_STAGE_X11_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_X11, ClutterStageX11Class)) | ||||
|  | ||||
| typedef struct _ClutterStageX11         ClutterStageX11; | ||||
| typedef struct _ClutterStageX11Class    ClutterStageX11Class; | ||||
|  | ||||
| G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStageX11, g_object_unref) | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|   STAGE_X11_WITHDRAWN = 1 << 1 | ||||
| } ClutterStageX11State; | ||||
|  | ||||
| struct _ClutterStageX11 | ||||
| { | ||||
|   ClutterStageCogl parent_instance; | ||||
|  | ||||
|   CoglOnscreen *onscreen; | ||||
|   Window xwin; | ||||
|   gint xwin_width; | ||||
|   gint xwin_height; /* FIXME target_width / height */ | ||||
|  | ||||
|   ClutterStageView *legacy_view; | ||||
|   GList *legacy_views; | ||||
|  | ||||
|   CoglFrameClosure *frame_closure; | ||||
|  | ||||
|   gchar *title; | ||||
|  | ||||
|   guint clipped_redraws_cool_off; | ||||
|  | ||||
|   ClutterStageX11State wm_state; | ||||
|  | ||||
|   guint is_foreign_xwin       : 1; | ||||
|   guint fullscreening         : 1; | ||||
|   guint is_cursor_visible     : 1; | ||||
|   guint viewport_initialized  : 1; | ||||
|   guint accept_focus          : 1; | ||||
|   guint fullscreen_on_realize : 1; | ||||
| }; | ||||
|  | ||||
| struct _ClutterStageX11Class | ||||
| { | ||||
|   ClutterStageCoglClass parent_class; | ||||
| }; | ||||
|  | ||||
| CLUTTER_EXPORT | ||||
| GType _clutter_stage_x11_get_type (void) G_GNUC_CONST; | ||||
|  | ||||
| void  _clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11, | ||||
|                                                 ClutterInputDevice *device, | ||||
|                                                 ClutterDeviceManager *device_manager); | ||||
|  | ||||
| /* Private to subclasses */ | ||||
| void            _clutter_stage_x11_set_user_time                (ClutterStageX11 *stage_x11, | ||||
|                                                                  guint32          user_time); | ||||
|  | ||||
| G_END_DECLS | ||||
|  | ||||
| #endif /* __CLUTTER_STAGE_H__ */ | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user