Compare commits
826 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a14144658 | |||
| 0ff6176525 | |||
| c30befed1e | |||
| 9d38806ced | |||
| 3cdde3fc4b | |||
| 05b9a99661 | |||
| a16e1cbf18 | |||
| c7ea83cd82 | |||
| 352c9ba42a | |||
| 30b37dd7c5 | |||
| 2e256986c3 | |||
| 77e0d360ed | |||
| 942a93250a | |||
| 7ccd6597c3 | |||
| 355a417dba | |||
| 36e3f4d902 | |||
| 69fe705d0d | |||
| f62535affc | |||
| 1a56a10fc1 | |||
| 4287f0def4 | |||
| 7bebc3e2b2 | |||
| b4e2df8fca | |||
| 0df0de0b5d | |||
| 53c22bf833 | |||
| d8144ec497 | |||
| 3d9e3390f1 | |||
| 03595f9567 | |||
| 64e026d0a9 | |||
| 0623b00512 | |||
| ac902e697e | |||
| f1ff69963e | |||
| 731ae8f39e | |||
| 7da6fdc30e | |||
| a297129685 | |||
| 1eec7362b9 | |||
| a105256611 | |||
| 2ee04ee8ed | |||
| 6e358e2a49 | |||
| 71ee4df357 | |||
| 2bc6e1b875 | |||
| 4e58541d52 | |||
| 53bc1d60c4 | |||
| 5b6b4f5075 | |||
| 16654eeef4 | |||
| 871959c88c | |||
| 55d08d8400 | |||
| 5dcce0c0bd | |||
| 975fe76a0e | |||
| 00be314feb | |||
| da5d524324 | |||
| 8e41fa2778 | |||
| f80a341b4f | |||
| 77f8245c0c | |||
| 8afdbd6ee3 | |||
| ac4e98f16a | |||
| ab0869ecbc | |||
| cff8304133 | |||
| 962e38c5c9 | |||
| 7855a98fd1 | |||
| aea27b86c1 | |||
| d4caf3d679 | |||
| d9652675ef | |||
| 685288216f | |||
| c8fa1f19db | |||
| 7e4feb092b | |||
| 9eadcd8d55 | |||
| 86aa011587 | |||
| f9e613f8fd | |||
| e13692c52f | |||
| cbed409f52 | |||
| 0351f27af2 | |||
| f84ecf9cd2 | |||
| 5e9d186c26 | |||
| de9f0c5505 | |||
| f5865b125e | |||
| 3483c1a45b | |||
| 5cc088128f | |||
| c4548e9c7b | |||
| 5d6aeb4bf7 | |||
| 560e03f962 | |||
| c3f1ff7db4 | |||
| 88d26b7549 | |||
| 4ac8011126 | |||
| 9b29da93b6 | |||
| 0fe9643728 | |||
| 73a214d1a9 | |||
| 59a31e05bc | |||
| 527b67af3d | |||
| 3c03d7970a | |||
| 278762f00a | |||
| 1565f597c8 | |||
| fea42def61 | |||
| 56b8d1dfbe | |||
| 3120fb29e1 | |||
| 119457279b | |||
| dfea9bf0e8 | |||
| 36cb812ad8 | |||
| 95ed9de706 | |||
| a0448e2c7f | |||
| a6b05a19f1 | |||
| 672d7f679a | |||
| feecfcab27 | |||
| 24fa0f8e28 | |||
| 878f35515d | |||
| 68fd796125 | |||
| 5014b2a7fe | |||
| 8cb375de11 | |||
| 7927bcf6c5 | |||
| d24d0e9667 | |||
| e9e4bd423a | |||
| 81ddf4b946 | |||
| c8485af819 | |||
| 704a659438 | |||
| d32b0d3118 | |||
| 23426b0f39 | |||
| 417edd28fb | |||
| ea17728ee5 | |||
| a6f300cefd | |||
| 05b98c3834 | |||
| 820c9403e3 | |||
| 509531349d | |||
| 2a5a52dd4b | |||
| f42e18507f | |||
| e6a0a2f587 | |||
| 631ea5caac | |||
| d59784f7c7 | |||
| 193eb5b0dd | |||
| 6a1adf6f1a | |||
| 563ad2db1b | |||
| c85d9a3259 | |||
| b9c81b1b94 | |||
| b52bcf7e0a | |||
| a38ba91e35 | |||
| a350c2452a | |||
| 025902b9fb | |||
| 7e2e92a87e | |||
| be4d42507c | |||
| 6e88ccf7fb | |||
| cec4c15f05 | |||
| ce1f1f7dec | |||
| 95f00c6071 | |||
| 55cfeccfd2 | |||
| 2301916fa4 | |||
| bb4efe18b7 | |||
| a463dccd81 | |||
| eff129323f | |||
| a5530caec3 | |||
| 92cfc03821 | |||
| 46bb1a9b6a | |||
| 19280db075 | |||
| 7210c5484e | |||
| 433c8307b2 | |||
| 26506b0a15 | |||
| f8fa946989 | |||
| 119ebe1d70 | |||
| dda54b2b8f | |||
| 821efcb725 | |||
| 85793fe6b6 | |||
| dc8dedce07 | |||
| f5182f1c35 | |||
| 1efa39672b | |||
| 3f38a1c94c | |||
| d861dd5df8 | |||
| 8c98fd2e46 | |||
| 3091679ffa | |||
| 2e89c5360a | |||
| e448fc41f3 | |||
| c9e972eecb | |||
| 45455f1bdb | |||
| a3769eb0e5 | |||
| 7c75ea376f | |||
| 96143548ac | |||
| 0b2a6e34c4 | |||
| 24d8c0a7dc | |||
| ba08f5e67d | |||
| 31aa5a0e53 | |||
| 7aa17afe7a | |||
| 8c678ac756 | |||
| 7d1f915a61 | |||
| afa991752c | |||
| fc2d05ee38 | |||
| 00aa4f0597 | |||
| 3401150cca | |||
| 67991ed0f4 | |||
| 741e12012d | |||
| 91aa60b210 | |||
| e31c0898e5 | |||
| 1f2f2777e1 | |||
| 9cb2fe5cac | |||
| 8d15efba8f | |||
| 1200fe2daf | |||
| 515a527b27 | |||
| 06dbde22a0 | |||
| c21280e455 | |||
| 0d9a7fe089 | |||
| 03883b8b1a | |||
| f28cd6cea9 | |||
| b8b90fefd8 | |||
| b4a9cf2bfb | |||
| 2a919a4d4f | |||
| b2775d9bdd | |||
| d0a8a717ef | |||
| 7d72703d54 | |||
| 8ecd4e87e3 | |||
| 9de31929d6 | |||
| b41bba07fa | |||
| 0f694b8beb | |||
| 7b1ab8fb8b | |||
| d9b1a1ebb1 | |||
| d4f3979896 | |||
| 2e7cb6019f | |||
| f1fce5253e | |||
| 81b65eadcb | |||
| 1e7705c08e | |||
| cc3cf581ab | |||
| 6e09c5cee8 | |||
| 69fb3648b2 | |||
| 23f84e3a3d | |||
| 1a9b1f38a4 | |||
| 00a488a5b5 | |||
| 26c4c28068 | |||
| da2e184639 | |||
| 9576222b47 | |||
| 7738a05bd2 | |||
| 93b5b487ae | |||
| 7588655a42 | |||
| 007713c0ba | |||
| f0c1c3349f | |||
| 0dba6e5759 | |||
| 60cd7cd96c | |||
| 2b504201e3 | |||
| 3fcbe8d5f3 | |||
| 105acfe908 | |||
| 1caf197a0d | |||
| 0a49726c73 | |||
| dd0cc9df9f | |||
| 789f6f3941 | |||
| 2c231f4336 | |||
| 3c50e5324f | |||
| 3182063ffe | |||
| 5910e5ac6d | |||
| b2b89f6c57 | |||
| 5ac24db049 | |||
| 192a24fa1f | |||
| 2426b9e23a | |||
| 64848aebf4 | |||
| fcceac6d11 | |||
| 975f6529b1 | |||
| 357e215fb8 | |||
| 4716c9ae2f | |||
| 5aad3d7d0e | |||
| fe36c24b07 | |||
| 682068f887 | |||
| e8eb1df29f | |||
| 82dc7b903c | |||
| b020a3fcf9 | |||
| cb88de5938 | |||
| 94b1e72aa3 | |||
| 20b92638ec | |||
| dccb83c9ec | |||
| d668d2fa25 | |||
| 34f1ae8fad | |||
| 042537cf0d | |||
| d03f38470e | |||
| a7d72cf69b | |||
| 256139baab | |||
| a935aae6f1 | |||
| 9955d686ee | |||
| a9da41c66a | |||
| 4d8691b762 | |||
| 806e159b8b | |||
| 794ee0b8c0 | |||
| 2b7de841a9 | |||
| 45309811c5 | |||
| 2b695ac8d1 | |||
| cb03969c5f | |||
| 57e71a6a69 | |||
| 15b5a404b8 | |||
| 4056a40d2d | |||
| c1e9523f0e | |||
| 4c1ccfd7be | |||
| 823e00dec9 | |||
| 3e51966ea9 | |||
| e292767a01 | |||
| 75c433fb5f | |||
| 83867f9cbf | |||
| ea9f0df67b | |||
| 15c7980ba6 | |||
| de5fde1e12 | |||
| a83b360224 | |||
| 4d55d23c1a | |||
| 2b6162116d | |||
| b2ca947934 | |||
| 3eaf88b84c | |||
| 9e9eae3ad4 | |||
| 903afcbddd | |||
| d37612a476 | |||
| f5daecf353 | |||
| b76940bab5 | |||
| ec255f9bb1 | |||
| 9dc6be4fb0 | |||
| 186b783f9d | |||
| 2f3518c80d | |||
| 4a7f68e79e | |||
| 65af983ddb | |||
| f0dc5e0be5 | |||
| f0cbd175cd | |||
| 99aa47185e | |||
| 898e29c989 | |||
| cf1700fd13 | |||
| 112aed590f | |||
| 6763443c5d | |||
| 7d99339c39 | |||
| f33fe6daed | |||
| c7dc17d837 | |||
| a51ee20ed9 | |||
| 8d3e1eb314 | |||
| c941a2d9c6 | |||
| 1c03bbeb9c | |||
| a4059cd02d | |||
| eab6df31ac | |||
| 8a085fcc5a | |||
| 7668669d56 | |||
| 5e57b3d07a | |||
| 187a701a99 | |||
| d5f4579384 | |||
| 0297039b38 | |||
| 5206a92522 | |||
| 233ec1a5d6 | |||
| 579d8e427b | |||
| 9c11c60530 | |||
| 66c8da4750 | |||
| 05a9b72fc8 | |||
| 4fe5710456 | |||
| ac5b4a6307 | |||
| 5ce7bfbbd8 | |||
| 7646d1b22c | |||
| 61db81ab8e | |||
| 24d7586163 | |||
| b150625105 | |||
| 5787146238 | |||
| 8a72031e99 | |||
| 201a791076 | |||
| 359003670a | |||
| 6b7c5174ed | |||
| 8a521accbc | |||
| d116bbf0c8 | |||
| 42e440a111 | |||
| 13adb2591c | |||
| 7b73824dfe | |||
| 403aba82a9 | |||
| a053d7ddb1 | |||
| c878f650ce | |||
| 2d2cdeae88 | |||
| 009228471c | |||
| 379166e1ff | |||
| a59a20c1d4 | |||
| fb4b5c666b | |||
| b59c70aaeb | |||
| 6fcae42dde | |||
| 2ee087f25f | |||
| 9cc29efa25 | |||
| a04d314910 | |||
| f83f7a2b4d | |||
| edb175cf75 | |||
| 1eefaf8b41 | |||
| 0224517806 | |||
| 27c521cce8 | |||
| 62b87182c5 | |||
| c95659bf32 | |||
| 865fc9c925 | |||
| a1f4f52fcb | |||
| bdb4bf00c5 | |||
| aca252837d | |||
| 8b058572f0 | |||
| df050c51bb | |||
| bd20ae4fa5 | |||
| 818b456f9f | |||
| c1c8abf275 | |||
| c1029535ca | |||
| a5ca5eb865 | |||
| 2227d2a2b5 | |||
| 61559e38f4 | |||
| 134fca47e3 | |||
| 4630dd8d68 | |||
| d2f7d1b1d7 | |||
| cfa9e6da4a | |||
| ceca2f9202 | |||
| bf98ebcb12 | |||
| 1a5dece09c | |||
| 8e8254feae | |||
| 90cda9e307 | |||
| fdfa371d90 | |||
| deb16c1a00 | |||
| 8c3736709e | |||
| f459164f8a | |||
| 00169a06bf | |||
| e09f2b8b56 | |||
| 092c115ff0 | |||
| 5144d15168 | |||
| 5a6ab8cbd3 | |||
| 8c73f882af | |||
| 78832c65b5 | |||
| e8b830a3dd | |||
| 38974d7d2b | |||
| f6f331efe3 | |||
| dbb3727b03 | |||
| 508570864d | |||
| 96c77b61c1 | |||
| 2b819c830b | |||
| f3be49838f | |||
| e9067ae2db | |||
| f898bee032 | |||
| 6a7f39e6d2 | |||
| dfb2cbdfdb | |||
| f960eb6ab4 | |||
| 60fc2c6a7a | |||
| 3080592234 | |||
| 532fdde720 | |||
| f8399588e9 | |||
| ad019be75b | |||
| e505dab487 | |||
| 1262184269 | |||
| 46f42fc53d | |||
| cb26cd7391 | |||
| 1a3eeb1233 | |||
| e1f74c8f69 | |||
| 58106af54d | |||
| 1e000c3dac | |||
| 19ee9b4c57 | |||
| 1075607528 | |||
| d2bd9b0850 | |||
| 74d445636c | |||
| 7048790931 | |||
| b9034015d7 | |||
| c7b70b122a | |||
| 6e01a49d10 | |||
| c290bd6367 | |||
| 853063bea7 | |||
| 69e3fee5e2 | |||
| aa276a181e | |||
| 583705b4ae | |||
| cd7303d47c | |||
| 0f9cbf49ac | |||
| a309e74be7 | |||
| ccaf70e1b7 | |||
| 2fd9431f23 | |||
| 3f33a0ed27 | |||
| 4ea18a22e6 | |||
| 746dc5c3a2 | |||
| 17131f1137 | |||
| 07c889c5ea | |||
| b0d9a6ff20 | |||
| 802c7975e2 | |||
| 6e602e052b | |||
| 025eee112c | |||
| 70cdd4e951 | |||
| 75b789f20f | |||
| ac09500d74 | |||
| a76b187a5b | |||
| 45679d7bc3 | |||
| 6dc8fc3a4d | |||
| e53e0f461e | |||
| 37b849b808 | |||
| e03bdbe307 | |||
| 9b01d9a784 | |||
| b4c689ecd6 | |||
| 78a0913f0f | |||
| 74722fb10e | |||
| 3891ce36fe | |||
| 5a940408fe | |||
| efce8c2899 | |||
| ea9f2abcc4 | |||
| 993d6388ee | |||
| 5ad4b75ae2 | |||
| 24ef9df0f1 | |||
| 5d49b11ffd | |||
| 8e3db48482 | |||
| fdcfe0e80a | |||
| 8137dea8c1 | |||
| b15c31a3f7 | |||
| a52757874e | |||
| e9203eeef7 | |||
| 337057eb35 | |||
| 2803a15a51 | |||
| d145032cb6 | |||
| 2612331282 | |||
| d3fd071809 | |||
| 303c9becf8 | |||
| 6bf46c8f30 | |||
| 1e2c03beee | |||
| b24e10fa30 | |||
| 173952cbc8 | |||
| b31f4f2bae | |||
| df9d9c1f8a | |||
| 7dcb25bd46 | |||
| d131c8d0e7 | |||
| 0582a4ef1b | |||
| a9b1d4a389 | |||
| ea810f176b | |||
| 262ac4247a | |||
| 8e4f0b9484 | |||
| 7669e6e42e | |||
| a3f14a3395 | |||
| 73b8212bf3 | |||
| 6ba6f361be | |||
| 726909d735 | |||
| 04899e3707 | |||
| 7a27122dab | |||
| 73ce437459 | |||
| ca4ae81170 | |||
| 21a7dfae96 | |||
| 6c188f7c93 | |||
| c30e0f78ad | |||
| 76795ffba9 | |||
| c38c5c4ce1 | |||
| 108aac9ee3 | |||
| c427c2b22a | |||
| 59111d100f | |||
| cee8f78c6e | |||
| 0fc35b2124 | |||
| eebe67cf0a | |||
| b9726901a5 | |||
| df1d2b8417 | |||
| 8b1af398a0 | |||
| 982d73df0b | |||
| 1e55e01692 | |||
| 412fcb0330 | |||
| b8d1c3ab55 | |||
| 4fb519f04d | |||
| 054d69aaf9 | |||
| 1dea6d4fc7 | |||
| 022d19a4c6 | |||
| ef7276c398 | |||
| 0a8ca49b5e | |||
| 74f18f71d3 | |||
| c0d4a6fc81 | |||
| 1dd31d58fb | |||
| 766d4dff76 | |||
| e62f135c6a | |||
| 4788f88840 | |||
| 587bc82c37 | |||
| 750dc8dbe2 | |||
| d490d8f1f3 | |||
| cb2f523994 | |||
| 075a0ccb5e | |||
| db91b6dc61 | |||
| 44ac2d5abb | |||
| d7df56b6cb | |||
| 6a9bc5daef | |||
| b8aa51d522 | |||
| f79c807645 | |||
| d0d2ad9f5b | |||
| 0b8298038a | |||
| 6ef0bb8bea | |||
| 91472b2ecd | |||
| 80ddcf38d4 | |||
| 1477882b31 | |||
| 73f2167fe4 | |||
| 2079c898e7 | |||
| c79c18f39c | |||
| cef7f7f87d | |||
| fdce30d3f8 | |||
| f07397f4dd | |||
| f1751f514c | |||
| 2cbfb0e980 | |||
| 8dd7f5aefe | |||
| 398f49ad31 | |||
| 3d260a950e | |||
| f31667f437 | |||
| 219493c818 | |||
| 06f63764fb | |||
| 1243174e53 | |||
| cc909b160f | |||
| d12dde07c3 | |||
| 5191b6fccd | |||
| 2e6e6c1779 | |||
| a29b8fbef4 | |||
| 5b072e716c | |||
| 49845795d9 | |||
| ab04c74ec9 | |||
| 4744bb9099 | |||
| 91522dda63 | |||
| 095a378dbc | |||
| 0956c30ee5 | |||
| f85448ffbf | |||
| d3852ca33a | |||
| 9d9a730659 | |||
| 3f4cd4190f | |||
| 448a402353 | |||
| 2ee9752822 | |||
| f8a1f796b5 | |||
| 3b5a4cf215 | |||
| 759d53cfa0 | |||
| 814d20d61a | |||
| 6cef520804 | |||
| 8c77491150 | |||
| 709ebcedd4 | |||
| 47e6b88555 | |||
| df58d0acf3 | |||
| 9c2c5665df | |||
| 1be9c6aa3f | |||
| 96d2bf10b9 | |||
| 7a1aefc7f3 | |||
| f7f06f810b | |||
| e02fd80adb | |||
| 4b818495ca | |||
| 1841ec4f8e | |||
| 21708e4352 | |||
| 662bcb34b1 | |||
| f8a19506ab | |||
| 67d1d5ec80 | |||
| 49c6e99970 | |||
| 15242d66e1 | |||
| 94a0bc01f9 | |||
| 677c4b140c | |||
| 838ad5ed6d | |||
| 772ac2b0c5 | |||
| 68b3b66c03 | |||
| 0d1614be63 | |||
| 62b95e33b8 | |||
| dc5c8d2d29 | |||
| 425d5cc7c6 | |||
| baf99bb868 | |||
| 538efd0cc6 | |||
| 9ba184adf7 | |||
| 710b8d7f40 | |||
| a6244a95be | |||
| 133b6f2f23 | |||
| 53a634e23e | |||
| 156935e0e9 | |||
| f31a016efb | |||
| e56eb7b17b | |||
| de694958b5 | |||
| e12a580b0b | |||
| 52e0eef6cb | |||
| 85bf4cf895 | |||
| b06331218d | |||
| 9b165c8bec | |||
| 3fd427cfce | |||
| 0bb9fc65ad | |||
| 3dd6cc405e | |||
| 06860bb2be | |||
| 7ee5779efc | |||
| 53d9445715 | |||
| 54b2727b50 | |||
| a2aefa83bb | |||
| 0854140b22 | |||
| 57a861723c | |||
| b59521bb82 | |||
| 7e8393ba0f | |||
| 9e15f3df75 | |||
| 5c97f09796 | |||
| bf4ec504b2 | |||
| 59aeae3c8e | |||
| 941f22c033 | |||
| 27543120f2 | |||
| 901518ec25 | |||
| 4c9b0d82af | |||
| 2c5f4c5871 | |||
| 8ee44d200d | |||
| 57b7e87d76 | |||
| e424246134 | |||
| ca87048045 | |||
| 5ec9b15d84 | |||
| 6b691bc02d | |||
| abcd83dd78 | |||
| 5d2113ff5d | |||
| 5c086b9d44 | |||
| 8efa612288 | |||
| 928f7faf7d | |||
| 4b4cf36b03 | |||
| 5d821425b3 | |||
| 8b3066127f | |||
| 360239a6c8 | |||
| 80e903afeb | |||
| 62e9ea412a | |||
| 3d4acf6360 | |||
| 0cf1e1e106 | |||
| b23fbe1f39 | |||
| f5e79b9bc5 | |||
| 94e238c467 | |||
| 22f6787283 | |||
| 6255dcd8ec | |||
| 6f80eee962 | |||
| fd0f01bcad | |||
| 0b6e521dc5 | |||
| ad6fe9d6a0 | |||
| 7078765903 | |||
| a73947e54f | |||
| 7525271de1 | |||
| 0bc65f0bde | |||
| 4a0476752c | |||
| 9543a5daeb | |||
| 28b91a4450 | |||
| 6b89d8a199 | |||
| e999016273 | |||
| 7c6e620f16 | |||
| 267d5ae011 | |||
| 08d4bb4785 | |||
| a02e25ffff | |||
| 280bdb0567 | |||
| 1a94e5fb0e | |||
| b6cfe59460 | |||
| 7db2abf918 | |||
| b398af914f | |||
| 29e1dac1ff | |||
| 3af8a658a7 | |||
| b5aeb29146 | |||
| 85b702b0d1 | |||
| 77c57b4b14 | |||
| 10d260ec71 | |||
| 1ac8bb0128 | |||
| 28539ba838 | |||
| f1bb6ef658 | |||
| 24c66f831f | |||
| 87502b4f2e | |||
| 3644d3a100 | |||
| 9e3147f78d | |||
| cc3ecac6d8 | |||
| 72932d2776 | |||
| 58bc9452f6 | |||
| 2a7b5d8229 | |||
| 245546de61 | |||
| a3793ff137 | |||
| 0a98817a6f | |||
| 663fb93af7 | |||
| db42c23c0a | |||
| 33716d1e50 | |||
| 65769fd7a6 | |||
| e6d3f3d91e | |||
| 79a17d5a25 | |||
| c924b48a6c | |||
| 519ff576cd | |||
| 5bc3bed461 | |||
| 442f13ef6f | |||
| 95aeadf36c | |||
| 267ea7552b | |||
| 08f7526f8f | |||
| 0604924c20 | |||
| 5ef2748cef | |||
| 8f8229dcd2 | |||
| a5b5657e96 | |||
| 0f2281e267 | |||
| 994a807819 | |||
| 79f42cec8e | |||
| 0546fd7c8a | |||
| d51e3e835e | |||
| 3d8d4921af | |||
| ba3549fa34 | |||
| 721595edea | |||
| 46d960ddfd | |||
| ed24f93fb9 | |||
| c4043a8eef | |||
| dff86c0e12 | |||
| 9a5ec33d61 | |||
| 78227bf5b0 | |||
| bf2c29a36a | |||
| 47285c6642 | |||
| e4fb4116fd | |||
| 6d3373cb2c | |||
| 6ddc214e68 | |||
| 91a802a1e5 | |||
| 886ab54eda | |||
| 4470e5bc93 | |||
| 9bbacd3e4c | |||
| 353df67c0b | |||
| 050eb9ba73 | |||
| 4fa5f5497a | |||
| 21a032b783 | |||
| 207efd8932 | |||
| 43c943e48a | |||
| d6dc5da6db | |||
| 12d787286e | |||
| c33a7670d0 | |||
| bbb56d8216 | |||
| a20c8af678 | |||
| 0eb2b382a2 | |||
| 101298c54d | |||
| f6bdfc32d3 | |||
| 5015730212 | |||
| f8a7f30a0d | |||
| 1f94028ff7 | |||
| 512c4c13a6 | |||
| 552db7cb08 | |||
| d564cb2a7e | |||
| a6e3fc2d2f | |||
| e54049bc26 | |||
| e331b39ca5 | |||
| e6270ca43f | |||
| 88da95d921 | |||
| 44f9c67466 | |||
| 02bbe399df | |||
| 41bb40feee | |||
| 336d652be5 | |||
| d3e8678955 | |||
| 503d988c1b | |||
| 7a46378e71 | |||
| 9f6d12551f | |||
| 43c93d6f85 | |||
| d683d085c0 | |||
| 92ab450983 | |||
| 7b14c65b41 | |||
| c89c652401 | |||
| f0f57d156b | |||
| cecf4f2763 | |||
| 4eeed47c7b | |||
| bd1f7e057a | |||
| 174d8b72a5 | |||
| 1437b0856c | |||
| 917181cb67 | |||
| a207a4b3cd | |||
| 39a1d27960 | |||
| 5ef4a64084 | |||
| baacd9efbf | |||
| abde37a4d7 | |||
| 3ee9b0cf4b | |||
| 88049915a2 | |||
| 585397937d | |||
| 256b6f1aff | |||
| acabdafb35 | |||
| 168c1f440d | |||
| 33a8ef4bce | |||
| 9c5ea8eba4 | |||
| 04bb5aad36 | |||
| a439be5161 |
+2
-2
@@ -13,7 +13,7 @@ stages:
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64: &fedora-x86_64-defaults
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v7
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v9
|
||||
stage: build
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
@@ -29,6 +29,7 @@ fedora-x86_64: &fedora-x86_64-defaults
|
||||
- "${CI_PROJECT_DIR}/_build/report.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
@@ -45,7 +46,6 @@ fedora-x86_64-staticlibs:
|
||||
script:
|
||||
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
|
||||
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
|
||||
allow_failure: true
|
||||
cache:
|
||||
key: "%CI_JOB_NAME%"
|
||||
<<: *cache-paths
|
||||
|
||||
@@ -53,6 +53,7 @@ RUN dnf -y install \
|
||||
libxkbcommon-devel \
|
||||
libXrandr-devel \
|
||||
libXrender-devel \
|
||||
libXtst-devel \
|
||||
libxslt \
|
||||
mesa-dri-drivers \
|
||||
mesa-libEGL-devel \
|
||||
@@ -66,6 +67,7 @@ RUN dnf -y install \
|
||||
python3-wheel \
|
||||
redhat-rpm-config \
|
||||
sassc \
|
||||
sysprof-devel \
|
||||
systemtap-sdt-devel \
|
||||
vulkan-devel \
|
||||
wayland-devel \
|
||||
|
||||
@@ -16,6 +16,7 @@ meson \
|
||||
-Dwayland-backend=true \
|
||||
-Dbroadway-backend=true \
|
||||
-Dvulkan=yes \
|
||||
-Dprofiler=true \
|
||||
--werror \
|
||||
${EXTRA_MESON_FLAGS:-} \
|
||||
_build $srcdir
|
||||
|
||||
@@ -33,6 +33,10 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
|
||||
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ maintainers review your contribution.
|
||||
|
||||
Each contribution is reviewed by the core developers of the GTK project.
|
||||
|
||||
The [CODE-OWNERS](./docs/CODE-OWNERS) document contains the list of core
|
||||
The [CODEOWNERS](./docs/CODEOWNERS) document contains the list of core
|
||||
contributors to GTK and the areas for which they are responsible; you
|
||||
should ensure to receive their review and signoff on your changes.
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ demo_application_window_load_state (DemoApplicationWindow *win)
|
||||
static void
|
||||
demo_application_window_init (DemoApplicationWindow *window)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *popover;
|
||||
|
||||
window->width = -1;
|
||||
window->height = -1;
|
||||
@@ -428,8 +428,8 @@ demo_application_window_init (DemoApplicationWindow *window)
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (window));
|
||||
|
||||
menu = gtk_menu_new_from_model (window->toolmenu);
|
||||
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (window->menutool), menu);
|
||||
popover = gtk_popover_menu_new_from_model (window->menutool, window->toolmenu);
|
||||
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (window->menutool), popover);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
||||
@@ -43,25 +43,17 @@
|
||||
<object class="GtkInfoBar" id="infobar">
|
||||
<property name="visible">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="content_area">
|
||||
<child>
|
||||
<object class="GtkLabel" id="message">
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="message">
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_OK</property>
|
||||
<property name="use-underline">1</property>
|
||||
<signal name="clicked" handler="clicked_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_OK</property>
|
||||
<property name="use-underline">1</property>
|
||||
<signal name="clicked" handler="clicked_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
|
||||
@@ -94,6 +94,7 @@ create_page1 (GtkWidget *assistant)
|
||||
GtkWidget *box, *label, *entry;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
g_object_set (box, "margin", 12, NULL);
|
||||
|
||||
label = gtk_label_new ("You must fill out this entry to continue:");
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
@@ -115,10 +116,12 @@ create_page2 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *box, *checkbutton;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
g_object_set (box, "margin", 12, NULL);
|
||||
|
||||
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
||||
"even if you do not check this");
|
||||
gtk_widget_set_valign (checkbutton, GTK_ALIGN_CENTER);
|
||||
gtk_container_add (GTK_CONTAINER (box), checkbutton);
|
||||
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
|
||||
|
||||
+15
-40
@@ -38,7 +38,22 @@ help_activate (GSimpleAction *action,
|
||||
g_print ("Help not available\n");
|
||||
}
|
||||
|
||||
static void
|
||||
not_implemented (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "new", not_implemented, NULL, NULL, NULL },
|
||||
{ "open", not_implemented, NULL, NULL, NULL },
|
||||
{ "save", not_implemented, NULL, NULL, NULL },
|
||||
{ "save-as", not_implemented, NULL, NULL, NULL },
|
||||
{ "copy", not_implemented, NULL, NULL, NULL },
|
||||
{ "cut", not_implemented, NULL, NULL, NULL },
|
||||
{ "paste", not_implemented, NULL, NULL, NULL },
|
||||
{ "quit", quit_activate, NULL, NULL, NULL },
|
||||
{ "about", about_activate, NULL, NULL, NULL },
|
||||
{ "help", help_activate, NULL, NULL, NULL }
|
||||
@@ -50,8 +65,6 @@ do_builder (GtkWidget *do_widget)
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *toolbar;
|
||||
GActionGroup *actions;
|
||||
GtkAccelGroup *accel_group;
|
||||
GtkWidget *item;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -72,44 +85,6 @@ do_builder (GtkWidget *do_widget)
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
gtk_widget_insert_action_group (window, "win", actions);
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "new_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_n, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "open_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_o, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "save_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "quit_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "copy_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_c, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "cut_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_x, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "paste_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_v, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "help_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_F1, 0, GTK_ACCEL_VISIBLE);
|
||||
|
||||
item = (GtkWidget*)gtk_builder_get_object (builder, "about_item");
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_F7, 0, GTK_ACCEL_VISIBLE);
|
||||
|
||||
g_object_set_data_full (G_OBJECT(window), "builder", builder, g_object_unref);
|
||||
}
|
||||
|
||||
@@ -1,551 +0,0 @@
|
||||
/* Change Display
|
||||
*
|
||||
* Demonstrates migrating a window between different displays.
|
||||
* A display is a mouse and keyboard with some number of
|
||||
* associated monitors. The neat thing about having multiple
|
||||
* displays is that they can be on a completely separate
|
||||
* computers, as long as there is a network connection to the
|
||||
* computer where the application is running.
|
||||
*
|
||||
* Only some of the windowing systems where GTK runs have the
|
||||
* concept of multiple displays. (The X Window System is the
|
||||
* main example.) Other windowing systems can only handle one
|
||||
* keyboard and mouse, and combine all monitors into
|
||||
* a single display.
|
||||
*
|
||||
* This is a moderately complex example, and demonstrates:
|
||||
*
|
||||
* - Tracking the currently open displays
|
||||
*
|
||||
* - Changing the display for a window
|
||||
*
|
||||
* - Letting the user choose a window by clicking on it
|
||||
*
|
||||
* - Using GtkListStore and GtkTreeView
|
||||
*
|
||||
* - Using GtkDialog
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* The ChangeDisplayInfo structure corresponds to a toplevel window and
|
||||
* holds pointers to widgets inside the toplevel window along with other
|
||||
* information about the contents of the window.
|
||||
* This is a common organizational structure in real applications.
|
||||
*/
|
||||
typedef struct _ChangeDisplayInfo ChangeDisplayInfo;
|
||||
|
||||
struct _ChangeDisplayInfo
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkSizeGroup *size_group;
|
||||
|
||||
GtkTreeModel *display_model;
|
||||
|
||||
GdkDisplay *current_display;
|
||||
};
|
||||
|
||||
/* These enumerations provide symbolic names for the columns
|
||||
* in the two GtkListStore models.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DISPLAY_COLUMN_NAME,
|
||||
DISPLAY_COLUMN_DISPLAY,
|
||||
DISPLAY_NUM_COLUMNS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SCREEN_COLUMN_NUMBER,
|
||||
SCREEN_COLUMN_SCREEN,
|
||||
SCREEN_NUM_COLUMNS
|
||||
};
|
||||
|
||||
/* Finds the toplevel window under the mouse pointer, if any.
|
||||
*/
|
||||
static GtkWidget *
|
||||
find_toplevel_at_pointer (GdkDisplay *display)
|
||||
{
|
||||
GdkSurface *pointer_window;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
|
||||
|
||||
if (pointer_window)
|
||||
widget = GTK_WIDGET (gtk_native_get_for_surface (pointer_window));
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
released_cb (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gboolean *clicked)
|
||||
{
|
||||
*clicked = TRUE;
|
||||
}
|
||||
|
||||
/* Asks the user to click on a window, then waits for them click
|
||||
* the mouse. When the mouse is released, returns the toplevel
|
||||
* window under the pointer, or NULL, if there is none.
|
||||
*/
|
||||
static GtkWidget *
|
||||
query_for_toplevel (GdkDisplay *display,
|
||||
const char *prompt)
|
||||
{
|
||||
GtkWidget *popup, *label, *frame;
|
||||
GdkCursor *cursor;
|
||||
GtkWidget *toplevel = NULL;
|
||||
GdkDevice *device;
|
||||
|
||||
popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_display (GTK_WINDOW (popup), display);
|
||||
gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add (GTK_CONTAINER (popup), frame);
|
||||
|
||||
label = gtk_label_new (prompt);
|
||||
g_object_set (label, "margin", 10, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
|
||||
gtk_widget_show (popup);
|
||||
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
||||
device = gtk_get_current_event_device ();
|
||||
|
||||
if (gdk_seat_grab (gdk_device_get_seat (device),
|
||||
gtk_native_get_surface (GTK_NATIVE (popup)),
|
||||
GDK_SEAT_CAPABILITY_ALL_POINTING,
|
||||
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
|
||||
{
|
||||
GtkGesture *gesture = gtk_gesture_click_new ();
|
||||
gboolean clicked = FALSE;
|
||||
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (released_cb), &clicked);
|
||||
gtk_widget_add_controller (popup, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Process events until clicked is set by our button release event handler.
|
||||
* We pass in may_block=TRUE since we want to wait if there
|
||||
* are no events currently.
|
||||
*/
|
||||
while (!clicked)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
gdk_seat_ungrab (gdk_device_get_seat (device));
|
||||
|
||||
toplevel = find_toplevel_at_pointer (display);
|
||||
if (toplevel == popup)
|
||||
toplevel = NULL;
|
||||
}
|
||||
|
||||
g_object_unref (cursor);
|
||||
gtk_widget_destroy (popup);
|
||||
|
||||
return toplevel;
|
||||
}
|
||||
|
||||
/* Prompts the user for a toplevel window to move, and then moves
|
||||
* that window to the currently selected display
|
||||
*/
|
||||
static void
|
||||
query_change_display (ChangeDisplayInfo *info)
|
||||
{
|
||||
GdkDisplay *display = gtk_widget_get_display (info->window);
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = query_for_toplevel (display,
|
||||
"Please select the toplevel\n"
|
||||
"to move to the new display");
|
||||
|
||||
if (toplevel)
|
||||
gtk_window_set_display (GTK_WINDOW (toplevel), info->current_display);
|
||||
else
|
||||
gdk_display_beep (display);
|
||||
}
|
||||
|
||||
/* Called when the user clicks on a button in our dialog or
|
||||
* closes the dialog through the window manager. Unless the
|
||||
* "Change" button was clicked, we destroy the dialog.
|
||||
*/
|
||||
static void
|
||||
response_cb (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
query_change_display (info);
|
||||
else
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
/* Called when the user clicks on "Open..." in the display
|
||||
* frame. Prompts for a new display, and then opens a connection
|
||||
* to that display.
|
||||
*/
|
||||
static void
|
||||
open_display_cb (GtkWidget *button,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *display_entry;
|
||||
GtkWidget *dialog_label;
|
||||
gchar *new_screen_name = NULL;
|
||||
GdkDisplay *result = NULL;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Open Display",
|
||||
GTK_WINDOW (info->window),
|
||||
GTK_DIALOG_MODAL,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_OK"), GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
display_entry = gtk_entry_new ();
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
|
||||
dialog_label =
|
||||
gtk_label_new ("Please enter the name of\nthe new display\n");
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), display_entry);
|
||||
|
||||
gtk_widget_grab_focus (display_entry);
|
||||
|
||||
while (!result)
|
||||
{
|
||||
gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
if (response_id != GTK_RESPONSE_OK)
|
||||
break;
|
||||
|
||||
new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
|
||||
0, -1);
|
||||
|
||||
if (strcmp (new_screen_name, "") != 0)
|
||||
{
|
||||
result = gdk_display_open (new_screen_name);
|
||||
if (!result)
|
||||
{
|
||||
gchar *error_msg =
|
||||
g_strdup_printf ("Can't open display:\n\t%s\nplease try another one\n",
|
||||
new_screen_name);
|
||||
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
|
||||
g_free (error_msg);
|
||||
}
|
||||
|
||||
g_free (new_screen_name);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
/* Called when the user clicks on the "Close" button in the
|
||||
* "Display" frame. Closes the selected display.
|
||||
*/
|
||||
static void
|
||||
close_display_cb (GtkWidget *button,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
if (info->current_display)
|
||||
gdk_display_close (info->current_display);
|
||||
}
|
||||
|
||||
/* Called when the selected row in the display list changes.
|
||||
* Updates info->current_display, then refills the list of
|
||||
* screens.
|
||||
*/
|
||||
static void
|
||||
display_changed_cb (GtkTreeSelection *selection,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (info->current_display)
|
||||
g_object_unref (info->current_display);
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
gtk_tree_model_get (model, &iter,
|
||||
DISPLAY_COLUMN_DISPLAY, &info->current_display,
|
||||
-1);
|
||||
else
|
||||
info->current_display = NULL;
|
||||
}
|
||||
|
||||
/* This function is used both for creating the "Display" and
|
||||
* "Screen" frames, since they have a similar structure. The
|
||||
* caller hooks up the right context for the value returned
|
||||
* in tree_view, and packs any relevant buttons into button_vbox.
|
||||
*/
|
||||
static void
|
||||
create_frame (ChangeDisplayInfo *info,
|
||||
const char *title,
|
||||
GtkWidget **frame,
|
||||
GtkWidget **tree_view,
|
||||
GtkWidget **button_vbox)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkWidget *scrollwin;
|
||||
GtkWidget *hbox;
|
||||
|
||||
*frame = gtk_frame_new (title);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
|
||||
g_object_set (hbox, "margin", 8, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (*frame), hbox);
|
||||
|
||||
scrollwin = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), scrollwin);
|
||||
|
||||
*tree_view = gtk_tree_view_new ();
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view);
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
||||
|
||||
*button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), *button_vbox);
|
||||
|
||||
if (!info->size_group)
|
||||
info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
|
||||
}
|
||||
|
||||
/* If we have a stack of buttons, it often looks better if their contents
|
||||
* are left-aligned, rather than centered. This function creates a button
|
||||
* and left-aligns it contents.
|
||||
*/
|
||||
GtkWidget *
|
||||
left_align_button_new (const char *label)
|
||||
{
|
||||
GtkWidget *button = gtk_button_new_with_mnemonic (label);
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (button));
|
||||
|
||||
gtk_widget_set_halign (child, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
/* Creates the "Display" frame in the main window.
|
||||
*/
|
||||
GtkWidget *
|
||||
create_display_frame (ChangeDisplayInfo *info)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *tree_view;
|
||||
GtkWidget *button_vbox;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeSelection *selection;
|
||||
GtkWidget *button;
|
||||
|
||||
create_frame (info, "Display", &frame, &tree_view, &button_vbox);
|
||||
|
||||
button = left_align_button_new ("_Open...");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
|
||||
gtk_container_add (GTK_CONTAINER (button_vbox), button);
|
||||
|
||||
button = left_align_button_new ("_Close");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
|
||||
gtk_container_add (GTK_CONTAINER (button_vbox), button);
|
||||
|
||||
info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
|
||||
G_TYPE_STRING,
|
||||
GDK_TYPE_DISPLAY);
|
||||
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->display_model);
|
||||
|
||||
column = gtk_tree_view_column_new_with_attributes ("Name",
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", DISPLAY_COLUMN_NAME,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (display_changed_cb), info);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
/* Called when one of the currently open displays is closed.
|
||||
* Remove it from our list of displays.
|
||||
*/
|
||||
static void
|
||||
display_closed_cb (GdkDisplay *display,
|
||||
gboolean is_error,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
|
||||
for (valid = gtk_tree_model_get_iter_first (info->display_model, &iter);
|
||||
valid;
|
||||
valid = gtk_tree_model_iter_next (info->display_model, &iter))
|
||||
{
|
||||
GdkDisplay *tmp_display;
|
||||
|
||||
gtk_tree_model_get (info->display_model, &iter,
|
||||
DISPLAY_COLUMN_DISPLAY, &tmp_display,
|
||||
-1);
|
||||
if (tmp_display == display)
|
||||
{
|
||||
gtk_list_store_remove (GTK_LIST_STORE (info->display_model), &iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Adds a new display to our list of displays, and connects
|
||||
* to the "closed" signal so that we can remove it from the
|
||||
* list of displays again.
|
||||
*/
|
||||
static void
|
||||
add_display (ChangeDisplayInfo *info,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
const gchar *name = gdk_display_get_name (display);
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
|
||||
DISPLAY_COLUMN_NAME, name,
|
||||
DISPLAY_COLUMN_DISPLAY, display,
|
||||
-1);
|
||||
|
||||
g_signal_connect (display, "closed",
|
||||
G_CALLBACK (display_closed_cb), info);
|
||||
}
|
||||
|
||||
/* Called when a new display is opened
|
||||
*/
|
||||
static void
|
||||
display_opened_cb (GdkDisplayManager *manager,
|
||||
GdkDisplay *display,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
add_display (info, display);
|
||||
}
|
||||
|
||||
/* Adds all currently open displays to our list of displays,
|
||||
* and set up a signal connection so that we'll be notified
|
||||
* when displays are opened in the future as well.
|
||||
*/
|
||||
static void
|
||||
initialize_displays (ChangeDisplayInfo *info)
|
||||
{
|
||||
GdkDisplayManager *manager = gdk_display_manager_get ();
|
||||
GSList *displays = gdk_display_manager_list_displays (manager);
|
||||
GSList *tmp_list;
|
||||
|
||||
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
|
||||
add_display (info, tmp_list->data);
|
||||
|
||||
g_slist_free (tmp_list);
|
||||
|
||||
g_signal_connect (manager, "display-opened",
|
||||
G_CALLBACK (display_opened_cb), info);
|
||||
}
|
||||
|
||||
/* Cleans up when the toplevel is destroyed; we remove the
|
||||
* connections we use to track currently open displays, then
|
||||
* free the ChangeDisplayInfo structure.
|
||||
*/
|
||||
static void
|
||||
destroy_info (ChangeDisplayInfo *info)
|
||||
{
|
||||
GdkDisplayManager *manager = gdk_display_manager_get ();
|
||||
GSList *displays = gdk_display_manager_list_displays (manager);
|
||||
GSList *tmp_list;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (manager,
|
||||
display_opened_cb,
|
||||
info);
|
||||
|
||||
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
|
||||
g_signal_handlers_disconnect_by_func (tmp_list->data,
|
||||
display_closed_cb,
|
||||
info);
|
||||
|
||||
g_slist_free (tmp_list);
|
||||
|
||||
g_object_unref (info->size_group);
|
||||
g_object_unref (info->display_model);
|
||||
|
||||
if (info->current_display)
|
||||
g_object_unref (info->current_display);
|
||||
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_cb (GObject *object,
|
||||
ChangeDisplayInfo **info)
|
||||
{
|
||||
destroy_info (*info);
|
||||
*info = NULL;
|
||||
}
|
||||
|
||||
/* Main entry point. If the dialog for this demo doesn't yet exist, creates
|
||||
* it. Otherwise, destroys it.
|
||||
*/
|
||||
GtkWidget *
|
||||
do_changedisplay (GtkWidget *do_widget)
|
||||
{
|
||||
static ChangeDisplayInfo *info = NULL;
|
||||
|
||||
if (!info)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
info = g_new0 (ChangeDisplayInfo, 1);
|
||||
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Display",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
"Close", GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
||||
|
||||
g_signal_connect (info->window, "response",
|
||||
G_CALLBACK (response_cb), info);
|
||||
g_signal_connect (info->window, "destroy",
|
||||
G_CALLBACK (destroy_cb), &info);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (info->window));
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
g_object_set (vbox, "margin", 8, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), vbox);
|
||||
|
||||
frame = create_display_frame (info);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), frame);
|
||||
|
||||
initialize_displays (info);
|
||||
|
||||
gtk_widget_show (info->window);
|
||||
return info->window;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (info->window);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
+116
-73
@@ -119,59 +119,85 @@ get_image_paintable (GtkImage *image)
|
||||
}
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
drag_begin (GtkDragSource *source,
|
||||
GdkDrag *drag,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
gtk_drag_source_set_icon (source, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
gpointer data)
|
||||
static void
|
||||
get_texture (GValue *value,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
|
||||
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
|
||||
g_value_set_object (value, paintable);
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
prepare_drag (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *image)
|
||||
{
|
||||
return gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
got_texture (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
if (gtk_selection_data_get_length (selection_data) > 0)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GdkDrop *drop = GDK_DROP (source);
|
||||
GtkWidget *image = data;
|
||||
const GValue *value;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = gtk_selection_data_get_texture (selection_data);
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
|
||||
g_object_unref (texture);
|
||||
value = gdk_drop_read_value_finish (drop, result, &error);
|
||||
if (value)
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (texture));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("Failed to get data: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_image (GtkMenuItem *item,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
drag_drop (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
int x,
|
||||
int y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
GdkPaintable *paintable;
|
||||
if (gdk_drop_has_value (drop, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
gdk_drop_read_value_async (drop, GDK_TYPE_TEXTURE, G_PRIORITY_DEFAULT, NULL, got_texture, widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||
paintable = get_image_paintable (GTK_IMAGE (data));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_image (GSimpleAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
|
||||
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
|
||||
@@ -196,16 +222,12 @@ paste_image_received (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
paste_image (GtkMenuItem *item,
|
||||
gpointer data)
|
||||
paste_image (GSimpleAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||
gdk_clipboard_read_texture_async (clipboard,
|
||||
NULL,
|
||||
paste_image_received,
|
||||
data);
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||
gdk_clipboard_read_texture_async (clipboard, NULL, paste_image_received, data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -215,22 +237,23 @@ pressed_cb (GtkGesture *gesture,
|
||||
double y,
|
||||
GtkWidget *image)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
GtkWidget *popover;
|
||||
GMenu *menu;
|
||||
GMenuItem *item;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
menu = g_menu_new ();
|
||||
item = g_menu_item_new (_("_Copy"), "clipboard.copy");
|
||||
g_menu_append_item (menu, item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic (_("_Copy"));
|
||||
g_signal_connect (item, "activate", G_CALLBACK (copy_image), image);
|
||||
gtk_widget_show (item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
item = g_menu_item_new (_("_Paste"), "clipboard.paste");
|
||||
g_menu_append_item (menu, item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic (_("_Paste"));
|
||||
g_signal_connect (item, "activate", G_CALLBACK (paste_image), image);
|
||||
gtk_widget_show (item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
popover = gtk_popover_menu_new_from_model (image, G_MENU_MODEL (menu));
|
||||
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &(GdkRectangle) { x, y, 1, 1});
|
||||
gtk_popover_popup (GTK_POPOVER (popover));
|
||||
|
||||
g_object_unref (menu);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -243,6 +266,14 @@ do_clipboard (GtkWidget *do_widget)
|
||||
GtkWidget *entry, *button;
|
||||
GtkWidget *image;
|
||||
GtkGesture *gesture;
|
||||
GActionEntry entries[] = {
|
||||
{ "copy", copy_image, NULL, NULL, NULL },
|
||||
{ "paste", paste_image, NULL, NULL, NULL },
|
||||
};
|
||||
GActionGroup *actions;
|
||||
GtkDragSource *source;
|
||||
GtkDropTarget *dest;
|
||||
GdkContentFormats *formats;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
@@ -301,22 +332,21 @@ do_clipboard (GtkWidget *do_widget)
|
||||
|
||||
/* Create the first image */
|
||||
image = gtk_image_new_from_icon_name ("dialog-warning");
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), image);
|
||||
|
||||
/* make image a drag source */
|
||||
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
|
||||
gtk_drag_source_add_image_targets (image);
|
||||
g_signal_connect (image, "drag-begin",
|
||||
G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (image, "drag-data-get",
|
||||
G_CALLBACK (drag_data_get), image);
|
||||
source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
/* accept drops on image */
|
||||
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
|
||||
NULL, GDK_ACTION_COPY);
|
||||
gtk_drag_dest_add_image_targets (image);
|
||||
g_signal_connect (image, "drag-data-received",
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_TEXTURE);
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (drag_drop), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_click_new ();
|
||||
@@ -324,30 +354,43 @@ do_clipboard (GtkWidget *do_widget)
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
actions = G_ACTION_GROUP (g_simple_action_group_new ());
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
|
||||
|
||||
gtk_widget_insert_action_group (image, "clipboard", actions);
|
||||
|
||||
g_object_unref (actions);
|
||||
|
||||
/* Create the second image */
|
||||
image = gtk_image_new_from_icon_name ("process-stop");
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), image);
|
||||
|
||||
/* make image a drag source */
|
||||
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
|
||||
gtk_drag_source_add_image_targets (image);
|
||||
g_signal_connect (image, "drag-begin",
|
||||
G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (image, "drag-data-get",
|
||||
G_CALLBACK (drag_data_get), image);
|
||||
source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
/* accept drops on image */
|
||||
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
|
||||
NULL, GDK_ACTION_COPY);
|
||||
gtk_drag_dest_add_image_targets (image);
|
||||
g_signal_connect (image, "drag-data-received",
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_TEXTURE);
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (drag_drop), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
actions = G_ACTION_GROUP (g_simple_action_group_new ());
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
|
||||
|
||||
gtk_widget_insert_action_group (image, "clipboard", actions);
|
||||
|
||||
g_object_unref (actions);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -149,7 +149,6 @@
|
||||
<file>application_demo.c</file>
|
||||
<file>assistant.c</file>
|
||||
<file>builder.c</file>
|
||||
<file>changedisplay.c</file>
|
||||
<file>clipboard.c</file>
|
||||
<file>colorsel.c</file>
|
||||
<file>combobox.c</file>
|
||||
@@ -191,7 +190,6 @@
|
||||
<file>listbox.c</file>
|
||||
<file>list_store.c</file>
|
||||
<file>markup.c</file>
|
||||
<file>menus.c</file>
|
||||
<file>modelbutton.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay2.c</file>
|
||||
|
||||
+71
-103
@@ -22,6 +22,75 @@
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<menu id="menubar">
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_File</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">win.new</attribute>
|
||||
<attribute name="accel"><Primary>n</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Open</attribute>
|
||||
<attribute name="action">win.open</attribute>
|
||||
<attribute name="accel"><Primary>o</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Save</attribute>
|
||||
<attribute name="action">win.save</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save _As</attribute>
|
||||
<attribute name="action">win.save-as</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">win.quit</attribute>
|
||||
<attribute name="accel"><Primary><Shift>s</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Edit</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Copy</attribute>
|
||||
<attribute name="action">win.copy</attribute>
|
||||
<attribute name="accel"><Primary>c</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Cut</attribute>
|
||||
<attribute name="action">win.cut</attribute>
|
||||
<attribute name="accel"><Primary>x</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Paste</attribute>
|
||||
<attribute name="action">win.paste</attribute>
|
||||
<attribute name="accel"><Primary>v</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<attribute name="action">win.help</attribute>
|
||||
<attribute name="accel">F1</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About</attribute>
|
||||
<attribute name="action">win.about</attribute>
|
||||
<attribute name="accel">F7</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
</menu>
|
||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
@@ -37,109 +106,8 @@
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkMenuBar" id="menubar1">
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-menubar">
|
||||
<property name="AtkObject::accessible-name">The menubar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem">
|
||||
<property name="label" translatable="yes">_File</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="new_item">
|
||||
<property name="label" translatable="yes">_New</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="open_item">
|
||||
<property name="label" translatable="yes">_Open</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="save_item">
|
||||
<property name="label" translatable="yes">_Save</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="save_as_item">
|
||||
<property name="label" translatable="yes">Save _As</property>
|
||||
<property name="use-underline">1</property>
|
||||
<accelerator key="s" modifiers="primary | shift-mask" signal="activate"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="quit_item">
|
||||
<property name="label" translatable="yes">_Quit</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem">
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="copy_item">
|
||||
<property name="label" translatable="yes">_Copy</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="cut_item">
|
||||
<property name="label" translatable="yes">_Cut</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="paste_item">
|
||||
<property name="label" translatable="yes">_Paste</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem">
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="help_item">
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.help</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="about_item">
|
||||
<property name="label" translatable="yes">_About</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.about</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkPopoverMenuBar" id="menubar1">
|
||||
<property name="menu-model">menubar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
+68
-52
@@ -1,6 +1,8 @@
|
||||
/* Drag-and-Drop
|
||||
*
|
||||
* I can't believe its not glade!
|
||||
*
|
||||
* Try right-clicking in the window.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -92,7 +94,7 @@ deserialize_widget (GtkDemoWidget *demo)
|
||||
static double pos_x, pos_y;
|
||||
|
||||
static void
|
||||
new_label_cb (GtkMenuItem *item,
|
||||
new_label_cb (GtkWidget *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFixed *fixed = data;
|
||||
@@ -100,10 +102,12 @@ new_label_cb (GtkMenuItem *item,
|
||||
|
||||
widget = gtk_label_new ("Label");
|
||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
new_spinner_cb (GtkMenuItem *item,
|
||||
new_spinner_cb (GtkWidget *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFixed *fixed = data;
|
||||
@@ -113,33 +117,39 @@ new_spinner_cb (GtkMenuItem *item,
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||
gtk_spinner_start (GTK_SPINNER (widget));
|
||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
copy_cb (GtkWidget *child)
|
||||
copy_cb (GtkWidget *button, GtkWidget *child)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
GtkDemoWidget *demo;
|
||||
|
||||
g_print ("Copy %s\n", G_OBJECT_TYPE_NAME (child));
|
||||
|
||||
demo = serialize_widget (child);
|
||||
|
||||
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
||||
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
delete_cb (GtkWidget *child)
|
||||
delete_cb (GtkWidget *button, GtkWidget *child)
|
||||
{
|
||||
gtk_widget_destroy (child);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
cut_cb (GtkWidget *child)
|
||||
cut_cb (GtkWidget *button, GtkWidget *child)
|
||||
{
|
||||
copy_cb (child);
|
||||
delete_cb (child);
|
||||
copy_cb (button, child);
|
||||
delete_cb (button, child);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -175,7 +185,7 @@ value_read (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
paste_cb (GtkWidget *fixed)
|
||||
paste_cb (GtkWidget *button, GtkWidget *fixed)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
@@ -187,6 +197,8 @@ paste_cb (GtkWidget *fixed)
|
||||
}
|
||||
else
|
||||
g_print ("Don't know how to handle clipboard contents\n");
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -205,7 +217,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
edit_cb (GtkWidget *child)
|
||||
edit_cb (GtkWidget *button, GtkWidget *child)
|
||||
{
|
||||
GtkWidget *fixed = gtk_widget_get_parent (child);
|
||||
int x, y;
|
||||
@@ -219,6 +231,7 @@ edit_cb (GtkWidget *child)
|
||||
g_object_set_data (G_OBJECT (entry), "label", child);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (entry), 12);
|
||||
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
|
||||
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
|
||||
gtk_widget_grab_focus (entry);
|
||||
@@ -230,6 +243,9 @@ edit_cb (GtkWidget *child)
|
||||
g_object_get (child, "active", &active, NULL);
|
||||
g_object_set (child, "active", !active, NULL);
|
||||
}
|
||||
|
||||
if (button)
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -247,65 +263,65 @@ pressed_cb (GtkGesture *gesture,
|
||||
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *box;
|
||||
GtkWidget *item;
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
pos_x = x;
|
||||
pos_y = y;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
item = gtk_menu_item_new_with_label ("New Label");
|
||||
g_signal_connect (item, "activate", G_CALLBACK (new_label_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_menu_item_new_with_label ("New Spinner");
|
||||
g_signal_connect (item, "activate", G_CALLBACK (new_spinner_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
menu = gtk_popover_new (widget);
|
||||
gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1});
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (menu), box);
|
||||
|
||||
item = gtk_separator_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_button_new_with_label ("New Label");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (new_label_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
item = gtk_button_new_with_label ("New Spinner");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (new_spinner_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("Edit");
|
||||
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
|
||||
item = gtk_button_new_with_label ("Edit");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (edit_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
|
||||
item = gtk_separator_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("Cut");
|
||||
item = gtk_button_new_with_label ("Cut");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (cut_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_menu_item_new_with_label ("Copy");
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (cut_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
item = gtk_button_new_with_label ("Copy");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (copy_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_menu_item_new_with_label ("Paste");
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (copy_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
item = gtk_button_new_with_label ("Paste");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
||||
gtk_widget_set_sensitive (item,
|
||||
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
|
||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (paste_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
item = gtk_menu_item_new_with_label ("Delete");
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (paste_cb), widget);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
item = gtk_button_new_with_label ("Delete");
|
||||
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (delete_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
|
||||
gtk_container_add (GTK_CONTAINER (box), item);
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = 0;
|
||||
rect.height = 0;
|
||||
|
||||
gtk_menu_popup_at_rect (GTK_MENU (menu),
|
||||
gtk_native_get_surface (gtk_widget_get_native (widget)),
|
||||
&rect,
|
||||
GDK_GRAVITY_NORTH_WEST,
|
||||
GDK_GRAVITY_NORTH_WEST,
|
||||
NULL);
|
||||
|
||||
return;
|
||||
gtk_popover_popup (GTK_POPOVER (menu));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +341,7 @@ released_cb (GtkGesture *gesture,
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
if (child != NULL && child != widget)
|
||||
edit_cb (child);
|
||||
edit_cb (NULL, child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1228,7 +1228,7 @@ do_font_features (GtkWidget *do_widget)
|
||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", g_object_ref (controller), g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||
gtk_widget_add_controller (entry, controller);
|
||||
|
||||
@@ -1337,6 +1337,8 @@ do_font_features (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
update_display ();
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
#include "fontplane.h"
|
||||
|
||||
#include "gtk.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_WEIGHT_ADJUSTMENT,
|
||||
|
||||
@@ -165,10 +165,11 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style><class name="linked"/></style>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="text_radio">
|
||||
<property name="draw-indicator">0</property>
|
||||
@@ -183,7 +184,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">7</property>
|
||||
</layout>
|
||||
|
||||
@@ -262,7 +262,7 @@ draw_menu (GtkWidget *widget,
|
||||
gint toggle_x, toggle_y, toggle_width, toggle_height;
|
||||
|
||||
/* This information is taken from the GtkMenu docs, see "CSS nodes" */
|
||||
menu_context = get_style (gtk_widget_get_style_context(widget), "menu");
|
||||
menu_context = get_style (NULL, "menu");
|
||||
hovermenuitem_context = get_style (menu_context, "menuitem:hover");
|
||||
hoveredarrowmenuitem_context = get_style (hovermenuitem_context, "arrow.right:dir(ltr)");
|
||||
menuitem_context = get_style (menu_context, "menuitem");
|
||||
@@ -414,7 +414,7 @@ draw_menubar (GtkWidget *widget,
|
||||
frame_context = get_style (NULL, "frame");
|
||||
border_context = get_style (frame_context, "border");
|
||||
|
||||
/* This information is taken from the GtkMenuBar docs, see "CSS nodes" */
|
||||
/* This information is taken from the GtkPopoverMenuBar docs, see "CSS nodes" */
|
||||
menubar_context = get_style (NULL, "menubar");
|
||||
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
|
||||
menuitem_context = get_style (menubar_context, "menuitem");
|
||||
|
||||
@@ -94,9 +94,12 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
cairo_pattern_t *pat;
|
||||
cairo_matrix_t matrix;
|
||||
gdouble angle, scale;
|
||||
gdouble x_center, y_center;
|
||||
|
||||
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
|
||||
|
||||
cairo_get_matrix (cr, &matrix);
|
||||
cairo_matrix_translate (&matrix, width / 2, height / 2);
|
||||
cairo_matrix_translate (&matrix, x_center, y_center);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="hadjustment"><object class="GtkAdjustment" id="hadjustment"/></property>
|
||||
<property name="vadjustment"><object class="GtkAdjustment" id="vadjustment"/></property>
|
||||
<property name="hadjustment">
|
||||
<object class="GtkAdjustment" id="hadjustment"/>
|
||||
</property>
|
||||
<property name="vadjustment">
|
||||
<object class="GtkAdjustment" id="vadjustment"/>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -97,6 +97,7 @@ do_infobar (GtkWidget *do_widget)
|
||||
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||
gtk_info_bar_set_default_response (GTK_INFO_BAR (bar), GTK_RESPONSE_OK);
|
||||
|
||||
button = gtk_toggle_button_new_with_label ("Question");
|
||||
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
|
||||
+11
-15
@@ -1,19 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk40">
|
||||
<object class="GtkMenu" id="menu1">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem1">
|
||||
<property name="label" translatable="yes">Email message</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem2">
|
||||
<property name="label" translatable="yes">Embed message</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<menu id="menu1">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Email message</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Embed message</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<template class="GtkMessageRow" parent="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
@@ -171,7 +167,7 @@
|
||||
<object class="GtkMenuButton" id="more-button">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="popup">menu1</property>
|
||||
<property name="menu-model">menu1</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="label" translatable="yes">More...</property>
|
||||
</object>
|
||||
|
||||
@@ -1003,32 +1003,6 @@ row_activated_cb (GtkWidget *tree_view,
|
||||
run_example_for_row (window, model, &iter);
|
||||
}
|
||||
|
||||
static void
|
||||
start_cb (GtkMenuItem *item, GtkWidget *scrollbar)
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
||||
gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
|
||||
}
|
||||
|
||||
static void
|
||||
end_cb (GtkMenuItem *item, GtkWidget *scrollbar)
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
||||
gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
|
||||
{
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -1037,10 +1011,6 @@ activate (GApplication *app)
|
||||
GtkWidget *widget;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *scrollbar;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "run", activate_run, NULL, NULL, NULL }
|
||||
@@ -1062,21 +1032,6 @@ activate (GApplication *app)
|
||||
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
|
||||
|
||||
sw = (GtkWidget *)gtk_builder_get_object (builder, "source-scrolledwindow");
|
||||
scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw));
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
item = gtk_menu_item_new_with_label ("Start");
|
||||
g_signal_connect (item, "activate", G_CALLBACK (start_cb), scrollbar);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("End");
|
||||
g_signal_connect (item, "activate", G_CALLBACK (end_cb), scrollbar);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
|
||||
g_signal_connect (scrollbar, "popup-menu", G_CALLBACK (scrollbar_popup), menu);
|
||||
|
||||
load_file (gtk_demos[0].name, gtk_demos[0].filename);
|
||||
|
||||
populate_model (model);
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
/* Menus
|
||||
*
|
||||
* There are several widgets involved in displaying menus. The
|
||||
* GtkMenuBar widget is a menu bar, which normally appears horizontally
|
||||
* at the top of an application, but can also be layed out vertically.
|
||||
* The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
|
||||
* and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
|
||||
* menu items (GtkMenuItem). Each menu item contains text and/or images
|
||||
* and can be selected by the user.
|
||||
*
|
||||
* There are several kinds of menu item, including plain GtkMenuItem,
|
||||
* GtkCheckMenuItem which can be checked/unchecked, GtkRadioMenuItem
|
||||
* which is a check menu item that's in a mutually exclusive group,
|
||||
* GtkSeparatorMenuItem which is a separator bar, GtkTearoffMenuItem
|
||||
* which allows a GtkMenu to be torn off, and GtkImageMenuItem which
|
||||
* can place a GtkImage or other widget next to the menu text.
|
||||
*
|
||||
* A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
|
||||
* up when the menu item is selected. Typically, all menu items in a menu bar
|
||||
* have submenus.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_menu (gint depth)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkRadioMenuItem *last_item;
|
||||
char buf[32];
|
||||
int i, j;
|
||||
|
||||
if (depth < 1)
|
||||
return NULL;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
last_item = NULL;
|
||||
|
||||
for (i = 0, j = 1; i < 5; i++, j++)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
|
||||
sprintf (buf, "item %2d - %d", depth, j);
|
||||
|
||||
menu_item = gtk_radio_menu_item_new_with_label_from_widget (NULL, buf);
|
||||
gtk_radio_menu_item_join_group (GTK_RADIO_MENU_ITEM (menu_item), last_item);
|
||||
last_item = GTK_RADIO_MENU_ITEM (menu_item);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
gtk_widget_show (menu_item);
|
||||
if (i == 3)
|
||||
gtk_widget_set_sensitive (menu_item, FALSE);
|
||||
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), create_menu (depth - 1));
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
static void
|
||||
change_orientation (GtkWidget *button,
|
||||
GtkWidget *menubar)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkOrientation orientation;
|
||||
|
||||
parent = gtk_widget_get_parent (menubar);
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_menus (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *button;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *menubar;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Menus");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK(gtk_widget_destroyed), &window);
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), box1);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_widget_set_hexpand (menubar, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box1), menubar);
|
||||
|
||||
menu = create_menu (2);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("bar");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_container_add (GTK_CONTAINER (box1), box2);
|
||||
|
||||
button = gtk_button_new_with_label ("Flip");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (change_orientation), menubar);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK(gtk_widget_destroy), window);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
gtk_window_set_default_widget (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -4,7 +4,6 @@ demos = files([
|
||||
'application_demo.c',
|
||||
'assistant.c',
|
||||
'builder.c',
|
||||
'changedisplay.c',
|
||||
'clipboard.c',
|
||||
'colorsel.c',
|
||||
'combobox.c',
|
||||
@@ -44,7 +43,6 @@ demos = files([
|
||||
'flowbox.c',
|
||||
'list_store.c',
|
||||
'markup.c',
|
||||
'menus.c',
|
||||
'modelbutton.c',
|
||||
'overlay.c',
|
||||
'overlay2.c',
|
||||
|
||||
+10
-10
@@ -75,11 +75,11 @@
|
||||
<property name="adjustment">adjustment2</property>
|
||||
<property name="hexpand">1</property>
|
||||
<marks>
|
||||
<mark value="0" position="bottom"/>
|
||||
<mark value="1" position="bottom"/>
|
||||
<mark value="2" position="bottom"/>
|
||||
<mark value="3" position="bottom"/>
|
||||
<mark value="4" position="bottom"/>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="1" position="bottom"></mark>
|
||||
<mark value="2" position="bottom"></mark>
|
||||
<mark value="3" position="bottom"></mark>
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_marks"/>
|
||||
@@ -115,11 +115,11 @@
|
||||
<relation type="labelled-by" target="label_discrete"/>
|
||||
</accessibility>
|
||||
<marks>
|
||||
<mark value="0" position="bottom"/>
|
||||
<mark value="1" position="bottom"/>
|
||||
<mark value="2" position="bottom"/>
|
||||
<mark value="3" position="bottom"/>
|
||||
<mark value="4" position="bottom"/>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="1" position="bottom"></mark>
|
||||
<mark value="2" position="bottom"></mark>
|
||||
<mark value="3" position="bottom"></mark>
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
|
||||
+210
-211
@@ -6,236 +6,235 @@
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="end">
|
||||
<object class="GtkLabel" id="fps">
|
||||
</object>
|
||||
<object class="GtkLabel" id="fps"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="margin">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="show-arrow">0</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="margin">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-chars">10</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip_text">Switch it</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Hi, I am a button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">And I'm another button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">This is a button party!</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Plain</property>
|
||||
<property name="halign">end</property>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="show-arrow">0</property>
|
||||
<style>
|
||||
<class name="primary-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
<style>
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-chars">10</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip_text">Switch it</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Destructive</property>
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="destructive-action"/>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Hi, I am a button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">And I'm another button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">This is a button party!</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Suggested</property>
|
||||
<object class="GtkToolbar">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Plain</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Destructive</property>
|
||||
<style>
|
||||
<class name="destructive-action"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">Suggested</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<interface>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
@@ -92,6 +93,7 @@
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip_text">Switch it</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Drag 'n Drop */
|
||||
static const char *target_table[] = {
|
||||
"text/uri-list"
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -76,30 +73,11 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
|
||||
gtk_tree_model_filter_refilter (win->filter_model);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
get_icon (GtkWidget *image, const gchar *name, gint size)
|
||||
{
|
||||
GtkIconInfo *info;
|
||||
GtkStyleContext *context;
|
||||
GdkTexture *texture;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
context = gtk_widget_get_style_context (image);
|
||||
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, size, 0);
|
||||
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL));
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (info);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
set_image (GtkWidget *image, const gchar *name, gint size)
|
||||
{
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
|
||||
gtk_drag_source_set_icon_name (image, name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -365,78 +343,107 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
|
||||
gtk_list_box_unselect_all (GTK_LIST_BOX (win->context_list));
|
||||
}
|
||||
|
||||
static void
|
||||
get_image_data (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
static GdkPaintable *
|
||||
get_image_paintable (GtkImage *image)
|
||||
{
|
||||
GtkWidget *image;
|
||||
const gchar *name;
|
||||
gint size;
|
||||
GdkPixbuf *pixbuf;
|
||||
const gchar *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconInfo *icon_info;
|
||||
int size;
|
||||
|
||||
image = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
||||
name = gtk_image_get_icon_name (GTK_IMAGE (image));
|
||||
size = gtk_image_get_pixel_size (GTK_IMAGE (image));
|
||||
|
||||
pixbuf = get_icon (image, name, size);
|
||||
gtk_selection_data_set_pixbuf (selection, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
switch (gtk_image_get_storage_type (image))
|
||||
{
|
||||
case GTK_IMAGE_PAINTABLE:
|
||||
return g_object_ref (gtk_image_get_paintable (image));
|
||||
case GTK_IMAGE_ICON_NAME:
|
||||
icon_name = gtk_image_get_icon_name (image);
|
||||
size = gtk_image_get_pixel_size (image);
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size,
|
||||
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon_info == NULL)
|
||||
return NULL;
|
||||
return gtk_icon_info_load_icon (icon_info, NULL);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_scalable_image_data (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
drag_begin (GtkDragSource *source,
|
||||
GdkDrag *drag,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gchar *uris[2];
|
||||
GtkIconInfo *info;
|
||||
GtkWidget *image;
|
||||
GFile *file;
|
||||
const gchar *name;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
image = gtk_bin_get_child (GTK_BIN (widget));
|
||||
name = gtk_image_get_icon_name (GTK_IMAGE (image));
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
w = gdk_paintable_get_intrinsic_width (paintable);
|
||||
h = gdk_paintable_get_intrinsic_height (paintable);
|
||||
gtk_drag_source_set_icon (source, paintable, w, h);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_texture (GValue *value,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
|
||||
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
g_value_set_object (value, paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
get_file (GValue *value,
|
||||
gpointer data)
|
||||
{
|
||||
const char *name;
|
||||
GtkIconInfo *info;
|
||||
GFile *file;
|
||||
|
||||
name = gtk_image_get_icon_name (GTK_IMAGE (data));
|
||||
|
||||
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, -1, 0);
|
||||
file = g_file_new_for_path (gtk_icon_info_get_filename (info));
|
||||
uris[0] = g_file_get_uri (file);
|
||||
uris[1] = NULL;
|
||||
|
||||
gtk_selection_data_set_uris (selection, uris);
|
||||
|
||||
g_free (uris[0]);
|
||||
g_object_unref (info);
|
||||
g_value_set_object (value, file);
|
||||
g_object_unref (file);
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_image_dnd (GtkWidget *image)
|
||||
{
|
||||
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
|
||||
gtk_drag_source_add_image_targets (image);
|
||||
g_signal_connect (image, "drag-data-get", G_CALLBACK (get_image_data), NULL);
|
||||
GdkContentProvider *content;
|
||||
GtkDragSource *source;
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
content = gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
|
||||
gtk_drag_source_set_content (source, content);
|
||||
g_object_unref (content);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_scalable_image_dnd (GtkWidget *image)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GdkContentFormats *targets;
|
||||
GdkContentProvider *content;
|
||||
GtkDragSource *source;
|
||||
|
||||
parent = gtk_widget_get_parent (image);
|
||||
targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table));
|
||||
gtk_drag_source_set (parent, GDK_BUTTON1_MASK,
|
||||
targets,
|
||||
GDK_ACTION_COPY);
|
||||
gdk_content_formats_unref (targets);
|
||||
source = gtk_drag_source_new ();
|
||||
content = gdk_content_provider_new_with_callback (G_TYPE_FILE, get_file, image);
|
||||
gtk_drag_source_set_content (source, content);
|
||||
g_object_unref (content);
|
||||
|
||||
g_signal_connect (parent, "drag-data-get", G_CALLBACK (get_scalable_image_data), NULL);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -446,8 +453,7 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
list = gdk_content_formats_new (NULL, 0);
|
||||
list = gtk_content_formats_add_text_targets (list);
|
||||
list = gdk_content_formats_new_for_gtype (G_TYPE_STRING);
|
||||
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (win->list),
|
||||
GDK_BUTTON1_MASK,
|
||||
list,
|
||||
@@ -459,7 +465,6 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
setup_image_dnd (win->image3);
|
||||
setup_image_dnd (win->image4);
|
||||
setup_image_dnd (win->image5);
|
||||
setup_image_dnd (win->image6);
|
||||
setup_scalable_image_dnd (win->image6);
|
||||
|
||||
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, context_free);
|
||||
|
||||
@@ -1053,27 +1053,6 @@ row_activated (GtkListBox *box, GtkListBoxRow *row)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_accel (GtkApplication *app, GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *accel_label;
|
||||
const gchar *action;
|
||||
gchar **accels;
|
||||
guint key;
|
||||
GdkModifierType mods;
|
||||
|
||||
accel_label = gtk_bin_get_child (GTK_BIN (widget));
|
||||
g_assert (GTK_IS_ACCEL_LABEL (accel_label));
|
||||
|
||||
action = gtk_actionable_get_action_name (GTK_ACTIONABLE (widget));
|
||||
accels = gtk_application_get_accels_for_action (app, action);
|
||||
|
||||
gtk_accelerator_parse (accels[0], &key, &mods);
|
||||
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (accel_label), key, mods);
|
||||
|
||||
g_strfreev (accels);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkTextView tv;
|
||||
@@ -1663,6 +1642,7 @@ static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkBuilderScope *scope;
|
||||
GtkWindow *window;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *widget2;
|
||||
@@ -1716,18 +1696,23 @@ activate (GApplication *app)
|
||||
g_object_unref (provider);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
|
||||
gtk_builder_add_callback_symbol (builder, "on_record_button_toggled", (GCallback)on_record_button_toggled);
|
||||
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
|
||||
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"on_entry_icon_release", (GCallback)on_entry_icon_release,
|
||||
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
|
||||
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
|
||||
"on_record_button_toggled", (GCallback)on_record_button_toggled,
|
||||
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||
"on_range_to_changed", (GCallback)on_range_to_changed,
|
||||
"tab_close_cb", (GCallback)tab_close_cb,
|
||||
"increase_icon_size", (GCallback)increase_icon_size,
|
||||
"decrease_icon_size", (GCallback)decrease_icon_size,
|
||||
"reset_icon_size", (GCallback)reset_icon_size,
|
||||
"osd_frame_pressed", (GCallback)osd_frame_pressed,
|
||||
NULL);
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
|
||||
|
||||
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
||||
@@ -1857,13 +1842,6 @@ activate (GApplication *app)
|
||||
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
|
||||
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "quitmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "deletemenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "searchmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "darkmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "aboutmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "bgmenuitem")));
|
||||
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton1");
|
||||
@@ -2022,6 +2000,13 @@ toggle_action (GSimpleAction *action,
|
||||
g_variant_new_boolean (!g_variant_get_boolean (state)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
quit_timeout (gpointer data)
|
||||
{
|
||||
exit (0);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -2087,6 +2072,9 @@ main (int argc, char *argv[])
|
||||
|
||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0, G_OPTION_ARG_NONE, "Show program version", NULL);
|
||||
|
||||
if (g_getenv ("GTK_DEBUG_AUTO_QUIT"))
|
||||
g_timeout_add (500, quit_timeout, NULL);
|
||||
|
||||
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
@@ -1500,6 +1500,10 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="value">.5</property>
|
||||
<property name="halign">center</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1515,6 +1519,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
|
||||
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -1809,260 +1814,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="menu-model">menu_bar_model</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuBar">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem1">
|
||||
<property name="label" translatable="yes">File</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu1">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem101">
|
||||
<property name="label" translatable="yes">_New</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem102">
|
||||
<property name="label" translatable="yes">_Open</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem103">
|
||||
<property name="label" translatable="yes">_Save</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem104">
|
||||
<property name="label" translatable="yes">Save _As</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem1"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="quitmenuitem">
|
||||
<property name="label" translatable="yes">_Quit</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem2">
|
||||
<property name="label" translatable="yes">Edit</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu2">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem106">
|
||||
<property name="label" translatable="yes">Cu_t</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem107">
|
||||
<property name="label" translatable="yes">_Copy</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem108">
|
||||
<property name="label" translatable="yes">_Paste</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="deletemenuitem">
|
||||
<property name="label" translatable="yes">_Delete</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.delete</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="searchmenuitem">
|
||||
<property name="label" translatable="yes">_Search</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.search</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="checksmenuitem">
|
||||
<property name="label">_Checks</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="checkssubmenu">
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem1">
|
||||
<property name="label">_Check</property>
|
||||
<property name="active">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem2">
|
||||
<property name="label">_Check</property>
|
||||
<property name="active">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem3">
|
||||
<property name="label">_Check</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem4">
|
||||
<property name="label">_Check</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem5">
|
||||
<property name="label">_Check</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="checkmenuitem6">
|
||||
<property name="label">_Check</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="radiosmenuitem">
|
||||
<property name="label">_Radios</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="radiossubmenu">
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem1">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="active">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem2">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="active">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem3">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem4">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem5">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioMenuItem" id="radiomenuitem6">
|
||||
<property name="label">_Radio</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem3">
|
||||
<property name="label" translatable="yes">View</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="view-menu">
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="darkmenuitem">
|
||||
<property name="label">_Dark theme</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.dark</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="toolbarmenuitem">
|
||||
<property name="label">_Toolbar</property>
|
||||
<property name="active">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="statusbarmenuitem">
|
||||
<property name="label">_Statusbar</property>
|
||||
<property name="active">1</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.statusbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="bgmenuitem">
|
||||
<property name="label">_Select Background</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">win.background</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="menuitem4">
|
||||
<property name="label" translatable="yes">Help</property>
|
||||
<property name="use-underline">1</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="menu3">
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="aboutmenuitem">
|
||||
<property name="label" translatable="yes">_About</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="action-name">app.about</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<child>
|
||||
@@ -3198,6 +2949,10 @@ bad things might happen.</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -3205,6 +2960,7 @@ bad things might happen.</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -3219,6 +2975,7 @@ bad things might happen.</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -3243,6 +3000,7 @@ bad things might happen.</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -3269,6 +3027,7 @@ bad things might happen.</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -3684,50 +3443,50 @@ bad things might happen.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">basement</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Basement</property>
|
||||
<property name="role">title</property>
|
||||
<property name="menu-name">main</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Berk</property>
|
||||
<property name="action-name">app.berk</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Broni</property>
|
||||
<property name="action-name">app.broni</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Drutt</property>
|
||||
<property name="action-name">app.drutt</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">The Thing Upstairs</property>
|
||||
<property name="action-name">app.upstairs</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<property name="name">basement</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Basement</property>
|
||||
<property name="role">title</property>
|
||||
<property name="menu-name">main</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Berk</property>
|
||||
<property name="action-name">app.berk</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Broni</property>
|
||||
<property name="action-name">app.broni</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Drutt</property>
|
||||
<property name="action-name">app.drutt</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">The Thing Upstairs</property>
|
||||
<property name="action-name">app.upstairs</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -544,8 +544,6 @@ GdkSeatCapabilities
|
||||
GdkGrabStatus
|
||||
GdkSeatGrabPrepareFunc
|
||||
gdk_seat_get_display
|
||||
gdk_seat_grab
|
||||
gdk_seat_ungrab
|
||||
gdk_seat_get_capabilities
|
||||
gdk_seat_get_pointer
|
||||
gdk_seat_get_keyboard
|
||||
|
||||
@@ -30,6 +30,7 @@ GskRenderNodeType
|
||||
gsk_render_node_get_node_type
|
||||
gsk_render_node_draw
|
||||
GskSerializationError
|
||||
GskParseErrorFunc
|
||||
gsk_render_node_serialize
|
||||
gsk_render_node_deserialize
|
||||
gsk_render_node_write_to_file
|
||||
@@ -182,6 +183,7 @@ gsk_transform_perspective
|
||||
gsk_transform_equal
|
||||
<SUBSECTION>
|
||||
gsk_transform_transform_bounds
|
||||
gsk_transform_transform_point
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_TRANSFORM
|
||||
gsk_transform_get_type
|
||||
|
||||
@@ -314,8 +314,8 @@
|
||||
be connected to an action just by setting the ::action-name
|
||||
property. If the action has a parameter, you will also need
|
||||
to set the ::action-target property.
|
||||
Widgets that implement GtkAction include GtkSwitch, GtkButton,
|
||||
GtkMenuItem and their respective subclasses.
|
||||
Widgets that implement GtkActionable include GtkSwitch, GtkButton,
|
||||
and their respective subclasses.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
||||
@@ -49,12 +49,16 @@
|
||||
<xi:include href="xml/gtkmaplistmodel.xml" />
|
||||
<xi:include href="xml/gtkslicelistmodel.xml" />
|
||||
<xi:include href="xml/gtksortlistmodel.xml" />
|
||||
<xi:include href="xml/gtktreelistmodel.xml" />
|
||||
<xi:include href="xml/gtkselectionmodel.xml" />
|
||||
<xi:include href="xml/gtknoselection.xml" />
|
||||
<xi:include href="xml/gtksingleselection.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Trees">
|
||||
<xi:include href="xml/gtktreelistrow.xml" />
|
||||
<xi:include href="xml/gtktreelistmodel.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Application">
|
||||
<title>Application support</title>
|
||||
<xi:include href="xml/gtkapplication.xml" />
|
||||
@@ -66,11 +70,13 @@
|
||||
<title>Interface builder</title>
|
||||
<xi:include href="xml/gtkbuilder.xml" />
|
||||
<xi:include href="xml/gtkbuildable.xml" />
|
||||
<xi:include href="xml/gtkbuilderscope.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="WindowWidgets">
|
||||
<title>Windows</title>
|
||||
<xi:include href="xml/gtkroot.xml" />
|
||||
<xi:include href="xml/gtknative.xml" />
|
||||
<xi:include href="xml/gtkwindow.xml" />
|
||||
<xi:include href="xml/gtkdialog.xml" />
|
||||
<xi:include href="xml/gtkmessagedialog.xml" />
|
||||
@@ -211,12 +217,6 @@
|
||||
<title>Menus, Combo Box, Toolbar</title>
|
||||
<xi:include href="xml/gtkcombobox.xml" />
|
||||
<xi:include href="xml/gtkcomboboxtext.xml" />
|
||||
<xi:include href="xml/gtkmenu.xml" />
|
||||
<xi:include href="xml/gtkmenubar.xml" />
|
||||
<xi:include href="xml/gtkmenuitem.xml" />
|
||||
<xi:include href="xml/gtkradiomenuitem.xml" />
|
||||
<xi:include href="xml/gtkcheckmenuitem.xml" />
|
||||
<xi:include href="xml/gtkseparatormenuitem.xml" />
|
||||
<xi:include href="xml/gtktoolshell.xml" />
|
||||
<xi:include href="xml/gtktoolbar.xml" />
|
||||
<xi:include href="xml/gtktoolitem.xml" />
|
||||
@@ -305,7 +305,6 @@
|
||||
<xi:include href="xml/gtkwidget.xml" />
|
||||
<xi:include href="xml/gtkcontainer.xml" />
|
||||
<xi:include href="xml/gtkbin.xml" />
|
||||
<xi:include href="xml/gtkmenushell.xml" />
|
||||
<xi:include href="xml/gtkrange.xml" />
|
||||
<xi:include href="xml/gtkimcontext.xml" />
|
||||
<xi:include href="xml/gtknativedialog.xml" />
|
||||
@@ -345,6 +344,13 @@
|
||||
<xi:include href="xml/gtkpadcontroller.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
<title>Data exchange, clipboards and Drag-and-Drop</title>
|
||||
<xi:include href="xml/gtkdragsource.xml"/>
|
||||
<xi:include href="xml/gtkdragicon.xml"/>
|
||||
<xi:include href="xml/gtkdroptarget.xml"/>
|
||||
</chapter>
|
||||
|
||||
</part>
|
||||
|
||||
<part id="gtkbase">
|
||||
@@ -353,7 +359,6 @@
|
||||
<xi:include href="xml/gtkfeatures.xml" />
|
||||
<xi:include href="xml/gtkaccelgroup.xml" />
|
||||
<xi:include href="xml/gtkaccelmap.xml" />
|
||||
<xi:include href="xml/gtkdnd.xml" />
|
||||
<xi:include href="xml/gtksettings.xml" />
|
||||
<xi:include href="xml/gtkbindings.xml" />
|
||||
<xi:include href="xml/gtkenums.xml" />
|
||||
|
||||
@@ -213,7 +213,6 @@ gtk_adjustment_get_type
|
||||
<TITLE>GtkAssistant</TITLE>
|
||||
GtkAssistant
|
||||
GtkAssistantPage
|
||||
GtkAssistantClass
|
||||
gtk_assistant_new
|
||||
gtk_assistant_get_page
|
||||
gtk_assistant_get_pages
|
||||
@@ -258,7 +257,6 @@ gtk_assistant_get_type
|
||||
<FILE>gtkaspectframe</FILE>
|
||||
<TITLE>GtkAspectFrame</TITLE>
|
||||
GtkAspectFrame
|
||||
GtkAspectFrameClass
|
||||
gtk_aspect_frame_new
|
||||
gtk_aspect_frame_set
|
||||
<SUBSECTION Standard>
|
||||
@@ -369,7 +367,6 @@ gtk_center_layout_get_type
|
||||
<FILE>gtklistbox</FILE>
|
||||
<TITLE>GtkListBox</TITLE>
|
||||
GtkListBox
|
||||
GtkListBoxClass
|
||||
GtkListBoxRow
|
||||
GtkListBoxRowClass
|
||||
GtkListBoxFilterFunc
|
||||
@@ -516,21 +513,41 @@ GTK_BUILDABLE_CLASS
|
||||
GTK_BUILDABLE_GET_IFACE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbuilderscope</FILE>
|
||||
<TITLE>GtkBuilderScope</TITLE>
|
||||
gtk_builder_cscope_new
|
||||
gtk_builder_cscope_add_callback_symbol
|
||||
gtk_builder_cscope_add_callback_symbols
|
||||
gtk_builder_cscope_lookup_callback_symbol
|
||||
<SUBSECTION Standard>
|
||||
GTK_BUILDER_SCOPE
|
||||
GTK_IS_BUILDER_SCOPE
|
||||
GTK_TYPE_BUILDER_SCOPE
|
||||
GTK_BUILDER_SCOPE_INTERFACE
|
||||
GTK_IS_BUILDER_SCOPE_INTERFACE
|
||||
GTK_BUILDER_SCOPE_GET_INTERFACE
|
||||
GTK_BUILDER_CSCOPE
|
||||
GTK_IS_BUILDER_CSCOPE
|
||||
GTK_TYPE_BUILDER_CSCOPE
|
||||
GTK_BUILDER_CSCOPE_CLASS
|
||||
GTK_IS_BUILDER_CSCOPE_CLASS
|
||||
GTK_BUILDER_CSCOPE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_builder_scope_get_type
|
||||
gtk_builder_cscope_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbuilder</FILE>
|
||||
<TITLE>GtkBuilder</TITLE>
|
||||
GtkBuilder
|
||||
GtkBuilderClosureFunc
|
||||
GtkBuilderError
|
||||
gtk_builder_new
|
||||
gtk_builder_new_from_file
|
||||
gtk_builder_new_from_resource
|
||||
gtk_builder_new_from_string
|
||||
gtk_builder_add_callback_symbol
|
||||
gtk_builder_add_callback_symbols
|
||||
gtk_builder_lookup_callback_symbol
|
||||
gtk_builder_create_closure
|
||||
gtk_builder_create_cclosure
|
||||
gtk_builder_add_from_file
|
||||
gtk_builder_add_from_resource
|
||||
gtk_builder_add_from_string
|
||||
@@ -541,10 +558,13 @@ gtk_builder_extend_with_template
|
||||
gtk_builder_get_object
|
||||
gtk_builder_get_objects
|
||||
gtk_builder_expose_object
|
||||
gtk_builder_set_current_object
|
||||
gtk_builder_get_current_object
|
||||
gtk_builder_set_scope
|
||||
gtk_builder_get_scope
|
||||
gtk_builder_set_translation_domain
|
||||
gtk_builder_get_translation_domain
|
||||
gtk_builder_get_type_from_name
|
||||
gtk_builder_set_closure_func
|
||||
gtk_builder_value_from_string
|
||||
gtk_builder_value_from_string_type
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE
|
||||
@@ -560,7 +580,6 @@ GTK_BUILDER_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_builder_get_type
|
||||
gtk_builder_error_quark
|
||||
GtkBuilderPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -655,34 +674,6 @@ GTK_CHECK_BUTTON_GET_CLASS
|
||||
gtk_check_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcheckmenuitem</FILE>
|
||||
GtkCheckMenuItem
|
||||
GtkCheckMenuItemClass
|
||||
<TITLE>GtkCheckMenuItem</TITLE>
|
||||
gtk_check_menu_item_new
|
||||
gtk_check_menu_item_new_with_label
|
||||
gtk_check_menu_item_new_with_mnemonic
|
||||
gtk_check_menu_item_get_active
|
||||
gtk_check_menu_item_set_active
|
||||
gtk_check_menu_item_toggled
|
||||
gtk_check_menu_item_get_inconsistent
|
||||
gtk_check_menu_item_set_inconsistent
|
||||
gtk_check_menu_item_set_draw_as_radio
|
||||
gtk_check_menu_item_get_draw_as_radio
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CHECK_MENU_ITEM
|
||||
GTK_IS_CHECK_MENU_ITEM
|
||||
GTK_TYPE_CHECK_MENU_ITEM
|
||||
GTK_CHECK_MENU_ITEM_CLASS
|
||||
GTK_IS_CHECK_MENU_ITEM_CLASS
|
||||
GTK_CHECK_MENU_ITEM_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkCheckMenuItemPrivate
|
||||
gtk_check_menu_item_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorbutton</FILE>
|
||||
<TITLE>GtkColorButton</TITLE>
|
||||
@@ -784,7 +775,6 @@ gtk_container_add
|
||||
gtk_container_remove
|
||||
gtk_container_foreach
|
||||
gtk_container_get_children
|
||||
gtk_container_get_path_for_child
|
||||
gtk_container_get_focus_vadjustment
|
||||
gtk_container_set_focus_vadjustment
|
||||
gtk_container_get_focus_hadjustment
|
||||
@@ -1110,7 +1100,6 @@ gtk_entry_completion_get_type
|
||||
<FILE>gtkexpander</FILE>
|
||||
<TITLE>GtkExpander</TITLE>
|
||||
GtkExpander
|
||||
GtkExpanderClass
|
||||
gtk_expander_new
|
||||
gtk_expander_new_with_mnemonic
|
||||
gtk_expander_set_expanded
|
||||
@@ -1257,7 +1246,6 @@ GtkFileChooserDialogPrivate
|
||||
<FILE>gtkfilechooserwidget</FILE>
|
||||
<TITLE>GtkFileChooserWidget</TITLE>
|
||||
GtkFileChooserWidget
|
||||
GtkFileChooserWidgetClass
|
||||
gtk_file_chooser_widget_new
|
||||
<SUBSECTION Standard>
|
||||
GTK_FILE_CHOOSER_WIDGET
|
||||
@@ -1275,7 +1263,6 @@ GtkFileChooserWidgetPrivate
|
||||
<FILE>gtkfilechooserbutton</FILE>
|
||||
<TITLE>GtkFileChooserButton</TITLE>
|
||||
GtkFileChooserButton
|
||||
GtkFileChooserButtonClass
|
||||
gtk_file_chooser_button_new
|
||||
gtk_file_chooser_button_new_with_dialog
|
||||
gtk_file_chooser_button_get_title
|
||||
@@ -1451,7 +1438,6 @@ gtk_font_chooser_get_type
|
||||
<FILE>gtkfontchooserwidget</FILE>
|
||||
<TITLE>GtkFontChooserWidget</TITLE>
|
||||
GtkFontChooserWidget
|
||||
GtkFontChooserWidgetClass
|
||||
gtk_font_chooser_widget_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -1471,7 +1457,6 @@ gtk_font_chooser_widget_get_type
|
||||
<FILE>gtkfontchooserdialog</FILE>
|
||||
<TITLE>GtkFontChooserDialog</TITLE>
|
||||
GtkFontChooserDialog
|
||||
GtkFontChooserDialogClass
|
||||
gtk_font_chooser_dialog_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -1776,7 +1761,6 @@ GtkLabelSelectionInfo
|
||||
<FILE>gtklinkbutton</FILE>
|
||||
<TITLE>GtkLinkButton</TITLE>
|
||||
GtkLinkButton
|
||||
GtkLinkButtonClass
|
||||
gtk_link_button_new
|
||||
gtk_link_button_new_with_label
|
||||
gtk_link_button_get_uri
|
||||
@@ -1817,80 +1801,15 @@ GTK_MAP_LIST_MODEL_GET_CLASS
|
||||
gtk_map_list_model_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenu</FILE>
|
||||
<TITLE>GtkMenu</TITLE>
|
||||
GtkMenu
|
||||
gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
GtkPopoverMenuFlags
|
||||
gtk_menu_new_from_model_full
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
gtk_menu_popup_at_pointer
|
||||
gtk_menu_set_accel_group
|
||||
gtk_menu_get_accel_group
|
||||
gtk_menu_set_accel_path
|
||||
gtk_menu_get_accel_path
|
||||
gtk_menu_set_monitor
|
||||
gtk_menu_get_monitor
|
||||
gtk_menu_place_on_monitor
|
||||
gtk_menu_set_reserve_toggle_size
|
||||
gtk_menu_get_reserve_toggle_size
|
||||
<SUBSECTION>
|
||||
gtk_menu_popdown
|
||||
gtk_menu_reposition
|
||||
gtk_menu_get_active
|
||||
gtk_menu_set_active
|
||||
gtk_menu_attach_to_widget
|
||||
gtk_menu_detach
|
||||
gtk_menu_get_attach_widget
|
||||
gtk_menu_get_for_attach_widget
|
||||
GtkMenuDetachFunc
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU
|
||||
GTK_IS_MENU
|
||||
GTK_TYPE_MENU
|
||||
GTK_MENU_CLASS
|
||||
GTK_IS_MENU_CLASS
|
||||
GTK_MENU_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkMenuPrivate
|
||||
gtk_menu_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenubar</FILE>
|
||||
<TITLE>GtkMenuBar</TITLE>
|
||||
GtkMenuBar
|
||||
gtk_menu_bar_new
|
||||
gtk_menu_bar_new_from_model
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU_BAR
|
||||
GTK_IS_MENU_BAR
|
||||
GTK_TYPE_MENU_BAR
|
||||
GTK_MENU_BAR_CLASS
|
||||
GTK_IS_MENU_BAR_CLASS
|
||||
GTK_MENU_BAR_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkMenuBarPrivate
|
||||
gtk_menu_bar_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenubutton</FILE>
|
||||
<TITLE>GtkMenuButton</TITLE>
|
||||
GtkMenuButton
|
||||
gtk_menu_button_new
|
||||
gtk_menu_button_set_popup
|
||||
gtk_menu_button_get_popup
|
||||
gtk_menu_button_set_popover
|
||||
gtk_menu_button_get_popover
|
||||
gtk_menu_button_set_menu_model
|
||||
gtk_menu_button_get_menu_model
|
||||
gtk_menu_button_set_use_popover
|
||||
gtk_menu_button_get_use_popover
|
||||
GtkArrowType
|
||||
gtk_menu_button_set_direction
|
||||
gtk_menu_button_get_direction
|
||||
@@ -1904,6 +1823,7 @@ gtk_menu_button_set_relief
|
||||
gtk_menu_button_get_relief
|
||||
gtk_menu_button_popup
|
||||
gtk_menu_button_popdown
|
||||
GtkMenuButtonCreatePopupFunc
|
||||
gtk_menu_button_set_create_popup_func
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_MENU_BUTTON
|
||||
@@ -1917,72 +1837,6 @@ GtkMenuButtonPrivate
|
||||
gtk_menu_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenuitem</FILE>
|
||||
<TITLE>GtkMenuItem</TITLE>
|
||||
GtkMenuItem
|
||||
GtkMenuItemClass
|
||||
gtk_menu_item_new
|
||||
gtk_menu_item_new_with_label
|
||||
gtk_menu_item_new_with_mnemonic
|
||||
gtk_menu_item_get_label
|
||||
gtk_menu_item_set_label
|
||||
gtk_menu_item_get_use_underline
|
||||
gtk_menu_item_set_use_underline
|
||||
gtk_menu_item_set_submenu
|
||||
gtk_menu_item_get_submenu
|
||||
gtk_menu_item_set_accel_path
|
||||
gtk_menu_item_get_accel_path
|
||||
gtk_menu_item_select
|
||||
gtk_menu_item_deselect
|
||||
gtk_menu_item_activate
|
||||
gtk_menu_item_toggle_size_request
|
||||
gtk_menu_item_toggle_size_allocate
|
||||
gtk_menu_item_get_reserve_indicator
|
||||
gtk_menu_item_set_reserve_indicator
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU_ITEM
|
||||
GTK_IS_MENU_ITEM
|
||||
GTK_TYPE_MENU_ITEM
|
||||
GTK_MENU_ITEM_CLASS
|
||||
GTK_IS_MENU_ITEM_CLASS
|
||||
GTK_MENU_ITEM_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkMenuItemPrivate
|
||||
gtk_menu_item_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmenushell</FILE>
|
||||
<TITLE>GtkMenuShell</TITLE>
|
||||
GtkMenuShell
|
||||
gtk_menu_shell_append
|
||||
gtk_menu_shell_prepend
|
||||
gtk_menu_shell_insert
|
||||
gtk_menu_shell_deactivate
|
||||
gtk_menu_shell_select_item
|
||||
gtk_menu_shell_select_first
|
||||
gtk_menu_shell_deselect
|
||||
gtk_menu_shell_activate_item
|
||||
gtk_menu_shell_cancel
|
||||
gtk_menu_shell_set_take_focus
|
||||
gtk_menu_shell_get_take_focus
|
||||
gtk_menu_shell_get_selected_item
|
||||
gtk_menu_shell_get_parent_shell
|
||||
gtk_menu_shell_bind_model
|
||||
GtkMenuDirectionType
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU_SHELL
|
||||
GTK_IS_MENU_SHELL
|
||||
GTK_TYPE_MENU_SHELL
|
||||
GTK_MENU_SHELL_CLASS
|
||||
GTK_IS_MENU_SHELL_CLASS
|
||||
GTK_MENU_SHELL_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkMenuShellPrivate
|
||||
gtk_menu_shell_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmessagedialog</FILE>
|
||||
<TITLE>GtkMessageDialog</TITLE>
|
||||
@@ -2245,31 +2099,6 @@ GtkRadioButtonPrivate
|
||||
gtk_radio_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkradiomenuitem</FILE>
|
||||
<TITLE>GtkRadioMenuItem</TITLE>
|
||||
GtkRadioMenuItem
|
||||
gtk_radio_menu_item_new
|
||||
gtk_radio_menu_item_new_with_label
|
||||
gtk_radio_menu_item_new_with_mnemonic
|
||||
gtk_radio_menu_item_new_from_widget
|
||||
gtk_radio_menu_item_new_with_label_from_widget
|
||||
gtk_radio_menu_item_new_with_mnemonic_from_widget
|
||||
gtk_radio_menu_item_set_group
|
||||
gtk_radio_menu_item_get_group
|
||||
gtk_radio_menu_item_join_group
|
||||
<SUBSECTION Standard>
|
||||
GTK_RADIO_MENU_ITEM
|
||||
GTK_IS_RADIO_MENU_ITEM
|
||||
GTK_TYPE_RADIO_MENU_ITEM
|
||||
GTK_RADIO_MENU_ITEM_CLASS
|
||||
GTK_IS_RADIO_MENU_ITEM_CLASS
|
||||
GTK_RADIO_MENU_ITEM_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkRadioMenuItemPrivate
|
||||
gtk_radio_menu_item_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkrange</FILE>
|
||||
<TITLE>GtkRange</TITLE>
|
||||
@@ -2471,7 +2300,6 @@ gtk_scrollbar_get_type
|
||||
<FILE>gtkscrolledwindow</FILE>
|
||||
<TITLE>GtkScrolledWindow</TITLE>
|
||||
GtkScrolledWindow
|
||||
GtkScrolledWindowClass
|
||||
gtk_scrolled_window_new
|
||||
gtk_scrolled_window_get_hadjustment
|
||||
gtk_scrolled_window_set_hadjustment
|
||||
@@ -2523,7 +2351,6 @@ GtkScrolledWindowPrivate
|
||||
<FILE>gtksearchbar</FILE>
|
||||
<TITLE>GtkSearchBar</TITLE>
|
||||
GtkSearchBar
|
||||
GtkSearchBarClass
|
||||
gtk_search_bar_new
|
||||
gtk_search_bar_connect_entry
|
||||
gtk_search_bar_get_search_mode
|
||||
@@ -2578,23 +2405,6 @@ gtk_separator_get_type
|
||||
GtkSeparatorPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkseparatormenuitem</FILE>
|
||||
<TITLE>GtkSeparatorMenuItem</TITLE>
|
||||
GtkSeparatorMenuItem
|
||||
GtkSeparatorMenuItemClass
|
||||
gtk_separator_menu_item_new
|
||||
<SUBSECTION Standard>
|
||||
GTK_SEPARATOR_MENU_ITEM
|
||||
GTK_SEPARATOR_MENU_ITEM_CLASS
|
||||
GTK_SEPARATOR_MENU_ITEM_GET_CLASS
|
||||
GTK_IS_SEPARATOR_MENU_ITEM
|
||||
GTK_IS_SEPARATOR_MENU_ITEM_CLASS
|
||||
GTK_TYPE_SEPARATOR_MENU_ITEM
|
||||
<SUBSECTION Private>
|
||||
gtk_separator_menu_item_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtksettings</FILE>
|
||||
<TITLE>GtkSettings</TITLE>
|
||||
@@ -3091,8 +2901,6 @@ gtk_text_view_get_iter_at_location
|
||||
gtk_text_view_get_iter_at_position
|
||||
gtk_text_view_buffer_to_window_coords
|
||||
gtk_text_view_window_to_buffer_coords
|
||||
gtk_text_view_set_border_window_size
|
||||
gtk_text_view_get_border_window_size
|
||||
gtk_text_view_forward_display_line
|
||||
gtk_text_view_backward_display_line
|
||||
gtk_text_view_forward_display_line_end
|
||||
@@ -3271,9 +3079,8 @@ gtk_tool_item_get_orientation
|
||||
gtk_tool_item_get_toolbar_style
|
||||
gtk_tool_item_get_text_alignment
|
||||
gtk_tool_item_get_text_orientation
|
||||
gtk_tool_item_retrieve_proxy_menu_item
|
||||
gtk_tool_item_get_proxy_menu_item
|
||||
gtk_tool_item_set_proxy_menu_item
|
||||
gtk_tool_item_set_overflow_text
|
||||
gtk_tool_item_get_overflow_text
|
||||
gtk_tool_item_rebuild_menu
|
||||
gtk_tool_item_toolbar_reconfigured
|
||||
gtk_tool_item_get_text_size_group
|
||||
@@ -3295,7 +3102,6 @@ GtkToolItemPrivate
|
||||
<FILE>gtkseparatortoolitem</FILE>
|
||||
<TITLE>GtkSeparatorToolItem</TITLE>
|
||||
GtkSeparatorToolItem
|
||||
GtkSeparatorToolItemClass
|
||||
gtk_separator_tool_item_new
|
||||
gtk_separator_tool_item_set_draw
|
||||
gtk_separator_tool_item_get_draw
|
||||
@@ -3347,10 +3153,9 @@ GtkToolButtonPrivate
|
||||
<FILE>gtkmenutoolbutton</FILE>
|
||||
<TITLE>GtkMenuToolButton</TITLE>
|
||||
GtkMenuToolButton
|
||||
GtkMenuToolButtonClass
|
||||
gtk_menu_tool_button_new
|
||||
gtk_menu_tool_button_set_menu
|
||||
gtk_menu_tool_button_get_menu
|
||||
gtk_menu_tool_button_set_popover
|
||||
gtk_menu_tool_button_get_popover
|
||||
gtk_menu_tool_button_set_arrow_tooltip_text
|
||||
gtk_menu_tool_button_set_arrow_tooltip_markup
|
||||
|
||||
@@ -3429,6 +3234,29 @@ GTK_TOOLTIP
|
||||
gtk_tooltip_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktreelistrow</FILE>
|
||||
<TITLE>GtkTreeListRow</TITLE>
|
||||
gtk_tree_list_row_get_item
|
||||
gtk_tree_list_row_set_expanded
|
||||
gtk_tree_list_row_get_expanded
|
||||
gtk_tree_list_row_is_expandable
|
||||
gtk_tree_list_row_get_position
|
||||
gtk_tree_list_row_get_depth
|
||||
gtk_tree_list_row_get_children
|
||||
gtk_tree_list_row_get_parent
|
||||
gtk_tree_list_row_get_child_row
|
||||
<SUBSECTION Standard>
|
||||
GTK_TREE_LIST_ROW
|
||||
GTK_IS_TREE_LIST_ROW
|
||||
GTK_TYPE_TREE_LIST_ROW
|
||||
GTK_TREE_LIST_ROW_CLASS
|
||||
GTK_IS_TREE_LIST_ROW_CLASS
|
||||
GTK_TREE_LIST_ROW_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_tree_list_row_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktreelistmodel</FILE>
|
||||
<TITLE>GtkTreeListModel</TITLE>
|
||||
@@ -3442,18 +3270,6 @@ gtk_tree_list_model_set_autoexpand
|
||||
gtk_tree_list_model_get_autoexpand
|
||||
gtk_tree_list_model_get_child_row
|
||||
gtk_tree_list_model_get_row
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_tree_list_row_get_item
|
||||
gtk_tree_list_row_set_expanded
|
||||
gtk_tree_list_row_get_expanded
|
||||
gtk_tree_list_row_is_expandable
|
||||
gtk_tree_list_row_get_position
|
||||
gtk_tree_list_row_get_depth
|
||||
gtk_tree_list_row_get_children
|
||||
gtk_tree_list_row_get_parent
|
||||
gtk_tree_list_row_get_child_row
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TREE_LIST_MODEL
|
||||
GTK_IS_TREE_LIST_MODEL
|
||||
@@ -3461,14 +3277,7 @@ GTK_TYPE_TREE_LIST_MODEL
|
||||
GTK_TREE_LIST_MODEL_CLASS
|
||||
GTK_IS_TREE_LIST_MODEL_CLASS
|
||||
GTK_TREE_LIST_MODEL_GET_CLASS
|
||||
GTK_TREE_LIST_ROW
|
||||
GTK_IS_TREE_LIST_ROW
|
||||
GTK_TYPE_TREE_LIST_ROW
|
||||
GTK_TREE_LIST_ROW_CLASS
|
||||
GTK_IS_TREE_LIST_ROW_CLASS
|
||||
GTK_TREE_LIST_ROW_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_tree_list_model_get_type
|
||||
gtk_tree_list_row_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -3614,7 +3423,6 @@ gtk_tree_model_filter_get_type
|
||||
<FILE>gtktreeselection</FILE>
|
||||
<TITLE>GtkTreeSelection</TITLE>
|
||||
GtkTreeSelection
|
||||
GtkTreeSelectionClass
|
||||
GtkTreeSelectionFunc
|
||||
GtkTreeSelectionForeachFunc
|
||||
gtk_tree_selection_set_mode
|
||||
@@ -3816,7 +3624,6 @@ gtk_tree_view_column_get_type
|
||||
<TITLE>GtkTreeView</TITLE>
|
||||
GtkTreeView
|
||||
GtkTreeViewDropPosition
|
||||
GtkTreeViewPrivate
|
||||
GtkTreeViewColumnDropFunc
|
||||
GtkTreeViewMappingFunc
|
||||
GtkTreeViewSearchEqualFunc
|
||||
@@ -3891,9 +3698,6 @@ gtk_tree_view_get_search_equal_func
|
||||
gtk_tree_view_set_search_equal_func
|
||||
gtk_tree_view_get_search_entry
|
||||
gtk_tree_view_set_search_entry
|
||||
GtkTreeViewSearchPositionFunc
|
||||
gtk_tree_view_get_search_position_func
|
||||
gtk_tree_view_set_search_position_func
|
||||
gtk_tree_view_get_fixed_height_mode
|
||||
gtk_tree_view_set_fixed_height_mode
|
||||
gtk_tree_view_get_hover_selection
|
||||
@@ -3932,7 +3736,6 @@ gtk_tree_view_get_type
|
||||
<FILE>gtkcellview</FILE>
|
||||
<TITLE>GtkCellView</TITLE>
|
||||
GtkCellView
|
||||
GtkCellViewClass
|
||||
gtk_cell_view_new
|
||||
gtk_cell_view_new_with_context
|
||||
gtk_cell_view_new_with_text
|
||||
@@ -4080,7 +3883,6 @@ GtkCellAreaContextPrivate
|
||||
<FILE>gtkcellareabox</FILE>
|
||||
<TITLE>GtkCellAreaBox</TITLE>
|
||||
GtkCellAreaBox
|
||||
GtkCellAreaBoxClass
|
||||
gtk_cell_area_box_new
|
||||
gtk_cell_area_box_pack_start
|
||||
gtk_cell_area_box_pack_end
|
||||
@@ -4360,7 +4162,6 @@ gtk_list_store_get_type
|
||||
<FILE>gtkviewport</FILE>
|
||||
<TITLE>GtkViewport</TITLE>
|
||||
GtkViewport
|
||||
GtkViewportClass
|
||||
gtk_viewport_new
|
||||
gtk_viewport_set_shadow_type
|
||||
gtk_viewport_get_shadow_type
|
||||
@@ -4610,7 +4411,6 @@ gtk_widget_get_layout_manager
|
||||
gtk_widget_should_layout
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_widget_get_path
|
||||
gtk_widget_get_style_context
|
||||
gtk_widget_reset_style
|
||||
gtk_widget_class_get_css_name
|
||||
@@ -4666,7 +4466,7 @@ gtk_widget_class_bind_template_child_internal_private
|
||||
gtk_widget_class_bind_template_child_full
|
||||
gtk_widget_class_bind_template_callback
|
||||
gtk_widget_class_bind_template_callback_full
|
||||
gtk_widget_class_set_closure_func
|
||||
gtk_widget_class_set_template_scope
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_widget_observe_children
|
||||
@@ -5095,7 +4895,6 @@ gtk_border_free
|
||||
<SUBSECTION>
|
||||
gtk_render_arrow
|
||||
gtk_render_background
|
||||
gtk_render_background_get_clip
|
||||
gtk_render_check
|
||||
gtk_render_expander
|
||||
gtk_render_focus
|
||||
@@ -5199,56 +4998,10 @@ GTK_TYPE_SELECTION_DATA
|
||||
gtk_selection_data_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkdnd</FILE>
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
GtkDestDefaults
|
||||
GtkDragResult
|
||||
|
||||
<SUBSECTION Destination Side>
|
||||
gtk_drag_dest_set
|
||||
gtk_drag_dest_unset
|
||||
gtk_drag_dest_find_target
|
||||
gtk_drag_dest_get_target_list
|
||||
gtk_drag_dest_set_target_list
|
||||
gtk_drag_dest_add_text_targets
|
||||
gtk_drag_dest_add_image_targets
|
||||
gtk_drag_dest_add_uri_targets
|
||||
gtk_drag_dest_set_track_motion
|
||||
gtk_drag_dest_get_track_motion
|
||||
gtk_drag_get_data
|
||||
gtk_drag_get_source_widget
|
||||
gtk_drag_highlight
|
||||
gtk_drag_unhighlight
|
||||
|
||||
<SUBSECTION Source Side>
|
||||
gtk_drag_begin
|
||||
gtk_drag_cancel
|
||||
gtk_drag_set_icon_widget
|
||||
gtk_drag_set_icon_paintable
|
||||
gtk_drag_set_icon_name
|
||||
gtk_drag_set_icon_gicon
|
||||
gtk_drag_set_icon_default
|
||||
gtk_drag_check_threshold
|
||||
gtk_drag_source_set
|
||||
gtk_drag_source_set_icon_name
|
||||
gtk_drag_source_set_icon_gicon
|
||||
gtk_drag_source_set_icon_paintable
|
||||
gtk_drag_source_unset
|
||||
gtk_drag_source_set_target_list
|
||||
gtk_drag_source_get_target_list
|
||||
gtk_drag_source_add_text_targets
|
||||
gtk_drag_source_add_image_targets
|
||||
gtk_drag_source_add_uri_targets
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbindings</FILE>
|
||||
<TITLE>Bindings</TITLE>
|
||||
GtkBindingSet
|
||||
GtkBindingEntry
|
||||
GtkBindingSignal
|
||||
GtkBindingArg
|
||||
gtk_binding_set_new
|
||||
gtk_binding_set_by_class
|
||||
gtk_binding_set_find
|
||||
@@ -5293,7 +5046,6 @@ GtkIconSize
|
||||
<TITLE>GtkIconTheme</TITLE>
|
||||
GtkIconInfo
|
||||
GtkIconTheme
|
||||
GtkIconThemeClass
|
||||
GtkIconLookupFlags
|
||||
GTK_ICON_THEME_ERROR
|
||||
GtkIconThemeError
|
||||
@@ -5323,7 +5075,6 @@ gtk_icon_info_get_base_size
|
||||
gtk_icon_info_get_base_scale
|
||||
gtk_icon_info_get_filename
|
||||
gtk_icon_info_load_icon
|
||||
gtk_icon_info_load_texture
|
||||
gtk_icon_info_load_icon_async
|
||||
gtk_icon_info_load_icon_finish
|
||||
gtk_icon_info_load_symbolic
|
||||
@@ -5827,7 +5578,6 @@ gtk_print_job_get_type
|
||||
<FILE>gtkpagesetupunixdialog</FILE>
|
||||
<TITLE>GtkPageSetupUnixDialog</TITLE>
|
||||
GtkPageSetupUnixDialog
|
||||
GtkPageSetupUnixDialogClass
|
||||
gtk_page_setup_unix_dialog_new
|
||||
gtk_page_setup_unix_dialog_set_page_setup
|
||||
gtk_page_setup_unix_dialog_get_page_setup
|
||||
@@ -6038,7 +5788,6 @@ gtk_grid_get_type
|
||||
<SECTION>
|
||||
<FILE>gtkswitch</FILE>
|
||||
GtkSwitch
|
||||
GtkSwitchClass
|
||||
gtk_switch_new
|
||||
gtk_switch_set_active
|
||||
gtk_switch_get_active
|
||||
@@ -6088,7 +5837,6 @@ GTK_IS_APP_CHOOSER_ONLINE_PK_CLASS
|
||||
<FILE>gtkappchooserbutton</FILE>
|
||||
<TITLE>GtkAppChooserButton</TITLE>
|
||||
GtkAppChooserButton
|
||||
GtkAppChooserButtonClass
|
||||
gtk_app_chooser_button_new
|
||||
gtk_app_chooser_button_append_custom_item
|
||||
gtk_app_chooser_button_append_separator
|
||||
@@ -6117,7 +5865,6 @@ gtk_app_chooser_button_get_type
|
||||
<FILE>gtkappchooserdialog</FILE>
|
||||
<TITLE>GtkAppChooserDialog</TITLE>
|
||||
GtkAppChooserDialog
|
||||
GtkAppChooserDialogClass
|
||||
gtk_app_chooser_dialog_new
|
||||
gtk_app_chooser_dialog_new_for_content_type
|
||||
gtk_app_chooser_dialog_get_widget
|
||||
@@ -6141,7 +5888,6 @@ gtk_app_chooser_dialog_get_type
|
||||
<FILE>gtkappchooserwidget</FILE>
|
||||
<TITLE>GtkAppChooserWidget</TITLE>
|
||||
GtkAppChooserWidget
|
||||
GtkAppChooserWidgetClass
|
||||
gtk_app_chooser_widget_new
|
||||
gtk_app_chooser_widget_set_show_default
|
||||
gtk_app_chooser_widget_get_show_default
|
||||
@@ -6173,7 +5919,6 @@ gtk_app_chooser_widget_get_type
|
||||
<FILE>gtklockbutton</FILE>
|
||||
<TITLE>GtkLockButton</TITLE>
|
||||
GtkLockButton
|
||||
GtkLockButtonClass
|
||||
|
||||
gtk_lock_button_new
|
||||
gtk_lock_button_get_permission
|
||||
@@ -6195,7 +5940,6 @@ GtkLockButtonPrivate
|
||||
<FILE>gtkoverlay</FILE>
|
||||
<TITLE>GtkOverlay</TITLE>
|
||||
GtkOverlay
|
||||
GtkOverlayClass
|
||||
|
||||
gtk_overlay_new
|
||||
gtk_overlay_add_overlay
|
||||
@@ -6245,7 +5989,6 @@ gtk_color_chooser_get_type
|
||||
<FILE>gtkcolorchooserwidget</FILE>
|
||||
<TITLE>GtkColorChooserWidget</TITLE>
|
||||
GtkColorChooserWidget
|
||||
GtkColorChooserWidgetClass
|
||||
gtk_color_chooser_widget_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -6405,7 +6148,6 @@ gtk_stack_switcher_get_type
|
||||
<FILE>gtkrevealer</FILE>
|
||||
<TITLE>GtkRevealer</TITLE>
|
||||
GtkRevealer
|
||||
GtkRevealerClass
|
||||
gtk_revealer_new
|
||||
gtk_revealer_get_reveal_child
|
||||
gtk_revealer_set_reveal_child
|
||||
@@ -6512,15 +6254,11 @@ gtk_popover_set_pointing_to
|
||||
gtk_popover_get_pointing_to
|
||||
gtk_popover_set_position
|
||||
gtk_popover_get_position
|
||||
GtkPopoverConstraint
|
||||
gtk_popover_set_constrain_to
|
||||
gtk_popover_get_constrain_to
|
||||
gtk_popover_set_autohide
|
||||
gtk_popover_get_autohide
|
||||
gtk_popover_set_has_arrow
|
||||
gtk_popover_get_has_arrow
|
||||
gtk_popover_set_default_widget
|
||||
gtk_popover_get_default_widget
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_POPOVER
|
||||
GTK_IS_POPOVER
|
||||
@@ -6707,6 +6445,8 @@ GtkEventControllerMotion
|
||||
gtk_event_controller_motion_new
|
||||
gtk_event_controller_motion_get_pointer_origin
|
||||
gtk_event_controller_motion_get_pointer_target
|
||||
gtk_event_controller_motion_contains_pointer
|
||||
gtk_event_controller_motion_is_pointer
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_EVENT_CONTROLLER_MOTION
|
||||
@@ -7275,8 +7015,8 @@ gtk_fixed_layout_new
|
||||
<SUBSECTION>
|
||||
GtkFixedLayoutChild
|
||||
|
||||
gtk_fixed_layout_child_set_position
|
||||
gtk_fixed_layout_child_get_position
|
||||
gtk_fixed_layout_child_set_transform
|
||||
gtk_fixed_layout_child_get_transform
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_FIXED_LAYOUT
|
||||
@@ -7405,3 +7145,69 @@ gtk_constraint_guide_get_max_size
|
||||
GTK_TYPE_CONSTRAINT_GUIDE
|
||||
gtk_constraint_guide_get_tyoe
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkdragsource</FILE>
|
||||
GtkDragSource
|
||||
gtk_drag_source_new
|
||||
gtk_drag_source_set_content
|
||||
gtk_drag_source_get_content
|
||||
gtk_drag_source_set_actions
|
||||
gtk_drag_source_get_actions
|
||||
gtk_drag_source_set_icon
|
||||
gtk_drag_source_drag_cancel
|
||||
gtk_drag_source_get_drag
|
||||
gtk_drag_check_threshold
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_DRAG_SOURCE
|
||||
GTK_DRAG_SOURCE
|
||||
GTK_DRAG_SOURCE_CLASS
|
||||
GTK_IS_DRAG_SOURCE
|
||||
GTK_IS_DRAG_SOURCE_CLASS
|
||||
GTK_DRAG_SOURCE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_drag_source_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkdroptarget</FILE>
|
||||
GtkDropTarget
|
||||
gtk_drop_target_new
|
||||
gtk_drop_target_set_formats
|
||||
gtk_drop_target_get_formats
|
||||
gtk_drop_target_set_actions
|
||||
gtk_drop_target_get_actions
|
||||
gtk_drop_target_get_drop
|
||||
gtk_drop_target_find_mimetype
|
||||
gtk_drop_target_read_selection
|
||||
gtk_drop_target_read_selection_finish
|
||||
gtk_drag_highlight
|
||||
gtk_drag_unhighlight
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_DROP_TARGET
|
||||
GTK_DROP_TARGET
|
||||
GTK_DROP_TARGET_CLASS
|
||||
GTK_IS_DROP_TARGET
|
||||
GTK_IS_DROP_TARGET_CLASS
|
||||
GTK_DROP_TARGET_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_drop_target_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkdragicon</FILE>
|
||||
GtkDragIcon
|
||||
gtk_drag_icon_new_for_drag
|
||||
gtk_drag_icon_set_from_paintable
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_DRAG_ICON
|
||||
GTK_DRAG_ICON
|
||||
GTK_DRAG_ICON_CLASS
|
||||
GTK_IS_DRAG_ICON
|
||||
GTK_IS_DRAG_ICON_CLASS
|
||||
GTK_DRAG_ICON_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_drag_icon_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -22,7 +22,9 @@ gtk_bin_get_type
|
||||
gtk_bin_layout_get_type
|
||||
gtk_box_get_type
|
||||
gtk_box_layout_get_type
|
||||
gtk_builder_cscope_get_type
|
||||
gtk_builder_get_type
|
||||
gtk_builder_scope_get_type
|
||||
gtk_buildable_get_type
|
||||
gtk_button_get_type
|
||||
gtk_calendar_get_type
|
||||
@@ -42,7 +44,6 @@ gtk_cell_renderer_text_get_type
|
||||
gtk_cell_renderer_toggle_get_type
|
||||
gtk_cell_view_get_type
|
||||
gtk_check_button_get_type
|
||||
gtk_check_menu_item_get_type
|
||||
gtk_color_button_get_type
|
||||
gtk_color_chooser_get_type
|
||||
gtk_color_chooser_dialog_get_type
|
||||
@@ -56,7 +57,10 @@ gtk_constraint_target_get_type
|
||||
gtk_container_get_type
|
||||
gtk_css_provider_get_type
|
||||
gtk_dialog_get_type
|
||||
gtk_drag_icon_get_type
|
||||
gtk_drag_source_get_type
|
||||
gtk_drawing_area_get_type
|
||||
gtk_drop_target_get_type
|
||||
gtk_editable_get_type
|
||||
gtk_entry_buffer_get_type
|
||||
gtk_entry_completion_get_type
|
||||
@@ -72,8 +76,10 @@ gtk_file_chooser_dialog_get_type
|
||||
gtk_file_chooser_get_type
|
||||
gtk_file_chooser_widget_get_type
|
||||
gtk_file_filter_get_type
|
||||
gtk_filter_list_model_get_type
|
||||
gtk_fixed_get_type
|
||||
gtk_fixed_layout_get_type
|
||||
gtk_flatten_list_model_get_type
|
||||
gtk_flow_box_get_type
|
||||
gtk_flow_box_child_get_type
|
||||
gtk_font_button_get_type
|
||||
@@ -111,18 +117,16 @@ gtk_list_store_get_type
|
||||
gtk_list_box_get_type
|
||||
gtk_list_box_row_get_type
|
||||
gtk_lock_button_get_type
|
||||
gtk_map_list_model_get_type
|
||||
gtk_media_controls_get_type
|
||||
gtk_media_file_get_type
|
||||
gtk_media_stream_get_type
|
||||
gtk_menu_bar_get_type
|
||||
gtk_menu_button_get_type
|
||||
gtk_menu_get_type
|
||||
gtk_menu_item_get_type
|
||||
gtk_menu_shell_get_type
|
||||
gtk_menu_tool_button_get_type
|
||||
gtk_message_dialog_get_type
|
||||
gtk_mount_operation_get_type
|
||||
gtk_native_get_type
|
||||
gtk_no_selection_get_type
|
||||
gtk_notebook_get_type
|
||||
gtk_notebook_page_get_type
|
||||
gtk_orientable_get_type
|
||||
@@ -146,7 +150,6 @@ gtk_print_settings_get_type
|
||||
@DISABLE_ON_W32@gtk_print_unix_dialog_get_type
|
||||
gtk_progress_bar_get_type
|
||||
gtk_radio_button_get_type
|
||||
gtk_radio_menu_item_get_type
|
||||
gtk_radio_tool_button_get_type
|
||||
gtk_range_get_type
|
||||
gtk_recent_manager_get_type
|
||||
@@ -161,7 +164,6 @@ gtk_search_bar_get_type
|
||||
gtk_search_entry_get_type
|
||||
gtk_selection_model_get_type
|
||||
gtk_separator_get_type
|
||||
gtk_separator_menu_item_get_type
|
||||
gtk_separator_tool_item_get_type
|
||||
gtk_settings_get_type
|
||||
gtk_shortcut_label_get_type
|
||||
@@ -171,7 +173,9 @@ gtk_shortcuts_group_get_type
|
||||
gtk_shortcuts_shortcut_get_type
|
||||
gtk_single_selection_get_type
|
||||
gtk_size_group_get_type
|
||||
gtk_slice_list_model_get_type
|
||||
gtk_snapshot_get_type
|
||||
gtk_sort_list_model_get_type
|
||||
gtk_spin_button_get_type
|
||||
gtk_spinner_get_type
|
||||
gtk_stack_get_type
|
||||
@@ -198,6 +202,8 @@ gtk_tool_button_get_type
|
||||
gtk_tool_item_get_type
|
||||
gtk_tree_drag_dest_get_type
|
||||
gtk_tree_drag_source_get_type
|
||||
gtk_tree_list_model_get_type
|
||||
gtk_tree_list_row_get_type
|
||||
gtk_tree_model_filter_get_type
|
||||
gtk_tree_model_get_type
|
||||
gtk_tree_model_sort_get_type
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
private_headers = [
|
||||
'imm-extra.h',
|
||||
'gtkbitmaskprivateimpl.h',
|
||||
'gdkpixbufutilsprivate.h',
|
||||
'gtkaccelgroupprivate.h',
|
||||
'gtkaccelmapprivate.h',
|
||||
@@ -15,7 +17,6 @@ private_headers = [
|
||||
'gtkbuttonprivate.h',
|
||||
'gtkcellareaboxcontextprivate.h',
|
||||
'gtkcheckbuttonprivate.h',
|
||||
'gtkcheckmenuitemprivate.h',
|
||||
'gtkcolorchooserprivate.h',
|
||||
'gtkcoloreditorprivate.h',
|
||||
'gtkcolorplaneprivate.h',
|
||||
@@ -35,6 +36,7 @@ private_headers = [
|
||||
'gtkcssarrayvalueprivate.h',
|
||||
'gtkcssbgsizevalueprivate.h',
|
||||
'gtkcssbordervalueprivate.h',
|
||||
'gtkcssboxesprivate.h',
|
||||
'gtkcsscalcvalueprivate.h',
|
||||
'gtkcsscolorvalueprivate.h',
|
||||
'gtkcsscornervalueprivate.h',
|
||||
@@ -46,7 +48,6 @@ private_headers = [
|
||||
'gtkcssfontfeaturesvalueprivate.h',
|
||||
'gtkcssfontvariationsvalueprivate.h',
|
||||
'gtkcssiconthemevalueprivate.h',
|
||||
'gtkcssimagebuiltinprivate.h',
|
||||
'gtkcssimagecrossfadeprivate.h',
|
||||
'gtkcssimagefallbackprivate.h',
|
||||
'gtkcssimageiconthemeprivate.h',
|
||||
@@ -95,7 +96,6 @@ private_headers = [
|
||||
'gtkcsswidgetnodeprivate.h',
|
||||
'gtkcsswin32sizevalueprivate.h',
|
||||
'gtkdialogprivate.h',
|
||||
'gtkdndprivate.h',
|
||||
'gtkentryprivate.h',
|
||||
'gtkeventcontrollerlegacyprivate.h',
|
||||
'gtkeventcontrollerprivate.h',
|
||||
@@ -135,9 +135,6 @@ private_headers = [
|
||||
'gtkmagnifierprivate.h',
|
||||
'gtkmediafileprivate.h',
|
||||
'gtkmenubuttonprivate.h',
|
||||
'gtkmenuitemprivate.h',
|
||||
'gtkmenuprivate.h',
|
||||
'gtkmenushellprivate.h',
|
||||
'gtkmodulesprivate.h',
|
||||
'gtkmountoperationprivate.h',
|
||||
'gtknativedialogprivate.h',
|
||||
@@ -178,8 +175,10 @@ private_headers = [
|
||||
'gtktextchildprivate.h',
|
||||
'gtktextdisplayprivate.h',
|
||||
'gtktexthandleprivate.h',
|
||||
'gtktexthistoryprivate.h',
|
||||
'gtktextiterprivate.h',
|
||||
'gtktextlayoutprivate.h',
|
||||
'gtktextlinedisplaycacheprivate.h',
|
||||
'gtktextmarkprivate.h',
|
||||
'gtktexttagprivate.h',
|
||||
'gtktextviewprivate.h',
|
||||
|
||||
@@ -305,6 +305,18 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using grabs</title>
|
||||
<para>
|
||||
GTK 4 no longer provides the gdk_device_grab() or gdk_seat_grab() apis.
|
||||
</para>
|
||||
<para>
|
||||
If you need to dismiss a popup when the user clicks outside (a common
|
||||
use for grabs), you can use the GdkSurface #GdkSurface:autohide property instead.
|
||||
GtkPopover also has a #GtkPopover:autohide property.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to coordinate API changes</title>
|
||||
<para>
|
||||
@@ -673,7 +685,7 @@
|
||||
<section>
|
||||
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton</title>
|
||||
<para>
|
||||
The GtkEditable has been made more useful, and the core functionality of
|
||||
The GtkEditable interface has been made more useful, and the core functionality of
|
||||
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
|
||||
GtkSpinButton and the new GtkPasswordEntry now use a GtkText widget internally
|
||||
and implement GtkEditable. In particular, this means that it is no longer
|
||||
@@ -851,6 +863,77 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkMenu, GtkMenuBar and GtkMenuItem are gone</title>
|
||||
<para>
|
||||
These widgets were heavily relying on X11-centric concepts such as
|
||||
override-redirect windows and grabs, and were hard to adjust to other
|
||||
windowing systems.
|
||||
</para>
|
||||
<para>
|
||||
Menus can already be replaced using GtkPopoverMenu in GTK 3. Additionally,
|
||||
GTK 4 introduces GtkPopoverMenuBar to replace menubars. These new widgets
|
||||
can only be constructed from menu models, so the porting effort involves
|
||||
switching to menu models and actions.
|
||||
</para>
|
||||
<para>
|
||||
Since menus are gone, GtkMenuButton and GtkMenuToolButton also lost their
|
||||
ability to show menus, and need to be used with popovers in GTK 4.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkToolbar overflow handling has changed</title>
|
||||
<para>
|
||||
The handling of overflow in toolbars has been simplified.
|
||||
Instead of creating a proxy menuitem and setting it with
|
||||
gtk_tool_item_set_proxy_menu_item(), you simply provide
|
||||
a label for the overflow menu with gtk_tool_item_set_overflow_text().
|
||||
GTK will figure out itself whether to create a check- or
|
||||
radioitem as proxy.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using custom tooltip windows</title>
|
||||
<para>
|
||||
Tooltips no longer use GtkWindows in GTK 4, and it is no longer
|
||||
possible to provide a custom window for tooltips. Replacing the content
|
||||
of the tooltip with a custom widget is still possible, with
|
||||
gtk_tooltip_set_custom().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Switch to the new DND api</title>
|
||||
<para>
|
||||
The source-side DND apis in GTK 4 have been changed to use an event controller, #GtkDragSource.
|
||||
</para>
|
||||
<para>
|
||||
Instead of calling gtk_drag_source_set() and connecting to #GtkWidget signals, you create
|
||||
a #GtkDragSource object, attach it to the widget with gtk_widget_add_controller(), and connect
|
||||
to #GtkDragSource signals. Instead of calling gtk_drag_begin() on a widget to start a drag
|
||||
manually, call gdk_drag_begin().
|
||||
</para>
|
||||
<para>
|
||||
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare signal, which
|
||||
returns a #GdkContentProvider for the drag operation.
|
||||
</para>
|
||||
<para>
|
||||
The destination-side DND apis in GTK 4 have also been changed to use and event controller,
|
||||
#GTkDropTarget.
|
||||
</para>
|
||||
<para>
|
||||
Instead of calling gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
|
||||
a #GtkDropTarget object, attach it to the widget with gtk_widget_add_controller(), and
|
||||
connect to #GtkDropTarget signals.
|
||||
</para>
|
||||
<para>
|
||||
The ::drag-motion signal has been renamed to #GtkDragSource::accept, and instead of
|
||||
::drag-data-received, you need to use async read methods on the #GdkDrop object, such
|
||||
as gdk_drop_read_value_async() or gdk_drop_read_text_async().
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -162,9 +162,6 @@
|
||||
<link linkend="GtkPaned">
|
||||
<inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkMenuBar">
|
||||
<inlinegraphic fileref="menubar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkToolbar">
|
||||
<inlinegraphic fileref="toolbar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
|
||||
+2
-29
@@ -152,8 +152,8 @@ create_menu_button (void)
|
||||
image = gtk_image_new ();
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (widget), image);
|
||||
menu = gtk_menu_new ();
|
||||
gtk_menu_button_set_popup (GTK_MENU_BUTTON (widget), menu);
|
||||
menu = gtk_popover_new (NULL);
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), menu);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), widget);
|
||||
@@ -800,32 +800,6 @@ create_toolbar (void)
|
||||
return new_widget_info ("toolbar", widget, SMALL);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_menubar (void)
|
||||
{
|
||||
GtkWidget *widget, *vbox, *item;
|
||||
|
||||
widget = gtk_menu_bar_new ();
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic ("_File");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic ("_Edit");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic ("_Help");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), widget);
|
||||
gtk_container_add (GTK_CONTAINER (vbox),
|
||||
gtk_label_new ("Menu Bar"));
|
||||
|
||||
return new_widget_info ("menubar", vbox, SMALL);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_message_dialog (void)
|
||||
{
|
||||
@@ -1438,7 +1412,6 @@ get_all_widgets (void)
|
||||
retval = g_list_prepend (retval, create_image ());
|
||||
retval = g_list_prepend (retval, create_label ());
|
||||
retval = g_list_prepend (retval, create_link_button ());
|
||||
retval = g_list_prepend (retval, create_menubar ());
|
||||
retval = g_list_prepend (retval, create_message_dialog ());
|
||||
retval = g_list_prepend (retval, create_notebook ());
|
||||
retval = g_list_prepend (retval, create_panes ());
|
||||
|
||||
@@ -0,0 +1,537 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Matthias Clasen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkcontentdeserializer.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
|
||||
#include <gio/gunixfdlist.h>
|
||||
|
||||
#ifndef O_PATH
|
||||
#define O_PATH 0
|
||||
#endif
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#else
|
||||
#define HAVE_O_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
#include "filetransferportalprivate.h"
|
||||
|
||||
static GDBusProxy *file_transfer_proxy = NULL;
|
||||
|
||||
typedef struct {
|
||||
GTask *task;
|
||||
const char **files;
|
||||
int len;
|
||||
int start;
|
||||
} AddFileData;
|
||||
|
||||
static void add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd);
|
||||
|
||||
static void
|
||||
add_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
AddFileData *afd = data;
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
|
||||
ret = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, NULL, result, &error);
|
||||
if (ret == NULL)
|
||||
{
|
||||
g_task_return_error (afd->task, error);
|
||||
g_object_unref (afd->task);
|
||||
g_free (afd);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_unref (ret);
|
||||
|
||||
if (afd->start >= afd->len)
|
||||
{
|
||||
g_task_return_boolean (afd->task, TRUE);
|
||||
g_object_unref (afd->task);
|
||||
g_free (afd);
|
||||
return;
|
||||
}
|
||||
|
||||
add_files (proxy, afd);
|
||||
}
|
||||
|
||||
/* We call AddFiles in chunks of 16 to avoid running into
|
||||
* the per-message fd limit of the bus.
|
||||
*/
|
||||
static void
|
||||
add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd)
|
||||
{
|
||||
GUnixFDList *fd_list;
|
||||
GVariantBuilder fds;
|
||||
int i;
|
||||
char *key;
|
||||
|
||||
g_variant_builder_init (&fds, G_VARIANT_TYPE ("ah"));
|
||||
fd_list = g_unix_fd_list_new ();
|
||||
|
||||
for (i = 0; afd->files[afd->start + i]; i++)
|
||||
{
|
||||
int fd;
|
||||
int fd_in;
|
||||
GError *error = NULL;
|
||||
|
||||
if (i == 16)
|
||||
break;
|
||||
|
||||
fd = open (afd->files[afd->start + i], O_PATH | O_CLOEXEC);
|
||||
if (fd == -1)
|
||||
{
|
||||
g_task_return_new_error (afd->task, G_IO_ERROR, g_io_error_from_errno (errno),
|
||||
"Failed to open %s", afd->files[afd->start + i]);
|
||||
g_object_unref (afd->task);
|
||||
g_free (afd);
|
||||
g_object_unref (fd_list);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef HAVE_O_CLOEXEC
|
||||
fcntl (fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
fd_in = g_unix_fd_list_append (fd_list, fd, &error);
|
||||
close (fd);
|
||||
|
||||
if (fd_in == -1)
|
||||
{
|
||||
g_task_return_error (afd->task, error);
|
||||
g_object_unref (afd->task);
|
||||
g_free (afd);
|
||||
g_object_unref (fd_list);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_builder_add (&fds, "h", fd_in);
|
||||
}
|
||||
|
||||
afd->start += 16;
|
||||
|
||||
key = (char *)g_object_get_data (G_OBJECT (afd->task), "key");
|
||||
|
||||
g_dbus_proxy_call_with_unix_fd_list (proxy,
|
||||
"AddFiles",
|
||||
g_variant_new ("(sah)", key, &fds),
|
||||
0, -1,
|
||||
fd_list,
|
||||
NULL,
|
||||
add_files_done, afd);
|
||||
|
||||
g_object_unref (fd_list);
|
||||
}
|
||||
|
||||
static void
|
||||
start_session_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
AddFileData *afd = data;
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
const char *key;
|
||||
|
||||
ret = g_dbus_proxy_call_finish (proxy, result, &error);
|
||||
if (ret == NULL)
|
||||
{
|
||||
g_task_return_error (afd->task, error);
|
||||
g_object_unref (afd->task);
|
||||
g_free (afd);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_get (ret, "(&s)", &key);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (afd->task), "key", g_strdup (key), g_free);
|
||||
|
||||
g_variant_unref (ret);
|
||||
|
||||
add_files (proxy, afd);
|
||||
}
|
||||
|
||||
void
|
||||
file_transfer_portal_register_files (const char **files,
|
||||
gboolean writable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
GTask *task;
|
||||
AddFileData *afd;
|
||||
GVariantBuilder options;
|
||||
|
||||
task = g_task_new (NULL, NULL, callback, data);
|
||||
|
||||
if (file_transfer_proxy == NULL)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"No portal found");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
afd = g_new (AddFileData, 1);
|
||||
afd->task = task;
|
||||
afd->files = files;
|
||||
afd->len = g_strv_length ((char **)files);
|
||||
afd->start = 0;
|
||||
|
||||
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
|
||||
g_variant_builder_add (&options, "{sv}", "writable", g_variant_new_boolean (writable));
|
||||
g_variant_builder_add (&options, "{sv}", "autostop", g_variant_new_boolean (TRUE));
|
||||
|
||||
g_dbus_proxy_call (file_transfer_proxy, "StartTransfer",
|
||||
g_variant_new ("(a{sv})", &options),
|
||||
0, -1, NULL, start_session_done, afd);
|
||||
}
|
||||
|
||||
gboolean
|
||||
file_transfer_portal_register_files_finish (GAsyncResult *result,
|
||||
char **key,
|
||||
GError **error)
|
||||
{
|
||||
if (g_task_propagate_boolean (G_TASK (result), error))
|
||||
{
|
||||
*key = g_strdup (g_object_get_data (G_OBJECT (result), "key"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
retrieve_files_done (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GDBusProxy *proxy = G_DBUS_PROXY (object);
|
||||
GTask *task = data;
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
char **files;
|
||||
|
||||
ret = g_dbus_proxy_call_finish (proxy, result, &error);
|
||||
if (ret == NULL)
|
||||
{
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_get (ret, "(^a&s)", &files);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (task), "files", g_strdupv (files), (GDestroyNotify)g_strfreev);
|
||||
|
||||
g_variant_unref (ret);
|
||||
|
||||
g_task_return_boolean (task, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
file_transfer_portal_retrieve_files (const char *key,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
GTask *task;
|
||||
GVariantBuilder options;
|
||||
|
||||
task = g_task_new (NULL, NULL, callback, data);
|
||||
|
||||
if (file_transfer_proxy == NULL)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"No portal found");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
|
||||
g_dbus_proxy_call (file_transfer_proxy,
|
||||
"RetrieveFiles",
|
||||
g_variant_new ("(sa{sv})", key, &options),
|
||||
0, -1, NULL,
|
||||
retrieve_files_done, task);
|
||||
}
|
||||
|
||||
gboolean
|
||||
file_transfer_portal_retrieve_files_finish (GAsyncResult *result,
|
||||
char ***files,
|
||||
GError **error)
|
||||
{
|
||||
if (g_task_propagate_boolean (G_TASK (result), error))
|
||||
{
|
||||
*files = g_strdupv (g_object_get_data (G_OBJECT (result), "files"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* serializer */
|
||||
|
||||
static void
|
||||
file_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_output_stream_write_all_finish (stream, result, NULL, &error))
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
else
|
||||
gdk_content_serializer_return_success (serializer);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_ready (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *key;
|
||||
|
||||
if (!file_transfer_portal_register_files_finish (result, &key, &error))
|
||||
{
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
|
||||
key,
|
||||
strlen (key) + 1,
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
file_serializer_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, key, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GFile *file;
|
||||
const GValue *value;
|
||||
GPtrArray *files;
|
||||
|
||||
files = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
{
|
||||
file = g_value_get_object (gdk_content_serializer_get_value (serializer));
|
||||
if (file)
|
||||
g_ptr_array_add (files, g_file_get_path (file));
|
||||
g_ptr_array_add (files, NULL);
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
for (l = g_value_get_boxed (value); l; l = l->next)
|
||||
g_ptr_array_add (files, g_file_get_path (l->data));
|
||||
|
||||
g_ptr_array_add (files, NULL);
|
||||
}
|
||||
|
||||
/* this call doesn't copy the strings, so keep the array around until the registration is done */
|
||||
file_transfer_portal_register_files ((const char **)files->pdata, TRUE, portal_ready, serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, files, (GDestroyNotify)g_ptr_array_unref);
|
||||
}
|
||||
|
||||
/* deserializer */
|
||||
|
||||
static void
|
||||
portal_finish (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
char **files = NULL;
|
||||
GError *error = NULL;
|
||||
GValue *value;
|
||||
|
||||
if (!file_transfer_portal_retrieve_files_finish (result, &files, &error))
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
value = gdk_content_deserializer_get_value (deserializer);
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
{
|
||||
if (files[0] != NULL)
|
||||
g_value_take_object (value, g_file_new_for_path (files[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
GSList *l = NULL;
|
||||
gsize i;
|
||||
|
||||
for (i = 0; files[i] != NULL; i++)
|
||||
l = g_slist_prepend (l, g_file_new_for_path (files[i]));
|
||||
g_value_take_boxed (value, g_slist_reverse (l));
|
||||
}
|
||||
g_strfreev (files);
|
||||
|
||||
gdk_content_deserializer_return_success (deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
gssize written;
|
||||
char *key;
|
||||
|
||||
written = g_output_stream_splice_finish (stream, result, &error);
|
||||
if (written < 0)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
/* write terminating NULL */
|
||||
if (!g_output_stream_write (stream, "", 1, NULL, &error))
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
key = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (stream));
|
||||
if (key == NULL)
|
||||
{
|
||||
GError *gerror = g_error_new (G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Could not convert data from %s to %s",
|
||||
gdk_content_deserializer_get_mime_type (deserializer),
|
||||
g_type_name (gdk_content_deserializer_get_gtype (deserializer)));
|
||||
gdk_content_deserializer_return_error (deserializer, gerror);
|
||||
return;
|
||||
}
|
||||
|
||||
file_transfer_portal_retrieve_files (key, portal_finish, deserializer);
|
||||
gdk_content_deserializer_set_task_data (deserializer, key, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
portal_file_deserializer (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
output = g_memory_output_stream_new_resizable ();
|
||||
|
||||
g_output_stream_splice_async (output,
|
||||
gdk_content_deserializer_get_input_stream (deserializer),
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
portal_file_deserializer_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
got_proxy (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
|
||||
if (!file_transfer_proxy)
|
||||
{
|
||||
g_message ("Failed to get file transfer portal: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.files",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.files",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
file_transfer_portal_register (void)
|
||||
{
|
||||
static gboolean called;
|
||||
|
||||
if (!called)
|
||||
{
|
||||
called = TRUE;
|
||||
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
||||
NULL,
|
||||
"org.freedesktop.portal.Documents",
|
||||
"/org/freedesktop/portal/documents",
|
||||
"org.freedesktop.portal.FileTransfer",
|
||||
NULL,
|
||||
got_proxy,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* G_OS_UNIX */
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Matthias Clasen
|
||||
*
|
||||
* 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 __FILE_TRANSFER_PROTOCOL_H__
|
||||
#define __FILE_TRANSFER_PROTOCOL_H__
|
||||
|
||||
|
||||
void file_transfer_portal_register (void);
|
||||
|
||||
void file_transfer_portal_register_files (const char **files,
|
||||
gboolean writable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data);
|
||||
gboolean file_transfer_portal_register_files_finish (GAsyncResult *result,
|
||||
char **key,
|
||||
GError **error);
|
||||
|
||||
void file_transfer_portal_retrieve_files (const char *key,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer data);
|
||||
gboolean file_transfer_portal_retrieve_files_finish (GAsyncResult *result,
|
||||
char ***files,
|
||||
GError **error);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -212,14 +212,14 @@ gdk_pre_parse (void)
|
||||
_gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
(GDebugKey *) gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
if (g_getenv ("GTK_TRACE_FD"))
|
||||
gdk_profiler_start (atoi (g_getenv ("GTK_TRACE_FD")));
|
||||
else if (g_getenv ("GTK_TRACE"))
|
||||
gdk_profiler_start (-1);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (g_getenv ("GTK_TRACE_FD"))
|
||||
gdk_profiler_start (atoi (g_getenv ("GTK_TRACE_FD")));
|
||||
else if (g_getenv ("GTK_TRACE"))
|
||||
gdk_profiler_start (-1);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_desktop_startup_notification_id ();
|
||||
#endif
|
||||
|
||||
@@ -1054,6 +1054,7 @@ gdk_clipboard_write_serialize_done (GObject *content,
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_clipboard_write_async (GdkClipboard *clipboard,
|
||||
const char *mime_type,
|
||||
|
||||
@@ -14,7 +14,6 @@ G_BEGIN_DECLS
|
||||
#mesondefine GDK_WINDOWING_BROADWAY
|
||||
#mesondefine GDK_WINDOWING_WAYLAND
|
||||
#mesondefine GDK_WINDOWING_WIN32
|
||||
#mesondefine GDK_WINDOWING_MIR
|
||||
|
||||
#mesondefine GDK_RENDERING_VULKAN
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include "gdkcontentdeserializer.h"
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -758,6 +760,63 @@ file_uri_deserializer (GdkContentDeserializer *deserializer)
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
color_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
gssize written;
|
||||
|
||||
written = g_output_stream_splice_finish (stream, result, &error);
|
||||
if (written < 0)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
else if (written == 0)
|
||||
{
|
||||
GdkRGBA black = GDK_RGBA ("000");
|
||||
|
||||
/* Never return NULL, we only return that on error */
|
||||
g_value_set_boxed (gdk_content_deserializer_get_value (deserializer), &black);
|
||||
}
|
||||
else
|
||||
{
|
||||
guint16 *data;
|
||||
GdkRGBA rgba;
|
||||
|
||||
data = (guint16 *)g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (stream));
|
||||
rgba.red = data[0] / 65535.0;
|
||||
rgba.green = data[1] / 65535.0;
|
||||
rgba.blue = data[2] / 65535.0;
|
||||
rgba.alpha = data[3] / 65535.0;
|
||||
|
||||
g_value_set_boxed (gdk_content_deserializer_get_value (deserializer), &rgba);
|
||||
}
|
||||
gdk_content_deserializer_return_success (deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
color_deserializer (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
guint16 *data;
|
||||
|
||||
data = g_new0 (guint16, 4);
|
||||
output = g_memory_output_stream_new (data, 4 * sizeof (guint16), NULL, g_free);
|
||||
|
||||
g_output_stream_splice_async (output,
|
||||
gdk_content_deserializer_get_input_stream (deserializer),
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
color_deserializer_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
init (void)
|
||||
{
|
||||
@@ -816,11 +875,16 @@ init (void)
|
||||
|
||||
g_slist_free (formats);
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
file_transfer_portal_register ();
|
||||
#endif
|
||||
|
||||
gdk_content_register_deserializer ("text/uri-list",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
file_uri_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("text/uri-list",
|
||||
G_TYPE_FILE,
|
||||
file_uri_deserializer,
|
||||
@@ -846,5 +910,11 @@ init (void)
|
||||
string_deserializer,
|
||||
(gpointer) "ASCII",
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/x-color",
|
||||
GDK_TYPE_RGBA,
|
||||
color_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ gdk_content_provider_write_mime_type_finish (GdkContentProvider *provider,
|
||||
* @error: a #GError location to store the error occurring, or %NULL to
|
||||
* ignore.
|
||||
*
|
||||
* Gets the convtents of @provider stored in @value.
|
||||
* Gets the contents of @provider stored in @value.
|
||||
*
|
||||
* The @value will have been initialized to the #GType the value should be
|
||||
* provided in. This given #GType does not need to be listed in the formats
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "gdkcontentprovider.h"
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkcontentproviderimpl.h"
|
||||
|
||||
@@ -280,3 +281,232 @@ gdk_content_provider_new_for_bytes (const char *mime_type,
|
||||
|
||||
return GDK_CONTENT_PROVIDER (content);
|
||||
}
|
||||
|
||||
#define GDK_TYPE_CONTENT_PROVIDER_CALLBACK (gdk_content_provider_callback_get_type ())
|
||||
#define GDK_CONTENT_PROVIDER_CALLBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_CALLBACK, GdkContentProviderCallback))
|
||||
|
||||
typedef struct _GdkContentProviderCallback GdkContentProviderCallback;
|
||||
typedef struct _GdkContentProviderCallbackClass GdkContentProviderCallbackClass;
|
||||
|
||||
struct _GdkContentProviderCallback
|
||||
{
|
||||
GdkContentProvider parent;
|
||||
|
||||
GType type;
|
||||
GdkContentProviderGetValueFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
struct _GdkContentProviderCallbackClass
|
||||
{
|
||||
GdkContentProviderClass parent_class;
|
||||
};
|
||||
|
||||
GType gdk_content_provider_callback_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_TYPE (GdkContentProviderCallback, gdk_content_provider_callback, GDK_TYPE_CONTENT_PROVIDER)
|
||||
|
||||
static GdkContentFormats *
|
||||
gdk_content_provider_callback_ref_formats (GdkContentProvider *provider)
|
||||
{
|
||||
GdkContentProviderCallback *callback = GDK_CONTENT_PROVIDER_CALLBACK (provider);
|
||||
|
||||
return gdk_content_formats_new_for_gtype (callback->type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_content_provider_callback_get_value (GdkContentProvider *provider,
|
||||
GValue *value,
|
||||
GError **error)
|
||||
{
|
||||
GdkContentProviderCallback *callback = GDK_CONTENT_PROVIDER_CALLBACK (provider);
|
||||
|
||||
if (G_VALUE_HOLDS (value, callback->type) && callback->func != NULL)
|
||||
{
|
||||
callback->func (value, callback->data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return GDK_CONTENT_PROVIDER_CLASS (gdk_content_provider_callback_parent_class)->get_value (provider, value, error);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback_class_init (GdkContentProviderCallbackClass *class)
|
||||
{
|
||||
GdkContentProviderClass *provider_class = GDK_CONTENT_PROVIDER_CLASS (class);
|
||||
|
||||
provider_class->ref_formats = gdk_content_provider_callback_ref_formats;
|
||||
provider_class->get_value = gdk_content_provider_callback_get_value;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback_init (GdkContentProviderCallback *content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_provider_new_for_callback:
|
||||
* @type: the type that the callback provides
|
||||
* @func: callback to populate a #GValue
|
||||
* @data: (closure): data that gets passed to @func
|
||||
*
|
||||
* Create a content provider that provides data that is provided via a callback.
|
||||
*
|
||||
* Returns: a new #GdkContentProvider
|
||||
**/
|
||||
GdkContentProvider *
|
||||
gdk_content_provider_new_with_callback (GType type,
|
||||
GdkContentProviderGetValueFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GdkContentProviderCallback *content;
|
||||
|
||||
content = g_object_new (GDK_TYPE_CONTENT_PROVIDER_CALLBACK, NULL);
|
||||
content->type = type;
|
||||
content->func = func;
|
||||
content->data = data;
|
||||
|
||||
return GDK_CONTENT_PROVIDER (content);
|
||||
}
|
||||
|
||||
#define GDK_TYPE_CONTENT_PROVIDER_CALLBACK2 (gdk_content_provider_callback2_get_type ())
|
||||
#define GDK_CONTENT_PROVIDER_CALLBACK2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_CALLBACK2, GdkContentProviderCallback2))
|
||||
|
||||
typedef struct _GdkContentProviderCallback2 GdkContentProviderCallback2;
|
||||
typedef struct _GdkContentProviderCallback2Class GdkContentProviderCallback2Class;
|
||||
|
||||
struct _GdkContentProviderCallback2
|
||||
{
|
||||
GdkContentProvider parent;
|
||||
|
||||
GdkContentFormats *formats;
|
||||
GdkContentProviderGetBytesFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
struct _GdkContentProviderCallback2Class
|
||||
{
|
||||
GdkContentProviderClass parent_class;
|
||||
};
|
||||
|
||||
GType gdk_content_provider_callback2_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_TYPE (GdkContentProviderCallback2, gdk_content_provider_callback2, GDK_TYPE_CONTENT_PROVIDER)
|
||||
|
||||
static GdkContentFormats *
|
||||
gdk_content_provider_callback2_ref_formats (GdkContentProvider *provider)
|
||||
{
|
||||
GdkContentProviderCallback2 *callback = GDK_CONTENT_PROVIDER_CALLBACK2 (provider);
|
||||
|
||||
return gdk_content_formats_ref (callback->formats);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback2_write_mime_type_done (GObject *stream,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_output_stream_write_all_finish (G_OUTPUT_STREAM (stream), result, NULL, &error))
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback2_write_mime_type_async (GdkContentProvider *provider,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentProviderCallback2 *content = GDK_CONTENT_PROVIDER_CALLBACK2 (provider);
|
||||
GTask *task;
|
||||
GBytes *bytes;
|
||||
|
||||
task = g_task_new (content, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_content_provider_callback2_write_mime_type_async);
|
||||
|
||||
if (!gdk_content_formats_contain_mime_type (content->formats, mime_type))
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Cannot provide contents as “%s”"), mime_type);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = content->func (mime_type, content->data);
|
||||
if (!bytes)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Failed to get contents as “%s”"), mime_type);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (task), "bytes", bytes, (GDestroyNotify)g_bytes_unref);
|
||||
|
||||
g_output_stream_write_all_async (stream,
|
||||
g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes),
|
||||
io_priority,
|
||||
cancellable,
|
||||
gdk_content_provider_callback2_write_mime_type_done,
|
||||
task);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_content_provider_callback2_write_mime_type_finish (GdkContentProvider *provider,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, provider), FALSE);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_content_provider_callback2_write_mime_type_async, FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback2_class_init (GdkContentProviderCallback2Class *class)
|
||||
{
|
||||
GdkContentProviderClass *provider_class = GDK_CONTENT_PROVIDER_CLASS (class);
|
||||
|
||||
provider_class->ref_formats = gdk_content_provider_callback2_ref_formats;
|
||||
provider_class->write_mime_type_async = gdk_content_provider_callback2_write_mime_type_async;
|
||||
provider_class->write_mime_type_finish = gdk_content_provider_callback2_write_mime_type_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_content_provider_callback2_init (GdkContentProviderCallback2 *content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_provider_new_with_formats:
|
||||
* @formats: formats to advertise
|
||||
* @func: callback to populate a #GValue
|
||||
* @data: data that gets passed to @func
|
||||
*
|
||||
* Create a content provider that provides data that is provided via a callback.
|
||||
*
|
||||
* Returns: a new #GdkContentProvider
|
||||
**/
|
||||
GdkContentProvider *
|
||||
gdk_content_provider_new_with_formats (GdkContentFormats *formats,
|
||||
GdkContentProviderGetBytesFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GdkContentProviderCallback2 *content;
|
||||
content = g_object_new (GDK_TYPE_CONTENT_PROVIDER_CALLBACK2, NULL);
|
||||
content->formats = gdk_content_formats_union_serialize_mime_types (gdk_content_formats_ref (formats));
|
||||
content->func = func;
|
||||
content->data = data;
|
||||
|
||||
return GDK_CONTENT_PROVIDER (content);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,21 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkContentProvider * gdk_content_provider_new_for_bytes (const char *mime_type,
|
||||
GBytes *bytes);
|
||||
|
||||
typedef void (*GdkContentProviderGetValueFunc) (GValue *value,
|
||||
gpointer data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentProvider * gdk_content_provider_new_with_callback (GType type,
|
||||
GdkContentProviderGetValueFunc func,
|
||||
gpointer data);
|
||||
|
||||
typedef GBytes * (*GdkContentProviderGetBytesFunc) (const char *mime_type,
|
||||
gpointer data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentProvider * gdk_content_provider_new_with_formats (GdkContentFormats *formats,
|
||||
GdkContentProviderGetBytesFunc func,
|
||||
gpointer data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <string.h>
|
||||
@@ -431,7 +433,7 @@ lookup_serializer (const char *mime_type,
|
||||
|
||||
/**
|
||||
* gdk_content_formats_union_serialize_gtypes:
|
||||
* @formats: a #GdkContentFormats
|
||||
* @formats: (transfer full): a #GdkContentFormats
|
||||
*
|
||||
* Add GTypes for the mime types in @formats for which serializers are
|
||||
* registered.
|
||||
@@ -466,7 +468,7 @@ gdk_content_formats_union_serialize_gtypes (GdkContentFormats *formats)
|
||||
|
||||
/**
|
||||
* gdk_content_formats_union_serialize_mime_types:
|
||||
* @formats: a #GdkContentFormats
|
||||
* @formats: (transfer full): a #GdkContentFormats
|
||||
*
|
||||
* Add mime types for GTypes in @formats for which serializers are
|
||||
* registered.
|
||||
@@ -802,6 +804,48 @@ file_text_serializer (GdkContentSerializer *serializer)
|
||||
gdk_content_serializer_set_task_data (serializer, path, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
color_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer serializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_output_stream_write_all_finish (stream, result, NULL, &error))
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
else
|
||||
gdk_content_serializer_return_success (serializer);
|
||||
}
|
||||
|
||||
static void
|
||||
color_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
const GValue *value;
|
||||
GdkRGBA *rgba;
|
||||
guint16 *data;
|
||||
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
rgba = g_value_get_boxed (value);
|
||||
data = g_new0 (guint16, 4);
|
||||
if (rgba)
|
||||
{
|
||||
data[0] = (guint16) (rgba->red * 65535);
|
||||
data[1] = (guint16) (rgba->green * 65535);
|
||||
data[2] = (guint16) (rgba->blue * 65535);
|
||||
data[3] = (guint16) (rgba->alpha * 65535);
|
||||
}
|
||||
|
||||
g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
|
||||
data,
|
||||
4 * sizeof (guint16),
|
||||
gdk_content_serializer_get_priority (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
color_serializer_finish,
|
||||
serializer);
|
||||
gdk_content_serializer_set_task_data (serializer, data, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
init (void)
|
||||
{
|
||||
@@ -863,6 +907,10 @@ init (void)
|
||||
|
||||
g_slist_free (formats);
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
file_transfer_portal_register ();
|
||||
#endif
|
||||
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"text/uri-list",
|
||||
file_uri_serializer,
|
||||
@@ -873,6 +921,7 @@ init (void)
|
||||
file_text_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"text/uri-list",
|
||||
file_uri_serializer,
|
||||
@@ -903,5 +952,11 @@ init (void)
|
||||
string_serializer,
|
||||
(gpointer) "ASCII",
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_RGBA,
|
||||
"application/x-color",
|
||||
color_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
+17
-7
@@ -90,20 +90,30 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* SECTION:dnd
|
||||
* @title: Drag And Drop
|
||||
* @short_description: Functions for controlling drag and drop handling
|
||||
* @Title: Drag And Drop
|
||||
* @Short_description: Functions for controlling drag and drop handling
|
||||
*
|
||||
* These functions provide a low level interface for drag and drop.
|
||||
* These functions provide a low-level interface for drag and drop.
|
||||
*
|
||||
* The GdkDrag object represents the source side of an ongoing DND operation.
|
||||
* It is created when a drag is started, and stays alive for duration of
|
||||
* the DND operation.
|
||||
* the DND operation. After a drag has been started with gdk_drag_begin(),
|
||||
* the caller gets informed about the status of the ongoing drag operation
|
||||
* with signals on the #GtkDrag object.
|
||||
*
|
||||
* The GdkDrop object represents the target side of an ongoing DND operation.
|
||||
* Possible drop sites get informed about the status of the ongoing drag operation
|
||||
* with events of type %GDK_DRAG_ENTER, %GDK_DRAG_LEAVE, %GDK_DRAG_MOTION and
|
||||
* %GDK_DROP_START. The #GdkDrop object can be obtained from these #GdkEvents
|
||||
* using gdk_event_get_drop().
|
||||
*
|
||||
* The actual data transfer is initiated from the target side via an async
|
||||
* read, using one of the GdkDrop functions for this purpose: gdk_drop_read_async(),
|
||||
* gdk_drop_read_value_async() or gdk_drop_read_text_async().
|
||||
*
|
||||
* GTK+ provides a higher level abstraction based on top of these functions,
|
||||
* and so they are not normally needed in GTK+ applications. See the
|
||||
* [Drag and Drop][gtk4-Drag-and-Drop] section of the GTK+ documentation
|
||||
* GTK provides a higher level abstraction based on top of these functions,
|
||||
* and so they are not normally needed in GTK applications. See the
|
||||
* [Drag and Drop][gtk4-Drag-and-Drop] section of the GTK documentation
|
||||
* for more information.
|
||||
*/
|
||||
|
||||
|
||||
+41
-1
@@ -448,7 +448,10 @@ gdk_drop_get_surface (GdkDrop *self)
|
||||
* Returns the possible actions for this #GdkDrop. If this value
|
||||
* contains multiple actions - ie gdk_drag_action_is_unique()
|
||||
* returns %FALSE for the result - gdk_drag_finish() must choose
|
||||
* the action to use when accepting the drop.
|
||||
* the action to use when accepting the drop. This will only
|
||||
* happen if you passed %GDK_ACTION_ASK as one of the possible
|
||||
* actions in gdk_drag_status(). %GDK_ACTION_ASK itself will not
|
||||
* be included in the actions returned by this function.
|
||||
*
|
||||
* This value may change over the lifetime of the #GdkDrop both
|
||||
* as a response to source side actions as well as to calls to
|
||||
@@ -938,6 +941,9 @@ gdk_drop_emit_motion_event (GdkDrop *self,
|
||||
{
|
||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||
GdkEvent *event;
|
||||
int x, y;
|
||||
|
||||
gdk_surface_get_origin (priv->surface, &x, &y);
|
||||
|
||||
event = gdk_event_new (GDK_DRAG_MOTION);
|
||||
event->any.surface = g_object_ref (priv->surface);
|
||||
@@ -945,6 +951,8 @@ gdk_drop_emit_motion_event (GdkDrop *self,
|
||||
event->dnd.time = time;
|
||||
event->dnd.x_root = x_root;
|
||||
event->dnd.y_root = y_root;
|
||||
event->dnd.x = x_root - x;
|
||||
event->dnd.y = y_root - y;
|
||||
gdk_event_set_device (event, priv->device);
|
||||
|
||||
gdk_drop_do_emit_event (event, dont_queue);
|
||||
@@ -976,6 +984,9 @@ gdk_drop_emit_drop_event (GdkDrop *self,
|
||||
{
|
||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||
GdkEvent *event;
|
||||
int x, y;
|
||||
|
||||
gdk_surface_get_origin (priv->surface, &x, &y);
|
||||
|
||||
event = gdk_event_new (GDK_DROP_START);
|
||||
event->any.surface = g_object_ref (priv->surface);
|
||||
@@ -983,8 +994,37 @@ gdk_drop_emit_drop_event (GdkDrop *self,
|
||||
event->dnd.time = time;
|
||||
event->dnd.x_root = x_root;
|
||||
event->dnd.y_root = y_root;
|
||||
event->dnd.x = x_root - x;
|
||||
event->dnd.y = y_root - y;
|
||||
gdk_event_set_device (event, priv->device);
|
||||
|
||||
gdk_drop_do_emit_event (event, dont_queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_has_value:
|
||||
* @self: a #GdkDrop
|
||||
* @type: the type to check
|
||||
*
|
||||
* Returns whether calling gdk_drop_read_value_async() for @type
|
||||
* can succeed.
|
||||
*
|
||||
* Returns: %TRUE if the data can be deserialized to the given type
|
||||
*/
|
||||
gboolean
|
||||
gdk_drop_has_value (GdkDrop *self,
|
||||
GType type)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
gboolean ret;
|
||||
|
||||
formats = gdk_content_formats_ref (gdk_drop_get_formats (self));
|
||||
formats = gdk_content_formats_union_deserialize_gtypes (formats);
|
||||
|
||||
ret = gdk_content_formats_contain_gtype (formats, type);
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ char * gdk_drop_read_text_finish (GdkDrop
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drop_has_value (GdkDrop *self,
|
||||
GType type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -947,6 +947,13 @@ gdk_event_get_coords (const GdkEvent *event,
|
||||
x = event->touchpad_pinch.x;
|
||||
y = event->touchpad_pinch.y;
|
||||
break;
|
||||
case GDK_DRAG_ENTER:
|
||||
case GDK_DRAG_LEAVE:
|
||||
case GDK_DRAG_MOTION:
|
||||
case GDK_DROP_START:
|
||||
x = event->dnd.x;
|
||||
y = event->dnd.y;
|
||||
break;
|
||||
default:
|
||||
fetched = FALSE;
|
||||
break;
|
||||
@@ -1006,6 +1013,13 @@ gdk_event_set_coords (GdkEvent *event,
|
||||
event->touchpad_pinch.x = x;
|
||||
event->touchpad_pinch.y = y;
|
||||
break;
|
||||
case GDK_DRAG_ENTER:
|
||||
case GDK_DRAG_LEAVE:
|
||||
case GDK_DRAG_MOTION:
|
||||
case GDK_DROP_START:
|
||||
event->dnd.x = x;
|
||||
event->dnd.y = y;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,9 @@ struct _GdkEventDND {
|
||||
GdkDrop *drop;
|
||||
|
||||
guint32 time;
|
||||
gshort x_root, y_root;
|
||||
double x_root, y_root;
|
||||
double x;
|
||||
double y;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+50
-19
@@ -649,46 +649,94 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
|
||||
void
|
||||
_gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::flush-events", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::before-paint", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[UPDATE], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::update", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[LAYOUT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::layout", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::paint", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::after-paint", "");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
|
||||
{
|
||||
guint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000,
|
||||
(g_get_monotonic_time () - before) * 1000,
|
||||
"frameclock ::resume-events", "");
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static gint64
|
||||
guess_refresh_interval (GdkFrameClock *frame_clock)
|
||||
{
|
||||
@@ -758,34 +806,17 @@ frame_clock_get_fps (GdkFrameClock *frame_clock)
|
||||
|
||||
return ((double) end_counter - start_counter) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
|
||||
GdkFrameTimings *timings)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gdk_profiler_add_mark (timings->frame_time * 1000,
|
||||
(timings->frame_end_time - timings->frame_time) * 1000,
|
||||
"frame", "");
|
||||
|
||||
if (timings->layout_start_time != 0)
|
||||
gdk_profiler_add_mark (timings->layout_start_time * 1000,
|
||||
(timings->paint_start_time - timings->layout_start_time) * 1000,
|
||||
"layout", "");
|
||||
|
||||
if (timings->paint_start_time != 0)
|
||||
gdk_profiler_add_mark (timings->paint_start_time * 1000,
|
||||
(timings->frame_end_time - timings->paint_start_time) * 1000,
|
||||
"paint", "");
|
||||
|
||||
if (timings->presentation_time != 0)
|
||||
gdk_profiler_add_mark (timings->presentation_time * 1000,
|
||||
0,
|
||||
"presentation", "");
|
||||
|
||||
gdk_profiler_set_counter (fps_counter,
|
||||
timings->frame_end_time * 1000,
|
||||
timings->presentation_time * 1000,
|
||||
frame_clock_get_fps (clock));
|
||||
#endif
|
||||
}
|
||||
|
||||
+10
-12
@@ -42,9 +42,7 @@ struct _GdkFrameClockIdlePrivate
|
||||
gint64 frame_time;
|
||||
gint64 min_next_frame_time;
|
||||
gint64 sleep_serial;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 freeze_time;
|
||||
#endif
|
||||
|
||||
guint flush_idle_id;
|
||||
guint paint_idle_id;
|
||||
@@ -319,6 +317,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
|
||||
gboolean skip_to_resume_events;
|
||||
GdkFrameTimings *timings = NULL;
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
priv->paint_idle_id = 0;
|
||||
priv->in_paint_idle = TRUE;
|
||||
@@ -409,13 +408,13 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
{
|
||||
int iter;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
|
||||
timings->layout_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
/* We loop in the layout phase, because we don't want to progress
|
||||
@@ -439,13 +438,13 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
|
||||
timings->paint_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT;
|
||||
if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
|
||||
@@ -466,7 +465,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
timings->frame_end_time = g_get_monotonic_time ();
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
@@ -502,6 +501,9 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (priv->freeze_count == 0)
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "frameclock", "paint_idle");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -561,13 +563,11 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
|
||||
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
|
||||
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
if (gdk_profiler_is_running ())
|
||||
priv->freeze_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->freeze_count++;
|
||||
maybe_stop_idle (clock_idle);
|
||||
@@ -594,7 +594,6 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
|
||||
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
if (priv->freeze_time != 0)
|
||||
@@ -602,11 +601,10 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
|
||||
gint64 thaw_time = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (priv->freeze_time * 1000,
|
||||
(thaw_time - priv->freeze_time) * 1000,
|
||||
"freeze", "");
|
||||
"frameclock freeze", "");
|
||||
priv->freeze_time = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -955,7 +955,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
if (priv->use_es < 0)
|
||||
priv->use_es = !epoxy_is_desktop_gl ();
|
||||
|
||||
priv->has_debug_output = epoxy_has_gl_extension ("GL_ARB_debug_output");
|
||||
priv->has_debug_output = epoxy_has_gl_extension ("GL_ARB_debug_output") ||
|
||||
epoxy_has_gl_extension ("GL_KHR_debug");
|
||||
|
||||
#ifdef G_ENABLE_CONSISTENCY_CHECKS
|
||||
if (priv->has_debug_output)
|
||||
|
||||
@@ -266,6 +266,16 @@ void gdk_surface_get_geometry (GdkSurface *surface,
|
||||
|
||||
GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
|
||||
|
||||
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
|
||||
GdkSurface *surface,
|
||||
GdkSeatCapabilities capabilities,
|
||||
gboolean owner_events,
|
||||
GdkCursor *cursor,
|
||||
const GdkEvent *event,
|
||||
GdkSeatGrabPrepareFunc prepare_func,
|
||||
gpointer prepare_func_data);
|
||||
void gdk_seat_ungrab (GdkSeat *seat);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_INTERNALS_H__ */
|
||||
|
||||
+12
-9
@@ -100,7 +100,7 @@ gdk_rgba_free (GdkRGBA *rgba)
|
||||
gboolean
|
||||
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((double) 0x00ff / (double) 0xffff);
|
||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
gboolean
|
||||
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((double)0xff00 / (double)0xffff);
|
||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||
}
|
||||
|
||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||
@@ -398,23 +398,25 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||
|
||||
static gboolean
|
||||
parse_color_channel_value (GtkCssParser *parser,
|
||||
double *value,
|
||||
float *value,
|
||||
gboolean is_percentage)
|
||||
{
|
||||
double dvalue;
|
||||
|
||||
if (is_percentage)
|
||||
{
|
||||
if (!gtk_css_parser_consume_percentage (parser, value))
|
||||
if (!gtk_css_parser_consume_percentage (parser, &dvalue))
|
||||
return FALSE;
|
||||
|
||||
*value = CLAMP (*value, 0.0, 100.0) / 100.0;
|
||||
*value = CLAMP (dvalue, 0.0, 100.0) / 100.0;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gtk_css_parser_consume_number (parser, value))
|
||||
if (!gtk_css_parser_consume_number (parser, &dvalue))
|
||||
return FALSE;
|
||||
|
||||
*value = CLAMP (*value, 0.0, 255.0) / 255.0;
|
||||
*value = CLAMP (dvalue, 0.0, 255.0) / 255.0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -425,6 +427,7 @@ parse_color_channel (GtkCssParser *parser,
|
||||
gpointer data)
|
||||
{
|
||||
GdkRGBA *rgba = data;
|
||||
double dvalue;
|
||||
|
||||
switch (arg)
|
||||
{
|
||||
@@ -450,10 +453,10 @@ parse_color_channel (GtkCssParser *parser,
|
||||
return 1;
|
||||
|
||||
case 3:
|
||||
if (!gtk_css_parser_consume_number (parser, &rgba->alpha))
|
||||
if (!gtk_css_parser_consume_number (parser, &dvalue))
|
||||
return 0;
|
||||
|
||||
rgba->alpha = CLAMP (rgba->alpha, 0.0, 1.0);
|
||||
rgba->alpha = CLAMP (dvalue, 0.0, 1.0);
|
||||
return 1;
|
||||
|
||||
default:
|
||||
|
||||
+8
-8
@@ -36,10 +36,10 @@ G_BEGIN_DECLS
|
||||
|
||||
struct _GdkRGBA
|
||||
{
|
||||
gdouble red;
|
||||
gdouble green;
|
||||
gdouble blue;
|
||||
gdouble alpha;
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
float alpha;
|
||||
};
|
||||
|
||||
#define GDK_TYPE_RGBA (gdk_rgba_get_type ())
|
||||
@@ -53,15 +53,15 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_rgba_free (GdkRGBA *rgba);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_rgba_is_clear (const GdkRGBA *rgba);
|
||||
gboolean gdk_rgba_is_clear (const GdkRGBA *rgba) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_rgba_is_opaque (const GdkRGBA *rgba);
|
||||
gboolean gdk_rgba_is_opaque (const GdkRGBA *rgba) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_rgba_hash (gconstpointer p);
|
||||
guint gdk_rgba_hash (gconstpointer p) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2);
|
||||
gconstpointer p2) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_rgba_parse (GdkRGBA *rgba,
|
||||
|
||||
+3
-2
@@ -25,6 +25,7 @@
|
||||
#include "gdkseatprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
/**
|
||||
* SECTION:gdkseat
|
||||
@@ -247,10 +248,10 @@ gdk_seat_get_capabilities (GdkSeat *seat)
|
||||
* elsewhere.
|
||||
* @event: (nullable): the event that is triggering the grab, or %NULL if none
|
||||
* is available.
|
||||
* @prepare_func: (nullable) (scope call) (closure prepare_func_data): function to
|
||||
* @prepare_func: (nullable) (scope call): function to
|
||||
* prepare the surface to be grabbed, it can be %NULL if @surface is
|
||||
* visible before this call.
|
||||
* @prepare_func_data: user data to pass to @prepare_func
|
||||
* @prepare_func_data: (closure): user data to pass to @prepare_func
|
||||
*
|
||||
* Grabs the seat so that all events corresponding to the given @capabilities
|
||||
* are passed to this application until the seat is ungrabbed with gdk_seat_ungrab(),
|
||||
|
||||
@@ -82,18 +82,6 @@ struct _GdkSeat
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_seat_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
|
||||
GdkSurface *surface,
|
||||
GdkSeatCapabilities capabilities,
|
||||
gboolean owner_events,
|
||||
GdkCursor *cursor,
|
||||
const GdkEvent *event,
|
||||
GdkSeatGrabPrepareFunc prepare_func,
|
||||
gpointer prepare_func_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_seat_ungrab (GdkSeat *seat);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_seat_get_display (GdkSeat *seat);
|
||||
|
||||
|
||||
+19
-15
@@ -2438,10 +2438,10 @@ gdk_surface_get_root_coords (GdkSurface *surface,
|
||||
* @offset_x: X position of @shape_region in @surface coordinates
|
||||
* @offset_y: Y position of @shape_region in @surface coordinates
|
||||
*
|
||||
* Like gdk_surface_shape_combine_region(), but the shape applies
|
||||
* only to event handling. Mouse events which happen while
|
||||
* the pointer position corresponds to an unset bit in the
|
||||
* mask will be passed on the surface below @surface.
|
||||
* Apply the region to the surface for the purpose of event
|
||||
* handling. Mouse events which happen while the pointer position
|
||||
* corresponds to an unset bit in the mask will be passed on the
|
||||
* surface below @surface.
|
||||
*
|
||||
* An input shape is typically used with RGBA surfaces.
|
||||
* The alpha channel of the surface defines which pixels are
|
||||
@@ -3583,7 +3583,13 @@ gdk_surface_register_dnd (GdkSurface *surface)
|
||||
*
|
||||
* Starts a drag and creates a new drag context for it.
|
||||
*
|
||||
* This function is called by the drag source.
|
||||
* This function is called by the drag source. After this call, you
|
||||
* probably want to set up the drag icon using the surface returned
|
||||
* by gdk_drag_get_drag_surface().
|
||||
*
|
||||
* Note: if @actions include %GDK_ACTION_MOVE, you need to listen for
|
||||
* the #GdkDrag::dnd-finished signal and delete the data at the source
|
||||
* if gdk_drag_get_selected_action() returns %GDK_ACTION_MOVE.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a newly created #GdkDrag or
|
||||
* %NULL on error.
|
||||
@@ -3614,7 +3620,6 @@ gdk_surface_flush_events (GdkFrameClock *clock,
|
||||
_gdk_display_pause_events (surface->display);
|
||||
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS);
|
||||
|
||||
surface->frame_clock_events_paused = TRUE;
|
||||
}
|
||||
|
||||
@@ -3624,9 +3629,11 @@ gdk_surface_resume_events (GdkFrameClock *clock,
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
|
||||
_gdk_display_unpause_events (surface->display);
|
||||
|
||||
surface->frame_clock_events_paused = FALSE;
|
||||
if (surface->frame_clock_events_paused)
|
||||
{
|
||||
_gdk_display_unpause_events (surface->display);
|
||||
surface->frame_clock_events_paused = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3998,7 +4005,6 @@ rewrite_event_for_toplevel (GdkEvent *event)
|
||||
g_set_object (&event->any.surface, surface);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void
|
||||
add_event_mark (GdkEvent *event,
|
||||
gint64 time,
|
||||
@@ -4065,6 +4071,9 @@ add_event_mark (GdkEvent *event,
|
||||
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
message = g_strdup ("");
|
||||
break;
|
||||
|
||||
case GDK_TOUCHPAD_SWIPE:
|
||||
case GDK_TOUCHPAD_PINCH:
|
||||
case GDK_SCROLL:
|
||||
@@ -4106,14 +4115,11 @@ add_event_mark (GdkEvent *event,
|
||||
|
||||
g_free (message);
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
gdk_surface_handle_event (GdkEvent *event)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 begin_time = g_get_monotonic_time ();
|
||||
#endif
|
||||
gboolean handled = FALSE;
|
||||
|
||||
if (check_autohide (event))
|
||||
@@ -4132,10 +4138,8 @@ gdk_surface_handle_event (GdkEvent *event)
|
||||
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_profiler_is_running ())
|
||||
add_event_mark (event, begin_time, g_get_monotonic_time () - begin_time);
|
||||
#endif
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,9 +51,9 @@ GdkTexture * gdk_texture_new_from_file (GFile
|
||||
GError **error);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_texture_get_width (GdkTexture *texture);
|
||||
int gdk_texture_get_width (GdkTexture *texture) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_texture_get_height (GdkTexture *texture);
|
||||
int gdk_texture_get_height (GdkTexture *texture) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_texture_download (GdkTexture *texture,
|
||||
|
||||
+4
-3
@@ -568,11 +568,12 @@ typedef enum
|
||||
* @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
|
||||
* it from the source using the DELETE target of the X selection protocol.
|
||||
* @GDK_ACTION_LINK: Add a link to the data. Note that this is only
|
||||
* useful if source and destination agree on what it means.
|
||||
* useful if source and destination agree on what it means, and is not
|
||||
* supported on all platforms.
|
||||
* @GDK_ACTION_ASK: Ask the user what to do with the data.
|
||||
*
|
||||
* Used in #GdkDrag to indicate what the destination
|
||||
* should do with the dropped data.
|
||||
* Used in #GdkDrop and #GdkDrag to indicate the actions that the
|
||||
* destination can and should do with the dropped data.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ gdk_public_sources = files([
|
||||
'gdkdrawcontext.c',
|
||||
'gdkdrop.c',
|
||||
'gdkevents.c',
|
||||
'filetransferportal.c',
|
||||
'gdkframeclock.c',
|
||||
'gdkframeclockidle.c',
|
||||
'gdkframetimings.c',
|
||||
|
||||
@@ -55,9 +55,6 @@ _gdk_quartz_display_open (const gchar *display_name)
|
||||
if (_gdk_display != NULL)
|
||||
return NULL;
|
||||
|
||||
/* Initialize application */
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
_gdk_display = g_object_new (gdk_quartz_display_get_type (), NULL);
|
||||
_gdk_device_manager = _gdk_device_manager_new (_gdk_display);
|
||||
|
||||
@@ -67,6 +64,8 @@ _gdk_quartz_display_open (const gchar *display_name)
|
||||
|
||||
_gdk_quartz_events_init ();
|
||||
|
||||
/* Initialize application */
|
||||
[NSApplication sharedApplication];
|
||||
#if 0
|
||||
/* FIXME: Remove the #if 0 when we have these functions */
|
||||
_gdk_quartz_dnd_init ();
|
||||
|
||||
+14
-16
@@ -680,7 +680,6 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
{
|
||||
guint tmp_keyval;
|
||||
GdkModifierType bit;
|
||||
guint tmp_modifiers = 0;
|
||||
|
||||
if (keyval)
|
||||
*keyval = 0;
|
||||
@@ -694,24 +693,23 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
|
||||
return FALSE;
|
||||
|
||||
/* Check if modifiers modify the keyval */
|
||||
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
||||
{
|
||||
if (translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 0 : group,
|
||||
state & ~bit,
|
||||
NULL, NULL) !=
|
||||
translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 1 : group,
|
||||
state | bit,
|
||||
NULL, NULL))
|
||||
tmp_modifiers |= bit;
|
||||
}
|
||||
|
||||
tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
|
||||
|
||||
/* Check if modifiers modify the keyval */
|
||||
if (consumed_modifiers)
|
||||
*consumed_modifiers = tmp_modifiers;
|
||||
{
|
||||
guint tmp_modifiers = (state & GDK_MODIFIER_MASK);
|
||||
|
||||
for (bit = 1; bit <= tmp_modifiers; bit <<= 1)
|
||||
{
|
||||
if ((bit & tmp_modifiers) &&
|
||||
translate_keysym (hardware_keycode, group, state & ~bit,
|
||||
NULL, NULL) == tmp_keyval)
|
||||
tmp_modifiers &= ~bit;
|
||||
}
|
||||
|
||||
*consumed_modifiers = tmp_modifiers;
|
||||
}
|
||||
|
||||
if (keyval)
|
||||
*keyval = tmp_keyval;
|
||||
|
||||
@@ -2710,7 +2710,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
|
||||
impl_class->set_decorations = gdk_quartz_surface_set_decorations;
|
||||
impl_class->get_decorations = gdk_quartz_surface_get_decorations;
|
||||
impl_class->set_functions = gdk_quartz_surface_set_functions;
|
||||
impl_class->set_functions = gdk_quartz_surface_set_functions;
|
||||
impl_class->begin_resize_drag = gdk_quartz_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_quartz_surface_begin_move_drag;
|
||||
impl_class->set_opacity = gdk_quartz_surface_set_opacity;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
wayland_cursor_sources = files([
|
||||
'wayland-cursor.c',
|
||||
'xcursor.c',
|
||||
'os-compatibility.c'
|
||||
])
|
||||
|
||||
libwayland_cursor = static_library('wayland+cursor',
|
||||
sources: wayland_cursor_sources,
|
||||
include_directories: [ confinc, ],
|
||||
dependencies: [ glib_dep, ],
|
||||
c_args: common_cflags,
|
||||
link_args: common_ldflags)
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright © 2012 Collabora, Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define HAVE_MEMFD_CREATE
|
||||
#ifdef HAVE_MEMFD_CREATE
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include "os-compatibility.h"
|
||||
|
||||
#ifndef HAVE_MKOSTEMP
|
||||
static int
|
||||
set_cloexec_or_close(int fd)
|
||||
{
|
||||
long flags;
|
||||
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
if (flags == -1)
|
||||
goto err;
|
||||
|
||||
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
|
||||
goto err;
|
||||
|
||||
return fd;
|
||||
|
||||
err:
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
create_tmpfile_cloexec(char *tmpname)
|
||||
{
|
||||
int fd;
|
||||
|
||||
#ifdef HAVE_MKOSTEMP
|
||||
fd = mkostemp(tmpname, O_CLOEXEC);
|
||||
if (fd >= 0)
|
||||
unlink(tmpname);
|
||||
#else
|
||||
fd = mkstemp(tmpname);
|
||||
if (fd >= 0) {
|
||||
fd = set_cloexec_or_close(fd);
|
||||
unlink(tmpname);
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new, unique, anonymous file of the given size, and
|
||||
* return the file descriptor for it. The file descriptor is set
|
||||
* CLOEXEC. The file is immediately suitable for mmap()'ing
|
||||
* the given size at offset zero.
|
||||
*
|
||||
* The file should not have a permanent backing store like a disk,
|
||||
* but may have if XDG_RUNTIME_DIR is not properly implemented in OS.
|
||||
*
|
||||
* The file name is deleted from the file system.
|
||||
*
|
||||
* The file is suitable for buffer sharing between processes by
|
||||
* transmitting the file descriptor over Unix sockets using the
|
||||
* SCM_RIGHTS methods.
|
||||
*
|
||||
* If the C library implements posix_fallocate(), it is used to
|
||||
* guarantee that disk space is available for the file at the
|
||||
* given size. If disk space is insufficent, errno is set to ENOSPC.
|
||||
* If posix_fallocate() is not supported, program may receive
|
||||
* SIGBUS on accessing mmap()'ed file contents instead.
|
||||
*
|
||||
* If the C library implements memfd_create(), it is used to create the
|
||||
* file purely in memory, without any backing file name on the file
|
||||
* system, and then sealing off the possibility of shrinking it. This
|
||||
* can then be checked before accessing mmap()'ed file contents, to
|
||||
* make sure SIGBUS can't happen. It also avoids requiring
|
||||
* XDG_RUNTIME_DIR.
|
||||
*/
|
||||
int
|
||||
os_create_anonymous_file(off_t size)
|
||||
{
|
||||
static const char template[] = "/wayland-cursor-shared-XXXXXX";
|
||||
const char *path;
|
||||
char *name;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_MEMFD_CREATE
|
||||
fd = memfd_create("wayland-cursor", MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
||||
if (fd >= 0) {
|
||||
/* We can add this seal before calling posix_fallocate(), as
|
||||
* the file is currently zero-sized anyway.
|
||||
*
|
||||
* There is also no need to check for the return value, we
|
||||
* couldn't do anything with it anyway.
|
||||
*/
|
||||
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
path = getenv("XDG_RUNTIME_DIR");
|
||||
if (!path) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
name = malloc(strlen(path) + sizeof(template));
|
||||
if (!name)
|
||||
return -1;
|
||||
|
||||
strcpy(name, path);
|
||||
strcat(name, template);
|
||||
|
||||
fd = create_tmpfile_cloexec(name);
|
||||
|
||||
free(name);
|
||||
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
ret = posix_fallocate(fd, 0, size);
|
||||
if (ret != 0) {
|
||||
close(fd);
|
||||
errno = ret;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
ret = ftruncate(fd, size);
|
||||
if (ret < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright © 2012 Collabora, Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OS_COMPATIBILITY_H
|
||||
#define OS_COMPATIBILITY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
os_create_anonymous_file(off_t size);
|
||||
|
||||
#endif /* OS_COMPATIBILITY_H */
|
||||
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "xcursor.h"
|
||||
#include "wayland-cursor.h"
|
||||
#include "wayland-client.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <os-compatibility.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
|
||||
|
||||
struct shm_pool {
|
||||
struct wl_shm_pool *pool;
|
||||
int fd;
|
||||
unsigned int size;
|
||||
unsigned int used;
|
||||
char *data;
|
||||
};
|
||||
|
||||
static struct shm_pool *
|
||||
shm_pool_create(struct wl_shm *shm, int size)
|
||||
{
|
||||
struct shm_pool *pool;
|
||||
|
||||
pool = malloc(sizeof *pool);
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
pool->fd = os_create_anonymous_file (size);
|
||||
if (pool->fd < 0)
|
||||
goto err_free;
|
||||
|
||||
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
pool->fd, 0);
|
||||
|
||||
if (pool->data == MAP_FAILED)
|
||||
goto err_close;
|
||||
|
||||
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
|
||||
pool->size = size;
|
||||
pool->used = 0;
|
||||
|
||||
return pool;
|
||||
|
||||
err_close:
|
||||
close(pool->fd);
|
||||
err_free:
|
||||
free(pool);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
shm_pool_resize(struct shm_pool *pool, int size)
|
||||
{
|
||||
if (ftruncate(pool->fd, size) < 0)
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
errno = posix_fallocate(pool->fd, 0, size);
|
||||
if (errno != 0)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
wl_shm_pool_resize(pool->pool, size);
|
||||
|
||||
munmap(pool->data, pool->size);
|
||||
|
||||
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
pool->fd, 0);
|
||||
if (pool->data == (void *)-1)
|
||||
return 0;
|
||||
pool->size = size;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
shm_pool_allocate(struct shm_pool *pool, int size)
|
||||
{
|
||||
int offset;
|
||||
|
||||
if (pool->used + size > pool->size)
|
||||
if (!shm_pool_resize(pool, 2 * pool->size + size))
|
||||
return -1;
|
||||
|
||||
offset = pool->used;
|
||||
pool->used += size;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static void
|
||||
shm_pool_destroy(struct shm_pool *pool)
|
||||
{
|
||||
munmap(pool->data, pool->size);
|
||||
wl_shm_pool_destroy(pool->pool);
|
||||
close(pool->fd);
|
||||
free(pool);
|
||||
}
|
||||
|
||||
|
||||
struct wl_cursor_theme {
|
||||
unsigned int cursor_count;
|
||||
struct wl_cursor **cursors;
|
||||
struct wl_shm *shm;
|
||||
struct shm_pool *pool;
|
||||
int size;
|
||||
char *path;
|
||||
};
|
||||
|
||||
struct cursor_image {
|
||||
struct wl_cursor_image image;
|
||||
struct wl_cursor_theme *theme;
|
||||
struct wl_buffer *buffer;
|
||||
int offset; /* data offset of this image in the shm pool */
|
||||
};
|
||||
|
||||
struct cursor {
|
||||
struct wl_cursor cursor;
|
||||
uint32_t total_delay; /* length of the animation in ms */
|
||||
};
|
||||
|
||||
/** Get an shm buffer for a cursor image
|
||||
*
|
||||
* \param image The cursor image
|
||||
* \return An shm buffer for the cursor image. The user should not destroy
|
||||
* the returned buffer.
|
||||
*/
|
||||
struct wl_buffer *
|
||||
wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
|
||||
{
|
||||
struct cursor_image *image = (struct cursor_image *) _img;
|
||||
struct wl_cursor_theme *theme = image->theme;
|
||||
|
||||
if (!image->buffer) {
|
||||
image->buffer =
|
||||
wl_shm_pool_create_buffer(theme->pool->pool,
|
||||
image->offset,
|
||||
_img->width, _img->height,
|
||||
_img->width * 4,
|
||||
WL_SHM_FORMAT_ARGB8888);
|
||||
};
|
||||
|
||||
return image->buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
wl_cursor_image_destroy(struct wl_cursor_image *_img)
|
||||
{
|
||||
struct cursor_image *image = (struct cursor_image *) _img;
|
||||
|
||||
if (image->buffer)
|
||||
wl_buffer_destroy(image->buffer);
|
||||
|
||||
free(image);
|
||||
}
|
||||
|
||||
static void
|
||||
wl_cursor_destroy(struct wl_cursor *cursor)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < cursor->image_count; i++)
|
||||
wl_cursor_image_destroy(cursor->images[i]);
|
||||
|
||||
free(cursor->images);
|
||||
free(cursor->name);
|
||||
free(cursor);
|
||||
}
|
||||
|
||||
static struct wl_cursor *
|
||||
wl_cursor_create_from_xcursor_images(XcursorImages *images,
|
||||
struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int load_size)
|
||||
{
|
||||
struct cursor *cursor;
|
||||
struct cursor_image *image;
|
||||
int i, size;
|
||||
|
||||
cursor = malloc(sizeof *cursor);
|
||||
if (!cursor)
|
||||
return NULL;
|
||||
|
||||
cursor->cursor.images =
|
||||
malloc(images->nimage * sizeof cursor->cursor.images[0]);
|
||||
if (!cursor->cursor.images) {
|
||||
free(cursor);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cursor->cursor.name = strdup(name);
|
||||
cursor->cursor.size = load_size;
|
||||
cursor->total_delay = 0;
|
||||
|
||||
for (i = 0; i < images->nimage; i++) {
|
||||
image = malloc(sizeof *image);
|
||||
if (image == NULL)
|
||||
break;
|
||||
|
||||
image->theme = theme;
|
||||
image->buffer = NULL;
|
||||
|
||||
image->image.width = images->images[i]->width;
|
||||
image->image.height = images->images[i]->height;
|
||||
image->image.hotspot_x = images->images[i]->xhot;
|
||||
image->image.hotspot_y = images->images[i]->yhot;
|
||||
image->image.delay = images->images[i]->delay;
|
||||
|
||||
size = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, size);
|
||||
if (image->offset < 0) {
|
||||
free(image);
|
||||
break;
|
||||
}
|
||||
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, size);
|
||||
cursor->total_delay += image->image.delay;
|
||||
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
|
||||
}
|
||||
cursor->cursor.image_count = i;
|
||||
|
||||
if (cursor->cursor.image_count == 0) {
|
||||
free(cursor->cursor.name);
|
||||
free(cursor->cursor.images);
|
||||
free(cursor);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &cursor->cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
struct wl_cursor *cursor;
|
||||
char *path;
|
||||
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, size);
|
||||
g_free (path);
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
|
||||
|
||||
if (cursor) {
|
||||
theme->cursor_count++;
|
||||
theme->cursors =
|
||||
realloc(theme->cursors,
|
||||
theme->cursor_count * sizeof theme->cursors[0]);
|
||||
|
||||
if (theme->cursors == NULL) {
|
||||
theme->cursor_count--;
|
||||
free(cursor);
|
||||
} else {
|
||||
theme->cursors[theme->cursor_count - 1] = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
}
|
||||
|
||||
/** Load a cursor theme to memory shared with the compositor
|
||||
*
|
||||
* \param name The name of the cursor theme to load. If %NULL, the default
|
||||
* theme will be loaded.
|
||||
* \param size Desired size of the cursor images.
|
||||
* \param shm The compositor's shm interface.
|
||||
*
|
||||
* \return An object representing the theme that should be destroyed with
|
||||
* wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
|
||||
* name exists, a default theme will be loaded.
|
||||
*/
|
||||
struct wl_cursor_theme *
|
||||
wl_cursor_theme_create(const char *path, int size, struct wl_shm *shm)
|
||||
{
|
||||
struct wl_cursor_theme *theme;
|
||||
|
||||
theme = malloc(sizeof *theme);
|
||||
if (!theme)
|
||||
return NULL;
|
||||
|
||||
theme->path = strdup (path);
|
||||
theme->size = size;
|
||||
theme->cursor_count = 0;
|
||||
theme->cursors = NULL;
|
||||
|
||||
theme->pool = shm_pool_create(shm, size * size * 4);
|
||||
if (!theme->pool) {
|
||||
free (theme->path);
|
||||
free (theme);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
/** Destroys a cursor theme object
|
||||
*
|
||||
* \param theme The cursor theme to be destroyed
|
||||
*/
|
||||
void
|
||||
wl_cursor_theme_destroy(struct wl_cursor_theme *theme)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < theme->cursor_count; i++)
|
||||
wl_cursor_destroy(theme->cursors[i]);
|
||||
|
||||
shm_pool_destroy(theme->pool);
|
||||
|
||||
free(theme->cursors);
|
||||
free(theme->path);
|
||||
free(theme);
|
||||
}
|
||||
|
||||
/** Get the cursor for a given name from a cursor theme
|
||||
*
|
||||
* \param theme The cursor theme
|
||||
* \param name Name of the desired cursor
|
||||
* \return The theme's cursor of the given name or %NULL if there is no
|
||||
* such cursor
|
||||
*/
|
||||
struct wl_cursor *
|
||||
wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int scale)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int size;
|
||||
|
||||
size = theme->size * scale;
|
||||
|
||||
for (i = 0; i < theme->cursor_count; i++) {
|
||||
if (size == theme->cursors[i]->size &&
|
||||
strcmp(name, theme->cursors[i]->name) == 0)
|
||||
return theme->cursors[i];
|
||||
}
|
||||
|
||||
load_cursor (theme, name, size);
|
||||
|
||||
if (i < theme->cursor_count) {
|
||||
if (size == theme->cursors[i]->size &&
|
||||
strcmp (name, theme->cursors[theme->cursor_count - 1]->name) == 0)
|
||||
return theme->cursors[theme->cursor_count - 1];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright © 2012 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef WAYLAND_CURSOR_H
|
||||
#define WAYLAND_CURSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct wl_cursor_theme;
|
||||
struct wl_buffer;
|
||||
struct wl_shm;
|
||||
|
||||
struct wl_cursor_image {
|
||||
uint32_t width; /* actual width */
|
||||
uint32_t height; /* actual height */
|
||||
uint32_t hotspot_x; /* hot spot x (must be inside image) */
|
||||
uint32_t hotspot_y; /* hot spot y (must be inside image) */
|
||||
uint32_t delay; /* animation delay to next frame (ms) */
|
||||
};
|
||||
|
||||
struct wl_cursor {
|
||||
unsigned int image_count;
|
||||
struct wl_cursor_image **images;
|
||||
char *name;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
struct wl_cursor_theme *
|
||||
wl_cursor_theme_create(const char *name, int size, struct wl_shm *shm);
|
||||
|
||||
void
|
||||
wl_cursor_theme_destroy(struct wl_cursor_theme *theme);
|
||||
|
||||
struct wl_cursor *
|
||||
wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int scale);
|
||||
|
||||
struct wl_buffer *
|
||||
wl_cursor_image_get_buffer(struct wl_cursor_image *image);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,612 @@
|
||||
/*
|
||||
* Copyright © 2002 Keith Packard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xcursor.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* From libXcursor/include/X11/extensions/Xcursor.h
|
||||
*/
|
||||
|
||||
#define XcursorTrue 1
|
||||
#define XcursorFalse 0
|
||||
|
||||
/*
|
||||
* Cursor files start with a header. The header
|
||||
* contains a magic number, a version number and a
|
||||
* table of contents which has type and offset information
|
||||
* for the remaining tables in the file.
|
||||
*
|
||||
* File minor versions increment for compatible changes
|
||||
* File major versions increment for incompatible changes (never, we hope)
|
||||
*
|
||||
* Chunks of the same type are always upward compatible. Incompatible
|
||||
* changes are made with new chunk types; the old data can remain under
|
||||
* the old type. Upward compatible changes can add header data as the
|
||||
* header lengths are specified in the file.
|
||||
*
|
||||
* File:
|
||||
* FileHeader
|
||||
* LISTofChunk
|
||||
*
|
||||
* FileHeader:
|
||||
* CARD32 magic magic number
|
||||
* CARD32 header bytes in file header
|
||||
* CARD32 version file version
|
||||
* CARD32 ntoc number of toc entries
|
||||
* LISTofFileToc toc table of contents
|
||||
*
|
||||
* FileToc:
|
||||
* CARD32 type entry type
|
||||
* CARD32 subtype entry subtype (size for images)
|
||||
* CARD32 position absolute file position
|
||||
*/
|
||||
|
||||
#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */
|
||||
|
||||
/*
|
||||
* Current Xcursor version number. Will be substituted by configure
|
||||
* from the version in the libXcursor configure.ac file.
|
||||
*/
|
||||
|
||||
#define XCURSOR_LIB_MAJOR 1
|
||||
#define XCURSOR_LIB_MINOR 1
|
||||
#define XCURSOR_LIB_REVISION 13
|
||||
#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \
|
||||
(XCURSOR_LIB_MINOR * 100) + \
|
||||
(XCURSOR_LIB_REVISION))
|
||||
|
||||
/*
|
||||
* This version number is stored in cursor files; changes to the
|
||||
* file format require updating this version number
|
||||
*/
|
||||
#define XCURSOR_FILE_MAJOR 1
|
||||
#define XCURSOR_FILE_MINOR 0
|
||||
#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
|
||||
#define XCURSOR_FILE_HEADER_LEN (4 * 4)
|
||||
#define XCURSOR_FILE_TOC_LEN (3 * 4)
|
||||
|
||||
typedef struct _XcursorFileToc {
|
||||
XcursorUInt type; /* chunk type */
|
||||
XcursorUInt subtype; /* subtype (size for images) */
|
||||
XcursorUInt position; /* absolute position in file */
|
||||
} XcursorFileToc;
|
||||
|
||||
typedef struct _XcursorFileHeader {
|
||||
XcursorUInt magic; /* magic number */
|
||||
XcursorUInt header; /* byte length of header */
|
||||
XcursorUInt version; /* file version number */
|
||||
XcursorUInt ntoc; /* number of toc entries */
|
||||
XcursorFileToc *tocs; /* table of contents */
|
||||
} XcursorFileHeader;
|
||||
|
||||
/*
|
||||
* The rest of the file is a list of chunks, each tagged by type
|
||||
* and version.
|
||||
*
|
||||
* Chunk:
|
||||
* ChunkHeader
|
||||
* <extra type-specific header fields>
|
||||
* <type-specific data>
|
||||
*
|
||||
* ChunkHeader:
|
||||
* CARD32 header bytes in chunk header + type header
|
||||
* CARD32 type chunk type
|
||||
* CARD32 subtype chunk subtype
|
||||
* CARD32 version chunk type version
|
||||
*/
|
||||
|
||||
#define XCURSOR_CHUNK_HEADER_LEN (4 * 4)
|
||||
|
||||
typedef struct _XcursorChunkHeader {
|
||||
XcursorUInt header; /* bytes in chunk header */
|
||||
XcursorUInt type; /* chunk type */
|
||||
XcursorUInt subtype; /* chunk subtype (size for images) */
|
||||
XcursorUInt version; /* version of this type */
|
||||
} XcursorChunkHeader;
|
||||
|
||||
/*
|
||||
* Here's a list of the known chunk types
|
||||
*/
|
||||
|
||||
/*
|
||||
* Comments consist of a 4-byte length field followed by
|
||||
* UTF-8 encoded text
|
||||
*
|
||||
* Comment:
|
||||
* ChunkHeader header chunk header
|
||||
* CARD32 length bytes in text
|
||||
* LISTofCARD8 text UTF-8 encoded text
|
||||
*/
|
||||
|
||||
#define XCURSOR_COMMENT_TYPE 0xfffe0001
|
||||
#define XCURSOR_COMMENT_VERSION 1
|
||||
#define XCURSOR_COMMENT_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
|
||||
#define XCURSOR_COMMENT_COPYRIGHT 1
|
||||
#define XCURSOR_COMMENT_LICENSE 2
|
||||
#define XCURSOR_COMMENT_OTHER 3
|
||||
#define XCURSOR_COMMENT_MAX_LEN 0x100000
|
||||
|
||||
typedef struct _XcursorComment {
|
||||
XcursorUInt version;
|
||||
XcursorUInt comment_type;
|
||||
char *comment;
|
||||
} XcursorComment;
|
||||
|
||||
/*
|
||||
* Each cursor image occupies a separate image chunk.
|
||||
* The length of the image header follows the chunk header
|
||||
* so that future versions can extend the header without
|
||||
* breaking older applications
|
||||
*
|
||||
* Image:
|
||||
* ChunkHeader header chunk header
|
||||
* CARD32 width actual width
|
||||
* CARD32 height actual height
|
||||
* CARD32 xhot hot spot x
|
||||
* CARD32 yhot hot spot y
|
||||
* CARD32 delay animation delay
|
||||
* LISTofCARD32 pixels ARGB pixels
|
||||
*/
|
||||
|
||||
#define XCURSOR_IMAGE_TYPE 0xfffd0002
|
||||
#define XCURSOR_IMAGE_VERSION 1
|
||||
#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4))
|
||||
#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */
|
||||
|
||||
typedef struct _XcursorFile XcursorFile;
|
||||
|
||||
struct _XcursorFile {
|
||||
void *closure;
|
||||
int (*read) (XcursorFile *file, unsigned char *buf, int len);
|
||||
int (*write) (XcursorFile *file, unsigned char *buf, int len);
|
||||
int (*seek) (XcursorFile *file, long offset, int whence);
|
||||
};
|
||||
|
||||
typedef struct _XcursorComments {
|
||||
int ncomment; /* number of comments */
|
||||
XcursorComment **comments; /* array of XcursorComment pointers */
|
||||
} XcursorComments;
|
||||
|
||||
/*
|
||||
* From libXcursor/src/file.c
|
||||
*/
|
||||
|
||||
static XcursorImage *
|
||||
XcursorImageCreate (int width, int height)
|
||||
{
|
||||
XcursorImage *image;
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return NULL;
|
||||
if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
|
||||
return NULL;
|
||||
|
||||
image = malloc (sizeof (XcursorImage) +
|
||||
width * height * sizeof (XcursorPixel));
|
||||
if (!image)
|
||||
return NULL;
|
||||
image->version = XCURSOR_IMAGE_VERSION;
|
||||
image->pixels = (XcursorPixel *) (image + 1);
|
||||
image->size = width > height ? width : height;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->delay = 0;
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
XcursorImageDestroy (XcursorImage *image)
|
||||
{
|
||||
free (image);
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorImagesCreate (int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
|
||||
images = malloc (sizeof (XcursorImages) +
|
||||
size * sizeof (XcursorImage *));
|
||||
if (!images)
|
||||
return NULL;
|
||||
images->nimage = 0;
|
||||
images->images = (XcursorImage **) (images + 1);
|
||||
images->name = NULL;
|
||||
return images;
|
||||
}
|
||||
|
||||
static void
|
||||
XcursorImagesDestroy (XcursorImages *images)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
for (n = 0; n < images->nimage; n++)
|
||||
XcursorImageDestroy (images->images[n]);
|
||||
if (images->name)
|
||||
free (images->name);
|
||||
free (images);
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
|
||||
{
|
||||
unsigned char bytes[4];
|
||||
|
||||
if (!file || !u)
|
||||
return XcursorFalse;
|
||||
|
||||
if ((*file->read) (file, bytes, 4) != 4)
|
||||
return XcursorFalse;
|
||||
*u = ((bytes[0] << 0) |
|
||||
(bytes[1] << 8) |
|
||||
(bytes[2] << 16) |
|
||||
(bytes[3] << 24));
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
static void
|
||||
_XcursorFileHeaderDestroy (XcursorFileHeader *fileHeader)
|
||||
{
|
||||
free (fileHeader);
|
||||
}
|
||||
|
||||
static XcursorFileHeader *
|
||||
_XcursorFileHeaderCreate (int ntoc)
|
||||
{
|
||||
XcursorFileHeader *fileHeader;
|
||||
|
||||
if (ntoc > 0x10000)
|
||||
return NULL;
|
||||
fileHeader = malloc (sizeof (XcursorFileHeader) +
|
||||
ntoc * sizeof (XcursorFileToc));
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
fileHeader->magic = XCURSOR_MAGIC;
|
||||
fileHeader->header = XCURSOR_FILE_HEADER_LEN;
|
||||
fileHeader->version = XCURSOR_FILE_VERSION;
|
||||
fileHeader->ntoc = ntoc;
|
||||
fileHeader->tocs = (XcursorFileToc *) (fileHeader + 1);
|
||||
return fileHeader;
|
||||
}
|
||||
|
||||
static XcursorFileHeader *
|
||||
_XcursorReadFileHeader (XcursorFile *file)
|
||||
{
|
||||
XcursorFileHeader head, *fileHeader;
|
||||
XcursorUInt skip;
|
||||
unsigned int n;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
if (!_XcursorReadUInt (file, &head.magic))
|
||||
return NULL;
|
||||
if (head.magic != XCURSOR_MAGIC)
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.header))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.version))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.ntoc))
|
||||
return NULL;
|
||||
skip = head.header - XCURSOR_FILE_HEADER_LEN;
|
||||
if (skip)
|
||||
if ((*file->seek) (file, skip, SEEK_CUR) == EOF)
|
||||
return NULL;
|
||||
fileHeader = _XcursorFileHeaderCreate (head.ntoc);
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
fileHeader->magic = head.magic;
|
||||
fileHeader->header = head.header;
|
||||
fileHeader->version = head.version;
|
||||
fileHeader->ntoc = head.ntoc;
|
||||
for (n = 0; n < fileHeader->ntoc; n++)
|
||||
{
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].type))
|
||||
break;
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].subtype))
|
||||
break;
|
||||
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].position))
|
||||
break;
|
||||
}
|
||||
if (n != fileHeader->ntoc)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
return fileHeader;
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorSeekToToc (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc)
|
||||
{
|
||||
if (!file || !fileHeader || \
|
||||
(*file->seek) (file, fileHeader->tocs[toc].position, SEEK_SET) == EOF)
|
||||
return XcursorFalse;
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
static XcursorBool
|
||||
_XcursorFileReadChunkHeader (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc,
|
||||
XcursorChunkHeader *chunkHeader)
|
||||
{
|
||||
if (!file || !fileHeader || !chunkHeader)
|
||||
return XcursorFalse;
|
||||
if (!_XcursorSeekToToc (file, fileHeader, toc))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->header))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->type))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->subtype))
|
||||
return XcursorFalse;
|
||||
if (!_XcursorReadUInt (file, &chunkHeader->version))
|
||||
return XcursorFalse;
|
||||
/* sanity check */
|
||||
if (chunkHeader->type != fileHeader->tocs[toc].type ||
|
||||
chunkHeader->subtype != fileHeader->tocs[toc].subtype)
|
||||
return XcursorFalse;
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
#define dist(a,b) ((a) > (b) ? (a) - (b) : (b) - (a))
|
||||
|
||||
static XcursorDim
|
||||
_XcursorFindBestSize (XcursorFileHeader *fileHeader,
|
||||
XcursorDim size,
|
||||
int *nsizesp)
|
||||
{
|
||||
unsigned int n;
|
||||
int nsizes = 0;
|
||||
XcursorDim bestSize = 0;
|
||||
XcursorDim thisSize;
|
||||
|
||||
if (!fileHeader || !nsizesp)
|
||||
return 0;
|
||||
|
||||
for (n = 0; n < fileHeader->ntoc; n++)
|
||||
{
|
||||
if (fileHeader->tocs[n].type != XCURSOR_IMAGE_TYPE)
|
||||
continue;
|
||||
thisSize = fileHeader->tocs[n].subtype;
|
||||
if (!bestSize || dist (thisSize, size) < dist (bestSize, size))
|
||||
{
|
||||
bestSize = thisSize;
|
||||
nsizes = 1;
|
||||
}
|
||||
else if (thisSize == bestSize)
|
||||
nsizes++;
|
||||
}
|
||||
*nsizesp = nsizes;
|
||||
return bestSize;
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorFindImageToc (XcursorFileHeader *fileHeader,
|
||||
XcursorDim size,
|
||||
int count)
|
||||
{
|
||||
unsigned int toc;
|
||||
XcursorDim thisSize;
|
||||
|
||||
if (!fileHeader)
|
||||
return 0;
|
||||
|
||||
for (toc = 0; toc < fileHeader->ntoc; toc++)
|
||||
{
|
||||
if (fileHeader->tocs[toc].type != XCURSOR_IMAGE_TYPE)
|
||||
continue;
|
||||
thisSize = fileHeader->tocs[toc].subtype;
|
||||
if (thisSize != size)
|
||||
continue;
|
||||
if (!count)
|
||||
break;
|
||||
count--;
|
||||
}
|
||||
if (toc == fileHeader->ntoc)
|
||||
return -1;
|
||||
return toc;
|
||||
}
|
||||
|
||||
static XcursorImage *
|
||||
_XcursorReadImage (XcursorFile *file,
|
||||
XcursorFileHeader *fileHeader,
|
||||
int toc)
|
||||
{
|
||||
XcursorChunkHeader chunkHeader;
|
||||
XcursorImage head;
|
||||
XcursorImage *image;
|
||||
int n;
|
||||
XcursorPixel *p;
|
||||
|
||||
if (!file || !fileHeader)
|
||||
return NULL;
|
||||
|
||||
if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.width))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.height))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.xhot))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.yhot))
|
||||
return NULL;
|
||||
if (!_XcursorReadUInt (file, &head.delay))
|
||||
return NULL;
|
||||
/* sanity check data */
|
||||
if (head.width > XCURSOR_IMAGE_MAX_SIZE ||
|
||||
head.height > XCURSOR_IMAGE_MAX_SIZE)
|
||||
return NULL;
|
||||
if (head.width == 0 || head.height == 0)
|
||||
return NULL;
|
||||
if (head.xhot > head.width || head.yhot > head.height)
|
||||
return NULL;
|
||||
|
||||
/* Create the image and initialize it */
|
||||
image = XcursorImageCreate (head.width, head.height);
|
||||
if (image == NULL)
|
||||
return NULL;
|
||||
if (chunkHeader.version < image->version)
|
||||
image->version = chunkHeader.version;
|
||||
image->size = chunkHeader.subtype;
|
||||
image->xhot = head.xhot;
|
||||
image->yhot = head.yhot;
|
||||
image->delay = head.delay;
|
||||
n = image->width * image->height;
|
||||
p = image->pixels;
|
||||
while (n--)
|
||||
{
|
||||
if (!_XcursorReadUInt (file, p))
|
||||
{
|
||||
XcursorImageDestroy (image);
|
||||
return NULL;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorXcFileLoadImages (XcursorFile *file, int size)
|
||||
{
|
||||
XcursorFileHeader *fileHeader;
|
||||
XcursorDim bestSize;
|
||||
int nsize;
|
||||
XcursorImages *images;
|
||||
int n;
|
||||
int toc;
|
||||
|
||||
if (!file || size < 0)
|
||||
return NULL;
|
||||
fileHeader = _XcursorReadFileHeader (file);
|
||||
if (!fileHeader)
|
||||
return NULL;
|
||||
bestSize = _XcursorFindBestSize (fileHeader, (XcursorDim) size, &nsize);
|
||||
if (!bestSize)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
images = XcursorImagesCreate (nsize);
|
||||
if (!images)
|
||||
{
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
return NULL;
|
||||
}
|
||||
for (n = 0; n < nsize; n++)
|
||||
{
|
||||
toc = _XcursorFindImageToc (fileHeader, bestSize, n);
|
||||
if (toc < 0)
|
||||
break;
|
||||
images->images[images->nimage] = _XcursorReadImage (file, fileHeader,
|
||||
toc);
|
||||
if (!images->images[images->nimage])
|
||||
break;
|
||||
images->nimage++;
|
||||
}
|
||||
_XcursorFileHeaderDestroy (fileHeader);
|
||||
if (images->nimage != nsize)
|
||||
{
|
||||
XcursorImagesDestroy (images);
|
||||
images = NULL;
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileRead (XcursorFile *file, unsigned char *buf, int len)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fread (buf, 1, len, f);
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileWrite (XcursorFile *file, unsigned char *buf, int len)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fwrite (buf, 1, len, f);
|
||||
}
|
||||
|
||||
static int
|
||||
_XcursorStdioFileSeek (XcursorFile *file, long offset, int whence)
|
||||
{
|
||||
FILE *f = file->closure;
|
||||
return fseek (f, offset, whence);
|
||||
}
|
||||
|
||||
static void
|
||||
_XcursorStdioFileInitialize (FILE *stdfile, XcursorFile *file)
|
||||
{
|
||||
file->closure = stdfile;
|
||||
file->read = _XcursorStdioFileRead;
|
||||
file->write = _XcursorStdioFileWrite;
|
||||
file->seek = _XcursorStdioFileSeek;
|
||||
}
|
||||
|
||||
static XcursorImages *
|
||||
XcursorFileLoadImages (FILE *file, int size)
|
||||
{
|
||||
XcursorFile f;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
_XcursorStdioFileInitialize (file, &f);
|
||||
return XcursorXcFileLoadImages (&f, size);
|
||||
}
|
||||
|
||||
XcursorImages *
|
||||
xcursor_load_images (const char *path, int size)
|
||||
{
|
||||
FILE *f;
|
||||
XcursorImages *images;
|
||||
|
||||
f = fopen (path, "r");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
images = XcursorFileLoadImages (f, size);
|
||||
fclose (f);
|
||||
|
||||
return images;
|
||||
}
|
||||
|
||||
void
|
||||
xcursor_images_destroy (XcursorImages *images)
|
||||
{
|
||||
XcursorImagesDestroy (images);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright © 2002 Keith Packard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef XCURSOR_H
|
||||
#define XCURSOR_H
|
||||
|
||||
typedef int XcursorBool;
|
||||
typedef unsigned int XcursorUInt;
|
||||
|
||||
typedef XcursorUInt XcursorDim;
|
||||
typedef XcursorUInt XcursorPixel;
|
||||
|
||||
typedef struct _XcursorImage {
|
||||
XcursorUInt version; /* version of the image data */
|
||||
XcursorDim size; /* nominal size for matching */
|
||||
XcursorDim width; /* actual width */
|
||||
XcursorDim height; /* actual height */
|
||||
XcursorDim xhot; /* hot spot x (must be inside image) */
|
||||
XcursorDim yhot; /* hot spot y (must be inside image) */
|
||||
XcursorUInt delay; /* animation delay to next frame (ms) */
|
||||
XcursorPixel *pixels; /* pointer to pixels */
|
||||
} XcursorImage;
|
||||
|
||||
/*
|
||||
* Other data structures exposed by the library API
|
||||
*/
|
||||
typedef struct _XcursorImages {
|
||||
int nimage; /* number of images */
|
||||
XcursorImage **images; /* array of XcursorImage pointers */
|
||||
char *name; /* name used to load images */
|
||||
} XcursorImages;
|
||||
|
||||
void
|
||||
xcursor_images_destroy (XcursorImages *images);
|
||||
|
||||
XcursorImages *
|
||||
xcursor_load_images (const char *path, int size);
|
||||
|
||||
#endif
|
||||
@@ -33,8 +33,7 @@
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkwayland.h"
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include <wayland-cursor.h>
|
||||
#include "cursor/wayland-cursor.h"
|
||||
|
||||
static void
|
||||
gdk_wayland_cursor_remove_from_cache (gpointer data, GObject *cursor)
|
||||
@@ -119,11 +118,12 @@ name_fallback (const gchar *name)
|
||||
static struct wl_cursor *
|
||||
gdk_wayland_cursor_load_for_name (GdkWaylandDisplay *display_wayland,
|
||||
struct wl_cursor_theme *theme,
|
||||
int scale,
|
||||
const char *name)
|
||||
{
|
||||
struct wl_cursor *c;
|
||||
|
||||
c = wl_cursor_theme_get_cursor (theme, name);
|
||||
c = wl_cursor_theme_get_cursor (theme, name, scale);
|
||||
if (!c)
|
||||
{
|
||||
const char *fallback;
|
||||
@@ -131,7 +131,7 @@ gdk_wayland_cursor_load_for_name (GdkWaylandDisplay *display_wayland,
|
||||
fallback = name_fallback (name);
|
||||
if (fallback)
|
||||
{
|
||||
c = wl_cursor_theme_get_cursor (theme, fallback);
|
||||
c = wl_cursor_theme_get_cursor (theme, fallback, scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,8 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
goto none;
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_scaled_cursor_theme (display, desired_scale),
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c)
|
||||
{
|
||||
@@ -270,7 +271,8 @@ _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
}
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_scaled_cursor_theme (display, scale),
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
scale,
|
||||
gdk_cursor_get_name (cursor));
|
||||
|
||||
if (c)
|
||||
|
||||
+83
-104
@@ -56,6 +56,8 @@
|
||||
#define BTN_STYLUS3 0x149 /* Linux 4.15 */
|
||||
#endif
|
||||
|
||||
#define GDK_SEAT_NOTE(seat,type,action) GDK_DISPLAY_NOTE(gdk_seat_get_display (GDK_SEAT (seat)),type,action)
|
||||
|
||||
typedef struct _GdkWaylandDevicePad GdkWaylandDevicePad;
|
||||
typedef struct _GdkWaylandDevicePadClass GdkWaylandDevicePadClass;
|
||||
|
||||
@@ -1119,7 +1121,7 @@ data_offer_offer (void *data,
|
||||
|
||||
if (seat->pending_offer != offer)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("%p: offer for unknown offer %p of %s",
|
||||
seat, offer, type));
|
||||
return;
|
||||
@@ -1191,7 +1193,7 @@ data_device_data_offer (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("data device data offer, data device %p, offer %p",
|
||||
data_device, offer));
|
||||
|
||||
@@ -1228,13 +1230,13 @@ data_device_enter (void *data,
|
||||
|
||||
if (offer != seat->pending_offer)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("%p: enter event for unknown offer %p, expected %p",
|
||||
seat, offer, seat->pending_offer));
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("data device enter, data device %p serial %u, surface %p, x %f y %f, offer %p",
|
||||
data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer));
|
||||
|
||||
@@ -1258,6 +1260,8 @@ data_device_enter (void *data,
|
||||
seat->pending_offer = NULL;
|
||||
|
||||
seat->drop = gdk_wayland_drop_new (device, seat->drag, formats, dest_surface, offer, serial);
|
||||
gdk_wayland_drop_set_source_actions (seat->drop, seat->pending_source_actions);
|
||||
gdk_wayland_drop_set_action (seat->drop, seat->pending_action);
|
||||
|
||||
gdk_wayland_seat_discard_pending_offer (seat);
|
||||
|
||||
@@ -1272,7 +1276,7 @@ data_device_leave (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("data device leave, data device %p", data_device));
|
||||
|
||||
if (seat->drop == NULL)
|
||||
@@ -1296,8 +1300,9 @@ data_device_motion (void *data,
|
||||
wl_fixed_t y)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
int origin_x, origin_y;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f",
|
||||
data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y)));
|
||||
|
||||
@@ -1308,10 +1313,12 @@ data_device_motion (void *data,
|
||||
seat->pointer_info.surface_x = wl_fixed_to_double (x);
|
||||
seat->pointer_info.surface_y = wl_fixed_to_double (y);
|
||||
|
||||
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
|
||||
|
||||
gdk_drop_emit_motion_event (seat->drop,
|
||||
FALSE,
|
||||
seat->pointer_info.surface_x,
|
||||
seat->pointer_info.surface_y,
|
||||
origin_x + seat->pointer_info.surface_x,
|
||||
origin_y + seat->pointer_info.surface_y,
|
||||
time);
|
||||
}
|
||||
|
||||
@@ -1320,14 +1327,17 @@ data_device_drop (void *data,
|
||||
struct wl_data_device *data_device)
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
int origin_x, origin_y;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("data device drop, data device %p", data_device));
|
||||
|
||||
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
|
||||
|
||||
gdk_drop_emit_drop_event (seat->drop,
|
||||
FALSE,
|
||||
seat->pointer_info.surface_x,
|
||||
seat->pointer_info.surface_y,
|
||||
origin_x + seat->pointer_info.surface_x,
|
||||
origin_y + seat->pointer_info.surface_y,
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
@@ -1565,7 +1575,7 @@ pointer_handle_enter (void *data,
|
||||
&event->crossing.x_root,
|
||||
&event->crossing.y_root);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("enter, seat %p surface %p",
|
||||
seat, seat->pointer_info.focus));
|
||||
|
||||
@@ -1613,7 +1623,7 @@ pointer_handle_leave (void *data,
|
||||
&event->crossing.x_root,
|
||||
&event->crossing.y_root);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("leave, seat %p surface %p",
|
||||
seat, seat->pointer_info.focus));
|
||||
|
||||
@@ -1659,7 +1669,7 @@ pointer_handle_motion (void *data,
|
||||
&event->motion.x_root,
|
||||
&event->motion.y_root);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("motion %f %f, seat %p state %d",
|
||||
wl_fixed_to_double (sx), wl_fixed_to_double (sy),
|
||||
seat, event->motion.state));
|
||||
@@ -1732,7 +1742,7 @@ pointer_handle_button (void *data,
|
||||
else
|
||||
seat->pointer_info.button_modifiers &= ~modifier;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("button %d %s, seat %p state %d",
|
||||
event->button.button,
|
||||
state ? "press" : "release",
|
||||
@@ -1790,7 +1800,7 @@ pointer_handle_axis (void *data,
|
||||
|
||||
seat->pointer_info.time = time;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("scroll, axis %s, value %f, seat %p",
|
||||
get_axis_name (axis), wl_fixed_to_double (value) / 10.0,
|
||||
seat));
|
||||
@@ -1805,7 +1815,7 @@ pointer_handle_frame (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("frame, seat %p", seat));
|
||||
|
||||
gdk_wayland_seat_flush_frame_event (seat);
|
||||
@@ -1846,7 +1856,7 @@ pointer_handle_axis_source (void *data,
|
||||
|
||||
pointer_frame->source = source;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("axis source %s, seat %p", get_axis_source_name (source), seat));
|
||||
}
|
||||
|
||||
@@ -1878,7 +1888,7 @@ pointer_handle_axis_stop (void *data,
|
||||
|
||||
pointer_frame->is_scroll_stop = TRUE;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("axis %s stop, seat %p", get_axis_name (axis), seat));
|
||||
}
|
||||
|
||||
@@ -1906,7 +1916,7 @@ pointer_handle_axis_discrete (void *data,
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("discrete scroll, axis %s, value %d, seat %p",
|
||||
get_axis_name (axis), value, seat));
|
||||
}
|
||||
@@ -1962,7 +1972,7 @@ keyboard_handle_enter (void *data,
|
||||
gdk_event_set_device (event, seat->master_keyboard);
|
||||
gdk_event_set_source_device (event, seat->keyboard);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("focus in, seat %p surface %p",
|
||||
seat, seat->keyboard_focus));
|
||||
|
||||
@@ -2003,7 +2013,7 @@ keyboard_handle_leave (void *data,
|
||||
seat->keyboard_focus = NULL;
|
||||
seat->repeat_key = 0;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("focus out, seat %p surface %p",
|
||||
seat, event->any.surface));
|
||||
|
||||
@@ -2098,7 +2108,7 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("keyboard %s event%s, surface %p, code %d, sym %d, "
|
||||
"mods 0x%x",
|
||||
(state ? "press" : "release"),
|
||||
@@ -2386,7 +2396,7 @@ touch_handle_down (void *data,
|
||||
mimic_pointer_emulating_touch_info (seat->touch_master, touch);
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("touch begin %f %f", event->touch.x, event->touch.y));
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -2409,7 +2419,7 @@ touch_handle_up (void *data,
|
||||
touch = gdk_wayland_seat_get_touch (seat, id);
|
||||
event = _create_touch_event (seat, touch, GDK_TOUCH_END, time);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("touch end %f %f", event->touch.x, event->touch.y));
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -2441,7 +2451,7 @@ touch_handle_motion (void *data,
|
||||
|
||||
event = _create_touch_event (seat, touch, GDK_TOUCH_UPDATE, time);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("touch update %f %f", event->touch.x, event->touch.y));
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -2478,7 +2488,7 @@ touch_handle_cancel (void *data,
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (wayland_seat->display, EVENTS, g_message ("touch cancel"));
|
||||
GDK_SEAT_NOTE (wayland_seat, EVENTS, g_message ("touch cancel"));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2514,7 +2524,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
&event->touchpad_swipe.x_root,
|
||||
&event->touchpad_swipe.y_root);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||
event->any.type, event->touchpad_swipe.x,
|
||||
event->touchpad_swipe.y, seat,
|
||||
@@ -2617,7 +2627,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
||||
&event->touchpad_pinch.x_root,
|
||||
&event->touchpad_pinch.y_root);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||
event->any.type, event->touchpad_pinch.x,
|
||||
event->touchpad_pinch.y, seat,
|
||||
@@ -2943,7 +2953,7 @@ seat_handle_capabilities (void *data,
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, MISC,
|
||||
GDK_SEAT_NOTE (seat, MISC,
|
||||
g_message ("seat %p with %s%s%s", wl_seat,
|
||||
(caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "",
|
||||
(caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "",
|
||||
@@ -3166,7 +3176,7 @@ seat_handle_name (void *data,
|
||||
const char *name)
|
||||
{
|
||||
/* We don't care about the name. */
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (data)->display, MISC,
|
||||
GDK_SEAT_NOTE (GDK_WAYLAND_SEAT (data), MISC,
|
||||
g_message ("seat %p name %s", seat, name));
|
||||
}
|
||||
|
||||
@@ -3480,7 +3490,7 @@ tablet_tool_handle_proximity_in (void *data,
|
||||
gdk_wayland_surface_get_wl_output (surface));
|
||||
pointer_surface_update_scale (tablet->master);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("proximity in, seat %p surface %p tool %d",
|
||||
seat, tablet->pointer_info.focus,
|
||||
gdk_device_tool_get_tool_type (tool->tool)));
|
||||
@@ -3492,11 +3502,10 @@ tablet_tool_handle_proximity_out (void *data,
|
||||
{
|
||||
GdkWaylandTabletToolData *tool = data;
|
||||
GdkWaylandTabletData *tablet = tool->current_tablet;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
|
||||
GdkEvent *event;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
g_message ("proximity out, seat %p, tool %d", seat,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("proximity out, seat %p, tool %d", tool->seat,
|
||||
gdk_device_tool_get_tool_type (tool->tool)));
|
||||
|
||||
event = gdk_wayland_tablet_get_frame_event (tablet, GDK_PROXIMITY_OUT);
|
||||
@@ -3592,7 +3601,7 @@ tablet_tool_handle_motion (void *data,
|
||||
tablet->pointer_info.surface_x = wl_fixed_to_double (sx);
|
||||
tablet->pointer_info.surface_y = wl_fixed_to_double (sy);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("tablet motion %f %f",
|
||||
tablet->pointer_info.surface_x,
|
||||
tablet->pointer_info.surface_y));
|
||||
@@ -3625,7 +3634,7 @@ tablet_tool_handle_pressure (void *data,
|
||||
_gdk_device_translate_axis (tablet->current_device, axis_index,
|
||||
pressure, &tablet->axes[axis_index]);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d pressure %d",
|
||||
gdk_device_tool_get_tool_type (tool->tool), pressure));
|
||||
}
|
||||
@@ -3642,7 +3651,7 @@ tablet_tool_handle_distance (void *data,
|
||||
_gdk_device_translate_axis (tablet->current_device, axis_index,
|
||||
distance, &tablet->axes[axis_index]);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d distance %d",
|
||||
gdk_device_tool_get_tool_type (tool->tool), distance));
|
||||
}
|
||||
@@ -3665,7 +3674,7 @@ tablet_tool_handle_tilt (void *data,
|
||||
wl_fixed_to_double (ytilt),
|
||||
&tablet->axes[ytilt_axis_index]);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d tilt %f/%f",
|
||||
gdk_device_tool_get_tool_type (tool->tool),
|
||||
wl_fixed_to_double (xtilt), wl_fixed_to_double (ytilt)));
|
||||
@@ -3720,7 +3729,7 @@ tablet_tool_handle_rotation (void *data,
|
||||
wl_fixed_to_double (degrees),
|
||||
&tablet->axes[axis_index]);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d rotation %f",
|
||||
gdk_device_tool_get_tool_type (tool->tool),
|
||||
wl_fixed_to_double (degrees)));
|
||||
@@ -3738,7 +3747,7 @@ tablet_tool_handle_slider (void *data,
|
||||
_gdk_device_translate_axis (tablet->current_device, axis_index,
|
||||
position, &tablet->axes[axis_index]);
|
||||
|
||||
GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d slider %d",
|
||||
gdk_device_tool_get_tool_type (tool->tool), position));
|
||||
}
|
||||
@@ -3754,7 +3763,7 @@ tablet_tool_handle_wheel (void *data,
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
||||
GdkEvent *event;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("tablet tool %d wheel %d/%d",
|
||||
gdk_device_tool_get_tool_type (tool->tool), degrees, clicks));
|
||||
|
||||
@@ -3784,10 +3793,9 @@ tablet_tool_handle_frame (void *data,
|
||||
{
|
||||
GdkWaylandTabletToolData *tool = data;
|
||||
GdkWaylandTabletData *tablet = tool->current_tablet;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
||||
GdkEvent *frame_event;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (tablet->seat, EVENTS,
|
||||
g_message ("tablet frame, time %d", time));
|
||||
|
||||
frame_event = tablet->pointer_info.frame.event;
|
||||
@@ -3830,10 +3838,8 @@ tablet_pad_ring_handle_source (void *data,
|
||||
uint32_t source)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad ring handle source, ring = %p source = %d",
|
||||
wp_tablet_pad_ring, source));
|
||||
|
||||
@@ -3846,10 +3852,8 @@ tablet_pad_ring_handle_angle (void *data,
|
||||
wl_fixed_t angle)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad ring handle angle, ring = %p angle = %f",
|
||||
wp_tablet_pad_ring, wl_fixed_to_double (angle)));
|
||||
|
||||
@@ -3861,10 +3865,8 @@ tablet_pad_ring_handle_stop (void *data,
|
||||
struct zwp_tablet_pad_ring_v2 *wp_tablet_pad_ring)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring));
|
||||
|
||||
group->axis_tmp_info.is_stop = TRUE;
|
||||
@@ -3880,7 +3882,7 @@ tablet_pad_ring_handle_frame (void *data,
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
GdkEvent *event;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
|
||||
|
||||
event = gdk_event_new (GDK_PAD_RING);
|
||||
@@ -3910,10 +3912,8 @@ tablet_pad_strip_handle_source (void *data,
|
||||
uint32_t source)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad strip handle source, strip = %p source = %d",
|
||||
wp_tablet_pad_strip, source));
|
||||
|
||||
@@ -3926,10 +3926,8 @@ tablet_pad_strip_handle_position (void *data,
|
||||
uint32_t position)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad strip handle position, strip = %p position = %d",
|
||||
wp_tablet_pad_strip, position));
|
||||
|
||||
@@ -3941,10 +3939,8 @@ tablet_pad_strip_handle_stop (void *data,
|
||||
struct zwp_tablet_pad_strip_v2 *wp_tablet_pad_strip)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad strip handle stop, strip = %p",
|
||||
wp_tablet_pad_strip));
|
||||
|
||||
@@ -3961,7 +3957,7 @@ tablet_pad_strip_handle_frame (void *data,
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
GdkEvent *event;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("tablet pad strip handle frame, strip = %p",
|
||||
wp_tablet_pad_strip));
|
||||
|
||||
@@ -3993,11 +3989,9 @@ tablet_pad_group_handle_buttons (void *data,
|
||||
struct wl_array *buttons)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
uint32_t *p;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad group handle buttons, pad group = %p, n_buttons = %" G_GSIZE_FORMAT,
|
||||
wp_tablet_pad_group, buttons->size));
|
||||
|
||||
@@ -4015,10 +4009,8 @@ tablet_pad_group_handle_ring (void *data,
|
||||
struct zwp_tablet_pad_ring_v2 *wp_tablet_pad_ring)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad group handle ring, pad group = %p, ring = %p",
|
||||
wp_tablet_pad_group, wp_tablet_pad_ring));
|
||||
|
||||
@@ -4036,10 +4028,8 @@ tablet_pad_group_handle_strip (void *data,
|
||||
struct zwp_tablet_pad_strip_v2 *wp_tablet_pad_strip)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad group handle strip, pad group = %p, strip = %p",
|
||||
wp_tablet_pad_group, wp_tablet_pad_strip));
|
||||
|
||||
@@ -4057,10 +4047,8 @@ tablet_pad_group_handle_modes (void *data,
|
||||
uint32_t modes)
|
||||
{
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad group handle modes, pad group = %p, n_modes = %d",
|
||||
wp_tablet_pad_group, modes));
|
||||
|
||||
@@ -4071,11 +4059,11 @@ static void
|
||||
tablet_pad_group_handle_done (void *data,
|
||||
struct zwp_tablet_pad_group_v2 *wp_tablet_pad_group)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
GdkWaylandTabletPadData *pad = group->pad;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
#endif
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (group->pad->seat, EVENTS,
|
||||
g_message ("tablet pad group handle done, pad group = %p",
|
||||
wp_tablet_pad_group));
|
||||
}
|
||||
@@ -4093,7 +4081,7 @@ tablet_pad_group_handle_mode (void *data,
|
||||
GdkEvent *event;
|
||||
guint n_group;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("tablet pad group handle mode, pad group = %p, mode = %d",
|
||||
wp_tablet_pad_group, mode));
|
||||
|
||||
@@ -4129,9 +4117,8 @@ tablet_pad_handle_group (void *data,
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandTabletPadGroupData *group;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle group, pad group = %p, group = %p",
|
||||
wp_tablet_pad_group, wp_tablet_pad_group));
|
||||
|
||||
@@ -4151,9 +4138,8 @@ tablet_pad_handle_path (void *data,
|
||||
const char *path)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle path, pad = %p, path = %s",
|
||||
wp_tablet_pad, path));
|
||||
|
||||
@@ -4166,9 +4152,8 @@ tablet_pad_handle_buttons (void *data,
|
||||
uint32_t buttons)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle buttons, pad = %p, n_buttons = %d",
|
||||
wp_tablet_pad, buttons));
|
||||
|
||||
@@ -4180,9 +4165,8 @@ tablet_pad_handle_done (void *data,
|
||||
struct zwp_tablet_pad_v2 *wp_tablet_pad)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle done, pad = %p", wp_tablet_pad));
|
||||
|
||||
pad->device =
|
||||
@@ -4192,11 +4176,11 @@ tablet_pad_handle_done (void *data,
|
||||
"input-source", GDK_SOURCE_TABLET_PAD,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"display", gdk_seat_get_display (pad->seat),
|
||||
"seat", seat,
|
||||
"seat", pad->seat,
|
||||
NULL);
|
||||
|
||||
_gdk_device_set_associated_device (pad->device, seat->master_keyboard);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), pad->device);
|
||||
_gdk_device_set_associated_device (pad->device, GDK_WAYLAND_SEAT (pad->seat)->master_keyboard);
|
||||
gdk_seat_device_added (GDK_SEAT (pad->seat), pad->device);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4208,11 +4192,10 @@ tablet_pad_handle_button (void *data,
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandTabletPadGroupData *group;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
GdkEvent *event;
|
||||
gint n_group;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle button, pad = %p, button = %d, state = %d",
|
||||
wp_tablet_pad, button, state));
|
||||
|
||||
@@ -4222,7 +4205,7 @@ tablet_pad_handle_button (void *data,
|
||||
event = gdk_event_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ?
|
||||
GDK_PAD_BUTTON_PRESS :
|
||||
GDK_PAD_BUTTON_RELEASE);
|
||||
g_set_object (&event->any.surface, seat->keyboard_focus);
|
||||
g_set_object (&event->any.surface, GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus);
|
||||
event->pad_button.button = button;
|
||||
event->pad_button.group = n_group;
|
||||
event->pad_button.mode = group->current_mode;
|
||||
@@ -4230,8 +4213,7 @@ tablet_pad_handle_button (void *data,
|
||||
gdk_event_set_device (event, pad->device);
|
||||
gdk_event_set_source_device (event, pad->device);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_seat_get_display (pad->seat),
|
||||
event);
|
||||
_gdk_wayland_display_deliver_event (gdk_seat_get_display (pad->seat), event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4242,10 +4224,9 @@ tablet_pad_handle_enter (void *data,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle enter, pad = %p, tablet = %p surface = %p",
|
||||
wp_tablet_pad, wp_tablet, surface));
|
||||
|
||||
@@ -4261,9 +4242,8 @@ tablet_pad_handle_leave (void *data,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle leave, pad = %p, surface = %p",
|
||||
wp_tablet_pad, surface));
|
||||
|
||||
@@ -4279,9 +4259,8 @@ tablet_pad_handle_removed (void *data,
|
||||
struct zwp_tablet_pad_v2 *wp_tablet_pad)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = data;
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (pad->seat, EVENTS,
|
||||
g_message ("tablet pad handle removed, pad = %p", wp_tablet_pad));
|
||||
|
||||
/* Remove from the current tablet */
|
||||
@@ -4453,7 +4432,7 @@ pointer_surface_enter (void *data,
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
|
||||
GdkWaylandTabletData *tablet;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("pointer surface of seat %p entered output %p",
|
||||
seat, output));
|
||||
|
||||
@@ -4482,7 +4461,7 @@ pointer_surface_leave (void *data,
|
||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
|
||||
GdkWaylandTabletData *tablet;
|
||||
|
||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("pointer surface of seat %p left output %p",
|
||||
seat, output));
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "gdkglcontext-wayland.h"
|
||||
#include "gdkvulkancontext-wayland.h"
|
||||
#include "gdkwaylandmonitor.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include <wayland/pointer-gestures-unstable-v1-client-protocol.h>
|
||||
#include "tablet-unstable-v2-client-protocol.h"
|
||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||
@@ -725,7 +726,6 @@ static void
|
||||
gdk_wayland_display_finalize (GObject *object)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (object);
|
||||
guint i;
|
||||
|
||||
_gdk_wayland_display_finalize_cursors (display_wayland);
|
||||
|
||||
@@ -733,13 +733,10 @@ gdk_wayland_display_finalize (GObject *object)
|
||||
g_free (display_wayland->cursor_theme_name);
|
||||
xkb_context_unref (display_wayland->xkb_context);
|
||||
|
||||
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
|
||||
if (display_wayland->cursor_theme)
|
||||
{
|
||||
if (display_wayland->scaled_cursor_themes[i])
|
||||
{
|
||||
wl_cursor_theme_destroy (display_wayland->scaled_cursor_themes[i]);
|
||||
display_wayland->scaled_cursor_themes[i] = NULL;
|
||||
}
|
||||
wl_cursor_theme_destroy (display_wayland->cursor_theme);
|
||||
display_wayland->cursor_theme = NULL;
|
||||
}
|
||||
|
||||
g_ptr_array_free (display_wayland->monitors, TRUE);
|
||||
@@ -1059,6 +1056,33 @@ gdk_wayland_display_get_toplevel_surfaces (GdkDisplay *display)
|
||||
return GDK_WAYLAND_DISPLAY (display)->toplevels;
|
||||
}
|
||||
|
||||
static struct wl_cursor_theme *
|
||||
get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
const char * const *xdg_data_dirs;
|
||||
struct wl_cursor_theme *theme = NULL;
|
||||
int i;
|
||||
|
||||
xdg_data_dirs = g_get_system_data_dirs ();
|
||||
for (i = 0; xdg_data_dirs[i]; i++)
|
||||
{
|
||||
char *path = g_build_filename (xdg_data_dirs[i], "icons", name, "cursors", NULL);
|
||||
|
||||
if (g_file_test (path, G_FILE_TEST_IS_DIR))
|
||||
theme = wl_cursor_theme_create (path, size, display_wayland->shm);
|
||||
|
||||
g_free (path);
|
||||
|
||||
if (theme)
|
||||
return theme;
|
||||
}
|
||||
|
||||
/* This may fall back to builtin cursors */
|
||||
return wl_cursor_theme_create ("/usr/share/icons/default/cursors", size, display_wayland->shm);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const gchar *name,
|
||||
@@ -1066,7 +1090,6 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||
struct wl_cursor_theme *theme;
|
||||
int i;
|
||||
|
||||
g_assert (display_wayland);
|
||||
g_assert (display_wayland->shm);
|
||||
@@ -1075,22 +1098,20 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
display_wayland->cursor_theme_size == size)
|
||||
return;
|
||||
|
||||
theme = wl_cursor_theme_load (name, size, display_wayland->shm);
|
||||
theme = get_cursor_theme (display_wayland, name, size);
|
||||
|
||||
if (theme == NULL)
|
||||
{
|
||||
g_warning ("Failed to load cursor theme %s", name);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
|
||||
if (display_wayland->cursor_theme)
|
||||
{
|
||||
if (display_wayland->scaled_cursor_themes[i])
|
||||
{
|
||||
wl_cursor_theme_destroy (display_wayland->scaled_cursor_themes[i]);
|
||||
display_wayland->scaled_cursor_themes[i] = NULL;
|
||||
}
|
||||
wl_cursor_theme_destroy (display_wayland->cursor_theme);
|
||||
display_wayland->cursor_theme = NULL;
|
||||
}
|
||||
display_wayland->scaled_cursor_themes[0] = theme;
|
||||
display_wayland->cursor_theme = theme;
|
||||
if (display_wayland->cursor_theme_name != NULL)
|
||||
g_free (display_wayland->cursor_theme_name);
|
||||
display_wayland->cursor_theme_name = g_strdup (name);
|
||||
@@ -1098,31 +1119,11 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
}
|
||||
|
||||
struct wl_cursor_theme *
|
||||
_gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
guint scale)
|
||||
_gdk_wayland_display_get_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
struct wl_cursor_theme *theme;
|
||||
|
||||
g_assert (display_wayland->cursor_theme_name);
|
||||
g_assert (scale <= GDK_WAYLAND_MAX_THEME_SCALE);
|
||||
g_assert (scale >= 1);
|
||||
|
||||
theme = display_wayland->scaled_cursor_themes[scale - 1];
|
||||
if (!theme)
|
||||
{
|
||||
theme = wl_cursor_theme_load (display_wayland->cursor_theme_name,
|
||||
display_wayland->cursor_theme_size * scale,
|
||||
display_wayland->shm);
|
||||
if (theme == NULL)
|
||||
{
|
||||
g_warning ("Failed to load cursor theme %s with scale %u",
|
||||
display_wayland->cursor_theme_name, scale);
|
||||
return NULL;
|
||||
}
|
||||
display_wayland->scaled_cursor_themes[scale - 1] = theme;
|
||||
}
|
||||
|
||||
return theme;
|
||||
return display_wayland->cursor_theme;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1131,6 +1132,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
guint size;
|
||||
const gchar *name;
|
||||
GValue v = G_VALUE_INIT;
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_assert (display_wayland);
|
||||
g_assert (display_wayland->shm);
|
||||
@@ -1150,6 +1152,12 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
|
||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
g_value_unset (&v);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "wayland", "load cursor theme");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
guint32
|
||||
@@ -2307,10 +2315,11 @@ xdg_output_handle_description (void *data,
|
||||
struct zxdg_output_v1 *xdg_output,
|
||||
const char *description)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("handle description xdg-output %d", monitor->id));
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
|
||||
g_message ("handle description xdg-output %d", monitor->id);
|
||||
});
|
||||
}
|
||||
|
||||
static const struct zxdg_output_v1_listener xdg_output_listener = {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-cursor.h>
|
||||
#include <wayland-egl.h>
|
||||
#include <gdk/wayland/tablet-unstable-v2-client-protocol.h>
|
||||
#include <gdk/wayland/gtk-shell-client-protocol.h>
|
||||
@@ -45,6 +44,7 @@
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkwaylanddevice.h"
|
||||
#include "cursor/wayland-cursor.h"
|
||||
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
@@ -126,7 +126,7 @@ struct _GdkWaylandDisplay
|
||||
|
||||
GList *current_popups;
|
||||
|
||||
struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
|
||||
struct wl_cursor_theme *cursor_theme;
|
||||
gchar *cursor_theme_name;
|
||||
int cursor_theme_size;
|
||||
GHashTable *cursor_surface_cache;
|
||||
|
||||
@@ -173,7 +173,7 @@ gdk_wayland_drag_drop_done (GdkDrag *drag,
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
GdkDevice *device = gdk_drag_get_device (drag);
|
||||
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), drag);
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), NULL);
|
||||
|
||||
if (success)
|
||||
{
|
||||
@@ -340,6 +340,7 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag)
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
const char *const *mimetypes;
|
||||
GdkContentFormats *formats;
|
||||
gsize i, n_mimetypes;
|
||||
|
||||
drag_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
@@ -347,11 +348,20 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag)
|
||||
&data_source_listener,
|
||||
drag);
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mimetypes);
|
||||
formats = gdk_content_formats_ref (gdk_drag_get_formats (drag));
|
||||
formats = gdk_content_formats_union_serialize_mime_types (formats);
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (formats, &n_mimetypes);
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
|
||||
{char *s = g_strjoinv (" ", (char **)mimetypes);
|
||||
g_message ("create data source, mime types=%s", s);
|
||||
g_free (s);});
|
||||
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
{
|
||||
wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
|
||||
}
|
||||
wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
}
|
||||
|
||||
GdkDrag *
|
||||
|
||||
@@ -51,7 +51,6 @@ struct _GdkWaylandDrop
|
||||
struct wl_data_offer *offer;
|
||||
uint32_t source_actions;
|
||||
uint32_t action;
|
||||
GdkDragAction selected_action;
|
||||
uint32_t serial;
|
||||
};
|
||||
|
||||
@@ -116,43 +115,43 @@ gdk_wayland_drop_drop_set_status (GdkWaylandDrop *drop_wayland,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop)
|
||||
gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
uint32_t dnd_actions;
|
||||
|
||||
display = gdk_drop_get_display (GDK_DROP (wayland_drop));
|
||||
|
||||
dnd_actions = gdk_to_wl_actions (wayland_drop->selected_action);
|
||||
|
||||
if (GDK_WAYLAND_DISPLAY (display)->data_device_manager_version >=
|
||||
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
|
||||
{
|
||||
if (gdk_drag_action_is_unique (wayland_drop->selected_action))
|
||||
{
|
||||
wl_data_offer_set_actions (wayland_drop->offer, dnd_actions, dnd_actions);
|
||||
}
|
||||
uint32_t dnd_actions;
|
||||
uint32_t preferred_action;
|
||||
|
||||
dnd_actions = gdk_to_wl_actions (actions);
|
||||
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
|
||||
preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||
else if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
|
||||
preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
|
||||
else if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
preferred_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
|
||||
else
|
||||
{
|
||||
wl_data_offer_set_actions (wayland_drop->offer,
|
||||
dnd_actions | WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK,
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK);
|
||||
}
|
||||
preferred_action = 0;
|
||||
|
||||
wl_data_offer_set_actions (wayland_drop->offer, dnd_actions, preferred_action);
|
||||
}
|
||||
|
||||
gdk_wayland_drop_drop_set_status (wayland_drop, wayland_drop->selected_action != 0);
|
||||
gdk_wayland_drop_drop_set_status (wayland_drop, actions != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drop_status (GdkDrop *drop,
|
||||
GdkDragAction action)
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkWaylandDrop *wayland_drop;
|
||||
GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (drop);
|
||||
|
||||
wayland_drop = GDK_WAYLAND_DROP (drop);
|
||||
wayland_drop->selected_action = action;
|
||||
|
||||
gdk_wayland_drop_commit_status (wayland_drop);
|
||||
gdk_wayland_drop_commit_status (wayland_drop, actions);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -163,11 +162,9 @@ gdk_wayland_drop_finish (GdkDrop *drop,
|
||||
GdkDisplay *display = gdk_drop_get_display (drop);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
wayland_drop->selected_action = action;
|
||||
|
||||
if (action)
|
||||
{
|
||||
gdk_wayland_drop_commit_status (wayland_drop);
|
||||
gdk_wayland_drop_commit_status (wayland_drop, action);
|
||||
|
||||
if (display_wayland->data_device_manager_version >=
|
||||
WL_DATA_OFFER_FINISH_SINCE_VERSION)
|
||||
@@ -184,19 +181,17 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (drop);
|
||||
GdkDisplay *display;
|
||||
GInputStream *stream;
|
||||
const char *mime_type;
|
||||
int pipe_fd[2];
|
||||
GError *error = NULL;
|
||||
GTask *task;
|
||||
|
||||
display = gdk_drop_get_display (drop),
|
||||
task = g_task_new (drop, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_wayland_drop_read_async);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, DND, char *s = gdk_content_formats_to_string (formats);
|
||||
GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, char *s = gdk_content_formats_to_string (formats);
|
||||
g_message ("%p: read for %s", drop, s);
|
||||
g_free (s); );
|
||||
mime_type = gdk_content_formats_match_mime_type (formats,
|
||||
@@ -288,7 +283,8 @@ gdk_wayland_drop_update_actions (GdkWaylandDrop *drop)
|
||||
GdkDragAction gdk_actions = 0;
|
||||
uint32_t wl_actions;
|
||||
|
||||
if (drop->action & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
if (drop->action == 0 ||
|
||||
drop->action & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
wl_actions = drop->source_actions;
|
||||
else
|
||||
wl_actions = drop->action;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
|
||||
@@ -238,6 +239,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "swap buffers");
|
||||
if (display_wayland->have_egl_swap_buffers_with_damage)
|
||||
{
|
||||
int i, j, n_rects = cairo_region_num_rectangles (painted);
|
||||
|
||||
@@ -57,8 +57,7 @@ gboolean _gdk_wayland_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||
void _gdk_wayland_display_init_cursors (GdkWaylandDisplay *display);
|
||||
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
|
||||
|
||||
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
guint scale);
|
||||
struct wl_cursor_theme * _gdk_wayland_display_get_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||
|
||||
void _gdk_wayland_display_get_default_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
|
||||
@@ -357,6 +357,7 @@ frame_callback (void *data,
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "frame event");
|
||||
GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface));
|
||||
|
||||
wl_callback_destroy (callback);
|
||||
@@ -395,10 +396,10 @@ frame_callback (void *data,
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
#endif
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener frame_listener = {
|
||||
@@ -477,6 +478,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
|
||||
* before we need to stage any changes, then we can take it back and
|
||||
* use it again.
|
||||
*/
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
impl->pending_commit = FALSE;
|
||||
@@ -1508,6 +1510,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
|
||||
if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG)
|
||||
_gdk_wayland_screen_add_orphan_dialog (surface);
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
}
|
||||
|
||||
@@ -2302,6 +2305,7 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
impl->popup_parent = parent;
|
||||
@@ -4109,7 +4113,7 @@ gdk_wayland_surface_is_exported (GdkSurface *surface)
|
||||
* gdk_wayland_surface_export_handle:
|
||||
* @surface: the #GdkSurface to obtain a handle for
|
||||
* @callback: callback to call with the handle
|
||||
* @user_data: user data for @callback
|
||||
* @user_data: (closure): user data for @callback
|
||||
* @destroy_func: destroy notify for @user_data
|
||||
*
|
||||
* Asynchronously obtains a handle for a surface that can be passed
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
subdir('cursor')
|
||||
|
||||
gdk_wayland_sources = files([
|
||||
'gdkapplaunchcontext-wayland.c',
|
||||
'gdkcairocontext-wayland.c',
|
||||
@@ -33,7 +35,6 @@ gdk_wayland_deps = [
|
||||
xkbdep,
|
||||
wlclientdep,
|
||||
wlprotocolsdep,
|
||||
wlcursordep,
|
||||
wlegldep,
|
||||
]
|
||||
|
||||
@@ -105,4 +106,5 @@ libgdk_wayland = static_library('gdk-wayland',
|
||||
'-DG_LOG_DOMAIN="Gdk"',
|
||||
] + common_cflags,
|
||||
link_args: common_ldflags,
|
||||
dependencies: [ gdk_deps, gdk_wayland_deps, ])
|
||||
link_with: [libwayland_cursor, ],
|
||||
dependencies: [ gdk_deps, gdk_wayland_deps])
|
||||
|
||||
@@ -40,7 +40,9 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
||||
{
|
||||
GdkSurface *window = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkWin32Surface *win32_surface = GDK_WIN32_SURFACE (window);
|
||||
VkWin32SurfaceCreateInfoKHR info;
|
||||
VkResult result;
|
||||
|
||||
info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
info.pNext = NULL;
|
||||
@@ -55,11 +57,19 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
||||
*/
|
||||
gdk_display_sync (display);
|
||||
|
||||
return GDK_VK_CHECK (vkCreateWin32SurfaceKHR,
|
||||
gdk_vulkan_context_get_instance (context),
|
||||
&info,
|
||||
NULL,
|
||||
surface);
|
||||
result = GDK_VK_CHECK (vkCreateWin32SurfaceKHR,
|
||||
gdk_vulkan_context_get_instance (context),
|
||||
&info,
|
||||
NULL,
|
||||
surface);
|
||||
|
||||
if (result == VK_SUCCESS)
|
||||
win32_surface->suppress_layered ++;
|
||||
|
||||
if (win32_surface->suppress_layered == 1)
|
||||
_gdk_win32_surface_update_style_bits (window);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -65,16 +65,15 @@ print_atoms (GdkX11Clipboard *cb,
|
||||
const Atom *atoms,
|
||||
gsize n_atoms)
|
||||
{
|
||||
GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
|
||||
|
||||
GDK_DISPLAY_NOTE (display, CLIPBOARD,
|
||||
GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, {
|
||||
gsize i;
|
||||
GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
|
||||
|
||||
g_printerr ("%s: %s [ ", cb->selection, prefix);
|
||||
for (i = 0; i < n_atoms; i++)
|
||||
g_printerr ("%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i]));
|
||||
g_printerr (" ]\n");
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -86,9 +85,7 @@ gdk_x11_clipboard_default_output_done (GObject *clipboard,
|
||||
|
||||
if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error))
|
||||
{
|
||||
GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard));
|
||||
|
||||
GDK_DISPLAY_NOTE (display, CLIPBOARD,
|
||||
GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD,
|
||||
g_printerr ("%s: failed to write stream: %s\n",
|
||||
GDK_X11_CLIPBOARD (clipboard)->selection, error->message));
|
||||
g_error_free (error);
|
||||
@@ -440,16 +437,20 @@ gdk_x11_clipboard_xevent (GdkDisplay *display,
|
||||
|
||||
case SelectionRequest:
|
||||
{
|
||||
const char *target, *property;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *target, *property;
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.selection != cb->xselection)
|
||||
return FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
target = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.target);
|
||||
if (xevent->xselectionrequest.property == None)
|
||||
property = target;
|
||||
else
|
||||
property = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.property);
|
||||
#endif
|
||||
|
||||
if (!gdk_clipboard_is_local (GDK_CLIPBOARD (cb)))
|
||||
{
|
||||
|
||||
@@ -305,6 +305,9 @@ gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
||||
if (size > 0)
|
||||
XcursorSetDefaultSize (xdisplay, size);
|
||||
|
||||
if (GDK_X11_DISPLAY (display)->cursors == NULL)
|
||||
return;
|
||||
|
||||
g_hash_table_iter_init (&iter, GDK_X11_DISPLAY (display)->cursors);
|
||||
while (g_hash_table_iter_next (&iter, &cursor, &xcursor))
|
||||
{
|
||||
|
||||
+34
-23
@@ -1061,6 +1061,7 @@ xdnd_send_enter (GdkX11Drag *drag_x11)
|
||||
{
|
||||
GdkDrag *drag = GDK_DRAG (drag_x11);
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkContentFormats *formats;
|
||||
const char * const *atoms;
|
||||
gsize i, n_atoms;
|
||||
XEvent xev;
|
||||
@@ -1080,7 +1081,10 @@ xdnd_send_enter (GdkX11Drag *drag_x11)
|
||||
GDK_DISPLAY_NOTE (display, DND,
|
||||
g_message ("Sending enter source window %#lx XDND protocol version %d\n",
|
||||
GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version));
|
||||
atoms = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_atoms);
|
||||
formats = gdk_content_formats_ref (gdk_drag_get_formats (drag));
|
||||
formats = gdk_content_formats_union_serialize_mime_types (formats);
|
||||
|
||||
atoms = gdk_content_formats_get_mime_types (formats, &n_atoms);
|
||||
|
||||
if (n_atoms > 3)
|
||||
{
|
||||
@@ -1300,8 +1304,7 @@ xdnd_precache_atoms (GdkDisplay *display)
|
||||
/* Source side */
|
||||
|
||||
static void
|
||||
gdk_drag_do_leave (GdkX11Drag *drag_x11,
|
||||
guint32 time)
|
||||
gdk_drag_do_leave (GdkX11Drag *drag_x11)
|
||||
{
|
||||
if (drag_x11->proxy_xid)
|
||||
{
|
||||
@@ -1502,27 +1505,10 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
|
||||
}
|
||||
}
|
||||
|
||||
/* When we have a Xdnd target, make sure our XdndActionList
|
||||
* matches the current actions;
|
||||
*/
|
||||
if (protocol == GDK_DRAG_PROTO_XDND && drag_x11->xdnd_actions != gdk_drag_get_actions (drag))
|
||||
{
|
||||
if (proxy_xid)
|
||||
{
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkDrop *drop = GDK_X11_DISPLAY (display)->current_drop;
|
||||
|
||||
if (drop && GDK_SURFACE_XID (gdk_drop_get_surface (drop)) == proxy_xid)
|
||||
gdk_x11_drop_read_actions (drop);
|
||||
else
|
||||
xdnd_set_actions (drag_x11);
|
||||
}
|
||||
}
|
||||
|
||||
if (drag_x11->proxy_xid != proxy_xid)
|
||||
{
|
||||
/* Send a leave to the last destination */
|
||||
gdk_drag_do_leave (drag_x11, time);
|
||||
gdk_drag_do_leave (drag_x11);
|
||||
drag_x11->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
/* Check if new destination accepts drags, and which protocol */
|
||||
@@ -1558,6 +1544,23 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
|
||||
drag_x11->current_action = gdk_drag_get_selected_action (drag);
|
||||
}
|
||||
|
||||
/* When we have a Xdnd target, make sure our XdndActionList
|
||||
* matches the current actions;
|
||||
*/
|
||||
if (protocol == GDK_DRAG_PROTO_XDND && drag_x11->xdnd_actions != gdk_drag_get_actions (drag))
|
||||
{
|
||||
if (proxy_xid)
|
||||
{
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkDrop *drop = GDK_X11_DISPLAY (display)->current_drop;
|
||||
|
||||
if (drop && GDK_SURFACE_XID (gdk_drop_get_surface (drop)) == proxy_xid)
|
||||
gdk_x11_drop_read_actions (drop);
|
||||
else
|
||||
xdnd_set_actions (drag_x11);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send a drag-motion event */
|
||||
|
||||
drag_x11->last_x = x_root;
|
||||
@@ -1746,16 +1749,20 @@ gdk_x11_drag_xevent (GdkDisplay *display,
|
||||
|
||||
case SelectionRequest:
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *target, *property;
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.selection != xselection)
|
||||
return FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
target = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.target);
|
||||
if (xevent->xselectionrequest.property == None)
|
||||
property = target;
|
||||
else
|
||||
property = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.property);
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.requestor == None)
|
||||
{
|
||||
@@ -1814,6 +1821,7 @@ struct _GdkDragAnim {
|
||||
static void
|
||||
gdk_drag_anim_destroy (GdkDragAnim *anim)
|
||||
{
|
||||
gdk_surface_hide (anim->drag->drag_surface);
|
||||
g_object_unref (anim->drag);
|
||||
g_slice_free (GdkDragAnim, anim);
|
||||
}
|
||||
@@ -1842,8 +1850,10 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
|
||||
gdk_surface_show (drag->drag_surface);
|
||||
gdk_x11_surface_move (drag->drag_surface,
|
||||
drag->last_x + (drag->start_x - drag->last_x) * t,
|
||||
drag->last_y + (drag->start_y - drag->last_y) * t);
|
||||
(drag->last_x - drag->hot_x) +
|
||||
(drag->start_x - drag->last_x) * t,
|
||||
(drag->last_y - drag->hot_y) +
|
||||
(drag->start_y - drag->last_y) * t);
|
||||
gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
@@ -2135,6 +2145,7 @@ static void
|
||||
gdk_x11_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
gdk_drag_do_leave (GDK_X11_DRAG (drag));
|
||||
drag_ungrab (drag);
|
||||
gdk_drag_drop_done (drag, FALSE);
|
||||
}
|
||||
|
||||
+18
-7
@@ -145,9 +145,9 @@ gdk_x11_drop_read_got_stream (GObject *source,
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *mime_type = ((GSList *) g_task_get_task_data (task))->data;
|
||||
#if 0
|
||||
gsize i;
|
||||
const char *mime_type = ((GSList *) g_task_get_task_data (task))->data;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (special_targets); i++)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ gdk_x11_drop_read_got_stream (GObject *source,
|
||||
#endif
|
||||
|
||||
GDK_NOTE (DND, g_printerr ("reading DND as %s now\n",
|
||||
mime_type));
|
||||
(const char *)((GSList *) g_task_get_task_data (task))->data));
|
||||
g_task_return_pointer (task, stream, g_object_unref);
|
||||
}
|
||||
|
||||
@@ -732,14 +732,14 @@ gdk_x11_drop_do_nothing (Window window,
|
||||
gboolean success,
|
||||
gpointer data)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display = data;
|
||||
|
||||
if (!success)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, DND,
|
||||
g_message ("Send event to %lx failed",
|
||||
window));
|
||||
GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", window));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -747,7 +747,7 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkX11Drop *drop_x11 = GDK_X11_DROP (drop);
|
||||
GdkDragAction possible_actions;
|
||||
GdkDragAction possible_actions, suggested_action;
|
||||
XEvent xev;
|
||||
GdkDisplay *display;
|
||||
|
||||
@@ -755,6 +755,17 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
|
||||
possible_actions = actions & gdk_drop_get_actions (drop);
|
||||
|
||||
if (drop_x11->suggested_action != 0)
|
||||
suggested_action = drop_x11->suggested_action;
|
||||
else if (possible_actions & GDK_ACTION_COPY)
|
||||
suggested_action = GDK_ACTION_COPY;
|
||||
else if (possible_actions & GDK_ACTION_MOVE)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
else if (possible_actions & GDK_ACTION_ASK)
|
||||
suggested_action = GDK_ACTION_ASK;
|
||||
else
|
||||
suggested_action = 0;
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
|
||||
xev.xclient.format = 32;
|
||||
@@ -764,7 +775,7 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
xev.xclient.data.l[1] = (possible_actions != 0) ? (2 | 1) : 0;
|
||||
xev.xclient.data.l[2] = 0;
|
||||
xev.xclient.data.l[3] = 0;
|
||||
xev.xclient.data.l[4] = xdnd_action_to_atom (display, possible_actions);
|
||||
xev.xclient.data.l[4] = xdnd_action_to_atom (display, suggested_action);
|
||||
|
||||
if (gdk_drop_get_drag (drop))
|
||||
{
|
||||
|
||||
+20
-38
@@ -590,29 +590,27 @@ gsk_gl_driver_create_texture (GskGLDriver *self,
|
||||
return t->texture_id;
|
||||
}
|
||||
|
||||
static int
|
||||
create_render_target (GskGLDriver *self,
|
||||
int texture_id,
|
||||
gboolean add_depth_buffer,
|
||||
gboolean add_stencil_buffer)
|
||||
void
|
||||
gsk_gl_driver_create_render_target (GskGLDriver *self,
|
||||
int width,
|
||||
int height,
|
||||
int *out_texture_id,
|
||||
int *out_render_target_id)
|
||||
{
|
||||
GLuint fbo_id, depth_stencil_buffer_id;
|
||||
Texture *t;
|
||||
GLuint fbo_id;
|
||||
Texture *texture;
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_DRIVER (self), -1);
|
||||
g_return_val_if_fail (self->in_frame, -1);
|
||||
g_return_if_fail (self->in_frame);
|
||||
|
||||
t = gsk_gl_driver_get_texture (self, texture_id);
|
||||
if (t == NULL)
|
||||
return -1;
|
||||
|
||||
if (t->fbo.fbo_id != 0)
|
||||
fbo_clear (&t->fbo);
|
||||
texture = create_texture (self, width, height);
|
||||
gsk_gl_driver_bind_source_texture (self, texture->texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self, texture->texture_id, GL_NEAREST, GL_NEAREST);
|
||||
|
||||
glGenFramebuffers (1, &fbo_id);
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, fbo_id);
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, t->texture_id, 0);
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->texture_id, 0);
|
||||
|
||||
#if 0
|
||||
if (add_depth_buffer || add_stencil_buffer)
|
||||
{
|
||||
glGenRenderbuffersEXT (1, &depth_stencil_buffer_id);
|
||||
@@ -638,34 +636,18 @@ create_render_target (GskGLDriver *self,
|
||||
if (add_stencil_buffer)
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, depth_stencil_buffer_id);
|
||||
texture->fbo.depth_stencil_id = depth_stencil_buffer_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
t->fbo.fbo_id = fbo_id;
|
||||
t->fbo.depth_stencil_id = depth_stencil_buffer_id;
|
||||
texture->fbo.fbo_id = fbo_id;
|
||||
|
||||
g_assert_cmphex (glCheckFramebufferStatus (GL_FRAMEBUFFER), ==, GL_FRAMEBUFFER_COMPLETE);
|
||||
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, self->default_fbo.fbo_id);
|
||||
|
||||
return fbo_id;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_driver_create_render_target (GskGLDriver *self,
|
||||
int width,
|
||||
int height,
|
||||
int *out_texture_id,
|
||||
int *out_render_target_id)
|
||||
{
|
||||
int texture_id, render_target;
|
||||
|
||||
texture_id = gsk_gl_driver_create_texture (self, width, height);
|
||||
gsk_gl_driver_bind_source_texture (self, texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self, texture_id, GL_NEAREST, GL_NEAREST);
|
||||
|
||||
render_target = create_render_target (self, texture_id, FALSE, FALSE);
|
||||
|
||||
*out_texture_id = texture_id;
|
||||
*out_render_target_id = render_target;
|
||||
*out_texture_id = texture->texture_id;
|
||||
*out_render_target_id = fbo_id;
|
||||
}
|
||||
|
||||
/* Mark the texture permanent, meaning it won'e be reused by the GLDriver.
|
||||
|
||||
@@ -195,10 +195,15 @@ upload_glyph (GlyphCacheKey *key,
|
||||
{
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, r.stride / 4);
|
||||
glBindTexture (GL_TEXTURE_2D, value->texture_id);
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
r.x, r.y, r.width, r.height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
r.data);
|
||||
|
||||
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, r.x, r.y, r.width, r.height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
r.data);
|
||||
else
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, r.x, r.y, r.width, r.height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
r.data);
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
|
||||
g_free (r.data);
|
||||
}
|
||||
|
||||
+19
-12
@@ -83,7 +83,7 @@ gsk_gl_icon_cache_begin_frame (GskGLIconCache *self,
|
||||
}
|
||||
|
||||
if (self->timestamp % MAX_FRAME_AGE == 0)
|
||||
{
|
||||
{
|
||||
g_hash_table_iter_init (&iter, self->icons);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *)&texture, (gpointer *)&icon_data))
|
||||
{
|
||||
@@ -134,6 +134,7 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
int packed_y = 0;
|
||||
cairo_surface_t *surface;
|
||||
unsigned char *surface_data;
|
||||
guint gl_format;
|
||||
|
||||
gsk_gl_texture_atlases_pack (self->atlases, width + 2, height + 2, &atlas, &packed_x, &packed_y);
|
||||
|
||||
@@ -155,30 +156,37 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
surface_data = cairo_image_surface_get_data (surface);
|
||||
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
||||
"Uploading texture");
|
||||
|
||||
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
|
||||
gl_format = GL_RGBA;
|
||||
else
|
||||
gl_format = GL_BGRA;
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + 1, packed_y + 1,
|
||||
width, height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding top */
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + 1, packed_y,
|
||||
width, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding left */
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x, packed_y + 1,
|
||||
1, height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding top left */
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x, packed_y,
|
||||
1, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
|
||||
/* Padding right */
|
||||
@@ -187,13 +195,13 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + width + 1, packed_y + 1,
|
||||
1, height,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding top right */
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + width + 1, packed_y,
|
||||
1, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding bottom */
|
||||
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
|
||||
@@ -202,13 +210,13 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + 1, packed_y + 1 + height,
|
||||
width, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding bottom left */
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x, packed_y + 1 + height,
|
||||
1, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
/* Padding bottom right */
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
@@ -216,9 +224,8 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + 1 + width, packed_y + 1 + height,
|
||||
1, 1,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
gl_format, GL_UNSIGNED_BYTE,
|
||||
surface_data);
|
||||
|
||||
/* Reset this */
|
||||
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
|
||||
@@ -239,7 +246,7 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
|
||||
char *filename = g_strdup_printf ("atlas_%u_%d.png", atlas->texture_id, k++);
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||
glGetTexImage (GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
|
||||
glGetTexImage (GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, data);
|
||||
s = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, atlas->width, atlas->height, stride);
|
||||
cairo_surface_write_to_png (s, filename);
|
||||
|
||||
|
||||
+383
-587
File diff suppressed because it is too large
Load Diff
+81
-55
@@ -8,6 +8,46 @@ rect_equal (const graphene_rect_t *a,
|
||||
return memcmp (a, b, sizeof (graphene_rect_t)) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
rounded_rect_equal (const GskRoundedRect *r1,
|
||||
const GskRoundedRect *r2)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!r1)
|
||||
return FALSE;
|
||||
|
||||
if (r1->bounds.origin.x != r2->bounds.origin.x ||
|
||||
r1->bounds.origin.y != r2->bounds.origin.y ||
|
||||
r1->bounds.size.width != r2->bounds.size.width ||
|
||||
r1->bounds.size.height != r2->bounds.size.height)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 4; i ++)
|
||||
if (r1->corner[i].width != r2->corner[i].width ||
|
||||
r1->corner[i].height != r2->corner[i].height)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
rounded_rect_corners_equal (const GskRoundedRect *r1,
|
||||
const GskRoundedRect *r2)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!r1)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 4; i ++)
|
||||
if (r1->corner[i].width != r2->corner[i].width ||
|
||||
r1->corner[i].height != r2->corner[i].height)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline ProgramState *
|
||||
get_current_program_state (RenderOpBuilder *builder)
|
||||
{
|
||||
@@ -41,16 +81,6 @@ ops_finish (RenderOpBuilder *builder)
|
||||
builder->current_viewport = GRAPHENE_RECT_INIT (0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
rgba_to_float (const GdkRGBA *c,
|
||||
float *f)
|
||||
{
|
||||
f[0] = c->red;
|
||||
f[1] = c->green;
|
||||
f[2] = c->blue;
|
||||
f[3] = c->alpha;
|
||||
}
|
||||
|
||||
/* Debugging only! */
|
||||
void
|
||||
ops_dump_framebuffer (RenderOpBuilder *builder,
|
||||
@@ -97,15 +127,12 @@ static void
|
||||
extract_matrix_metadata (GskTransform *transform,
|
||||
OpsMatrixMetadata *md)
|
||||
{
|
||||
float dummy;
|
||||
|
||||
switch (gsk_transform_get_category (transform))
|
||||
{
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
gsk_transform_to_translate (transform, &md->translate_x, &md->translate_y);
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
@@ -113,7 +140,7 @@ extract_matrix_metadata (GskTransform *transform,
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
gsk_transform_to_affine (transform,
|
||||
&md->scale_x, &md->scale_y,
|
||||
&md->translate_x, &md->translate_y);
|
||||
&dummy, &dummy);
|
||||
break;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
@@ -129,9 +156,6 @@ extract_matrix_metadata (GskTransform *transform,
|
||||
|
||||
/* TODO: 90% sure this is incorrect. But we should never hit this code
|
||||
* path anyway. */
|
||||
md->translate_x = graphene_matrix_get_value (&m, 3, 0);
|
||||
md->translate_y = graphene_matrix_get_value (&m, 3, 1);
|
||||
|
||||
graphene_vec3_init (&col1,
|
||||
graphene_matrix_get_value (&m, 0, 0),
|
||||
graphene_matrix_get_value (&m, 1, 0),
|
||||
@@ -156,17 +180,15 @@ ops_transform_bounds_modelview (const RenderOpBuilder *builder,
|
||||
const graphene_rect_t *src,
|
||||
graphene_rect_t *dst)
|
||||
{
|
||||
const MatrixStackEntry *head;
|
||||
graphene_rect_t r = *src;
|
||||
|
||||
g_assert (builder->mv_stack != NULL);
|
||||
g_assert (builder->mv_stack->len >= 1);
|
||||
|
||||
head = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
r.origin.x += builder->dx;
|
||||
r.origin.y += builder->dy;
|
||||
|
||||
gsk_transform_transform_bounds (builder->current_modelview, src, dst);
|
||||
|
||||
dst->origin.x += builder->dx * head->metadata.scale_x;
|
||||
dst->origin.y += builder->dy * head->metadata.scale_y;
|
||||
gsk_transform_transform_bounds (builder->current_modelview, &r, dst);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -205,11 +227,6 @@ void
|
||||
ops_set_program (RenderOpBuilder *builder,
|
||||
const Program *program)
|
||||
{
|
||||
/* The tricky part about this is that we want to initialize all uniforms of a program
|
||||
* to the current value from the builder, but only once. */
|
||||
static const GskRoundedRect empty_clip;
|
||||
static const graphene_matrix_t empty_matrix;
|
||||
static const graphene_rect_t empty_rect;
|
||||
OpProgram *op;
|
||||
ProgramState *program_state;
|
||||
|
||||
@@ -223,9 +240,7 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
|
||||
program_state = &builder->program_state[program->index];
|
||||
|
||||
/* If the projection is not yet set for this program, we use the current one. */
|
||||
if (memcmp (&empty_matrix, &program_state->projection, sizeof (graphene_matrix_t)) == 0 ||
|
||||
memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
@@ -245,8 +260,7 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
program_state->modelview = gsk_transform_ref (builder->current_modelview);
|
||||
}
|
||||
|
||||
if (rect_equal (&empty_rect, &program_state->viewport) ||
|
||||
!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
if (!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
{
|
||||
OpViewport *opv;
|
||||
|
||||
@@ -255,13 +269,13 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
program_state->viewport = builder->current_viewport;
|
||||
}
|
||||
|
||||
if (memcmp (&empty_clip, &program_state->clip, sizeof (GskRoundedRect)) == 0 ||
|
||||
memcmp (&builder->current_clip, &program_state->clip, sizeof (GskRoundedRect)) != 0)
|
||||
if (!rounded_rect_equal (builder->current_clip, &program_state->clip))
|
||||
{
|
||||
OpClip *opc;
|
||||
|
||||
opc = ops_begin (builder, OP_CHANGE_CLIP);
|
||||
opc->clip = *builder->current_clip;
|
||||
opc->send_corners = !rounded_rect_corners_equal (builder->current_clip, &program_state->clip);
|
||||
program_state->clip = *builder->current_clip;
|
||||
}
|
||||
|
||||
@@ -283,15 +297,25 @@ ops_set_clip (RenderOpBuilder *builder,
|
||||
OpClip *op;
|
||||
|
||||
if (current_program_state &&
|
||||
memcmp (¤t_program_state->clip, clip,sizeof (GskRoundedRect)) == 0)
|
||||
rounded_rect_equal (¤t_program_state->clip, clip))
|
||||
return;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_CLIP)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_CLIP);
|
||||
{
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_CLIP);
|
||||
op->send_corners = !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the op before sent the corners, this one needs, too */
|
||||
op->send_corners |= !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
|
||||
op->clip = *clip;
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
if (current_program_state)
|
||||
current_program_state->clip = *clip;
|
||||
}
|
||||
|
||||
@@ -343,7 +367,6 @@ ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
GskTransform *transform)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
graphene_matrix_t matrix;
|
||||
OpMatrix *op;
|
||||
|
||||
#if 0
|
||||
@@ -353,12 +376,10 @@ ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
return;
|
||||
#endif
|
||||
|
||||
gsk_transform_to_matrix (transform, &matrix);
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_MODELVIEW)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_MODELVIEW);
|
||||
|
||||
op->matrix = matrix;
|
||||
gsk_transform_to_matrix (transform, &op->matrix);
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
{
|
||||
@@ -597,7 +618,7 @@ ops_set_color (RenderOpBuilder *builder,
|
||||
current_program_state->color = *color;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR);
|
||||
op->rgba = *color;
|
||||
op->rgba = color;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -620,8 +641,8 @@ ops_set_color_matrix (RenderOpBuilder *builder,
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR_MATRIX);
|
||||
op->matrix = *matrix;
|
||||
op->offset = *offset;
|
||||
op->matrix = matrix;
|
||||
op->offset = offset;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -668,19 +689,17 @@ ops_set_border_color (RenderOpBuilder *builder,
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpBorder *op;
|
||||
float fcolor[4];
|
||||
|
||||
rgba_to_float (color, fcolor);
|
||||
|
||||
if (memcmp (fcolor, ¤t_program_state->border.color, sizeof fcolor) == 0)
|
||||
if (gdk_rgba_equal (color, ¤t_program_state->border.color))
|
||||
return;
|
||||
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_BORDER_COLOR);
|
||||
memcpy (op->color, fcolor, sizeof (float[4]));
|
||||
memcpy (current_program_state->border.color, fcolor, sizeof (float[4]));
|
||||
op->color = color;
|
||||
|
||||
current_program_state->border.color = *color;
|
||||
}
|
||||
|
||||
void
|
||||
GskQuadVertex *
|
||||
ops_draw (RenderOpBuilder *builder,
|
||||
const GskQuadVertex vertex_data[GL_N_VERTICES])
|
||||
{
|
||||
@@ -697,7 +716,14 @@ ops_draw (RenderOpBuilder *builder,
|
||||
op->vao_size = GL_N_VERTICES;
|
||||
}
|
||||
|
||||
g_array_append_vals (builder->vertices, vertex_data, GL_N_VERTICES);
|
||||
if (vertex_data)
|
||||
{
|
||||
g_array_append_vals (builder->vertices, vertex_data, GL_N_VERTICES);
|
||||
return NULL; /* Better not use this on the caller side */
|
||||
}
|
||||
|
||||
g_array_set_size (builder->vertices, builder->vertices->len + GL_N_VERTICES);
|
||||
return &g_array_index (builder->vertices, GskQuadVertex, builder->vertices->len - GL_N_VERTICES);
|
||||
}
|
||||
|
||||
/* The offset is only valid for the current modelview.
|
||||
|
||||
@@ -15,12 +15,8 @@
|
||||
#define GL_N_VERTICES 6
|
||||
#define GL_N_PROGRAMS 13
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float translate_x;
|
||||
float translate_y;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
|
||||
@@ -44,14 +40,10 @@ struct _Program
|
||||
int position_location;
|
||||
int uv_location;
|
||||
int alpha_location;
|
||||
int blend_mode_location;
|
||||
int viewport_location;
|
||||
int projection_location;
|
||||
int modelview_location;
|
||||
int clip_location;
|
||||
int clip_corner_widths_location;
|
||||
int clip_corner_heights_location;
|
||||
|
||||
int clip_rect_location;
|
||||
union {
|
||||
struct {
|
||||
int color_location;
|
||||
@@ -66,7 +58,6 @@ struct _Program
|
||||
struct {
|
||||
int num_color_stops_location;
|
||||
int color_stops_location;
|
||||
int color_offsets_location;
|
||||
int start_point_location;
|
||||
int end_point_location;
|
||||
} linear_gradient;
|
||||
@@ -79,19 +70,14 @@ struct _Program
|
||||
int color_location;
|
||||
int spread_location;
|
||||
int offset_location;
|
||||
int outline_location;
|
||||
int corner_widths_location;
|
||||
int corner_heights_location;
|
||||
int outline_rect_location;
|
||||
} inset_shadow;
|
||||
struct {
|
||||
int outline_location;
|
||||
int corner_widths_location;
|
||||
int corner_heights_location;
|
||||
int color_location;
|
||||
int outline_rect_location;
|
||||
} outset_shadow;
|
||||
struct {
|
||||
int outline_location;
|
||||
int corner_widths_location;
|
||||
int corner_heights_location;
|
||||
int outline_rect_location;
|
||||
int color_location;
|
||||
int spread_location;
|
||||
int offset_location;
|
||||
@@ -99,9 +85,7 @@ struct _Program
|
||||
struct {
|
||||
int color_location;
|
||||
int widths_location;
|
||||
int outline_location;
|
||||
int corner_widths_location;
|
||||
int corner_heights_location;
|
||||
int outline_rect_location;
|
||||
} border;
|
||||
struct {
|
||||
int source2_location;
|
||||
@@ -135,7 +119,7 @@ typedef struct
|
||||
} color_matrix;
|
||||
struct {
|
||||
float widths[4];
|
||||
float color[4];
|
||||
GdkRGBA color;
|
||||
GskRoundedRect outline;
|
||||
} border;
|
||||
};
|
||||
@@ -230,7 +214,7 @@ void ops_set_border_width (RenderOpBuilder *builder,
|
||||
void ops_set_border_color (RenderOpBuilder *builder,
|
||||
const GdkRGBA *color);
|
||||
|
||||
void ops_draw (RenderOpBuilder *builder,
|
||||
GskQuadVertex * ops_draw (RenderOpBuilder *builder,
|
||||
const GskQuadVertex vertex_data[GL_N_VERTICES]);
|
||||
|
||||
void ops_offset (RenderOpBuilder *builder,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user