Compare commits
584 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5efa3400d9 | |||
| 41c6bfec67 | |||
| 5a4d19644f | |||
| c9e9f6184d | |||
| 3a3c16c475 | |||
| dfb25771a7 | |||
| b286b04b7d | |||
| 22aa12ade5 | |||
| 79ba157664 | |||
| c21c63c357 | |||
| 78f04ae486 | |||
| bd4dcc54fb | |||
| 580d3057ce | |||
| 0060734103 | |||
| 95ce8aafb4 | |||
| 0603bc2f45 | |||
| 07864c3070 | |||
| 95d5b9a057 | |||
| d5fe88a787 | |||
| 343324c205 | |||
| 12dde7b4a1 | |||
| c07afdf1d7 | |||
| 7959ed96e2 | |||
| 43360a1cfa | |||
| 22753c685e | |||
| 40ae74e03d | |||
| 95b71d47c9 | |||
| cfd8855676 | |||
| 7c7bb31d93 | |||
| a0c9e33865 | |||
| dccec4ced2 | |||
| 8f3f16d251 | |||
| d0ce83e853 | |||
| 91dd2e449e | |||
| 6ff7c67c67 | |||
| de1213cbb2 | |||
| 217921ff22 | |||
| 13153e4b30 | |||
| 1eca63e442 | |||
| 2ed55da45c | |||
| ab77041437 | |||
| 1ef2a39c4d | |||
| bccada91b6 | |||
| bed254cc7a | |||
| bb224682c1 | |||
| 8e2f90c887 | |||
| 705617a6d5 | |||
| bc019bd1fc | |||
| c9edcb1009 | |||
| 967968fb0b | |||
| 9e7d3b4473 | |||
| 5819bfeca7 | |||
| e611becb9f | |||
| 541f7aa2bb | |||
| 7163015b1a | |||
| 8422d7965f | |||
| 0092f55bd1 | |||
| 3e8fcf4831 | |||
| a0c680011c | |||
| b8ddef040d | |||
| a1f759336c | |||
| acfcb9da6c | |||
| b2fdb10aaa | |||
| f92dbb8caa | |||
| 484b7dd5f2 | |||
| 307eccc451 | |||
| 57227e8f64 | |||
| a5b1842acf | |||
| e482dd739f | |||
| c1b8eb50ed | |||
| 12c5bb6f8c | |||
| 16d504a78c | |||
| e22a12bb42 | |||
| 4fc6ef1a5f | |||
| 5bda1e0d4b | |||
| aca2f15f05 | |||
| b69e956d60 | |||
| feaff8825c | |||
| f1ff8f9aad | |||
| 115ea624d9 | |||
| 6ecae6c5f8 | |||
| 6d76b587cf | |||
| 8e62ff50fe | |||
| 0daa905a27 | |||
| d1a4ad3db6 | |||
| 2c1bd399d2 | |||
| fac5fba0dc | |||
| c907ad83b0 | |||
| 585ba777c2 | |||
| f8ee4cfea5 | |||
| 35d2cbefe6 | |||
| 004f0a6596 | |||
| b68e0bb3fb | |||
| 92f0216605 | |||
| e317b9be00 | |||
| 2e52386be5 | |||
| 9431c70a6a | |||
| 6e67d44aa3 | |||
| e622013f7e | |||
| 3886f0c530 | |||
| eb9c204535 | |||
| ab9e99218f | |||
| 714c610d6b | |||
| 8706d69e60 | |||
| 55a242bd81 | |||
| 61b40c47f9 | |||
| 710d0620a4 | |||
| 71cb7c2063 | |||
| a482d870dd | |||
| bc4992fef9 | |||
| b38d0d7d9e | |||
| 853a9c7a8c | |||
| 26b9254ac7 | |||
| a51f11999a | |||
| f11c23f407 | |||
| 0c8de4e561 | |||
| 13f9993007 | |||
| b2b451d762 | |||
| 2e146a56f7 | |||
| 34197d4f8a | |||
| 39dbd91bb0 | |||
| 901d99d7c5 | |||
| 8f6e3848f6 | |||
| 3548350dfa | |||
| caae240bc7 | |||
| f5f6ceece5 | |||
| 4caceb5dd4 | |||
| 3da41b6021 | |||
| 9b9fb4d7a3 | |||
| ca8b00e871 | |||
| 4434889e41 | |||
| 475352fbc0 | |||
| ad30ac3932 | |||
| 9d52ca1887 | |||
| ec537d75e4 | |||
| b47ea9421f | |||
| 845d2e5433 | |||
| 50310f7b14 | |||
| af944aa74c | |||
| b5077d02ed | |||
| 6a3bd1c4d1 | |||
| 2fcd0e21bd | |||
| 5127726bbc | |||
| db456a70ee | |||
| 770e848953 | |||
| 9e1dd15e31 | |||
| 27b9a9e7ef | |||
| a020c901ba | |||
| cdad68e858 | |||
| ef36028526 | |||
| 69b1b19315 | |||
| 516f71bbdc | |||
| d820fea7a4 | |||
| 3e8d157118 | |||
| 67f45940ce | |||
| 95400e6451 | |||
| d46fe31f54 | |||
| 4f67be1c8e | |||
| c13e164f25 | |||
| eba8f36d4f | |||
| 37f11ab77d | |||
| 8b898818c2 | |||
| 0f62ab6c42 | |||
| c524b72d13 | |||
| b5313dbd4d | |||
| b9a1827da7 | |||
| 1057189ea2 | |||
| 879b2845ad | |||
| ecce3756d4 | |||
| 6e4dd5811d | |||
| 598e1304f6 | |||
| e3fbc0ee9c | |||
| 4021734047 | |||
| 5a307fa7f3 | |||
| 617d12fd77 | |||
| 837f398a9b | |||
| e18211deca | |||
| 32a547cc3e | |||
| 365afa381a | |||
| b7d3c073f8 | |||
| 56b0095622 | |||
| 39f0c48eb2 | |||
| 7d24e1405e | |||
| 3680ae220a | |||
| f309fa21c9 | |||
| 61e7326f22 | |||
| dc13ff97e2 | |||
| af28237569 | |||
| ff8de0a93f | |||
| aefabcc056 | |||
| 1d6c6fc3b8 | |||
| 8645773fc6 | |||
| d663909159 | |||
| e3ff92bc87 | |||
| 2d43ecf8ca | |||
| 5f4beb711f | |||
| da514187f5 | |||
| 6bd9ce7b55 | |||
| ec21d354b9 | |||
| 8cf4ce5d9e | |||
| 09b6c37e1d | |||
| 3161dbfff2 | |||
| 8412928a14 | |||
| 60a7830ba5 | |||
| ac473282a2 | |||
| 20f9e0f144 | |||
| 71a9e5d8c2 | |||
| a605fcc2bd | |||
| 3eaebf1e0b | |||
| e540ccbd34 | |||
| 55ce61d1a8 | |||
| 8e14f43398 | |||
| bbbcc72460 | |||
| c2b1b00e52 | |||
| 05c2e35c5d | |||
| 8efde9c48c | |||
| 247fc2e471 | |||
| 9d2ca90b4c | |||
| 3a5f8b6192 | |||
| 16b5a88097 | |||
| fdf2e046c3 | |||
| 531d57f30c | |||
| 841bf67bb9 | |||
| 399b457f54 | |||
| fed734edfc | |||
| c84c014536 | |||
| 1e994419ee | |||
| 7b22c44b39 | |||
| 2e744260e0 | |||
| 7190a31b5f | |||
| 729f007379 | |||
| b75b359f19 | |||
| d7de720275 | |||
| ef86e46238 | |||
| 0a46baeb56 | |||
| fd3a6299ce | |||
| 803b147483 | |||
| 1f44319588 | |||
| 505478bc59 | |||
| de7833b6a0 | |||
| 3a1b2083d6 | |||
| 3e996f61ae | |||
| 56eac4f846 | |||
| 61dcb685b2 | |||
| bd0d75e237 | |||
| 179fc68355 | |||
| 9828756e05 | |||
| 40f2b49c0d | |||
| 8e81cbef2c | |||
| 47d572834b | |||
| 46601325f1 | |||
| 0abc7a3361 | |||
| 1e01b9079d | |||
| be688c46f2 | |||
| ab163f168d | |||
| e937f7eac8 | |||
| b84945e43f | |||
| b3dba1dca6 | |||
| 060cfc713f | |||
| 6be575992f | |||
| 4bec75c66b | |||
| 8e4cc59a7a | |||
| c17227966d | |||
| a2ce6268b2 | |||
| 5ab14ff7f6 | |||
| 8482b956d6 | |||
| 562c7b1ff3 | |||
| 8099de22f9 | |||
| a4c3bee4a1 | |||
| 5afa985e85 | |||
| e600a07237 | |||
| 8fa58c2e17 | |||
| d436c2e839 | |||
| b37634dcd5 | |||
| 2d636fdda0 | |||
| 28095641c5 | |||
| d58b06ceeb | |||
| 82b4c34eca | |||
| ee47ddf5fd | |||
| f32ae2964a | |||
| eae5eaeb21 | |||
| 09fd2d61c4 | |||
| 86d7ab7c50 | |||
| 88be92ceee | |||
| 04c4b387a0 | |||
| 7551f85d4c | |||
| 184886f893 | |||
| 36ef94b002 | |||
| 831ebe3ef2 | |||
| 76b8676955 | |||
| b3243132a0 | |||
| de461712a1 | |||
| dd7f52c59a | |||
| 3f1bc740e4 | |||
| 9128ad105b | |||
| 745cbc6c91 | |||
| b635736ac2 | |||
| ba081bf119 | |||
| 3003f37e9d | |||
| c1e05e7c52 | |||
| 6b475aacd2 | |||
| bc4969ec42 | |||
| 1c7daece7a | |||
| 37a8c138f9 | |||
| 34d547a2aa | |||
| 163c04c101 | |||
| f2284ff40f | |||
| eded9459df | |||
| 8fd1530848 | |||
| 77f9efa747 | |||
| 109ec523cb | |||
| 5cc5022a8f | |||
| 3c769bb11d | |||
| 33b07e4825 | |||
| 714e5c72f6 | |||
| 153c6424d3 | |||
| b76e514322 | |||
| 1501aa0603 | |||
| cf5a173a4f | |||
| 2b8c3731c1 | |||
| ade2f1030a | |||
| 4f12df5f1c | |||
| 9941799449 | |||
| 5a938ad83d | |||
| 835c807d7a | |||
| 2ef72442ec | |||
| 3bc2bf40a8 | |||
| cd4c0b6127 | |||
| fa79e8651e | |||
| 9a29487e25 | |||
| fceff93994 | |||
| acd8b08d35 | |||
| 2abee57421 | |||
| 437f902c9d | |||
| a7befc647e | |||
| 121e61cf01 | |||
| f7ac13b78f | |||
| c2ae73f247 | |||
| 4b0b6100d6 | |||
| 2c9bf55eea | |||
| 1d11d42aa0 | |||
| 361407201b | |||
| 50c29398e6 | |||
| dff8a9eb46 | |||
| 1bb4e660fd | |||
| ded6ec6424 | |||
| 47e49acc7d | |||
| 0996b178dc | |||
| 4befd13744 | |||
| bb1463871c | |||
| 12a9164414 | |||
| 108fe033aa | |||
| 9de2b4b0e1 | |||
| ee056fd8bd | |||
| bc4f71a107 | |||
| 125442297f | |||
| eec92b40ea | |||
| d392f6f2a4 | |||
| 41a9c46ec8 | |||
| 0530aeec17 | |||
| 22741a74ff | |||
| 23331c1919 | |||
| d266bd62de | |||
| 57c95937b1 | |||
| 1d86086434 | |||
| e2f26b0d9a | |||
| 7816fc2b83 | |||
| 04d802f7f4 | |||
| 994cc32d7b | |||
| f14ca28c4e | |||
| da9d32e472 | |||
| 08d6db4ab6 | |||
| 6891f40110 | |||
| cdbf24c3af | |||
| b30715da6a | |||
| 5e9883453d | |||
| b97b95b0c7 | |||
| dd0a854bbb | |||
| b8d0ad8643 | |||
| 65d57877a8 | |||
| afc73c38ce | |||
| f4e1c271ea | |||
| 8e42239439 | |||
| 5b4ac5456e | |||
| f1db73379e | |||
| 20918dbe8e | |||
| b5ec20db88 | |||
| d347df431d | |||
| 25e6988d95 | |||
| a7f05b8d91 | |||
| fe690265eb | |||
| f45ea3fa90 | |||
| bdc28cd870 | |||
| c648c1f235 | |||
| 8a92ee03ea | |||
| e3c72f8f09 | |||
| 1f472104ad | |||
| 4b41580041 | |||
| c136f84584 | |||
| 80de00a248 | |||
| 50a7e59623 | |||
| 92ca3a3419 | |||
| 8203d9cc40 | |||
| abc9b403f8 | |||
| b9ad3172a4 | |||
| 0d7fcdda28 | |||
| 75f9b83b1e | |||
| 61e980bfb6 | |||
| ebda736a09 | |||
| d4ddfdc265 | |||
| f8bb206034 | |||
| 87f92a93d3 | |||
| e49e084f4c | |||
| 995daa1e29 | |||
| d34936c1ea | |||
| a59889a274 | |||
| bfb054a023 | |||
| e940704018 | |||
| 429c7fc039 | |||
| 0d6e4f7a6e | |||
| 1f9eb5c64c | |||
| 056a073061 | |||
| e46522e4b5 | |||
| 7ac7919697 | |||
| 5d9799d4e3 | |||
| f95943a752 | |||
| ef88e9ffcc | |||
| 49613dca8e | |||
| a651a0ce69 | |||
| 08d59d3f68 | |||
| afff39c503 | |||
| a2897e1868 | |||
| 15172ebdb0 | |||
| 9ac4a7d99f | |||
| 8157717e03 | |||
| 9052f6dafe | |||
| 292576f312 | |||
| 2285382074 | |||
| 526f1e315b | |||
| 877a7f98ca | |||
| 73b14a3c3a | |||
| 40c0826921 | |||
| 27b9b2e76c | |||
| 04c4d293a7 | |||
| 033791b374 | |||
| 95ee5ff424 | |||
| 65d29e00c7 | |||
| 3b2cd972d5 | |||
| 428ec29598 | |||
| bfe5b0d1b7 | |||
| 82b855cc4b | |||
| 0db504edde | |||
| 5ed3ad6cc8 | |||
| 27c4c19333 | |||
| 74a7f73239 | |||
| a047b7d6d1 | |||
| a76f37a501 | |||
| d6a0948182 | |||
| 7215c74933 | |||
| e4be785c6c | |||
| 18779b9d67 | |||
| 9b056f57f7 | |||
| d6c753bde7 | |||
| d69a943661 | |||
| 0ececc7109 | |||
| 3cc0870084 | |||
| 2229d7f66c | |||
| ed7619ec16 | |||
| 7ed06480cf | |||
| f9db651f32 | |||
| c264254d4b | |||
| 6af89e9034 | |||
| 1bdc8b9061 | |||
| c442f9f05a | |||
| 6cbd7e29dd | |||
| 6079033cde | |||
| d63afaf5ad | |||
| 7e089664fc | |||
| 06fbad0b26 | |||
| 2a3c3b4c6a | |||
| eb3933cffd | |||
| d1de9234c5 | |||
| 3e8260d528 | |||
| 192f515682 | |||
| 2543c9f5a3 | |||
| a745dbfc15 | |||
| 14be50839e | |||
| a85d9cda07 | |||
| 7d49f1e250 | |||
| 6fa2936956 | |||
| b81463e7d3 | |||
| b622745501 | |||
| 5379a4bf34 | |||
| b966f593a5 | |||
| 706a8f9784 | |||
| 2dc7e327ad | |||
| 7b151c3ef0 | |||
| 0af6630521 | |||
| 4b459a99be | |||
| e093ed7d67 | |||
| ddbea8feda | |||
| 6b5dff5667 | |||
| 53cd499621 | |||
| 30c5a6f79c | |||
| 4e1191550c | |||
| 3b1363d31a | |||
| 160e29ea95 | |||
| b9adad304e | |||
| ef17d716d7 | |||
| 8ec01772be | |||
| 4084b4c6c6 | |||
| c3cb8e0a79 | |||
| 19b5e5349e | |||
| f87923e09e | |||
| 05684f6c3c | |||
| 08193ecf1c | |||
| 8c9a827516 | |||
| 638987f359 | |||
| 8190f0c420 | |||
| f7de0bc9c8 | |||
| 08f2990eac | |||
| e6d46ec5ad | |||
| db6d7dccd8 | |||
| 4e8a5f2ec8 | |||
| 63e9414210 | |||
| 4751ac1ac8 | |||
| 9d56c56117 | |||
| 0d82faa239 | |||
| fb27724042 | |||
| 90141ef305 | |||
| bc05da8dc0 | |||
| bf3e1e5b40 | |||
| 0ae93c8cdc | |||
| f9813019a7 | |||
| 5e907ebd58 | |||
| fa5fa3a881 | |||
| 9b9cc2f947 | |||
| 80f5be8b13 | |||
| ec5b5e8aaa | |||
| 95463719ae | |||
| 041415e9b4 | |||
| abd5383d40 | |||
| c5dc0e2e4c | |||
| 88116712f6 | |||
| 7dfa41bbc4 | |||
| c09ff35df4 | |||
| d526bcc71b | |||
| 13d1e497f7 | |||
| 3eaae748d3 | |||
| 7f16067383 | |||
| 024e048c26 | |||
| c31c3848df | |||
| b0e0af1838 | |||
| 3785bf1f17 | |||
| 79fb5724f9 | |||
| 65b2ea1888 | |||
| 6309bd12ac | |||
| 7444a151b2 | |||
| ce9cc2db86 | |||
| e91b930648 | |||
| ed78fb1366 | |||
| 388f12b7d9 | |||
| 8ae415acff | |||
| d2cc9365fc | |||
| dcfb6e5ef5 | |||
| 75f96b83de | |||
| 66bba1493e | |||
| 1dde54b872 | |||
| c48a990778 | |||
| 23c425618e | |||
| d2a7ecf72c | |||
| f220a1e3c7 | |||
| ba63aa76ca | |||
| 72415eaa49 | |||
| d88f7c9459 | |||
| 425d8ad02a | |||
| ae9758b964 | |||
| 828a067b2b | |||
| bb24b350ac | |||
| dafb2b0361 | |||
| 30210c7087 | |||
| d8a795df0a | |||
| 1340ff2bc2 | |||
| eef1097c90 |
@@ -1,3 +1,7 @@
|
||||
include:
|
||||
- project: 'gnome/citemplates'
|
||||
file: 'flatpak/flatpak_ci_initiative.yml'
|
||||
|
||||
stages:
|
||||
- build
|
||||
- analysis
|
||||
@@ -149,6 +153,7 @@ msys2-mingw64:
|
||||
artifacts:
|
||||
paths:
|
||||
- "${APPID}-dev.flatpak"
|
||||
- 'repo.tar'
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
@@ -200,6 +205,24 @@ flatpak-master:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
# Publish the demo apps to the GNOME Nightly repo
|
||||
# https://wiki.gnome.org/Apps/Nightly
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
nightly demo:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:demo']
|
||||
needs: ['flatpak-master:demo']
|
||||
|
||||
nightly factory:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:widget-factory']
|
||||
needs: ['flatpak-master:widget-factory']
|
||||
|
||||
nightly icon-browser:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:icon-browser']
|
||||
needs: ['flatpak-master:icon-browser']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
|
||||
@@ -40,3 +40,8 @@ flatpak build-bundle \
|
||||
${appid}-dev.flatpak \
|
||||
--runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo \
|
||||
${appid}
|
||||
|
||||
# to be consumed by the nightly publish jobs
|
||||
if [[ $CI_COMMIT_BRANCH == master ]]; then
|
||||
tar cf repo.tar ${repodir}
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,100 @@
|
||||
Overview of Changes in master
|
||||
Overview of Changes
|
||||
===================
|
||||
|
||||
* Accessibility:
|
||||
- Map presentation role according to Core-AAM
|
||||
- Use presentation role for spacers in list views
|
||||
- Set proper roles, relations and descriptions on more widgets
|
||||
- Expand the documentation
|
||||
- Use a single GTK_A11Y environment variable and document it
|
||||
- Serveral memory leak and crash fixes
|
||||
- Initialize AT contexts lazily
|
||||
- Improve the API for storing lists in relations
|
||||
- Implement more of the Component interface
|
||||
- Implement the Cache interface
|
||||
- Implement ScrollSubstringTo for GtkTextView
|
||||
|
||||
* Introspection:
|
||||
- Add many missing annotations to APIs
|
||||
- In particular, nullability annotation fixes for rust
|
||||
|
||||
* Touch support:
|
||||
- Fix issues with text handles
|
||||
- Fix interaction between touch scrolling and focus
|
||||
- Fix active state updates for touch events
|
||||
- Allow pressing buttons with multiple fingers
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Accumulate velocity with kinetic scrolling
|
||||
|
||||
* GtkSearchEntry:
|
||||
- Use a better clear icon
|
||||
|
||||
* GtkTreeView:
|
||||
- Remove the deprecated GtkCellRendererClass.get_size vfunc
|
||||
|
||||
* GtkBuilder:
|
||||
- Be stricter about <requires>
|
||||
- Make gtk-builder-tool simplify update <requires>
|
||||
|
||||
* GtkFileChooser:
|
||||
- Remove GtkFileChooserButton
|
||||
|
||||
* Make the inspector available in non-debug builds
|
||||
|
||||
* CSS:
|
||||
- Support conic gradients
|
||||
|
||||
* Adwaita:
|
||||
- Round all window corners
|
||||
- Round submenus
|
||||
- Remove the 'chin' on menus
|
||||
- Industrial style menuitems
|
||||
- Improved tooltip styling
|
||||
- Unified sidebar styles
|
||||
- Dark prelight
|
||||
- Don't backdrop labels
|
||||
|
||||
* GSK:
|
||||
- Rename render node apis from peek to get
|
||||
|
||||
* Make GLES work in the absence of GL_ARB_timer_query
|
||||
|
||||
* Wayland:
|
||||
- Support gtk_shell1 version 3 (startup notification
|
||||
and activation)
|
||||
- Implmement minimization
|
||||
|
||||
* OS X:
|
||||
- Use the cairo renderer by default
|
||||
- Work towards a working GL renderer
|
||||
- Search engine updates
|
||||
- Fix rendering artifacts with hover transitions
|
||||
|
||||
* Windows:
|
||||
- Fix key event generation, making text input work
|
||||
|
||||
* Documentation:
|
||||
- Add missing enumerations, symbols and types
|
||||
- Lots of smaller fixes
|
||||
|
||||
* Demos:
|
||||
- Make the constraints demo more useful
|
||||
- Make search more obvious
|
||||
- Add a suggestion entry demo
|
||||
- Consistency improvements
|
||||
- Drop 'devel' styling
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
Catalan
|
||||
Polish
|
||||
Spanish
|
||||
Swedish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 3.99.4
|
||||
=============================
|
||||
|
||||
* GtkColumnView:
|
||||
@@ -23,6 +119,7 @@ Overview of Changes in master
|
||||
|
||||
* GtkTextView:
|
||||
- Fix rendering and positioning of anchored children
|
||||
- Fix positioning of touch handles
|
||||
|
||||
* Constraints:
|
||||
- Fix loading constraints from ui files
|
||||
@@ -37,6 +134,7 @@ Overview of Changes in master
|
||||
- Add documentation for app and widget developers
|
||||
- Handle HIDDEN state changes by adding/removing elements
|
||||
- Support setting accessibility attributes in ui files
|
||||
- Make window controls accessible
|
||||
|
||||
* Introspection:
|
||||
- Add some missing annotations
|
||||
@@ -44,10 +142,12 @@ Overview of Changes in master
|
||||
* gdk:
|
||||
- Deliver events on flush
|
||||
- Drop the unused GdkPoint struct from the API
|
||||
- Improve popup autohide behavior
|
||||
|
||||
* Demos:
|
||||
- Add another constraints demo
|
||||
- Tweak various demos to improve consistency
|
||||
- Small accessibility improvements
|
||||
|
||||
* Tools:
|
||||
- Improve gtk4-builder-tool handling of various
|
||||
@@ -65,6 +165,12 @@ Overview of Changes in master
|
||||
- Fix the build with cups 2.2.12
|
||||
- Make cloudprint support build without warnings
|
||||
|
||||
* Broadway:
|
||||
- Support modifiers for scroll events
|
||||
|
||||
* Windows:
|
||||
- Improve IME support
|
||||
|
||||
* OS X:
|
||||
- Fix various input issues
|
||||
- Make GtkGLArea work (with the cairo backend)
|
||||
|
||||
@@ -36,7 +36,7 @@ struct _ConstraintEditorWindow
|
||||
G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static GtkConstraintTarget *
|
||||
find_target (GListModel *model,
|
||||
find_target (GListModel *model,
|
||||
GtkConstraintTarget *orig)
|
||||
{
|
||||
const char *name;
|
||||
@@ -163,20 +163,30 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||
GtkConstraint *clone;
|
||||
GtkConstraintTarget *target;
|
||||
GtkConstraintTarget *source;
|
||||
GtkConstraintAttribute source_attr;
|
||||
|
||||
item = g_list_model_get_item (list, i);
|
||||
constraint = GTK_CONSTRAINT (item);
|
||||
|
||||
target = gtk_constraint_get_target (constraint);
|
||||
source = gtk_constraint_get_source (constraint);
|
||||
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
source_attr = gtk_constraint_get_source_attribute (constraint);
|
||||
|
||||
if (source == NULL && source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)
|
||||
clone = gtk_constraint_new_constant (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_relation (constraint),
|
||||
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_multiplier (constraint),
|
||||
gtk_constraint_get_constant (constraint),
|
||||
gtk_constraint_get_strength (constraint));
|
||||
else
|
||||
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_relation (constraint),
|
||||
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
|
||||
source_attr,
|
||||
gtk_constraint_get_multiplier (constraint),
|
||||
gtk_constraint_get_constant (constraint),
|
||||
gtk_constraint_get_strength (constraint));
|
||||
|
||||
constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone);
|
||||
|
||||
@@ -300,7 +310,7 @@ save_response_cb (GtkNativeDialog *dialog,
|
||||
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
|
||||
text = serialize_model (model);
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, -1,
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
NULL,
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="ConstraintEditorWindow" parent="GtkApplicationWindow">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">GTK Constraint Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
|
||||
@@ -142,6 +142,9 @@ get_target (GListModel *model,
|
||||
{
|
||||
int i;
|
||||
|
||||
if (id == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp ("super", id) == 0)
|
||||
return NULL;
|
||||
|
||||
@@ -212,6 +215,22 @@ get_relation_nick (GtkConstraintRelation relation)
|
||||
return nick;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_relation_display_name (GtkConstraintRelation relation)
|
||||
{
|
||||
switch (relation)
|
||||
{
|
||||
case GTK_CONSTRAINT_RELATION_LE:
|
||||
return "≤";
|
||||
case GTK_CONSTRAINT_RELATION_EQ:
|
||||
return "=";
|
||||
case GTK_CONSTRAINT_RELATION_GE:
|
||||
return "≥";
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
static GtkConstraintStrength
|
||||
get_strength (const char *id)
|
||||
{
|
||||
@@ -331,6 +350,7 @@ source_attr_changed (ConstraintEditor *editor)
|
||||
{
|
||||
gtk_widget_set_sensitive (editor->source, TRUE);
|
||||
gtk_widget_set_sensitive (editor->multiplier, TRUE);
|
||||
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +367,7 @@ constraint_editor_constraint_to_string (GtkConstraint *constraint)
|
||||
|
||||
name = get_target_name (gtk_constraint_get_target (constraint));
|
||||
attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
|
||||
relation = get_relation_nick (gtk_constraint_get_relation (constraint));
|
||||
relation = get_relation_display_name (gtk_constraint_get_relation (constraint));
|
||||
|
||||
if (name == NULL)
|
||||
name = "[ ]";
|
||||
@@ -441,8 +461,12 @@ update_preview (ConstraintEditor *editor)
|
||||
static void
|
||||
update_button (ConstraintEditor *editor)
|
||||
{
|
||||
if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)) != NULL &&
|
||||
gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)) != NULL)
|
||||
const char *target = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
|
||||
const char *source = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
|
||||
const char *source_attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
|
||||
|
||||
if (target &&
|
||||
(source || (source_attr && get_target_attr (source_attr) == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
|
||||
gtk_widget_set_sensitive (editor->button, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (editor->button, FALSE);
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
<object class="GtkComboBoxText" id="source_attr">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
|
||||
@@ -67,7 +67,7 @@ vec2 raySphere(vec3 ro, vec3 rd, vec4 sphere) {
|
||||
return vec2(t0, t1);
|
||||
}
|
||||
|
||||
float noise1(vec2 p) {
|
||||
float noize1(vec2 p) {
|
||||
vec2 n = mod2(p, vec2(cellWidth));
|
||||
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
|
||||
hh.x *= hh.y;
|
||||
@@ -81,7 +81,7 @@ float noise1(vec2 p) {
|
||||
return h*0.25;
|
||||
}
|
||||
|
||||
float noise2(vec2 p) {
|
||||
float noize2(vec2 p) {
|
||||
vec2 n = mod2(p, vec2(cellWidth));
|
||||
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
|
||||
hh.x *= hh.y;
|
||||
@@ -114,7 +114,7 @@ float height(vec2 p, float dd, int mx) {
|
||||
int i = 0;
|
||||
|
||||
for (; i < 4;++i) {
|
||||
float nn = a*noise2(p);
|
||||
float nn = a*noize2(p);
|
||||
s += nn;
|
||||
d += abs(a);
|
||||
p += o;
|
||||
@@ -130,7 +130,7 @@ float height(vec2 p, float dd, int mx) {
|
||||
mx = int(mix(float(4), float(mx), step(rdd, far)));
|
||||
|
||||
for (; i < mx; ++i) {
|
||||
float nn = a*noise1(p);
|
||||
float nn = a*noize1(p);
|
||||
s += nn;
|
||||
d += abs(a);
|
||||
p += o;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">0</property>
|
||||
<property name="title">CSS Blend Modes</property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Builder
|
||||
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, toolbar
|
||||
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar
|
||||
*
|
||||
* Demonstrates a traditional interface, loaded from a XML description,
|
||||
* and shows how to connect actions to the menu items and toolbar buttons.
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Constraints — Builder</property>
|
||||
<property name="default-width">260</property>
|
||||
<child>
|
||||
<object class="ConstraintsGrid">
|
||||
<property name="layout-manager">
|
||||
<object class="GtkConstraintLayout">
|
||||
<constraints>
|
||||
<guide name="space"
|
||||
min-width="10" min-height="10"
|
||||
nat-width="100" nat-height="10"
|
||||
max-width="200" max-height="20"
|
||||
strength="strong"/>
|
||||
<constraint target="button1" target-attribute="width"
|
||||
relation="le"
|
||||
constant="200"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="start"
|
||||
relation="eq"
|
||||
source="button1" source-attribute="start"
|
||||
constant="-8"
|
||||
strength="required"/>
|
||||
<constraint target="button1" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="button1" target-attribute="end"
|
||||
relation="eq"
|
||||
source="space" source-attribute="start"
|
||||
strength="required"/>
|
||||
<constraint target="space" target-attribute="end"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="start"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="end"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="end"
|
||||
constant="8"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="start"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="start"
|
||||
constant="-8"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="end"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="end"
|
||||
constant="8"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="top"
|
||||
relation="eq"
|
||||
source="button1" source-attribute="top"
|
||||
constant="-8"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="top"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="top"
|
||||
constant="-8"
|
||||
strength="required"/>
|
||||
<constraint target="button1" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="top"
|
||||
constant="-12"
|
||||
strength="required"/>
|
||||
<constraint target="button2" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="top"
|
||||
constant="-12"
|
||||
strength="required"/>
|
||||
<constraint target="button3" target-attribute="height"
|
||||
relation="eq"
|
||||
source="button1" source-attribute="height"
|
||||
strength="required"/>
|
||||
<constraint target="button3" target-attribute="height"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="height"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="bottom"
|
||||
constant="8"
|
||||
strength="required"/>
|
||||
</constraints>
|
||||
</object>
|
||||
</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">Child 1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">Child 2</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label">Child 3</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -1,8 +1,10 @@
|
||||
/* Constraints/Builder
|
||||
*
|
||||
* GtkConstraintLayouts can be created in .ui files, and constraints can be
|
||||
* set up at that time as well, as this example demonstrates. It uses the
|
||||
* same setup as the “Simple” constraints demo.
|
||||
* GtkConstraintLayouts can be created in .ui files, and constraints can
|
||||
* be set up at that time as well, as this example demonstrates. It shows
|
||||
* various ways to do spacing and sizing with constraints.
|
||||
*
|
||||
* Make the window wider to see the rows react differently
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -43,7 +45,7 @@ constraints_grid_class_init (ConstraintsGridClass *klass)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints4 (GtkWidget *do_widget)
|
||||
do_constraints_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -53,7 +55,7 @@ do_constraints4 (GtkWidget *do_widget)
|
||||
|
||||
g_type_ensure (constraints_grid_get_type ());
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/constraints4/constraints.ui");
|
||||
builder = gtk_builder_new_from_resource ("/constraints_builder/constraints_builder.ui");
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
@@ -0,0 +1,460 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Constraints — Builder</property>
|
||||
<property name="default-width">260</property>
|
||||
<child>
|
||||
<object class="ConstraintsGrid">
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">fill</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="layout-manager">
|
||||
<object class="GtkConstraintLayout">
|
||||
<constraints>
|
||||
<guide name="guide1" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide2" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide3" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide4" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide5" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide6" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide7" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide8" min-width="10" nat-width="200" strength="weak"/>
|
||||
<guide name="guide9" min-width="0" nat-width="200" strength="weak"/>
|
||||
<guide name="guide10" min-width="0" nat-width="200" strength="weak"/>
|
||||
<guide name="barrier1" min-height="10"/>
|
||||
<guide name="barrier2" min-height="10"/>
|
||||
<guide name="barrier3" min-height="10"/>
|
||||
<guide name="barrier4" min-height="10"/>
|
||||
|
||||
<!-- Spread Chain -->
|
||||
<constraint target="super" target-attribute="top"
|
||||
relation="eq"
|
||||
source="button1" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="top"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="top"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="top"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="super" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide1" source-attribute="left"
|
||||
strength="required"/>
|
||||
<constraint target="button1" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide1" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="guide2" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button1" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="button2" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide2" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="guide3" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="button3" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide3" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="guide4" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="right"
|
||||
relation="eq"
|
||||
source="guide4" source-attribute="right"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="guide1" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide2" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="guide2" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide3" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="guide3" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide4" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button1" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button2" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="button2" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button3" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button1" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button2" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button3" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="top"
|
||||
strength="required"/>
|
||||
|
||||
<!-- Spread Inside Chain -->
|
||||
|
||||
<constraint target="super" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button4" source-attribute="left"
|
||||
strength="required"/>
|
||||
<constraint target="guide5" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button4" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="button5" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide5" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="guide6" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button5" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="button6" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide6" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="right"
|
||||
relation="eq"
|
||||
source="button6" source-attribute="right"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="guide5" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide6" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button4" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button5" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="button5" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button6" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button4" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button5" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button6" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier1" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button4" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button5" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button6" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="top"
|
||||
strength="required"/>
|
||||
|
||||
<!-- Weighted Chain -->
|
||||
|
||||
<constraint target="super" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button7" source-attribute="left"
|
||||
strength="required"/>
|
||||
<constraint target="button8" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button7" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="button9" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button8" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="right"
|
||||
relation="eq"
|
||||
source="button9" source-attribute="right"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button8" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button7" source-attribute="width"
|
||||
multiplier="2"
|
||||
strength="required"/>
|
||||
<constraint target="button9" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button7" source-attribute="width"
|
||||
multiplier="3"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button7" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button8" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button9" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier2" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button7" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button8" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button9" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="top"
|
||||
strength="required"/>
|
||||
|
||||
<!-- Packed Chain -->
|
||||
|
||||
<constraint target="super" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide7" source-attribute="left"
|
||||
strength="required"/>
|
||||
<constraint target="button10" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide7" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="button11" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button10" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="button12" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button11" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="guide8" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button12" source-attribute="right"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="right"
|
||||
relation="eq"
|
||||
source="guide8" source-attribute="right"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="guide7" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide8" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button10" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button11" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="button11" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button12" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button10" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button11" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button12" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier3" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button10" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button11" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="top"
|
||||
strength="required"/>
|
||||
<constraint target="button12" target-attribute="bottom"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="top"
|
||||
strength="required"/>
|
||||
|
||||
<!-- Packed Chain with Bias -->
|
||||
|
||||
<constraint target="super" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide9" source-attribute="left"
|
||||
strength="required"/>
|
||||
<constraint target="button13" target-attribute="left"
|
||||
relation="eq"
|
||||
source="guide9" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="button14" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button13" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="button15" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button14" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="guide10" target-attribute="left"
|
||||
relation="eq"
|
||||
source="button15" source-attribute="right"
|
||||
constant="10"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="right"
|
||||
relation="eq"
|
||||
source="guide10" source-attribute="right"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="guide9" target-attribute="width"
|
||||
relation="eq"
|
||||
source="guide10" source-attribute="width"
|
||||
multiplier="4"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button13" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button14" source-attribute="width"
|
||||
strength="required"/>
|
||||
<constraint target="button14" target-attribute="width"
|
||||
relation="eq"
|
||||
source="button15" source-attribute="width"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="button13" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button14" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="button15" target-attribute="top"
|
||||
relation="eq"
|
||||
source="barrier4" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
|
||||
<constraint target="super" target-attribute="bottom"
|
||||
relation="ge"
|
||||
source="button13" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="bottom"
|
||||
relation="ge"
|
||||
source="button14" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
<constraint target="super" target-attribute="bottom"
|
||||
relation="ge"
|
||||
source="button15" source-attribute="bottom"
|
||||
strength="required"/>
|
||||
</constraints>
|
||||
</object>
|
||||
</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">A</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">B</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label">C</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button4">
|
||||
<property name="label">A</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button5">
|
||||
<property name="label">B</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button6">
|
||||
<property name="label">C</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button7">
|
||||
<property name="label">A</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button8">
|
||||
<property name="label">B</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button9">
|
||||
<property name="label">C</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button10">
|
||||
<property name="label">A</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button11">
|
||||
<property name="label">B</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button12">
|
||||
<property name="label">C</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button13">
|
||||
<property name="label">A</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button14">
|
||||
<property name="label">B</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button15">
|
||||
<property name="label">C</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -205,7 +205,7 @@ interactive_grid_init (InteractiveGrid *self)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints2 (GtkWidget *do_widget)
|
||||
do_constraints_interactive (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -128,7 +128,7 @@ vfl_grid_init (VflGrid *self)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints3 (GtkWidget *do_widget)
|
||||
do_constraints_vfl (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<file>demoimage.c</file>
|
||||
<file>demoimage.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/constraints4">
|
||||
<file>constraints.ui</file>
|
||||
<gresource prefix="/constraints_builder">
|
||||
<file>constraints_builder.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/css_accordion">
|
||||
<file>css_accordion.css</file>
|
||||
@@ -43,6 +43,11 @@
|
||||
<file>cssview.css</file>
|
||||
<file>reset.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/dropdown">
|
||||
<file>suggestionentry.h</file>
|
||||
<file>suggestionentry.c</file>
|
||||
<file>suggestionentry.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/theming_style_classes">
|
||||
<file>theming.ui</file>
|
||||
</gresource>
|
||||
@@ -208,6 +213,8 @@
|
||||
<file>demo3widget.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/paintable_svg">
|
||||
<file>svgpaintable.h</file>
|
||||
<file>svgpaintable.c</file>
|
||||
<file>org.gtk.gtk4.NodeEditor.Devel.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/shortcuts">
|
||||
@@ -246,9 +253,9 @@
|
||||
<file>clipboard.c</file>
|
||||
<file>combobox.c</file>
|
||||
<file>constraints.c</file>
|
||||
<file>constraints2.c</file>
|
||||
<file>constraints3.c</file>
|
||||
<file>constraints4.c</file>
|
||||
<file>constraints_interactive.c</file>
|
||||
<file>constraints_vfl.c</file>
|
||||
<file>constraints_builder.c</file>
|
||||
<file>css_accordion.c</file>
|
||||
<file>css_basics.c</file>
|
||||
<file>css_blendmodes.c</file>
|
||||
@@ -287,7 +294,7 @@
|
||||
<file>layoutmanager2.c</file>
|
||||
<file>links.c</file>
|
||||
<file>listbox.c</file>
|
||||
<file>listbox2.c</file>
|
||||
<file>listbox_controls.c</file>
|
||||
<file>listview_applauncher.c</file>
|
||||
<file>listview_colors.c</file>
|
||||
<file>listview_clocks.c</file>
|
||||
@@ -302,7 +309,7 @@
|
||||
<file>markup.c</file>
|
||||
<file>menu.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay2.c</file>
|
||||
<file>overlay_decorative.c</file>
|
||||
<file>paint.c</file>
|
||||
<file>pagesetup.c</file>
|
||||
<file>paintable.c</file>
|
||||
@@ -312,6 +319,9 @@
|
||||
<file>paintable_svg.c</file>
|
||||
<file>panes.c</file>
|
||||
<file>password_entry.c</file>
|
||||
<file>path_fill.c</file>
|
||||
<file>path_maze.c</file>
|
||||
<file>path_text.c</file>
|
||||
<file>peg_solitaire.c</file>
|
||||
<file>pickers.c</file>
|
||||
<file>printing.c</file>
|
||||
@@ -352,8 +362,8 @@
|
||||
<file>messages.txt</file>
|
||||
<file>apple-red.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/listbox2">
|
||||
<file>listbox2.ui</file>
|
||||
<gresource prefix="/listbox_controls">
|
||||
<file>listbox_controls.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/glarea">
|
||||
<file>glarea-gl.fs.glsl</file>
|
||||
@@ -396,6 +406,9 @@
|
||||
<gresource prefix="/fontrendering">
|
||||
<file>fontrendering.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/path_text">
|
||||
<file>path_text.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4">
|
||||
<file>icons/16x16/actions/application-exit.png</file>
|
||||
<file>icons/16x16/actions/document-new.png</file>
|
||||
|
||||
@@ -96,13 +96,18 @@
|
||||
<child>
|
||||
<object class="GtkPopoverMenuBar" id="menubar1">
|
||||
<property name="menu-model">menubar</property>
|
||||
<accessibility>
|
||||
<property name="label">Main Menu</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<style>
|
||||
<class name="toolbar"/>
|
||||
</style>
|
||||
<property name="accessible-role">toolbar</property>
|
||||
<property name="css-classes">toolbar</property>
|
||||
<accessibility>
|
||||
<property name="label">Toolbar</property>
|
||||
</accessibility>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
|
||||
@@ -311,6 +311,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 250, -1);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
|
||||
+237
-26
@@ -1,17 +1,16 @@
|
||||
/* Drop Downs
|
||||
/* Lists/Selections
|
||||
*
|
||||
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
||||
* It uses list models instead of tree models, and the content is
|
||||
* displayed using widgets instead of cell renderers.
|
||||
*
|
||||
* The examples here demonstrate how to use different kinds of
|
||||
* list models with GtkDropDown, how to use search and how to
|
||||
* display the selected item differently from the presentation
|
||||
* in the popup.
|
||||
* This example also shows a custom widget that can replace
|
||||
* GtkEntryCompletion or GtkComboBoxText. It is not currently
|
||||
* part of GTK.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "suggestionentry.h"
|
||||
|
||||
#define STRING_TYPE_HOLDER (string_holder_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (StringHolder, string_holder, STRING, HOLDER, GObject)
|
||||
@@ -273,13 +272,110 @@ get_title (gpointer item)
|
||||
return g_strdup (STRING_HOLDER (item)->title);
|
||||
}
|
||||
|
||||
static char *
|
||||
get_file_name (gpointer item)
|
||||
{
|
||||
return g_strdup (g_file_info_get_display_name (G_FILE_INFO (item)));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *icon;
|
||||
GtkWidget *label;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
icon = gtk_image_new ();
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_box_append (GTK_BOX (box), icon);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
gtk_list_item_set_child (item, box);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
MatchObject *match = MATCH_OBJECT (gtk_list_item_get_item (item));
|
||||
GFileInfo *info = G_FILE_INFO (match_object_get_item (match));
|
||||
GtkWidget *box = gtk_list_item_get_child (item);
|
||||
GtkWidget *icon = gtk_widget_get_first_child (box);
|
||||
GtkWidget *label = gtk_widget_get_last_child (box);
|
||||
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (icon), g_file_info_get_icon (info));
|
||||
gtk_label_set_label (GTK_LABEL (label), g_file_info_get_display_name (info));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_highlight_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_list_item_set_child (item, label);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_highlight_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
MatchObject *obj;
|
||||
GtkWidget *label;
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
const char *str;
|
||||
|
||||
obj = MATCH_OBJECT (gtk_list_item_get_item (item));
|
||||
label = gtk_list_item_get_child (item);
|
||||
|
||||
str = match_object_get_string (obj);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (label), str);
|
||||
attrs = pango_attr_list_new ();
|
||||
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
|
||||
attr->start_index = match_object_get_match_start (obj);
|
||||
attr->end_index = match_object_get_match_end (obj);
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
match_func (MatchObject *obj,
|
||||
const char *search,
|
||||
gpointer user_data)
|
||||
{
|
||||
char *tmp1, *tmp2;
|
||||
char *p;
|
||||
|
||||
tmp1 = g_utf8_normalize (match_object_get_string (obj), -1, G_NORMALIZE_ALL);
|
||||
tmp2 = g_utf8_normalize (search, -1, G_NORMALIZE_ALL);
|
||||
|
||||
if ((p = strstr (tmp1, tmp2)) != NULL)
|
||||
match_object_set_match (obj,
|
||||
p - tmp1,
|
||||
(p - tmp1) + g_utf8_strlen (search, -1),
|
||||
1);
|
||||
else
|
||||
match_object_set_match (obj, 0, 0, 0);
|
||||
|
||||
g_free (tmp1);
|
||||
g_free (tmp2);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_dropdown (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *button, *box, *spin, *check;
|
||||
GtkWidget *button, *box, *spin, *check, *hbox, *label, *entry;
|
||||
GListModel *model;
|
||||
GtkExpression *expression;
|
||||
GtkListItemFactory *factory;
|
||||
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
|
||||
const char * const many_times[] = {
|
||||
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
|
||||
@@ -292,22 +388,49 @@ do_dropdown (GtkWidget *do_widget)
|
||||
const char * const device_descriptions[] = {
|
||||
"Built-in Audio", "Built-in audio", "Thinkpad Tunderbolt 3 Dock USB Audio", "Thinkpad Tunderbolt 3 Dock USB Audio", NULL
|
||||
};
|
||||
char *cwd;
|
||||
GFile *file;
|
||||
GListModel *dir;
|
||||
GtkStringList *strings;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Drop Downs");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Selections");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
|
||||
|
||||
gtk_widget_set_margin_start (hbox, 20);
|
||||
gtk_widget_set_margin_end (hbox, 20);
|
||||
gtk_widget_set_margin_top (hbox, 20);
|
||||
gtk_widget_set_margin_bottom (hbox, 20);
|
||||
gtk_window_set_child (GTK_WINDOW (window), hbox);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_widget_set_margin_start (box, 10);
|
||||
gtk_widget_set_margin_end (box, 10);
|
||||
gtk_widget_set_margin_top (box, 10);
|
||||
gtk_widget_set_margin_bottom (box, 10);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
gtk_box_append (GTK_BOX (hbox), box);
|
||||
|
||||
label = gtk_label_new ("Dropdowns");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
/* A basic dropdown */
|
||||
button = drop_down_new_from_strings (times, NULL, NULL);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
/* A dropdown using an expression to obtain strings */
|
||||
button = drop_down_new_from_strings (many_times, NULL, NULL);
|
||||
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
|
||||
gtk_expression_unref (expression);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
button = gtk_drop_down_new (NULL, NULL);
|
||||
|
||||
@@ -325,30 +448,118 @@ do_dropdown (GtkWidget *do_widget)
|
||||
|
||||
spin = gtk_spin_button_new_with_range (-1, g_list_model_get_n_items (G_LIST_MODEL (model)), 1);
|
||||
gtk_widget_set_halign (spin, GTK_ALIGN_START);
|
||||
gtk_widget_set_margin_start (spin, 20);
|
||||
g_object_bind_property (button, "selected", spin, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
gtk_box_append (GTK_BOX (box), spin);
|
||||
|
||||
check = gtk_check_button_new_with_label ("Enable search");
|
||||
gtk_widget_set_margin_start (check, 20);
|
||||
g_object_bind_property (button, "enable-search", check, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
gtk_box_append (GTK_BOX (box), check);
|
||||
|
||||
g_object_unref (model);
|
||||
|
||||
button = drop_down_new_from_strings (times, NULL, NULL);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
button = drop_down_new_from_strings (many_times, NULL, NULL);
|
||||
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
|
||||
gtk_expression_unref (expression);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
/* A dropdown with a separate list factory */
|
||||
button = drop_down_new_from_strings (device_titles, device_icons, device_descriptions);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_box_append (GTK_BOX (hbox), box);
|
||||
|
||||
label = gtk_label_new ("Suggestions");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
/* A basic suggestion entry */
|
||||
entry = suggestion_entry_new ();
|
||||
g_object_set (entry, "placeholder-text", "Words with T or G…", NULL);
|
||||
strings = gtk_string_list_new ((const char *[]){
|
||||
"GNOME",
|
||||
"gnominious",
|
||||
"Gnomonic projection",
|
||||
"total",
|
||||
"totally",
|
||||
"toto",
|
||||
"tottery",
|
||||
"totterer",
|
||||
"Totten trust",
|
||||
"totipotent",
|
||||
"totipotency",
|
||||
"totemism",
|
||||
"totem pole",
|
||||
"Totara",
|
||||
"totalizer",
|
||||
"totalizator",
|
||||
"totalitarianism",
|
||||
"total parenteral nutrition",
|
||||
"total hysterectomy",
|
||||
"total eclipse",
|
||||
"Totipresence",
|
||||
"Totipalmi",
|
||||
"Tomboy",
|
||||
"zombie",
|
||||
NULL});
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
|
||||
g_object_unref (strings);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
/* A suggestion entry using a custom model, and no filtering */
|
||||
entry = suggestion_entry_new ();
|
||||
|
||||
cwd = g_get_current_dir ();
|
||||
file = g_file_new_for_path (cwd);
|
||||
dir = G_LIST_MODEL (gtk_directory_list_new ("standard::display-name,standard::content-type,standard::icon,standard::size", file));
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), dir);
|
||||
g_object_unref (dir);
|
||||
g_object_unref (file);
|
||||
g_free (cwd);
|
||||
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_file_name,
|
||||
NULL, NULL);
|
||||
suggestion_entry_set_expression (SUGGESTION_ENTRY (entry), expression);
|
||||
gtk_expression_unref (expression);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_item), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_item), NULL);
|
||||
|
||||
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
suggestion_entry_set_use_filter (SUGGESTION_ENTRY (entry), FALSE);
|
||||
suggestion_entry_set_show_arrow (SUGGESTION_ENTRY (entry), TRUE);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
/* A suggestion entry with match highlighting */
|
||||
entry = suggestion_entry_new ();
|
||||
g_object_set (entry, "placeholder-text", "Destination", NULL);
|
||||
|
||||
strings = gtk_string_list_new ((const char *[]){
|
||||
"app-mockups",
|
||||
"settings-mockups",
|
||||
"os-mockups",
|
||||
"software-mockups",
|
||||
"mocktails",
|
||||
NULL});
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
|
||||
g_object_unref (strings);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
suggestion_entry_set_match_func (SUGGESTION_ENTRY (entry), match_func, NULL, NULL);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_highlight_item), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_highlight_item), NULL);
|
||||
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<column type="gint"/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
|
||||
@@ -501,7 +501,7 @@ fontify (const char *format,
|
||||
char *theme;
|
||||
gboolean prefer_dark;
|
||||
const char *style_arg;
|
||||
const char *text;
|
||||
char *text;
|
||||
GtkTextIter start, end;
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
@@ -553,7 +553,7 @@ fontify (const char *format,
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
|
||||
bytes = g_bytes_new_static (text, strlen (text));
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
|
||||
#ifdef HAVE_GIO_UNIX
|
||||
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
|
||||
@@ -570,4 +570,5 @@ fontify (const char *format,
|
||||
NULL,
|
||||
fontify_finish,
|
||||
g_object_ref (source_buffer));
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
@@ -179,6 +179,9 @@ gtk_fishbowl_add (GtkFishbowl *fishbowl,
|
||||
child_info->dy = new_speed ();
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (fishbowl));
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (widget),
|
||||
GTK_ACCESSIBLE_STATE_HIDDEN, TRUE,
|
||||
-1);
|
||||
|
||||
g_hash_table_insert (priv->children, widget, child_info);
|
||||
priv->count++;
|
||||
@@ -342,6 +345,8 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_PRESENTATION);
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -13,7 +13,7 @@ static GtkWidget *window = NULL;
|
||||
static GtkWidget *scrolledwindow;
|
||||
static int selected;
|
||||
|
||||
#define N_WIDGET_TYPES 6
|
||||
#define N_WIDGET_TYPES 7
|
||||
|
||||
|
||||
static int hincrement = 5;
|
||||
@@ -177,6 +177,24 @@ populate_grid (void)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list);
|
||||
}
|
||||
|
||||
extern GtkWidget *create_ucd_view (GtkWidget *label);
|
||||
|
||||
static void
|
||||
populate_list2 (void)
|
||||
{
|
||||
GtkWidget *list;
|
||||
|
||||
list = create_ucd_view (NULL);
|
||||
|
||||
hincrement = 0;
|
||||
vincrement = 5;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list);
|
||||
}
|
||||
|
||||
static void
|
||||
set_widget_type (int type)
|
||||
{
|
||||
@@ -216,6 +234,11 @@ set_widget_type (int type)
|
||||
break;
|
||||
|
||||
case 5:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a columned list");
|
||||
populate_list2 ();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a grid");
|
||||
populate_grid ();
|
||||
break;
|
||||
|
||||
@@ -34,7 +34,7 @@ row_activated (GtkListBox *list,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listbox2 (GtkWidget *do_widget)
|
||||
do_listbox_controls (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ do_listbox2 (GtkWidget *do_widget)
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL);
|
||||
gtk_builder_add_from_resource (builder, "/listbox_controls/listbox_controls.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
@@ -80,7 +80,7 @@ ucd_model_new (void)
|
||||
iter = g_variant_iter_new (v);
|
||||
|
||||
store = g_list_store_new (G_TYPE_OBJECT);
|
||||
while (g_variant_iter_next (iter, "(us)", &u, &name))
|
||||
while (g_variant_iter_next (iter, "(u&s)", &u, &name))
|
||||
{
|
||||
if (u == 0)
|
||||
continue;
|
||||
@@ -259,7 +259,7 @@ selection_changed (GObject *object,
|
||||
gtk_label_set_label (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
GtkWidget *
|
||||
create_ucd_view (GtkWidget *label)
|
||||
{
|
||||
GtkWidget *cv;
|
||||
@@ -273,7 +273,8 @@ create_ucd_view (GtkWidget *label)
|
||||
selection = gtk_single_selection_new (ucd_model);
|
||||
gtk_single_selection_set_autoselect (selection, TRUE);
|
||||
gtk_single_selection_set_can_unselect (selection, FALSE);
|
||||
g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label);
|
||||
if (label)
|
||||
g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label);
|
||||
|
||||
cv = gtk_column_view_new (GTK_SELECTION_MODEL (selection));
|
||||
gtk_column_view_set_show_column_separators (GTK_COLUMN_VIEW (cv), TRUE);
|
||||
@@ -283,12 +284,14 @@ create_ucd_view (GtkWidget *label)
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_codepoint), NULL);
|
||||
column = gtk_column_view_column_new ("Codepoint", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_centered_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_char), NULL);
|
||||
column = gtk_column_view_column_new ("Char", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -296,6 +299,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Name", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -303,6 +307,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -310,6 +315,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Break Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@@ -317,6 +323,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Combining Class", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@@ -324,6 +331,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Script", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
@@ -142,16 +142,42 @@ load_file (GtkStringList *list,
|
||||
}
|
||||
|
||||
static void
|
||||
file_selected_cb (GtkWidget *button,
|
||||
open_response_cb (GtkWidget *dialog,
|
||||
int response,
|
||||
GtkStringList *stringlist)
|
||||
{
|
||||
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (file)
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
load_file (stringlist, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
file_open_cb (GtkWidget *button,
|
||||
GtkStringList *stringlist)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Open file",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Load", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -189,8 +215,8 @@ do_listview_words (GtkWidget *do_widget)
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
open_button = gtk_file_chooser_button_new ("_Open", GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
g_signal_connect (open_button, "file-set", G_CALLBACK (file_selected_cb), stringlist);
|
||||
open_button = gtk_button_new_with_mnemonic ("_Open");
|
||||
g_signal_connect (open_button, "clicked", G_CALLBACK (file_open_cb), stringlist);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), open_button);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
|
||||
@@ -337,8 +337,8 @@ display_text (const char *format,
|
||||
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
g_assert (bytes);
|
||||
|
||||
g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL));
|
||||
text = g_bytes_get_data (bytes, &len);
|
||||
g_assert (g_utf8_validate (text, len, NULL));
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 20);
|
||||
@@ -354,9 +354,8 @@ display_text (const char *format,
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (textview), TRUE);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
text = g_bytes_unref_to_data (bytes, &len);
|
||||
gtk_text_buffer_set_text (buffer, text, len);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (format)
|
||||
fontify (format, buffer);
|
||||
|
||||
+34
-15
@@ -17,9 +17,6 @@
|
||||
</section>
|
||||
</menu>
|
||||
<object class="GtkApplicationWindow" id="window">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="default-width">800</property>
|
||||
<property name="default-height">600</property>
|
||||
<child type="titlebar">
|
||||
@@ -28,14 +25,17 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="action-name">win.run</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Run</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="label" translatable="yes">Run</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton">
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active" bind-source="searchbar" bind-property="search-mode-enabled" bind-flags="bidirectional|sync-create"/>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
@@ -43,6 +43,9 @@
|
||||
<property name="valign">center</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Primary menu</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -51,6 +54,9 @@
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="width-request">120</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
@@ -63,7 +69,11 @@
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry"/>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -78,6 +88,10 @@
|
||||
<property name="resource">/ui/main-listitem.ui</property>
|
||||
</object>
|
||||
</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Demo list</property>
|
||||
<relation name="controls">notebook</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -85,9 +99,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="scrollable">1</property>
|
||||
@@ -112,6 +123,10 @@
|
||||
<property name="editable">0</property>
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="cursor-visible">0</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Info</property>
|
||||
<property name="description" translatable="yes">A description of the demo</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -142,6 +157,10 @@
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="pixels-above-lines">2</property>
|
||||
<property name="pixels-below-lines">2</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Source</property>
|
||||
<property name="description" translatable="yes">The source code of the demo</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
+19
-11
@@ -7,9 +7,9 @@ demos = files([
|
||||
'clipboard.c',
|
||||
'combobox.c',
|
||||
'constraints.c',
|
||||
'constraints2.c',
|
||||
'constraints3.c',
|
||||
'constraints4.c',
|
||||
'constraints_interactive.c',
|
||||
'constraints_vfl.c',
|
||||
'constraints_builder.c',
|
||||
'css_accordion.c',
|
||||
'css_basics.c',
|
||||
'css_blendmodes.c',
|
||||
@@ -19,7 +19,6 @@ demos = files([
|
||||
'cursors.c',
|
||||
'dialog.c',
|
||||
'drawingarea.c',
|
||||
'dropdown.c',
|
||||
'dnd.c',
|
||||
'editable_cells.c',
|
||||
'entry_completion.c',
|
||||
@@ -45,7 +44,7 @@ demos = files([
|
||||
'layoutmanager2.c',
|
||||
'links.c',
|
||||
'listbox.c',
|
||||
'listbox2.c',
|
||||
'listbox_controls.c',
|
||||
'menu.c',
|
||||
'flowbox.c',
|
||||
'list_store.c',
|
||||
@@ -54,12 +53,14 @@ demos = files([
|
||||
'listview_colors.c',
|
||||
'listview_filebrowser.c',
|
||||
'listview_minesweeper.c',
|
||||
'dropdown.c',
|
||||
'listview_settings.c',
|
||||
'listview_ucd.c',
|
||||
'listview_weather.c',
|
||||
'listview_words.c',
|
||||
'markup.c',
|
||||
'overlay.c',
|
||||
'overlay2.c',
|
||||
'overlay_decorative.c',
|
||||
'paint.c',
|
||||
'paintable.c',
|
||||
'paintable_animated.c',
|
||||
@@ -67,6 +68,9 @@ demos = files([
|
||||
'paintable_mediastream.c',
|
||||
'panes.c',
|
||||
'password_entry.c',
|
||||
'path_fill.c',
|
||||
'path_maze.c',
|
||||
'path_text.c',
|
||||
'peg_solitaire.c',
|
||||
'pickers.c',
|
||||
'printing.c',
|
||||
@@ -120,11 +124,14 @@ extra_demo_sources = files(['main.c',
|
||||
'four_point_transform.c',
|
||||
'demo2widget.c',
|
||||
'demo3widget.c',
|
||||
'pixbufpaintable.c'])
|
||||
'pixbufpaintable.c',
|
||||
'script-names.c',
|
||||
'unicode-names.c',
|
||||
'suggestionentry.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files(['font_features.c', 'listview_ucd.c'])
|
||||
extra_demo_sources += files(['script-names.c', 'language-names.c', 'unicode-names.c'])
|
||||
demos += files(['font_features.c'])
|
||||
extra_demo_sources += files(['language-names.c'])
|
||||
gtkdemo_deps += [ harfbuzz_dep, epoxy_dep ]
|
||||
endif
|
||||
|
||||
@@ -136,6 +143,7 @@ librsvg_dep = dependency('librsvg-2.0', version: '>= 2.46.0', required: false)
|
||||
|
||||
if librsvg_dep.found()
|
||||
demos += files('paintable_svg.c')
|
||||
extra_demo_sources += files(['svgpaintable.c'])
|
||||
gtkdemo_deps += [ librsvg_dep ]
|
||||
endif
|
||||
|
||||
@@ -162,7 +170,7 @@ executable('gtk4-demo',
|
||||
c_args: gtkdemo_args + demo_cflags,
|
||||
dependencies: gtkdemo_deps,
|
||||
include_directories: confinc,
|
||||
# gui_app: true,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
@@ -171,7 +179,7 @@ executable('gtk4-demo-application',
|
||||
c_args: gtkdemo_args + common_cflags,
|
||||
dependencies: gtkdemo_deps,
|
||||
include_directories: confinc,
|
||||
# gui_app: true,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ margin_changed (GtkAdjustment *adjustment,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_overlay2 (GtkWidget *do_widget)
|
||||
do_overlay_decorative (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
@@ -153,7 +153,7 @@ do_paintable_emblem (GtkWidget *do_widget)
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Emblems");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paintable — Emblems");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
+38
-173
@@ -9,186 +9,54 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <librsvg/rsvg.h>
|
||||
|
||||
#define SVG_TYPE_PAINTABLE (svg_paintable_get_type ())
|
||||
#include "svgpaintable.h"
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SvgPaintable, svg_paintable, SVG, PAINTABLE, GObject)
|
||||
|
||||
struct _SvgPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
GFile *file;
|
||||
RsvgHandle *handle;
|
||||
};
|
||||
|
||||
struct _SvgPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_FILE = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static void
|
||||
svg_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
open_response_cb (GtkWidget *dialog,
|
||||
int response,
|
||||
GtkPicture *picture)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
cairo_t *cr;
|
||||
GError *error = NULL;
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
cr = gtk_snapshot_append_cairo (GTK_SNAPSHOT (snapshot),
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
if (!rsvg_handle_render_document (self->handle, cr,
|
||||
&(RsvgRectangle) {0, 0, width, height},
|
||||
&error))
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
g_error ("%s", error->message);
|
||||
GFile *file;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.width;
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.height;
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_init_interface (GdkPaintableInterface *iface)
|
||||
show_file_open (GtkWidget *button,
|
||||
GtkPicture *picture)
|
||||
{
|
||||
iface->snapshot = svg_paintable_snapshot;
|
||||
iface->get_intrinsic_width = svg_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = svg_paintable_get_intrinsic_height;
|
||||
}
|
||||
GtkFileFilter *filter;
|
||||
GtkWidget *dialog;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (SvgPaintable, svg_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
svg_paintable_init_interface))
|
||||
dialog = gtk_file_chooser_dialog_new ("Open node file",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Load", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
static void
|
||||
svg_paintable_init (SvgPaintable *self)
|
||||
{
|
||||
}
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
|
||||
static void
|
||||
svg_paintable_dispose (GObject *object)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
g_clear_object (&self->file);
|
||||
g_clear_object (&self->handle);
|
||||
|
||||
G_OBJECT_CLASS (svg_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
{
|
||||
GFile *file = g_value_get_object (value);
|
||||
RsvgHandle *handle = rsvg_handle_new_from_gfile_sync (file,
|
||||
RSVG_HANDLE_FLAGS_NONE,
|
||||
NULL,
|
||||
NULL);
|
||||
rsvg_handle_set_dpi (handle, 90);
|
||||
|
||||
g_set_object (&self->file, file);
|
||||
g_set_object (&self->handle, handle);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
g_value_set_object (value, self->file);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
svg_paintable_class_init (SvgPaintableClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = svg_paintable_dispose;
|
||||
object_class->set_property = svg_paintable_set_property;
|
||||
object_class->get_property = svg_paintable_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_FILE,
|
||||
g_param_spec_object ("file", "File", "File",
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static SvgPaintable *
|
||||
svg_paintable_new (GFile *file)
|
||||
{
|
||||
return g_object_new (SVG_TYPE_PAINTABLE,
|
||||
"file", file,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
file_set (GtkFileChooserButton *button,
|
||||
GtkWidget *picture)
|
||||
{
|
||||
GFile *file;
|
||||
SvgPaintable *paintable;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
|
||||
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (paintable));
|
||||
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static GtkWidget *window;
|
||||
@@ -198,36 +66,33 @@ do_paintable_svg (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *header;
|
||||
GtkWidget *picture;
|
||||
GtkFileFilter *filter;
|
||||
GtkWidget *button;
|
||||
GFile *file;
|
||||
SvgPaintable *paintable;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 330, 330);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paintable — SVG");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (button), filter);
|
||||
button = gtk_button_new_with_mnemonic ("_Open");
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
|
||||
|
||||
picture = gtk_picture_new ();
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (picture), TRUE);
|
||||
gtk_widget_set_size_request (picture, 16, 16);
|
||||
|
||||
g_signal_connect (button, "file-set", G_CALLBACK (file_set), picture);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (show_file_open), picture);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), picture);
|
||||
|
||||
file = g_file_new_for_uri ("resource:///paintable_svg/org.gtk.gtk4.NodeEditor.Devel.svg");
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (paintable));
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
/* Path/Fill
|
||||
*
|
||||
* This demo shows how to use PangoCairo to draw text with more than
|
||||
* just a single color.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "paintable.h"
|
||||
#include "gsk/gskpathdashprivate.h"
|
||||
|
||||
#define GTK_TYPE_PATH_PAINTABLE (gtk_path_paintable_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkPathPaintable, gtk_path_paintable, GTK, PATH_PAINTABLE, GObject)
|
||||
|
||||
struct _GtkPathPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
GskPath *path;
|
||||
GdkPaintable *background;
|
||||
};
|
||||
|
||||
struct _GtkPathPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static int
|
||||
gtk_path_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
|
||||
|
||||
if (self->background)
|
||||
return MAX (gdk_paintable_get_intrinsic_width (self->background), self->width);
|
||||
else
|
||||
return self->width;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_path_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
|
||||
|
||||
if (self->background)
|
||||
return MAX (gdk_paintable_get_intrinsic_height (self->background), self->height);
|
||||
else
|
||||
return self->height;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
|
||||
|
||||
#if 0
|
||||
gtk_snapshot_push_fill (snapshot, self->path, GSK_FILL_RULE_WINDING);
|
||||
#else
|
||||
GskStroke *stroke = gsk_stroke_new (2.0);
|
||||
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
|
||||
gsk_stroke_free (stroke);
|
||||
#endif
|
||||
|
||||
if (self->background)
|
||||
{
|
||||
gdk_paintable_snapshot (self->background, snapshot, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_snapshot_append_linear_gradient (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (0, 0),
|
||||
&GRAPHENE_POINT_INIT (width, height),
|
||||
(GskColorStop[8]) {
|
||||
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
|
||||
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
|
||||
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
|
||||
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
|
||||
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
|
||||
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
|
||||
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
|
||||
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
|
||||
},
|
||||
8);
|
||||
}
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
}
|
||||
|
||||
static GdkPaintableFlags
|
||||
gtk_path_paintable_get_flags (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
|
||||
|
||||
if (self->background)
|
||||
return gdk_paintable_get_flags (self->background);
|
||||
else
|
||||
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_paintable_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->get_intrinsic_width = gtk_path_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gtk_path_paintable_get_intrinsic_height;
|
||||
iface->snapshot = gtk_path_paintable_snapshot;
|
||||
iface->get_flags = gtk_path_paintable_get_flags;
|
||||
}
|
||||
|
||||
/* When defining the GType, we need to implement the GdkPaintable interface */
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPathPaintable, gtk_path_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gtk_path_paintable_paintable_init))
|
||||
|
||||
/* Here's the boilerplate for the GObject declaration.
|
||||
* We don't need to do anything special here, because we keep no
|
||||
* data of our own.
|
||||
*/
|
||||
static void
|
||||
gtk_path_paintable_class_init (GtkPathPaintableClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_paintable_init (GtkPathPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
/* And finally, we add a simple constructor.
|
||||
* It is declared in the header so that the other examples
|
||||
* can use it.
|
||||
*/
|
||||
GdkPaintable *
|
||||
gtk_path_paintable_new (GskPath *path,
|
||||
GdkPaintable *background,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GtkPathPaintable *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_PATH_PAINTABLE, NULL);
|
||||
self->path = path;
|
||||
self->background = background;
|
||||
if (self->background)
|
||||
{
|
||||
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gdk_paintable_invalidate_contents), self);
|
||||
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gdk_paintable_invalidate_size), self);
|
||||
}
|
||||
self->width = width;
|
||||
self->height = height;
|
||||
|
||||
return GDK_PAINTABLE (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_path_paintable_set_path (GtkPathPaintable *self,
|
||||
GskPath *path)
|
||||
{
|
||||
g_clear_pointer (&self->path, gsk_path_unref);
|
||||
self->path = gsk_path_ref (path);
|
||||
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
}
|
||||
|
||||
static GskPath *
|
||||
create_hexagon (GtkWidget *widget)
|
||||
{
|
||||
GskPathBuilder *builder;
|
||||
|
||||
builder = gsk_path_builder_new ();
|
||||
|
||||
gsk_path_builder_move_to (builder, 120, 0);
|
||||
gsk_path_builder_line_to (builder, 360, 0);
|
||||
gsk_path_builder_line_to (builder, 480, 208);
|
||||
gsk_path_builder_line_to (builder, 360, 416);
|
||||
gsk_path_builder_line_to (builder, 120, 416);
|
||||
gsk_path_builder_line_to (builder, 0, 208);
|
||||
gsk_path_builder_close (builder);
|
||||
|
||||
return gsk_path_builder_free_to_path (builder);
|
||||
}
|
||||
|
||||
static GskPath *
|
||||
create_path_from_text (GtkWidget *widget)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
cairo_path_t *path;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *desc;
|
||||
GskPath *result;
|
||||
|
||||
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, "Pango power!\nPango power!\nPango power!");
|
||||
desc = pango_font_description_from_string ("sans bold 36");
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
pango_cairo_layout_path (cr, layout);
|
||||
path = cairo_copy_path_flat (cr);
|
||||
result = gsk_path_new_from_cairo (path);
|
||||
|
||||
cairo_path_destroy (path);
|
||||
g_object_unref (layout);
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
build_path (GskPathOperation op,
|
||||
const graphene_point_t *pts,
|
||||
gsize n_pts,
|
||||
float weight,
|
||||
gpointer user_data)
|
||||
{
|
||||
GskPathBuilder *builder = user_data;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case GSK_PATH_MOVE:
|
||||
gsk_path_builder_move_to (builder, pts[0].x, pts[0].y);
|
||||
break;
|
||||
|
||||
case GSK_PATH_CLOSE:
|
||||
gsk_path_builder_close (builder);
|
||||
break;
|
||||
|
||||
case GSK_PATH_LINE:
|
||||
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
|
||||
break;
|
||||
|
||||
case GSK_PATH_CURVE:
|
||||
gsk_path_builder_curve_to (builder, pts[1].x, pts[1].y, pts[2].x, pts[2].y, pts[3].x, pts[3].y);
|
||||
break;
|
||||
|
||||
case GSK_PATH_CONIC:
|
||||
gsk_path_builder_conic_to (builder, pts[1].x, pts[1].y, pts[2].x, pts[2].y, weight);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
update_path (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer measure)
|
||||
{
|
||||
float progress = gdk_frame_clock_get_frame_time (frame_clock) % (60 * G_USEC_PER_SEC) / (float) (30 * G_USEC_PER_SEC);
|
||||
GskPathBuilder *builder;
|
||||
GskPath *path;
|
||||
graphene_point_t pos;
|
||||
graphene_vec2_t tangent;
|
||||
GskStroke *stroke;
|
||||
|
||||
builder = gsk_path_builder_new ();
|
||||
gsk_path_builder_add_segment (builder,
|
||||
measure,
|
||||
#if 1
|
||||
0.0, gsk_path_measure_get_length (measure));
|
||||
#else
|
||||
progress > 1 ? (progress - 1) * gsk_path_measure_get_length (measure) : 0.0,
|
||||
(progress < 1 ? progress : 1.0) * gsk_path_measure_get_length (measure));
|
||||
#endif
|
||||
|
||||
path = gsk_path_builder_free_to_path (builder);
|
||||
|
||||
stroke = gsk_stroke_new (1);
|
||||
gsk_stroke_set_dash (stroke, (float[2]) { 10, 5 }, 2);
|
||||
gsk_stroke_set_dash_offset (stroke, - (gdk_frame_clock_get_frame_time (frame_clock) % G_USEC_PER_SEC) * 15. / G_USEC_PER_SEC);
|
||||
builder = gsk_path_builder_new ();
|
||||
gsk_path_dash (path, stroke, 0.2, build_path, builder);
|
||||
gsk_path_unref (path);
|
||||
|
||||
gsk_path_measure_get_point (measure,
|
||||
(progress > 1 ? (progress - 1) : progress) * gsk_path_measure_get_length (measure),
|
||||
&pos,
|
||||
&tangent);
|
||||
gsk_path_builder_move_to (builder, pos.x + 5 * graphene_vec2_get_x (&tangent), pos.y + 5 * graphene_vec2_get_y (&tangent));
|
||||
gsk_path_builder_line_to (builder, pos.x + 3 * graphene_vec2_get_y (&tangent), pos.y + 3 * graphene_vec2_get_x (&tangent));
|
||||
gsk_path_builder_line_to (builder, pos.x - 3 * graphene_vec2_get_y (&tangent), pos.y - 3 * graphene_vec2_get_x (&tangent));
|
||||
gsk_path_builder_close (builder);
|
||||
|
||||
path = gsk_path_builder_free_to_path (builder);
|
||||
|
||||
gtk_path_paintable_set_path (GTK_PATH_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget))),
|
||||
path);
|
||||
gsk_path_unref (path);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_path_fill (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GdkPaintable *paintable;
|
||||
GtkMediaStream *stream;
|
||||
GskPath *path;
|
||||
graphene_rect_t bounds;
|
||||
GskPathMeasure *measure;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Path Fill");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
#if 0
|
||||
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
#else
|
||||
stream = gtk_nuclear_media_stream_new ();
|
||||
#endif
|
||||
gtk_media_stream_play (stream);
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
|
||||
path = create_hexagon (window);
|
||||
path = create_path_from_text (window);
|
||||
gsk_path_get_bounds (path, &bounds);
|
||||
|
||||
paintable = gtk_path_paintable_new (path,
|
||||
GDK_PAINTABLE (stream),
|
||||
bounds.origin.x + bounds.size.width,
|
||||
bounds.origin.y + bounds.size.height);
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
measure = gsk_path_measure_new (path);
|
||||
gtk_widget_add_tick_callback (picture, update_path, measure, (GDestroyNotify) gsk_path_measure_unref);
|
||||
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (picture), FALSE);
|
||||
g_object_unref (paintable);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), picture);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/* Path/Maze
|
||||
*
|
||||
* This demo shows how to use a GskPath to create a maze and use
|
||||
* gsk_path_measure_get_closest_point() to check the mouse stays
|
||||
* on the path.
|
||||
*
|
||||
* It also shows off the performance of GskPath (or not) as this
|
||||
* is a rather complex path.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "paintable.h"
|
||||
|
||||
#define MAZE_GRID_SIZE 20
|
||||
#define MAZE_STROKE_SIZE_ACTIVE (MAZE_GRID_SIZE - 4)
|
||||
#define MAZE_STROKE_SIZE_INACTIVE (MAZE_GRID_SIZE - 12)
|
||||
#define MAZE_WIDTH 31
|
||||
#define MAZE_HEIGHT 21
|
||||
|
||||
#define GTK_TYPE_MAZE (gtk_maze_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkMaze, gtk_maze, GTK, MAZE, GtkWidget)
|
||||
|
||||
struct _GtkMaze
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
GskPath *path;
|
||||
GskPathMeasure *measure;
|
||||
GdkPaintable *background;
|
||||
|
||||
gboolean active;
|
||||
};
|
||||
|
||||
struct _GtkMazeClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkMaze, gtk_maze, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
gtk_maze_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
GtkMaze *self = GTK_MAZE (widget);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
*minimum = *natural = self->width;
|
||||
else
|
||||
*minimum = *natural = self->height;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_maze_snapshot (GtkWidget *widget,
|
||||
GdkSnapshot *snapshot)
|
||||
{
|
||||
GtkMaze *self = GTK_MAZE (widget);
|
||||
double width = gtk_widget_get_width (widget);
|
||||
double height = gtk_widget_get_height (widget);
|
||||
GskStroke *stroke;
|
||||
|
||||
stroke = gsk_stroke_new (MAZE_STROKE_SIZE_INACTIVE);
|
||||
if (self->active)
|
||||
gsk_stroke_set_line_width (stroke, MAZE_STROKE_SIZE_ACTIVE);
|
||||
gsk_stroke_set_line_join (stroke, GSK_LINE_JOIN_ROUND);
|
||||
gsk_stroke_set_line_cap (stroke, GSK_LINE_CAP_ROUND);
|
||||
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
|
||||
gsk_stroke_free (stroke);
|
||||
|
||||
if (self->background)
|
||||
{
|
||||
gdk_paintable_snapshot (self->background, snapshot, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_snapshot_append_linear_gradient (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (0, 0),
|
||||
&GRAPHENE_POINT_INIT (width, height),
|
||||
(GskColorStop[8]) {
|
||||
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
|
||||
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
|
||||
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
|
||||
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
|
||||
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
|
||||
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
|
||||
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
|
||||
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
|
||||
},
|
||||
8);
|
||||
}
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_maze_dispose (GObject *object)
|
||||
{
|
||||
GtkMaze *self = GTK_MAZE (object);
|
||||
|
||||
g_clear_pointer (&self->path, gsk_path_unref);
|
||||
g_clear_pointer (&self->measure, gsk_path_measure_unref);
|
||||
if (self->background)
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (self->background, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
|
||||
g_clear_object (&self->background);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_maze_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_maze_class_init (GtkMazeClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_maze_dispose;
|
||||
|
||||
widget_class->measure = gtk_maze_measure;
|
||||
widget_class->snapshot = gtk_maze_snapshot;
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_motion (GtkEventControllerMotion *controller,
|
||||
double x,
|
||||
double y,
|
||||
GtkMaze *self)
|
||||
{
|
||||
if (!self->active)
|
||||
return;
|
||||
|
||||
if (gsk_path_measure_get_closest_point (self->measure, &GRAPHENE_POINT_INIT (x, y), NULL) <= MAZE_STROKE_SIZE_ACTIVE / 2.0f)
|
||||
return;
|
||||
|
||||
self->active = FALSE;
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_leave (GtkEventControllerMotion *controller,
|
||||
GtkMaze *self)
|
||||
{
|
||||
if (!self->active)
|
||||
{
|
||||
self->active = TRUE;
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_maze_init (GtkMaze *self)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
self->active = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_maze_set_path (GtkMaze *self,
|
||||
GskPath *path)
|
||||
{
|
||||
g_clear_pointer (&self->path, gsk_path_unref);
|
||||
g_clear_pointer (&self->measure, gsk_path_measure_unref);
|
||||
self->path = gsk_path_ref (path);
|
||||
self->measure = gsk_path_measure_new (path);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_maze_new (GskPath *path,
|
||||
GdkPaintable *background,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GtkMaze *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_MAZE, NULL);
|
||||
|
||||
gtk_maze_set_path (self, path);
|
||||
gsk_path_unref (path);
|
||||
self->background = background;
|
||||
if (self->background)
|
||||
{
|
||||
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), self);
|
||||
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), self);
|
||||
}
|
||||
self->width = width;
|
||||
self->height = height;
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
||||
|
||||
static void
|
||||
add_point_to_maze (GtkBitset *maze,
|
||||
GskPathBuilder *builder,
|
||||
guint x,
|
||||
guint y)
|
||||
{
|
||||
gboolean set[4] = { };
|
||||
guint dir;
|
||||
|
||||
gtk_bitset_add (maze, y * MAZE_WIDTH + x);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
set[0] = set[0] || x == 0 || gtk_bitset_contains (maze, y * MAZE_WIDTH + x - 1);
|
||||
set[1] = set[1] || y == 0 || gtk_bitset_contains (maze, (y - 1) * MAZE_WIDTH + x);
|
||||
set[2] = set[2] || x + 1 == MAZE_WIDTH || gtk_bitset_contains (maze, y * MAZE_WIDTH + x + 1);
|
||||
set[3] = set[3] || y + 1 == MAZE_HEIGHT || gtk_bitset_contains (maze, (y + 1) * MAZE_WIDTH + x);
|
||||
|
||||
if (set[0] && set[1] && set[2] && set[3])
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
dir = g_random_int_range (0, 4);
|
||||
}
|
||||
while (set[dir]);
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case 0:
|
||||
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, (x - 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
add_point_to_maze (maze, builder, x - 1, y);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y - 0.5) * MAZE_GRID_SIZE);
|
||||
add_point_to_maze (maze, builder, x, y - 1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, (x + 1.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
add_point_to_maze (maze, builder, x + 1, y);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 1.5) * MAZE_GRID_SIZE);
|
||||
add_point_to_maze (maze, builder, x, y + 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static GskPath *
|
||||
create_path_for_maze (GtkWidget *widget)
|
||||
{
|
||||
GskPathBuilder *builder;
|
||||
GtkBitset *maze;
|
||||
|
||||
builder = gsk_path_builder_new ();
|
||||
maze = gtk_bitset_new_empty ();
|
||||
/* make sure the outer lines are unreachable:
|
||||
* Set the full range, then remove the center again. */
|
||||
gtk_bitset_add_range (maze, 0, MAZE_WIDTH * MAZE_HEIGHT);
|
||||
gtk_bitset_remove_rectangle (maze, MAZE_WIDTH + 1, MAZE_WIDTH - 2, MAZE_HEIGHT - 2, MAZE_WIDTH);
|
||||
|
||||
/* Fill the maze */
|
||||
add_point_to_maze (maze, builder, MAZE_WIDTH / 2, MAZE_HEIGHT / 2);
|
||||
|
||||
/* Add start and stop lines */
|
||||
gsk_path_builder_move_to (builder, 1.5 * MAZE_GRID_SIZE, -0.5 * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, 1.5 * MAZE_GRID_SIZE, 1.5 * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_move_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT - 1.5) * MAZE_GRID_SIZE);
|
||||
gsk_path_builder_line_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT + 0.5) * MAZE_GRID_SIZE);
|
||||
|
||||
|
||||
gtk_bitset_unref (maze);
|
||||
|
||||
return gsk_path_builder_free_to_path (builder);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_path_maze (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *maze;
|
||||
GtkMediaStream *stream;
|
||||
GskPath *path;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
#if 0
|
||||
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
#else
|
||||
stream = gtk_nuclear_media_stream_new ();
|
||||
#endif
|
||||
gtk_media_stream_play (stream);
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
|
||||
path = create_path_for_maze (window);
|
||||
|
||||
maze = gtk_maze_new (path,
|
||||
GDK_PAINTABLE (stream),
|
||||
MAZE_WIDTH * MAZE_GRID_SIZE,
|
||||
MAZE_HEIGHT * MAZE_GRID_SIZE);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), maze);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -0,0 +1,590 @@
|
||||
/* Path/Text
|
||||
*
|
||||
* This demo shows how to use GskPath to animate a path along another path.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define GTK_TYPE_PATH_WIDGET (gtk_path_widget_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkPathWidget, gtk_path_widget, GTK, PATH_WIDGET, GtkWidget)
|
||||
|
||||
#define POINT_SIZE 8
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_TEXT,
|
||||
PROP_EDITABLE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
struct _GtkPathWidget
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
char *text;
|
||||
gboolean editable;
|
||||
|
||||
graphene_point_t points[4];
|
||||
|
||||
guint active_point;
|
||||
float line_closest;
|
||||
|
||||
GskPath *line_path;
|
||||
GskPathMeasure *line_measure;
|
||||
GskPath *text_path;
|
||||
|
||||
GdkPaintable *background;
|
||||
};
|
||||
|
||||
struct _GtkPathWidgetClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE (GtkPathWidget, gtk_path_widget, GTK_TYPE_WIDGET)
|
||||
|
||||
static GskPath *
|
||||
create_path_from_text (GtkWidget *widget,
|
||||
const char *text)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
cairo_path_t *path;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *desc;
|
||||
GskPath *result;
|
||||
|
||||
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
desc = pango_font_description_from_string ("sans bold 36");
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
cairo_move_to (cr, 0, - pango_layout_get_baseline (layout) / (double) PANGO_SCALE);
|
||||
pango_cairo_layout_path (cr, layout);
|
||||
path = cairo_copy_path_flat (cr);
|
||||
result = gsk_path_new_from_cairo (path);
|
||||
|
||||
cairo_path_destroy (path);
|
||||
g_object_unref (layout);
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskPathMeasure *measure;
|
||||
GskPathBuilder *builder;
|
||||
double scale;
|
||||
} GtkPathTransform;
|
||||
|
||||
static void
|
||||
gtk_path_transform_point (GskPathMeasure *measure,
|
||||
const graphene_point_t *pt,
|
||||
float scale,
|
||||
graphene_point_t *res)
|
||||
{
|
||||
graphene_vec2_t tangent;
|
||||
|
||||
gsk_path_measure_get_point (measure, pt->x * scale, res, &tangent);
|
||||
|
||||
res->x -= pt->y * scale * graphene_vec2_get_y (&tangent);
|
||||
res->y += pt->y * scale * graphene_vec2_get_x (&tangent);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_path_transform_op (GskPathOperation op,
|
||||
const graphene_point_t *pts,
|
||||
gsize n_pts,
|
||||
float weight,
|
||||
gpointer data)
|
||||
{
|
||||
GtkPathTransform *transform = data;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case GSK_PATH_MOVE:
|
||||
{
|
||||
graphene_point_t res;
|
||||
gtk_path_transform_point (transform->measure, &pts[0], transform->scale, &res);
|
||||
gsk_path_builder_move_to (transform->builder, res.x, res.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_PATH_LINE:
|
||||
{
|
||||
graphene_point_t res;
|
||||
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res);
|
||||
gsk_path_builder_line_to (transform->builder, res.x, res.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_PATH_CURVE:
|
||||
{
|
||||
graphene_point_t res[3];
|
||||
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
|
||||
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
|
||||
gtk_path_transform_point (transform->measure, &pts[3], transform->scale, &res[2]);
|
||||
gsk_path_builder_curve_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, res[2].x, res[2].y);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_PATH_CONIC:
|
||||
{
|
||||
graphene_point_t res[2];
|
||||
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
|
||||
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
|
||||
gsk_path_builder_conic_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, weight);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_PATH_CLOSE:
|
||||
gsk_path_builder_close (transform->builder);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GskPath *
|
||||
gtk_path_transform (GskPathMeasure *measure,
|
||||
GskPath *path)
|
||||
{
|
||||
GtkPathTransform transform = { measure, gsk_path_builder_new () };
|
||||
graphene_rect_t bounds;
|
||||
|
||||
gsk_path_get_bounds (path, &bounds);
|
||||
if (bounds.origin.x + bounds.size.width > 0)
|
||||
transform.scale = gsk_path_measure_get_length (measure) / (bounds.origin.x + bounds.size.width);
|
||||
else
|
||||
transform.scale = 1.0f;
|
||||
|
||||
gsk_path_foreach (path, GSK_PATH_FOREACH_ALLOW_CURVE, gtk_path_transform_op, &transform);
|
||||
|
||||
return gsk_path_builder_free_to_path (transform.builder);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_clear_text_path (GtkPathWidget *self)
|
||||
{
|
||||
g_clear_pointer (&self->text_path, gsk_path_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_clear_paths (GtkPathWidget *self)
|
||||
{
|
||||
gtk_path_widget_clear_text_path (self);
|
||||
|
||||
g_clear_pointer (&self->line_path, gsk_path_unref);
|
||||
g_clear_pointer (&self->line_measure, gsk_path_measure_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_create_text_path (GtkPathWidget *self)
|
||||
{
|
||||
GskPath *path;
|
||||
|
||||
gtk_path_widget_clear_text_path (self);
|
||||
|
||||
if (self->line_measure == NULL)
|
||||
return;
|
||||
|
||||
path = create_path_from_text (GTK_WIDGET (self), self->text);
|
||||
self->text_path = gtk_path_transform (self->line_measure, path);
|
||||
|
||||
gsk_path_unref (path);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_create_paths (GtkPathWidget *self)
|
||||
{
|
||||
double width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
double height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||
GskPathBuilder *builder;
|
||||
|
||||
gtk_path_widget_clear_paths (self);
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
return;
|
||||
|
||||
builder = gsk_path_builder_new ();
|
||||
gsk_path_builder_move_to (builder,
|
||||
self->points[0].x * width, self->points[0].y * height);
|
||||
gsk_path_builder_curve_to (builder,
|
||||
self->points[1].x * width, self->points[1].y * height,
|
||||
self->points[2].x * width, self->points[2].y * height,
|
||||
self->points[3].x * width, self->points[3].y * height);
|
||||
self->line_path = gsk_path_builder_free_to_path (builder);
|
||||
|
||||
self->line_measure = gsk_path_measure_new (self->line_path);
|
||||
|
||||
gtk_path_widget_create_text_path (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_path_widget_parent_class)->size_allocate (widget, width, height, baseline);
|
||||
|
||||
gtk_path_widget_create_paths (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
|
||||
double width = gtk_widget_get_width (widget);
|
||||
double height = gtk_widget_get_height (widget);
|
||||
GskPath *path;
|
||||
GskStroke *stroke;
|
||||
gsize i;
|
||||
|
||||
/* frosted glass the background */
|
||||
gtk_snapshot_push_blur (snapshot, 100);
|
||||
gdk_paintable_snapshot (self->background, snapshot, width, height);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 0.6 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
/* draw the text */
|
||||
if (self->text_path)
|
||||
{
|
||||
gtk_snapshot_push_fill (snapshot, self->text_path, GSK_FILL_RULE_WINDING);
|
||||
gdk_paintable_snapshot (self->background, snapshot, width, height);
|
||||
|
||||
/* ... with an emboss effect */
|
||||
stroke = gsk_stroke_new (2.0);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT(1, 1));
|
||||
gtk_snapshot_push_stroke (snapshot, self->text_path, stroke);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.2 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gsk_stroke_free (stroke);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
if (self->editable && self->line_path)
|
||||
{
|
||||
GskPathBuilder *builder;
|
||||
|
||||
/* draw the control line */
|
||||
stroke = gsk_stroke_new (1.0);
|
||||
gtk_snapshot_push_stroke (snapshot, self->line_path, stroke);
|
||||
gsk_stroke_free (stroke);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
/* draw the points */
|
||||
builder = gsk_path_builder_new ();
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), POINT_SIZE);
|
||||
}
|
||||
path = gsk_path_builder_free_to_path (builder);
|
||||
|
||||
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
stroke = gsk_stroke_new (1.0);
|
||||
gtk_snapshot_push_stroke (snapshot, path, stroke);
|
||||
gsk_stroke_free (stroke);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gsk_path_unref (path);
|
||||
}
|
||||
|
||||
if (self->line_closest >= 0)
|
||||
{
|
||||
GskPathBuilder *builder;
|
||||
graphene_point_t closest;
|
||||
|
||||
builder = gsk_path_builder_new ();
|
||||
gsk_path_measure_get_point (self->line_measure, self->line_closest, &closest, NULL);
|
||||
gsk_path_builder_add_circle (builder, &closest, POINT_SIZE);
|
||||
path = gsk_path_builder_free_to_path (builder);
|
||||
|
||||
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
|
||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gsk_path_unref (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_set_text (GtkPathWidget *self,
|
||||
const char *text)
|
||||
{
|
||||
if (g_strcmp0 (self->text, text) == 0)
|
||||
return;
|
||||
|
||||
g_free (self->text);
|
||||
self->text = g_strdup (text);
|
||||
|
||||
gtk_path_widget_create_paths (self);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_set_editable (GtkPathWidget *self,
|
||||
gboolean editable)
|
||||
{
|
||||
if (self->editable == editable)
|
||||
return;
|
||||
|
||||
self->editable = editable;
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EDITABLE]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
|
||||
{
|
||||
GtkPathWidget *self = GTK_PATH_WIDGET (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TEXT:
|
||||
gtk_path_widget_set_text (self, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE:
|
||||
gtk_path_widget_set_editable (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkPathWidget *self = GTK_PATH_WIDGET (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TEXT:
|
||||
g_value_set_string (value, self->text);
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE:
|
||||
g_value_set_boolean (value, self->editable);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_dispose (GObject *object)
|
||||
{
|
||||
GtkPathWidget *self = GTK_PATH_WIDGET (object);
|
||||
|
||||
gtk_path_widget_clear_paths (self);
|
||||
|
||||
G_OBJECT_CLASS (gtk_path_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_class_init (GtkPathWidgetClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_path_widget_dispose;
|
||||
object_class->set_property = gtk_path_widget_set_property;
|
||||
object_class->get_property = gtk_path_widget_get_property;
|
||||
|
||||
widget_class->size_allocate = gtk_path_widget_allocate;
|
||||
widget_class->snapshot = gtk_path_widget_snapshot;
|
||||
|
||||
properties[PROP_TEXT] =
|
||||
g_param_spec_string ("text",
|
||||
"text",
|
||||
"Text transformed along a path",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_EDITABLE] =
|
||||
g_param_spec_boolean ("editable",
|
||||
"editable",
|
||||
"If the path can be edited by the user",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_begin (GtkGestureDrag *gesture,
|
||||
double x,
|
||||
double y,
|
||||
GtkPathWidget *self)
|
||||
{
|
||||
graphene_point_t mouse = GRAPHENE_POINT_INIT (x, y);
|
||||
double width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
double height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||
gsize i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (graphene_point_distance (&GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), &mouse, NULL, NULL) <= POINT_SIZE)
|
||||
{
|
||||
self->active_point = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 4)
|
||||
{
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
drag_update (GtkGestureDrag *drag,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkPathWidget *self)
|
||||
{
|
||||
double width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
double height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||
double start_x, start_y;
|
||||
|
||||
gtk_gesture_drag_get_start_point (drag, &start_x, &start_y);
|
||||
|
||||
self->points[self->active_point] = GRAPHENE_POINT_INIT ((start_x + offset_x) / width,
|
||||
(start_y + offset_y) / height);
|
||||
self->points[self->active_point].x = CLAMP (self->points[self->active_point].x, 0, 1);
|
||||
self->points[self->active_point].y = CLAMP (self->points[self->active_point].y, 0, 1);
|
||||
|
||||
gtk_path_widget_create_paths (self);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_motion (GtkEventControllerMotion *controller,
|
||||
double x,
|
||||
double y,
|
||||
GtkPathWidget *self)
|
||||
{
|
||||
gsk_path_measure_get_closest_point_full (self->line_measure,
|
||||
&GRAPHENE_POINT_INIT (x, y),
|
||||
INFINITY,
|
||||
&self->line_closest,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_leave (GtkEventControllerMotion *controller,
|
||||
GtkPathWidget *self)
|
||||
{
|
||||
self->line_closest = -1;
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_widget_init (GtkPathWidget *self)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
|
||||
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
|
||||
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
|
||||
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_update), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (pointer_motion), self);
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
self->line_closest = -1;
|
||||
|
||||
self->points[0] = GRAPHENE_POINT_INIT (0.1, 0.9);
|
||||
self->points[1] = GRAPHENE_POINT_INIT (0.3, 0.1);
|
||||
self->points[2] = GRAPHENE_POINT_INIT (0.7, 0.1);
|
||||
self->points[3] = GRAPHENE_POINT_INIT (0.9, 0.9);
|
||||
|
||||
self->background = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
|
||||
|
||||
gtk_path_widget_set_text (self, "It's almost working");
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_path_widget_new (void)
|
||||
{
|
||||
GtkPathWidget *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_PATH_WIDGET, NULL);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_path_text (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
g_type_ensure (GTK_TYPE_PATH_WIDGET);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/path_text/path_text.ui");
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="title" translatable="yes">Text along a Path</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="edit-toggle">
|
||||
<property name="icon-name">document-edit-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkRevealer">
|
||||
<property name="reveal-child" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="text">
|
||||
<property name="text">Through the looking glass</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPathWidget" id="view">
|
||||
<property name="editable" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
|
||||
<property name="text" bind-source="text" bind-property="text" bind-flags="sync-create"></property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="vexpand">true</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -63,9 +63,6 @@ do_pickers (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
char *dir;
|
||||
GFile *file;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
@@ -129,41 +126,6 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
|
||||
|
||||
picker = gtk_file_chooser_button_new ("Pick a File",
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
|
||||
|
||||
picker = gtk_file_chooser_button_new ("Pick a File",
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
|
||||
dir = g_get_current_dir ();
|
||||
file = g_file_new_for_path (dir);
|
||||
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (picker), file, NULL);
|
||||
g_object_unref (file);
|
||||
g_free (dir);
|
||||
|
||||
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
|
||||
"choice",
|
||||
"Encoding",
|
||||
(const char *[]) { "option1", "option2", NULL },
|
||||
(const char *[]) { "UTF-8", "Other Encoding", NULL });
|
||||
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "choice", "option1");
|
||||
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
|
||||
"check",
|
||||
"Read backwards",
|
||||
NULL, NULL);
|
||||
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "check", "false");
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 2, 2, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Folder:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
picker = gtk_file_chooser_button_new ("Pick a Folder",
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Mail:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
|
||||
@@ -57,6 +57,8 @@ do_shortcut_triggers (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shortcuts");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, -1);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
list = gtk_list_box_new ();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Sliding Puzzle
|
||||
* #Keywords: GdkPaintable, GdkGesture, game
|
||||
* #Keywords: GdkPaintable, GdkGesture, GtkShortcutController, game
|
||||
*
|
||||
* This demo demonstrates how to use gestures and paintables to create a
|
||||
* small sliding puzzle game.
|
||||
@@ -281,7 +281,8 @@ start_puzzle (GdkPaintable *paintable)
|
||||
gtk_aspect_frame_set_obey_child (GTK_ASPECT_FRAME (frame), FALSE);
|
||||
|
||||
/* Add shortcuts so people can use the arrow
|
||||
* keys to move the puzzle */
|
||||
* keys to move the puzzle
|
||||
*/
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GTK_SHORTCUT_SCOPE_LOCAL);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
entry.suggestion > popover.menu.background > contents {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
entry.suggestion arrow {
|
||||
-gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
|
||||
min-height: 16px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
entry.suggestion > popover {
|
||||
margin-top: 6px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview > row {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview > row:selected {
|
||||
outline-color: rgba(1,1,1,0.2);
|
||||
color: @theme_text_color;
|
||||
background-color: shade(#f6f5f4, 0.97);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MATCH_TYPE_OBJECT (match_object_get_type ())
|
||||
#define MATCH_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATCH_TYPE_OBJECT, MatchObject))
|
||||
#define MATCH_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATCH_TYPE_OBJECT))
|
||||
|
||||
typedef struct _MatchObject MatchObject;
|
||||
|
||||
GType match_object_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gpointer match_object_get_item (MatchObject *object);
|
||||
const char * match_object_get_string (MatchObject *object);
|
||||
guint match_object_get_match_start (MatchObject *object);
|
||||
guint match_object_get_match_end (MatchObject *object);
|
||||
guint match_object_get_score (MatchObject *object);
|
||||
void match_object_set_match (MatchObject *object,
|
||||
guint start,
|
||||
guint end,
|
||||
guint score);
|
||||
|
||||
#define SUGGESTION_TYPE_ENTRY (suggestion_entry_get_type ())
|
||||
#define SUGGESTION_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUGGESTION_TYPE_ENTRY, SuggestionEntry))
|
||||
#define SUGGESTION_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUGGESTION_TYPE_ENTRY))
|
||||
|
||||
typedef struct _SuggestionEntry SuggestionEntry;
|
||||
|
||||
GType suggestion_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* suggestion_entry_new (void);
|
||||
|
||||
void suggestion_entry_set_model (SuggestionEntry *self,
|
||||
GListModel *model);
|
||||
GListModel * suggestion_entry_get_model (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_factory (SuggestionEntry *self,
|
||||
GtkListItemFactory *factory);
|
||||
GtkListItemFactory *
|
||||
suggestion_entry_get_factory (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_use_filter (SuggestionEntry *self,
|
||||
gboolean use_ilter);
|
||||
gboolean suggestion_entry_get_use_filter (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_expression (SuggestionEntry *self,
|
||||
GtkExpression *expression);
|
||||
GtkExpression * suggestion_entry_get_expression (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_show_arrow (SuggestionEntry *self,
|
||||
gboolean show_arrow);
|
||||
gboolean suggestion_entry_get_show_arrow (SuggestionEntry *self);
|
||||
|
||||
typedef void (* SuggestionEntryMatchFunc) (MatchObject *object,
|
||||
const char *search,
|
||||
gpointer user_data);
|
||||
|
||||
void suggestion_entry_set_match_func (SuggestionEntry *self,
|
||||
SuggestionEntryMatchFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,26 +1,8 @@
|
||||
/* testsvg.c
|
||||
* Copyright (C) 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "svgpaintable.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <librsvg/rsvg.h>
|
||||
|
||||
#define SVG_TYPE_PAINTABLE (svg_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SvgPaintable, svg_paintable, SVG, PAINTABLE, GObject)
|
||||
|
||||
struct _SvgPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
@@ -175,69 +157,10 @@ svg_paintable_class_init (SvgPaintableClass *class)
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static SvgPaintable *
|
||||
GdkPaintable *
|
||||
svg_paintable_new (GFile *file)
|
||||
{
|
||||
return g_object_new (SVG_TYPE_PAINTABLE,
|
||||
"file", file,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
file_set (GtkFileChooserButton *button,
|
||||
GtkWidget *picture)
|
||||
{
|
||||
GFile *file;
|
||||
SvgPaintable *paintable;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
|
||||
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (paintable));
|
||||
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *header;
|
||||
GtkWidget *picture;
|
||||
GtkFileFilter *filter;
|
||||
GtkWidget *button;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_window_new ();
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (button), filter);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
|
||||
|
||||
picture = gtk_picture_new ();
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (picture), TRUE);
|
||||
|
||||
g_signal_connect (button, "file-set", G_CALLBACK (file_set), picture);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), picture);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
GFile *file = g_file_new_for_commandline_arg (argv[1]);
|
||||
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (button), file, NULL);
|
||||
file_set (GTK_FILE_CHOOSER_BUTTON (button), picture);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SVG_TYPE_PAINTABLE (svg_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SvgPaintable, svg_paintable, SVG, PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * svg_paintable_new (GFile *file);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -13,9 +13,6 @@
|
||||
</section>
|
||||
</menu>
|
||||
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
@@ -66,11 +63,14 @@
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListView">
|
||||
<style>
|
||||
<class name="navigation-sidebar" />
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
<property name="model">
|
||||
<object class="GtkSingleSelection" id="context_model">
|
||||
@@ -108,11 +108,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">Help</property>
|
||||
<property name="default-width">720</property>
|
||||
<property name="default-height">520</property>
|
||||
|
||||
@@ -102,12 +102,11 @@ text_buffer_remove_all_tags (GtkTextBuffer *buffer)
|
||||
}
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
deserialize_error_func (const GskParseLocation *start_location,
|
||||
const GskParseLocation *end_location,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
const GtkCssLocation *start_location = gtk_css_section_get_start_location (section);
|
||||
const GtkCssLocation *end_location = gtk_css_section_get_end_location (section);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
TextViewError text_view_error;
|
||||
@@ -466,7 +465,7 @@ save_response_cb (GtkWidget *dialog,
|
||||
text = get_current_text (self->text_buffer);
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, -1,
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
NULL,
|
||||
|
||||
@@ -94,9 +94,6 @@
|
||||
</object>
|
||||
|
||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
|
||||
@@ -812,8 +812,6 @@ activate (GApplication *app)
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
|
||||
update_title (GTK_WINDOW (main_window));
|
||||
|
||||
gtk_widget_add_css_class (main_window, "devel");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (main_window), box);
|
||||
|
||||
|
||||
@@ -433,9 +433,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkApplicationWindow" id="window">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title">GTK Widget Factory</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="headerbar1">
|
||||
@@ -881,9 +878,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="use-alpha">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFileChooserButton" id="filechooserbutton1"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="linkbutton1">
|
||||
<property name="label" translatable="yes">link button</property>
|
||||
@@ -1145,7 +1139,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption</property>
|
||||
<style><class name="Caption"/></style>
|
||||
<style><class name="caption"/></style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3304,246 +3298,6 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="new_style_menu">
|
||||
<style><class name="menu"/></style>
|
||||
<child>
|
||||
<object class="GtkStack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">main</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="circular-buttons"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">printer-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="action-name">win.print</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">emblem-shared-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="action-name">app.share</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Open in New Window</property>
|
||||
<property name="action-name">app.open-in</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="inline-buttons"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkLabel" id="cut_copy_paste_filler"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Edit</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-cut-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-copy-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-paste-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Pin</property>
|
||||
<property name="action-name">app.pin</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Select Labels…</property>
|
||||
<property name="action-name">app.labels</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Share…</property>
|
||||
<property name="action-name">app.share</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Basement</property>
|
||||
<property name="menu-name">basement</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Large</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'large'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Medium</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'medium'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Small</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'small'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Move to Trash</property>
|
||||
<property name="action-name">win.delete</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</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>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="main-indicators">
|
||||
<widgets>
|
||||
<widget name="cut_copy_paste_filler"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="basement-indicators"/>
|
||||
<menu id="new_style_menu_model">
|
||||
<section>
|
||||
|
||||
@@ -11,6 +11,11 @@ GDK_WINDOWING_WIN32
|
||||
GDK_WINDOWING_MACOS
|
||||
GDK_WINDOWING_WAYLAND
|
||||
|
||||
<SUBSECTION>
|
||||
GDK_MAJOR_VERSION
|
||||
GDK_MICRO_VERSION
|
||||
GDK_MINOR_VERSION
|
||||
|
||||
<SUBSECTION>
|
||||
GDK_VERSION_4_0
|
||||
GDK_VERSION_MIN_REQUIRED
|
||||
@@ -24,6 +29,8 @@ GDK_TYPE_GRAB_STATUS
|
||||
GDK_TYPE_STATUS
|
||||
GdkStatus
|
||||
GDKVAR
|
||||
GDK_VERSION_3_92
|
||||
GDK_VERSION_3_94
|
||||
gdk_axis_use_get_type
|
||||
gdk_byte_order_get_type
|
||||
gdk_crossing_mode_get_type
|
||||
@@ -827,11 +834,14 @@ gdk_x11_display_error_trap_pop_ignored
|
||||
gdk_x11_display_set_cursor_theme
|
||||
gdk_x11_display_set_surface_scale
|
||||
gdk_x11_display_get_glx_version
|
||||
gdk_x11_display_get_primary_monitor
|
||||
gdk_x11_display_get_screen
|
||||
gdk_x11_monitor_get_output
|
||||
gdk_x11_monitor_get_workarea
|
||||
gdk_x11_screen_get_screen_number
|
||||
gdk_x11_screen_get_xscreen
|
||||
gdk_x11_screen_get_window_manager_name
|
||||
gdk_x11_screen_get_monitor_output
|
||||
gdk_x11_screen_lookup_visual
|
||||
gdk_x11_screen_supports_net_wm_hint
|
||||
gdk_x11_screen_get_number_of_desktops
|
||||
gdk_x11_screen_get_current_desktop
|
||||
@@ -846,9 +856,9 @@ gdk_x11_surface_set_utf8_property
|
||||
gdk_x11_surface_set_frame_sync_enabled
|
||||
gdk_x11_surface_set_group
|
||||
gdk_x11_surface_get_group
|
||||
gdk_x11_keymap_get_group_for_state
|
||||
gdk_x11_keymap_key_is_modifier
|
||||
gdk_x11_visual_get_xvisual
|
||||
gdk_x11_surface_set_skip_pager_hint
|
||||
gdk_x11_surface_set_skip_taskbar_hint
|
||||
gdk_x11_surface_set_urgency_hint
|
||||
gdk_x11_get_xatom_by_name_for_display
|
||||
gdk_x11_get_xatom_name_for_display
|
||||
gdk_x11_set_sm_client_id
|
||||
@@ -901,29 +911,18 @@ GDK_X11_DRAG_CONTEXT_CLASS
|
||||
GDK_IS_X11_DRAG_CONTEXT
|
||||
GDK_IS_X11_DRAG_CONTEXT_CLASS
|
||||
GDK_X11_DRAG_CONTEXT_GET_CLASS
|
||||
GDK_TYPE_X11_KEYMAP
|
||||
GDK_X11_KEYMAP
|
||||
GDK_X11_KEYMAP_CLASS
|
||||
GDK_IS_X11_KEYMAP
|
||||
GDK_IS_X11_KEYMAP_CLASS
|
||||
GDK_X11_KEYMAP_GET_CLASS
|
||||
GDK_TYPE_X11_GL_CONTEXT
|
||||
GDK_X11_GL_CONTEXT
|
||||
GDK_X11_GL_CONTEXT_CLASS
|
||||
GDK_IS_X11_GL_CONTEXT
|
||||
GDK_IS_X11_GL_CONTEXT_CLASS
|
||||
GDK_TYPE_X11_SCREEN
|
||||
GDK_X11_SCREEN
|
||||
GDK_X11_SCREEN_CLASS
|
||||
GDK_IS_X11_SCREEN
|
||||
GDK_IS_X11_SCREEN_CLASS
|
||||
GDK_X11_SCREEN_GET_CLASS
|
||||
GDK_TYPE_X11_VISUAL
|
||||
GDK_X11_VISUAL
|
||||
GDK_X11_VISUAL_CLASS
|
||||
GDK_IS_X11_VISUAL
|
||||
GDK_IS_X11_VISUAL_CLASS
|
||||
GDK_X11_VISUAL_GET_CLASS
|
||||
GDK_TYPE_X11_DRAG
|
||||
GDK_X11_DRAG
|
||||
GDK_IS_X11_DRAG
|
||||
GDK_IS_X11_DRAG_CLASS
|
||||
GDK_TYPE_X11_MONITOR
|
||||
GDK_X11_MONITOR
|
||||
GDK_IS_X11_MONITOR
|
||||
GDK_TYPE_X11_SURFACE
|
||||
GDK_X11_SURFACE
|
||||
GDK_X11_SURFACE_CLASS
|
||||
@@ -941,9 +940,10 @@ gdk_x11_device_xi_get_type
|
||||
gdk_x11_display_get_type
|
||||
gdk_x11_display_manager_get_type
|
||||
gdk_x11_drag_context_get_type
|
||||
gdk_x11_keymap_get_type
|
||||
gdk_x11_drag_get_type
|
||||
gdk_x11_gl_context_get_type
|
||||
gdk_x11_monitor_get_type
|
||||
gdk_x11_screen_get_type
|
||||
gdk_x11_visual_get_type
|
||||
gdk_x11_surface_get_type
|
||||
gdk_surface_impl_x11_get_type
|
||||
</SECTION>
|
||||
@@ -958,14 +958,13 @@ gdk_wayland_display_query_registry
|
||||
gdk_wayland_display_set_cursor_theme
|
||||
gdk_wayland_display_get_startup_notification_id
|
||||
gdk_wayland_display_set_startup_notification_id
|
||||
gdk_wayland_display_query_registry
|
||||
|
||||
<SUBSECTION Device>
|
||||
gdk_wayland_seat_get_wl_seat
|
||||
gdk_wayland_device_get_wl_seat
|
||||
gdk_wayland_device_get_wl_pointer
|
||||
gdk_wayland_device_get_wl_keyboard
|
||||
gdk_wayland_device_get_node_ath
|
||||
gdk_wayland_device_get_node_path
|
||||
|
||||
<SUBSECTION Monitor>
|
||||
gdk_wayland_monitor_get_wl_output
|
||||
@@ -1008,8 +1007,12 @@ GDK_IS_WAYLAND_SURFACE_CLASS
|
||||
gdk_wayland_device_get_type
|
||||
gdk_wayland_display_get_type
|
||||
gdk_wayland_display_manager_get_type
|
||||
gdk_wayland_gl_context_get_type
|
||||
gdk_wayland_monitor_get_type
|
||||
gdk_wayland_popup_get_type
|
||||
gdk_wayland_seat_get_type
|
||||
gdk_wayland_surface_get_type
|
||||
|
||||
gdk_wayland_toplevel_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
private_headers = [
|
||||
'gdkintl.h',
|
||||
'gdkmarshalers.h',
|
||||
'gdkkeysyms.h',
|
||||
'gdkinternals.h',
|
||||
'gdk-autocleanup.h',
|
||||
'gdk-private.h',
|
||||
'gdkapplaunchcontextprivate.h',
|
||||
'gdkcairocontextprivate.h',
|
||||
'gdkcairoprivate.h',
|
||||
'gdkclipboardprivate.h',
|
||||
'gdkcontentformatsprivate.h',
|
||||
'gdkcontentproviderprivate.h',
|
||||
'gdkcursorprivate.h',
|
||||
'gdkdeviceprivate.h',
|
||||
'gdkdebug.h',
|
||||
'gdkdevicepadprivate.h',
|
||||
'gdkdeviceprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkdisplaymanagerprivate.h',
|
||||
'gdkdisplayprivate.h',
|
||||
'gdkdndprivate.h',
|
||||
'gdkdragprivate.h',
|
||||
'gdkdragsurfaceprivate.h',
|
||||
'gdkdrawcontextprivate.h',
|
||||
'gdkdropprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
@@ -23,12 +24,17 @@ private_headers = [
|
||||
'gdkframeclockprivate.h',
|
||||
'gdkglcontextprivate.h',
|
||||
'gdkgltextureprivate.h',
|
||||
'gdkinternals.h',
|
||||
'gdkintl.h',
|
||||
'gdkkeysprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkkeysyms.h',
|
||||
'gdkmarshalers.h',
|
||||
'gdkmemorytextureprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkpipeiostreamprivate.h',
|
||||
'gdkpopupprivate.h',
|
||||
'gdkprofilerprivate.h',
|
||||
'gdkrgbaprivate.h',
|
||||
'gdkscreenprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
'gdkseatprivate.h',
|
||||
@@ -37,22 +43,68 @@ private_headers = [
|
||||
'gdksurfaceprivate.h',
|
||||
'gdktextureprivate.h',
|
||||
'gdktoplevelprivate.h',
|
||||
'gdktoplevelsizeprivate.h',
|
||||
'gdkvulkancontextprivate.h',
|
||||
'filetransferportalprivate.h',
|
||||
'keyname-table.h',
|
||||
'x11/gdkprivate-x11.h',
|
||||
'x11/gdkeventsource.h',
|
||||
|
||||
# gdk/x11
|
||||
'gdkcairocontext-x11.h',
|
||||
'gdkclipboard-x11.h',
|
||||
'gdkdevice-xi2-private.h',
|
||||
'gdkdevicemanagerprivate-core.h',
|
||||
'gdkdisplay-x11.h',
|
||||
'gdkeventsource.h',
|
||||
'gdkeventtranslator.h',
|
||||
'gdkglcontext-x11.h',
|
||||
'gdkkeys-x11.h',
|
||||
'gdkmonitor-x11.h',
|
||||
'gdkprivate-x11.h',
|
||||
'gdkscreen-x11.h',
|
||||
'gdkselectioninputstream-x11.h',
|
||||
'gdkselectionoutputstream-x11.h',
|
||||
'gdksurface-x11.h',
|
||||
'gdktextlistconverter-x11.h',
|
||||
'gdkvisual-x11.h',
|
||||
'gdkvulkancontext-x11.h',
|
||||
'gdkx-autocleanups.h',
|
||||
'MwmUtil.h',
|
||||
'xsettings-client.h',
|
||||
|
||||
# gdk/wayland
|
||||
'gdkcairocontext-wayland.h',
|
||||
'gdkclipboard-wayland.h',
|
||||
'gdkdevice-wayland-private.h',
|
||||
'gdkdisplay-wayland.h',
|
||||
'gdkglcontext-wayland.h',
|
||||
'gdkmonitor-wayland.h',
|
||||
'gdkprimary-wayland.h',
|
||||
'gdkprivate-wayland.h',
|
||||
'gdkseat-wayland.h',
|
||||
'gdksurface-wayland.h',
|
||||
'gdkvulkancontext-wayland.h',
|
||||
'wm-button-layout-translation.h',
|
||||
'gtk-primary-selection-client-protocol.h',
|
||||
'gtk-shell-client-protocol.h',
|
||||
'idle-inhibit-unstable-v1-client-protocol.h',
|
||||
'keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
|
||||
'pointer-gestures-unstable-v1-client-protocol.h',
|
||||
'primary-selection-unstable-v1-client-protocol.h',
|
||||
'server-decoration-client-protocol.h',
|
||||
'tablet-unstable-v2-client-protocol.h',
|
||||
'xdg-foreign-unstable-v1-client-protocol.h',
|
||||
'xdg-shell-unstable-v6-client-protocol.h',
|
||||
'win32',
|
||||
'quartz',
|
||||
'xdg-output-unstable-v1-client-protocol.h',
|
||||
'xdg-shell-client-protocol.h',
|
||||
'xdg-shell-unstable-v6-client-protocol.h',
|
||||
'wayland-cursor.h',
|
||||
'os-compatibility.h',
|
||||
'xcursor.h',
|
||||
|
||||
'broadway',
|
||||
'mir'
|
||||
'wayland/cursor',
|
||||
'macos',
|
||||
'win32',
|
||||
]
|
||||
|
||||
images = [
|
||||
@@ -116,6 +168,9 @@ if get_option('gtk_doc')
|
||||
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
|
||||
'--ignore-headers=' + ' '.join(private_headers),
|
||||
],
|
||||
mkdb_args: [
|
||||
'--ignore-files=' + ' '.join(private_headers),
|
||||
],
|
||||
fixxref_args: [
|
||||
'--html-dir=@0@'.format(docpath),
|
||||
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
<xi:include href="xml/GskGLShader.xml" />
|
||||
</reference>
|
||||
|
||||
<part id="paths">
|
||||
<title>Paths</title>
|
||||
<xi:include href="xml/GskPath.xml" />
|
||||
<xi:include href="xml/GskPathBuilder.xml" />
|
||||
<xi:include href="xml/GskStroke.xml" />
|
||||
</part>
|
||||
|
||||
<index id="api-index-full">
|
||||
<title>Index of all symbols</title>
|
||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||
|
||||
@@ -62,97 +62,129 @@ gsk_render_node_write_to_file
|
||||
GskScalingFilter
|
||||
gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION Nodes>
|
||||
<SUBSECTION>
|
||||
gsk_color_node_new
|
||||
gsk_color_node_peek_color
|
||||
gsk_color_node_get_color
|
||||
gsk_texture_node_new
|
||||
gsk_texture_node_get_texture
|
||||
<SUBSECTION>
|
||||
GskColorStop
|
||||
gsk_linear_gradient_node_new
|
||||
gsk_linear_gradient_node_peek_start
|
||||
gsk_linear_gradient_node_peek_end
|
||||
gsk_linear_gradient_node_get_n_color_stops
|
||||
gsk_linear_gradient_node_peek_color_stops
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_linear_gradient_node_get_start
|
||||
gsk_linear_gradient_node_get_end
|
||||
gsk_linear_gradient_node_get_n_color_stops
|
||||
gsk_linear_gradient_node_get_color_stops
|
||||
<SUBSECTION>
|
||||
gsk_radial_gradient_node_new
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_radial_gradient_node_get_n_color_stops
|
||||
gsk_radial_gradient_node_peek_color_stops
|
||||
gsk_radial_gradient_node_get_color_stops
|
||||
gsk_radial_gradient_node_get_start
|
||||
gsk_radial_gradient_node_get_end
|
||||
gsk_radial_gradient_node_get_hradius
|
||||
gsk_radial_gradient_node_get_vradius
|
||||
gsk_radial_gradient_node_peek_center
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_radial_gradient_node_get_center
|
||||
<SUBSECTION>
|
||||
gsk_conic_gradient_node_new
|
||||
gsk_conic_gradient_node_get_n_color_stops
|
||||
gsk_conic_gradient_node_get_color_stops
|
||||
gsk_conic_gradient_node_get_center
|
||||
gsk_conic_gradient_node_get_rotation
|
||||
<SUBSECTION>
|
||||
gsk_border_node_new
|
||||
gsk_border_node_peek_outline
|
||||
gsk_border_node_peek_widths
|
||||
gsk_border_node_peek_colors
|
||||
gsk_border_node_get_outline
|
||||
gsk_border_node_get_widths
|
||||
gsk_border_node_get_colors
|
||||
<SUBSECTION>
|
||||
gsk_inset_shadow_node_new
|
||||
gsk_inset_shadow_node_peek_outline
|
||||
gsk_inset_shadow_node_peek_color
|
||||
gsk_inset_shadow_node_get_outline
|
||||
gsk_inset_shadow_node_get_color
|
||||
gsk_inset_shadow_node_get_dx
|
||||
gsk_inset_shadow_node_get_dy
|
||||
gsk_inset_shadow_node_get_spread
|
||||
gsk_inset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_outset_shadow_node_new
|
||||
gsk_outset_shadow_node_peek_outline
|
||||
gsk_outset_shadow_node_peek_color
|
||||
gsk_outset_shadow_node_get_outline
|
||||
gsk_outset_shadow_node_get_color
|
||||
gsk_outset_shadow_node_get_dx
|
||||
gsk_outset_shadow_node_get_dy
|
||||
gsk_outset_shadow_node_get_spread
|
||||
gsk_outset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_cairo_node_peek_surface
|
||||
gsk_cairo_node_get_surface
|
||||
<SUBSECTION>
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
<SUBSECTION>
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_get_transform
|
||||
<SUBSECTION>
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
<SUBSECTION>
|
||||
gsk_color_matrix_node_new
|
||||
gsk_color_matrix_node_get_child
|
||||
gsk_color_matrix_node_peek_color_matrix
|
||||
gsk_color_matrix_node_peek_color_offset
|
||||
gsk_color_matrix_node_get_color_matrix
|
||||
gsk_color_matrix_node_get_color_offset
|
||||
<SUBSECTION>
|
||||
gsk_repeat_node_new
|
||||
gsk_repeat_node_get_child
|
||||
gsk_repeat_node_peek_child_bounds
|
||||
gsk_repeat_node_get_child_bounds
|
||||
<SUBSECTION>
|
||||
gsk_clip_node_new
|
||||
gsk_clip_node_get_child
|
||||
gsk_clip_node_peek_clip
|
||||
gsk_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
gsk_rounded_clip_node_new
|
||||
gsk_rounded_clip_node_get_child
|
||||
gsk_rounded_clip_node_peek_clip
|
||||
gsk_rounded_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
GskFillRule
|
||||
gsk_fill_node_new
|
||||
gsk_fill_node_get_child
|
||||
gsk_fill_node_get_path
|
||||
gsk_fill_node_get_fill_rule
|
||||
<SUBSECTION>
|
||||
GskShadow
|
||||
gsk_shadow_node_new
|
||||
gsk_shadow_node_peek_shadow
|
||||
gsk_shadow_node_get_shadow
|
||||
gsk_shadow_node_get_n_shadows
|
||||
gsk_shadow_node_get_child
|
||||
<SUBSECTION>
|
||||
GskBlendMode
|
||||
gsk_blend_node_new
|
||||
gsk_blend_node_get_bottom_child
|
||||
gsk_blend_node_get_top_child
|
||||
gsk_blend_node_get_blend_mode
|
||||
<SUBSECTION>
|
||||
gsk_cross_fade_node_new
|
||||
gsk_cross_fade_node_get_start_child
|
||||
gsk_cross_fade_node_get_end_child
|
||||
gsk_cross_fade_node_get_progress
|
||||
<SUBSECTION>
|
||||
gsk_text_node_new
|
||||
gsk_text_node_peek_font
|
||||
gsk_text_node_peek_glyphs
|
||||
gsk_text_node_peek_color
|
||||
gsk_text_node_get_font
|
||||
gsk_text_node_get_glyphs
|
||||
gsk_text_node_get_color
|
||||
gsk_text_node_has_color_glyphs
|
||||
gsk_text_node_get_num_glyphs
|
||||
gsk_text_node_get_offset
|
||||
<SUBSECTION>
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
<SUBSECTION>
|
||||
gsk_debug_node_new
|
||||
gsk_debug_node_get_child
|
||||
gsk_debug_node_get_message
|
||||
<SUBSECTION>
|
||||
gsk_gl_shader_node_new
|
||||
gsk_gl_shader_node_get_n_children
|
||||
gsk_gl_shader_node_get_child
|
||||
@@ -172,6 +204,7 @@ GSK_TYPE_COLOR_NODE
|
||||
GSK_TYPE_CONTAINER_NODE
|
||||
GSK_TYPE_CROSS_FADE_NODE
|
||||
GSK_TYPE_DEBUG_NODE
|
||||
GSK_TYPE_FILL_NODE
|
||||
GSK_TYPE_INSET_SHADOW_NODE
|
||||
GSK_TYPE_LINEAR_GRADIENT_NODE
|
||||
GSK_TYPE_OPACITY_NODE
|
||||
@@ -197,6 +230,7 @@ gsk_color_node_get_type
|
||||
gsk_container_node_get_type
|
||||
gsk_cross_fade_node_get_type
|
||||
gsk_debug_node_get_type
|
||||
gsk_fill_node_get_type
|
||||
gsk_inset_shadow_node_get_type
|
||||
gsk_linear_gradient_node_get_type
|
||||
gsk_opacity_node_get_type
|
||||
@@ -234,6 +268,84 @@ gsk_rounded_rect_contains_rect
|
||||
gsk_rounded_rect_intersects_rect
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskPath</FILE>
|
||||
<SUBSECTION>
|
||||
GskPath
|
||||
gsk_path_ref
|
||||
gsk_path_unref
|
||||
gsk_path_new_rect
|
||||
gsk_path_new_from_cairo
|
||||
gsk_path_parse
|
||||
<SUBSECTION>
|
||||
gsk_path_print
|
||||
gsk_path_to_string
|
||||
gsk_path_to_cairo
|
||||
<SUBSECTION>
|
||||
gsk_path_is_empty
|
||||
gsk_path_get_bounds
|
||||
<SUBSECTION>
|
||||
GskPathForeachFlags
|
||||
gsk_path_foreach
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_PATH
|
||||
gsk_path_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskPathBuilder</FILE>
|
||||
GskPathBuilder
|
||||
gsk_path_builder_new
|
||||
gsk_path_builder_ref
|
||||
gsk_path_builder_unref
|
||||
gsk_path_builder_to_path
|
||||
gsk_path_builder_free_to_path
|
||||
<SUBSECTION>
|
||||
gsk_path_builder_get_current_point
|
||||
<SUBSECTION>
|
||||
gsk_path_builder_add_rect
|
||||
gsk_path_builder_add_rounded_rect
|
||||
gsk_path_builder_add_circle
|
||||
<SUBSECTION>
|
||||
gsk_path_builder_move_to
|
||||
gsk_path_builder_rel_move_to
|
||||
gsk_path_builder_line_to
|
||||
gsk_path_builder_rel_line_to
|
||||
gsk_path_builder_curve_to
|
||||
gsk_path_builder_rel_curve_to
|
||||
gsk_path_builder_conic_to
|
||||
gsk_path_builder_rel_conic_to
|
||||
gsk_path_builder_close
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_PATH_BUILDER
|
||||
gsk_path_builder_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskStroke</FILE>
|
||||
GskLineCap
|
||||
GskLineJoin
|
||||
gsk_stroke_new
|
||||
gsk_stroke_copy
|
||||
gsk_stroke_free
|
||||
gsk_stroke_equal
|
||||
gsk_stroke_set_line_width
|
||||
gsk_stroke_get_line_width
|
||||
gsk_stroke_set_line_join
|
||||
gsk_stroke_get_line_join
|
||||
gsk_stroke_set_line_cap
|
||||
gsk_stroke_get_line_cap
|
||||
gsk_stroke_set_miter_limit
|
||||
gsk_stroke_get_miter_limit
|
||||
gsk_stroke_set_dash
|
||||
gsk_stroke_get_dash
|
||||
gsk_stroke_set_dash_offset
|
||||
gsk_stroke_get_dash_offset
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_STROKE
|
||||
gsk_stroke_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskTransform</FILE>
|
||||
GskTransform
|
||||
|
||||
@@ -107,7 +107,9 @@ The `plain` build type provided by Meson should only be used when
|
||||
packaging GTK, and it's expected that packagers will provide their
|
||||
own compiler flags when building GTK. See the previous section for
|
||||
the list of environment variables to be used to define compiler and
|
||||
linker flags.
|
||||
linker flags. Note that with the plain build type, you are also
|
||||
responsible for controlling the debugging features of GTK with
|
||||
`-DG_ENABLE_DEBUG` and `-DG_DISABLE_CAST_CHECKS`.
|
||||
|
||||
## Dependencies {#dependencies}
|
||||
|
||||
@@ -159,7 +161,8 @@ Other libraries are maintained separately.
|
||||
fonts and matching them against font names.
|
||||
- [Cairo](https://www.cairographics.org) is a graphics library that
|
||||
supports vector graphics and image compositing. Both Pango and GTK
|
||||
use Cairo for drawing.
|
||||
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
||||
library.
|
||||
- [libepoxy](https://github.com/anholt/libepoxy) is a library that
|
||||
abstracts the differences between different OpenGL libraries. GTK
|
||||
uses it for cross-platform GL support and for its own drawing.
|
||||
|
||||
@@ -283,7 +283,6 @@
|
||||
<xi:include href="xml/gtkcolorchooserwidget.xml" />
|
||||
<xi:include href="xml/gtkcolorchooserdialog.xml" />
|
||||
<xi:include href="xml/gtkfilechooser.xml" />
|
||||
<xi:include href="xml/gtkfilechooserbutton.xml" />
|
||||
<xi:include href="xml/gtkfilechoosernative.xml" />
|
||||
<xi:include href="xml/gtkfilechooserdialog.xml" />
|
||||
<xi:include href="xml/gtkfilechooserwidget.xml" />
|
||||
|
||||
@@ -1339,31 +1339,6 @@ gtk_file_chooser_widget_get_type
|
||||
GtkFileChooserWidgetPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkfilechooserbutton</FILE>
|
||||
<TITLE>GtkFileChooserButton</TITLE>
|
||||
GtkFileChooserButton
|
||||
gtk_file_chooser_button_new
|
||||
gtk_file_chooser_button_new_with_dialog
|
||||
gtk_file_chooser_button_get_title
|
||||
gtk_file_chooser_button_set_title
|
||||
gtk_file_chooser_button_get_width_chars
|
||||
gtk_file_chooser_button_set_width_chars
|
||||
gtk_file_chooser_button_get_modal
|
||||
gtk_file_chooser_button_set_modal
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_FILE_CHOOSER_BUTTON
|
||||
GTK_IS_FILE_CHOOSER_BUTTON
|
||||
GTK_TYPE_FILE_CHOOSER_BUTTON
|
||||
GTK_FILE_CHOOSER_BUTTON_CLASS
|
||||
GTK_IS_FILE_CHOOSER_BUTTON_CLASS
|
||||
GTK_FILE_CHOOSER_BUTTON_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_file_chooser_button_get_type
|
||||
GtkFileChooserButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkfilefilter</FILE>
|
||||
GtkFileFilter
|
||||
@@ -1432,6 +1407,7 @@ GTK_TYPE_BOOKMARK_LIST
|
||||
<FILE>gtkfilter</FILE>
|
||||
<TITLE>GtkFilter</TITLE>
|
||||
GtkFilter
|
||||
GtkFilterMatch
|
||||
gtk_filter_match
|
||||
gtk_filter_get_strictness
|
||||
<SUBSECTION>
|
||||
@@ -2107,6 +2083,7 @@ gtk_native_dialog_get_type
|
||||
<TITLE>GtkNotebook</TITLE>
|
||||
GtkNotebook
|
||||
GtkNotebookPage
|
||||
GtkNotebookTab
|
||||
gtk_notebook_new
|
||||
gtk_notebook_get_page
|
||||
gtk_notebook_get_pages
|
||||
@@ -2163,7 +2140,6 @@ GTK_NOTEBOOK_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_notebook_get_type
|
||||
gtk_notebook_page_get_type
|
||||
GtkNotebookTab
|
||||
GtkNotebookPrivate
|
||||
</SECTION>
|
||||
|
||||
@@ -4303,6 +4279,8 @@ gtk_snapshot_push_color_matrix
|
||||
gtk_snapshot_push_repeat
|
||||
gtk_snapshot_push_clip
|
||||
gtk_snapshot_push_rounded_clip
|
||||
gtk_snapshot_push_fill
|
||||
gtk_snapshot_push_stroke
|
||||
gtk_snapshot_push_cross_fade
|
||||
gtk_snapshot_push_blend
|
||||
gtk_snapshot_push_blur
|
||||
@@ -4328,6 +4306,7 @@ gtk_snapshot_append_color
|
||||
gtk_snapshot_append_layout
|
||||
gtk_snapshot_append_linear_gradient
|
||||
gtk_snapshot_append_repeating_linear_gradient
|
||||
gtk_snapshot_append_conic_gradient
|
||||
gtk_snapshot_append_border
|
||||
gtk_snapshot_append_inset_shadow
|
||||
gtk_snapshot_append_outset_shadow
|
||||
@@ -4335,7 +4314,6 @@ gtk_snapshot_render_background
|
||||
gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
gtk_snapshot_render_layout
|
||||
gtk_snapshot_render_insertion_cursor
|
||||
<SUBSECTION Private>
|
||||
gtk_snapshot_get_type
|
||||
</SECTION>
|
||||
@@ -4845,7 +4823,6 @@ gtk_render_line
|
||||
gtk_render_option
|
||||
gtk_render_activity
|
||||
gtk_render_icon
|
||||
gtk_render_insertion_cursor
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_STYLE_CONTEXT
|
||||
|
||||
@@ -87,7 +87,6 @@ gtk_event_controller_motion_get_type
|
||||
gtk_event_controller_scroll_get_type
|
||||
gtk_every_filter_get_type
|
||||
gtk_expander_get_type
|
||||
gtk_file_chooser_button_get_type
|
||||
gtk_file_chooser_dialog_get_type
|
||||
gtk_file_chooser_get_type
|
||||
gtk_file_chooser_native_get_type
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
fs = import('fs')
|
||||
|
||||
private_headers = [
|
||||
'imm-extra.h',
|
||||
'gtkbitmaskprivateimpl.h',
|
||||
'gdkpixbufutilsprivate.h',
|
||||
'gtkaccelgroupprivate.h',
|
||||
'gtkaccelmapprivate.h',
|
||||
'gtkaccessibleattributesetprivate.h',
|
||||
@@ -21,6 +18,7 @@ private_headers = [
|
||||
'gtkapplicationprivate.h',
|
||||
'gtkatcontextprivate.h',
|
||||
'gtkbindingsprivate.h',
|
||||
'gtkbitmaskprivateimpl.h',
|
||||
'gtkbitmaskprivate.h',
|
||||
'gtkbuilderprivate.h',
|
||||
'gtkbuilderscopeprivate.h',
|
||||
@@ -146,6 +144,7 @@ private_headers = [
|
||||
'gtkimageprivate.h',
|
||||
'gtkimcontextsimpleprivate.h',
|
||||
'gtkimmoduleprivate.h',
|
||||
'gtkintl.h',
|
||||
'gtkkineticscrollingprivate.h',
|
||||
'gtklabelprivate.h',
|
||||
'gtklistbaseprivate.h',
|
||||
@@ -165,6 +164,7 @@ private_headers = [
|
||||
'gtknativedialogprivate.h',
|
||||
'gtknomediafileprivate.h',
|
||||
'gtkpango.h',
|
||||
'gdkpixbufutilsprivate.h',
|
||||
'gtkplacessidebarprivate.h',
|
||||
'gtkplacesviewprivate.h',
|
||||
'gtkplacesviewrowprivate.h',
|
||||
@@ -183,6 +183,10 @@ private_headers = [
|
||||
'gtkrendernodepaintableprivate.h',
|
||||
'gtkroundedboxprivate.h',
|
||||
'gtkscalerprivate.h',
|
||||
'gtksearchengine.h',
|
||||
'gtksearchenginemodel.h',
|
||||
'gtksearchenginequartz.h',
|
||||
'gtksearchenginetracker3.h',
|
||||
'gtksearchentryprivate.h',
|
||||
'gtksettingsprivate.h',
|
||||
'gtkshortcutcontrollerprivate.h',
|
||||
@@ -222,8 +226,15 @@ private_headers = [
|
||||
'gtkwin32drawprivate.h',
|
||||
'gtkwin32themeprivate.h',
|
||||
'gtkwindowprivate.h',
|
||||
'gtk-text-input-client-protocol.h',
|
||||
'roaring.h',
|
||||
|
||||
'gtkdbusgenerated.h',
|
||||
'imm-extra.h',
|
||||
'text-input-unstable-v3-client-protocol.h',
|
||||
|
||||
'a11y',
|
||||
'inspector',
|
||||
'roaring',
|
||||
'timsort',
|
||||
]
|
||||
|
||||
images = [
|
||||
@@ -471,6 +482,7 @@ if get_option('gtk_doc')
|
||||
],
|
||||
mkdb_args: [
|
||||
'--default-includes=gtk/gtk.h',
|
||||
'--ignore-files=' + ' '.join(private_headers),
|
||||
],
|
||||
fixxref_args: [
|
||||
'--html-dir=@0@'.format(docpath),
|
||||
|
||||
@@ -445,6 +445,9 @@ gtk4-builder-tool simplify command can perform many of the
|
||||
necessary changes automatically, when called with the --3to4
|
||||
option. You should always review the resulting changes.
|
||||
|
||||
The <requires> tag now supports for the 'lib' attribute the
|
||||
'gtk' value only, instead of the 'gtk+' one previously.
|
||||
|
||||
### Adapt to event controller API changes
|
||||
|
||||
A few changes to the event controller and #GtkGesture APIs
|
||||
@@ -1133,6 +1136,14 @@ gtk_buildable_get_buildable_id().
|
||||
GtkAboutDialog now directly derives from GtkWindow, the GtkDialog API can no
|
||||
longer be used on it.
|
||||
|
||||
### Adapt to GtkTreeView and GtkIconView tooltip context changes
|
||||
|
||||
The getter functions for retrieving the data from #GtkTreeView
|
||||
and #GtkIconView inside a #GtkWidget::query-tooltip signal do not take the
|
||||
pointer coordinates as inout arguments any more, but as normal in ones.
|
||||
|
||||
See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
|
||||
|
||||
## Changes to consider after the switch
|
||||
|
||||
GTK 4 has a number of new features that you may want to take
|
||||
|
||||
@@ -11,9 +11,9 @@ environment variables.
|
||||
|
||||
### GTK_DEBUG {#GTK_Debug-Options}
|
||||
|
||||
Unless GTK has been configured with `-Ddebug=false`, this variable
|
||||
can be set to a list of debug options, which cause GTK to print out
|
||||
different types of debugging information.
|
||||
This variable can be set to a list of debug options, which cause GTK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
|
||||
actions
|
||||
: Actions and menu models
|
||||
@@ -98,6 +98,14 @@ be used for the default IM module. This also can be a colon-separated
|
||||
list of input-methods, which GTK will try in turn until it finds one
|
||||
available on the system.
|
||||
|
||||
### GTK_MEDIA
|
||||
|
||||
Specifies what backend to load for #GtkMediaFile. The possible values
|
||||
depend on what options GTK was built with, and can include 'gstreamer',
|
||||
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
|
||||
The special value 'help' can be used to obtain a list of all supported
|
||||
media backends.
|
||||
|
||||
### GTK_EXE_PREFIX
|
||||
|
||||
If set, GTK uses `$GTK_EXE_PREFIX/lib` instead of the libdir
|
||||
@@ -133,9 +141,9 @@ The `loaders.cache` file is generated by the
|
||||
|
||||
### GDK_DEBUG
|
||||
|
||||
Unless GTK has been configured with `-Ddebug=false`, this variable
|
||||
can be set to a list of debug options, which cause GDK to print out
|
||||
different types of debugging information.
|
||||
This variable can be set to a list of debug options, which cause GDK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
|
||||
cursor
|
||||
: Information about cursor objects (only win32)
|
||||
@@ -183,10 +191,9 @@ to obtain a list of all supported debug options.
|
||||
|
||||
### GSK_DEBUG {#GSK-Debug-Options}
|
||||
|
||||
Unless GTK has been configured with `-Ddebug=false`,
|
||||
this variable can be set to a list of debug options,
|
||||
which cause GSK to print out different types of debugging
|
||||
information.
|
||||
This variable can be set to a list of debug options, which cause GSK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
|
||||
renderer
|
||||
: General renderer information
|
||||
@@ -285,6 +292,24 @@ CSD is always used for windows with a custom titlebar widget set,
|
||||
as the WM should not draw another titlebar or other decorations
|
||||
around the custom one.
|
||||
|
||||
### GTK_A11Y
|
||||
|
||||
If set, selects the accessibility backend to use. The following
|
||||
backends can be selected, provided they are included in the GTK
|
||||
library you are using:
|
||||
|
||||
help
|
||||
: Prints information about available options
|
||||
atspi
|
||||
: Selects the AT-SPI accessibility backend
|
||||
test
|
||||
: Selects the test backend
|
||||
none
|
||||
: Disables the accessibility backend
|
||||
|
||||
The `test` accessibility backend is recommended for test suites and remote
|
||||
continuous integration pipelines.
|
||||
|
||||
### XDG_DTA_HOME, XDG_DATA_DIRS
|
||||
|
||||
GTK uses these environment variables to locate icon themes
|
||||
|
||||
@@ -165,13 +165,13 @@ Each relation name is part of the #GtkAccessibleRelation enumeration.
|
||||
| %GTK_ACCESSIBLE_RELATION_COL_INDEX | “aria-colindex” | integer |
|
||||
| %GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT | “aria-colindextext” | translatable string |
|
||||
| %GTK_ACCESSIBLE_RELATION_COL_SPAN | “aria-colspan” | integer |
|
||||
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a #GList of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of #GtkAccessible |
|
||||
| %GTK_ACCESSIBLE_RELATION_POS_IN_SET | “aria-posinset” | integer |
|
||||
| %GTK_ACCESSIBLE_RELATION_ROW_COUNT | “aria-rowcount” | integer |
|
||||
| %GTK_ACCESSIBLE_RELATION_ROW_INDEX | “aria-rowindex” | integer |
|
||||
@@ -179,6 +179,10 @@ Each relation name is part of the #GtkAccessibleRelation enumeration.
|
||||
| %GTK_ACCESSIBLE_RELATION_ROW_SPAN | “aria-rowspan” | integer |
|
||||
| %GTK_ACCESSIBLE_RELATION_SET_SIZE | “aria-setsize” | integer |
|
||||
|
||||
*Note*: When using gtk_accessible_update_relation() with a relation that
|
||||
requires a list of #GtkAccessible instances, you should pass every
|
||||
accessible object separately, followed by %NULL.
|
||||
|
||||
## Application development rules
|
||||
|
||||
Even if standard UI controls provided by GTK have accessibility information
|
||||
@@ -292,12 +296,36 @@ The power of hiding and enhancing can be a double-edged sword, as it can
|
||||
lead to inadvertently overriding the accessible semantics of existing
|
||||
widgets.
|
||||
|
||||
## Hiding UI elements from the accessible tree
|
||||
|
||||
The accessibility API is mainly used to express semantics useful for
|
||||
assistive technologies, but it can also be used to hide elements. The
|
||||
canonical way to do so is to use the %GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||
which declares that a UI element is purely meant for presentation purposes,
|
||||
and as such it has no meaningful impact on the accessibility of the
|
||||
interface.
|
||||
|
||||
A "presentation" role should not be confused with the
|
||||
%GTK_ACCESSIBLE_STATE_HIDDEN state; the "hidden" state is transient, and is
|
||||
typically controlled by showing and hiding a widget using the #GtkWidget
|
||||
API.
|
||||
|
||||
## Design patterns and custom widgets
|
||||
|
||||
When creating custom widgets, following established patterns can help
|
||||
ensuring that the widgets work well for users of accessible technologies
|
||||
as well.
|
||||
|
||||
### Buttons
|
||||
|
||||
A button is a widget that enables users to trigger an action. While it is
|
||||
recommended you use #GtkButton for anything that looks and behaves like a
|
||||
button, it is possible to apply a button behavior to UI elements like images
|
||||
by using a #GtkGestureClick gesture. When doing so, you should:
|
||||
|
||||
- Give your widget the role %GTK_ACCESSIBLE_ROLE_BUTTON
|
||||
- Install an action with no parameters, which will activate the widget
|
||||
|
||||
### Custom entries
|
||||
|
||||
For custom entries, it is highly recommended that you implement the
|
||||
|
||||
@@ -615,51 +615,6 @@ create_font_button (void)
|
||||
return new_widget_info ("font-button", vbox, SMALL);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_file_button (void)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *picker;
|
||||
char *path;
|
||||
GFile *file;
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||
picker = gtk_file_chooser_button_new ("File Chooser Button",
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
gtk_widget_set_size_request (picker, 150, -1);
|
||||
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (vbox2), picker);
|
||||
gtk_box_append (GTK_BOX (vbox2),
|
||||
gtk_label_new ("File Button (Files)"));
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox),
|
||||
vbox2);
|
||||
gtk_box_append (GTK_BOX (vbox),
|
||||
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
|
||||
|
||||
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||
picker = gtk_file_chooser_button_new ("File Chooser Button",
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
gtk_widget_set_size_request (picker, 150, -1);
|
||||
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
|
||||
file = g_file_new_for_path (path);
|
||||
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (picker), file, NULL);
|
||||
g_free (path);
|
||||
g_object_unref (file);
|
||||
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (vbox2), picker);
|
||||
gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("File Button (Select Folder)"));
|
||||
gtk_box_append (GTK_BOX (vbox), vbox2);
|
||||
|
||||
add_margin (vbox);
|
||||
|
||||
return new_widget_info ("file-button", vbox, MEDIUM);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_editable_label (void)
|
||||
{
|
||||
@@ -2144,7 +2099,6 @@ get_all_widgets (void)
|
||||
retval = g_list_prepend (retval, create_combo_box_entry ());
|
||||
retval = g_list_prepend (retval, create_combo_box_text ());
|
||||
retval = g_list_prepend (retval, create_entry ());
|
||||
retval = g_list_prepend (retval, create_file_button ());
|
||||
retval = g_list_prepend (retval, create_font_button ());
|
||||
retval = g_list_prepend (retval, create_frame ());
|
||||
retval = g_list_prepend (retval, create_icon_view ());
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.17 -->
|
||||
<object class="GtkShortcutsWindow" id="help_overlay">
|
||||
<property name="modal">1</property>
|
||||
<child>
|
||||
|
||||
@@ -1022,7 +1022,7 @@ parse_line (const char *line, const char *key)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
if (!g_str_has_prefix (line, key))
|
||||
if (g_ascii_strncasecmp (line, key, strlen (key)) != 0)
|
||||
return NULL;
|
||||
p = line + strlen (key);
|
||||
if (*p != ':')
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct
|
||||
const char *key;
|
||||
guint value;
|
||||
const char *help;
|
||||
gboolean always_enabled;
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
|
||||
@@ -128,7 +128,6 @@ static int gdk_initialized = 0; /* 1 if the library is initi
|
||||
* 0 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "misc", GDK_DEBUG_MISC, "Miscellaneous information" },
|
||||
{ "events", GDK_DEBUG_EVENTS, "Information about events" },
|
||||
@@ -152,7 +151,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef G_HAS_CONSTRUCTORS
|
||||
@@ -212,6 +210,13 @@ gdk_parse_debug_var (const char *variable,
|
||||
const char *q;
|
||||
gboolean invert;
|
||||
gboolean help;
|
||||
gboolean debug_enabled;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
debug_enabled = TRUE;
|
||||
#else
|
||||
debug_enabled = FALSE;
|
||||
#endif
|
||||
|
||||
string = g_getenv (variable);
|
||||
if (string == NULL)
|
||||
@@ -237,21 +242,25 @@ gdk_parse_debug_var (const char *variable,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *val = g_strndup (p, q - p);
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
g_ascii_strncasecmp (keys[i].key, p, q - p) == 0)
|
||||
{
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
{
|
||||
fprintf (stderr, "\"%s\" is only available when building GTK with G_ENABLE_DEBUG. See %s=help\n",
|
||||
val, variable);
|
||||
break;
|
||||
}
|
||||
result |= keys[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == nkeys)
|
||||
{
|
||||
char *val = g_strndup (p, q - p);
|
||||
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||
g_free (val);
|
||||
}
|
||||
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||
g_free (val);
|
||||
}
|
||||
|
||||
p = q;
|
||||
@@ -267,11 +276,17 @@ gdk_parse_debug_var (const char *variable,
|
||||
max_width += 4;
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
fprintf (stderr, " %s%*s%s", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
fprintf (stderr, " [unavailable]");
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
|
||||
if (!debug_enabled)
|
||||
fprintf (stderr, "Values marked as [unavailable] are only accessible if GTK is built with G_ENABLE_DEBUG.\n");
|
||||
}
|
||||
|
||||
if (invert)
|
||||
@@ -279,7 +294,10 @@ gdk_parse_debug_var (const char *variable,
|
||||
guint all_flags = 0;
|
||||
|
||||
for (i = 0; i < nkeys; i++)
|
||||
all_flags |= keys[i].value;
|
||||
{
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
all_flags |= keys[i].value;
|
||||
}
|
||||
|
||||
result = all_flags & (~result);
|
||||
}
|
||||
@@ -294,14 +312,9 @@ gdk_pre_parse (void)
|
||||
|
||||
gdk_ensure_resources ();
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
#else
|
||||
if (g_getenv ("GDK_DEBUG"))
|
||||
g_warning ("GDK_DEBUG set but ignored because GTK isn't built with G_ENABLE_DEBUG");
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_desktop_startup_notification_id ();
|
||||
|
||||
@@ -49,6 +49,12 @@ struct _GdkContentProvider
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
/**
|
||||
* GdkContentProviderClass:
|
||||
* @content_changed: Signal class closure for #GdkContentProvider::content-changed
|
||||
*
|
||||
* Class structure for #GdkContentProvider.
|
||||
*/
|
||||
struct _GdkContentProviderClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
@@ -56,6 +62,7 @@ struct _GdkContentProviderClass
|
||||
/* signals */
|
||||
void (* content_changed) (GdkContentProvider *provider);
|
||||
|
||||
/*< private >*/
|
||||
/* vfuncs */
|
||||
void (* attach_clipboard) (GdkContentProvider *provider,
|
||||
GdkClipboard *clipboard);
|
||||
|
||||
+4
-4
@@ -272,9 +272,9 @@ gdk_cursor_equal (gconstpointer a,
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_name:
|
||||
* @name: the name of the cursor
|
||||
* @fallback: (allow-none): %NULL or the #GdkCursor to fall back to when
|
||||
* this one cannot be supported
|
||||
* @name: the name of the cursor
|
||||
*
|
||||
* Creates a new cursor by looking up @name in the current cursor
|
||||
* theme.
|
||||
@@ -321,9 +321,9 @@ gdk_cursor_equal (gconstpointer a,
|
||||
* Returns: (nullable): a new #GdkCursor, or %NULL if there is no
|
||||
* cursor with the given name
|
||||
*/
|
||||
GdkCursor*
|
||||
GdkCursor *
|
||||
gdk_cursor_new_from_name (const char *name,
|
||||
GdkCursor *fallback)
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
@@ -357,7 +357,7 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
|
||||
g_return_val_if_fail (0 <= hotspot_y && hotspot_y < gdk_texture_get_height (texture), NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
return g_object_new (GDK_TYPE_CURSOR,
|
||||
return g_object_new (GDK_TYPE_CURSOR,
|
||||
"texture", texture,
|
||||
"hotspot-x", hotspot_x,
|
||||
"hotspot-y", hotspot_y,
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ typedef enum
|
||||
* GdkTimeCoord:
|
||||
* @time: The timestamp for this event.
|
||||
* @flags: Flags indicating what axes are present
|
||||
* @axes: axis values
|
||||
* @axes: (array fixed-size=12): axis values
|
||||
*
|
||||
* A #GdkTimeCoord stores a single event in a motion history.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,11 @@ G_BEGIN_DECLS
|
||||
#define GDK_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_TOOL, GdkDeviceTool))
|
||||
#define GDK_IS_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_TOOL))
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:
|
||||
*
|
||||
* A physical tool associated to a #GdkDevice.
|
||||
*/
|
||||
typedef struct _GdkDeviceTool GdkDeviceTool;
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
* during a DND operation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GdkDragSurfaceInterface:
|
||||
*
|
||||
* The #GdkDragSurfaceInterface implementation is private to GDK.
|
||||
*/
|
||||
|
||||
G_DEFINE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -33,6 +33,11 @@ G_BEGIN_DECLS
|
||||
#define GDK_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_TEXTURE, GdkGLTexture))
|
||||
#define GDK_IS_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_TEXTURE))
|
||||
|
||||
/**
|
||||
* GdkGLTexture:
|
||||
*
|
||||
* A #GdkTexture representing a GL texture object.
|
||||
*/
|
||||
typedef struct _GdkGLTexture GdkGLTexture;
|
||||
typedef struct _GdkGLTextureClass GdkGLTextureClass;
|
||||
|
||||
|
||||
@@ -94,6 +94,11 @@ typedef enum {
|
||||
#define GDK_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_MEMORY_TEXTURE, GdkMemoryTexture))
|
||||
#define GDK_IS_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_MEMORY_TEXTURE))
|
||||
|
||||
/**
|
||||
* GdkMemoryTexture:
|
||||
*
|
||||
* A #GdkTexture representing image data in memory.
|
||||
*/
|
||||
typedef struct _GdkMemoryTexture GdkMemoryTexture;
|
||||
typedef struct _GdkMemoryTextureClass GdkMemoryTextureClass;
|
||||
|
||||
|
||||
+12
-5
@@ -31,6 +31,11 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_PAINTABLE (gdk_paintable_get_type ())
|
||||
|
||||
/**
|
||||
* GdkPaintable:
|
||||
*
|
||||
* Interface for paintable objects.
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (GdkPaintable, gdk_paintable, GDK, PAINTABLE, GObject)
|
||||
|
||||
@@ -74,11 +79,13 @@ typedef enum {
|
||||
* this function should return the aspect ratio computed from those.
|
||||
*
|
||||
* The list of functions that can be implemented for the #GdkPaintable interface.
|
||||
* Note that apart from the first function, no function is mandatory to implement,
|
||||
* though it is a good idea to implement #GdkPaintableInterface.get_current_image()
|
||||
* for non-static paintables and #GdkPaintableInterface.get_flags() if the image
|
||||
* is not dynamic as the default implementation returns no flags and that will
|
||||
* make the implementation likely quite slow.
|
||||
*
|
||||
* Note that apart from the #GdkPaintableInterface.snapshot() function, no virtual
|
||||
* function of this interface is mandatory to implement, though it is a good idea
|
||||
* to implement #GdkPaintableInterface.get_current_image() for non-static paintables
|
||||
* and #GdkPaintableInterface.get_flags() if the image is not dynamic as the default
|
||||
* implementation returns no flags and that will make the implementation likely
|
||||
* quite slow.
|
||||
*/
|
||||
struct _GdkPaintableInterface
|
||||
{
|
||||
|
||||
@@ -31,6 +31,11 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_POPUP (gdk_popup_get_type ())
|
||||
|
||||
/**
|
||||
* GdkPopup:
|
||||
*
|
||||
* Interface for popup surfaces.
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (GdkPopup, gdk_popup, GDK, POPUP, GObject)
|
||||
|
||||
|
||||
@@ -300,10 +300,10 @@ gdk_popup_layout_set_offset (GdkPopupLayout *layout,
|
||||
/**
|
||||
* gdk_popup_layout_get_offset:
|
||||
* @layout: a #GdkPopupLayout
|
||||
* @dx: a pointer to where to store the delta x coordinate
|
||||
* @dy: a pointer to where to store the delta y coordinate
|
||||
* @dx: (out): return location for the delta X coordinate
|
||||
* @dy: (out): return location for the delta Y coordinate
|
||||
*
|
||||
* Get the delta the anchor rectangle is offset with
|
||||
* Retrieves the offset for the anchor rectangle.
|
||||
*/
|
||||
void
|
||||
gdk_popup_layout_get_offset (GdkPopupLayout *layout,
|
||||
|
||||
+7
-1
@@ -29,7 +29,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkSnapshotClass GdkSnapshotClass;
|
||||
/**
|
||||
* GdkSnapshot:
|
||||
*
|
||||
* Base type for snapshot operations.
|
||||
*/
|
||||
|
||||
typedef struct _GdkSnapshotClass GdkSnapshotClass;
|
||||
|
||||
#define GDK_TYPE_SNAPSHOT (gdk_snapshot_get_type ())
|
||||
|
||||
|
||||
+20
-17
@@ -1408,9 +1408,13 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||
void
|
||||
gdk_surface_queue_render (GdkSurface *surface)
|
||||
{
|
||||
cairo_region_t *region;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
region = cairo_region_create ();
|
||||
impl_surface_add_update_area (surface, region);
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1491,9 +1495,7 @@ gdk_surface_freeze_updates (GdkSurface *surface)
|
||||
|
||||
surface->update_freeze_count++;
|
||||
if (surface->update_freeze_count == 1)
|
||||
{
|
||||
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2657,18 +2659,6 @@ gdk_synthesize_surface_state (GdkSurface *surface,
|
||||
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
|
||||
}
|
||||
|
||||
static void
|
||||
hide_popup_chain (GdkSurface *surface)
|
||||
{
|
||||
GdkSurface *parent;
|
||||
|
||||
gdk_surface_hide (surface);
|
||||
|
||||
parent = surface->parent;
|
||||
if (parent->autohide)
|
||||
hide_popup_chain (parent);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_autohide (GdkEvent *event)
|
||||
{
|
||||
@@ -2695,10 +2685,23 @@ check_autohide (GdkEvent *event)
|
||||
device = gdk_event_get_device (event);
|
||||
if (gdk_device_grab_info (display, device, &grab_surface, NULL))
|
||||
{
|
||||
if (grab_surface != gdk_event_get_surface (event) &&
|
||||
GdkSurface *event_surface;
|
||||
|
||||
event_surface = gdk_event_get_surface (event);
|
||||
|
||||
if (grab_surface != event_surface &&
|
||||
grab_surface != event_surface->parent &&
|
||||
grab_surface->autohide)
|
||||
{
|
||||
hide_popup_chain (grab_surface);
|
||||
GdkSurface *surface = grab_surface;
|
||||
|
||||
do
|
||||
{
|
||||
gdk_surface_hide (surface);
|
||||
surface = surface->parent;
|
||||
}
|
||||
while (surface->autohide && surface != event_surface);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -120,6 +120,11 @@ typedef enum
|
||||
|
||||
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
|
||||
|
||||
/**
|
||||
* GdkToplevel:
|
||||
*
|
||||
* An interface for top level surfaces.
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (GdkToplevel, gdk_toplevel, GDK, TOPLEVEL, GObject)
|
||||
|
||||
@@ -198,7 +203,6 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_TOPLEVEL_H__ */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GdkTopLevelLayout:
|
||||
* GdkToplevelLayout:
|
||||
*
|
||||
* Struct containing information for gdk_toplevel_present()
|
||||
*/
|
||||
|
||||
@@ -320,11 +320,20 @@
|
||||
|
||||
-(void)hide
|
||||
{
|
||||
BOOL wasKey = [self isKeyWindow];
|
||||
BOOL wasMain = [self isMainWindow];
|
||||
|
||||
inShowOrHide = YES;
|
||||
[self orderOut:nil];
|
||||
inShowOrHide = NO;
|
||||
|
||||
initialPositionKnown = NO;
|
||||
|
||||
if (wasMain)
|
||||
[self windowDidResignMain:nil];
|
||||
|
||||
if (wasKey)
|
||||
[self windowDidResignKey:nil];
|
||||
}
|
||||
|
||||
-(BOOL)trackManualMove
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gdkconfig.h"
|
||||
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#include <cairo-quartz.h>
|
||||
|
||||
#import "GdkMacosCairoView.h"
|
||||
|
||||
@@ -58,7 +57,12 @@ create_cairo_surface_for_surface (GdkSurface *surface)
|
||||
width = scale * gdk_surface_get_width (surface);
|
||||
height = scale * gdk_surface_get_height (surface);
|
||||
|
||||
cairo_surface = cairo_quartz_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||
/* We use a cairo image surface here instead of a quartz surface because we
|
||||
* get strange artifacts with the quartz surface such as empty cross-fades
|
||||
* when hovering buttons. For performance, we want to be using GL rendering
|
||||
* so there isn't much point here as correctness is better.
|
||||
*/
|
||||
cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||
|
||||
if (cairo_surface != NULL)
|
||||
cairo_surface_set_device_scale (cairo_surface, scale, scale);
|
||||
|
||||
@@ -122,7 +122,7 @@ gdk_macos_device_ungrab (GdkDevice *device,
|
||||
grab = _gdk_display_get_last_device_grab (display, device);
|
||||
|
||||
if (grab != NULL)
|
||||
grab->serial_end = 0;
|
||||
grab->serial_end = grab->serial_start;
|
||||
|
||||
_gdk_display_device_grab_update (display, device, 0);
|
||||
}
|
||||
|
||||
@@ -136,8 +136,6 @@ void _gdk_macos_display_add_frame_callback (GdkMacosDisp
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_display_remove_frame_callback (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_display_synthesize_motion (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
NSWindow *_gdk_macos_display_find_native_under_pointer (GdkMacosDisplay *self,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
@@ -610,7 +610,7 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
sx = [nsevent scrollingDeltaX];
|
||||
sy = [nsevent scrollingDeltaY];
|
||||
|
||||
if (sx != 0.0 || dx != 0.0)
|
||||
if (sx != 0.0 || sy != 0.0)
|
||||
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
@@ -1155,41 +1155,6 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_synthesize_motion (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
GdkModifierType state;
|
||||
GdkEvent *event;
|
||||
GdkSeat *seat;
|
||||
NSPoint point;
|
||||
GList *node;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
|
||||
point = [NSEvent mouseLocation];
|
||||
_gdk_macos_display_from_display_coords (self, point.x, point.y, &x, &y);
|
||||
|
||||
state = _gdk_macos_display_get_current_keyboard_modifiers (self) |
|
||||
_gdk_macos_display_get_current_mouse_modifiers (self);
|
||||
|
||||
event = gdk_motion_event_new (GDK_SURFACE (surface),
|
||||
gdk_seat_get_pointer (seat),
|
||||
NULL,
|
||||
get_time_from_ns_event ([NSApp currentEvent]),
|
||||
state,
|
||||
x,
|
||||
y,
|
||||
NULL);
|
||||
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
|
||||
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_send_button_event (GdkMacosDisplay *self,
|
||||
NSEvent *nsevent)
|
||||
|
||||
@@ -477,7 +477,8 @@ _gdk_macos_display_surface_removed (GdkMacosDisplay *self,
|
||||
if (self->keyboard_surface == surface)
|
||||
_gdk_macos_display_surface_resigned_key (self, surface);
|
||||
|
||||
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
|
||||
if (queue_contains (&self->sorted_surfaces, &surface->sorted))
|
||||
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
|
||||
|
||||
if (queue_contains (&self->main_surfaces, &surface->main))
|
||||
_gdk_macos_display_surface_resigned_main (self, surface);
|
||||
@@ -512,30 +513,37 @@ _gdk_macos_display_surface_became_key (GdkMacosDisplay *self,
|
||||
* ("is not key"). We send a dummy motion notify event now, so that
|
||||
* everything in the window is set to correct state.
|
||||
*/
|
||||
_gdk_macos_display_synthesize_motion (self, surface);
|
||||
gdk_surface_request_motion (GDK_SURFACE (surface));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
gboolean was_keyboard_surface;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
if (self->keyboard_surface == surface)
|
||||
was_keyboard_surface = self->keyboard_surface == surface;
|
||||
|
||||
self->keyboard_surface = NULL;
|
||||
|
||||
if (was_keyboard_surface)
|
||||
{
|
||||
GdkDevice *keyboard;
|
||||
GdkEvent *event;
|
||||
GdkSeat *seat;
|
||||
GList *node;
|
||||
|
||||
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, FALSE);
|
||||
_gdk_event_queue_append (GDK_DISPLAY (self), event);
|
||||
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
|
||||
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
|
||||
}
|
||||
|
||||
self->keyboard_surface = NULL;
|
||||
|
||||
_gdk_macos_display_clear_sorting (self);
|
||||
}
|
||||
|
||||
@@ -1049,9 +1057,8 @@ _gdk_macos_display_clear_sorting (GdkMacosDisplay *self)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
self->sorted_surfaces.head = NULL;
|
||||
self->sorted_surfaces.tail = NULL;
|
||||
self->sorted_surfaces.length = 0;
|
||||
while (self->sorted_surfaces.head != NULL)
|
||||
g_queue_unlink (&self->sorted_surfaces, self->sorted_surfaces.head);
|
||||
}
|
||||
|
||||
const GList *
|
||||
|
||||
@@ -525,8 +525,8 @@ select_thread_start_poll (GPollFD *ufds,
|
||||
have_new_pollfds = TRUE;
|
||||
else
|
||||
{
|
||||
if (!((nfds == 1 && poll_fd_index < 0 && g_thread_supported ()) ||
|
||||
(nfds == 2 && poll_fd_index >= 0 && g_thread_supported ())))
|
||||
if (!((nfds == 1 && poll_fd_index < 0) ||
|
||||
(nfds == 2 && poll_fd_index >= 0)))
|
||||
select_thread_set_state (POLLING_RESTART);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ struct _GdkMacosGLContext
|
||||
NSWindow *dummy_window;
|
||||
NSView *dummy_view;
|
||||
|
||||
cairo_region_t *damage;
|
||||
cairo_rectangle_int_t flush_rect;
|
||||
|
||||
guint is_attached : 1;
|
||||
guint needs_resize : 1;
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "gdkmacosglcontext-private.h"
|
||||
#include "gdkmacossurface-private.h"
|
||||
#include "gdkmacostoplevelsurface-private.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
@@ -99,6 +100,9 @@ create_pixel_format (int major,
|
||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,
|
||||
NSOpenGLPFAAccelerated,
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
NSOpenGLPFABackingStore,
|
||||
NSOpenGLPFAColorSize, 32,
|
||||
NSOpenGLPFAAlphaSize, 8,
|
||||
|
||||
(NSOpenGLPixelFormatAttribute)nil
|
||||
};
|
||||
@@ -143,6 +147,18 @@ ensure_gl_view (GdkMacosGLContext *self)
|
||||
[nsview setNeedsDisplay:YES];
|
||||
[nswindow setContentView:nsview];
|
||||
[nsview release];
|
||||
|
||||
if (self->dummy_view != NULL)
|
||||
{
|
||||
NSView *dummy_view = g_steal_pointer (&self->dummy_view);
|
||||
[dummy_view release];
|
||||
}
|
||||
|
||||
if (self->dummy_window != NULL)
|
||||
{
|
||||
NSWindow *dummy_window = g_steal_pointer (&self->dummy_window);
|
||||
[dummy_window release];
|
||||
}
|
||||
}
|
||||
|
||||
return [nswindow contentView];
|
||||
@@ -159,9 +175,8 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
NSOpenGLPixelFormat *pixelFormat;
|
||||
GdkGLContext *shared;
|
||||
GdkGLContext *shared_data;
|
||||
GdkGLContext *existing;
|
||||
NSOpenGLContext *existing;
|
||||
GLint sync_to_framerate = 1;
|
||||
GLint opaque = 0;
|
||||
GLint validate = 0;
|
||||
int major, minor;
|
||||
|
||||
@@ -170,7 +185,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
if (self->gl_context != nil)
|
||||
return TRUE;
|
||||
|
||||
existing = gdk_gl_context_get_current ();
|
||||
existing = [NSOpenGLContext currentContext];
|
||||
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
|
||||
@@ -212,24 +227,17 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
}
|
||||
|
||||
[gl_context setValues:&sync_to_framerate forParameter:NSOpenGLCPSwapInterval];
|
||||
[gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
||||
[gl_context setValues:&validate forParameter:NSOpenGLContextParameterStateValidation];
|
||||
|
||||
if (self->is_attached || shared == NULL)
|
||||
{
|
||||
NSRect frame = NSMakeRect (0, 0, 1, 1);
|
||||
self->dummy_window = [[NSWindow alloc] initWithContentRect:NSZeroRect
|
||||
styleMask:0
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO
|
||||
screen:nil];
|
||||
self->dummy_view = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||
[self->dummy_window setContentView:self->dummy_view];
|
||||
[gl_context setView:self->dummy_view];
|
||||
|
||||
self->dummy_window = [[NSWindow alloc] initWithContentRect:frame
|
||||
styleMask:0
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO
|
||||
screen:nil];
|
||||
self->dummy_view = [[NSView alloc] initWithFrame:frame];
|
||||
[self->dummy_window setContentView:self->dummy_view];
|
||||
[gl_context setView:self->dummy_view];
|
||||
}
|
||||
|
||||
[gl_context makeCurrentContext];
|
||||
GLint renderer_id = 0;
|
||||
[gl_context getValues:&renderer_id forParameter:NSOpenGLContextParameterCurrentRendererID];
|
||||
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)),
|
||||
@@ -237,12 +245,11 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
g_message ("Created NSOpenGLContext[%p] using %s",
|
||||
gl_context,
|
||||
get_renderer_name (renderer_id)));
|
||||
[NSOpenGLContext clearCurrentContext];
|
||||
|
||||
self->gl_context = g_steal_pointer (&gl_context);
|
||||
|
||||
if (existing != NULL)
|
||||
[GDK_MACOS_GL_CONTEXT (existing)->gl_context makeCurrentContext];
|
||||
[existing makeCurrentContext];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -257,24 +264,46 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||
|
||||
/* If begin frame is called, that means we are trying to draw to
|
||||
* the NSWindow using our view. That might be a GdkMacosCairoView
|
||||
* but we need it to be a GL view.
|
||||
* but we need it to be a GL view. Also, only in this case do we
|
||||
* want to replace our damage region for the next frame (to avoid
|
||||
* doing it multiple times).
|
||||
*/
|
||||
if (!self->is_attached &&
|
||||
gdk_gl_context_get_shared_context (GDK_GL_CONTEXT (context)))
|
||||
ensure_gl_view (self);
|
||||
{
|
||||
ensure_gl_view (self);
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
self->damage = cairo_region_copy (painted);
|
||||
|
||||
cairo_region_get_extents (painted, &self->flush_rect);
|
||||
}
|
||||
|
||||
if (self->needs_resize)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (context);
|
||||
GLint opaque;
|
||||
|
||||
self->needs_resize = FALSE;
|
||||
|
||||
if (self->dummy_view != NULL)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (context);
|
||||
GLint vals[2] = { surface->width, surface->height };
|
||||
NSRect frame = NSMakeRect (0, 0, surface->width, surface->height);
|
||||
|
||||
[self->gl_context setValues:vals forParameter:NSOpenGLContextParameterSurfaceBackingSize];
|
||||
[self->dummy_window setFrame:frame display:NO];
|
||||
[self->dummy_view setFrame:frame];
|
||||
}
|
||||
|
||||
/* Possibly update our opaque setting depending on a resize. We can
|
||||
* rely on getting a resize if decoarated is changed, so this reduces
|
||||
* how much we adjust the parameter.
|
||||
*/
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface))
|
||||
opaque = GDK_MACOS_TOPLEVEL_SURFACE (surface)->decorated;
|
||||
else
|
||||
opaque = FALSE;
|
||||
[self->gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
||||
|
||||
[self->gl_context update];
|
||||
}
|
||||
|
||||
@@ -297,27 +326,20 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkMacosGLContext *self = GDK_MACOS_GL_CONTEXT (context);
|
||||
GdkMacosSurface *surface;
|
||||
NSView *nsview;
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
|
||||
g_assert (self->gl_context != nil);
|
||||
|
||||
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (context));
|
||||
nsview = self->dummy_view ?
|
||||
self->dummy_view :
|
||||
_gdk_macos_surface_get_view (surface);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->end_frame (context, painted);
|
||||
|
||||
/* We want to limit how much gets moved to the front buffer so here
|
||||
* we adjust the clip rectangle before flushBuffer is called.
|
||||
*/
|
||||
G_STATIC_ASSERT (sizeof (GLint) == sizeof (int));
|
||||
|
||||
cairo_region_get_extents (painted, &extents);
|
||||
|
||||
[self->gl_context
|
||||
setValues:(GLint *)&extents
|
||||
setValues:(GLint *)&self->flush_rect
|
||||
forParameter:NSOpenGLCPSwapRectangle];
|
||||
|
||||
[self->gl_context flushBuffer];
|
||||
}
|
||||
|
||||
@@ -329,6 +351,21 @@ gdk_macos_gl_context_surface_resized (GdkDrawContext *draw_context)
|
||||
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
|
||||
|
||||
self->needs_resize = TRUE;
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_macos_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
|
||||
|
||||
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
|
||||
|
||||
if (self->damage != NULL)
|
||||
return cairo_region_copy (self->damage);
|
||||
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -339,17 +376,12 @@ gdk_macos_gl_context_dispose (GObject *gobject)
|
||||
if (self->dummy_view != nil)
|
||||
{
|
||||
NSView *nsview = g_steal_pointer (&self->dummy_view);
|
||||
|
||||
if (GDK_IS_MACOS_GL_VIEW (nsview))
|
||||
[(GdkMacosGLView *)nsview setOpenGLContext:nil];
|
||||
|
||||
[nsview release];
|
||||
}
|
||||
|
||||
if (self->dummy_window != nil)
|
||||
{
|
||||
NSWindow *nswindow = g_steal_pointer (&self->dummy_window);
|
||||
|
||||
[nswindow release];
|
||||
}
|
||||
|
||||
@@ -364,6 +396,8 @@ gdk_macos_gl_context_dispose (GObject *gobject)
|
||||
[gl_context release];
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_macos_gl_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
@@ -380,6 +414,7 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
|
||||
draw_context_class->end_frame = gdk_macos_gl_context_end_frame;
|
||||
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
|
||||
|
||||
gl_class->get_damage = gdk_macos_gl_context_get_damage;
|
||||
gl_class->realize = gdk_macos_gl_context_real_realize;
|
||||
}
|
||||
|
||||
@@ -412,15 +447,28 @@ _gdk_macos_gl_context_new (GdkMacosSurface *surface,
|
||||
gboolean
|
||||
_gdk_macos_gl_context_make_current (GdkMacosGLContext *self)
|
||||
{
|
||||
NSOpenGLContext *current;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE);
|
||||
|
||||
if (self->gl_context != nil)
|
||||
if (self->gl_context == NULL)
|
||||
return FALSE;
|
||||
|
||||
current = [NSOpenGLContext currentContext];
|
||||
|
||||
if (self->gl_context != current)
|
||||
{
|
||||
/* The OpenGL mac programming guide suggests that glFlush() is called
|
||||
* before switching current contexts to ensure that the drawing commands
|
||||
* are submitted.
|
||||
*/
|
||||
if (current != NULL)
|
||||
glFlush ();
|
||||
|
||||
[self->gl_context makeCurrentContext];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
@@ -112,15 +112,21 @@ gdk_macos_surface_hide (GdkSurface *surface)
|
||||
{
|
||||
GdkMacosSurface *self = (GdkMacosSurface *)surface;
|
||||
GdkSeat *seat;
|
||||
gboolean was_mapped;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
[self->window hide];
|
||||
|
||||
_gdk_surface_clear_update_area (surface);
|
||||
|
||||
if (was_mapped)
|
||||
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -256,7 +262,7 @@ gdk_macos_surface_get_device_state (GdkSurface *surface,
|
||||
| _gdk_macos_display_get_current_mouse_modifiers (GDK_MACOS_DISPLAY (display));
|
||||
|
||||
*x = point.x;
|
||||
*y = point.y - surface->height;
|
||||
*y = surface->height - point.y;
|
||||
|
||||
return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height;
|
||||
}
|
||||
@@ -361,6 +367,17 @@ gdk_macos_surface_destroy (GdkSurface *surface,
|
||||
|
||||
GdkMacosSurface *self = (GdkMacosSurface *)surface;
|
||||
GdkMacosWindow *window = g_steal_pointer (&self->window);
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
G_CALLBACK (gdk_macos_surface_before_paint),
|
||||
self);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
G_CALLBACK (gdk_macos_surface_before_paint),
|
||||
self);
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->title, g_free);
|
||||
|
||||
@@ -533,7 +550,10 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
|
||||
}
|
||||
|
||||
if (ret != NULL)
|
||||
_gdk_macos_surface_monitor_changed (ret);
|
||||
{
|
||||
gdk_surface_freeze_updates (GDK_SURFACE (ret));
|
||||
_gdk_macos_surface_monitor_changed (ret);
|
||||
}
|
||||
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
@@ -755,6 +775,7 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
|
||||
{
|
||||
_gdk_macos_surface_update_position (self);
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,24 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkMacosToplevelSurface GdkMacosToplevelSurface;
|
||||
typedef struct _GdkMacosToplevelSurfaceClass GdkMacosToplevelSurfaceClass;
|
||||
|
||||
#define GDK_TYPE_MACOS_TOPLEVEL_SURFACE (_gdk_macos_toplevel_surface_get_type())
|
||||
#define GDK_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MACOS_TOPLEVEL_SURFACE, GdkMacosToplevelSurface))
|
||||
#define GDK_IS_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_TOPLEVEL_SURFACE))
|
||||
|
||||
typedef struct _GdkMacosToplevelSurface GdkMacosToplevelSurface;
|
||||
typedef struct _GdkMacosToplevelSurfaceClass GdkMacosToplevelSurfaceClass;
|
||||
|
||||
struct _GdkMacosToplevelSurface
|
||||
{
|
||||
GdkMacosSurface parent_instance;
|
||||
guint decorated : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosToplevelSurfaceClass
|
||||
{
|
||||
GdkMacosSurfaceClass parent_instance;
|
||||
};
|
||||
|
||||
GType _gdk_macos_toplevel_surface_get_type (void);
|
||||
GdkMacosSurface *_gdk_macos_toplevel_surface_new (GdkMacosDisplay *display,
|
||||
GdkSurface *parent,
|
||||
|
||||
@@ -29,17 +29,6 @@
|
||||
#include "gdkmacostoplevelsurface-private.h"
|
||||
#include "gdkmacosutils-private.h"
|
||||
|
||||
struct _GdkMacosToplevelSurface
|
||||
{
|
||||
GdkMacosSurface parent_instance;
|
||||
guint decorated : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosToplevelSurfaceClass
|
||||
{
|
||||
GdkMacosSurfaceClass parent_instance;
|
||||
};
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_fullscreen (GdkMacosToplevelSurface *self)
|
||||
{
|
||||
@@ -111,6 +100,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
|
||||
|
||||
_gdk_macos_toplevel_surface_attach_to_parent (self);
|
||||
|
||||
style_mask = [nswindow styleMask];
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
@@ -185,6 +176,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
}
|
||||
else
|
||||
{
|
||||
[nswindow setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
|
||||
|
||||
if (!self->decorated &&
|
||||
!GDK_MACOS_SURFACE (self)->did_initial_present &&
|
||||
GDK_SURFACE (self)->x == 0 &&
|
||||
|
||||
@@ -34,7 +34,20 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
GAppInfo *info,
|
||||
GList *files)
|
||||
{
|
||||
return NULL;
|
||||
GdkWaylandDisplay *display;
|
||||
gchar *id = NULL;
|
||||
|
||||
g_object_get (context, "display", &display, NULL);
|
||||
|
||||
if (display->gtk_shell_version >= 3)
|
||||
{
|
||||
id = g_uuid_string_random ();
|
||||
gtk_shell1_notify_launch (display->gtk_shell, id);
|
||||
}
|
||||
|
||||
g_object_unref (display);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
#define MIN_SYSTEM_BELL_DELAY_MS 20
|
||||
|
||||
#define GTK_SHELL1_VERSION 2
|
||||
#define GTK_SHELL1_VERSION 3
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
|
||||
@@ -1076,6 +1076,8 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
/**
|
||||
* gdk_wayland_display_set_cursor_theme:
|
||||
* @display: (type GdkWaylandDisplay): a #GdkDisplay
|
||||
* @name: the new cursor theme
|
||||
* @size: the size to use for cursors
|
||||
*
|
||||
* Sets the cursor theme for the given @display.
|
||||
*/
|
||||
|
||||
@@ -1270,6 +1270,7 @@ configure_surface_geometry (GdkSurface *surface)
|
||||
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
g_object_unref (monitor);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
|
||||
@@ -1765,6 +1766,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
|
||||
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
xdg_toplevel_set_maximized (impl->display_server.xdg_toplevel);
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_MINIMIZED)
|
||||
xdg_toplevel_set_minimized (impl->display_server.xdg_toplevel);
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
||||
xdg_toplevel_set_fullscreen (impl->display_server.xdg_toplevel,
|
||||
impl->initial_fullscreen_output);
|
||||
@@ -1772,6 +1775,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
|
||||
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
zxdg_toplevel_v6_set_maximized (impl->display_server.zxdg_toplevel_v6);
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_MINIMIZED)
|
||||
zxdg_toplevel_v6_set_minimized (impl->display_server.zxdg_toplevel_v6);
|
||||
if (surface->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
||||
zxdg_toplevel_v6_set_fullscreen (impl->display_server.zxdg_toplevel_v6,
|
||||
impl->initial_fullscreen_output);
|
||||
@@ -2798,6 +2803,7 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
}
|
||||
|
||||
impl->has_uncommitted_ack_configure = FALSE;
|
||||
impl->input_region_dirty = TRUE;
|
||||
|
||||
unset_transient_for_exported (surface);
|
||||
|
||||
@@ -3230,14 +3236,20 @@ gdk_wayland_surface_focus (GdkSurface *surface,
|
||||
if (!impl->display_server.gtk_surface)
|
||||
return;
|
||||
|
||||
/* We didn't have an event to fetch a time from, meaning we have nothing valid
|
||||
* to send. This should rather be translated to a 'needs-attention' request or
|
||||
* something.
|
||||
*/
|
||||
if (timestamp == GDK_CURRENT_TIME)
|
||||
return;
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
|
||||
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
|
||||
if (display_wayland->gtk_shell_version >= 3)
|
||||
{
|
||||
gtk_surface1_request_focus (impl->display_server.gtk_surface,
|
||||
display_wayland->startup_notification_id);
|
||||
g_clear_pointer (&display_wayland->startup_notification_id, g_free);
|
||||
}
|
||||
}
|
||||
else
|
||||
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3539,6 +3551,9 @@ gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
|
||||
static void
|
||||
gdk_wayland_surface_minimize (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) ||
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
@@ -3546,13 +3561,9 @@ gdk_wayland_surface_minimize (GdkSurface *surface)
|
||||
if (!is_realized_toplevel (GDK_WAYLAND_SURFACE (surface)))
|
||||
return;
|
||||
|
||||
#if 0
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
/* We cannot use set_minimized() because it does not come with a
|
||||
* minimized state that we can query or get notified of. This means
|
||||
* we cannot implement the full GdkSurface API
|
||||
/* FIXME: xdg_toplevel does not come with a minimized state that we can
|
||||
* query or get notified of. This means we cannot implement the full
|
||||
* GdkSurface API, and our state will not reflect minimization.
|
||||
*/
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
switch (display_wayland->shell_variant)
|
||||
@@ -3566,7 +3577,6 @@ gdk_wayland_surface_minimize (GdkSurface *surface)
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -51,7 +51,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *theme,
|
||||
const char *name,
|
||||
int size);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char * gdk_wayland_display_get_startup_notification_id (GdkDisplay *display);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<protocol name="gtk">
|
||||
|
||||
<interface name="gtk_shell1" version="2">
|
||||
<interface name="gtk_shell1" version="3">
|
||||
<description summary="gtk specific extensions">
|
||||
gtk_shell is a protocol extension providing additional features for
|
||||
clients implementing it.
|
||||
@@ -28,9 +28,14 @@
|
||||
<request name="system_bell">
|
||||
<arg name="surface" type="object" interface="gtk_surface1" allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
<request name="notify_launch" since="3">
|
||||
<arg name="startup_id" type="string"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="gtk_surface1" version="2">
|
||||
<interface name="gtk_surface1" version="3">
|
||||
<request name="set_dbus_properties">
|
||||
<arg name="application_id" type="string" allow-null="true"/>
|
||||
<arg name="app_menu_path" type="string" allow-null="true"/>
|
||||
@@ -72,6 +77,11 @@
|
||||
<event name="configure_edges" since="2">
|
||||
<arg name="constraints" type="array"/>
|
||||
</event>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
<request name="request_focus" since="3">
|
||||
<arg name="startup_id" type="string" allow-null="true"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user