Compare commits
567 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a488be07a7 | |||
| 7d84cd8020 | |||
| 5fcc8b62ec | |||
| 1b61cc91bb | |||
| c65b978ac6 | |||
| 798234a776 | |||
| e75a27354c | |||
| 3b79ad1e7e | |||
| 1b57e5ac80 | |||
| 5aaa4cc452 | |||
| 56022d3a58 | |||
| 3f356d0b59 | |||
| dced4a4796 | |||
| 256d537242 | |||
| 2c2ee6a27a | |||
| eed54eac7a | |||
| 098c402a97 | |||
| b87095330a | |||
| 1037fc8387 | |||
| 3fc0df814c | |||
| ae552b3064 | |||
| 12d9d71449 | |||
| 7772e4f925 | |||
| 88055f62c5 | |||
| 4c7f009cc1 | |||
| 7c084b78f6 | |||
| e207e1ee9d | |||
| 598e14868c | |||
| ae09d17590 | |||
| d2e8c639ca | |||
| 06f0ab7e8f | |||
| 0d1fd1ce72 | |||
| d18ecca089 | |||
| 47560f8369 | |||
| 260be0300e | |||
| dca9fb5801 | |||
| f2012c6185 | |||
| cc43dee619 | |||
| 78f3d86a25 | |||
| 3869e4a818 | |||
| 7a6b489dc6 | |||
| 282c065b77 | |||
| 1f0622b27e | |||
| 0a85189e04 | |||
| 3301a1af0b | |||
| 245479f71d | |||
| d92b659d02 | |||
| 7bee50c4f6 | |||
| bad2324318 | |||
| dd15accb79 | |||
| 1d1f35576a | |||
| 15458b5af3 | |||
| 5ffe9a68ed | |||
| f341bd563b | |||
| 70edacc68d | |||
| 091176ae48 | |||
| d9cfb94a80 | |||
| 3c7ca28f1f | |||
| 25e518326c | |||
| a853307fb7 | |||
| 0ae541671d | |||
| ef0d6c7290 | |||
| 2217509701 | |||
| 16e46a73f3 | |||
| 526771751f | |||
| dfa6591675 | |||
| 6252517aac | |||
| 51e440fa03 | |||
| d82fb6f20a | |||
| 44de6a6cbe | |||
| 64e27cd87d | |||
| 60e75f8a2a | |||
| 57eda94dde | |||
| 723fb6c8be | |||
| 6c85ed1ba1 | |||
| 2e58274f23 | |||
| 4ade0afe03 | |||
| 93fb45c689 | |||
| 684a015c98 | |||
| f7fcd2e425 | |||
| c6c637fe21 | |||
| 33fc4d6495 | |||
| 33ff927522 | |||
| 2d39cdbff8 | |||
| 8d675810e8 | |||
| 8b25481c26 | |||
| 5fdf96f496 | |||
| b61991a023 | |||
| 91d302a201 | |||
| 35a1a62d50 | |||
| ac7a4cb94c | |||
| bacd7ef92f | |||
| 980dc44f4a | |||
| 2d648f84a9 | |||
| aef0943f61 | |||
| 3e146171cb | |||
| 24bbaceaa4 | |||
| 318cf132e9 | |||
| 8bbc143ed1 | |||
| 220d130c0f | |||
| e28a32a7c7 | |||
| 88f8b77d77 | |||
| 1066374909 | |||
| 34a2595dfb | |||
| 76fcd5cf25 | |||
| 32e6ed4eca | |||
| 2983c0be70 | |||
| e0bf6585de | |||
| c045b0be4c | |||
| d8c094944a | |||
| 510bf86268 | |||
| f3bea027a0 | |||
| bce3b6f34a | |||
| 01274dfbb9 | |||
| 533a2cf9ec | |||
| 5dbc5bbf22 | |||
| 79c999cf76 | |||
| e375bc8838 | |||
| 79505f940b | |||
| 0f087deb2a | |||
| e245883f91 | |||
| 4e9bd13892 | |||
| 65e9b8fe66 | |||
| e9f870fee6 | |||
| e5e5966934 | |||
| 5c407365e3 | |||
| 7e251d81c2 | |||
| 92d1d52c59 | |||
| ef436e4dce | |||
| 1a07e336bf | |||
| 169355f771 | |||
| 299c6a3d6f | |||
| 17698bfd2e | |||
| 377592cb62 | |||
| 015cebc046 | |||
| 0a5e5023a8 | |||
| a9b8ad6181 | |||
| 7331683c01 | |||
| cca6a66518 | |||
| 891462e5af | |||
| 95cd6fe206 | |||
| 63534fd9eb | |||
| e836e3380e | |||
| f693beab57 | |||
| 2d2df42a94 | |||
| fb0a4fa457 | |||
| be0003c108 | |||
| eb1e24a5bf | |||
| a3e98558d3 | |||
| f2b682dd9c | |||
| b826ef4f4d | |||
| a2fdeb99e0 | |||
| df8d28f5fe | |||
| 838c51cc92 | |||
| 315ded687c | |||
| 6855346269 | |||
| c2d6f900d9 | |||
| 85c2d5f14e | |||
| b3eb912cf3 | |||
| 81d9205369 | |||
| 152a335cee | |||
| b84650c2a3 | |||
| 722bea2943 | |||
| 6c337b949d | |||
| db97a35dc7 | |||
| c2fda63b0d | |||
| 5da64e9e34 | |||
| 3f360aa883 | |||
| a444045386 | |||
| 584a807ed6 | |||
| 72e5697804 | |||
| 93aff8a129 | |||
| c3cfaab479 | |||
| 663e3d0811 | |||
| 2dc35ec0c1 | |||
| a791f235e6 | |||
| 7df9cc1b47 | |||
| 4449344fad | |||
| e1c9f50d26 | |||
| 1f029229dc | |||
| a80dd28e35 | |||
| 16077fbdac | |||
| 1906bb5263 | |||
| a8b907a33c | |||
| f2a2e97004 | |||
| a86923de94 | |||
| 4412f25c9f | |||
| c40588886b | |||
| 4045a0edd1 | |||
| 636591c080 | |||
| aa6c670f15 | |||
| 746d0d8fde | |||
| 35b09c727a | |||
| c35f491795 | |||
| 5b64ca7e0a | |||
| d61737ac7a | |||
| ba28971a18 | |||
| 7b4846bc25 | |||
| eb3ccfb404 | |||
| e4c37ceb34 | |||
| dae1e2b117 | |||
| 49c2366121 | |||
| 76efe45552 | |||
| 1489c764cb | |||
| d5a6d09348 | |||
| ae89f6e6c0 | |||
| 63edecd857 | |||
| 515e1642a4 | |||
| 177ee89b99 | |||
| 94f5d2db0d | |||
| d562c86638 | |||
| 64ff528fe1 | |||
| 5993a2a16e | |||
| ff20b3f303 | |||
| 05ea3470e5 | |||
| 28e1f288c3 | |||
| 8d9a59f698 | |||
| 60a170db88 | |||
| 32550fd6fc | |||
| 12fb249dc6 | |||
| c3904e8a27 | |||
| 799fd4f4a3 | |||
| 090cd2238a | |||
| 8b8dfcdfb4 | |||
| 9015ed1c43 | |||
| 1a6d60b7d7 | |||
| 603d9e091c | |||
| 743b27571d | |||
| 30c38951b9 | |||
| 11d7052a40 | |||
| 48d719e58e | |||
| 5ec0b07baf | |||
| 343b9d246f | |||
| de622c592d | |||
| c2735f98b4 | |||
| 7669198d2c | |||
| 6bf4ad866f | |||
| d705a7effa | |||
| 407304f2ed | |||
| 21fa1d67ce | |||
| a9f8ec71a4 | |||
| caa8fb4fac | |||
| d59fc3da3c | |||
| cbdcf64e4d | |||
| e251e7583f | |||
| 158a3d4f04 | |||
| efeff41501 | |||
| 80c4d4f51d | |||
| 115f60796f | |||
| 7e62bdbf26 | |||
| 16bdaa11ce | |||
| 46afb4a9a4 | |||
| 775e8dc43d | |||
| cc603bf657 | |||
| 0652e05e0b | |||
| 1347d23658 | |||
| 3cf349eb6e | |||
| 53503e3f19 | |||
| 8106dc0f46 | |||
| 8dec07b6c4 | |||
| 29cf15a444 | |||
| abe5eda0f0 | |||
| fa98e2baf3 | |||
| e5eba26eac | |||
| 611439aad7 | |||
| cb3045bf38 | |||
| 447d1fab62 | |||
| 9836389fde | |||
| 7f26f5a160 | |||
| 6a009b7182 | |||
| 17dd100f43 | |||
| 49c2c2da1a | |||
| f88b1cef21 | |||
| c27e412ff1 | |||
| 0c72f19cb1 | |||
| cb4e92946b | |||
| e7c86f4608 | |||
| 4d026857dc | |||
| c523c68cef | |||
| 9f4320a4ac | |||
| 8f6cc19fdb | |||
| 9831632fbd | |||
| bef1c69254 | |||
| f381cdef5b | |||
| f8fd04402e | |||
| e5f570045e | |||
| 4bee0e2454 | |||
| fb6ce30fb4 | |||
| 11108ed048 | |||
| deac44962a | |||
| 0f6219c9ca | |||
| cf980cdefb | |||
| 51265e2367 | |||
| f1484df60a | |||
| 92a8cf3f29 | |||
| 5a877c8d43 | |||
| 1ffaf486af | |||
| 9c3e514d3f | |||
| 1b829c7d01 | |||
| 0f39069be1 | |||
| bc27b54367 | |||
| 9e784f47c9 | |||
| ade66c84ed | |||
| 57c34fca96 | |||
| 10e91f6281 | |||
| aada893352 | |||
| 79847f20c4 | |||
| 22548785b0 | |||
| 2349f13f45 | |||
| 084b4361b6 | |||
| d0ebd42e3e | |||
| a4330aae38 | |||
| a02fc2d290 | |||
| 9df935591c | |||
| 1f8045ddbe | |||
| 82ba8c848b | |||
| cf48f83709 | |||
| 9d79982677 | |||
| 27599d688e | |||
| c0d8716366 | |||
| 3681144768 | |||
| c2fef6f6fd | |||
| f06cfa2967 | |||
| 2cbee7cf86 | |||
| f5cdd6fa32 | |||
| c49c971f47 | |||
| 4746e0bdc4 | |||
| f20ef5a0fc | |||
| cf30a4f304 | |||
| ca189cb5f5 | |||
| 5e07710f5a | |||
| 46bb5837e2 | |||
| 1888f1e422 | |||
| e606313ad1 | |||
| b69bfe3799 | |||
| 5d07c71dd2 | |||
| 8155b08de8 | |||
| 0790f24773 | |||
| 5f02631812 | |||
| c8133ecb50 | |||
| b439398d09 | |||
| fcb9048043 | |||
| 5816e2fe51 | |||
| 298fed6d94 | |||
| 0557b29f5b | |||
| 4c65bdf707 | |||
| 351d747909 | |||
| 53af7208e6 | |||
| c67f3c5038 | |||
| 1bee1cd180 | |||
| e77a17b227 | |||
| d8b4249ee9 | |||
| da47d9cc3d | |||
| 53bebd2ed1 | |||
| ca9f0abdd8 | |||
| 8497f97dec | |||
| f22788a3a8 | |||
| a30e0fad1f | |||
| f033b6c2c6 | |||
| 45656ba426 | |||
| 83efe2b66c | |||
| 84840f1f2e | |||
| 2883f4b7a2 | |||
| 0a0f0d9e7e | |||
| e3cc3f7841 | |||
| d1135f9e3c | |||
| 2d89dfea29 | |||
| 89f20c2fb6 | |||
| c019eb9eea | |||
| 216e415186 | |||
| 28fb91e85e | |||
| 7f3d4fa66e | |||
| 0505c8fac9 | |||
| ccb7c9057a | |||
| ac6f18da12 | |||
| 0d7069452b | |||
| 5aa62b6273 | |||
| 41d03c68f8 | |||
| 30ff352960 | |||
| 2adc017048 | |||
| d1aae4bffa | |||
| 434a747d42 | |||
| 50cf1c08dd | |||
| caaeaedf1f | |||
| 19362522e0 | |||
| 50c3ea064b | |||
| 84e345adac | |||
| d2638f0955 | |||
| e580dcf18d | |||
| 14e44f36bf | |||
| 1e60ad1430 | |||
| 2c67d9f7cf | |||
| 4bcaeab4dc | |||
| 97a4cc301a | |||
| baaa748248 | |||
| cf69fecc87 | |||
| 29ad2c1247 | |||
| 1450789052 | |||
| 51f4ad55cf | |||
| 94d65f6ef1 | |||
| c3f446a95a | |||
| ad8e5c3a39 | |||
| 6b26a4f9be | |||
| 40f215ea46 | |||
| 55dd5f4780 | |||
| 1e878d3928 | |||
| 66c57a8f4e | |||
| ee22f8f52f | |||
| 9070c457d6 | |||
| bba324ce30 | |||
| c322ab34c7 | |||
| 8c5e046574 | |||
| 8860a2a688 | |||
| 5ca40c3660 | |||
| a9f9fb2022 | |||
| a8a49d270b | |||
| 419c431f29 | |||
| fd5d15004e | |||
| 5409f0b350 | |||
| f1b1aacc34 | |||
| e7201968d6 | |||
| 67f2ad817e | |||
| f420c143e0 | |||
| 1cf6dfab2f | |||
| 330a8b1cdb | |||
| 8d19db6732 | |||
| 0f1b039306 | |||
| b791aa0301 | |||
| 7fd94c1828 | |||
| dd4c1167b2 | |||
| d411912396 | |||
| 0e93ad8671 | |||
| d98991a0ad | |||
| 1f7dcc1286 | |||
| 328cdf7b2a | |||
| 79a227bc64 | |||
| 0fee26252c | |||
| d48b6b9ad5 | |||
| d4618ea8a6 | |||
| a73530f952 | |||
| 3e620a8fe5 | |||
| 6d8c8199d9 | |||
| 968ceb71d5 | |||
| 7f5504bea4 | |||
| 4b2b239550 | |||
| 23c10d434c | |||
| 87c9503293 | |||
| 76634cb68b | |||
| 52eefdb7d9 | |||
| ea9f0a3372 | |||
| 8561ff37c4 | |||
| a09580b9ef | |||
| 0511227379 | |||
| 4183ce0b52 | |||
| 57222cc64c | |||
| b3c1284382 | |||
| b02e054592 | |||
| 870ee06d1f | |||
| 8d586be693 | |||
| 94ab11b999 | |||
| 9b1dcd3872 | |||
| c37171f4d6 | |||
| c479f93372 | |||
| 186e056c56 | |||
| d8b9c3ae96 | |||
| 5de6f12e88 | |||
| 5422c12577 | |||
| bb145b9bc1 | |||
| a55fda0b49 | |||
| 5b93a32f90 | |||
| 495ee1be3d | |||
| 7f1bd1f047 | |||
| da147dca92 | |||
| 8ba5ff98aa | |||
| 34f4493c36 | |||
| 314923d4b5 | |||
| d2f45dae96 | |||
| 0e31cf9542 | |||
| af901a10e3 | |||
| 3d1a607367 | |||
| 1be21a33d9 | |||
| 64bcdb713c | |||
| 4a868736f9 | |||
| cfeaa0ac72 | |||
| b44ef07e22 | |||
| 7f119b5ad2 | |||
| d427933c61 | |||
| 85bafbdff0 | |||
| 7ae7356284 | |||
| 444d5fa500 | |||
| c380d17621 | |||
| 686d18dfc2 | |||
| 0a1702ae99 | |||
| 0016fea36b | |||
| 7ef46293aa | |||
| 6b59c138b2 | |||
| b7e3a231b4 | |||
| c8c895d160 | |||
| acbd7f212e | |||
| f2a2889153 | |||
| a4ae215309 | |||
| fa16ba12cf | |||
| ec2421b187 | |||
| 1fce2b1e06 | |||
| 38bf843de8 | |||
| 7b8a5235d4 | |||
| 3c9b3ead6f | |||
| 1549ec5f9b | |||
| 4339e8e464 | |||
| 39f4d5ccf7 | |||
| 957fa87fce | |||
| e8bdd46d8d | |||
| d03b27b441 | |||
| f4cbe26af3 | |||
| 24af4b48cc | |||
| 1c8caf745f | |||
| 395d80f131 | |||
| 74229572e7 | |||
| cbb3d3f177 | |||
| 8861d0eb53 | |||
| a23bc894e9 | |||
| 156e25b6aa | |||
| 96f6787a3e | |||
| cc665f29ea | |||
| 8d2047c824 | |||
| a79da8b655 | |||
| f29c7e76f5 | |||
| 29867e7ae1 | |||
| 876b439d4a | |||
| 4f6d7c69a1 | |||
| 2bf2635635 | |||
| 67ed09f5ae | |||
| 1c72f46eed | |||
| f5e7a1d4cc | |||
| 0f61c52593 | |||
| a4bae6a62d | |||
| d141ac5adf | |||
| 894a4bda85 | |||
| 2b88505ca4 | |||
| ef8c835762 | |||
| 50115d70c6 | |||
| 1a058a41c9 | |||
| be4f6ff3da | |||
| 4fcf899852 | |||
| 371e860184 | |||
| bce1e0bfdd | |||
| 468d2cb7f2 | |||
| b520a5ceda | |||
| e6bc82cff5 | |||
| d021aa7bd2 | |||
| 3dc3d03a08 | |||
| 788bd575d6 | |||
| 94a2dc4c47 | |||
| 169a7f83e6 | |||
| 703494c7fa | |||
| d642072603 | |||
| ab7a4f64cb | |||
| 21c53a1969 | |||
| ae2dd1d907 | |||
| f10c234361 | |||
| 3a650bff66 | |||
| e9f622b81f | |||
| a85ad2ce67 | |||
| 2af7e45860 | |||
| cf79ad4433 | |||
| f254ab700c | |||
| cfef21501c |
+15
-5
@@ -222,7 +222,7 @@ macos:
|
|||||||
-Dcpp_std=c++11
|
-Dcpp_std=c++11
|
||||||
-Dpixman:tests=disabled
|
-Dpixman:tests=disabled
|
||||||
-Dlibjpeg-turbo:simd=disabled
|
-Dlibjpeg-turbo:simd=disabled
|
||||||
-Ddemos=false
|
-Dbuild-demos=false
|
||||||
-Dbuild-tests=false
|
-Dbuild-tests=false
|
||||||
-Dbuild-examples=false
|
-Dbuild-examples=false
|
||||||
-Dbuild-testsuite=false
|
-Dbuild-testsuite=false
|
||||||
@@ -385,17 +385,27 @@ asan-build:
|
|||||||
tags: [ asan ]
|
tags: [ asan ]
|
||||||
stage: analysis
|
stage: analysis
|
||||||
needs: []
|
needs: []
|
||||||
when: manual
|
|
||||||
variables:
|
variables:
|
||||||
script:
|
script:
|
||||||
- export PATH="$HOME/.local/bin:$PATH"
|
- export PATH="$HOME/.local/bin:$PATH"
|
||||||
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
|
- CC=clang meson setup
|
||||||
|
--buildtype=debugoptimized
|
||||||
|
-Db_sanitize=address
|
||||||
|
-Db_lundef=false
|
||||||
|
-Dbuild-demos=false
|
||||||
|
-Dbuild-tests=false
|
||||||
|
-Dbuild-examples=false
|
||||||
|
-Dintrospection=disabled
|
||||||
|
-Df16c=disabled
|
||||||
|
_build
|
||||||
- ninja -C _build
|
- ninja -C _build
|
||||||
- .gitlab-ci/run-tests.sh _build wayland
|
- .gitlab-ci/run-tests.sh _build wayland
|
||||||
|
- .gitlab-ci/run-tests.sh _build wayland_gles
|
||||||
|
- .gitlab-ci/run-tests.sh _build x11
|
||||||
artifacts:
|
artifacts:
|
||||||
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- _build/meson-logs
|
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
reference:
|
reference:
|
||||||
image: $FEDORA_IMAGE
|
image: $FEDORA_IMAGE
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ flatpak build ${builddir} meson \
|
|||||||
-Dbuild-testsuite=false \
|
-Dbuild-testsuite=false \
|
||||||
-Dbuild-examples=false \
|
-Dbuild-examples=false \
|
||||||
-Dintrospection=disabled \
|
-Dintrospection=disabled \
|
||||||
-Ddemos=true \
|
-Dbuild-demos=true \
|
||||||
-Dprofile=devel \
|
-Ddemo-profile=devel \
|
||||||
_flatpak_build
|
_flatpak_build
|
||||||
|
|
||||||
flatpak build ${builddir} ninja -C _flatpak_build install
|
flatpak build ${builddir} ninja -C _flatpak_build install
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ backend=$2
|
|||||||
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
||||||
|
|
||||||
# Ignore memory leaks lower in dependencies
|
# Ignore memory leaks lower in dependencies
|
||||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
|
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
|
||||||
export G_SLICE=always-malloc
|
export G_SLICE=always-malloc
|
||||||
|
|
||||||
case "${backend}" in
|
case "${backend}" in
|
||||||
|
|||||||
@@ -1,4 +1,86 @@
|
|||||||
Overview of Changes in 4.11.3, xx-xx-xxxx
|
Overview of Changes in 4.11.4, xx-xx-xxxx
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
* GtkFileChooser:
|
||||||
|
- Default to sorting folders first
|
||||||
|
- Fix a crash when visiting recent files
|
||||||
|
|
||||||
|
* GtkTextView:
|
||||||
|
- Fix corner cases in word navigation
|
||||||
|
|
||||||
|
* GtkMenuButton:
|
||||||
|
- Normalize label layout
|
||||||
|
|
||||||
|
* GtkDropDown:
|
||||||
|
- Add support for sections
|
||||||
|
|
||||||
|
* GtkVideo:
|
||||||
|
- Make the overlay icon clickable
|
||||||
|
|
||||||
|
* GtkWindow:
|
||||||
|
- Clear the resize cursors to avoid artifacts
|
||||||
|
|
||||||
|
* GtkFileDialog:
|
||||||
|
- Always set initial-folder
|
||||||
|
|
||||||
|
* GtkDropDown:
|
||||||
|
- Update on expression changes
|
||||||
|
|
||||||
|
* Accessibility:
|
||||||
|
- Improvements all over the place: GtkButton, GtkPasswordEntry,
|
||||||
|
GtkFontChooserDialog, GtkColorChooserDialog, GtkShortcutsWindow,
|
||||||
|
GtkMenuButton, GtkAboutDialog, GtkFileChooserDialog, GtkStackSidebar,
|
||||||
|
GtkStackSwitcher, GtkMediaControls, GtkColorDialogButton, GtkDropDown,
|
||||||
|
GtkInfoBar, GtkNotebook, GtkPrintUnixDialog, GtkModelButton
|
||||||
|
- Make name computation follow the ARIA spec more closely
|
||||||
|
- Adapt name computation for the common 'nested button' scenario
|
||||||
|
- Change many containers to use `generic` instead of `group`
|
||||||
|
- Use `generic` as the default role
|
||||||
|
- Use `application` instead of `window` for windows
|
||||||
|
- Add properties for accessible names of not directly exposed
|
||||||
|
widgets in GtkListView, GtkGridView and GtkColumnView
|
||||||
|
|
||||||
|
* DND:
|
||||||
|
- Fix criticals when drops are rejected
|
||||||
|
|
||||||
|
* X11:
|
||||||
|
- Fix regressions in GLX setup
|
||||||
|
|
||||||
|
* Windows:
|
||||||
|
- Center newly created transient windows
|
||||||
|
|
||||||
|
* Vulkan:
|
||||||
|
- Add antialising for gradients
|
||||||
|
- Do less work on clipped away nodes
|
||||||
|
- Redo image uploading
|
||||||
|
- Support different image depths and formats
|
||||||
|
- Add a pipeline cache
|
||||||
|
|
||||||
|
* Demos:
|
||||||
|
- gtk4-demo: Improve window sizing
|
||||||
|
- gtk4-demo: Improve focus behavior
|
||||||
|
- gtk4-demo: Add many missing a11y properties
|
||||||
|
|
||||||
|
* Tools:
|
||||||
|
- gtk4-builder-tool: Make render an alias screenshot
|
||||||
|
|
||||||
|
* Inspector:
|
||||||
|
- Show more information in the a11y tab
|
||||||
|
- Add an accessibility overlay with warnings and recommendations
|
||||||
|
- Limit the width of the a11y tab
|
||||||
|
|
||||||
|
* Build:
|
||||||
|
- Require GLib 2.76
|
||||||
|
- Make asan builds work again
|
||||||
|
|
||||||
|
* Translation updates:
|
||||||
|
Brazilian Portuguese
|
||||||
|
Catalan
|
||||||
|
Czech
|
||||||
|
Georgian
|
||||||
|
|
||||||
|
|
||||||
|
Overview of Changes in 4.11.3, 05-06-2023
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
* GtkGridView:
|
* GtkGridView:
|
||||||
@@ -8,6 +90,9 @@ Overview of Changes in 4.11.3, xx-xx-xxxx
|
|||||||
* GtkListView:
|
* GtkListView:
|
||||||
- Don't leak the factories
|
- Don't leak the factories
|
||||||
|
|
||||||
|
* GtkColumnView:
|
||||||
|
- Support displaying sections
|
||||||
|
|
||||||
* GtkNotebook:
|
* GtkNotebook:
|
||||||
- Make the pages model implement GtkSelectionModel
|
- Make the pages model implement GtkSelectionModel
|
||||||
|
|
||||||
@@ -17,18 +102,41 @@ Overview of Changes in 4.11.3, xx-xx-xxxx
|
|||||||
* GtkPopoverMenu:
|
* GtkPopoverMenu:
|
||||||
- Avoid unnecessary left padding
|
- Avoid unnecessary left padding
|
||||||
|
|
||||||
* Css:
|
* GtkSearchEntry:
|
||||||
|
- Improve size allocation for the clear icon
|
||||||
|
|
||||||
|
* GtkBoxLayout:
|
||||||
|
- Fix a regression from recent baseline work
|
||||||
|
|
||||||
|
* CSS:
|
||||||
- Add new binding-friendly css provider apis
|
- Add new binding-friendly css provider apis
|
||||||
|
|
||||||
* Theme:
|
* Theme:
|
||||||
- Show focus in the shortcuts window
|
- Show focus in the shortcuts window
|
||||||
|
|
||||||
* Tests:
|
* GDK:
|
||||||
- Improve test coverage
|
- Support grayscale and alpha texture formats for loading
|
||||||
|
and saving to png and tiff, and in GL
|
||||||
|
- Fix some regressions in GL context initialization
|
||||||
|
|
||||||
|
* GSK:
|
||||||
|
- Support grayscale and alpha texture formats in the GL renderer
|
||||||
|
- Support straight alpha textures in the GL renderer
|
||||||
|
- Many improvements to the experimental Vulkan renderer
|
||||||
|
|
||||||
* Wayland:
|
* Wayland:
|
||||||
- Make exporting surface handles more flexible
|
- Make exporting surface handles more flexible
|
||||||
|
|
||||||
|
* X11:
|
||||||
|
- Trap XRandr errors
|
||||||
|
- Stop using passive grabs during DND
|
||||||
|
|
||||||
|
* Windows:
|
||||||
|
- Many cleanups and simplifications
|
||||||
|
|
||||||
|
* Tests:
|
||||||
|
- Improve test coverage
|
||||||
|
|
||||||
* Build:
|
* Build:
|
||||||
- Some build options have been renamed:
|
- Some build options have been renamed:
|
||||||
demos -> build-demos
|
demos -> build-demos
|
||||||
@@ -48,7 +156,9 @@ Overview of Changes in 4.11.3, xx-xx-xxxx
|
|||||||
* Translation updates:
|
* Translation updates:
|
||||||
Basque
|
Basque
|
||||||
Catalan
|
Catalan
|
||||||
|
Georgian
|
||||||
Russian
|
Russian
|
||||||
|
Turkish
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.11.2, 09-05-2023
|
Overview of Changes in 4.11.2, 09-05-2023
|
||||||
|
|||||||
@@ -162,6 +162,10 @@ create_page4 (GtkWidget *assistant)
|
|||||||
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
|
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
|
||||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
|
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
|
||||||
|
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (progress_bar),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Applying changes",
|
||||||
|
-1);
|
||||||
|
|
||||||
/* This prevents the assistant window from being
|
/* This prevents the assistant window from being
|
||||||
* closed while we're "busy" applying changes.
|
* closed while we're "busy" applying changes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
<object class="GtkWindow" id="window">
|
<object class="GtkWindow" id="window">
|
||||||
<property name="resizable">1</property>
|
<property name="resizable">1</property>
|
||||||
<property name="title">Clipboard</property>
|
<property name="title">Clipboard</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="described-by">label</relation>
|
||||||
|
</accessibility>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
@@ -13,7 +16,7 @@
|
|||||||
<property name="margin-bottom">12</property>
|
<property name="margin-bottom">12</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="label">
|
||||||
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
|
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
<property name="max-width-chars">40</property>
|
<property name="max-width-chars">40</property>
|
||||||
@@ -24,6 +27,9 @@
|
|||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDropDown" id="source_chooser">
|
<object class="GtkDropDown" id="source_chooser">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Source Type</property>
|
||||||
|
</accessibility>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
@@ -54,6 +60,9 @@
|
|||||||
<property name="name">Text</property>
|
<property name="name">Text</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkEntry" id="source_text">
|
<object class="GtkEntry" id="source_text">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Text Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<signal name="notify::text" handler="text_changed_cb" object="copy_button"/>
|
<signal name="notify::text" handler="text_changed_cb" object="copy_button"/>
|
||||||
<property name="text">Copy this!</property>
|
<property name="text">Copy this!</property>
|
||||||
@@ -66,6 +75,9 @@
|
|||||||
<property name="name">Color</property>
|
<property name="name">Color</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkColorDialogButton" id="source_color">
|
<object class="GtkColorDialogButton" id="source_color">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Color Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<property name="dialog">
|
<property name="dialog">
|
||||||
<object class="GtkColorDialog">
|
<object class="GtkColorDialog">
|
||||||
</object>
|
</object>
|
||||||
@@ -87,14 +99,17 @@
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="image_rose">
|
<object class="GtkToggleButton" id="image_rose">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Photo Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDragSource">
|
|
||||||
<signal name="prepare" handler="drag_prepare"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Portland Rose Photo</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="large-icons"/>
|
<class name="large-icons"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -105,6 +120,9 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="image_floppy">
|
<object class="GtkToggleButton" id="image_floppy">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Icon Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<property name="group">image_rose</property>
|
<property name="group">image_rose</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDragSource">
|
<object class="GtkDragSource">
|
||||||
@@ -113,6 +131,9 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Floppy Buddy Icon</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="large-icons"/>
|
<class name="large-icons"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -123,6 +144,9 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="image_logo">
|
<object class="GtkToggleButton" id="image_logo">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">SVG Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<property name="group">image_floppy</property>
|
<property name="group">image_floppy</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDragSource">
|
<object class="GtkDragSource">
|
||||||
@@ -131,6 +155,9 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">gtk-demo logo</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="large-icons"/>
|
<class name="large-icons"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -148,6 +175,9 @@
|
|||||||
<property name="name">File</property>
|
<property name="name">File</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkButton" id="source_file">
|
<object class="GtkButton" id="source_file">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">File Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDragSource">
|
<object class="GtkDragSource">
|
||||||
<property name="propagation-phase">capture</property>
|
<property name="propagation-phase">capture</property>
|
||||||
@@ -172,6 +202,9 @@
|
|||||||
<property name="name">Folder</property>
|
<property name="name">Folder</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkButton" id="source_folder">
|
<object class="GtkButton" id="source_folder">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Folder Drag Source</property>
|
||||||
|
</accessibility>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDragSource">
|
<object class="GtkDragSource">
|
||||||
<property name="propagation-phase">capture</property>
|
<property name="propagation-phase">capture</property>
|
||||||
@@ -225,7 +258,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="paste_label">
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<binding name="label">
|
<binding name="label">
|
||||||
<lookup name="visible-child-name" type="GtkStack">
|
<lookup name="visible-child-name" type="GtkStack">
|
||||||
@@ -252,6 +285,9 @@
|
|||||||
<property name="name">Text</property>
|
<property name="name">Text</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">paste_label</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
@@ -265,6 +301,9 @@
|
|||||||
<property name="name">Image</property>
|
<property name="name">Image</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">paste_label</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<style>
|
<style>
|
||||||
@@ -283,6 +322,9 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkColorSwatch">
|
<object class="GtkColorSwatch">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">paste_label</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="accessible-role">img</property>
|
<property name="accessible-role">img</property>
|
||||||
<property name="can-focus">0</property>
|
<property name="can-focus">0</property>
|
||||||
<property name="selectable">0</property>
|
<property name="selectable">0</property>
|
||||||
@@ -298,6 +340,9 @@
|
|||||||
<property name="name">File</property>
|
<property name="name">File</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">paste_label</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
|
|||||||
@@ -335,6 +335,9 @@
|
|||||||
<file>paintable_symbolic.c</file>
|
<file>paintable_symbolic.c</file>
|
||||||
<file>panes.c</file>
|
<file>panes.c</file>
|
||||||
<file>password_entry.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>peg_solitaire.c</file>
|
||||||
<file>pickers.c</file>
|
<file>pickers.c</file>
|
||||||
<file>printing.c</file>
|
<file>printing.c</file>
|
||||||
@@ -420,6 +423,9 @@
|
|||||||
<gresource prefix="/fontrendering">
|
<gresource prefix="/fontrendering">
|
||||||
<file>fontrendering.ui</file>
|
<file>fontrendering.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/path_text">
|
||||||
|
<file>path_text.ui</file>
|
||||||
|
</gresource>
|
||||||
<gresource prefix="/org/gtk/Demo4">
|
<gresource prefix="/org/gtk/Demo4">
|
||||||
<file>icons/16x16/actions/application-exit.png</file>
|
<file>icons/16x16/actions/application-exit.png</file>
|
||||||
<file>icons/16x16/actions/document-new.png</file>
|
<file>icons/16x16/actions/document-new.png</file>
|
||||||
|
|||||||
@@ -387,6 +387,8 @@ demo3_widget_class_init (Demo3WidgetClass *class)
|
|||||||
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
|
||||||
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
|
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
|
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
|
||||||
|
|
||||||
|
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_IMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
|||||||
@@ -19,8 +19,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
<template class="Demo3Widget">
|
<template class="Demo3Widget">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Demo image</property>
|
||||||
|
</accessibility>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPopoverMenu" id="menu">
|
<object class="GtkPopoverMenu" id="menu">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Context menu</property>
|
||||||
|
</accessibility>
|
||||||
<property name="has-arrow">0</property>
|
<property name="has-arrow">0</property>
|
||||||
<property name="menu-model">model</property>
|
<property name="menu-model">model</property>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
+19
-7
@@ -162,27 +162,39 @@ click_done (GtkGesture *gesture)
|
|||||||
gtk_widget_insert_after (item, canvas, last_child);
|
gtk_widget_insert_after (item, canvas, last_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GtkSettings treats `GTK_THEME=foo:dark` as theme name `foo`, variant `dark`,
|
||||||
|
* and our embedded CSS files let `foo-dark` work as an alias for `foo:dark`. */
|
||||||
|
static gboolean
|
||||||
|
has_dark_suffix (const char *theme)
|
||||||
|
{
|
||||||
|
return g_str_has_suffix (theme, ":dark") ||
|
||||||
|
g_str_has_suffix (theme, "-dark");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* So we can make a good guess whether the current theme is dark by checking for
|
||||||
|
* either: it is suffixed `[:-]dark`, or Settings:…prefer-dark-theme is TRUE. */
|
||||||
static gboolean
|
static gboolean
|
||||||
theme_is_dark (void)
|
theme_is_dark (void)
|
||||||
{
|
{
|
||||||
|
const char *env_theme;
|
||||||
GtkSettings *settings;
|
GtkSettings *settings;
|
||||||
char *theme;
|
char *theme;
|
||||||
gboolean prefer_dark;
|
gboolean prefer_dark;
|
||||||
gboolean dark;
|
gboolean dark;
|
||||||
|
|
||||||
|
/* Like GtkSettings, 1st see if theme is overridden by environment variable */
|
||||||
|
env_theme = g_getenv ("GTK_THEME");
|
||||||
|
if (env_theme != NULL)
|
||||||
|
return has_dark_suffix (env_theme);
|
||||||
|
|
||||||
|
/* If not, test Settings:…theme-name in the same way OR :…prefer-dark-theme */
|
||||||
settings = gtk_settings_get_default ();
|
settings = gtk_settings_get_default ();
|
||||||
g_object_get (settings,
|
g_object_get (settings,
|
||||||
"gtk-theme-name", &theme,
|
"gtk-theme-name", &theme,
|
||||||
"gtk-application-prefer-dark-theme", &prefer_dark,
|
"gtk-application-prefer-dark-theme", &prefer_dark,
|
||||||
NULL);
|
NULL);
|
||||||
|
dark = prefer_dark || has_dark_suffix (theme);
|
||||||
if ((strcmp (theme, "Adwaita") == 0 && prefer_dark) || strcmp (theme, "HighContrastInverse") == 0)
|
|
||||||
dark = TRUE;
|
|
||||||
else
|
|
||||||
dark = FALSE;
|
|
||||||
|
|
||||||
g_free (theme);
|
g_free (theme);
|
||||||
|
|
||||||
return dark;
|
return dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,11 +334,17 @@ do_drawingarea (GtkWidget *do_widget)
|
|||||||
gtk_widget_set_vexpand (frame, TRUE);
|
gtk_widget_set_vexpand (frame, TRUE);
|
||||||
gtk_box_append (GTK_BOX (vbox), frame);
|
gtk_box_append (GTK_BOX (vbox), frame);
|
||||||
|
|
||||||
da = gtk_drawing_area_new ();
|
da = g_object_new (GTK_TYPE_DRAWING_AREA,
|
||||||
|
"accessible-role", GTK_ACCESSIBLE_ROLE_IMG,
|
||||||
|
NULL);
|
||||||
|
gtk_frame_set_child (GTK_FRAME (frame), da);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (da),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), groups_draw, NULL, NULL);
|
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), groups_draw, NULL, NULL);
|
||||||
gtk_frame_set_child (GTK_FRAME (frame), da);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the scribble area
|
* Create the scribble area
|
||||||
@@ -352,11 +358,17 @@ do_drawingarea (GtkWidget *do_widget)
|
|||||||
gtk_widget_set_vexpand (frame, TRUE);
|
gtk_widget_set_vexpand (frame, TRUE);
|
||||||
gtk_box_append (GTK_BOX (vbox), frame);
|
gtk_box_append (GTK_BOX (vbox), frame);
|
||||||
|
|
||||||
da = gtk_drawing_area_new ();
|
da = g_object_new (GTK_TYPE_DRAWING_AREA,
|
||||||
|
"accessible-role", GTK_ACCESSIBLE_ROLE_IMG,
|
||||||
|
NULL);
|
||||||
|
gtk_frame_set_child (GTK_FRAME (frame), da);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (da),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
|
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
|
||||||
gtk_frame_set_child (GTK_FRAME (frame), da);
|
|
||||||
|
|
||||||
g_signal_connect (da, "resize",
|
g_signal_connect (da, "resize",
|
||||||
G_CALLBACK (scribble_resize), NULL);
|
G_CALLBACK (scribble_resize), NULL);
|
||||||
@@ -372,7 +384,7 @@ do_drawingarea (GtkWidget *do_widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
gtk_widget_set_visible (window, TRUE);
|
gtk_window_present (GTK_WINDOW (window));
|
||||||
else
|
else
|
||||||
gtk_window_destroy (GTK_WINDOW (window));
|
gtk_window_destroy (GTK_WINDOW (window));
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,13 @@ do_entry_completion (GtkWidget *do_widget)
|
|||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_box_append (GTK_BOX (vbox), entry);
|
gtk_box_append (GTK_BOX (vbox), entry);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE, GTK_ACCESSIBLE_AUTOCOMPLETE_LIST,
|
||||||
|
-1);
|
||||||
|
|
||||||
/* Create the completion object */
|
/* Create the completion object */
|
||||||
completion = gtk_entry_completion_new ();
|
completion = gtk_entry_completion_new ();
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ do_entry_undo (GtkWidget *do_widget)
|
|||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
|
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
|
||||||
gtk_box_append (GTK_BOX (vbox), entry);
|
gtk_box_append (GTK_BOX (vbox), entry);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
|||||||
@@ -22,11 +22,15 @@ validate_more_details (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
|
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
|
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
|
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
|
||||||
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
|
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,10 +48,18 @@ mode_switch_state_set (GtkSwitch *sw,
|
|||||||
{
|
{
|
||||||
gtk_widget_set_visible (label, FALSE);
|
gtk_widget_set_visible (label, FALSE);
|
||||||
gtk_switch_set_state (sw, state);
|
gtk_switch_set_state (sw, state);
|
||||||
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_set_visible (label, TRUE);
|
gtk_widget_set_visible (label, TRUE);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
|
||||||
|
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
|
||||||
|
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -73,6 +85,9 @@ level_scale_value_changed (GtkRange *range,
|
|||||||
{
|
{
|
||||||
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
|
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
|||||||
@@ -59,6 +59,9 @@
|
|||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFontDialogButton" id="font">
|
<object class="GtkFontDialogButton" id="font">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Font</property>
|
||||||
|
</accessibility>
|
||||||
<property name="dialog">
|
<property name="dialog">
|
||||||
<object class="GtkFontDialog">
|
<object class="GtkFontDialog">
|
||||||
</object>
|
</object>
|
||||||
@@ -73,7 +76,7 @@
|
|||||||
<property name="column-spacing">10</property>
|
<property name="column-spacing">10</property>
|
||||||
<property name="row-spacing">10</property>
|
<property name="row-spacing">10</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="size_label">
|
||||||
<property name="label">Size</property>
|
<property name="label">Size</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@@ -89,6 +92,9 @@
|
|||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
<property name="adjustment">size_adjustment</property>
|
<property name="adjustment">size_adjustment</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">size_label</relation>
|
||||||
|
</accessibility>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
<property name="row">0</property>
|
<property name="row">0</property>
|
||||||
@@ -101,6 +107,9 @@
|
|||||||
<property name="max-width-chars">4</property>
|
<property name="max-width-chars">4</property>
|
||||||
<property name="hexpand">0</property>
|
<property name="hexpand">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">size_label</relation>
|
||||||
|
</accessibility>
|
||||||
<signal name="activate" handler="basic_entry_activated"
|
<signal name="activate" handler="basic_entry_activated"
|
||||||
object="size_adjustment" swapped="false"/>
|
object="size_adjustment" swapped="false"/>
|
||||||
<layout>
|
<layout>
|
||||||
@@ -110,7 +119,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="letterspacing_label">
|
||||||
<property name="label">Letterspacing</property>
|
<property name="label">Letterspacing</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@@ -126,6 +135,9 @@
|
|||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
<property name="adjustment">letterspacing_adjustment</property>
|
<property name="adjustment">letterspacing_adjustment</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">letterspacing_label</relation>
|
||||||
|
</accessibility>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
<property name="row">1</property>
|
<property name="row">1</property>
|
||||||
@@ -138,6 +150,9 @@
|
|||||||
<property name="max-width-chars">4</property>
|
<property name="max-width-chars">4</property>
|
||||||
<property name="hexpand">0</property>
|
<property name="hexpand">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">letterspacing_label</relation>
|
||||||
|
</accessibility>
|
||||||
<signal name="activate" handler="basic_entry_activated"
|
<signal name="activate" handler="basic_entry_activated"
|
||||||
object="letterspacing_adjustment" swapped="false"/>
|
object="letterspacing_adjustment" swapped="false"/>
|
||||||
<layout>
|
<layout>
|
||||||
@@ -147,7 +162,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="line_height_label">
|
||||||
<property name="label">Line Height</property>
|
<property name="label">Line Height</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@@ -163,6 +178,9 @@
|
|||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
<property name="adjustment">line_height_adjustment</property>
|
<property name="adjustment">line_height_adjustment</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">line_height_label</relation>
|
||||||
|
</accessibility>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
<property name="row">2</property>
|
<property name="row">2</property>
|
||||||
@@ -175,6 +193,9 @@
|
|||||||
<property name="max-width-chars">4</property>
|
<property name="max-width-chars">4</property>
|
||||||
<property name="hexpand">0</property>
|
<property name="hexpand">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">line_height_label</relation>
|
||||||
|
</accessibility>
|
||||||
<signal name="activate" handler="basic_entry_activated"
|
<signal name="activate" handler="basic_entry_activated"
|
||||||
object="line_height_adjustment" swapped="false"/>
|
object="line_height_adjustment" swapped="false"/>
|
||||||
<layout>
|
<layout>
|
||||||
@@ -184,7 +205,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="foreground_label">
|
||||||
<property name="label">Foreground</property>
|
<property name="label">Foreground</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@@ -202,6 +223,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
<property name="rgba">black</property>
|
<property name="rgba">black</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">foreground_label</relation>
|
||||||
|
</accessibility>
|
||||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@@ -210,7 +234,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="background_label">
|
||||||
<property name="label">Background</property>
|
<property name="label">Background</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@@ -228,6 +252,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
<property name="rgba">white</property>
|
<property name="rgba">white</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">background_label</relation>
|
||||||
|
</accessibility>
|
||||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@@ -240,6 +267,9 @@
|
|||||||
<property name="icon-name">object-flip-vertical-symbolic</property>
|
<property name="icon-name">object-flip-vertical-symbolic</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Swap colors</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="circular"/>
|
<class name="circular"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -341,6 +371,9 @@
|
|||||||
<property name="yalign">0</property>
|
<property name="yalign">0</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
<property name="selectable">1</property>
|
<property name="selectable">1</property>
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Font example</property>
|
||||||
|
</accessibility>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
@@ -350,6 +383,9 @@
|
|||||||
<property name="name">entry</property>
|
<property name="name">entry</property>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkTextView" id="entry">
|
<object class="GtkTextView" id="entry">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Example text</property>
|
||||||
|
</accessibility>
|
||||||
<property name="buffer">
|
<property name="buffer">
|
||||||
<object class="GtkTextBuffer">
|
<object class="GtkTextBuffer">
|
||||||
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
||||||
@@ -446,6 +482,9 @@
|
|||||||
<property name="icon-name">document-edit-symbolic</property>
|
<property name="icon-name">document-edit-symbolic</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">end</property>
|
<property name="valign">end</property>
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Edit text</property>
|
||||||
|
</accessibility>
|
||||||
<signal name="clicked" handler="font_features_toggle_edit"/>
|
<signal name="clicked" handler="font_features_toggle_edit"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ retry:
|
|||||||
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
texture = gdk_texture_new_for_pixbuf (pixbuf2);
|
||||||
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
|
||||||
g_object_unref (pixbuf2);
|
g_object_unref (pixbuf2);
|
||||||
g_object_unref (pixbuf2);
|
g_object_unref (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean fading = FALSE;
|
static gboolean fading = FALSE;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<property name="row-spacing">10</property>
|
<property name="row-spacing">10</property>
|
||||||
<property name="column-spacing">10</property>
|
<property name="column-spacing">10</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="text_label">
|
||||||
<property name="margin-start">10</property>
|
<property name="margin-start">10</property>
|
||||||
<property name="label">Text</property>
|
<property name="label">Text</property>
|
||||||
<property name="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
@@ -57,10 +57,13 @@
|
|||||||
<layout>
|
<layout>
|
||||||
<property name="column">2</property>
|
<property name="column">2</property>
|
||||||
</layout>
|
</layout>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">text_label</relation>
|
||||||
|
</accessibility>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="font_label">
|
||||||
<property name="margin-start">10</property>
|
<property name="margin-start">10</property>
|
||||||
<property name="label">Font</property>
|
<property name="label">Font</property>
|
||||||
<property name="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
@@ -75,6 +78,9 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFontDialogButton" id="font_button">
|
<object class="GtkFontDialogButton" id="font_button">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">font_label</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="dialog">
|
<property name="dialog">
|
||||||
<object class="GtkFontDialog">
|
<object class="GtkFontDialog">
|
||||||
</object>
|
</object>
|
||||||
@@ -186,6 +192,9 @@
|
|||||||
<property name="icon-name">list-add-symbolic</property>
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Zoom in</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="circular"/>
|
<class name="circular"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -211,6 +220,9 @@
|
|||||||
<property name="icon-name">list-remove-symbolic</property>
|
<property name="icon-name">list-remove-symbolic</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Zoom out</property>
|
||||||
|
</accessibility>
|
||||||
<style>
|
<style>
|
||||||
<class name="circular"/>
|
<class name="circular"/>
|
||||||
</style>
|
</style>
|
||||||
@@ -251,6 +263,9 @@
|
|||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPicture" id="image">
|
<object class="GtkPicture" id="image">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Font rendering example</property>
|
||||||
|
</accessibility>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="can-shrink">0</property>
|
<property name="can-shrink">0</property>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ do_headerbar (GtkWidget *do_widget)
|
|||||||
GtkWidget *header;
|
GtkWidget *header;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
|
GtkWidget *content;
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@@ -37,16 +38,26 @@ do_headerbar (GtkWidget *do_widget)
|
|||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_widget_add_css_class (box, "linked");
|
gtk_widget_add_css_class (box, "linked");
|
||||||
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
|
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
|
||||||
|
gtk_widget_set_tooltip_text (button, "Back");
|
||||||
gtk_box_append (GTK_BOX (box), button);
|
gtk_box_append (GTK_BOX (box), button);
|
||||||
button = gtk_button_new_from_icon_name ("go-next-symbolic");
|
button = gtk_button_new_from_icon_name ("go-next-symbolic");
|
||||||
|
gtk_widget_set_tooltip_text (button, "Forward");
|
||||||
gtk_box_append (GTK_BOX (box), button);
|
gtk_box_append (GTK_BOX (box), button);
|
||||||
|
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), gtk_switch_new ());
|
button = gtk_switch_new ();
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Change something",
|
||||||
|
-1);
|
||||||
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
|
||||||
|
|
||||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||||
|
|
||||||
gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
|
content = gtk_text_view_new ();
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (content),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Content",
|
||||||
|
-1);
|
||||||
|
gtk_window_set_child (GTK_WINDOW (window), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
|||||||
@@ -164,12 +164,18 @@ do_image_scaling (GtkWidget *do_widget)
|
|||||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, -10., 10., 0.1);
|
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, -10., 10., 0.1);
|
||||||
gtk_scale_add_mark (GTK_SCALE (scale), 0., GTK_POS_TOP, NULL);
|
gtk_scale_add_mark (GTK_SCALE (scale), 0., GTK_POS_TOP, NULL);
|
||||||
gtk_widget_set_tooltip_text (scale, "Zoom");
|
gtk_widget_set_tooltip_text (scale, "Zoom");
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (scale),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Zoom",
|
||||||
|
-1);
|
||||||
gtk_range_set_value (GTK_RANGE (scale), 0.);
|
gtk_range_set_value (GTK_RANGE (scale), 0.);
|
||||||
gtk_widget_set_hexpand (scale, TRUE);
|
gtk_widget_set_hexpand (scale, TRUE);
|
||||||
gtk_box_append (GTK_BOX (box2), scale);
|
gtk_box_append (GTK_BOX (box2), scale);
|
||||||
|
|
||||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (gtk_string_list_new ((const char *[]){ "Linear", "Nearest", "Trilinear", NULL })), NULL);
|
dropdown = gtk_drop_down_new (G_LIST_MODEL (gtk_string_list_new ((const char *[]){ "Linear", "Nearest", "Trilinear", NULL })), NULL);
|
||||||
gtk_widget_set_tooltip_text (dropdown, "Filter");
|
gtk_widget_set_tooltip_text (dropdown, "Filter");
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (dropdown),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Filter",
|
||||||
|
-1);
|
||||||
gtk_box_append (GTK_BOX (box2), dropdown);
|
gtk_box_append (GTK_BOX (box2), dropdown);
|
||||||
|
|
||||||
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
|
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">switch</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">check</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -110,6 +112,7 @@
|
|||||||
<property name="margin-start">10</property>
|
<property name="margin-start">10</property>
|
||||||
<property name="margin-end">10</property>
|
<property name="margin-end">10</property>
|
||||||
<property name="opacity">0</property>
|
<property name="opacity">0</property>
|
||||||
|
<property name="accessible-role">status</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -150,10 +153,11 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">scale</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScale">
|
<object class="GtkScale" id="scale">
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="draw-value">0</property>
|
<property name="draw-value">0</property>
|
||||||
@@ -185,10 +189,11 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">spin</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinButton">
|
<object class="GtkSpinButton" id="spin">
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="adjustment">
|
<property name="adjustment">
|
||||||
@@ -217,10 +222,11 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">dropdown</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDropDown">
|
<object class="GtkDropDown" id="dropdown">
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
@@ -252,10 +258,11 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="mnemonic-widget">entry</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry">
|
<object class="GtkEntry" id="entry">
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="placeholder-text">Type here…</property>
|
<property name="placeholder-text">Type here…</property>
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ setup_listitem_cb (GtkListItemFactory *factory,
|
|||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||||
image = gtk_image_new ();
|
image = gtk_image_new ();
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (image),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL,
|
||||||
|
"App icon",
|
||||||
|
-1);
|
||||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||||
gtk_box_append (GTK_BOX (box), image);
|
gtk_box_append (GTK_BOX (box), image);
|
||||||
label = gtk_label_new ("");
|
label = gtk_label_new ("");
|
||||||
@@ -79,6 +83,7 @@ bind_listitem_cb (GtkListItemFactory *factory,
|
|||||||
|
|
||||||
gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
|
gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
|
||||||
gtk_label_set_label (GTK_LABEL (label), g_app_info_get_display_name (app_info));
|
gtk_label_set_label (GTK_LABEL (label), g_app_info_get_display_name (app_info));
|
||||||
|
gtk_list_item_set_accessible_label (list_item, g_app_info_get_display_name (app_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In more complex code, we would also need functions to unbind and teardown
|
/* In more complex code, we would also need functions to unbind and teardown
|
||||||
|
|||||||
@@ -431,6 +431,9 @@ setup_listitem_cb (GtkListItemFactory *factory,
|
|||||||
picture = gtk_picture_new ();
|
picture = gtk_picture_new ();
|
||||||
gtk_expression_bind (expression, picture, "paintable", picture);
|
gtk_expression_bind (expression, picture, "paintable", picture);
|
||||||
gtk_box_append (GTK_BOX (box), picture);
|
gtk_box_append (GTK_BOX (box), picture);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (picture),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, location_label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
|
||||||
/* And finally, everything comes together.
|
/* And finally, everything comes together.
|
||||||
@@ -487,6 +490,9 @@ do_listview_clocks (GtkWidget *do_widget)
|
|||||||
|
|
||||||
model = GTK_SELECTION_MODEL (gtk_no_selection_new (create_clocks_model ()));
|
model = GTK_SELECTION_MODEL (gtk_no_selection_new (create_clocks_model ()));
|
||||||
gridview = gtk_grid_view_new (model, factory);
|
gridview = gtk_grid_view_new (model, factory);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (gridview),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Clocks",
|
||||||
|
-1);
|
||||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||||
|
|
||||||
|
|||||||
@@ -368,6 +368,38 @@ match_func (MatchObject *obj,
|
|||||||
g_free (tmp2);
|
g_free (tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_header (GtkSignalListItemFactory *factory,
|
||||||
|
GObject *list_item,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GtkListHeader *self = GTK_LIST_HEADER (list_item);
|
||||||
|
GtkWidget *child;
|
||||||
|
|
||||||
|
child = gtk_label_new ("");
|
||||||
|
gtk_label_set_xalign (GTK_LABEL (child), 0);
|
||||||
|
gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
|
||||||
|
gtk_widget_set_margin_top (child, 10);
|
||||||
|
gtk_widget_set_margin_bottom (child, 10);
|
||||||
|
|
||||||
|
gtk_list_header_set_child (self, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
bind_header (GtkSignalListItemFactory *factory,
|
||||||
|
GObject *list_item,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GtkListHeader *self = GTK_LIST_HEADER (list_item);
|
||||||
|
GtkWidget *child = gtk_list_header_get_child (self);
|
||||||
|
GObject *item = gtk_list_header_get_item (self);
|
||||||
|
|
||||||
|
if (strstr (gtk_string_object_get_string (GTK_STRING_OBJECT (item)), "hour"))
|
||||||
|
gtk_label_set_label (GTK_LABEL (child), "<big><b>Hours</b></big>");
|
||||||
|
else
|
||||||
|
gtk_label_set_label (GTK_LABEL (child), "<big><b>Minutes</b></big>");
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
do_listview_selections (GtkWidget *do_widget)
|
do_listview_selections (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
@@ -377,10 +409,12 @@ do_listview_selections (GtkWidget *do_widget)
|
|||||||
GtkExpression *expression;
|
GtkExpression *expression;
|
||||||
GtkListItemFactory *factory;
|
GtkListItemFactory *factory;
|
||||||
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
|
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
|
||||||
const char * const many_times[] = {
|
const char * const minutes[] = {
|
||||||
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
|
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
|
||||||
"25 minutes", "30 minutes", "35 minutes", "40 minutes", "45 minutes", "50 minutes",
|
"25 minutes", "30 minutes", "35 minutes", "40 minutes", "45 minutes", "50 minutes",
|
||||||
"55 minutes", "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
|
"55 minutes", NULL
|
||||||
|
};
|
||||||
|
const char * const hours[] = { "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
|
||||||
"8 hours", "9 hours", "10 hours", "11 hours", "12 hours", NULL
|
"8 hours", "9 hours", "10 hours", "11 hours", "12 hours", NULL
|
||||||
};
|
};
|
||||||
const char * const device_titles[] = { "Digital Output", "Headphones", "Digital Output", "Analog Output", NULL };
|
const char * const device_titles[] = { "Digital Output", "Headphones", "Digital Output", "Analog Output", NULL };
|
||||||
@@ -395,6 +429,10 @@ do_listview_selections (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
|
GtkStringList *minutes_model, *hours_model;
|
||||||
|
GListStore *store;
|
||||||
|
GtkFlattenListModel *flat;
|
||||||
|
|
||||||
window = gtk_window_new ();
|
window = gtk_window_new ();
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
@@ -422,14 +460,25 @@ do_listview_selections (GtkWidget *do_widget)
|
|||||||
gtk_box_append (GTK_BOX (box), button);
|
gtk_box_append (GTK_BOX (box), button);
|
||||||
|
|
||||||
/* A dropdown using an expression to obtain strings */
|
/* A dropdown using an expression to obtain strings */
|
||||||
button = drop_down_new_from_strings (many_times, NULL, NULL);
|
minutes_model = gtk_string_list_new (minutes);
|
||||||
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
hours_model = gtk_string_list_new (hours);
|
||||||
|
store = g_list_store_new (G_TYPE_LIST_MODEL);
|
||||||
|
g_list_store_append (store, minutes_model);
|
||||||
|
g_list_store_append (store, hours_model);
|
||||||
|
g_object_unref (minutes_model);
|
||||||
|
g_object_unref (hours_model);
|
||||||
|
flat = gtk_flatten_list_model_new (G_LIST_MODEL (store));
|
||||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
(GCallback)get_title,
|
(GCallback)get_title,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
|
button = gtk_drop_down_new (G_LIST_MODEL (flat), expression);
|
||||||
gtk_expression_unref (expression);
|
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
||||||
|
factory = gtk_signal_list_item_factory_new ();
|
||||||
|
g_signal_connect (factory, "setup", G_CALLBACK (setup_header), NULL);
|
||||||
|
g_signal_connect (factory, "bind", G_CALLBACK (bind_header), NULL);
|
||||||
|
gtk_drop_down_set_header_factory (GTK_DROP_DOWN (button), factory);
|
||||||
|
g_object_unref (factory);
|
||||||
gtk_box_append (GTK_BOX (box), button);
|
gtk_box_append (GTK_BOX (box), button);
|
||||||
|
|
||||||
button = gtk_drop_down_new (NULL, NULL);
|
button = gtk_drop_down_new (NULL, NULL);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkInscription">
|
<object class="GtkInscription">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="nat-chars">25</property>
|
||||||
|
<property name="text-overflow">ellipsize-end</property>
|
||||||
<binding name="text">
|
<binding name="text">
|
||||||
<lookup name="title" type="GtkDemo">
|
<lookup name="title" type="GtkDemo">
|
||||||
<lookup name="item">expander</lookup>
|
<lookup name="item">expander</lookup>
|
||||||
|
|||||||
+38
-24
@@ -18,7 +18,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
@@ -268,9 +267,9 @@ activate_run (GSimpleAction *action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
display_image (const char *format,
|
display_image (const char *format,
|
||||||
const char *resource,
|
const char *resource,
|
||||||
char **label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
GtkWidget *sw, *image;
|
GtkWidget *sw, *image;
|
||||||
|
|
||||||
@@ -280,13 +279,17 @@ display_image (const char *format,
|
|||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
return sw;
|
return sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
display_images (const char *format,
|
display_images (const char *format,
|
||||||
const char *resource_dir,
|
const char *resource_dir,
|
||||||
char **label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
char **resources;
|
char **resources;
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
@@ -311,13 +314,15 @@ display_images (const char *format,
|
|||||||
{
|
{
|
||||||
char *resource_name;
|
char *resource_name;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
|
GtkWidget *image_label;
|
||||||
|
|
||||||
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
||||||
|
|
||||||
widget = display_image (NULL, resource_name, NULL);
|
image_label = gtk_label_new (resources[i]);
|
||||||
|
widget = display_image (NULL, resource_name, image_label);
|
||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_box_append (GTK_BOX (box), widget);
|
gtk_box_append (GTK_BOX (box), widget);
|
||||||
gtk_box_append (GTK_BOX (box), gtk_label_new (resources[i]));
|
gtk_box_append (GTK_BOX (box), image_label);
|
||||||
gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1);
|
gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1);
|
||||||
|
|
||||||
g_free (resource_name);
|
g_free (resource_name);
|
||||||
@@ -325,15 +330,19 @@ display_images (const char *format,
|
|||||||
|
|
||||||
g_strfreev (resources);
|
g_strfreev (resources);
|
||||||
|
|
||||||
*label = g_strdup ("Images");
|
gtk_label_set_label (GTK_LABEL (label), "Images");
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (grid),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
return sw;
|
return sw;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
display_text (const char *format,
|
display_text (const char *format,
|
||||||
const char *resource,
|
const char *resource,
|
||||||
char **label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
GtkWidget *textview, *sw;
|
GtkWidget *textview, *sw;
|
||||||
@@ -368,6 +377,10 @@ display_text (const char *format,
|
|||||||
|
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (textview),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
GTK_POLICY_AUTOMATIC,
|
GTK_POLICY_AUTOMATIC,
|
||||||
@@ -378,15 +391,19 @@ display_text (const char *format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
display_video (const char *format,
|
display_video (const char *format,
|
||||||
const char *resource,
|
const char *resource,
|
||||||
char **label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
GtkWidget *video;
|
GtkWidget *video;
|
||||||
|
|
||||||
video = gtk_video_new_for_resource (resource);
|
video = gtk_video_new_for_resource (resource);
|
||||||
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
|
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (video),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
|
||||||
return video;
|
return video;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,9 +425,9 @@ display_nothing (const char *resource)
|
|||||||
static struct {
|
static struct {
|
||||||
const char *extension;
|
const char *extension;
|
||||||
const char *format;
|
const char *format;
|
||||||
GtkWidget * (* display_func) (const char *format,
|
GtkWidget * (* display_func) (const char *format,
|
||||||
const char *resource,
|
const char *resource,
|
||||||
char **label);
|
GtkWidget *label);
|
||||||
} display_funcs[] = {
|
} display_funcs[] = {
|
||||||
{ ".gif", NULL, display_image },
|
{ ".gif", NULL, display_image },
|
||||||
{ ".jpg", NULL, display_image },
|
{ ".jpg", NULL, display_image },
|
||||||
@@ -433,7 +450,6 @@ add_data_tab (const char *demoname)
|
|||||||
char **resources;
|
char **resources;
|
||||||
GtkWidget *widget, *label;
|
GtkWidget *widget, *label;
|
||||||
guint i, j;
|
guint i, j;
|
||||||
char *label_string;
|
|
||||||
|
|
||||||
resource_dir = g_strconcat ("/", demoname, NULL);
|
resource_dir = g_strconcat ("/", demoname, NULL);
|
||||||
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
||||||
@@ -453,23 +469,21 @@ add_data_tab (const char *demoname)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
label_string = NULL;
|
label = gtk_label_new (resources[i]);
|
||||||
|
|
||||||
if (j < G_N_ELEMENTS (display_funcs))
|
if (j < G_N_ELEMENTS (display_funcs))
|
||||||
widget = display_funcs[j].display_func (display_funcs[j].format,
|
widget = display_funcs[j].display_func (display_funcs[j].format,
|
||||||
resource_name,
|
resource_name,
|
||||||
&label_string);
|
label);
|
||||||
else
|
else
|
||||||
widget = display_nothing (resource_name);
|
widget = display_nothing (resource_name);
|
||||||
|
|
||||||
label = gtk_label_new (label_string ? label_string : resources[i]);
|
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
||||||
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
|
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
|
||||||
"tab-expand", FALSE,
|
"tab-expand", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (resource_name);
|
g_free (resource_name);
|
||||||
g_free (label_string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (resources);
|
g_strfreev (resources);
|
||||||
|
|||||||
@@ -57,14 +57,17 @@
|
|||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="width-request">220</property>
|
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchBar" id="searchbar">
|
<object class="GtkSearchBar" id="searchbar">
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">search-entry</relation>
|
||||||
|
</accessibility>
|
||||||
<property name="key-capture-widget">window</property>
|
<property name="key-capture-widget">window</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="search-entry">
|
<object class="GtkSearchEntry" id="search-entry">
|
||||||
<accessibility>
|
<accessibility>
|
||||||
|
<property name="label" translatable="yes">Search</property>
|
||||||
<relation name="controls">listview</relation>
|
<relation name="controls">listview</relation>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
</object>
|
</object>
|
||||||
@@ -76,15 +79,15 @@
|
|||||||
<style>
|
<style>
|
||||||
<class name="sidebar"/>
|
<class name="sidebar"/>
|
||||||
</style>
|
</style>
|
||||||
<property name="width-request">120</property>
|
|
||||||
<property name="hscrollbar-policy">never</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
<property name="min-content-width">150</property>
|
<property name="propagate-natural-width">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListView" id="listview">
|
<object class="GtkListView" id="listview">
|
||||||
<style>
|
<style>
|
||||||
<class name="navigation-sidebar"/>
|
<class name="navigation-sidebar"/>
|
||||||
</style>
|
</style>
|
||||||
|
<property name="tab-behavior">item</property>
|
||||||
<property name="factory">
|
<property name="factory">
|
||||||
<object class="GtkBuilderListItemFactory">
|
<object class="GtkBuilderListItemFactory">
|
||||||
<property name="resource">/ui/main-listitem.ui</property>
|
<property name="resource">/ui/main-listitem.ui</property>
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ demos = files([
|
|||||||
'paintable_symbolic.c',
|
'paintable_symbolic.c',
|
||||||
'panes.c',
|
'panes.c',
|
||||||
'password_entry.c',
|
'password_entry.c',
|
||||||
|
'path_fill.c',
|
||||||
|
'path_maze.c',
|
||||||
|
'path_text.c',
|
||||||
'peg_solitaire.c',
|
'peg_solitaire.c',
|
||||||
'pickers.c',
|
'pickers.c',
|
||||||
'printing.c',
|
'printing.c',
|
||||||
@@ -158,17 +161,7 @@ demos_h = custom_target('gtk4 demo header',
|
|||||||
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
|
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
|
||||||
)
|
)
|
||||||
|
|
||||||
objcopy_supports_add_symbol = false
|
if can_use_objcopy_for_resources
|
||||||
objcopy = find_program('objcopy', required : false)
|
|
||||||
if objcopy.found()
|
|
||||||
objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
|
|
||||||
endif
|
|
||||||
|
|
||||||
ld = find_program('ld', required : false)
|
|
||||||
|
|
||||||
if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
|
||||||
glib_compile_resources = find_program('glib-compile-resources')
|
|
||||||
|
|
||||||
# Create the resource blob
|
# Create the resource blob
|
||||||
gtkdemo_gresource = custom_target('gtkdemo.gresource',
|
gtkdemo_gresource = custom_target('gtkdemo.gresource',
|
||||||
input : 'demo.gresource.xml',
|
input : 'demo.gresource.xml',
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ do_password_entry (GtkWidget *do_widget)
|
|||||||
"placeholder-text", "Password",
|
"placeholder-text", "Password",
|
||||||
"activates-default", TRUE,
|
"activates-default", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Password",
|
||||||
|
-1);
|
||||||
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
|
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
|
||||||
gtk_box_append (GTK_BOX (box), entry);
|
gtk_box_append (GTK_BOX (box), entry);
|
||||||
|
|
||||||
@@ -77,6 +80,9 @@ do_password_entry (GtkWidget *do_widget)
|
|||||||
"placeholder-text", "Confirm",
|
"placeholder-text", "Confirm",
|
||||||
"activates-default", TRUE,
|
"activates-default", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry2),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Confirm",
|
||||||
|
-1);
|
||||||
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
|
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
|
||||||
gtk_box_append (GTK_BOX (box), entry2);
|
gtk_box_append (GTK_BOX (box), entry2);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,321 @@
|
|||||||
|
/* 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"
|
||||||
|
|
||||||
|
#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 (4.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 need to disconnect the signals here that we set up elsewhere
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gtk_path_paintable_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GtkPathPaintable *self = GTK_PATH_PAINTABLE (object);
|
||||||
|
|
||||||
|
if (self->background)
|
||||||
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (self->background, gdk_paintable_invalidate_contents, self);
|
||||||
|
g_signal_handlers_disconnect_by_func (self->background, gdk_paintable_invalidate_size, self);
|
||||||
|
g_clear_object (&self->background);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gtk_path_paintable_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_path_paintable_class_init (GtkPathPaintableClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = gtk_path_paintable_dispose;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_object_ref (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
|
||||||
|
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;
|
||||||
|
|
||||||
|
builder = gsk_path_builder_new ();
|
||||||
|
gsk_path_measure_add_segment (measure,
|
||||||
|
builder,
|
||||||
|
progress > 1 ? (progress - 1) * gsk_path_measure_get_length (measure) : 0.0,
|
||||||
|
(progress < 1 ? progress : 1.0) * gsk_path_measure_get_length (measure));
|
||||||
|
|
||||||
|
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_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_CONTAIN);
|
||||||
|
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_window_present (GTK_WINDOW (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] = { FALSE, FALSE, FALSE, FALSE };
|
||||||
|
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_window_present (GTK_WINDOW (window));
|
||||||
|
else
|
||||||
|
gtk_window_destroy (GTK_WINDOW (window));
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
@@ -0,0 +1,580 @@
|
|||||||
|
/* 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,
|
||||||
|
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_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_CURVES, 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_window_present (GTK_WINDOW (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>
|
||||||
@@ -189,6 +189,7 @@ do_pickers (GtkWidget *do_widget)
|
|||||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||||
|
|
||||||
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
|
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
|
||||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
|
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
|
||||||
|
|
||||||
label = gtk_label_new ("Font:");
|
label = gtk_label_new ("Font:");
|
||||||
@@ -198,6 +199,7 @@ do_pickers (GtkWidget *do_widget)
|
|||||||
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
|
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
|
||||||
|
|
||||||
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
|
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
|
||||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
|
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
|
||||||
|
|
||||||
label = gtk_label_new ("File:");
|
label = gtk_label_new ("File:");
|
||||||
@@ -208,6 +210,9 @@ do_pickers (GtkWidget *do_widget)
|
|||||||
|
|
||||||
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||||
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
button = gtk_button_new_from_icon_name ("document-open-symbolic");
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Select File",
|
||||||
|
-1);
|
||||||
|
|
||||||
label = gtk_label_new ("None");
|
label = gtk_label_new ("None");
|
||||||
|
|
||||||
@@ -223,6 +228,9 @@ do_pickers (GtkWidget *do_widget)
|
|||||||
gtk_box_append (GTK_BOX (picker), button);
|
gtk_box_append (GTK_BOX (picker), button);
|
||||||
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
|
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
|
||||||
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
|
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (app_picker),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Open File",
|
||||||
|
-1);
|
||||||
gtk_widget_set_sensitive (app_picker, FALSE);
|
gtk_widget_set_sensitive (app_picker, FALSE);
|
||||||
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
|
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
|
||||||
gtk_box_append (GTK_BOX (picker), app_picker);
|
gtk_box_append (GTK_BOX (picker), app_picker);
|
||||||
@@ -241,7 +249,7 @@ do_pickers (GtkWidget *do_widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
gtk_widget_set_visible (window, TRUE);
|
gtk_window_present (GTK_WINDOW (window));
|
||||||
else
|
else
|
||||||
gtk_window_destroy (GTK_WINDOW (window));
|
gtk_window_destroy (GTK_WINDOW (window));
|
||||||
|
|
||||||
|
|||||||
@@ -150,20 +150,36 @@ do_video_player (GtkWidget *do_widget)
|
|||||||
|
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
image = gtk_image_new_from_resource ("/cursors/images/gtk_logo_cursor.png");
|
image = gtk_image_new_from_resource ("/cursors/images/gtk_logo_cursor.png");
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL,
|
||||||
|
-1);
|
||||||
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
|
||||||
gtk_button_set_child (GTK_BUTTON (button), image);
|
gtk_button_set_child (GTK_BUTTON (button), image);
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (logo_clicked_cb), video);
|
g_signal_connect (button, "clicked", G_CALLBACK (logo_clicked_cb), video);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "GTK Logo",
|
||||||
|
-1);
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
|
||||||
|
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
image = gtk_image_new_from_resource ("/video-player/bbb.png");
|
image = gtk_image_new_from_resource ("/video-player/bbb.png");
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL,
|
||||||
|
-1);
|
||||||
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
|
||||||
gtk_button_set_child (GTK_BUTTON (button), image);
|
gtk_button_set_child (GTK_BUTTON (button), image);
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (bbb_clicked_cb), video);
|
g_signal_connect (button, "clicked", G_CALLBACK (bbb_clicked_cb), video);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Big Buck Bunny",
|
||||||
|
-1);
|
||||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
|
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
|
||||||
|
|
||||||
fullscreen_button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic");
|
fullscreen_button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic");
|
||||||
g_signal_connect (fullscreen_button, "clicked", G_CALLBACK (fullscreen_clicked_cb), NULL);
|
g_signal_connect (fullscreen_button, "clicked", G_CALLBACK (fullscreen_clicked_cb), NULL);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (fullscreen_button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, "Fullscreen",
|
||||||
|
-1);
|
||||||
|
|
||||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (title), fullscreen_button);
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (title), fullscreen_button);
|
||||||
|
|
||||||
controller = gtk_shortcut_controller_new ();
|
controller = gtk_shortcut_controller_new ();
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
# demos/widget-factory
|
# demos/widget-factory
|
||||||
|
|
||||||
objcopy_supports_add_symbol = false
|
if can_use_objcopy_for_resources
|
||||||
objcopy = find_program('objcopy', required : false)
|
|
||||||
if objcopy.found()
|
|
||||||
objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
|
|
||||||
endif
|
|
||||||
|
|
||||||
ld = find_program('ld', required : false)
|
|
||||||
|
|
||||||
if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
|
||||||
glib_compile_resources = find_program('glib-compile-resources')
|
|
||||||
|
|
||||||
# Create the resource blob
|
# Create the resource blob
|
||||||
widgetfactory_gresource = custom_target('widgetfactory.gresource',
|
widgetfactory_gresource = custom_target('widgetfactory.gresource',
|
||||||
input : 'widget-factory.gresource.xml',
|
input : 'widget-factory.gresource.xml',
|
||||||
|
|||||||
@@ -1572,6 +1572,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="valign">3</property>
|
<property name="valign">3</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVolumeButton">
|
<object class="GtkVolumeButton">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label" translatable="1">Volume</property>
|
||||||
|
</accessibility>
|
||||||
<property name="orientation">1</property>
|
<property name="orientation">1</property>
|
||||||
<property name="valign">3</property>
|
<property name="valign">3</property>
|
||||||
<property name="value">.5</property>
|
<property name="value">.5</property>
|
||||||
@@ -1584,6 +1587,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScaleButton" id="mic-button">
|
<object class="GtkScaleButton" id="mic-button">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label" translatable="1">Microphone gain</property>
|
||||||
|
</accessibility>
|
||||||
<property name="has-tooltip">1</property>
|
<property name="has-tooltip">1</property>
|
||||||
<property name="icons">microphone-sensitivity-muted-symbolic
|
<property name="icons">microphone-sensitivity-muted-symbolic
|
||||||
microphone-sensitivity-high-symbolic
|
microphone-sensitivity-high-symbolic
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ When it comes to rendering, GTK follows the CSS box model as far as practical.
|
|||||||
|
|
||||||
The CSS stylesheet that is in use determines the sizes (and appearance) of the
|
The CSS stylesheet that is in use determines the sizes (and appearance) of the
|
||||||
margin, border and padding areas for each widget. The size of the content area
|
margin, border and padding areas for each widget. The size of the content area
|
||||||
is determined by GTKs layout algorithm using each widgets [vfunc@Gtk.Widget.measure]
|
is determined by GTKs layout algorithm using each widget’s [vfunc@Gtk.Widget.measure]
|
||||||
and [vfunc@Gtk.Widget.size_allocate] vfuncs.
|
and [vfunc@Gtk.Widget.size_allocate] vfuncs.
|
||||||
|
|
||||||
You can learn more about the CSS box model by reading the
|
You can learn more about the CSS box model by reading the
|
||||||
@@ -37,11 +37,11 @@ To learn more about where GTK CSS differs from CSS on the web, see the
|
|||||||
|
|
||||||
The content area in the CSS box model is the region that the widget considers its own.
|
The content area in the CSS box model is the region that the widget considers its own.
|
||||||
|
|
||||||
The origin of the widgets coordinate system is the top left corner of the content area,
|
The origin of the widget’s coordinate system is the top left corner of the content area,
|
||||||
and its size is the widgets size. The size can be queried with [method@Gtk.Widget.get_width]
|
and its size is the widget’s size. The size can be queried with [method@Gtk.Widget.get_width]
|
||||||
and [method@Gtk.Widget.get_height]. GTK allows general 3D transformations to position
|
and [method@Gtk.Widget.get_height]. GTK allows general 3D transformations to position
|
||||||
widgets (although most of the time, the transformation will be a simple 2D translation).
|
widgets (although most of the time, the transformation will be a simple 2D translation).
|
||||||
The transform to go from one widgets coordinate system to another one can be obtained
|
The transform to go from one widget’s coordinate system to another one can be obtained
|
||||||
with [method@Gtk.Widget.compute_transform].
|
with [method@Gtk.Widget.compute_transform].
|
||||||
|
|
||||||
In addition to a size, widgets can optionally have a **_baseline_** to position text on.
|
In addition to a size, widgets can optionally have a **_baseline_** to position text on.
|
||||||
@@ -55,8 +55,8 @@ or [method@Gtk.Widget.compute_bounds]. These methods can fail (either because th
|
|||||||
don't share a common ancestor, or because of a singular transformation), and callers need
|
don't share a common ancestor, or because of a singular transformation), and callers need
|
||||||
to handle this eventuality.
|
to handle this eventuality.
|
||||||
|
|
||||||
Another area that is occasionally relevant are the widgets **_bounds_**, which is the area
|
Another area that is occasionally relevant are the widget’s **_bounds_**, which is the area
|
||||||
that a widgets rendering is typically confined to (technically, widgets can draw outside
|
that a widget’s rendering is typically confined to (technically, widgets can draw outside
|
||||||
of this area, unless clipping is enforced via the [property@Gtk.Widget:overflow] property).
|
of this area, unless clipping is enforced via the [property@Gtk.Widget:overflow] property).
|
||||||
In CSS terms, the bounds of a widget correspond to the border area.
|
In CSS terms, the bounds of a widget correspond to the border area.
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ SYNOPSIS
|
|||||||
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
|
||||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||||
|
| **gtk4-builder-tool** render [OPTIONS...] <FILE>
|
||||||
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@@ -69,12 +70,11 @@ file to use.
|
|||||||
|
|
||||||
Load style information from the given CSS file.
|
Load style information from the given CSS file.
|
||||||
|
|
||||||
Screenshot
|
Render
|
||||||
^^^^^^^^^^
|
^^^^^^
|
||||||
|
|
||||||
The ``screenshot`` command saves a rendering of the UI definition file
|
The ``render`` command saves a rendering of the UI definition file as a png image
|
||||||
as a png image or node file. The name of the file to write can be specified as
|
or node file. The name of the file to write can be specified as a second FILE argument.
|
||||||
a second FILE argument.
|
|
||||||
|
|
||||||
This command accepts options to specify the ID of the toplevel object and a CSS
|
This command accepts options to specify the ID of the toplevel object and a CSS
|
||||||
file to use.
|
file to use.
|
||||||
@@ -96,6 +96,11 @@ file to use.
|
|||||||
|
|
||||||
Overwrite an existing file.
|
Overwrite an existing file.
|
||||||
|
|
||||||
|
Screenshot
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
The ``screenshot`` command is an alias for ``render``.
|
||||||
|
|
||||||
Simplification
|
Simplification
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,12 @@ A number of options affect behavior instead of logging:
|
|||||||
`nograbs`
|
`nograbs`
|
||||||
: Turn off all pointer and keyboard grabs
|
: Turn off all pointer and keyboard grabs
|
||||||
|
|
||||||
|
`portals`
|
||||||
|
: Force the use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||||
|
|
||||||
|
`no-portals`
|
||||||
|
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||||
|
|
||||||
`gl-disable`
|
`gl-disable`
|
||||||
: Disable OpenGL support
|
: Disable OpenGL support
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ described by a set of *attributes*.
|
|||||||
Roles define the taxonomy and semantics of a UI control to any assistive
|
Roles define the taxonomy and semantics of a UI control to any assistive
|
||||||
technology application; for instance, a button will have a role of
|
technology application; for instance, a button will have a role of
|
||||||
`GTK_ACCESSIBLE_ROLE_BUTTON`; an entry will have a role of
|
`GTK_ACCESSIBLE_ROLE_BUTTON`; an entry will have a role of
|
||||||
`GTK_ACCESSIBLE_ROLE_TEXTBOX`; a toggle button will have a role of
|
`GTK_ACCESSIBLE_ROLE_TEXTBOX`; a check button will have a role of
|
||||||
`GTK_ACCESSIBLE_ROLE_CHECKBOX`; etc.
|
`GTK_ACCESSIBLE_ROLE_CHECKBOX`; etc.
|
||||||
|
|
||||||
Each role is part of the widget's instance, and **cannot** be changed over
|
Each role is part of the widget's instance, and **cannot** be changed over
|
||||||
@@ -46,6 +46,7 @@ Each role name is part of the #GtkAccessibleRole enumeration.
|
|||||||
|
|
||||||
| Role name | Description | Related GTK widget |
|
| Role name | Description | Related GTK widget |
|
||||||
|-----------|-------------|--------------------|
|
|-----------|-------------|--------------------|
|
||||||
|
| `APPLICATION` | An application window | [class@Gtk.Window] |
|
||||||
| `BUTTON` | A control that performs an action when pressed | [class@Gtk.Button], [class@Gtk.LinkButton], [class@Gtk.Expander] |
|
| `BUTTON` | A control that performs an action when pressed | [class@Gtk.Button], [class@Gtk.LinkButton], [class@Gtk.Expander] |
|
||||||
| `CHECKBOX` | A control that has three possible value: `true`, `false`, or `undefined` | [class@Gtk.CheckButton] |
|
| `CHECKBOX` | A control that has three possible value: `true`, `false`, or `undefined` | [class@Gtk.CheckButton] |
|
||||||
| `COMBOBOX` | A control that can be expanded to show a list of possible values to select | [class@Gtk.ComboBox] |
|
| `COMBOBOX` | A control that can be expanded to show a list of possible values to select | [class@Gtk.ComboBox] |
|
||||||
@@ -78,7 +79,6 @@ Each role name is part of the #GtkAccessibleRole enumeration.
|
|||||||
| `TAB_PANEL` | A page in a notebook or stack | [class@Gtk.Stack] |
|
| `TAB_PANEL` | A page in a notebook or stack | [class@Gtk.Stack] |
|
||||||
| `TEXT_BOX` | A type of input that allows free-form text as its value. | [class@Gtk.Entry], [class@Gtk.PasswordEntry], [class@Gtk.TextView] |
|
| `TEXT_BOX` | A type of input that allows free-form text as its value. | [class@Gtk.Entry], [class@Gtk.PasswordEntry], [class@Gtk.TextView] |
|
||||||
| `TREE_GRID` | A treeview-like columned list | [class@Gtk.ColumnView] |
|
| `TREE_GRID` | A treeview-like columned list | [class@Gtk.ColumnView] |
|
||||||
| `WINDOW` | An application window | [class@Gtk.Window] |
|
|
||||||
| `...` | … |
|
| `...` | … |
|
||||||
|
|
||||||
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list
|
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list
|
||||||
@@ -204,19 +204,27 @@ you should ensure that:
|
|||||||
readable and localised action performed when pressed; for instance "Copy",
|
readable and localised action performed when pressed; for instance "Copy",
|
||||||
"Paste", "Add layer", or "Remove"
|
"Paste", "Add layer", or "Remove"
|
||||||
|
|
||||||
GTK will try to fill in some information by using ancillary UI control
|
GTK will try to fill in some information by using ancillary UI control properties,
|
||||||
properties, for instance the accessible label will be taken from the label or
|
for instance the accessible name will be taken from the label used by the UI control,
|
||||||
placeholder text used by the UI control, or from its tooltip, if the
|
or from its tooltip, if the `GTK_ACCESSIBLE_PROPERTY_LABEL` property or the
|
||||||
`GTK_ACCESSIBLE_PROPERTY_LABEL` property or the `GTK_ACCESSIBLE_RELATION_LABELLED_BY`
|
`GTK_ACCESSIBLE_RELATION_LABELLED_BY` relation are unset. Similary for the accessible
|
||||||
relation are unset. Nevertheless, it is good practice and project hygiene
|
description. Nevertheless, it is good practice and project hygiene to explicitly specify
|
||||||
to explicitly specify the accessible properties, just like it's good practice
|
the accessible properties, just like it's good practice to specify tooltips and style classes.
|
||||||
to specify tooltips and style classes.
|
|
||||||
|
|
||||||
Application developers using GTK **should** ensure that their UI controls
|
Application developers using GTK **should** ensure that their UI controls
|
||||||
are accessible as part of the development process. When using `GtkBuilder`
|
are accessible as part of the development process. The GTK Inspector shows
|
||||||
templates and UI definition files, GTK provides a validation tool that
|
the accessible attributes of each widget, and also provides an overlay that
|
||||||
verifies that each UI element has a valid role and properties; this tool can
|
can highlight accessibility issues.
|
||||||
be used as part of the application's test suite to avoid regressions.
|
|
||||||
|
It is possible to set accessible attributes in UI files as well:
|
||||||
|
```xml
|
||||||
|
<object class="GtkButton" id="button1">
|
||||||
|
<accessibility>
|
||||||
|
<property name="label">Download</property>
|
||||||
|
<relation name="labelled-by">label1</relation>
|
||||||
|
/accessibility>
|
||||||
|
</object>
|
||||||
|
```
|
||||||
|
|
||||||
## Implementations
|
## Implementations
|
||||||
|
|
||||||
@@ -259,6 +267,13 @@ turn automatically any widget into a `GtkButton`; but if your widget behaves
|
|||||||
like a button, using the %GTK_ACCESSIBLE_ROLE_BUTTON will allow any
|
like a button, using the %GTK_ACCESSIBLE_ROLE_BUTTON will allow any
|
||||||
assistive technology to handle it like they would a `GtkButton`.
|
assistive technology to handle it like they would a `GtkButton`.
|
||||||
|
|
||||||
|
For widgets that act as containers of other widgets, you should use
|
||||||
|
%GTK_ACCESSIBLE_ROLE_GROUP if the grouping of the children is semantic
|
||||||
|
in nature; for instance, the children of a [class@Gtk.HeaderBar] are
|
||||||
|
grouped together on the header of a window. For generic containers that
|
||||||
|
only impose a layout on their children, you should use
|
||||||
|
%GTK_ACCESSIBLE_ROLE_GENERIC instead.
|
||||||
|
|
||||||
### Attributes can both hide and enhance
|
### Attributes can both hide and enhance
|
||||||
|
|
||||||
Accessible attributes can be used to override the content of a UI element,
|
Accessible attributes can be used to override the content of a UI element,
|
||||||
@@ -367,3 +382,6 @@ To allow changing the value via accessible technologies, you can export
|
|||||||
actions. Since the accessibility interfaces only support actions
|
actions. Since the accessibility interfaces only support actions
|
||||||
without parameters, you should provide actions such as `increase-value`
|
without parameters, you should provide actions such as `increase-value`
|
||||||
and `decrease-value`.
|
and `decrease-value`.
|
||||||
|
|
||||||
|
Since GTK 4.10, the best way to suppose changing the value is by implementing
|
||||||
|
the [iface@Gtk.AccessibleRange] interface.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||||
|
|||||||
@@ -645,6 +645,9 @@ gdk_content_formats_builder_clear (GdkContentFormatsBuilder *builder)
|
|||||||
{
|
{
|
||||||
g_clear_pointer (&builder->gtypes, g_slist_free);
|
g_clear_pointer (&builder->gtypes, g_slist_free);
|
||||||
g_clear_pointer (&builder->mime_types, g_slist_free);
|
g_clear_pointer (&builder->mime_types, g_slist_free);
|
||||||
|
|
||||||
|
builder->n_gtypes = 0;
|
||||||
|
builder->n_mime_types = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "gdkglcontextprivate.h"
|
#include "gdkglcontextprivate.h"
|
||||||
#include "gdkmonitorprivate.h"
|
#include "gdkmonitorprivate.h"
|
||||||
#include "gdkrectangle.h"
|
#include "gdkrectangle.h"
|
||||||
|
#include "gdkvulkancontext.h"
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
#include <epoxy/egl.h>
|
#include <epoxy/egl.h>
|
||||||
@@ -383,6 +384,9 @@ gdk_display_dispose (GObject *object)
|
|||||||
#endif
|
#endif
|
||||||
g_clear_error (&priv->gl_error);
|
g_clear_error (&priv->gl_error);
|
||||||
|
|
||||||
|
for (GList *l = display->seats; l; l = l->next)
|
||||||
|
g_object_run_dispose (G_OBJECT (l->data));
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,6 +1217,49 @@ gdk_display_get_keymap (GdkDisplay *display)
|
|||||||
return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
|
return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*<private>
|
||||||
|
* gdk_display_create_vulkan_context:
|
||||||
|
* @self: a `GdkDisplay`
|
||||||
|
* @error: return location for an error
|
||||||
|
*
|
||||||
|
* Creates a new `GdkVulkanContext` for use with @display.
|
||||||
|
*
|
||||||
|
* The context can not be used to draw to surfaces, it can only be
|
||||||
|
* used for custom rendering or compute.
|
||||||
|
*
|
||||||
|
* If the creation of the `GdkVulkanContext` failed, @error will be set.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the newly created `GdkVulkanContext`, or
|
||||||
|
* %NULL on error
|
||||||
|
*/
|
||||||
|
GdkVulkanContext *
|
||||||
|
gdk_display_create_vulkan_context (GdkDisplay *self,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||||
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_VULKAN_DISABLE)
|
||||||
|
{
|
||||||
|
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||||
|
_("Vulkan support disabled via GDK_DEBUG"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDK_DISPLAY_GET_CLASS (self)->vk_extension_name == NULL)
|
||||||
|
{
|
||||||
|
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||||
|
"The %s backend has no Vulkan support.", G_OBJECT_TYPE_NAME (self));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_initable_new (GDK_DISPLAY_GET_CLASS (self)->vk_context_type,
|
||||||
|
NULL,
|
||||||
|
error,
|
||||||
|
"display", self,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_display_init_gl (GdkDisplay *self)
|
gdk_display_init_gl (GdkDisplay *self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ struct _GdkDisplay
|
|||||||
VkDevice vk_device;
|
VkDevice vk_device;
|
||||||
VkQueue vk_queue;
|
VkQueue vk_queue;
|
||||||
uint32_t vk_queue_family_index;
|
uint32_t vk_queue_family_index;
|
||||||
|
VkPipelineCache vk_pipeline_cache;
|
||||||
|
gsize vk_pipeline_cache_size;
|
||||||
|
char *vk_pipeline_cache_etag;
|
||||||
|
guint vk_save_pipeline_cache_source;
|
||||||
|
|
||||||
guint vulkan_refcount;
|
guint vulkan_refcount;
|
||||||
#endif /* GDK_RENDERING_VULKAN */
|
#endif /* GDK_RENDERING_VULKAN */
|
||||||
@@ -202,6 +206,9 @@ gulong _gdk_display_get_next_serial (GdkDisplay *display
|
|||||||
void _gdk_display_pause_events (GdkDisplay *display);
|
void _gdk_display_pause_events (GdkDisplay *display);
|
||||||
void _gdk_display_unpause_events (GdkDisplay *display);
|
void _gdk_display_unpause_events (GdkDisplay *display);
|
||||||
|
|
||||||
|
GdkVulkanContext * gdk_display_create_vulkan_context (GdkDisplay *self,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
||||||
|
|
||||||
gboolean gdk_display_init_egl (GdkDisplay *display,
|
gboolean gdk_display_init_egl (GdkDisplay *display,
|
||||||
|
|||||||
+11
-10
@@ -311,19 +311,20 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
|||||||
g_return_if_fail (priv->surface != NULL);
|
g_return_if_fail (priv->surface != NULL);
|
||||||
g_return_if_fail (region != NULL);
|
g_return_if_fail (region != NULL);
|
||||||
|
|
||||||
gdk_draw_context_begin_frame_full (context, FALSE, region);
|
gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @prefers_high_depth: %TRUE to request a higher bit depth
|
* @depth: best depth to render in
|
||||||
*
|
*
|
||||||
* If high depth is preferred, GDK will see about providing a rendering target
|
* If the given depth is not `GDK_MEMORY_U8`, GDK will see about providing a
|
||||||
* that supports higher bit depth than 8 bits per channel. Typically this means
|
* rendering target that supports a higher bit depth than 8 bits per channel.
|
||||||
* a target supporting 16bit floating point pixels, but that is not guaranteed.
|
* Typically this means a target supporting 16bit floating point pixels, but
|
||||||
|
* that is not guaranteed.
|
||||||
*
|
*
|
||||||
* This is only a request and if the GDK backend does not support HDR rendering
|
* This is only a request and if the GDK backend does not support HDR rendering
|
||||||
* or does not consider it worthwhile, it may choose to not honor the request.
|
* or does not consider it worthwhile, it may choose to not honor the request.
|
||||||
* It may also choose to provide high depth even if it was not requested.
|
* It may also choose to provide a differnet depth even if it was not requested.
|
||||||
* Typically the steps undertaken by a backend are:
|
* Typically the steps undertaken by a backend are:
|
||||||
* 1. Check if high depth is supported by this drawing backend.
|
* 1. Check if high depth is supported by this drawing backend.
|
||||||
* 2. Check if the compositor supports high depth.
|
* 2. Check if the compositor supports high depth.
|
||||||
@@ -333,12 +334,12 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
|||||||
* In either of those cases, the context will usually choose to not honor the request.
|
* In either of those cases, the context will usually choose to not honor the request.
|
||||||
*
|
*
|
||||||
* The rendering code must be able to deal with content in any bit depth, no matter
|
* The rendering code must be able to deal with content in any bit depth, no matter
|
||||||
* the preference. The prefers_high_depth argument is only a hint and GDK is free
|
* the preference. The depth argument is only a hint and GDK is free
|
||||||
* to choose.
|
* to choose.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
const cairo_region_t *region)
|
const cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||||
@@ -365,12 +366,12 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
|
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
|
||||||
prefers_high_depth = TRUE;
|
depth = GDK_MEMORY_FLOAT32;
|
||||||
|
|
||||||
priv->frame_region = cairo_region_copy (region);
|
priv->frame_region = cairo_region_copy (region);
|
||||||
priv->surface->paint_context = g_object_ref (context);
|
priv->surface->paint_context = g_object_ref (context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, depth, priv->frame_region);
|
||||||
|
|
||||||
cairo_region_intersect_rectangle (priv->frame_region,
|
cairo_region_intersect_rectangle (priv->frame_region,
|
||||||
&(cairo_rectangle_int_t) {
|
&(cairo_rectangle_int_t) {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "gdkdrawcontext.h"
|
#include "gdkdrawcontext.h"
|
||||||
|
|
||||||
|
#include "gdkmemoryformatprivate.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
|
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
|
||||||
@@ -40,7 +42,7 @@ struct _GdkDrawContextClass
|
|||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
void (* begin_frame) (GdkDrawContext *context,
|
void (* begin_frame) (GdkDrawContext *context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *update_area);
|
cairo_region_t *update_area);
|
||||||
void (* end_frame) (GdkDrawContext *context,
|
void (* end_frame) (GdkDrawContext *context,
|
||||||
cairo_region_t *painted);
|
cairo_region_t *painted);
|
||||||
@@ -50,7 +52,7 @@ struct _GdkDrawContextClass
|
|||||||
void gdk_draw_context_surface_resized (GdkDrawContext *context);
|
void gdk_draw_context_surface_resized (GdkDrawContext *context);
|
||||||
|
|
||||||
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
const cairo_region_t *region);
|
const cairo_region_t *region);
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <gdk/version/gdkversionmacros.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,6 +308,20 @@ typedef enum
|
|||||||
* the alpha value. Since: 4.6
|
* the alpha value. Since: 4.6
|
||||||
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
||||||
* alpha. Since: 4.6
|
* alpha. Since: 4.6
|
||||||
|
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
|
||||||
|
* values are premultiplied with the alpha value. Since: 4.12
|
||||||
|
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
|
||||||
|
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
|
||||||
|
* Since: 4.12
|
||||||
|
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
|
||||||
|
* The color values are premultiplied with the alpha value. Since: 4.12
|
||||||
|
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
|
||||||
|
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
|
||||||
|
* Since: 4.12
|
||||||
|
* @GDK_MEMORY_A8: One byte; for alpha.
|
||||||
|
* Since: 4.12
|
||||||
|
* @GDK_MEMORY_A16: One guint16 value; for alpha.
|
||||||
|
* Since: 4.12
|
||||||
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
||||||
* more formats get added, so do not rely on its concrete integer.
|
* more formats get added, so do not rely on its concrete integer.
|
||||||
*
|
*
|
||||||
@@ -340,6 +356,14 @@ typedef enum {
|
|||||||
GDK_MEMORY_R32G32B32_FLOAT,
|
GDK_MEMORY_R32G32B32_FLOAT,
|
||||||
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||||
GDK_MEMORY_R32G32B32A32_FLOAT,
|
GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||||
|
GDK_MEMORY_G8A8_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_G8A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_G8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_G16A16_PREMULTIPLIED GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_G16A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_G16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_A8 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
GDK_MEMORY_A16 GDK_AVAILABLE_ENUMERATOR_IN_4_12,
|
||||||
|
|
||||||
GDK_MEMORY_N_FORMATS
|
GDK_MEMORY_N_FORMATS
|
||||||
} GdkMemoryFormat;
|
} GdkMemoryFormat;
|
||||||
|
|||||||
+4
-8
@@ -173,12 +173,8 @@ static GPrivate thread_current_context = G_PRIVATE_INIT (unref_unmasked);
|
|||||||
static void
|
static void
|
||||||
gdk_gl_context_clear_old_updated_area (GdkGLContext *context)
|
gdk_gl_context_clear_old_updated_area (GdkGLContext *context)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned int i = 0; i < GDK_GL_MAX_TRACKED_BUFFERS; i++)
|
||||||
|
g_clear_pointer (&context->old_updated_area[i], cairo_region_destroy);
|
||||||
for (i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
g_clear_pointer (&context->old_updated_area[i], cairo_region_destroy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -585,7 +581,7 @@ gdk_gl_context_get_scale (GdkGLContext *self)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||||
@@ -601,7 +597,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
|||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
if (priv->egl_context)
|
if (priv->egl_context)
|
||||||
gdk_surface_ensure_egl_surface (surface, prefers_high_depth);
|
gdk_surface_ensure_egl_surface (surface, depth != GDK_MEMORY_U8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||||
|
|||||||
+139
-15
@@ -138,6 +138,7 @@ static gboolean
|
|||||||
gdk_gl_texture_find_format (gboolean use_es,
|
gdk_gl_texture_find_format (gboolean use_es,
|
||||||
guint gl_major,
|
guint gl_major,
|
||||||
guint gl_minor,
|
guint gl_minor,
|
||||||
|
GdkMemoryAlpha alpha,
|
||||||
GLint gl_format,
|
GLint gl_format,
|
||||||
GLint gl_type,
|
GLint gl_type,
|
||||||
GdkMemoryFormat *out_format)
|
GdkMemoryFormat *out_format)
|
||||||
@@ -147,8 +148,12 @@ gdk_gl_texture_find_format (gboolean use_es,
|
|||||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||||
{
|
{
|
||||||
GLenum q_internal_format, q_format, q_type;
|
GLenum q_internal_format, q_format, q_type;
|
||||||
|
GLint q_swizzle[4];
|
||||||
|
|
||||||
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type))
|
if (gdk_memory_format_alpha (format) != alpha)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (q_format != gl_format || q_type != gl_type)
|
if (q_format != gl_format || q_type != gl_type)
|
||||||
@@ -167,23 +172,57 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
gpointer download_)
|
gpointer download_)
|
||||||
{
|
{
|
||||||
GdkTexture *texture = GDK_TEXTURE (self);
|
GdkTexture *texture = GDK_TEXTURE (self);
|
||||||
|
GdkMemoryFormat format;
|
||||||
gsize expected_stride;
|
gsize expected_stride;
|
||||||
Download *download = download_;
|
Download *download = download_;
|
||||||
GLenum gl_internal_format, gl_format, gl_type;
|
GLenum gl_internal_format, gl_format, gl_type;
|
||||||
|
GLint gl_swizzle[4];
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
||||||
|
format = gdk_texture_get_format (texture),
|
||||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||||
gdk_gl_context_get_version (context, &major, &minor);
|
gdk_gl_context_get_version (context, &major, &minor);
|
||||||
|
|
||||||
if (download->stride == expected_stride &&
|
if (!gdk_gl_context_get_use_es (context) &&
|
||||||
!gdk_gl_context_get_use_es (context) &&
|
gdk_memory_format_gl_format (format,
|
||||||
gdk_memory_format_gl_format (download->format, TRUE, major, minor, &gl_internal_format, &gl_format, &gl_type))
|
FALSE,
|
||||||
|
major, minor,
|
||||||
|
&gl_internal_format,
|
||||||
|
&gl_format, &gl_type, &gl_swizzle))
|
||||||
{
|
{
|
||||||
glGetTexImage (GL_TEXTURE_2D,
|
if (download->stride == expected_stride &&
|
||||||
0,
|
download->format == format)
|
||||||
gl_format,
|
{
|
||||||
gl_type,
|
glGetTexImage (GL_TEXTURE_2D,
|
||||||
download->data);
|
0,
|
||||||
|
gl_format,
|
||||||
|
gl_type,
|
||||||
|
download->data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gsize stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||||
|
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||||
|
|
||||||
|
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||||
|
glGetTexImage (GL_TEXTURE_2D,
|
||||||
|
0,
|
||||||
|
gl_format,
|
||||||
|
gl_type,
|
||||||
|
pixels);
|
||||||
|
|
||||||
|
gdk_memory_convert (download->data,
|
||||||
|
download->stride,
|
||||||
|
download->format,
|
||||||
|
pixels,
|
||||||
|
stride,
|
||||||
|
format,
|
||||||
|
texture->width,
|
||||||
|
texture->height);
|
||||||
|
|
||||||
|
g_free (pixels);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -196,17 +235,26 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
||||||
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
||||||
{
|
{
|
||||||
gdk_gl_context_get_version (context, &major, &minor);
|
|
||||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
|
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
|
||||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
|
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
|
||||||
if (!gdk_gl_texture_find_format (gdk_gl_context_get_use_es (context), major, minor, gl_read_format, gl_read_type, &actual_format))
|
if (!gdk_gl_texture_find_format (TRUE, major, minor, gdk_memory_format_alpha (format), gl_read_format, gl_read_type, &actual_format))
|
||||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
{
|
||||||
|
gl_read_format = GL_RGBA;
|
||||||
|
gl_read_type = GL_UNSIGNED_BYTE;
|
||||||
|
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||||
|
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||||
|
else
|
||||||
|
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl_read_format = GL_RGBA;
|
gl_read_format = GL_RGBA;
|
||||||
gl_read_type = GL_UNSIGNED_BYTE;
|
gl_read_type = GL_UNSIGNED_BYTE;
|
||||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||||
|
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||||
|
else
|
||||||
|
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (download->format == actual_format &&
|
if (download->format == actual_format &&
|
||||||
@@ -221,19 +269,95 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
|
gsize actual_bpp = gdk_memory_format_bytes_per_pixel (actual_format);
|
||||||
guchar *pixels = g_malloc_n (texture->width * actual_bpp, texture->height);
|
gsize stride = actual_bpp * texture->width;
|
||||||
|
guchar *pixels = g_malloc_n (stride, texture->height);
|
||||||
|
|
||||||
|
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||||
glReadPixels (0, 0,
|
glReadPixels (0, 0,
|
||||||
texture->width, texture->height,
|
texture->width, texture->height,
|
||||||
gl_read_format,
|
gl_read_format,
|
||||||
gl_read_type,
|
gl_read_type,
|
||||||
pixels);
|
pixels);
|
||||||
|
|
||||||
|
/* Fix up gles inadequacies */
|
||||||
|
|
||||||
|
if (gl_read_format == GL_RGBA &&
|
||||||
|
gl_read_type == GL_UNSIGNED_BYTE &&
|
||||||
|
(format == GDK_MEMORY_G8A8 ||
|
||||||
|
format == GDK_MEMORY_G8A8_PREMULTIPLIED ||
|
||||||
|
format == GDK_MEMORY_G8 ||
|
||||||
|
format == GDK_MEMORY_A8))
|
||||||
|
{
|
||||||
|
for (unsigned int y = 0; y < texture->height; y++)
|
||||||
|
{
|
||||||
|
for (unsigned int x = 0; x < texture->width; x++)
|
||||||
|
{
|
||||||
|
guchar *data = &pixels[y * stride + x * actual_bpp];
|
||||||
|
if (format == GDK_MEMORY_G8A8 ||
|
||||||
|
format == GDK_MEMORY_G8A8_PREMULTIPLIED)
|
||||||
|
{
|
||||||
|
data[3] = data[1];
|
||||||
|
data[1] = data[0];
|
||||||
|
data[2] = data[0];
|
||||||
|
}
|
||||||
|
else if (format == GDK_MEMORY_G8)
|
||||||
|
{
|
||||||
|
data[1] = data[0];
|
||||||
|
data[2] = data[0];
|
||||||
|
data[3] = 0xff;
|
||||||
|
}
|
||||||
|
else if (format == GDK_MEMORY_A8)
|
||||||
|
{
|
||||||
|
data[3] = data[0];
|
||||||
|
data[0] = 0;
|
||||||
|
data[1] = 0;
|
||||||
|
data[2] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gl_read_format == GL_RGBA &&
|
||||||
|
gl_read_type == GL_UNSIGNED_SHORT &&
|
||||||
|
(format == GDK_MEMORY_G16A16 ||
|
||||||
|
format == GDK_MEMORY_G16A16_PREMULTIPLIED ||
|
||||||
|
format == GDK_MEMORY_G16 ||
|
||||||
|
format == GDK_MEMORY_A16))
|
||||||
|
{
|
||||||
|
for (unsigned int y = 0; y < texture->height; y++)
|
||||||
|
{
|
||||||
|
for (unsigned int x = 0; x < texture->width; x++)
|
||||||
|
{
|
||||||
|
guint16 *data = (guint16 *) &pixels[y * stride + x * actual_bpp];
|
||||||
|
if (format == GDK_MEMORY_G16A16 ||
|
||||||
|
format == GDK_MEMORY_G16A16_PREMULTIPLIED)
|
||||||
|
{
|
||||||
|
data[3] = data[1];
|
||||||
|
data[1] = data[0];
|
||||||
|
data[2] = data[0];
|
||||||
|
}
|
||||||
|
else if (format == GDK_MEMORY_G16)
|
||||||
|
{
|
||||||
|
data[1] = data[0];
|
||||||
|
data[2] = data[0];
|
||||||
|
data[3] = 0xffff;
|
||||||
|
}
|
||||||
|
else if (format == GDK_MEMORY_A16)
|
||||||
|
{
|
||||||
|
data[3] = data[0];
|
||||||
|
data[0] = 0;
|
||||||
|
data[1] = 0;
|
||||||
|
data[2] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gdk_memory_convert (download->data,
|
gdk_memory_convert (download->data,
|
||||||
download->stride,
|
download->stride,
|
||||||
download->format,
|
download->format,
|
||||||
pixels,
|
pixels,
|
||||||
texture->width * actual_bpp,
|
stride,
|
||||||
actual_format,
|
actual_format,
|
||||||
texture->width,
|
texture->width,
|
||||||
texture->height);
|
texture->height);
|
||||||
|
|||||||
@@ -644,10 +644,18 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
|
|||||||
* The format is the preferred format the texture data should be downloaded to. The
|
* The format is the preferred format the texture data should be downloaded to. The
|
||||||
* format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
|
* format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
|
||||||
*
|
*
|
||||||
|
* GDK's texture download code assumes that the format corresponds to the storage
|
||||||
|
* parameters of the GL texture in an obvious way. For example, a format of
|
||||||
|
* `GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16`
|
||||||
|
* texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture.
|
||||||
|
*
|
||||||
* Setting the right format is particularly useful when using high bit depth textures
|
* Setting the right format is particularly useful when using high bit depth textures
|
||||||
* to preserve the bit depth, to set the correct value for unpremultiplied textures
|
* to preserve the bit depth, to set the correct value for unpremultiplied textures
|
||||||
* and to make sure opaque textures are treated as such.
|
* and to make sure opaque textures are treated as such.
|
||||||
*
|
*
|
||||||
|
* Non-RGBA textures need to have swizzling parameters set up properly to be usable
|
||||||
|
* in GSK's shaders.
|
||||||
|
*
|
||||||
* Since: 4.12
|
* Since: 4.12
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|||||||
+205
-52
@@ -60,6 +60,36 @@ name ## _from_float (guchar *dest_data, \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TYPED_GRAY_FUNCS(name, T, G, A, bpp, scale) \
|
||||||
|
static void \
|
||||||
|
name ## _to_float (float *dest, \
|
||||||
|
const guchar *src_data, \
|
||||||
|
gsize n) \
|
||||||
|
{ \
|
||||||
|
for (gsize i = 0; i < n; i++) \
|
||||||
|
{ \
|
||||||
|
T *src = (T *) (src_data + i * bpp); \
|
||||||
|
if (G >= 0) dest[0] = (float) src[G] / scale; else dest[0] = 1.0; \
|
||||||
|
dest[1] = dest[2] = dest[0]; \
|
||||||
|
if (A >= 0) dest[3] = (float) src[A] / scale; else dest[3] = 1.0; \
|
||||||
|
dest += 4; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
static void \
|
||||||
|
name ## _from_float (guchar *dest_data, \
|
||||||
|
const float *src, \
|
||||||
|
gsize n) \
|
||||||
|
{ \
|
||||||
|
for (gsize i = 0; i < n; i++) \
|
||||||
|
{ \
|
||||||
|
T *dest = (T *) (dest_data + i * bpp); \
|
||||||
|
if (G >= 0) dest[G] = CLAMP ((src[0] + src[1] + src[2]) * scale / 3.f + 0.5, 0, scale); \
|
||||||
|
if (A >= 0) dest[A] = CLAMP (src[3] * scale + 0.5, 0, scale); \
|
||||||
|
src += 4; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
TYPED_FUNCS (b8g8r8a8_premultiplied, guchar, 2, 1, 0, 3, 4, 255)
|
TYPED_FUNCS (b8g8r8a8_premultiplied, guchar, 2, 1, 0, 3, 4, 255)
|
||||||
TYPED_FUNCS (a8r8g8b8_premultiplied, guchar, 1, 2, 3, 0, 4, 255)
|
TYPED_FUNCS (a8r8g8b8_premultiplied, guchar, 1, 2, 3, 0, 4, 255)
|
||||||
TYPED_FUNCS (r8g8b8a8_premultiplied, guchar, 0, 1, 2, 3, 4, 255)
|
TYPED_FUNCS (r8g8b8a8_premultiplied, guchar, 0, 1, 2, 3, 4, 255)
|
||||||
@@ -72,6 +102,15 @@ TYPED_FUNCS (b8g8r8, guchar, 2, 1, 0, -1, 3, 255)
|
|||||||
TYPED_FUNCS (r16g16b16, guint16, 0, 1, 2, -1, 6, 65535)
|
TYPED_FUNCS (r16g16b16, guint16, 0, 1, 2, -1, 6, 65535)
|
||||||
TYPED_FUNCS (r16g16b16a16, guint16, 0, 1, 2, 3, 8, 65535)
|
TYPED_FUNCS (r16g16b16a16, guint16, 0, 1, 2, 3, 8, 65535)
|
||||||
|
|
||||||
|
TYPED_GRAY_FUNCS (g8a8_premultiplied, guchar, 0, 1, 2, 255)
|
||||||
|
TYPED_GRAY_FUNCS (g8a8, guchar, 0, 1, 2, 255)
|
||||||
|
TYPED_GRAY_FUNCS (g8, guchar, 0, -1, 1, 255)
|
||||||
|
TYPED_GRAY_FUNCS (a8, guchar, -1, 0, 1, 255)
|
||||||
|
TYPED_GRAY_FUNCS (g16a16_premultiplied, guint16, 0, 1, 4, 65535)
|
||||||
|
TYPED_GRAY_FUNCS (g16a16, guint16, 0, 1, 4, 65535)
|
||||||
|
TYPED_GRAY_FUNCS (g16, guint16, 0, -1, 2, 65535)
|
||||||
|
TYPED_GRAY_FUNCS (a16, guint16, -1, 0, 2, 65535)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
r16g16b16_float_to_float (float *dest,
|
r16g16b16_float_to_float (float *dest,
|
||||||
const guchar *src_data,
|
const guchar *src_data,
|
||||||
@@ -219,7 +258,7 @@ struct _GdkMemoryFormatDescription
|
|||||||
GdkMemoryAlpha alpha;
|
GdkMemoryAlpha alpha;
|
||||||
gsize bytes_per_pixel;
|
gsize bytes_per_pixel;
|
||||||
gsize alignment;
|
gsize alignment;
|
||||||
gboolean prefers_high_depth;
|
GdkMemoryDepth depth;
|
||||||
struct {
|
struct {
|
||||||
guint gl_major;
|
guint gl_major;
|
||||||
guint gl_minor;
|
guint gl_minor;
|
||||||
@@ -230,6 +269,7 @@ struct _GdkMemoryFormatDescription
|
|||||||
guint internal_format;
|
guint internal_format;
|
||||||
guint format;
|
guint format;
|
||||||
guint type;
|
guint type;
|
||||||
|
GLint swizzle[4];
|
||||||
} gl;
|
} gl;
|
||||||
/* no premultiplication going on here */
|
/* no premultiplication going on here */
|
||||||
void (* to_float) (float *, const guchar*, gsize);
|
void (* to_float) (float *, const guchar*, gsize);
|
||||||
@@ -249,9 +289,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
|
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
b8g8r8a8_premultiplied_to_float,
|
b8g8r8a8_premultiplied_to_float,
|
||||||
b8g8r8a8_premultiplied_from_float,
|
b8g8r8a8_premultiplied_from_float,
|
||||||
},
|
},
|
||||||
@@ -259,9 +299,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
a8r8g8b8_premultiplied_to_float,
|
a8r8g8b8_premultiplied_to_float,
|
||||||
a8r8g8b8_premultiplied_from_float,
|
a8r8g8b8_premultiplied_from_float,
|
||||||
},
|
},
|
||||||
@@ -269,9 +309,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
|
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r8g8b8a8_premultiplied_to_float,
|
r8g8b8a8_premultiplied_to_float,
|
||||||
r8g8b8a8_premultiplied_from_float,
|
r8g8b8a8_premultiplied_from_float,
|
||||||
},
|
},
|
||||||
@@ -279,9 +319,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE },
|
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
b8g8r8a8_to_float,
|
b8g8r8a8_to_float,
|
||||||
b8g8r8a8_from_float,
|
b8g8r8a8_from_float,
|
||||||
},
|
},
|
||||||
@@ -289,9 +329,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
a8r8g8b8_to_float,
|
a8r8g8b8_to_float,
|
||||||
a8r8g8b8_from_float,
|
a8r8g8b8_from_float,
|
||||||
},
|
},
|
||||||
@@ -299,9 +339,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE },
|
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r8g8b8a8_to_float,
|
r8g8b8a8_to_float,
|
||||||
r8g8b8a8_from_float,
|
r8g8b8a8_from_float,
|
||||||
},
|
},
|
||||||
@@ -309,9 +349,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
4,
|
4,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED },
|
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
a8b8g8r8_to_float,
|
a8b8g8r8_to_float,
|
||||||
a8b8g8r8_from_float,
|
a8b8g8r8_from_float,
|
||||||
},
|
},
|
||||||
@@ -319,9 +359,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE,
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
3,
|
3,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE },
|
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||||
r8g8b8_to_float,
|
r8g8b8_to_float,
|
||||||
r8g8b8_from_float,
|
r8g8b8_from_float,
|
||||||
},
|
},
|
||||||
@@ -329,9 +369,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE,
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
3,
|
3,
|
||||||
G_ALIGNOF (guchar),
|
G_ALIGNOF (guchar),
|
||||||
FALSE,
|
GDK_MEMORY_U8,
|
||||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE },
|
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||||
b8g8r8_to_float,
|
b8g8r8_to_float,
|
||||||
b8g8r8_from_float,
|
b8g8r8_from_float,
|
||||||
},
|
},
|
||||||
@@ -339,9 +379,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE,
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
6,
|
6,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_U16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT },
|
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||||
r16g16b16_to_float,
|
r16g16b16_to_float,
|
||||||
r16g16b16_from_float,
|
r16g16b16_from_float,
|
||||||
},
|
},
|
||||||
@@ -349,9 +389,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
8,
|
8,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_U16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
|
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r16g16b16a16_to_float,
|
r16g16b16a16_to_float,
|
||||||
r16g16b16a16_from_float,
|
r16g16b16a16_from_float,
|
||||||
},
|
},
|
||||||
@@ -359,9 +399,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
8,
|
8,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_U16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT },
|
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r16g16b16a16_to_float,
|
r16g16b16a16_to_float,
|
||||||
r16g16b16a16_from_float,
|
r16g16b16a16_from_float,
|
||||||
},
|
},
|
||||||
@@ -369,9 +409,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE,
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
6,
|
6,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_FLOAT16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT },
|
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||||
r16g16b16_float_to_float,
|
r16g16b16_float_to_float,
|
||||||
r16g16b16_float_from_float,
|
r16g16b16_float_from_float,
|
||||||
},
|
},
|
||||||
@@ -379,9 +419,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
8,
|
8,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_FLOAT16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
|
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r16g16b16a16_float_to_float,
|
r16g16b16a16_float_to_float,
|
||||||
r16g16b16a16_float_from_float,
|
r16g16b16a16_float_from_float,
|
||||||
},
|
},
|
||||||
@@ -389,9 +429,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
8,
|
8,
|
||||||
G_ALIGNOF (guint16),
|
G_ALIGNOF (guint16),
|
||||||
TRUE,
|
GDK_MEMORY_FLOAT16,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT },
|
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r16g16b16a16_float_to_float,
|
r16g16b16a16_float_to_float,
|
||||||
r16g16b16a16_float_from_float,
|
r16g16b16a16_float_from_float,
|
||||||
},
|
},
|
||||||
@@ -399,9 +439,9 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE,
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
12,
|
12,
|
||||||
G_ALIGNOF (float),
|
G_ALIGNOF (float),
|
||||||
TRUE,
|
GDK_MEMORY_FLOAT32,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGB32F, GL_RGB, GL_FLOAT },
|
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||||
r32g32b32_float_to_float,
|
r32g32b32_float_to_float,
|
||||||
r32g32b32_float_from_float,
|
r32g32b32_float_from_float,
|
||||||
},
|
},
|
||||||
@@ -411,7 +451,7 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
G_ALIGNOF (float),
|
G_ALIGNOF (float),
|
||||||
TRUE,
|
TRUE,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
|
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r32g32b32a32_float_to_float,
|
r32g32b32a32_float_to_float,
|
||||||
r32g32b32a32_float_from_float,
|
r32g32b32a32_float_from_float,
|
||||||
},
|
},
|
||||||
@@ -419,11 +459,91 @@ static const GdkMemoryFormatDescription memory_formats[GDK_MEMORY_N_FORMATS] = {
|
|||||||
GDK_MEMORY_ALPHA_STRAIGHT,
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
16,
|
16,
|
||||||
G_ALIGNOF (float),
|
G_ALIGNOF (float),
|
||||||
TRUE,
|
GDK_MEMORY_FLOAT32,
|
||||||
{ 0, 0, 3, 0 },
|
{ 0, 0, 3, 0 },
|
||||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT },
|
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||||
r32g32b32a32_float_to_float,
|
r32g32b32a32_float_to_float,
|
||||||
r32g32b32a32_float_from_float,
|
r32g32b32a32_float_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
|
||||||
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
|
2,
|
||||||
|
G_ALIGNOF (guchar),
|
||||||
|
GDK_MEMORY_U8,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||||
|
g8a8_premultiplied_to_float,
|
||||||
|
g8a8_premultiplied_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G8A8] = {
|
||||||
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
|
2,
|
||||||
|
G_ALIGNOF (guchar),
|
||||||
|
GDK_MEMORY_U8,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||||
|
g8a8_to_float,
|
||||||
|
g8a8_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G8] = {
|
||||||
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
|
1,
|
||||||
|
G_ALIGNOF (guchar),
|
||||||
|
GDK_MEMORY_U8,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_ONE } },
|
||||||
|
g8_to_float,
|
||||||
|
g8_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
|
||||||
|
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||||
|
4,
|
||||||
|
G_ALIGNOF (guint16),
|
||||||
|
GDK_MEMORY_U16,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||||
|
g16a16_premultiplied_to_float,
|
||||||
|
g16a16_premultiplied_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G16A16] = {
|
||||||
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
|
4,
|
||||||
|
G_ALIGNOF (guint16),
|
||||||
|
GDK_MEMORY_U16,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
|
||||||
|
g16a16_to_float,
|
||||||
|
g16a16_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_G16] = {
|
||||||
|
GDK_MEMORY_ALPHA_OPAQUE,
|
||||||
|
2,
|
||||||
|
G_ALIGNOF (guint16),
|
||||||
|
GDK_MEMORY_U16,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_ONE } },
|
||||||
|
g16_to_float,
|
||||||
|
g16_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_A8] = {
|
||||||
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
|
1,
|
||||||
|
G_ALIGNOF (guchar),
|
||||||
|
GDK_MEMORY_U8,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
|
||||||
|
a8_to_float,
|
||||||
|
a8_from_float,
|
||||||
|
},
|
||||||
|
[GDK_MEMORY_A16] = {
|
||||||
|
GDK_MEMORY_ALPHA_STRAIGHT,
|
||||||
|
2,
|
||||||
|
G_ALIGNOF (guint16),
|
||||||
|
GDK_MEMORY_U16,
|
||||||
|
{ 0, 0, 3, 0 },
|
||||||
|
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_ONE, GL_ONE, GL_ONE, GL_RED } },
|
||||||
|
a16_to_float,
|
||||||
|
a16_from_float,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -446,23 +566,57 @@ gdk_memory_format_alignment (GdkMemoryFormat format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*<private>
|
/*<private>
|
||||||
* gdk_memory_format_prefers_high_depth:
|
* gdk_memory_format_get_depth:
|
||||||
* @format: a memory format
|
* @format: a memory format
|
||||||
*
|
*
|
||||||
* Checks if the given format benefits from being rendered
|
* Gets the depth of the individual channels of the format.
|
||||||
* in bit depths higher than 8bits per pixel. See
|
* See gsk_render_node_prefers_high_depth() for more
|
||||||
* gsk_render_node_prefers_high_depth() for more information
|
* information on this.
|
||||||
* on this.
|
|
||||||
* Usually this is the case when
|
|
||||||
* gdk_memory_format_bytes_per_pixel() is larger than 4.
|
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the format benefits from being
|
* Usually renderers want to use higher depth for render
|
||||||
* composited in hgiher bit depths.
|
* targets to match these formats.
|
||||||
|
*
|
||||||
|
* Returns: The depth of this format
|
||||||
**/
|
**/
|
||||||
gboolean
|
GdkMemoryDepth
|
||||||
gdk_memory_format_prefers_high_depth (GdkMemoryFormat format)
|
gdk_memory_format_get_depth (GdkMemoryFormat format)
|
||||||
{
|
{
|
||||||
return memory_formats[format].prefers_high_depth;
|
return memory_formats[format].depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*<private>
|
||||||
|
* gdk_memory_depth_merge:
|
||||||
|
* @depth1: the first depth
|
||||||
|
* @depth2: the second depth
|
||||||
|
*
|
||||||
|
* Returns a depth that can accomodate both given depths
|
||||||
|
* without any loss of precision.
|
||||||
|
*
|
||||||
|
* Returns: The merged depth
|
||||||
|
**/
|
||||||
|
GdkMemoryDepth
|
||||||
|
gdk_memory_depth_merge (GdkMemoryDepth depth1,
|
||||||
|
GdkMemoryDepth depth2)
|
||||||
|
{
|
||||||
|
switch (depth1)
|
||||||
|
{
|
||||||
|
case GDK_MEMORY_U8:
|
||||||
|
return depth2;
|
||||||
|
|
||||||
|
case GDK_MEMORY_FLOAT32:
|
||||||
|
return GDK_MEMORY_FLOAT32;
|
||||||
|
|
||||||
|
case GDK_MEMORY_U16:
|
||||||
|
case GDK_MEMORY_FLOAT16:
|
||||||
|
if (depth2 == depth1 || depth2 == GDK_MEMORY_U8)
|
||||||
|
return depth1;
|
||||||
|
else
|
||||||
|
return GDK_MEMORY_FLOAT32;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
return GDK_MEMORY_U8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -472,14 +626,13 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
|||||||
guint gl_minor,
|
guint gl_minor,
|
||||||
guint *out_internal_format,
|
guint *out_internal_format,
|
||||||
guint *out_format,
|
guint *out_format,
|
||||||
guint *out_type)
|
guint *out_type,
|
||||||
|
GLint (*out_swizzle)[4])
|
||||||
{
|
{
|
||||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||||
*out_format = memory_formats[format].gl.format;
|
*out_format = memory_formats[format].gl.format;
|
||||||
*out_type = memory_formats[format].gl.type;
|
*out_type = memory_formats[format].gl.type;
|
||||||
|
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
|
||||||
if (memory_formats[format].alpha == GDK_MEMORY_ALPHA_STRAIGHT)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (gles)
|
if (gles)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "gdkenums.h"
|
#include "gdkenums.h"
|
||||||
|
|
||||||
|
#include <epoxy/gl.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -29,17 +31,27 @@ typedef enum {
|
|||||||
GDK_MEMORY_ALPHA_OPAQUE
|
GDK_MEMORY_ALPHA_OPAQUE
|
||||||
} GdkMemoryAlpha;
|
} GdkMemoryAlpha;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GDK_MEMORY_U8,
|
||||||
|
GDK_MEMORY_U16,
|
||||||
|
GDK_MEMORY_FLOAT16,
|
||||||
|
GDK_MEMORY_FLOAT32
|
||||||
|
} GdkMemoryDepth;
|
||||||
|
|
||||||
gsize gdk_memory_format_alignment (GdkMemoryFormat format) G_GNUC_CONST;
|
gsize gdk_memory_format_alignment (GdkMemoryFormat format) G_GNUC_CONST;
|
||||||
GdkMemoryAlpha gdk_memory_format_alpha (GdkMemoryFormat format) G_GNUC_CONST;
|
GdkMemoryAlpha gdk_memory_format_alpha (GdkMemoryFormat format) G_GNUC_CONST;
|
||||||
gsize gdk_memory_format_bytes_per_pixel (GdkMemoryFormat format) G_GNUC_CONST;
|
gsize gdk_memory_format_bytes_per_pixel (GdkMemoryFormat format) G_GNUC_CONST;
|
||||||
gboolean gdk_memory_format_prefers_high_depth(GdkMemoryFormat format) G_GNUC_CONST;
|
GdkMemoryDepth gdk_memory_format_get_depth (GdkMemoryFormat format) G_GNUC_CONST;
|
||||||
|
GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth depth1,
|
||||||
|
GdkMemoryDepth depth2) G_GNUC_CONST;
|
||||||
gboolean gdk_memory_format_gl_format (GdkMemoryFormat format,
|
gboolean gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||||
gboolean gles,
|
gboolean gles,
|
||||||
guint gl_major,
|
guint gl_major,
|
||||||
guint gl_minor,
|
guint gl_minor,
|
||||||
guint *out_internal_format,
|
guint *out_internal_format,
|
||||||
guint *out_format,
|
guint *out_format,
|
||||||
guint *out_type);
|
guint *out_type,
|
||||||
|
GLint (*out_gizzle)[4]);
|
||||||
|
|
||||||
void gdk_memory_convert (guchar *dest_data,
|
void gdk_memory_convert (guchar *dest_data,
|
||||||
gsize dest_stride,
|
gsize dest_stride,
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ typedef enum {
|
|||||||
GDK_SEAT_CAPABILITY_KEYBOARD = 1 << 3,
|
GDK_SEAT_CAPABILITY_KEYBOARD = 1 << 3,
|
||||||
GDK_SEAT_CAPABILITY_TABLET_PAD = 1 << 4,
|
GDK_SEAT_CAPABILITY_TABLET_PAD = 1 << 4,
|
||||||
GDK_SEAT_CAPABILITY_ALL_POINTING = (GDK_SEAT_CAPABILITY_POINTER | GDK_SEAT_CAPABILITY_TOUCH | GDK_SEAT_CAPABILITY_TABLET_STYLUS),
|
GDK_SEAT_CAPABILITY_ALL_POINTING = (GDK_SEAT_CAPABILITY_POINTER | GDK_SEAT_CAPABILITY_TOUCH | GDK_SEAT_CAPABILITY_TABLET_STYLUS),
|
||||||
GDK_SEAT_CAPABILITY_ALL = (GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD)
|
GDK_SEAT_CAPABILITY_ALL = (GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD)
|
||||||
} GdkSeatCapabilities;
|
} GdkSeatCapabilities;
|
||||||
|
|
||||||
struct _GdkSeat
|
struct _GdkSeat
|
||||||
|
|||||||
+361
-25
@@ -47,7 +47,12 @@ typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
|||||||
struct _GdkVulkanContextPrivate {
|
struct _GdkVulkanContextPrivate {
|
||||||
#ifdef GDK_RENDERING_VULKAN
|
#ifdef GDK_RENDERING_VULKAN
|
||||||
VkSurfaceKHR surface;
|
VkSurfaceKHR surface;
|
||||||
VkSurfaceFormatKHR image_format;
|
struct {
|
||||||
|
VkSurfaceFormatKHR vk_format;
|
||||||
|
GdkMemoryFormat gdk_format;
|
||||||
|
} formats[4];
|
||||||
|
GdkMemoryDepth current_format;
|
||||||
|
GdkMemoryFormat offscreen_formats[4];
|
||||||
|
|
||||||
VkSwapchainKHR swapchain;
|
VkSwapchainKHR swapchain;
|
||||||
VkSemaphore draw_semaphore;
|
VkSemaphore draw_semaphore;
|
||||||
@@ -429,8 +434,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
|||||||
.minImageCount = CLAMP (4,
|
.minImageCount = CLAMP (4,
|
||||||
capabilities.minImageCount,
|
capabilities.minImageCount,
|
||||||
capabilities.maxImageCount ? capabilities.maxImageCount : G_MAXUINT32),
|
capabilities.maxImageCount ? capabilities.maxImageCount : G_MAXUINT32),
|
||||||
.imageFormat = priv->image_format.format,
|
.imageFormat = priv->formats[priv->current_format].vk_format.format,
|
||||||
.imageColorSpace = priv->image_format.colorSpace,
|
.imageColorSpace = priv->formats[priv->current_format].vk_format.colorSpace,
|
||||||
.imageExtent = capabilities.currentExtent,
|
.imageExtent = capabilities.currentExtent,
|
||||||
.imageArrayLayers = 1,
|
.imageArrayLayers = 1,
|
||||||
.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||||
@@ -499,19 +504,20 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
device_supports_incremental_present (VkPhysicalDevice device)
|
physical_device_supports_extension (VkPhysicalDevice device,
|
||||||
|
const char *extension_name)
|
||||||
{
|
{
|
||||||
VkExtensionProperties *extensions;
|
VkExtensionProperties *extensions;
|
||||||
uint32_t n_device_extensions;
|
uint32_t n_device_extensions;
|
||||||
|
|
||||||
vkEnumerateDeviceExtensionProperties (device, NULL, &n_device_extensions, NULL);
|
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, NULL);
|
||||||
|
|
||||||
extensions = g_newa (VkExtensionProperties, n_device_extensions);
|
extensions = g_newa (VkExtensionProperties, n_device_extensions);
|
||||||
vkEnumerateDeviceExtensionProperties (device, NULL, &n_device_extensions, extensions);
|
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, extensions);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < n_device_extensions; i++)
|
for (uint32_t i = 0; i < n_device_extensions; i++)
|
||||||
{
|
{
|
||||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME))
|
if (g_str_equal (extensions[i].extensionName, extension_name))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,13 +526,27 @@ device_supports_incremental_present (VkPhysicalDevice device)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
if (depth != priv->current_format)
|
||||||
|
{
|
||||||
|
if (priv->formats[depth].gdk_format != priv->formats[priv->current_format].gdk_format)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||||
|
{
|
||||||
|
g_warning ("%s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
priv->current_format = depth;
|
||||||
|
}
|
||||||
for (i = 0; i < priv->n_images; i++)
|
for (i = 0; i < priv->n_images; i++)
|
||||||
{
|
{
|
||||||
cairo_region_union (priv->regions[i], region);
|
cairo_region_union (priv->regions[i], region);
|
||||||
@@ -665,6 +685,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
|||||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (initable);
|
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (initable);
|
||||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||||
|
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||||
VkResult res;
|
VkResult res;
|
||||||
VkBool32 supported;
|
VkBool32 supported;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@@ -673,6 +694,22 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
|||||||
if (!priv->vulkan_ref)
|
if (!priv->vulkan_ref)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||||
|
priv->offscreen_formats[GDK_MEMORY_U16] = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||||
|
priv->offscreen_formats[GDK_MEMORY_FLOAT16] = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
|
||||||
|
priv->offscreen_formats[GDK_MEMORY_FLOAT32] = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||||
|
|
||||||
|
if (surface == NULL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (priv->formats); i++)
|
||||||
|
{
|
||||||
|
priv->formats[i].vk_format.format = VK_FORMAT_B8G8R8A8_UNORM;
|
||||||
|
priv->formats[i].vk_format.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
||||||
|
priv->formats[i].gdk_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
res = GDK_VULKAN_CONTEXT_GET_CLASS (context)->create_surface (context, &priv->surface);
|
res = GDK_VULKAN_CONTEXT_GET_CLASS (context)->create_surface (context, &priv->surface);
|
||||||
if (res != VK_SUCCESS)
|
if (res != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -707,17 +744,74 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
|||||||
&n_formats, formats);
|
&n_formats, formats);
|
||||||
for (i = 0; i < n_formats; i++)
|
for (i = 0; i < n_formats; i++)
|
||||||
{
|
{
|
||||||
if (formats[i].format == VK_FORMAT_B8G8R8A8_UNORM)
|
if (formats[i].colorSpace != VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
|
switch ((int) formats[i].format)
|
||||||
|
{
|
||||||
|
case VK_FORMAT_B8G8R8A8_UNORM:
|
||||||
|
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
|
{
|
||||||
|
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||||
|
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||||
|
priv->offscreen_formats[GDK_MEMORY_U8] = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_FORMAT_R8G8B8A8_UNORM:
|
||||||
|
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
|
{
|
||||||
|
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||||
|
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_FORMAT_R16G16B16A16_UNORM:
|
||||||
|
priv->formats[GDK_MEMORY_U16].vk_format = formats[i];
|
||||||
|
priv->formats[GDK_MEMORY_U16].gdk_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_FORMAT_R16G16B16A16_SFLOAT:
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT16].vk_format = formats[i];
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT16].gdk_format = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_FORMAT_R32G32B32A32_SFLOAT:
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT32].vk_format = formats[i];
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT32].gdk_format = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i == n_formats)
|
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||||
"No supported image format found.");
|
"No supported image format found.");
|
||||||
goto out_surface;
|
goto out_surface;
|
||||||
}
|
}
|
||||||
priv->image_format = formats[i];
|
/* Ensure all the formats exist:
|
||||||
priv->has_present_region = device_supports_incremental_present (display->vk_physical_device);
|
* - If a format was found, keep that one.
|
||||||
|
* - FLOAT32 chooses the best format we have.
|
||||||
|
* - FLOAT16 and U16 pick the format FLOAT32 uses
|
||||||
|
*/
|
||||||
|
if (priv->formats[GDK_MEMORY_FLOAT32].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
|
{
|
||||||
|
if (priv->formats[GDK_MEMORY_FLOAT16].vk_format.format != VK_FORMAT_UNDEFINED)
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT32] = priv->formats[GDK_MEMORY_FLOAT16];
|
||||||
|
else if (priv->formats[GDK_MEMORY_U16].vk_format.format != VK_FORMAT_UNDEFINED)
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT32] = priv->formats[GDK_MEMORY_U16];
|
||||||
|
else
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT32] = priv->formats[GDK_MEMORY_U8];
|
||||||
|
}
|
||||||
|
if (priv->formats[GDK_MEMORY_FLOAT16].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
|
priv->formats[GDK_MEMORY_FLOAT16] = priv->formats[GDK_MEMORY_FLOAT32];
|
||||||
|
if (priv->formats[GDK_MEMORY_U16].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||||
|
priv->formats[GDK_MEMORY_U16] = priv->formats[GDK_MEMORY_FLOAT32];
|
||||||
|
|
||||||
|
priv->has_present_region = physical_device_supports_extension (display->vk_physical_device,
|
||||||
|
VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||||
|
|
||||||
if (!gdk_vulkan_context_check_swapchain (context, error))
|
if (!gdk_vulkan_context_check_swapchain (context, error))
|
||||||
goto out_surface;
|
goto out_surface;
|
||||||
@@ -740,6 +834,15 @@ out_surface:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GdkMemoryFormat
|
||||||
|
gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||||
|
GdkMemoryDepth depth)
|
||||||
|
{
|
||||||
|
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||||
|
|
||||||
|
return priv->offscreen_formats[depth];
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
||||||
{
|
{
|
||||||
@@ -828,6 +931,216 @@ gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context)
|
|||||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_queue_family_index;
|
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_queue_family_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
gdk_vulkan_get_pipeline_cache_dirname (void)
|
||||||
|
{
|
||||||
|
return g_build_filename (g_get_user_cache_dir (), "gtk-4.0", "vulkan-pipeline-cache", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GFile *
|
||||||
|
gdk_vulkan_get_pipeline_cache_file (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
VkPhysicalDeviceProperties props;
|
||||||
|
char *dirname, *basename, *path;
|
||||||
|
GFile *result;
|
||||||
|
|
||||||
|
vkGetPhysicalDeviceProperties (display->vk_physical_device, &props);
|
||||||
|
|
||||||
|
dirname = gdk_vulkan_get_pipeline_cache_dirname ();
|
||||||
|
basename = g_strdup_printf ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x"
|
||||||
|
"-%02x%02x%02x%02x%02x%02x.%u",
|
||||||
|
props.pipelineCacheUUID[0], props.pipelineCacheUUID[1],
|
||||||
|
props.pipelineCacheUUID[2], props.pipelineCacheUUID[3],
|
||||||
|
props.pipelineCacheUUID[4], props.pipelineCacheUUID[5],
|
||||||
|
props.pipelineCacheUUID[6], props.pipelineCacheUUID[7],
|
||||||
|
props.pipelineCacheUUID[8], props.pipelineCacheUUID[9],
|
||||||
|
props.pipelineCacheUUID[10], props.pipelineCacheUUID[11],
|
||||||
|
props.pipelineCacheUUID[12], props.pipelineCacheUUID[13],
|
||||||
|
props.pipelineCacheUUID[14], props.pipelineCacheUUID[15],
|
||||||
|
props.driverVersion);
|
||||||
|
|
||||||
|
path = g_build_filename (dirname, basename, NULL);
|
||||||
|
result = g_file_new_for_path (path);
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
g_free (basename);
|
||||||
|
g_free (dirname);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VkPipelineCache
|
||||||
|
gdk_display_load_pipeline_cache (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
VkPipelineCache result;
|
||||||
|
GFile *cache_file;
|
||||||
|
char *etag, *data;
|
||||||
|
gsize size;
|
||||||
|
|
||||||
|
cache_file = gdk_vulkan_get_pipeline_cache_file (display);
|
||||||
|
if (!g_file_load_contents (cache_file, NULL, &data, &size, &etag, &error))
|
||||||
|
{
|
||||||
|
GDK_DEBUG (VULKAN, "failed to load Vulkan pipeline cache file '%s': %s\n",
|
||||||
|
g_file_peek_path (cache_file), error->message);
|
||||||
|
g_object_unref (cache_file);
|
||||||
|
g_clear_error (&error);
|
||||||
|
return VK_NULL_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDK_VK_CHECK (vkCreatePipelineCache, display->vk_device,
|
||||||
|
&(VkPipelineCacheCreateInfo) {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
|
||||||
|
.initialDataSize = size,
|
||||||
|
.pInitialData = data,
|
||||||
|
},
|
||||||
|
NULL,
|
||||||
|
&result) != VK_SUCCESS)
|
||||||
|
result = VK_NULL_HANDLE;
|
||||||
|
|
||||||
|
g_free (data);
|
||||||
|
g_free (display->vk_pipeline_cache_etag);
|
||||||
|
display->vk_pipeline_cache_etag = etag;
|
||||||
|
display->vk_pipeline_cache_size = size;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
VkDevice device;
|
||||||
|
VkPipelineCache cache;
|
||||||
|
GFile *file;
|
||||||
|
char *path;
|
||||||
|
size_t size;
|
||||||
|
char *data, *etag;
|
||||||
|
|
||||||
|
device = display->vk_device;
|
||||||
|
cache = display->vk_pipeline_cache;
|
||||||
|
|
||||||
|
GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, NULL);
|
||||||
|
if (size == 0)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (size == display->vk_pipeline_cache_size)
|
||||||
|
{
|
||||||
|
GDK_DEBUG (VULKAN, "pipeline cache size (%zu bytes) unchanged, skipping save", size);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data = g_malloc (size);
|
||||||
|
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
||||||
|
{
|
||||||
|
g_free (data);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
path = gdk_vulkan_get_pipeline_cache_dirname ();
|
||||||
|
if (g_mkdir_with_parents (path, 0755) != 0)
|
||||||
|
{
|
||||||
|
g_warning_once ("Failed to create pipeline cache directory");
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
|
||||||
|
file = gdk_vulkan_get_pipeline_cache_file (display);
|
||||||
|
|
||||||
|
GDK_DEBUG (VULKAN, "Saving pipeline cache to %s", g_file_peek_path (file));
|
||||||
|
|
||||||
|
if (!g_file_replace_contents (file,
|
||||||
|
data,
|
||||||
|
size,
|
||||||
|
display->vk_pipeline_cache_etag,
|
||||||
|
FALSE,
|
||||||
|
0,
|
||||||
|
&etag,
|
||||||
|
NULL,
|
||||||
|
&error))
|
||||||
|
{
|
||||||
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG))
|
||||||
|
{
|
||||||
|
VkPipelineCache new_cache;
|
||||||
|
|
||||||
|
GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current");
|
||||||
|
new_cache = gdk_display_load_pipeline_cache (display);
|
||||||
|
if (new_cache)
|
||||||
|
{
|
||||||
|
GDK_VK_CHECK (vkMergePipelineCaches, device, cache, 1, &new_cache);
|
||||||
|
vkDestroyPipelineCache (device, new_cache, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_clear_pointer (&display->vk_pipeline_cache_etag, g_free);
|
||||||
|
}
|
||||||
|
g_clear_error (&error);
|
||||||
|
g_object_unref (file);
|
||||||
|
|
||||||
|
/* try again */
|
||||||
|
return gdk_vulkan_save_pipeline_cache (display);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_warning ("Failed to save pipeline cache: %s", error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
g_object_unref (file);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref (file);
|
||||||
|
g_free (display->vk_pipeline_cache_etag);
|
||||||
|
display->vk_pipeline_cache_etag = etag;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gdk_vulkan_save_pipeline_cache_cb (gpointer data)
|
||||||
|
{
|
||||||
|
GdkDisplay *display = data;
|
||||||
|
|
||||||
|
gdk_vulkan_save_pipeline_cache (display);
|
||||||
|
|
||||||
|
display->vk_save_pipeline_cache_source = 0;
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdk_vulkan_context_pipeline_cache_updated (GdkVulkanContext *self)
|
||||||
|
{
|
||||||
|
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (self));
|
||||||
|
|
||||||
|
g_clear_handle_id (&display->vk_save_pipeline_cache_source, g_source_remove);
|
||||||
|
display->vk_save_pipeline_cache_source = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE - 10,
|
||||||
|
10, /* random choice that is not now */
|
||||||
|
gdk_vulkan_save_pipeline_cache_cb,
|
||||||
|
display,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdk_display_create_pipeline_cache (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
display->vk_pipeline_cache = gdk_display_load_pipeline_cache (display);
|
||||||
|
|
||||||
|
GDK_VK_CHECK (vkCreatePipelineCache, display->vk_device,
|
||||||
|
&(VkPipelineCacheCreateInfo) {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
|
||||||
|
},
|
||||||
|
NULL,
|
||||||
|
&display->vk_pipeline_cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
VkPipelineCache
|
||||||
|
gdk_vulkan_context_get_pipeline_cache (GdkVulkanContext *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (self), NULL);
|
||||||
|
|
||||||
|
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (self))->vk_pipeline_cache;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_vulkan_context_get_image_format:
|
* gdk_vulkan_context_get_image_format:
|
||||||
* @context: a `GdkVulkanContext`
|
* @context: a `GdkVulkanContext`
|
||||||
@@ -843,7 +1156,7 @@ gdk_vulkan_context_get_image_format (GdkVulkanContext *context)
|
|||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_FORMAT_UNDEFINED);
|
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
return priv->image_format.format;
|
return priv->formats[priv->current_format].vk_format.format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1039,6 +1352,10 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
for (i = first; i < last; i++)
|
for (i = first; i < last; i++)
|
||||||
{
|
{
|
||||||
uint32_t n_queue_props;
|
uint32_t n_queue_props;
|
||||||
|
|
||||||
|
if (!physical_device_supports_extension (devices[i], VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME))
|
||||||
|
continue;
|
||||||
|
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, NULL);
|
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, NULL);
|
||||||
VkQueueFamilyProperties *queue_props = g_newa (VkQueueFamilyProperties, n_queue_props);
|
VkQueueFamilyProperties *queue_props = g_newa (VkQueueFamilyProperties, n_queue_props);
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, queue_props);
|
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, queue_props);
|
||||||
@@ -1049,30 +1366,36 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
GPtrArray *device_extensions;
|
GPtrArray *device_extensions;
|
||||||
gboolean has_incremental_present;
|
gboolean has_incremental_present;
|
||||||
|
|
||||||
has_incremental_present = device_supports_incremental_present (devices[i]);
|
has_incremental_present = physical_device_supports_extension (devices[i],
|
||||||
|
VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||||
|
|
||||||
device_extensions = g_ptr_array_new ();
|
device_extensions = g_ptr_array_new ();
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||||
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_MAINTENANCE_3_EXTENSION_NAME);
|
||||||
|
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
|
||||||
if (has_incremental_present)
|
if (has_incremental_present)
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Using Vulkan device %u, queue %u", i, j);
|
GDK_DISPLAY_DEBUG (display, VULKAN, "Using Vulkan device %u, queue %u", i, j);
|
||||||
if (GDK_VK_CHECK (vkCreateDevice, devices[i],
|
if (GDK_VK_CHECK (vkCreateDevice, devices[i],
|
||||||
&(VkDeviceCreateInfo) {
|
&(VkDeviceCreateInfo) {
|
||||||
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||||
NULL,
|
.queueCreateInfoCount = 1,
|
||||||
0,
|
.pQueueCreateInfos = &(VkDeviceQueueCreateInfo) {
|
||||||
1,
|
|
||||||
&(VkDeviceQueueCreateInfo) {
|
|
||||||
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
||||||
.queueFamilyIndex = j,
|
.queueFamilyIndex = j,
|
||||||
.queueCount = 1,
|
.queueCount = 1,
|
||||||
.pQueuePriorities = (float []) { 1.0f },
|
.pQueuePriorities = (float []) { 1.0f },
|
||||||
},
|
},
|
||||||
0,
|
.enabledExtensionCount = device_extensions->len,
|
||||||
NULL,
|
.ppEnabledExtensionNames = (const char * const *) device_extensions->pdata,
|
||||||
device_extensions->len,
|
.pNext = &(VkPhysicalDeviceDescriptorIndexingFeatures) {
|
||||||
(const char * const *) device_extensions->pdata
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES,
|
||||||
|
.descriptorBindingPartiallyBound = VK_TRUE,
|
||||||
|
.descriptorBindingVariableDescriptorCount = VK_TRUE,
|
||||||
|
.descriptorBindingSampledImageUpdateAfterBind = VK_TRUE,
|
||||||
|
.descriptorBindingStorageBufferUpdateAfterBind = VK_TRUE,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&display->vk_device) != VK_SUCCESS)
|
&display->vk_device) != VK_SUCCESS)
|
||||||
@@ -1144,6 +1467,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
|
|
||||||
used_extensions = g_ptr_array_new ();
|
used_extensions = g_ptr_array_new ();
|
||||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_SURFACE_EXTENSION_NAME);
|
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_SURFACE_EXTENSION_NAME);
|
||||||
|
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
|
||||||
g_ptr_array_add (used_extensions, (gpointer) GDK_DISPLAY_GET_CLASS (display)->vk_extension_name);
|
g_ptr_array_add (used_extensions, (gpointer) GDK_DISPLAY_GET_CLASS (display)->vk_extension_name);
|
||||||
|
|
||||||
for (i = 0; i < n_extensions; i++)
|
for (i = 0; i < n_extensions; i++)
|
||||||
@@ -1215,7 +1539,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
.enabledLayerCount = used_layers->len,
|
.enabledLayerCount = used_layers->len,
|
||||||
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
|
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
|
||||||
.enabledExtensionCount = used_extensions->len,
|
.enabledExtensionCount = used_extensions->len,
|
||||||
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata
|
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&display->vk_instance);
|
&display->vk_instance);
|
||||||
@@ -1267,6 +1591,8 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_display_create_pipeline_cache (display);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,6 +1621,16 @@ gdk_display_unref_vulkan (GdkDisplay *display)
|
|||||||
if (display->vulkan_refcount > 0)
|
if (display->vulkan_refcount > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (display->vk_save_pipeline_cache_source)
|
||||||
|
{
|
||||||
|
gdk_vulkan_save_pipeline_cache_cb (display);
|
||||||
|
g_assert (display->vk_save_pipeline_cache_source == 0);
|
||||||
|
}
|
||||||
|
vkDestroyPipelineCache (display->vk_device, display->vk_pipeline_cache, NULL);
|
||||||
|
display->vk_device = VK_NULL_HANDLE;
|
||||||
|
g_clear_pointer (&display->vk_pipeline_cache_etag, g_free);
|
||||||
|
display->vk_pipeline_cache_size = 0;
|
||||||
|
|
||||||
vkDestroyDevice (display->vk_device, NULL);
|
vkDestroyDevice (display->vk_device, NULL);
|
||||||
display->vk_device = VK_NULL_HANDLE;
|
display->vk_device = VK_NULL_HANDLE;
|
||||||
if (display->vk_debug_callback != VK_NULL_HANDLE)
|
if (display->vk_debug_callback != VK_NULL_HANDLE)
|
||||||
|
|||||||
@@ -69,9 +69,15 @@ gdk_vulkan_handle_result (VkResult res,
|
|||||||
|
|
||||||
#define GDK_VK_CHECK(func, ...) gdk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
|
#define GDK_VK_CHECK(func, ...) gdk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
|
||||||
|
|
||||||
gboolean gdk_display_ref_vulkan (GdkDisplay *display,
|
gboolean gdk_display_ref_vulkan (GdkDisplay *display,
|
||||||
GError **error);
|
GError **error);
|
||||||
void gdk_display_unref_vulkan (GdkDisplay *display);
|
void gdk_display_unref_vulkan (GdkDisplay *display);
|
||||||
|
|
||||||
|
VkPipelineCache gdk_vulkan_context_get_pipeline_cache (GdkVulkanContext *self);
|
||||||
|
void gdk_vulkan_context_pipeline_cache_updated (GdkVulkanContext *self);
|
||||||
|
|
||||||
|
GdkMemoryFormat gdk_vulkan_context_get_offscreen_format (GdkVulkanContext *context,
|
||||||
|
GdkMemoryDepth depth);
|
||||||
|
|
||||||
#else /* !GDK_RENDERING_VULKAN */
|
#else /* !GDK_RENDERING_VULKAN */
|
||||||
|
|
||||||
|
|||||||
+49
-6
@@ -183,8 +183,7 @@ gdk_load_png (GBytes *bytes,
|
|||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_palette_to_rgb (png);
|
png_set_palette_to_rgb (png);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
png_set_expand_gray_1_2_4_to_8 (png);
|
png_set_expand_gray_1_2_4_to_8 (png);
|
||||||
|
|
||||||
if (png_get_valid (png, info, PNG_INFO_tRNS))
|
if (png_get_valid (png, info, PNG_INFO_tRNS))
|
||||||
@@ -193,10 +192,6 @@ gdk_load_png (GBytes *bytes,
|
|||||||
if (depth < 8)
|
if (depth < 8)
|
||||||
png_set_packing (png);
|
png_set_packing (png);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
|
||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
png_set_gray_to_rgb (png);
|
|
||||||
|
|
||||||
if (interlace != PNG_INTERLACE_NONE)
|
if (interlace != PNG_INTERLACE_NONE)
|
||||||
png_set_interlace_handling (png);
|
png_set_interlace_handling (png);
|
||||||
|
|
||||||
@@ -239,6 +234,26 @@ gdk_load_png (GBytes *bytes,
|
|||||||
format = GDK_MEMORY_R16G16B16;
|
format = GDK_MEMORY_R16G16B16;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PNG_COLOR_TYPE_GRAY:
|
||||||
|
if (depth == 8)
|
||||||
|
{
|
||||||
|
format = GDK_MEMORY_G8;
|
||||||
|
}
|
||||||
|
else if (depth == 16)
|
||||||
|
{
|
||||||
|
format = GDK_MEMORY_G16;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||||
|
if (depth == 8)
|
||||||
|
{
|
||||||
|
format = GDK_MEMORY_G8A8;
|
||||||
|
}
|
||||||
|
else if (depth == 16)
|
||||||
|
{
|
||||||
|
format = GDK_MEMORY_G16A16;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
png_destroy_read_struct (&png, &info, NULL);
|
png_destroy_read_struct (&png, &info, NULL);
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@@ -349,6 +364,34 @@ gdk_save_png (GdkTexture *texture)
|
|||||||
depth = 16;
|
depth = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_G8:
|
||||||
|
format = GDK_MEMORY_G8;
|
||||||
|
png_format = PNG_COLOR_TYPE_GRAY;
|
||||||
|
depth = 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_G8A8_PREMULTIPLIED:
|
||||||
|
case GDK_MEMORY_G8A8:
|
||||||
|
case GDK_MEMORY_A8:
|
||||||
|
format = GDK_MEMORY_G8A8;
|
||||||
|
png_format = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||||
|
depth = 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_G16:
|
||||||
|
format = GDK_MEMORY_G16;
|
||||||
|
png_format = PNG_COLOR_TYPE_GRAY;
|
||||||
|
depth = 16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_G16A16_PREMULTIPLIED:
|
||||||
|
case GDK_MEMORY_G16A16:
|
||||||
|
case GDK_MEMORY_A16:
|
||||||
|
format = GDK_MEMORY_G16A16;
|
||||||
|
png_format = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||||
|
depth = 16;
|
||||||
|
break;
|
||||||
|
|
||||||
case GDK_MEMORY_N_FORMATS:
|
case GDK_MEMORY_N_FORMATS:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|||||||
+32
-22
@@ -229,27 +229,36 @@ struct _FormatData {
|
|||||||
guint16 samples_per_pixel;
|
guint16 samples_per_pixel;
|
||||||
guint16 sample_format;
|
guint16 sample_format;
|
||||||
guint16 alpha_samples;
|
guint16 alpha_samples;
|
||||||
|
guint16 photometric;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const FormatData format_data[] = {
|
static const FormatData format_data[] = {
|
||||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = { GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_B8G8R8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_B8G8R8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0 },
|
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16A16] = { GDK_MEMORY_R16G16B16A16, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_R16G16B16A16] = { GDK_MEMORY_R16G16B16A16, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, 0 },
|
[GDK_MEMORY_R16G16B16_FLOAT] = { GDK_MEMORY_R16G16B16_FLOAT, 16, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_R16G16B16A16_FLOAT] = { GDK_MEMORY_R16G16B16A16_FLOAT, 16, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, 0 },
|
[GDK_MEMORY_R32G32B32_FLOAT] = { GDK_MEMORY_R32G32B32_FLOAT, 32, 3, SAMPLEFORMAT_IEEEFP, 0, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA },
|
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = { GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_RGB },
|
||||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = { GDK_MEMORY_R32G32B32A32_FLOAT, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA },
|
[GDK_MEMORY_R32G32B32A32_FLOAT] = { GDK_MEMORY_R32G32B32A32_FLOAT, 32, 4, SAMPLEFORMAT_IEEEFP, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_RGB },
|
||||||
|
[GDK_MEMORY_G8A8_PREMULTIPLIED] = { GDK_MEMORY_G8A8_PREMULTIPLIED, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_G8A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_G8] = { GDK_MEMORY_G8, 8, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_G16A16_PREMULTIPLIED] = { GDK_MEMORY_G16A16_PREMULTIPLIED, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_G16A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_G16] = { GDK_MEMORY_G16, 16, 1, SAMPLEFORMAT_UINT, 0, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_A8] = { GDK_MEMORY_G8A8, 8, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
|
[GDK_MEMORY_A16] = { GDK_MEMORY_G16A16, 16, 2, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA, PHOTOMETRIC_MINISBLACK },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* if this fails, somebody forgot to add formats above */
|
/* if this fails, somebody forgot to add formats above */
|
||||||
@@ -289,7 +298,7 @@ gdk_save_tiff (GdkTexture *texture)
|
|||||||
if (fdata->alpha_samples)
|
if (fdata->alpha_samples)
|
||||||
TIFFSetField (tif, TIFFTAG_EXTRASAMPLES, 1, &fdata->alpha_samples);
|
TIFFSetField (tif, TIFFTAG_EXTRASAMPLES, 1, &fdata->alpha_samples);
|
||||||
|
|
||||||
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, fdata->photometric);
|
||||||
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||||
|
|
||||||
gdk_texture_downloader_init (&downloader, texture);
|
gdk_texture_downloader_init (&downloader, texture);
|
||||||
@@ -397,7 +406,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
|||||||
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGEWIDTH, &width);
|
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGEWIDTH, &width);
|
||||||
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGELENGTH, &height);
|
TIFFGetFieldDefaulted (tif, TIFFTAG_IMAGELENGTH, &height);
|
||||||
|
|
||||||
if (samples_per_pixel == 4)
|
if (samples_per_pixel == 2 || samples_per_pixel == 4)
|
||||||
{
|
{
|
||||||
guint16 extra;
|
guint16 extra;
|
||||||
guint16 *extra_types;
|
guint16 *extra_types;
|
||||||
@@ -426,14 +435,15 @@ gdk_load_tiff (GBytes *input_bytes,
|
|||||||
if (format_data[format].sample_format == sample_format &&
|
if (format_data[format].sample_format == sample_format &&
|
||||||
format_data[format].bits_per_sample == bits_per_sample &&
|
format_data[format].bits_per_sample == bits_per_sample &&
|
||||||
format_data[format].samples_per_pixel == samples_per_pixel &&
|
format_data[format].samples_per_pixel == samples_per_pixel &&
|
||||||
format_data[format].alpha_samples == alpha_samples)
|
format_data[format].alpha_samples == alpha_samples &&
|
||||||
|
format_data[format].photometric == photometric)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == G_N_ELEMENTS(format_data) ||
|
if (format == G_N_ELEMENTS(format_data) ||
|
||||||
photometric != PHOTOMETRIC_RGB ||
|
(photometric != PHOTOMETRIC_RGB && photometric != PHOTOMETRIC_MINISBLACK) ||
|
||||||
planarconfig != PLANARCONFIG_CONTIG ||
|
planarconfig != PLANARCONFIG_CONTIG ||
|
||||||
TIFFIsTiled (tif) ||
|
TIFFIsTiled (tif) ||
|
||||||
orientation != ORIENTATION_TOPLEFT)
|
orientation != ORIENTATION_TOPLEFT)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ copy_surface_data (GdkMacosBuffer *from,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
|
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
|
||||||
|
|||||||
@@ -344,14 +344,14 @@ create_pixel_format (GdkGLVersion *version,
|
|||||||
if (gdk_gl_version_get_major (version) >= 4)
|
if (gdk_gl_version_get_major (version) >= 4)
|
||||||
{
|
{
|
||||||
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL4_Core;
|
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL4_Core;
|
||||||
if (CGLChoosePixelFormat (attrs, &format, &n_format))
|
if (CHECK (error, CGLChoosePixelFormat (attrs, &format, &n_format)))
|
||||||
return g_steal_pointer (&format);
|
return g_steal_pointer (&format);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_gl_version_greater_equal (version, &GDK_GL_MIN_GL_VERSION))
|
if (gdk_gl_version_greater_equal (version, &GDK_GL_MIN_GL_VERSION))
|
||||||
{
|
{
|
||||||
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL3_Core;
|
attrs[1] = (CGLPixelFormatAttribute)kCGLOGLPVersion_GL3_Core;
|
||||||
if (CGLChoosePixelFormat (attrs, &format, &n_format))
|
if (CHECK (error, CGLChoosePixelFormat (attrs, &format, &n_format)))
|
||||||
return g_steal_pointer (&format);
|
return g_steal_pointer (&format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +396,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
|||||||
gdk_gl_context_get_matching_version (context,
|
gdk_gl_context_get_matching_version (context,
|
||||||
GDK_GL_API_GL,
|
GDK_GL_API_GL,
|
||||||
FALSE,
|
FALSE,
|
||||||
&version);
|
&min_version);
|
||||||
|
|
||||||
display = gdk_gl_context_get_display (context);
|
display = gdk_gl_context_get_display (context);
|
||||||
shared = gdk_display_get_gl_context (display);
|
shared = gdk_display_get_gl_context (display);
|
||||||
@@ -480,7 +480,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
|
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
|||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
XcursorImages *images;
|
XcursorImages *images;
|
||||||
struct cursor *cursor;
|
struct wl_cursor *cursor;
|
||||||
struct cursor_image *image;
|
struct cursor_image *image;
|
||||||
int i, nbytes;
|
int i, nbytes;
|
||||||
unsigned int load_size;
|
unsigned int load_size;
|
||||||
@@ -240,17 +240,16 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->cursor.images =
|
cursor->images =
|
||||||
malloc(images->nimage * sizeof cursor->cursor.images[0]);
|
malloc(images->nimage * sizeof cursor->images[0]);
|
||||||
if (!cursor->cursor.images) {
|
if (!cursor->images) {
|
||||||
free(cursor);
|
free(cursor);
|
||||||
xcursor_images_destroy (images);
|
xcursor_images_destroy (images);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->cursor.name = strdup(name);
|
cursor->name = strdup(name);
|
||||||
cursor->cursor.size = load_size;
|
cursor->size = load_size;
|
||||||
cursor->total_delay = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < images->nimage; i++) {
|
for (i = 0; i < images->nimage; i++) {
|
||||||
image = malloc(sizeof *image);
|
image = malloc(sizeof *image);
|
||||||
@@ -291,14 +290,13 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor->total_delay += image->image.delay;
|
cursor->images[i] = (struct wl_cursor_image *) image;
|
||||||
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
|
|
||||||
}
|
}
|
||||||
cursor->cursor.image_count = i;
|
cursor->image_count = i;
|
||||||
|
|
||||||
if (cursor->cursor.image_count == 0) {
|
if (cursor->image_count == 0) {
|
||||||
free(cursor->cursor.name);
|
free(cursor->name);
|
||||||
free(cursor->cursor.images);
|
free(cursor->images);
|
||||||
free(cursor);
|
free(cursor);
|
||||||
xcursor_images_destroy (images);
|
xcursor_images_destroy (images);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -306,7 +304,7 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
|||||||
|
|
||||||
xcursor_images_destroy (images);
|
xcursor_images_destroy (images);
|
||||||
|
|
||||||
return &cursor->cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ gdk_wayland_cairo_context_create_surface (GdkWaylandCairoContext *self)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
|
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
|
||||||
|
|||||||
@@ -698,7 +698,36 @@ gdk_wayland_display_dispose (GObject *object)
|
|||||||
|
|
||||||
g_list_free_full (display_wayland->on_has_globals_closures, g_free);
|
g_list_free_full (display_wayland->on_has_globals_closures, g_free);
|
||||||
|
|
||||||
|
g_clear_pointer (&display_wayland->cursor_theme, wl_cursor_theme_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->compositor, wl_compositor_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_wm_base, xdg_wm_base_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->zxdg_shell_v6, zxdg_shell_v6_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->gtk_shell, gtk_shell1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->data_device_manager, wl_data_device_manager_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->subcompositor, wl_subcompositor_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->pointer_gestures, zwp_pointer_gestures_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->primary_selection_manager, zwp_primary_selection_device_manager_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->tablet_manager, zwp_tablet_manager_v2_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_exporter, zxdg_exporter_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_exporter_v2, zxdg_exporter_v2_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_importer, zxdg_importer_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_importer_v2, zxdg_importer_v2_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->keyboard_shortcuts_inhibit, zwp_keyboard_shortcuts_inhibit_manager_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->server_decoration_manager, org_kde_kwin_server_decoration_manager_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_output_manager, zxdg_output_manager_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->idle_inhibit_manager, zwp_idle_inhibit_manager_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||||
|
|
||||||
|
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
||||||
|
|
||||||
|
g_list_store_remove_all (display_wayland->monitors);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_wayland_display_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gdk_wayland_display_parent_class)->dispose (object);
|
||||||
|
|
||||||
|
g_clear_pointer (&display_wayland->wl_display, wl_display_disconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -708,22 +737,17 @@ gdk_wayland_display_finalize (GObject *object)
|
|||||||
|
|
||||||
_gdk_wayland_display_finalize_cursors (display_wayland);
|
_gdk_wayland_display_finalize_cursors (display_wayland);
|
||||||
|
|
||||||
|
g_object_unref (display_wayland->monitors);
|
||||||
|
|
||||||
g_free (display_wayland->startup_notification_id);
|
g_free (display_wayland->startup_notification_id);
|
||||||
g_free (display_wayland->cursor_theme_name);
|
g_free (display_wayland->cursor_theme_name);
|
||||||
xkb_context_unref (display_wayland->xkb_context);
|
xkb_context_unref (display_wayland->xkb_context);
|
||||||
|
|
||||||
g_clear_pointer (&display_wayland->cursor_theme, wl_cursor_theme_destroy);
|
|
||||||
|
|
||||||
g_list_store_remove_all (display_wayland->monitors);
|
|
||||||
g_object_unref (display_wayland->monitors);
|
|
||||||
|
|
||||||
if (display_wayland->settings)
|
if (display_wayland->settings)
|
||||||
g_hash_table_destroy (display_wayland->settings);
|
g_hash_table_destroy (display_wayland->settings);
|
||||||
|
|
||||||
g_clear_object (&display_wayland->settings_portal);
|
g_clear_object (&display_wayland->settings_portal);
|
||||||
|
|
||||||
wl_display_disconnect (display_wayland->wl_display);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_wayland_display_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_wayland_display_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ struct _GdkWaylandDisplay
|
|||||||
struct xdg_wm_base *xdg_wm_base;
|
struct xdg_wm_base *xdg_wm_base;
|
||||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||||
struct gtk_shell1 *gtk_shell;
|
struct gtk_shell1 *gtk_shell;
|
||||||
struct wl_input_device *input_device;
|
|
||||||
struct wl_data_device_manager *data_device_manager;
|
struct wl_data_device_manager *data_device_manager;
|
||||||
struct wl_subcompositor *subcompositor;
|
struct wl_subcompositor *subcompositor;
|
||||||
struct zwp_pointer_gestures_v1 *pointer_gestures;
|
struct zwp_pointer_gestures_v1 *pointer_gestures;
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
|
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
|
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, depth, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -2143,10 +2143,13 @@ _gdk_wayland_seat_remove_tablet_pad (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
seat->tablet_pads = g_list_remove (seat->tablet_pads, pad);
|
seat->tablet_pads = g_list_remove (seat->tablet_pads, pad);
|
||||||
|
|
||||||
gdk_seat_device_removed (GDK_SEAT (seat), pad->device);
|
if (pad->device)
|
||||||
_gdk_device_set_associated_device (pad->device, NULL);
|
{
|
||||||
|
gdk_seat_device_removed (GDK_SEAT (seat), pad->device);
|
||||||
|
_gdk_device_set_associated_device (pad->device, NULL);
|
||||||
|
g_object_unref (pad->device);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (pad->device);
|
|
||||||
g_free (pad);
|
g_free (pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3535,21 +3538,10 @@ static void
|
|||||||
tablet_pad_handle_done (void *data,
|
tablet_pad_handle_done (void *data,
|
||||||
struct zwp_tablet_pad_v2 *wp_tablet_pad)
|
struct zwp_tablet_pad_v2 *wp_tablet_pad)
|
||||||
{
|
{
|
||||||
GdkWaylandTabletPadData *pad = data;
|
G_GNUC_UNUSED GdkWaylandTabletPadData *pad = data;
|
||||||
|
|
||||||
GDK_SEAT_DEBUG (pad->seat, EVENTS,
|
GDK_SEAT_DEBUG (pad->seat, EVENTS,
|
||||||
"tablet pad handle done, pad = %p", wp_tablet_pad);
|
"tablet pad handle done, pad = %p", wp_tablet_pad);
|
||||||
|
|
||||||
pad->device =
|
|
||||||
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
|
|
||||||
"name", "Pad device",
|
|
||||||
"source", GDK_SOURCE_TABLET_PAD,
|
|
||||||
"display", gdk_seat_get_display (pad->seat),
|
|
||||||
"seat", pad->seat,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
_gdk_device_set_associated_device (pad->device, GDK_WAYLAND_SEAT (pad->seat)->logical_keyboard);
|
|
||||||
gdk_seat_device_added (GDK_SEAT (pad->seat), pad->device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3606,9 +3598,44 @@ tablet_pad_handle_enter (void *data,
|
|||||||
"tablet pad handle enter, pad = %p, tablet = %p surface = %p",
|
"tablet pad handle enter, pad = %p, tablet = %p surface = %p",
|
||||||
wp_tablet_pad, wp_tablet, surface);
|
wp_tablet_pad, wp_tablet, surface);
|
||||||
|
|
||||||
|
if (pad->device && pad->current_tablet != tablet)
|
||||||
|
{
|
||||||
|
gdk_seat_device_removed (GDK_SEAT (pad->seat), pad->device);
|
||||||
|
_gdk_device_set_associated_device (pad->device, NULL);
|
||||||
|
g_clear_object (&pad->device);
|
||||||
|
}
|
||||||
|
|
||||||
/* Relate pad and tablet */
|
/* Relate pad and tablet */
|
||||||
tablet->pads = g_list_prepend (tablet->pads, pad);
|
tablet->pads = g_list_prepend (tablet->pads, pad);
|
||||||
pad->current_tablet = tablet;
|
pad->current_tablet = tablet;
|
||||||
|
|
||||||
|
if (!pad->device)
|
||||||
|
{
|
||||||
|
gchar *name, *vid, *pid;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("%s Pad %d",
|
||||||
|
tablet->name,
|
||||||
|
g_list_index (tablet->pads, pad) + 1);
|
||||||
|
vid = g_strdup_printf ("%.4x", tablet->vid);
|
||||||
|
pid = g_strdup_printf ("%.4x", tablet->pid);
|
||||||
|
|
||||||
|
pad->device =
|
||||||
|
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
|
||||||
|
"name", name,
|
||||||
|
"vendor-id", vid,
|
||||||
|
"product-id", pid,
|
||||||
|
"source", GDK_SOURCE_TABLET_PAD,
|
||||||
|
"display", gdk_seat_get_display (pad->seat),
|
||||||
|
"seat", pad->seat,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
_gdk_device_set_associated_device (pad->device, GDK_WAYLAND_SEAT (pad->seat)->logical_keyboard);
|
||||||
|
gdk_seat_device_added (GDK_SEAT (pad->seat), pad->device);
|
||||||
|
|
||||||
|
g_free (name);
|
||||||
|
g_free (vid);
|
||||||
|
g_free (pid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3624,10 +3651,7 @@ tablet_pad_handle_leave (void *data,
|
|||||||
wp_tablet_pad, surface);
|
wp_tablet_pad, surface);
|
||||||
|
|
||||||
if (pad->current_tablet)
|
if (pad->current_tablet)
|
||||||
{
|
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||||
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
|
||||||
pad->current_tablet = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3875,6 +3899,23 @@ gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
|
|||||||
g_slist_free (pointer->pointer_surface_outputs);
|
g_slist_free (pointer->pointer_surface_outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdk_wayland_seat_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (object);
|
||||||
|
|
||||||
|
g_clear_pointer (&seat->wl_seat, wl_seat_destroy);
|
||||||
|
g_clear_pointer (&seat->wl_pointer, wl_pointer_destroy);
|
||||||
|
g_clear_pointer (&seat->wl_keyboard, wl_keyboard_destroy);
|
||||||
|
g_clear_pointer (&seat->wl_touch, wl_touch_destroy);
|
||||||
|
g_clear_pointer (&seat->wp_pointer_gesture_swipe, zwp_pointer_gesture_swipe_v1_destroy);
|
||||||
|
g_clear_pointer (&seat->wp_pointer_gesture_pinch, zwp_pointer_gesture_pinch_v1_destroy);
|
||||||
|
g_clear_pointer (&seat->wp_pointer_gesture_hold, zwp_pointer_gesture_hold_v1_destroy);
|
||||||
|
g_clear_pointer (&seat->wp_tablet_seat, zwp_tablet_seat_v2_destroy);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gdk_wayland_seat_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_seat_finalize (GObject *object)
|
gdk_wayland_seat_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
@@ -4189,6 +4230,7 @@ gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
|
|||||||
GdkSeatClass *seat_class = GDK_SEAT_CLASS (klass);
|
GdkSeatClass *seat_class = GDK_SEAT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = gdk_wayland_seat_finalize;
|
object_class->finalize = gdk_wayland_seat_finalize;
|
||||||
|
object_class->dispose = gdk_wayland_seat_dispose;
|
||||||
|
|
||||||
seat_class->get_capabilities = gdk_wayland_seat_get_capabilities;
|
seat_class->get_capabilities = gdk_wayland_seat_get_capabilities;
|
||||||
seat_class->grab = gdk_wayland_seat_grab;
|
seat_class->grab = gdk_wayland_seat_grab;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ create_cairo_surface_for_surface (GdkSurface *surface,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
|
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
|
||||||
|
|||||||
@@ -1436,7 +1436,7 @@ register_clipboard_notification ()
|
|||||||
|
|
||||||
wclass.lpszClassName = "GdkClipboardNotification";
|
wclass.lpszClassName = "GdkClipboardNotification";
|
||||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||||
wclass.hInstance = _gdk_dll_hinstance;
|
wclass.hInstance = this_module ();
|
||||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||||
|
|
||||||
klass = RegisterClass (&wclass);
|
klass = RegisterClass (&wclass);
|
||||||
@@ -1446,7 +1446,7 @@ register_clipboard_notification ()
|
|||||||
clipboard_thread_data->clipboard_window = CreateWindow (MAKEINTRESOURCE (klass),
|
clipboard_thread_data->clipboard_window = CreateWindow (MAKEINTRESOURCE (klass),
|
||||||
NULL, WS_POPUP,
|
NULL, WS_POPUP,
|
||||||
0, 0, 0, 0, NULL, NULL,
|
0, 0, 0, 0, NULL, NULL,
|
||||||
_gdk_dll_hinstance, NULL);
|
this_module (), NULL);
|
||||||
|
|
||||||
if (clipboard_thread_data->clipboard_window == NULL)
|
if (clipboard_thread_data->clipboard_window == NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
@@ -1471,7 +1471,7 @@ register_clipboard_notification ()
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
g_critical ("Failed to install clipboard viewer");
|
g_critical ("Failed to install clipboard viewer");
|
||||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_dll_hinstance);
|
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -417,13 +417,12 @@ hcursor_from_x_cursor (int i,
|
|||||||
#undef SET_BIT
|
#undef SET_BIT
|
||||||
#undef RESET_BIT
|
#undef RESET_BIT
|
||||||
|
|
||||||
rv = CreateCursor (_gdk_app_hmodule, cursors[i].hotx, cursors[i].hoty,
|
rv = CreateCursor (NULL, cursors[i].hotx, cursors[i].hoty,
|
||||||
w, h, and_plane, xor_plane);
|
w, h, and_plane, xor_plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rv = CreateCursor (_gdk_app_hmodule, 0, 0,
|
rv = CreateCursor (NULL, 0, 0, w, h, and_plane, xor_plane);
|
||||||
w, h, and_plane, xor_plane);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv == NULL)
|
if (rv == NULL)
|
||||||
@@ -466,7 +465,7 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (_gdk_app_hmodule,
|
LoadImageA (GetModuleHandle (NULL),
|
||||||
(const char *) cursor->resource_name,
|
(const char *) cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
@@ -476,7 +475,7 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (_gdk_dll_hinstance,
|
LoadImageA (this_module (),
|
||||||
(const char *) cursor->resource_name,
|
(const char *) cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
@@ -858,9 +857,7 @@ create_blank_win32hcursor (GdkWin32Display *display)
|
|||||||
xor_plane = g_malloc ((w/8) * h);
|
xor_plane = g_malloc ((w/8) * h);
|
||||||
memset (xor_plane, 0, (w/8) * h);
|
memset (xor_plane, 0, (w/8) * h);
|
||||||
|
|
||||||
rv = CreateCursor (_gdk_app_hmodule, 0, 0,
|
rv = CreateCursor (NULL, 0, 0, w, h, and_plane, xor_plane);
|
||||||
w, h, and_plane, xor_plane);
|
|
||||||
|
|
||||||
if (rv == NULL)
|
if (rv == NULL)
|
||||||
WIN32_API_FAILED ("CreateCursor");
|
WIN32_API_FAILED ("CreateCursor");
|
||||||
|
|
||||||
@@ -871,6 +868,7 @@ static GdkWin32HCursor *
|
|||||||
gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
|
const HINSTANCE hinstance = GetModuleHandle (NULL);
|
||||||
GdkWin32HCursor *win32hcursor = NULL;
|
GdkWin32HCursor *win32hcursor = NULL;
|
||||||
|
|
||||||
/* Blank cursor case */
|
/* Blank cursor case */
|
||||||
@@ -885,7 +883,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
|
|||||||
/* Allow to load named cursor resources linked into the executable.
|
/* Allow to load named cursor resources linked into the executable.
|
||||||
* Cursors obtained with LoadCursor() cannot be destroyed.
|
* Cursors obtained with LoadCursor() cannot be destroyed.
|
||||||
*/
|
*/
|
||||||
return gdk_win32_hcursor_new (display, LoadCursor (_gdk_app_hmodule, name), FALSE);
|
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HICON
|
static HICON
|
||||||
@@ -1452,27 +1450,6 @@ pixbuf_to_hicon (GdkPixbuf *pixbuf,
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON
|
|
||||||
_gdk_win32_texture_to_hicon (GdkTexture *texture)
|
|
||||||
{
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
int width, height;
|
|
||||||
HICON icon;
|
|
||||||
|
|
||||||
surface = gdk_texture_download_surface (texture);
|
|
||||||
width = cairo_image_surface_get_width (surface);
|
|
||||||
height = cairo_image_surface_get_height (surface);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
|
||||||
|
|
||||||
icon = pixbuf_to_hicon (pixbuf, TRUE, 0, 0);
|
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_win32_display_get_win32hcursor:
|
* gdk_win32_display_get_win32hcursor:
|
||||||
* @display: (type GdkWin32Display): a `GdkDisplay`
|
* @display: (type GdkWin32Display): a `GdkDisplay`
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
|||||||
if (!w32_ex_monitor->remove)
|
if (!w32_ex_monitor->remove)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
w32_ex_monitor->hmonitor = NULL;
|
||||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||||
gdk_monitor_invalidate (ex_monitor);
|
gdk_monitor_invalidate (ex_monitor);
|
||||||
}
|
}
|
||||||
@@ -480,7 +481,7 @@ register_display_change_notification (GdkDisplay *display)
|
|||||||
|
|
||||||
wclass.lpszClassName = "GdkDisplayChange";
|
wclass.lpszClassName = "GdkDisplayChange";
|
||||||
wclass.lpfnWndProc = display_change_window_procedure;
|
wclass.lpfnWndProc = display_change_window_procedure;
|
||||||
wclass.hInstance = _gdk_app_hmodule;
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
|
|
||||||
klass = RegisterClass (&wclass);
|
klass = RegisterClass (&wclass);
|
||||||
@@ -489,10 +490,10 @@ register_display_change_notification (GdkDisplay *display)
|
|||||||
display_win32->hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
display_win32->hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
||||||
NULL, WS_POPUP,
|
NULL, WS_POPUP,
|
||||||
0, 0, 0, 0, NULL, NULL,
|
0, 0, 0, 0, NULL, NULL,
|
||||||
_gdk_app_hmodule, NULL);
|
this_module (), NULL);
|
||||||
if (!display_win32->hwnd)
|
if (!display_win32->hwnd)
|
||||||
{
|
{
|
||||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
|
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,8 +413,7 @@ set_up_low_level_keyboard_hook (void)
|
|||||||
|
|
||||||
hook_handle = SetWindowsHookEx (WH_KEYBOARD_LL,
|
hook_handle = SetWindowsHookEx (WH_KEYBOARD_LL,
|
||||||
(HOOKPROC) low_level_keyboard_proc,
|
(HOOKPROC) low_level_keyboard_proc,
|
||||||
_gdk_dll_hinstance,
|
this_module (), 0);
|
||||||
0);
|
|
||||||
|
|
||||||
if (hook_handle != NULL)
|
if (hook_handle != NULL)
|
||||||
keyboard_hook = hook_handle;
|
keyboard_hook = hook_handle;
|
||||||
@@ -2735,6 +2734,10 @@ gdk_event_translate (MSG *msg,
|
|||||||
if (GDK_IS_DRAG_SURFACE (window) ||
|
if (GDK_IS_DRAG_SURFACE (window) ||
|
||||||
_gdk_modal_blocked (window))
|
_gdk_modal_blocked (window))
|
||||||
{
|
{
|
||||||
|
/* Focus the modal window */
|
||||||
|
GdkSurface *modal_window = _gdk_modal_current ();
|
||||||
|
if (modal_window != NULL)
|
||||||
|
SetFocus (GDK_SURFACE_HWND (modal_window));
|
||||||
*ret_valp = MA_NOACTIVATE;
|
*ret_valp = MA_NOACTIVATE;
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
}
|
}
|
||||||
@@ -2745,6 +2748,10 @@ gdk_event_translate (MSG *msg,
|
|||||||
if (GDK_IS_DRAG_SURFACE (window) ||
|
if (GDK_IS_DRAG_SURFACE (window) ||
|
||||||
_gdk_modal_blocked (window))
|
_gdk_modal_blocked (window))
|
||||||
{
|
{
|
||||||
|
/* Focus the modal window */
|
||||||
|
GdkSurface *modal_window = _gdk_modal_current ();
|
||||||
|
if (modal_window != NULL)
|
||||||
|
SetFocus (GDK_SURFACE_HWND (modal_window));
|
||||||
*ret_valp = PA_NOACTIVATE;
|
*ret_valp = PA_NOACTIVATE;
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ gdk_win32_gl_context_egl_end_frame (GdkDrawContext *draw_context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
|
gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *update_area)
|
cairo_region_t *update_area)
|
||||||
{
|
{
|
||||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
|
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -118,12 +118,12 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
|
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *update_area)
|
cairo_region_t *update_area)
|
||||||
{
|
{
|
||||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
|
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -261,7 +261,7 @@ create_dummy_gl_window (void)
|
|||||||
|
|
||||||
wclass.lpszClassName = "GdkGLDummyWindow";
|
wclass.lpszClassName = "GdkGLDummyWindow";
|
||||||
wclass.lpfnWndProc = DefWindowProc;
|
wclass.lpfnWndProc = DefWindowProc;
|
||||||
wclass.hInstance = _gdk_app_hmodule;
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
|
|
||||||
klass = RegisterClass (&wclass);
|
klass = RegisterClass (&wclass);
|
||||||
@@ -270,10 +270,10 @@ create_dummy_gl_window (void)
|
|||||||
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
||||||
NULL, WS_POPUP,
|
NULL, WS_POPUP,
|
||||||
0, 0, 0, 0, NULL, NULL,
|
0, 0, 0, 0, NULL, NULL,
|
||||||
_gdk_app_hmodule, NULL);
|
this_module (), NULL);
|
||||||
if (!hwnd)
|
if (!hwnd)
|
||||||
{
|
{
|
||||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
|
UnregisterClass (MAKEINTRESOURCE (klass), this_module ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,6 @@
|
|||||||
GdkDisplay *_gdk_display = NULL;
|
GdkDisplay *_gdk_display = NULL;
|
||||||
GdkDeviceManagerWin32 *_gdk_device_manager = NULL;
|
GdkDeviceManagerWin32 *_gdk_device_manager = NULL;
|
||||||
|
|
||||||
HDC _gdk_display_hdc;
|
|
||||||
HINSTANCE _gdk_dll_hinstance;
|
|
||||||
HINSTANCE _gdk_app_hmodule;
|
|
||||||
|
|
||||||
int _gdk_input_ignore_core;
|
int _gdk_input_ignore_core;
|
||||||
|
|
||||||
HKL _gdk_input_locale;
|
HKL _gdk_input_locale;
|
||||||
|
|||||||
@@ -1003,7 +1003,7 @@ winpointer_notif_window_create (void)
|
|||||||
wndclassex.cbSize = sizeof (wndclassex);
|
wndclassex.cbSize = sizeof (wndclassex);
|
||||||
wndclassex.lpszClassName = L"GdkWin32WinpointerNotificationsWindowClass";
|
wndclassex.lpszClassName = L"GdkWin32WinpointerNotificationsWindowClass";
|
||||||
wndclassex.lpfnWndProc = winpointer_notifications_window_procedure;
|
wndclassex.lpfnWndProc = winpointer_notifications_window_procedure;
|
||||||
wndclassex.hInstance = _gdk_dll_hinstance;
|
wndclassex.hInstance = this_module ();
|
||||||
|
|
||||||
if ((notifications_window_class = RegisterClassExW (&wndclassex)) == 0)
|
if ((notifications_window_class = RegisterClassExW (&wndclassex)) == 0)
|
||||||
{
|
{
|
||||||
@@ -1018,7 +1018,7 @@ winpointer_notif_window_create (void)
|
|||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
HWND_MESSAGE,
|
HWND_MESSAGE,
|
||||||
NULL,
|
NULL,
|
||||||
_gdk_dll_hinstance,
|
this_module (),
|
||||||
NULL)))
|
NULL)))
|
||||||
{
|
{
|
||||||
WIN32_API_FAILED ("CreateWindowExW");
|
WIN32_API_FAILED ("CreateWindowExW");
|
||||||
|
|||||||
@@ -576,19 +576,6 @@ gdk_mod_mask_to_mod_bits (GdkModifierType mod_mask)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* keypad decimal mark depends on active keyboard layout
|
|
||||||
* return current decimal mark as unicode character
|
|
||||||
*/
|
|
||||||
guint32
|
|
||||||
_gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap)
|
|
||||||
{
|
|
||||||
guint32 c = MapVirtualKeyW (VK_DECIMAL, MAPVK_VK_TO_CHAR);
|
|
||||||
if (!c)
|
|
||||||
c = (guint32) '.';
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_keymap (GdkWin32Keymap *keymap)
|
update_keymap (GdkWin32Keymap *keymap)
|
||||||
{
|
{
|
||||||
|
|||||||
+56
-190
@@ -45,9 +45,6 @@
|
|||||||
#include <wintab.h>
|
#include <wintab.h>
|
||||||
#include <imm.h>
|
#include <imm.h>
|
||||||
|
|
||||||
/* for CFSTR_SHELLIDLIST */
|
|
||||||
#include <shlobj.h>
|
|
||||||
|
|
||||||
static gboolean gdk_synchronize = FALSE;
|
static gboolean gdk_synchronize = FALSE;
|
||||||
|
|
||||||
/* Whether GDK initialized COM */
|
/* Whether GDK initialized COM */
|
||||||
@@ -66,8 +63,6 @@ _gdk_win32_surfaceing_init (void)
|
|||||||
if (gdk_synchronize)
|
if (gdk_synchronize)
|
||||||
GdiSetBatchLimit (1);
|
GdiSetBatchLimit (1);
|
||||||
|
|
||||||
_gdk_app_hmodule = GetModuleHandle (NULL);
|
|
||||||
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
|
||||||
_gdk_input_locale = GetKeyboardLayout (0);
|
_gdk_input_locale = GetKeyboardLayout (0);
|
||||||
_gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale);
|
_gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale);
|
||||||
|
|
||||||
@@ -187,135 +182,6 @@ static_printf (const char *format,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
|
|
||||||
const int nentries)
|
|
||||||
{
|
|
||||||
char buf[20];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nentries; i++)
|
|
||||||
g_print (" %3d %02x: %02x %02x %02x%s\n",
|
|
||||||
i, i,
|
|
||||||
pep[i].peRed, pep[i].peGreen, pep[i].peBlue,
|
|
||||||
(pep[i].peFlags == 0 ? "" :
|
|
||||||
(pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" :
|
|
||||||
(pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" :
|
|
||||||
(pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" :
|
|
||||||
(g_sprintf (buf, " %d", pep[i].peFlags), buf))))));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_win32_print_system_palette (void)
|
|
||||||
{
|
|
||||||
PALETTEENTRY *pe;
|
|
||||||
int k;
|
|
||||||
|
|
||||||
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, 0, NULL);
|
|
||||||
pe = g_new (PALETTEENTRY, k);
|
|
||||||
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, k, pe);
|
|
||||||
|
|
||||||
if (!k)
|
|
||||||
g_print ("GetSystemPaletteEntries failed: %s\n",
|
|
||||||
g_win32_error_message (GetLastError ()));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_print ("System palette: %d entries\n", k);
|
|
||||||
_gdk_win32_print_paletteentries (pe, k);
|
|
||||||
}
|
|
||||||
g_free (pe);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
palette_size (HPALETTE hpal)
|
|
||||||
{
|
|
||||||
WORD npal = 0;
|
|
||||||
|
|
||||||
if (!GetObject (hpal, sizeof (npal), &npal))
|
|
||||||
WIN32_GDI_FAILED ("GetObject (HPALETTE)");
|
|
||||||
|
|
||||||
return npal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_win32_print_hpalette (HPALETTE hpal)
|
|
||||||
{
|
|
||||||
PALETTEENTRY *pe;
|
|
||||||
int n, npal;
|
|
||||||
|
|
||||||
npal = palette_size (hpal);
|
|
||||||
pe = g_new (PALETTEENTRY, npal);
|
|
||||||
n = GetPaletteEntries (hpal, 0, npal, pe);
|
|
||||||
|
|
||||||
if (!n)
|
|
||||||
g_print ("HPALETTE %p: GetPaletteEntries failed: %s\n",
|
|
||||||
hpal, g_win32_error_message (GetLastError ()));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_print ("HPALETTE %p: %d (%d) entries\n", hpal, n, npal);
|
|
||||||
_gdk_win32_print_paletteentries (pe, n);
|
|
||||||
}
|
|
||||||
g_free (pe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_win32_print_dc (HDC hdc)
|
|
||||||
{
|
|
||||||
HGDIOBJ obj;
|
|
||||||
LOGBRUSH logbrush;
|
|
||||||
EXTLOGPEN extlogpen;
|
|
||||||
HRGN hrgn;
|
|
||||||
RECT rect;
|
|
||||||
int flag;
|
|
||||||
|
|
||||||
g_print ("%p:\n", hdc);
|
|
||||||
obj = GetCurrentObject (hdc, OBJ_BRUSH);
|
|
||||||
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
|
|
||||||
g_print ("brush: %s color=%06lx hatch=%p\n",
|
|
||||||
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
|
|
||||||
logbrush.lbColor, (gpointer) logbrush.lbHatch);
|
|
||||||
obj = GetCurrentObject (hdc, OBJ_PEN);
|
|
||||||
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
|
|
||||||
g_print ("pen: %s %s %s %s w=%d %s\n",
|
|
||||||
_gdk_win32_pstype_to_string (extlogpen.elpPenStyle),
|
|
||||||
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
|
|
||||||
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
|
|
||||||
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
|
|
||||||
(int) extlogpen.elpWidth,
|
|
||||||
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
|
|
||||||
g_print ("rop2: %s textcolor=%06lx\n",
|
|
||||||
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
|
|
||||||
GetTextColor (hdc));
|
|
||||||
hrgn = CreateRectRgn (0, 0, 0, 0);
|
|
||||||
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
|
|
||||||
WIN32_API_FAILED ("GetClipRgn");
|
|
||||||
else if (flag == 0)
|
|
||||||
g_print ("no clip region\n");
|
|
||||||
else if (flag == 1)
|
|
||||||
{
|
|
||||||
GetRgnBox (hrgn, &rect);
|
|
||||||
g_print ("clip region: %p bbox: %s\n",
|
|
||||||
hrgn, _gdk_win32_rect_to_string (&rect));
|
|
||||||
}
|
|
||||||
DeleteObject (hrgn);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol)
|
|
||||||
{
|
|
||||||
switch (protocol)
|
|
||||||
{
|
|
||||||
#define CASE(x) case GDK_DRAG_PROTO_##x: return #x
|
|
||||||
CASE (NONE);
|
|
||||||
CASE (WIN32_DROPFILES);
|
|
||||||
CASE (OLE2);
|
|
||||||
#undef CASE
|
|
||||||
default: return static_printf ("illegal_%d", protocol);
|
|
||||||
}
|
|
||||||
/* NOTREACHED */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
_gdk_win32_surface_state_to_string (GdkToplevelState state)
|
_gdk_win32_surface_state_to_string (GdkToplevelState state)
|
||||||
{
|
{
|
||||||
@@ -478,7 +344,7 @@ _gdk_win32_drag_action_to_string (GdkDragAction actions)
|
|||||||
return static_printf ("%s", buf);
|
return static_printf ("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_rop2_to_string (int rop2)
|
_gdk_win32_rop2_to_string (int rop2)
|
||||||
{
|
{
|
||||||
switch (rop2)
|
switch (rop2)
|
||||||
@@ -507,7 +373,7 @@ _gdk_win32_rop2_to_string (int rop2)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_lbstyle_to_string (UINT brush_style)
|
_gdk_win32_lbstyle_to_string (UINT brush_style)
|
||||||
{
|
{
|
||||||
switch (brush_style)
|
switch (brush_style)
|
||||||
@@ -526,7 +392,7 @@ _gdk_win32_lbstyle_to_string (UINT brush_style)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_pstype_to_string (DWORD pen_style)
|
_gdk_win32_pstype_to_string (DWORD pen_style)
|
||||||
{
|
{
|
||||||
switch (pen_style & PS_TYPE_MASK)
|
switch (pen_style & PS_TYPE_MASK)
|
||||||
@@ -539,7 +405,7 @@ _gdk_win32_pstype_to_string (DWORD pen_style)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_psstyle_to_string (DWORD pen_style)
|
_gdk_win32_psstyle_to_string (DWORD pen_style)
|
||||||
{
|
{
|
||||||
switch (pen_style & PS_STYLE_MASK)
|
switch (pen_style & PS_STYLE_MASK)
|
||||||
@@ -561,7 +427,7 @@ _gdk_win32_psstyle_to_string (DWORD pen_style)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_psendcap_to_string (DWORD pen_style)
|
_gdk_win32_psendcap_to_string (DWORD pen_style)
|
||||||
{
|
{
|
||||||
switch (pen_style & PS_ENDCAP_MASK)
|
switch (pen_style & PS_ENDCAP_MASK)
|
||||||
@@ -577,7 +443,7 @@ _gdk_win32_psendcap_to_string (DWORD pen_style)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
_gdk_win32_psjoin_to_string (DWORD pen_style)
|
_gdk_win32_psjoin_to_string (DWORD pen_style)
|
||||||
{
|
{
|
||||||
switch (pen_style & PS_JOIN_MASK)
|
switch (pen_style & PS_JOIN_MASK)
|
||||||
@@ -593,6 +459,56 @@ _gdk_win32_psjoin_to_string (DWORD pen_style)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gdk_win32_print_dc (HDC hdc)
|
||||||
|
{
|
||||||
|
HGDIOBJ obj;
|
||||||
|
LOGBRUSH logbrush;
|
||||||
|
EXTLOGPEN extlogpen;
|
||||||
|
HRGN hrgn;
|
||||||
|
RECT rect;
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
g_print ("%p:\n", hdc);
|
||||||
|
|
||||||
|
obj = GetCurrentObject (hdc, OBJ_BRUSH);
|
||||||
|
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
|
||||||
|
|
||||||
|
g_print ("brush: %s color=%06lx hatch=%p\n",
|
||||||
|
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
|
||||||
|
logbrush.lbColor, (gpointer) logbrush.lbHatch);
|
||||||
|
|
||||||
|
obj = GetCurrentObject (hdc, OBJ_PEN);
|
||||||
|
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
|
||||||
|
|
||||||
|
g_print ("pen: %s %s %s %s w=%d %s\n",
|
||||||
|
_gdk_win32_pstype_to_string (extlogpen.elpPenStyle),
|
||||||
|
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
|
||||||
|
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
|
||||||
|
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
|
||||||
|
(int) extlogpen.elpWidth,
|
||||||
|
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
|
||||||
|
|
||||||
|
g_print ("rop2: %s textcolor=%06lx\n",
|
||||||
|
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
|
||||||
|
GetTextColor (hdc));
|
||||||
|
|
||||||
|
hrgn = CreateRectRgn (0, 0, 0, 0);
|
||||||
|
|
||||||
|
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
|
||||||
|
WIN32_API_FAILED ("GetClipRgn");
|
||||||
|
else if (flag == 0)
|
||||||
|
g_print ("no clip region\n");
|
||||||
|
else if (flag == 1)
|
||||||
|
{
|
||||||
|
GetRgnBox (hrgn, &rect);
|
||||||
|
g_print ("clip region: %p bbox: %s\n",
|
||||||
|
hrgn, _gdk_win32_rect_to_string (&rect));
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteObject (hrgn);
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
_gdk_win32_message_to_string (UINT msg)
|
_gdk_win32_message_to_string (UINT msg)
|
||||||
{
|
{
|
||||||
@@ -893,26 +809,6 @@ _gdk_win32_cf_to_string (UINT format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
_gdk_win32_data_to_string (const guchar *data,
|
|
||||||
int nbytes)
|
|
||||||
{
|
|
||||||
GString *s = g_string_new ("");
|
|
||||||
int i;
|
|
||||||
char *retval;
|
|
||||||
|
|
||||||
for (i = 0; i < nbytes; i++)
|
|
||||||
if (data[i] >=' ' && data[i] <= '~')
|
|
||||||
g_string_append_printf (s, "%c ", data[i]);
|
|
||||||
else
|
|
||||||
g_string_append_printf (s, "%02X ", data[i]);
|
|
||||||
|
|
||||||
retval = static_printf ("%s", s->str);
|
|
||||||
g_string_free (s, TRUE);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
_gdk_win32_rect_to_string (const RECT *rect)
|
_gdk_win32_rect_to_string (const RECT *rect)
|
||||||
{
|
{
|
||||||
@@ -921,34 +817,4 @@ _gdk_win32_rect_to_string (const RECT *rect)
|
|||||||
rect->left, rect->top);
|
rect->left, rect->top);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect)
|
|
||||||
{
|
|
||||||
return static_printf ("%dx%d@%+d%+d",
|
|
||||||
rect->width, rect->height,
|
|
||||||
rect->x, rect->y);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
_gdk_win32_cairo_region_to_string (const cairo_region_t *rgn)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t extents;
|
|
||||||
cairo_region_get_extents (rgn, &extents);
|
|
||||||
return static_printf ("%dx%d@%+d%+d",
|
|
||||||
extents.width, extents.height,
|
|
||||||
extents.x, extents.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
_gdk_win32_surface_description (GdkSurface *d)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GDK_IS_SURFACE (d), NULL);
|
|
||||||
|
|
||||||
return static_printf ("%s:%p:%dx%d",
|
|
||||||
G_OBJECT_TYPE_NAME (d),
|
|
||||||
GDK_SURFACE_HWND (d),
|
|
||||||
gdk_surface_get_width (GDK_SURFACE (d)),
|
|
||||||
gdk_surface_get_height (GDK_SURFACE (d)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* G_ENABLE_DEBUG */
|
#endif /* G_ENABLE_DEBUG */
|
||||||
|
|||||||
@@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
|||||||
char *path, *path_lower;
|
char *path, *path_lower;
|
||||||
DISPLAYCONFIG_RATIONAL *refresh;
|
DISPLAYCONFIG_RATIONAL *refresh;
|
||||||
|
|
||||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
||||||
tdn.header.size = sizeof (tdn);
|
tdn.header.size = sizeof (tdn);
|
||||||
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
||||||
@@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
|||||||
if (w32mon == NULL)
|
if (w32mon == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||||
|
{
|
||||||
|
w32mon->remove = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
mon = GDK_MONITOR (w32mon);
|
mon = GDK_MONITOR (w32mon);
|
||||||
|
|
||||||
if (!tdn.flags.friendlyNameForced)
|
if (!tdn.flags.friendlyNameForced)
|
||||||
@@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
|
|||||||
|
|
||||||
if (w32mon == NULL)
|
if (w32mon == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
w32mon->hmonitor = hmonitor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ struct _GdkWin32Monitor
|
|||||||
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
||||||
char *instance_path;
|
char *instance_path;
|
||||||
|
|
||||||
|
/* MOnitor handle (used to fullscreen windows on monitors) */
|
||||||
|
HMONITOR hmonitor;
|
||||||
|
|
||||||
/* TRUE if monitor is made up by us
|
/* TRUE if monitor is made up by us
|
||||||
* (this happens when system has logical monitors, but no physical ones).
|
* (this happens when system has logical monitors, but no physical ones).
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
-157
@@ -15,15 +15,10 @@
|
|||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
||||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
||||||
* files for a list of changes. These files are distributed with
|
|
||||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <gdk/gdkcursorprivate.h>
|
#include <gdk/gdkcursorprivate.h>
|
||||||
#include <gdk/gdkdebugprivate.h>
|
#include <gdk/gdkdebugprivate.h>
|
||||||
#include <gdk/win32/gdksurface-win32.h>
|
#include <gdk/win32/gdksurface-win32.h>
|
||||||
@@ -32,10 +27,6 @@
|
|||||||
#include <gdk/win32/gdkwin32keys.h>
|
#include <gdk/win32/gdkwin32keys.h>
|
||||||
#include <gdk/win32/gdkdevicemanager-win32.h>
|
#include <gdk/win32/gdkdevicemanager-win32.h>
|
||||||
#include <gdk/win32/gdkclipdrop-win32.h>
|
#include <gdk/win32/gdkclipdrop-win32.h>
|
||||||
//#include <gdk/win32/gdkselection-win32.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Old debug macros */
|
/* Old debug macros */
|
||||||
@@ -54,62 +45,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Make up for some minor w32api or MSVC6 header lossage */
|
|
||||||
|
|
||||||
#ifndef PS_JOIN_MASK
|
|
||||||
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FS_VIETNAMESE
|
|
||||||
#define FS_VIETNAMESE 0x100
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WM_GETOBJECT
|
|
||||||
#define WM_GETOBJECT 0x3D
|
|
||||||
#endif
|
|
||||||
#ifndef WM_NCXBUTTONDOWN
|
|
||||||
#define WM_NCXBUTTONDOWN 0xAB
|
|
||||||
#endif
|
|
||||||
#ifndef WM_NCXBUTTONUP
|
|
||||||
#define WM_NCXBUTTONUP 0xAC
|
|
||||||
#endif
|
|
||||||
#ifndef WM_NCXBUTTONDBLCLK
|
|
||||||
#define WM_NCXBUTTONDBLCLK 0xAD
|
|
||||||
#endif
|
|
||||||
#ifndef WM_CHANGEUISTATE
|
|
||||||
#define WM_CHANGEUISTATE 0x127
|
|
||||||
#endif
|
|
||||||
#ifndef WM_UPDATEUISTATE
|
|
||||||
#define WM_UPDATEUISTATE 0x128
|
|
||||||
#endif
|
|
||||||
#ifndef WM_QUERYUISTATE
|
|
||||||
#define WM_QUERYUISTATE 0x129
|
|
||||||
#endif
|
|
||||||
#ifndef WM_XBUTTONDOWN
|
|
||||||
#define WM_XBUTTONDOWN 0x20B
|
|
||||||
#endif
|
|
||||||
#ifndef WM_XBUTTONUP
|
|
||||||
#define WM_XBUTTONUP 0x20C
|
|
||||||
#endif
|
|
||||||
#ifndef WM_XBUTTONDBLCLK
|
|
||||||
#define WM_XBUTTONDBLCLK 0x20D
|
|
||||||
#endif
|
|
||||||
#ifndef WM_NCMOUSEHOVER
|
|
||||||
#define WM_NCMOUSEHOVER 0x2A0
|
|
||||||
#endif
|
|
||||||
#ifndef WM_NCMOUSELEAVE
|
|
||||||
#define WM_NCMOUSELEAVE 0x2A2
|
|
||||||
#endif
|
|
||||||
#ifndef WM_APPCOMMAND
|
|
||||||
#define WM_APPCOMMAND 0x319
|
|
||||||
#endif
|
|
||||||
#ifndef WM_MOUSEHWHEEL
|
|
||||||
#define WM_MOUSEHWHEEL 0x20E
|
|
||||||
#endif
|
|
||||||
#ifndef WM_DPICHANGED
|
|
||||||
#define WM_DPICHANGED 0x02E0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* According to
|
/* According to
|
||||||
* http://blog.airesoft.co.uk/2009/11/wm_messages/
|
* http://blog.airesoft.co.uk/2009/11/wm_messages/
|
||||||
* this is the actual internal name MS uses for this undocumented message.
|
* this is the actual internal name MS uses for this undocumented message.
|
||||||
@@ -122,11 +57,6 @@
|
|||||||
#define WM_SYSMENU 0x313
|
#define WM_SYSMENU 0x313
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CF_DIBV5
|
|
||||||
#define CF_DIBV5 17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Define some combinations of GdkDebugFlags */
|
/* Define some combinations of GdkDebugFlags */
|
||||||
#define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT)
|
#define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT)
|
||||||
#define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
|
#define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
|
||||||
@@ -140,22 +70,6 @@ GdkWin32Screen *GDK_SURFACE_SCREEN(GObject *win);
|
|||||||
*/
|
*/
|
||||||
#define SWP_NOZORDER_SPECIFIED HWND_TOP
|
#define SWP_NOZORDER_SPECIFIED HWND_TOP
|
||||||
|
|
||||||
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
|
|
||||||
|
|
||||||
struct _GdkWin32SingleFont
|
|
||||||
{
|
|
||||||
HFONT hfont;
|
|
||||||
UINT charset;
|
|
||||||
UINT codepage;
|
|
||||||
FONTSIGNATURE fs;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GDK_WIN32_PE_STATIC,
|
|
||||||
GDK_WIN32_PE_AVAILABLE,
|
|
||||||
GDK_WIN32_PE_INUSE
|
|
||||||
} GdkWin32PalEntryState;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GDK_DRAG_PROTO_NONE = 0,
|
GDK_DRAG_PROTO_NONE = 0,
|
||||||
@@ -163,51 +77,23 @@ typedef enum
|
|||||||
GDK_DRAG_PROTO_OLE2,
|
GDK_DRAG_PROTO_OLE2,
|
||||||
} GdkDragProtocol;
|
} GdkDragProtocol;
|
||||||
|
|
||||||
GType _gdk_gc_win32_get_type (void);
|
|
||||||
|
|
||||||
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
|
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
|
||||||
|
|
||||||
BOOL _gdk_win32_get_cursor_pos (LPPOINT lpPoint);
|
BOOL _gdk_win32_get_cursor_pos (LPPOINT lpPoint);
|
||||||
|
|
||||||
void _gdk_surface_init_position (GdkSurface *window);
|
|
||||||
void _gdk_surface_move_resize_child (GdkSurface *window,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
|
|
||||||
gboolean _gdk_win32_surface_enable_transparency (GdkSurface *window);
|
gboolean _gdk_win32_surface_enable_transparency (GdkSurface *window);
|
||||||
|
|
||||||
|
|
||||||
/* GdkSurfaceImpl methods */
|
|
||||||
void _gdk_win32_surface_scroll (GdkSurface *window,
|
|
||||||
int dx,
|
|
||||||
int dy);
|
|
||||||
void _gdk_win32_surface_move_region (GdkSurface *window,
|
|
||||||
const cairo_region_t *region,
|
|
||||||
int dx,
|
|
||||||
int dy);
|
|
||||||
|
|
||||||
|
|
||||||
void _gdk_win32_selection_init (void);
|
|
||||||
void _gdk_win32_dnd_exit (void);
|
void _gdk_win32_dnd_exit (void);
|
||||||
|
|
||||||
void gdk_win32_handle_table_insert (HANDLE *handle,
|
void gdk_win32_handle_table_insert (HANDLE *handle,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void gdk_win32_handle_table_remove (HANDLE handle);
|
void gdk_win32_handle_table_remove (HANDLE handle);
|
||||||
|
|
||||||
HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
|
|
||||||
int x_origin,
|
|
||||||
int y_origin);
|
|
||||||
|
|
||||||
cairo_region_t *_gdk_win32_hrgn_to_region (HRGN hrgn,
|
cairo_region_t *_gdk_win32_hrgn_to_region (HRGN hrgn,
|
||||||
guint scale);
|
guint scale);
|
||||||
|
|
||||||
void _gdk_win32_adjust_client_rect (GdkSurface *window,
|
void _gdk_win32_adjust_client_rect (GdkSurface *window,
|
||||||
RECT *RECT);
|
RECT *RECT);
|
||||||
|
|
||||||
void _gdk_selection_property_delete (GdkSurface *);
|
|
||||||
|
|
||||||
void _gdk_push_modal_window (GdkSurface *window);
|
void _gdk_push_modal_window (GdkSurface *window);
|
||||||
void _gdk_remove_modal_window (GdkSurface *window);
|
void _gdk_remove_modal_window (GdkSurface *window);
|
||||||
GdkSurface *_gdk_modal_current (void);
|
GdkSurface *_gdk_modal_current (void);
|
||||||
@@ -217,41 +103,22 @@ gboolean gdk_win32_ensure_com (void);
|
|||||||
gboolean gdk_win32_ensure_ole (void);
|
gboolean gdk_win32_ensure_ole (void);
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
|
|
||||||
const int nentries);
|
|
||||||
void _gdk_win32_print_system_palette (void);
|
|
||||||
void _gdk_win32_print_hpalette (HPALETTE hpal);
|
|
||||||
void _gdk_win32_print_dc (HDC hdc);
|
void _gdk_win32_print_dc (HDC hdc);
|
||||||
|
|
||||||
char *_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol);
|
|
||||||
char *_gdk_win32_surface_state_to_string (GdkToplevelState state);
|
char *_gdk_win32_surface_state_to_string (GdkToplevelState state);
|
||||||
char *_gdk_win32_surface_style_to_string (LONG style);
|
char *_gdk_win32_surface_style_to_string (LONG style);
|
||||||
char *_gdk_win32_surface_exstyle_to_string (LONG style);
|
char *_gdk_win32_surface_exstyle_to_string (LONG style);
|
||||||
char *_gdk_win32_surface_pos_bits_to_string (UINT flags);
|
char *_gdk_win32_surface_pos_bits_to_string (UINT flags);
|
||||||
char *_gdk_win32_drag_action_to_string (GdkDragAction actions);
|
char *_gdk_win32_drag_action_to_string (GdkDragAction actions);
|
||||||
char *_gdk_win32_surface_description (GdkSurface *d);
|
|
||||||
|
|
||||||
char *_gdk_win32_rop2_to_string (int rop2);
|
|
||||||
char *_gdk_win32_lbstyle_to_string (UINT brush_style);
|
|
||||||
char *_gdk_win32_pstype_to_string (DWORD pen_style);
|
|
||||||
char *_gdk_win32_psstyle_to_string (DWORD pen_style);
|
|
||||||
char *_gdk_win32_psendcap_to_string (DWORD pen_style);
|
|
||||||
char *_gdk_win32_psjoin_to_string (DWORD pen_style);
|
|
||||||
char *_gdk_win32_message_to_string (UINT msg);
|
char *_gdk_win32_message_to_string (UINT msg);
|
||||||
char *_gdk_win32_key_to_string (LONG lParam);
|
char *_gdk_win32_key_to_string (LONG lParam);
|
||||||
char *_gdk_win32_cf_to_string (UINT format);
|
char *_gdk_win32_cf_to_string (UINT format);
|
||||||
char *_gdk_win32_data_to_string (const guchar*data,
|
|
||||||
int nbytes);
|
|
||||||
char *_gdk_win32_rect_to_string (const RECT *rect);
|
char *_gdk_win32_rect_to_string (const RECT *rect);
|
||||||
|
|
||||||
char *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
|
|
||||||
char *_gdk_win32_cairo_region_to_string (const cairo_region_t *box);
|
|
||||||
|
|
||||||
void _gdk_win32_print_event (GdkEvent *event);
|
void _gdk_win32_print_event (GdkEvent *event);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *_gdk_win32_last_error_string (void);
|
|
||||||
void _gdk_win32_api_failed (const char *where,
|
void _gdk_win32_api_failed (const char *where,
|
||||||
const char *api);
|
const char *api);
|
||||||
void _gdk_other_api_failed (const char *where,
|
void _gdk_other_api_failed (const char *where,
|
||||||
@@ -284,10 +151,6 @@ extern GdkDisplay *_gdk_display;
|
|||||||
|
|
||||||
extern GdkDeviceManagerWin32 *_gdk_device_manager;
|
extern GdkDeviceManagerWin32 *_gdk_device_manager;
|
||||||
|
|
||||||
extern HDC _gdk_display_hdc;
|
|
||||||
extern HINSTANCE _gdk_dll_hinstance;
|
|
||||||
extern HINSTANCE _gdk_app_hmodule;
|
|
||||||
|
|
||||||
extern int _gdk_input_ignore_core;
|
extern int _gdk_input_ignore_core;
|
||||||
|
|
||||||
/* These are thread specific, but GDK/win32 works OK only when invoked
|
/* These are thread specific, but GDK/win32 works OK only when invoked
|
||||||
@@ -304,8 +167,6 @@ extern GdkWin32Clipdrop *_win32_clipdrop;
|
|||||||
/* Used to identify the main thread */
|
/* Used to identify the main thread */
|
||||||
extern GThread *_win32_main_thread;
|
extern GThread *_win32_main_thread;
|
||||||
|
|
||||||
void _gdk_win32_dnd_do_dragdrop (void);
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GDK_WIN32_MODAL_OP_NONE = 0x0,
|
GDK_WIN32_MODAL_OP_NONE = 0x0,
|
||||||
GDK_WIN32_MODAL_OP_SIZE = 0x1 << 0,
|
GDK_WIN32_MODAL_OP_SIZE = 0x1 << 0,
|
||||||
@@ -324,16 +185,9 @@ extern HWND _modal_move_resize_window;
|
|||||||
void _gdk_win32_begin_modal_call (GdkWin32ModalOpKind kind);
|
void _gdk_win32_begin_modal_call (GdkWin32ModalOpKind kind);
|
||||||
void _gdk_win32_end_modal_call (GdkWin32ModalOpKind kind);
|
void _gdk_win32_end_modal_call (GdkWin32ModalOpKind kind);
|
||||||
|
|
||||||
/* Convert a pixbuf to an HICON (or HCURSOR). Supports alpha under
|
|
||||||
* Windows XP, thresholds alpha otherwise.
|
|
||||||
*/
|
|
||||||
HICON _gdk_win32_texture_to_hicon (GdkTexture *texture);
|
|
||||||
|
|
||||||
void _gdk_win32_display_init_cursors (GdkWin32Display *display);
|
void _gdk_win32_display_init_cursors (GdkWin32Display *display);
|
||||||
void _gdk_win32_display_finalize_cursors (GdkWin32Display *display);
|
void _gdk_win32_display_finalize_cursors (GdkWin32Display *display);
|
||||||
void _gdk_win32_display_update_cursors (GdkWin32Display *display);
|
void _gdk_win32_display_update_cursors (GdkWin32Display *display);
|
||||||
GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display, const char * cursor_name);
|
|
||||||
GdkCursor *gdk_win32_display_cursor_from_hcursor (GdkDisplay *display, HCURSOR hcursor);
|
|
||||||
|
|
||||||
typedef struct _Win32CursorTheme Win32CursorTheme;
|
typedef struct _Win32CursorTheme Win32CursorTheme;
|
||||||
|
|
||||||
@@ -367,9 +221,6 @@ Win32Cursor * win32_cursor_theme_get_cursor (Win32CursorTheme *theme,
|
|||||||
void win32_cursor_theme_destroy (Win32CursorTheme *theme);
|
void win32_cursor_theme_destroy (Win32CursorTheme *theme);
|
||||||
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
|
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
|
||||||
|
|
||||||
/* GdkDisplay member functions */
|
|
||||||
GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
|
|
||||||
|
|
||||||
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
||||||
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
||||||
|
|
||||||
@@ -395,16 +246,11 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
|||||||
/* Stray GdkWin32Screen members */
|
/* Stray GdkWin32Screen members */
|
||||||
gboolean _gdk_win32_get_setting (const char *name, GValue *value);
|
gboolean _gdk_win32_get_setting (const char *name, GValue *value);
|
||||||
void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen);
|
void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen);
|
||||||
GdkSurface *gdk_win32_screen_get_root_window (GdkWin32Screen *screen);
|
|
||||||
GdkSurface *gdk_win32_display_get_root_window (GdkDisplay *display);
|
|
||||||
|
|
||||||
/* Distributed display manager implementation */
|
/* Distributed display manager implementation */
|
||||||
GdkDisplay *_gdk_win32_display_open (const char *display_name);
|
GdkDisplay *_gdk_win32_display_open (const char *display_name);
|
||||||
void _gdk_win32_append_event (GdkEvent *event);
|
void _gdk_win32_append_event (GdkEvent *event);
|
||||||
|
|
||||||
|
|
||||||
guint32 _gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap);
|
|
||||||
|
|
||||||
void _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
void _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||||
GdkWin32AeroSnapCombo combo);
|
GdkWin32AeroSnapCombo combo);
|
||||||
|
|
||||||
@@ -449,8 +295,15 @@ gboolean _gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type);
|
|||||||
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
GdkPixbuf *gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
||||||
double *x_hot,
|
double *x_hot,
|
||||||
double *y_hot);
|
double *y_hot);
|
||||||
HICON gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
|
|
||||||
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
void gdk_win32_set_modal_dialog_libgtk_only (HWND window);
|
||||||
|
|
||||||
gpointer gdk_win32_handle_table_lookup_ (HWND handle);
|
gpointer gdk_win32_handle_table_lookup_ (HWND handle);
|
||||||
|
|
||||||
|
extern IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
|
||||||
|
static inline HMODULE
|
||||||
|
this_module (void)
|
||||||
|
{
|
||||||
|
return (HMODULE) &__ImageBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,15 @@ _gdk_win32_get_setting (const char *name,
|
|||||||
}
|
}
|
||||||
else if (strcmp ("gtk-font-name", name) == 0)
|
else if (strcmp ("gtk-font-name", name) == 0)
|
||||||
{
|
{
|
||||||
char *font_name = _get_system_font_name (_gdk_display_hdc);
|
char *font_name = NULL;
|
||||||
|
HDC hdc = NULL;
|
||||||
|
|
||||||
|
if ((hdc = GetDC (HWND_DESKTOP)) != NULL)
|
||||||
|
{
|
||||||
|
font_name = _get_system_font_name (hdc);
|
||||||
|
ReleaseDC (HWND_DESKTOP, hdc);
|
||||||
|
hdc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (font_name)
|
if (font_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include "gdkdisplay-win32.h"
|
#include "gdkdisplay-win32.h"
|
||||||
#include "gdkdevice-win32.h"
|
#include "gdkdevice-win32.h"
|
||||||
#include "gdkcairocontext-win32.h"
|
#include "gdkcairocontext-win32.h"
|
||||||
|
#include "gdkmonitor-win32.h"
|
||||||
|
|
||||||
#include <cairo-win32.h>
|
#include <cairo-win32.h>
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
@@ -338,7 +339,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
wcl.lpfnWndProc = _gdk_win32_surface_procedure;
|
wcl.lpfnWndProc = _gdk_win32_surface_procedure;
|
||||||
wcl.cbClsExtra = 0;
|
wcl.cbClsExtra = 0;
|
||||||
wcl.cbWndExtra = 0;
|
wcl.cbWndExtra = 0;
|
||||||
wcl.hInstance = _gdk_dll_hinstance;
|
wcl.hInstance = this_module ();
|
||||||
wcl.hIcon = 0;
|
wcl.hIcon = 0;
|
||||||
wcl.hIconSm = 0;
|
wcl.hIconSm = 0;
|
||||||
|
|
||||||
@@ -355,7 +356,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||||
{
|
{
|
||||||
// fallback : load icon from GTK DLL
|
// fallback : load icon from GTK DLL
|
||||||
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
if (0 != GetModuleFileName (this_module (), sLoc, MAX_PATH))
|
||||||
{
|
{
|
||||||
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
||||||
}
|
}
|
||||||
@@ -492,7 +493,7 @@ gdk_win32_surface_constructed (GObject *object)
|
|||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
owner,
|
owner,
|
||||||
NULL,
|
NULL,
|
||||||
_gdk_dll_hinstance,
|
this_module (),
|
||||||
surface);
|
surface);
|
||||||
if (impl->handle == NULL)
|
if (impl->handle == NULL)
|
||||||
{
|
{
|
||||||
@@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_surface_fullscreen (GdkSurface *window);
|
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||||
|
GdkMonitor *monitor);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_window_internal (GdkSurface *window,
|
show_window_internal (GdkSurface *window,
|
||||||
@@ -723,11 +725,7 @@ show_window_internal (GdkSurface *window,
|
|||||||
|
|
||||||
if (center)
|
if (center)
|
||||||
{
|
{
|
||||||
window_rect.left = 0;
|
GetWindowRect (GDK_SURFACE_HWND (window), &window_rect);
|
||||||
window_rect.top = 0;
|
|
||||||
window_rect.right = window->width * surface->surface_scale;
|
|
||||||
window_rect.bottom = window->height * surface->surface_scale;
|
|
||||||
_gdk_win32_adjust_client_rect (window, &window_rect);
|
|
||||||
|
|
||||||
x = center_on_rect.left + ((center_on_rect.right - center_on_rect.left) - (window_rect.right - window_rect.left)) / 2;
|
x = center_on_rect.left + ((center_on_rect.right - center_on_rect.left) - (window_rect.right - window_rect.left)) / 2;
|
||||||
y = center_on_rect.top + ((center_on_rect.bottom - center_on_rect.top) - (window_rect.bottom - window_rect.top)) / 2;
|
y = center_on_rect.top + ((center_on_rect.bottom - center_on_rect.top) - (window_rect.bottom - window_rect.top)) / 2;
|
||||||
@@ -789,11 +787,7 @@ show_window_internal (GdkSurface *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||||
{
|
|
||||||
gdk_win32_surface_fullscreen (window);
|
|
||||||
}
|
|
||||||
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
|
||||||
{
|
{
|
||||||
GtkShowWindow (window, SW_MAXIMIZE);
|
GtkShowWindow (window, SW_MAXIMIZE);
|
||||||
}
|
}
|
||||||
@@ -2406,7 +2400,7 @@ RegisterGdkDumbClass ()
|
|||||||
wcl.lpfnWndProc = DefWindowProcW;
|
wcl.lpfnWndProc = DefWindowProcW;
|
||||||
wcl.cbClsExtra = 0;
|
wcl.cbClsExtra = 0;
|
||||||
wcl.cbWndExtra = 0;
|
wcl.cbWndExtra = 0;
|
||||||
wcl.hInstance = _gdk_dll_hinstance;
|
wcl.hInstance = this_module ();
|
||||||
wcl.hIcon = 0;
|
wcl.hIcon = 0;
|
||||||
wcl.hIconSm = 0;
|
wcl.hIconSm = 0;
|
||||||
wcl.lpszMenuName = NULL;
|
wcl.lpszMenuName = NULL;
|
||||||
@@ -2447,7 +2441,7 @@ ensure_snap_indicator_exists (GdkW32DragMoveResizeContext *context)
|
|||||||
0, 0,
|
0, 0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
_gdk_dll_hinstance,
|
this_module (),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
context->shape_indicator = handle;
|
context->shape_indicator = handle;
|
||||||
@@ -4008,11 +4002,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_surface_fullscreen (GdkSurface *window)
|
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||||
|
GdkMonitor *monitor)
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
FullscreenInfo *fi;
|
FullscreenInfo *fi;
|
||||||
HMONITOR monitor;
|
HMONITOR hmonitor = NULL;
|
||||||
MONITORINFO mi;
|
MONITORINFO mi;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||||
@@ -4025,9 +4020,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
|||||||
{
|
{
|
||||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||||
|
|
||||||
monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
if (monitor && GDK_IS_WIN32_MONITOR (monitor))
|
||||||
|
hmonitor = GDK_WIN32_MONITOR (monitor)->hmonitor;
|
||||||
|
|
||||||
|
if (!hmonitor)
|
||||||
|
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||||
|
|
||||||
mi.cbSize = sizeof (mi);
|
mi.cbSize = sizeof (mi);
|
||||||
if (monitor && GetMonitorInfo (monitor, &mi))
|
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
|
||||||
{
|
{
|
||||||
x = mi.rcMonitor.left;
|
x = mi.rcMonitor.left;
|
||||||
y = mi.rcMonitor.top;
|
y = mi.rcMonitor.top;
|
||||||
@@ -4869,9 +4869,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
|
|||||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||||
{
|
{
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
gdk_win32_surface_fullscreen (surface);
|
{
|
||||||
|
GdkMonitor *monitor;
|
||||||
|
|
||||||
|
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||||
|
gdk_win32_surface_fullscreen (surface, monitor);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gdk_win32_surface_unfullscreen (surface);
|
{
|
||||||
|
gdk_win32_surface_unfullscreen (surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_win32_surface_show (surface, FALSE);
|
gdk_win32_surface_show (surface, FALSE);
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
#include "gdkprivate-win32.h"
|
#include "gdkprivate-win32.h"
|
||||||
#include "gdkwin32misc.h"
|
#include "gdkwin32misc.h"
|
||||||
|
|
||||||
extern HINSTANCE _gdk_dll_hinstance;
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWin32VulkanContext, gdk_win32_vulkan_context, GDK_TYPE_VULKAN_CONTEXT)
|
G_DEFINE_TYPE (GdkWin32VulkanContext, gdk_win32_vulkan_context, GDK_TYPE_VULKAN_CONTEXT)
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
@@ -47,7 +45,7 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
|||||||
info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||||
info.pNext = NULL;
|
info.pNext = NULL;
|
||||||
info.flags = 0;
|
info.flags = 0;
|
||||||
info.hinstance = _gdk_dll_hinstance;
|
info.hinstance = this_module ();
|
||||||
info.hwnd = GDK_SURFACE_HWND (window);
|
info.hwnd = GDK_SURFACE_HWND (window);
|
||||||
|
|
||||||
/* This is necessary so that Vulkan sees the Window.
|
/* This is necessary so that Vulkan sees the Window.
|
||||||
@@ -68,12 +66,12 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *update_area)
|
cairo_region_t *update_area)
|
||||||
{
|
{
|
||||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||||
|
|
||||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
|
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ create_cairo_surface_for_surface (GdkSurface *surface)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
gboolean prefers_high_depth,
|
GdkMemoryDepth depth,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);
|
GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);
|
||||||
|
|||||||
+1
-204
@@ -134,35 +134,6 @@ struct _GdkX11DragClass
|
|||||||
GdkDragClass parent_class;
|
GdkDragClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int keysym;
|
|
||||||
int modifiers;
|
|
||||||
} GrabKey;
|
|
||||||
|
|
||||||
static GrabKey grab_keys[] = {
|
|
||||||
{ XK_Escape, 0 },
|
|
||||||
{ XK_space, 0 },
|
|
||||||
{ XK_KP_Space, 0 },
|
|
||||||
{ XK_Return, 0 },
|
|
||||||
{ XK_KP_Enter, 0 },
|
|
||||||
{ XK_Up, 0 },
|
|
||||||
{ XK_Up, Mod1Mask },
|
|
||||||
{ XK_Down, 0 },
|
|
||||||
{ XK_Down, Mod1Mask },
|
|
||||||
{ XK_Left, 0 },
|
|
||||||
{ XK_Left, Mod1Mask },
|
|
||||||
{ XK_Right, 0 },
|
|
||||||
{ XK_Right, Mod1Mask },
|
|
||||||
{ XK_KP_Up, 0 },
|
|
||||||
{ XK_KP_Up, Mod1Mask },
|
|
||||||
{ XK_KP_Down, 0 },
|
|
||||||
{ XK_KP_Down, Mod1Mask },
|
|
||||||
{ XK_KP_Left, 0 },
|
|
||||||
{ XK_KP_Left, Mod1Mask },
|
|
||||||
{ XK_KP_Right, 0 },
|
|
||||||
{ XK_KP_Right, Mod1Mask }
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
|
||||||
static GdkSurfaceCache *gdk_surface_cache_ref (GdkSurfaceCache *cache);
|
static GdkSurfaceCache *gdk_surface_cache_ref (GdkSurfaceCache *cache);
|
||||||
@@ -1861,20 +1832,15 @@ drag_grab (GdkDrag *drag)
|
|||||||
{
|
{
|
||||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||||
GdkSeatCapabilities capabilities;
|
GdkSeatCapabilities capabilities;
|
||||||
GdkDisplay *display;
|
|
||||||
Window root;
|
|
||||||
GdkSeat *seat;
|
GdkSeat *seat;
|
||||||
int keycode, i;
|
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
|
|
||||||
if (!x11_drag->ipc_surface)
|
if (!x11_drag->ipc_surface)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
display = gdk_drag_get_display (drag);
|
|
||||||
root = GDK_DISPLAY_XROOTWIN (display);
|
|
||||||
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
|
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
|
||||||
|
|
||||||
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING | GDK_SEAT_CAPABILITY_KEYBOARD;
|
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
|
||||||
|
|
||||||
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
|
cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
|
||||||
g_set_object (&x11_drag->cursor, cursor);
|
g_set_object (&x11_drag->cursor, cursor);
|
||||||
@@ -1886,46 +1852,6 @@ drag_grab (GdkDrag *drag)
|
|||||||
|
|
||||||
g_set_object (&x11_drag->grab_seat, seat);
|
g_set_object (&x11_drag->grab_seat, seat);
|
||||||
|
|
||||||
gdk_x11_display_error_trap_push (display);
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
|
||||||
{
|
|
||||||
int deviceid = gdk_x11_device_get_id (gdk_seat_get_keyboard (seat));
|
|
||||||
unsigned char mask[XIMaskLen(XI_LASTEVENT)];
|
|
||||||
XIGrabModifiers mods;
|
|
||||||
XIEventMask evmask;
|
|
||||||
int num_mods;
|
|
||||||
|
|
||||||
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display),
|
|
||||||
grab_keys[i].keysym);
|
|
||||||
if (keycode == NoSymbol)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
memset (mask, 0, sizeof (mask));
|
|
||||||
XISetMask (mask, XI_KeyPress);
|
|
||||||
XISetMask (mask, XI_KeyRelease);
|
|
||||||
|
|
||||||
evmask.deviceid = deviceid;
|
|
||||||
evmask.mask_len = sizeof (mask);
|
|
||||||
evmask.mask = mask;
|
|
||||||
|
|
||||||
num_mods = 1;
|
|
||||||
mods.modifiers = grab_keys[i].modifiers;
|
|
||||||
|
|
||||||
XIGrabKeycode (GDK_DISPLAY_XDISPLAY (display),
|
|
||||||
deviceid,
|
|
||||||
keycode,
|
|
||||||
root,
|
|
||||||
GrabModeAsync,
|
|
||||||
GrabModeAsync,
|
|
||||||
False,
|
|
||||||
&evmask,
|
|
||||||
num_mods,
|
|
||||||
&mods);
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_x11_display_error_trap_pop_ignored (display);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1933,41 +1859,13 @@ static void
|
|||||||
drag_ungrab (GdkDrag *drag)
|
drag_ungrab (GdkDrag *drag)
|
||||||
{
|
{
|
||||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||||
GdkDisplay *display;
|
|
||||||
GdkDevice *keyboard;
|
|
||||||
Window root;
|
|
||||||
int keycode, i;
|
|
||||||
|
|
||||||
if (!x11_drag->grab_seat)
|
if (!x11_drag->grab_seat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdk_seat_ungrab (x11_drag->grab_seat);
|
gdk_seat_ungrab (x11_drag->grab_seat);
|
||||||
|
|
||||||
display = gdk_drag_get_display (drag);
|
|
||||||
keyboard = gdk_seat_get_keyboard (x11_drag->grab_seat);
|
|
||||||
root = GDK_DISPLAY_XROOTWIN (display);
|
|
||||||
g_clear_object (&x11_drag->grab_seat);
|
g_clear_object (&x11_drag->grab_seat);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
|
||||||
{
|
|
||||||
XIGrabModifiers mods;
|
|
||||||
int num_mods;
|
|
||||||
|
|
||||||
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display),
|
|
||||||
grab_keys[i].keysym);
|
|
||||||
if (keycode == NoSymbol)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
num_mods = 1;
|
|
||||||
mods.modifiers = grab_keys[i].modifiers;
|
|
||||||
|
|
||||||
XIUngrabKeycode (GDK_DISPLAY_XDISPLAY (display),
|
|
||||||
gdk_x11_device_get_id (keyboard),
|
|
||||||
keycode,
|
|
||||||
root,
|
|
||||||
num_mods,
|
|
||||||
&mods);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkDrag *
|
GdkDrag *
|
||||||
@@ -2191,103 +2089,6 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gdk_dnd_handle_key_event (GdkDrag *drag,
|
|
||||||
GdkEvent *event)
|
|
||||||
{
|
|
||||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
|
||||||
GdkModifierType state;
|
|
||||||
GdkDevice *pointer;
|
|
||||||
GdkSeat *seat;
|
|
||||||
int dx, dy;
|
|
||||||
|
|
||||||
dx = dy = 0;
|
|
||||||
state = gdk_event_get_modifier_state (event);
|
|
||||||
seat = gdk_event_get_seat (event);
|
|
||||||
pointer = gdk_seat_get_pointer (seat);
|
|
||||||
|
|
||||||
if (event->event_type == GDK_KEY_PRESS)
|
|
||||||
{
|
|
||||||
guint keyval = gdk_key_event_get_keyval (event);
|
|
||||||
|
|
||||||
switch (keyval)
|
|
||||||
{
|
|
||||||
case GDK_KEY_Escape:
|
|
||||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case GDK_KEY_space:
|
|
||||||
case GDK_KEY_Return:
|
|
||||||
case GDK_KEY_ISO_Enter:
|
|
||||||
case GDK_KEY_KP_Enter:
|
|
||||||
case GDK_KEY_KP_Space:
|
|
||||||
if ((gdk_drag_get_selected_action (drag) != 0) &&
|
|
||||||
(x11_drag->proxy_xid != None))
|
|
||||||
{
|
|
||||||
g_signal_emit_by_name (drag, "drop-performed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case GDK_KEY_Up:
|
|
||||||
case GDK_KEY_KP_Up:
|
|
||||||
dy = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GDK_KEY_Down:
|
|
||||||
case GDK_KEY_KP_Down:
|
|
||||||
dy = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GDK_KEY_Left:
|
|
||||||
case GDK_KEY_KP_Left:
|
|
||||||
dx = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GDK_KEY_Right:
|
|
||||||
case GDK_KEY_KP_Right:
|
|
||||||
dx = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The state is not yet updated in the event, so we need
|
|
||||||
* to query it here. We could use XGetModifierMapping, but
|
|
||||||
* that would be overkill.
|
|
||||||
*/
|
|
||||||
gdk_x11_device_xi2_query_state (pointer, NULL, NULL, NULL, &state);
|
|
||||||
|
|
||||||
if (dx != 0 || dy != 0)
|
|
||||||
{
|
|
||||||
GdkDisplay *display;
|
|
||||||
Display *xdisplay;
|
|
||||||
GdkX11Screen *screen;
|
|
||||||
Window dest;
|
|
||||||
|
|
||||||
x11_drag->last_x += dx;
|
|
||||||
x11_drag->last_y += dy;
|
|
||||||
|
|
||||||
display = gdk_event_get_display ((GdkEvent *)event);
|
|
||||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
|
||||||
screen = GDK_X11_DISPLAY (display)->screen;
|
|
||||||
dest = GDK_SCREEN_XROOTWIN (screen);
|
|
||||||
|
|
||||||
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
|
|
||||||
round (x11_drag->last_x * screen->surface_scale),
|
|
||||||
round (x11_drag->last_y * screen->surface_scale));
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,
|
|
||||||
gdk_event_get_time (event));
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
|
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
|
||||||
GdkEvent *event)
|
GdkEvent *event)
|
||||||
@@ -2354,10 +2155,6 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
|
|||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
return gdk_dnd_handle_button_event (drag, event);
|
return gdk_dnd_handle_button_event (drag, event);
|
||||||
|
|
||||||
case GDK_KEY_PRESS:
|
|
||||||
case GDK_KEY_RELEASE:
|
|
||||||
return gdk_dnd_handle_key_event (drag, event);
|
|
||||||
|
|
||||||
case GDK_GRAB_BROKEN:
|
case GDK_GRAB_BROKEN:
|
||||||
return gdk_dnd_handle_grab_broken_event (drag, event);
|
return gdk_dnd_handle_grab_broken_event (drag, event);
|
||||||
|
|
||||||
|
|||||||
+31
-22
@@ -543,8 +543,6 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
|||||||
if (share != NULL)
|
if (share != NULL)
|
||||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||||
|
|
||||||
gdk_x11_display_error_trap_push (display);
|
|
||||||
|
|
||||||
supported_versions = gdk_gl_versions_get_for_api (api);
|
supported_versions = gdk_gl_versions_get_for_api (api);
|
||||||
for (j = 0; gdk_gl_version_greater_equal (&supported_versions[j], &version); j++)
|
for (j = 0; gdk_gl_version_greater_equal (&supported_versions[j], &version); j++)
|
||||||
{
|
{
|
||||||
@@ -568,19 +566,13 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
|||||||
True,
|
True,
|
||||||
context_attribs);
|
context_attribs);
|
||||||
|
|
||||||
if (ctx)
|
if (ctx != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
{
|
{
|
||||||
gdk_x11_display_error_trap_pop_ignored (display);
|
GDK_DISPLAY_DEBUG (display, OPENGL, "Failed to create a GLX context");
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gdk_x11_display_error_trap_pop (display))
|
|
||||||
{
|
|
||||||
glXDestroyContext (dpy, ctx);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,25 +656,42 @@ gdk_x11_gl_context_glx_realize (GdkGLContext *context,
|
|||||||
if (share != NULL && gdk_gl_context_is_legacy (share))
|
if (share != NULL && gdk_gl_context_is_legacy (share))
|
||||||
legacy = TRUE;
|
legacy = TRUE;
|
||||||
|
|
||||||
|
gdk_x11_display_error_trap_push (display);
|
||||||
|
|
||||||
|
/* Increase XNextRequest because GLX may fake errors with the last request
|
||||||
|
* and we want the error trap to catch them */
|
||||||
|
XChangeWindowAttributes (GDK_DISPLAY_XDISPLAY (display),
|
||||||
|
GDK_X11_DISPLAY (display)->leader_window,
|
||||||
|
0,
|
||||||
|
(XSetWindowAttributes[1]) { 0, });
|
||||||
|
|
||||||
if (preferred_api == GDK_GL_API_GL)
|
if (preferred_api == GDK_GL_API_GL)
|
||||||
{
|
{
|
||||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy);
|
||||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, legacy)) ||
|
if (api == 0)
|
||||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, legacy);
|
||||||
return api;
|
if (api == 0)
|
||||||
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, FALSE)) ||
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, FALSE);
|
||||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
if (api == 0)
|
||||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy);
|
||||||
return api;
|
if (api == 0)
|
||||||
|
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_set_error_literal (error, GDK_GL_ERROR,
|
gdk_x11_display_error_trap_pop_ignored (display);
|
||||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
|
||||||
_("Unable to create a GL context"));
|
if (api == 0)
|
||||||
return 0;
|
{
|
||||||
|
g_set_error_literal (error, GDK_GL_ERROR,
|
||||||
|
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||||
|
_("Unable to create a GL context"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef N_GLX_ATTRS
|
#undef N_GLX_ATTRS
|
||||||
|
|||||||
+19
-3
@@ -685,8 +685,13 @@ init_randr13 (GdkX11Screen *x11_screen)
|
|||||||
for (i = 0; i < resources->noutput; ++i)
|
for (i = 0; i < resources->noutput; ++i)
|
||||||
{
|
{
|
||||||
RROutput output = resources->outputs[i];
|
RROutput output = resources->outputs[i];
|
||||||
XRROutputInfo *output_info =
|
XRROutputInfo *output_info;
|
||||||
XRRGetOutputInfo (x11_screen->xdisplay, resources, output);
|
|
||||||
|
gdk_x11_display_error_trap_push (display);
|
||||||
|
output_info = XRRGetOutputInfo (x11_screen->xdisplay, resources, output);
|
||||||
|
|
||||||
|
if (gdk_x11_display_error_trap_pop (display))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (output_info->connection == RR_Disconnected)
|
if (output_info->connection == RR_Disconnected)
|
||||||
{
|
{
|
||||||
@@ -697,13 +702,22 @@ init_randr13 (GdkX11Screen *x11_screen)
|
|||||||
if (output_info->crtc)
|
if (output_info->crtc)
|
||||||
{
|
{
|
||||||
GdkX11Monitor *monitor;
|
GdkX11Monitor *monitor;
|
||||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc);
|
XRRCrtcInfo *crtc;
|
||||||
char *name;
|
char *name;
|
||||||
GdkRectangle geometry;
|
GdkRectangle geometry;
|
||||||
GdkRectangle newgeo;
|
GdkRectangle newgeo;
|
||||||
int j;
|
int j;
|
||||||
int refresh_rate = 0;
|
int refresh_rate = 0;
|
||||||
|
|
||||||
|
gdk_x11_display_error_trap_push (display);
|
||||||
|
crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc);
|
||||||
|
|
||||||
|
if (gdk_x11_display_error_trap_pop (display))
|
||||||
|
{
|
||||||
|
XRRFreeOutputInfo (output_info);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < resources->nmode; j++)
|
for (j = 0; j < resources->nmode; j++)
|
||||||
{
|
{
|
||||||
XRRModeInfo *xmode = &resources->modes[j];
|
XRRModeInfo *xmode = &resources->modes[j];
|
||||||
@@ -775,8 +789,10 @@ init_randr13 (GdkX11Screen *x11_screen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
x11_display->primary_monitor = 0;
|
x11_display->primary_monitor = 0;
|
||||||
|
gdk_x11_display_error_trap_push (display);
|
||||||
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
||||||
x11_screen->xroot_window);
|
x11_screen->xroot_window);
|
||||||
|
gdk_x11_display_error_trap_pop_ignored (display);
|
||||||
|
|
||||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ gdk_x11_selection_input_stream_fill_buffer (GdkX11SelectionInputStream *stream,
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
/* EOF marker, put it back */
|
/* EOF marker, put it back */
|
||||||
g_async_queue_push_front_unlocked (priv->chunks, bytes);
|
g_async_queue_push_front_unlocked (priv->chunks, g_steal_pointer (&bytes));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (size > count)
|
else if (size > count)
|
||||||
@@ -107,7 +107,7 @@ gdk_x11_selection_input_stream_fill_buffer (GdkX11SelectionInputStream *stream,
|
|||||||
memcpy (buffer, g_bytes_get_data (bytes, NULL), size);
|
memcpy (buffer, g_bytes_get_data (bytes, NULL), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (g_steal_pointer (&bytes));
|
||||||
result += size;
|
result += size;
|
||||||
if (buffer)
|
if (buffer)
|
||||||
buffer += size;
|
buffer += size;
|
||||||
@@ -165,9 +165,7 @@ gdk_x11_selection_input_stream_complete (GdkX11SelectionInputStream *stream)
|
|||||||
GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream);
|
GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream);
|
||||||
g_signal_handlers_disconnect_by_func (priv->display,
|
g_signal_handlers_disconnect_by_func (priv->display,
|
||||||
gdk_x11_selection_input_stream_xevent,
|
gdk_x11_selection_input_stream_xevent,
|
||||||
stream);
|
g_steal_pointer (&stream));
|
||||||
|
|
||||||
g_object_unref (stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gssize
|
static gssize
|
||||||
@@ -416,7 +414,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
|||||||
"%s:%s: got PropertyNotify erroring out of INCR",
|
"%s:%s: got PropertyNotify erroring out of INCR",
|
||||||
priv->selection, priv->target);
|
priv->selection, priv->target);
|
||||||
/* error, should we signal one? */
|
/* error, should we signal one? */
|
||||||
gdk_x11_selection_input_stream_complete (stream);
|
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||||
}
|
}
|
||||||
else if (g_bytes_get_size (bytes) == 0 || type == None)
|
else if (g_bytes_get_size (bytes) == 0 || type == None)
|
||||||
{
|
{
|
||||||
@@ -424,7 +422,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
|||||||
"%s:%s: got PropertyNotify ending INCR",
|
"%s:%s: got PropertyNotify ending INCR",
|
||||||
priv->selection, priv->target);
|
priv->selection, priv->target);
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
gdk_x11_selection_input_stream_complete (stream);
|
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -467,7 +465,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
|||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
G_IO_ERROR_NOT_FOUND,
|
G_IO_ERROR_NOT_FOUND,
|
||||||
_("Format %s not supported"), priv->target);
|
_("Format %s not supported"), priv->target);
|
||||||
gdk_x11_selection_input_stream_complete (stream);
|
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -478,7 +476,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
|||||||
|
|
||||||
if (bytes == NULL)
|
if (bytes == NULL)
|
||||||
{
|
{
|
||||||
gdk_x11_selection_input_stream_complete (stream);
|
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -500,7 +498,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display,
|
|||||||
g_bytes_get_size (bytes));
|
g_bytes_get_size (bytes));
|
||||||
g_async_queue_push (priv->chunks, bytes);
|
g_async_queue_push (priv->chunks, bytes);
|
||||||
|
|
||||||
gdk_x11_selection_input_stream_complete (stream);
|
g_clear_pointer (&stream, gdk_x11_selection_input_stream_complete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +539,10 @@ gdk_x11_selection_input_stream_new_async (GdkDisplay *display,
|
|||||||
priv->property = g_strdup_printf ("GDK_SELECTION_%p", stream);
|
priv->property = g_strdup_printf ("GDK_SELECTION_%p", stream);
|
||||||
priv->xproperty = gdk_x11_get_xatom_by_name_for_display (display, priv->property);
|
priv->xproperty = gdk_x11_get_xatom_by_name_for_display (display, priv->property);
|
||||||
|
|
||||||
g_signal_connect (display, "xevent", G_CALLBACK (gdk_x11_selection_input_stream_xevent), stream);
|
g_signal_connect_data (display, "xevent",
|
||||||
|
G_CALLBACK (gdk_x11_selection_input_stream_xevent),
|
||||||
|
g_steal_pointer (&stream),
|
||||||
|
(GClosureNotify) g_object_unref, 0);
|
||||||
|
|
||||||
XConvertSelection (GDK_DISPLAY_XDISPLAY (display),
|
XConvertSelection (GDK_DISPLAY_XDISPLAY (display),
|
||||||
priv->xselection,
|
priv->xselection,
|
||||||
@@ -577,7 +578,6 @@ gdk_x11_selection_input_stream_new_finish (GAsyncResult *result,
|
|||||||
*type = priv->type;
|
*type = priv->type;
|
||||||
if (format)
|
if (format)
|
||||||
*format = priv->format;
|
*format = priv->format;
|
||||||
g_object_ref (stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return G_INPUT_STREAM (stream);
|
return G_INPUT_STREAM (stream);
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ collect_reused_child_nodes (GskRenderer *renderer,
|
|||||||
case GSK_CROSS_FADE_NODE:
|
case GSK_CROSS_FADE_NODE:
|
||||||
case GSK_BLUR_NODE:
|
case GSK_BLUR_NODE:
|
||||||
case GSK_MASK_NODE:
|
case GSK_MASK_NODE:
|
||||||
|
case GSK_FILL_NODE:
|
||||||
|
case GSK_STROKE_NODE:
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@@ -859,6 +861,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
|||||||
case GSK_CROSS_FADE_NODE:
|
case GSK_CROSS_FADE_NODE:
|
||||||
case GSK_BLUR_NODE:
|
case GSK_BLUR_NODE:
|
||||||
case GSK_GL_SHADER_NODE:
|
case GSK_GL_SHADER_NODE:
|
||||||
|
case GSK_FILL_NODE:
|
||||||
|
case GSK_STROKE_NODE:
|
||||||
default:
|
default:
|
||||||
break; /* Fallback */
|
break; /* Fallback */
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -165,7 +165,7 @@ void half_to_float4 (const guint16 h[4], float f[4]) __attribute__((ifunc ("reso
|
|||||||
void float_to_half (const float *f, guint16 *h, int n) __attribute__((ifunc ("resolve_float_to_half")));
|
void float_to_half (const float *f, guint16 *h, int n) __attribute__((ifunc ("resolve_float_to_half")));
|
||||||
void half_to_float (const guint16 *h, float *f, int n) __attribute__((ifunc ("resolve_half_to_float")));
|
void half_to_float (const guint16 *h, float *f, int n) __attribute__((ifunc ("resolve_half_to_float")));
|
||||||
|
|
||||||
static void *
|
static void * __attribute__ ((no_sanitize_address))
|
||||||
resolve_float_to_half4 (void)
|
resolve_float_to_half4 (void)
|
||||||
{
|
{
|
||||||
__builtin_cpu_init ();
|
__builtin_cpu_init ();
|
||||||
@@ -175,7 +175,7 @@ resolve_float_to_half4 (void)
|
|||||||
return float_to_half4_c;
|
return float_to_half4_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void * __attribute__ ((no_sanitize_address))
|
||||||
resolve_half_to_float4 (void)
|
resolve_half_to_float4 (void)
|
||||||
{
|
{
|
||||||
__builtin_cpu_init ();
|
__builtin_cpu_init ();
|
||||||
@@ -185,7 +185,7 @@ resolve_half_to_float4 (void)
|
|||||||
return half_to_float4_c;
|
return half_to_float4_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void * __attribute__ ((no_sanitize_address))
|
||||||
resolve_float_to_half (void)
|
resolve_float_to_half (void)
|
||||||
{
|
{
|
||||||
__builtin_cpu_init ();
|
__builtin_cpu_init ();
|
||||||
@@ -195,7 +195,7 @@ resolve_float_to_half (void)
|
|||||||
return float_to_half_c;
|
return float_to_half_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void * __attribute__ ((no_sanitize_address))
|
||||||
resolve_half_to_float (void)
|
resolve_half_to_float (void)
|
||||||
{
|
{
|
||||||
__builtin_cpu_init ();
|
__builtin_cpu_init ();
|
||||||
|
|||||||
+80
-13
@@ -1447,6 +1447,7 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
|
|||||||
return fbo_id;
|
return fbo_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GdkMemoryFormat
|
static GdkMemoryFormat
|
||||||
memory_format_gl_format (GdkMemoryFormat data_format,
|
memory_format_gl_format (GdkMemoryFormat data_format,
|
||||||
gboolean use_es,
|
gboolean use_es,
|
||||||
@@ -1454,18 +1455,65 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
|||||||
guint minor,
|
guint minor,
|
||||||
guint *gl_internalformat,
|
guint *gl_internalformat,
|
||||||
guint *gl_format,
|
guint *gl_format,
|
||||||
guint *gl_type)
|
guint *gl_type,
|
||||||
|
GLint (*gl_swizzle)[4])
|
||||||
{
|
{
|
||||||
|
GdkMemoryDepth depth;
|
||||||
|
|
||||||
|
/* First, try the format itself */
|
||||||
if (gdk_memory_format_gl_format (data_format,
|
if (gdk_memory_format_gl_format (data_format,
|
||||||
use_es,
|
use_es,
|
||||||
major,
|
major,
|
||||||
minor,
|
minor,
|
||||||
gl_internalformat,
|
gl_internalformat,
|
||||||
gl_format,
|
gl_format,
|
||||||
gl_type))
|
gl_type,
|
||||||
|
gl_swizzle) &&
|
||||||
|
gdk_memory_format_alpha (data_format) != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||||
return data_format;
|
return data_format;
|
||||||
|
|
||||||
if (gdk_memory_format_prefers_high_depth (data_format))
|
depth = gdk_memory_format_get_depth (data_format);
|
||||||
|
|
||||||
|
/* Next, try the generic format for the given bit depth */
|
||||||
|
switch (depth)
|
||||||
|
{
|
||||||
|
case GDK_MEMORY_FLOAT16:
|
||||||
|
data_format = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
|
||||||
|
if (gdk_memory_format_gl_format (data_format,
|
||||||
|
use_es,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
gl_internalformat,
|
||||||
|
gl_format,
|
||||||
|
gl_type,
|
||||||
|
gl_swizzle))
|
||||||
|
return data_format;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_U16:
|
||||||
|
data_format = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||||
|
if (gdk_memory_format_gl_format (data_format,
|
||||||
|
use_es,
|
||||||
|
major,
|
||||||
|
minor,
|
||||||
|
gl_internalformat,
|
||||||
|
gl_format,
|
||||||
|
gl_type,
|
||||||
|
gl_swizzle))
|
||||||
|
return data_format;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDK_MEMORY_FLOAT32:
|
||||||
|
case GDK_MEMORY_U8:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the format is high depth, also try float32 */
|
||||||
|
if (depth != GDK_MEMORY_U8)
|
||||||
{
|
{
|
||||||
data_format = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
data_format = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||||
if (gdk_memory_format_gl_format (data_format,
|
if (gdk_memory_format_gl_format (data_format,
|
||||||
@@ -1474,10 +1522,12 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
|||||||
minor,
|
minor,
|
||||||
gl_internalformat,
|
gl_internalformat,
|
||||||
gl_format,
|
gl_format,
|
||||||
gl_type))
|
gl_type,
|
||||||
|
gl_swizzle))
|
||||||
return data_format;
|
return data_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If all else fails, pick the one format that's always supported */
|
||||||
data_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
data_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||||
if (!gdk_memory_format_gl_format (data_format,
|
if (!gdk_memory_format_gl_format (data_format,
|
||||||
use_es,
|
use_es,
|
||||||
@@ -1485,7 +1535,8 @@ memory_format_gl_format (GdkMemoryFormat data_format,
|
|||||||
minor,
|
minor,
|
||||||
gl_internalformat,
|
gl_internalformat,
|
||||||
gl_format,
|
gl_format,
|
||||||
gl_type))
|
gl_type,
|
||||||
|
gl_swizzle))
|
||||||
{
|
{
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
@@ -1508,6 +1559,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
|||||||
GLenum gl_internalformat;
|
GLenum gl_internalformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
|
GLint gl_swizzle[4];
|
||||||
gsize bpp;
|
gsize bpp;
|
||||||
gboolean use_es;
|
gboolean use_es;
|
||||||
int major, minor;
|
int major, minor;
|
||||||
@@ -1524,7 +1576,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
|||||||
minor,
|
minor,
|
||||||
&gl_internalformat,
|
&gl_internalformat,
|
||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type,
|
||||||
|
&gl_swizzle);
|
||||||
|
|
||||||
gdk_texture_downloader_init (&downloader, texture);
|
gdk_texture_downloader_init (&downloader, texture);
|
||||||
gdk_texture_downloader_set_format (&downloader, data_format);
|
gdk_texture_downloader_set_format (&downloader, data_format);
|
||||||
@@ -1559,6 +1612,18 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
|||||||
|
|
||||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||||
|
|
||||||
|
/* Only apply swizzle if really needed, might not even be
|
||||||
|
* supported if default values are set
|
||||||
|
*/
|
||||||
|
if (gl_swizzle[0] != GL_RED || gl_swizzle[1] != GL_GREEN || gl_swizzle[2] != GL_BLUE)
|
||||||
|
{
|
||||||
|
/* Set each channel independently since GLES 3.0 doesn't support the iv method */
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_swizzle[0]);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, gl_swizzle[1]);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, gl_swizzle[2]);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, gl_swizzle[3]);
|
||||||
|
}
|
||||||
|
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,6 +1638,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
|||||||
GLenum gl_internalformat;
|
GLenum gl_internalformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
|
GLint gl_swizzle[4];
|
||||||
gboolean use_es;
|
gboolean use_es;
|
||||||
int texture_id;
|
int texture_id;
|
||||||
int major, minor;
|
int major, minor;
|
||||||
@@ -1611,13 +1677,14 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
|||||||
use_es = gdk_gl_context_get_use_es (self->context);
|
use_es = gdk_gl_context_get_use_es (self->context);
|
||||||
gdk_gl_context_get_version (self->context, &major, &minor);
|
gdk_gl_context_get_version (self->context, &major, &minor);
|
||||||
data_format = gdk_texture_get_format (chunks[0].texture);
|
data_format = gdk_texture_get_format (chunks[0].texture);
|
||||||
memory_format_gl_format (data_format,
|
data_format = memory_format_gl_format (data_format,
|
||||||
use_es,
|
use_es,
|
||||||
major,
|
major,
|
||||||
minor,
|
minor,
|
||||||
&gl_internalformat,
|
&gl_internalformat,
|
||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type,
|
||||||
|
&gl_swizzle);
|
||||||
|
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
|
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
|
||||||
|
|
||||||
|
|||||||
+11
-6
@@ -686,17 +686,21 @@ gsk_gl_driver_cache_texture (GskGLDriver *self,
|
|||||||
const GskTextureKey *key,
|
const GskTextureKey *key,
|
||||||
guint texture_id)
|
guint texture_id)
|
||||||
{
|
{
|
||||||
GskTextureKey *k;
|
|
||||||
|
|
||||||
g_assert (GSK_IS_GL_DRIVER (self));
|
g_assert (GSK_IS_GL_DRIVER (self));
|
||||||
g_assert (key != NULL);
|
g_assert (key != NULL);
|
||||||
g_assert (texture_id > 0);
|
g_assert (texture_id > 0);
|
||||||
g_assert (g_hash_table_contains (self->textures, GUINT_TO_POINTER (texture_id)));
|
g_assert (g_hash_table_contains (self->textures, GUINT_TO_POINTER (texture_id)));
|
||||||
|
|
||||||
k = g_memdup (key, sizeof *key);
|
if (!g_hash_table_contains (self->key_to_texture_id, key))
|
||||||
|
{
|
||||||
|
GskTextureKey *k;
|
||||||
|
|
||||||
g_hash_table_insert (self->key_to_texture_id, k, GUINT_TO_POINTER (texture_id));
|
k = g_memdup (key, sizeof *key);
|
||||||
g_hash_table_insert (self->texture_id_to_key, GUINT_TO_POINTER (texture_id), k);
|
|
||||||
|
g_assert (!g_hash_table_contains (self->texture_id_to_key, GUINT_TO_POINTER (texture_id)));
|
||||||
|
g_hash_table_insert (self->key_to_texture_id, k, GUINT_TO_POINTER (texture_id));
|
||||||
|
g_hash_table_insert (self->texture_id_to_key, GUINT_TO_POINTER (texture_id), k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -761,7 +765,8 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
|
|||||||
GdkGLContext *texture_context = gdk_gl_texture_get_context (gl_texture);
|
GdkGLContext *texture_context = gdk_gl_texture_get_context (gl_texture);
|
||||||
|
|
||||||
if (gdk_gl_context_is_shared (context, texture_context) &&
|
if (gdk_gl_context_is_shared (context, texture_context) &&
|
||||||
(!ensure_mipmap || gdk_gl_texture_has_mipmap (gl_texture)))
|
(!ensure_mipmap || gdk_gl_texture_has_mipmap (gl_texture)) &&
|
||||||
|
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||||
{
|
{
|
||||||
/* A GL texture from the same GL context is a simple task... */
|
/* A GL texture from the same GL context is a simple task... */
|
||||||
return gdk_gl_texture_get_id (gl_texture);
|
return gdk_gl_texture_get_id (gl_texture);
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ gsk_gl_renderer_render (GskRenderer *renderer,
|
|||||||
viewport.size.height = gdk_surface_get_height (surface) * scale;
|
viewport.size.height = gdk_surface_get_height (surface) * scale;
|
||||||
|
|
||||||
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
|
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
|
||||||
gsk_render_node_prefers_high_depth (root),
|
gsk_render_node_get_preferred_depth (root),
|
||||||
update_area);
|
update_area);
|
||||||
|
|
||||||
gdk_gl_context_make_current (self->context);
|
gdk_gl_context_make_current (self->context);
|
||||||
@@ -373,7 +373,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gsk_render_node_prefers_high_depth (root) &&
|
if (gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8 &&
|
||||||
gdk_gl_context_check_version (self->context, "3.0", "3.0"))
|
gdk_gl_context_check_version (self->context, "3.0", "3.0"))
|
||||||
format = GL_RGBA32F;
|
format = GL_RGBA32F;
|
||||||
else
|
else
|
||||||
|
|||||||
+15
-1
@@ -194,7 +194,7 @@ static inline int
|
|||||||
get_target_format (GskGLRenderJob *job,
|
get_target_format (GskGLRenderJob *job,
|
||||||
const GskRenderNode *node)
|
const GskRenderNode *node)
|
||||||
{
|
{
|
||||||
if (gsk_render_node_prefers_high_depth (node))
|
if (gsk_render_node_get_preferred_depth (node) != GDK_MEMORY_U8)
|
||||||
return job->target_format;
|
return job->target_format;
|
||||||
|
|
||||||
return GL_RGBA8;
|
return GL_RGBA8;
|
||||||
@@ -254,6 +254,8 @@ node_supports_2d_transform (const GskRenderNode *node)
|
|||||||
case GSK_BLEND_NODE:
|
case GSK_BLEND_NODE:
|
||||||
case GSK_BLUR_NODE:
|
case GSK_BLUR_NODE:
|
||||||
case GSK_MASK_NODE:
|
case GSK_MASK_NODE:
|
||||||
|
case GSK_FILL_NODE:
|
||||||
|
case GSK_STROKE_NODE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case GSK_SHADOW_NODE:
|
case GSK_SHADOW_NODE:
|
||||||
@@ -308,6 +310,8 @@ node_supports_transform (const GskRenderNode *node)
|
|||||||
case GSK_BLEND_NODE:
|
case GSK_BLEND_NODE:
|
||||||
case GSK_BLUR_NODE:
|
case GSK_BLUR_NODE:
|
||||||
case GSK_MASK_NODE:
|
case GSK_MASK_NODE:
|
||||||
|
case GSK_FILL_NODE:
|
||||||
|
case GSK_STROKE_NODE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case GSK_SHADOW_NODE:
|
case GSK_SHADOW_NODE:
|
||||||
@@ -803,6 +807,8 @@ gsk_gl_render_job_untransform_bounds (GskGLRenderJob *job,
|
|||||||
|
|
||||||
out_rect->origin.x -= job->offset_x;
|
out_rect->origin.x -= job->offset_x;
|
||||||
out_rect->origin.y -= job->offset_y;
|
out_rect->origin.y -= job->offset_y;
|
||||||
|
|
||||||
|
gsk_transform_unref (transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -4111,6 +4117,14 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
|
|||||||
gsk_gl_render_job_visit_as_fallback (job, node);
|
gsk_gl_render_job_visit_as_fallback (job, node);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GSK_FILL_NODE:
|
||||||
|
gsk_gl_render_job_visit_as_fallback (job, node);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSK_STROKE_NODE:
|
||||||
|
gsk_gl_render_job_visit_as_fallback (job, node);
|
||||||
|
break;
|
||||||
|
|
||||||
case GSK_NOT_A_RENDER_NODE:
|
case GSK_NOT_A_RENDER_NODE:
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ gsk_gl_texture_library_dispose (GObject *object)
|
|||||||
|
|
||||||
g_clear_pointer (&self->atlases, g_ptr_array_unref);
|
g_clear_pointer (&self->atlases, g_ptr_array_unref);
|
||||||
g_clear_object (&self->driver);
|
g_clear_object (&self->driver);
|
||||||
|
g_clear_pointer (&self->hash_table, g_hash_table_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gsk_gl_texture_library_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gsk_gl_texture_library_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,15 @@
|
|||||||
#define __GSK_H_INSIDE__
|
#define __GSK_H_INSIDE__
|
||||||
|
|
||||||
#include <gsk/gskenums.h>
|
#include <gsk/gskenums.h>
|
||||||
|
#include <gsk/gskglshader.h>
|
||||||
|
#include <gsk/gskpath.h>
|
||||||
|
#include <gsk/gskpathbuilder.h>
|
||||||
|
#include <gsk/gskpathmeasure.h>
|
||||||
#include <gsk/gskrenderer.h>
|
#include <gsk/gskrenderer.h>
|
||||||
#include <gsk/gskrendernode.h>
|
#include <gsk/gskrendernode.h>
|
||||||
#include <gsk/gskroundedrect.h>
|
#include <gsk/gskroundedrect.h>
|
||||||
|
#include <gsk/gskstroke.h>
|
||||||
#include <gsk/gsktransform.h>
|
#include <gsk/gsktransform.h>
|
||||||
#include <gsk/gskglshader.h>
|
|
||||||
|
|
||||||
#include <gsk/gskcairorenderer.h>
|
#include <gsk/gskcairorenderer.h>
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -15,8 +15,7 @@ static const GdkDebugKey gsk_debug_keys[] = {
|
|||||||
{ "geometry", GSK_DEBUG_GEOMETRY, "Show borders (when using cairo)" },
|
{ "geometry", GSK_DEBUG_GEOMETRY, "Show borders (when using cairo)" },
|
||||||
{ "full-redraw", GSK_DEBUG_FULL_REDRAW, "Force full redraws" },
|
{ "full-redraw", GSK_DEBUG_FULL_REDRAW, "Force full redraws" },
|
||||||
{ "sync", GSK_DEBUG_SYNC, "Sync after each frame" },
|
{ "sync", GSK_DEBUG_SYNC, "Sync after each frame" },
|
||||||
{ "vulkan-staging-image", GSK_DEBUG_VULKAN_STAGING_IMAGE, "Use a staging image for Vulkan texture upload" },
|
{ "staging", GSK_DEBUG_STAGING, "Use a staging image for texture upload (Vulkan only)" },
|
||||||
{ "vulkan-staging-buffer", GSK_DEBUG_VULKAN_STAGING_BUFFER, "Use a staging buffer for Vulkan texture upload" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint gsk_debug_flags;
|
static guint gsk_debug_flags;
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ typedef enum {
|
|||||||
GSK_DEBUG_GEOMETRY = 1 << 9,
|
GSK_DEBUG_GEOMETRY = 1 << 9,
|
||||||
GSK_DEBUG_FULL_REDRAW = 1 << 10,
|
GSK_DEBUG_FULL_REDRAW = 1 << 10,
|
||||||
GSK_DEBUG_SYNC = 1 << 11,
|
GSK_DEBUG_SYNC = 1 << 11,
|
||||||
GSK_DEBUG_VULKAN_STAGING_IMAGE = 1 << 12,
|
GSK_DEBUG_STAGING = 1 << 12
|
||||||
GSK_DEBUG_VULKAN_STAGING_BUFFER = 1 << 13
|
|
||||||
} GskDebugFlags;
|
} GskDebugFlags;
|
||||||
|
|
||||||
#define GSK_DEBUG_ANY ((1 << 13) - 1)
|
#define GSK_DEBUG_ANY ((1 << 13) - 1)
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
* @GSK_REPEAT_NODE: A node that repeats the child's contents
|
* @GSK_REPEAT_NODE: A node that repeats the child's contents
|
||||||
* @GSK_CLIP_NODE: A node that clips its child to a rectangular area
|
* @GSK_CLIP_NODE: A node that clips its child to a rectangular area
|
||||||
* @GSK_ROUNDED_CLIP_NODE: A node that clips its child to a rounded rectangle
|
* @GSK_ROUNDED_CLIP_NODE: A node that clips its child to a rounded rectangle
|
||||||
|
* @GSK_FILL_NODE: A node that fills a path
|
||||||
|
* @GSK_STROKE_NODE: A node that strokes a path
|
||||||
* @GSK_SHADOW_NODE: A node that draws a shadow below its child
|
* @GSK_SHADOW_NODE: A node that draws a shadow below its child
|
||||||
* @GSK_BLEND_NODE: A node that blends two children together
|
* @GSK_BLEND_NODE: A node that blends two children together
|
||||||
* @GSK_CROSS_FADE_NODE: A node that cross-fades between two children
|
* @GSK_CROSS_FADE_NODE: A node that cross-fades between two children
|
||||||
@@ -74,6 +76,8 @@ typedef enum {
|
|||||||
GSK_REPEAT_NODE,
|
GSK_REPEAT_NODE,
|
||||||
GSK_CLIP_NODE,
|
GSK_CLIP_NODE,
|
||||||
GSK_ROUNDED_CLIP_NODE,
|
GSK_ROUNDED_CLIP_NODE,
|
||||||
|
GSK_FILL_NODE,
|
||||||
|
GSK_STROKE_NODE,
|
||||||
GSK_SHADOW_NODE,
|
GSK_SHADOW_NODE,
|
||||||
GSK_BLEND_NODE,
|
GSK_BLEND_NODE,
|
||||||
GSK_CROSS_FADE_NODE,
|
GSK_CROSS_FADE_NODE,
|
||||||
@@ -170,6 +174,101 @@ typedef enum {
|
|||||||
GSK_CORNER_BOTTOM_LEFT
|
GSK_CORNER_BOTTOM_LEFT
|
||||||
} GskCorner;
|
} GskCorner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskFillRule:
|
||||||
|
* @GSK_FILL_RULE_WINDING: If the path crosses the ray from
|
||||||
|
* left-to-right, counts +1. If the path crosses the ray
|
||||||
|
* from right to left, counts -1. (Left and right are determined
|
||||||
|
* from the perspective of looking along the ray from the starting
|
||||||
|
* point.) If the total count is non-zero, the point will be filled.
|
||||||
|
* @GSK_FILL_RULE_EVEN_ODD: Counts the total number of
|
||||||
|
* intersections, without regard to the orientation of the contour. If
|
||||||
|
* the total number of intersections is odd, the point will be
|
||||||
|
* filled.
|
||||||
|
*
|
||||||
|
* #GskFillRule is used to select how paths are filled, for example in
|
||||||
|
* gsk_fill_node_new(). Whether or not a point is included in the fill is
|
||||||
|
* determined by taking a ray from that point to infinity and looking
|
||||||
|
* at intersections with the path. The ray can be in any direction,
|
||||||
|
* as long as it doesn't pass through the end point of a segment
|
||||||
|
* or have a tricky intersection such as intersecting tangent to the path.
|
||||||
|
* (Note that filling is not actually implemented in this way. This
|
||||||
|
* is just a description of the rule that is applied.)
|
||||||
|
*
|
||||||
|
* New entries may be added in future versions.
|
||||||
|
**/
|
||||||
|
typedef enum {
|
||||||
|
GSK_FILL_RULE_WINDING,
|
||||||
|
GSK_FILL_RULE_EVEN_ODD
|
||||||
|
} GskFillRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskLineCap:
|
||||||
|
* @GSK_LINE_CAP_BUTT: Start and stop the line exactly at the start
|
||||||
|
* and end point
|
||||||
|
* @GSK_LINE_CAP_ROUND: Use a round ending, the center of the circle
|
||||||
|
* is the start or end point.
|
||||||
|
* @GSK_LINE_CAP_SQUARE: use squared ending, the center of the square
|
||||||
|
* is the start or end point.
|
||||||
|
*
|
||||||
|
* Specifies how to render the start and end points of contours or
|
||||||
|
* dashes when stroking.
|
||||||
|
*
|
||||||
|
* The default line cap style is %GSK_LINE_CAP_BUTT.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
GSK_LINE_CAP_BUTT,
|
||||||
|
GSK_LINE_CAP_ROUND,
|
||||||
|
GSK_LINE_CAP_SQUARE
|
||||||
|
} GskLineCap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskLineJoin:
|
||||||
|
* @GSK_LINE_JOIN_MITER: Use a sharp, angled corner
|
||||||
|
* @GSK_LINE_JOIN_MITER_CLIP: Use a sharp, angled corner, at a distance
|
||||||
|
* @GSK_LINE_JOIN_ROUND: Use a round join, the center of the circle is
|
||||||
|
* the joint point
|
||||||
|
* @GSK_LINE_JOIN_BEVEL: Use a cut-off join, the join is cut off at half
|
||||||
|
* the line width from the joint point
|
||||||
|
*
|
||||||
|
* Specifies how to render the junction of two lines when stroking.
|
||||||
|
*
|
||||||
|
* See gsk_stroke_set_miter_limit() for details on the difference between
|
||||||
|
* @GSK_LINE_JOIN_MITER and @GSK_LINE_JOIN_MITER_CLIP.
|
||||||
|
*
|
||||||
|
* The default line join style is %GSK_LINE_JOIN_MITER.
|
||||||
|
**/
|
||||||
|
typedef enum {
|
||||||
|
GSK_LINE_JOIN_MITER,
|
||||||
|
GSK_LINE_JOIN_MITER_CLIP,
|
||||||
|
GSK_LINE_JOIN_ROUND,
|
||||||
|
GSK_LINE_JOIN_BEVEL
|
||||||
|
} GskLineJoin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GskPathOperation:
|
||||||
|
* @GSK_PATH_MOVE: A move-to operation, with 1 point describing the
|
||||||
|
* target point.
|
||||||
|
* @GSK_PATH_LINE: A line-to operation, with 2 points describing the
|
||||||
|
* start and end point of a straight line.
|
||||||
|
* @GSK_PATH_CLOSE: A close operation ending the current contour with
|
||||||
|
* a line back to the starting point. Two points describe the start
|
||||||
|
* and end of the line.
|
||||||
|
* @GSK_PATH_CURVE: A curve-to operation describing a cubic Bézier curve
|
||||||
|
* with 4 points describing the start point, the two control points
|
||||||
|
* and the end point of the curve.
|
||||||
|
*
|
||||||
|
* Path operations can be used to approximate a #GskPath.
|
||||||
|
*
|
||||||
|
* More values may be added in the future.
|
||||||
|
**/
|
||||||
|
typedef enum {
|
||||||
|
GSK_PATH_MOVE,
|
||||||
|
GSK_PATH_CLOSE,
|
||||||
|
GSK_PATH_LINE,
|
||||||
|
GSK_PATH_CURVE,
|
||||||
|
} GskPathOperation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GskSerializationError:
|
* GskSerializationError:
|
||||||
* @GSK_SERIALIZATION_UNSUPPORTED_FORMAT: The format can not be identified
|
* @GSK_SERIALIZATION_UNSUPPORTED_FORMAT: The format can not be identified
|
||||||
|
|||||||
+2819
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user