Compare commits
571 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1050ca63a6 | |||
| 1080822ffa | |||
| 3fef45683c | |||
| cfcc5c5c0b | |||
| 856f1808de | |||
| 4341344545 | |||
| 20392e8840 | |||
| 426fefff81 | |||
| 13013053f7 | |||
| 62b9a4af75 | |||
| 76caf2c812 | |||
| 3d5fce1b9f | |||
| bfe8adbee4 | |||
| 827642303c | |||
| 6b6a0e1257 | |||
| 7a98176a02 | |||
| a93a986ef2 | |||
| 39dbc5ea87 | |||
| cf4d13bee3 | |||
| 0bacde8e0a | |||
| 949cd45bb7 | |||
| 2e9e216641 | |||
| 1ab8ffaceb | |||
| 3cc1726856 | |||
| 30eaa2c3cc | |||
| ba5993195a | |||
| bf42351ebf | |||
| ee277f4d92 | |||
| 00acc7957f | |||
| a931335f24 | |||
| 1ef320a9ec | |||
| 411b7f12b5 | |||
| 611fcfb1c7 | |||
| 6257a51f4f | |||
| e24630bd18 | |||
| 6b0b3a4db7 | |||
| fd19c7c2ab | |||
| 4aa2206699 | |||
| eae23ebf69 | |||
| ecd27f6c3c | |||
| 01f3c72338 | |||
| 87be414c05 | |||
| f6d676cc8a | |||
| 4961241f26 | |||
| 60c944bb94 | |||
| 740c10282f | |||
| 3a4c69f370 | |||
| c3083572fb | |||
| 8ecb00be66 | |||
| 48e707aceb | |||
| e2f9ff2304 | |||
| fa3a72c8f6 | |||
| fc45d90834 | |||
| fcd95cd5c6 | |||
| b8c1ac41d2 | |||
| 90e1ce0906 | |||
| d121fd5b7d | |||
| 4d88fcc1db | |||
| 85fcda178e | |||
| ecc678454b | |||
| 5a85bc691e | |||
| d506a5eea8 | |||
| aefa79413b | |||
| 73e4eb7552 | |||
| dff340530a | |||
| f6ea3e1684 | |||
| f790441505 | |||
| 0c307f7563 | |||
| f89dc9644c | |||
| 735455b523 | |||
| d037cfaf44 | |||
| 293d63425a | |||
| 38f9bb87bc | |||
| 64abadb370 | |||
| 6f85827fcb | |||
| b0e321cfb8 | |||
| 46d0569365 | |||
| 2eea911a0f | |||
| ee4a817121 | |||
| 3d1f914271 | |||
| 7bb0639a75 | |||
| f8f38aab63 | |||
| 75c2bd53aa | |||
| 83921750ae | |||
| 413512eba7 | |||
| e824764dc3 | |||
| 61b12abdab | |||
| 07bd5c7b05 | |||
| 1dc20eda28 | |||
| 5a9299f626 | |||
| 9c86c67f06 | |||
| e6ca7668be | |||
| 0b540b9ad1 | |||
| 514cdf7398 | |||
| 2ab52d73ab | |||
| b3ae172c1e | |||
| a6d1df66ec | |||
| ba92ce342e | |||
| 9f4c715516 | |||
| 5aa47b6e45 | |||
| 3b40d95581 | |||
| 3ad2d91e1c | |||
| d4c586e882 | |||
| 612c547ed3 | |||
| 1a777ce7f3 | |||
| 7ec4f6e297 | |||
| afaa0f3afd | |||
| 8841a002ed | |||
| 6da606aaad | |||
| 51bd155670 | |||
| 8fa16ec1cc | |||
| 04e5a0006d | |||
| a1d2169992 | |||
| 778976f8da | |||
| f81dea58a2 | |||
| e82606a538 | |||
| fe5b28f5b8 | |||
| 82fd0d7eef | |||
| 16761fcb49 | |||
| 4fac5680fb | |||
| 4ec4280e51 | |||
| 15bb77472d | |||
| 5c92d5e081 | |||
| 1626c5f1e7 | |||
| 3b5f0ed05e | |||
| d2298f1c8f | |||
| 085062ab89 | |||
| 9741082467 | |||
| 3db4a05493 | |||
| e3b9df2cec | |||
| 4a4e445a35 | |||
| db0f9b60ac | |||
| d51de390ba | |||
| c14e167a11 | |||
| 2837a85461 | |||
| 282510e113 | |||
| accabe3eee | |||
| 9dbdbaca43 | |||
| 5935bc95b7 | |||
| 4c677e4dcd | |||
| d4c25c9ec0 | |||
| b69df2bc4d | |||
| 7f9363d471 | |||
| 01d86eab66 | |||
| 09e85aa809 | |||
| d49816d2e6 | |||
| 59a00d6768 | |||
| 6bd6c6acba | |||
| be2ff60787 | |||
| 070b9a87b6 | |||
| ecbe6a421e | |||
| 317e68a58c | |||
| 9b42377347 | |||
| 7372a845fb | |||
| cf8c3be030 | |||
| 4eb715cf81 | |||
| d4899fdf1f | |||
| 4142c4d79e | |||
| ca442f8641 | |||
| 3c1491423a | |||
| eb4993d3fb | |||
| aa057da1ca | |||
| 1de09d59fb | |||
| 130a6fe0cf | |||
| e1f7c027d7 | |||
| 396ef5ebe5 | |||
| 840a20db3b | |||
| 8c6f7d1ae9 | |||
| c69fa6221b | |||
| 3c92c81705 | |||
| 297de981c4 | |||
| 53beb054b6 | |||
| 0431492284 | |||
| aed9cc1874 | |||
| c15804d124 | |||
| 1bd208d937 | |||
| b70bcd6bfe | |||
| 74a1d45238 | |||
| 3ada35460d | |||
| 1f133c3d64 | |||
| 4440ce874e | |||
| db302df82a | |||
| b550b58e8f | |||
| ed889b951b | |||
| b603479fe2 | |||
| 7c39b2cea3 | |||
| b1bce7a62b | |||
| fa73e17fba | |||
| dee2150a04 | |||
| f647fc3fe2 | |||
| 6bae80c331 | |||
| 2aeb80f490 | |||
| 8a2f434443 | |||
| d4134430fc | |||
| 73f64971c8 | |||
| ecc2c953e5 | |||
| e353117937 | |||
| 492ae6df35 | |||
| a19d0471e9 | |||
| 5b5ba36999 | |||
| 89b64cbf47 | |||
| e65d1f2122 | |||
| 2756496d47 | |||
| 8b653f21cc | |||
| 4e6759a126 | |||
| d20e0b0370 | |||
| ed8255993f | |||
| f5d69fa0c5 | |||
| e1431f31c1 | |||
| f191fc0047 | |||
| b60c60f03b | |||
| af0c277bba | |||
| 88203fbf4d | |||
| 970c9eef63 | |||
| 2439876bd3 | |||
| 97582ae9ad | |||
| a5b85f0dc5 | |||
| aefb16510b | |||
| 4360d433b5 | |||
| 5927319589 | |||
| 25db645f65 | |||
| b3c6a98132 | |||
| 031109aec3 | |||
| 18d2f9c8a4 | |||
| 0ae721f144 | |||
| 7898d1b46d | |||
| 3648398f6d | |||
| 019916c5b9 | |||
| ebb31590ae | |||
| 32ea1cf32d | |||
| 172cdf8e21 | |||
| dc07bcf3a3 | |||
| bd96c10563 | |||
| 76299396cf | |||
| a96dd2ad0a | |||
| 1e210e83bb | |||
| 14f1a91bff | |||
| 3f2bcdf82e | |||
| c61d8bc188 | |||
| 4e5976427b | |||
| 7fcdb0205f | |||
| 4814c5f653 | |||
| eb24e3548f | |||
| 87f0f374a9 | |||
| 0cd95951e6 | |||
| c45815c217 | |||
| b914869715 | |||
| ff5699e097 | |||
| 8846f85874 | |||
| fc1c6cfb1a | |||
| 77028362ab | |||
| 496aee5b02 | |||
| b2fb624496 | |||
| f2ef5d85ea | |||
| 7eca32edf0 | |||
| 7775bcf2fb | |||
| ed35f6f8b8 | |||
| 307942e1f7 | |||
| 92b7231168 | |||
| 14d7eb97d2 | |||
| fed1c3d3fc | |||
| e1ac97a185 | |||
| 08a48dd97e | |||
| 50df3ebb46 | |||
| df77f22740 | |||
| 2437a551ec | |||
| 46ab71fc8a | |||
| f922ff8597 | |||
| 690c06109e | |||
| 94505987fe | |||
| c6d7b704cb | |||
| 349509c332 | |||
| 84fd420271 | |||
| 0c40defaf1 | |||
| cda1733fc7 | |||
| 0ee851c8c7 | |||
| d665274eb1 | |||
| ed3b73871f | |||
| e570eb4f86 | |||
| 81b6251073 | |||
| cfaf619620 | |||
| de5b6764bc | |||
| bc17dfa83d | |||
| 84a98f74c1 | |||
| 50facedc47 | |||
| 200cacc3ad | |||
| eed3cab29f | |||
| 76b0687467 | |||
| 5039dc40f8 | |||
| 7c3de4a2da | |||
| b486e9b760 | |||
| ce2fd8a0d0 | |||
| 99b1b26fdb | |||
| b7e4bbaf74 | |||
| f579b171a9 | |||
| f9929d15eb | |||
| c45a6ad52d | |||
| 7233e38aa8 | |||
| 73ba97acd9 | |||
| 7d2ad604d2 | |||
| 45e64b915c | |||
| ebaef9f18b | |||
| c73fe8ac4a | |||
| 8ed8f883d1 | |||
| 032a5afc20 | |||
| 0064500146 | |||
| 4582ddcad9 | |||
| 8bb2720494 | |||
| 3b8218a99e | |||
| 9a8fa8dd82 | |||
| d6892c85dc | |||
| d3c20c3269 | |||
| 9904259661 | |||
| a8fcde11de | |||
| d2d4cd64cd | |||
| 2c7e68d98f | |||
| 6f42f8ef2c | |||
| 152dd70cde | |||
| 8ec1045c87 | |||
| 46866b8a66 | |||
| 9df6f802f2 | |||
| ad8613876c | |||
| 1bbca0cd25 | |||
| 83784c17a3 | |||
| 3f46d0f2fa | |||
| ef1ff8313f | |||
| 119a07e055 | |||
| abfd94d2d9 | |||
| 6022fbcdf8 | |||
| 744016e768 | |||
| d39f50a4ee | |||
| c23d3c4406 | |||
| 1e2eae4ddf | |||
| 77eb3df7c0 | |||
| e540022869 | |||
| e6700405c9 | |||
| 5bbd8e12fa | |||
| 8b59771cd1 | |||
| 8a0a08e4ce | |||
| bef6352401 | |||
| 60a43ddce0 | |||
| 90c9e88ee9 | |||
| d860bf95ab | |||
| a3bd0a3e17 | |||
| d274c7df06 | |||
| 9a5f482e1a | |||
| 2f6140c066 | |||
| 9ce4471527 | |||
| cda4ec48b2 | |||
| d9582c123e | |||
| 4d30aacb0c | |||
| 4862c3f779 | |||
| 08d1353cde | |||
| 585dadf575 | |||
| d069eb173a | |||
| 6015560b63 | |||
| 5a776389d7 | |||
| 6c2dfed5a5 | |||
| 7dec24c2cc | |||
| c20e7a0c5d | |||
| 719021e1f4 | |||
| 4856e115a9 | |||
| bfb5bbe862 | |||
| b98c86fb7b | |||
| e01c3f581e | |||
| c45199e388 | |||
| 27fb9917d8 | |||
| b5d6613a3f | |||
| 5dc77edbe3 | |||
| a3d63b3579 | |||
| 57c12a8661 | |||
| f1ccb9b81a | |||
| 2711cb8dcd | |||
| c79925bd4a | |||
| 05d5860dc0 | |||
| a1fdf06d80 | |||
| 36d7ca058e | |||
| 2e08db91ca | |||
| 2c9b47ff3c | |||
| 62ad1a61dc | |||
| 3fc9de7539 | |||
| 1c9a55d185 | |||
| 492940205e | |||
| 985e4906c8 | |||
| e9dcf8167c | |||
| 3aa6c27c26 | |||
| f537a55b71 | |||
| 7075e6be89 | |||
| 54a86a2a7e | |||
| 016354b6dd | |||
| 1dfc6d65df | |||
| b7d0295481 | |||
| a2854af325 | |||
| 320496b039 | |||
| b0450d4b1b | |||
| 91ff8bf336 | |||
| 7b145f72dc | |||
| 0dcc21b605 | |||
| bd43a9e868 | |||
| 9bf23d80a1 | |||
| 38fd66dc04 | |||
| f004f14b89 | |||
| 8f15f6959c | |||
| f26efd9adf | |||
| 3f342d75b2 | |||
| 3ab189404e | |||
| 48fc8d6606 | |||
| 2e0f411de9 | |||
| f08e36e225 | |||
| 9f358ac655 | |||
| 33d1349e53 | |||
| 6b2b6ceb74 | |||
| 76421847a5 | |||
| 840cd6e44c | |||
| f81038e99a | |||
| 007e7c68dc | |||
| e5e147ad53 | |||
| 58e00040e0 | |||
| 5d1b8399fb | |||
| deec2b6c6c | |||
| 246eb8ea25 | |||
| 815df9a76a | |||
| f896dddadc | |||
| d733e94a8b | |||
| 59db0ca328 | |||
| 3bd97590a1 | |||
| 722a0fa36d | |||
| b21708c5e4 | |||
| b5fb584316 | |||
| fd1e1b9b7c | |||
| c0caae0ff0 | |||
| 5c972e4786 | |||
| 1a3c5cf420 | |||
| eb7affd911 | |||
| a05dbff2c9 | |||
| 4b0d17b332 | |||
| 2d8f677e63 | |||
| b5c9b6aa25 | |||
| 86924c2f9a | |||
| af0f5e3f30 | |||
| 9e6c72210d | |||
| ce0b2d6953 | |||
| d1bb3f66ac | |||
| 70cd0e28ab | |||
| 2e00bcc580 | |||
| db68c1f2c6 | |||
| e3fa60a070 | |||
| c9c29d8bde | |||
| cd59d62947 | |||
| 4f4fe4ef44 | |||
| 06f83847c6 | |||
| 941b5c2aeb | |||
| d661b7f258 | |||
| f86d996d58 | |||
| fe3031fb99 | |||
| 4b001a24db | |||
| 4727fea631 | |||
| 7ff4cba624 | |||
| 0363cc83b9 | |||
| c1327e2c1b | |||
| 9971707544 | |||
| 02115912aa | |||
| e29571e6a6 | |||
| 582ad79088 | |||
| 3fac42fd3c | |||
| 8f0b38b462 | |||
| 6c5a106d7e | |||
| 5f7cab4632 | |||
| 558db5a3a7 | |||
| bc94b4f235 | |||
| 4c809281b2 | |||
| 81faf7caa3 | |||
| 7477e8626d | |||
| 47f30d208c | |||
| 74a1c0916a | |||
| 06351844bb | |||
| ee67edbe3a | |||
| ec9cdb74ef | |||
| ad0f9144ec | |||
| 3e8215a971 | |||
| 8df7487e2a | |||
| 633692b53e | |||
| e0a5c65003 | |||
| e4753791c0 | |||
| a57f7e3935 | |||
| 8de5a94eb7 | |||
| 88872d1986 | |||
| ab33b56ec9 | |||
| c37e88d561 | |||
| 2638700435 | |||
| 0a5a720fe1 | |||
| 0e5f7601e4 | |||
| e583e823b5 | |||
| a96358046f | |||
| 40f26ea09b | |||
| 71a7f0771b | |||
| 00739718ab | |||
| 19881c8c06 | |||
| 8b0aae8536 | |||
| fbe000734a | |||
| 0c67b367ac | |||
| f75b4aac1d | |||
| d563d158c0 | |||
| 5c892fa4ea | |||
| 4aac64edf0 | |||
| c97bbfdfb1 | |||
| a44598772d | |||
| 933a0e5a98 | |||
| e33e9c506d | |||
| 0108a5f56d | |||
| c995473407 | |||
| 3f9bdaa4c8 | |||
| a70998aa50 | |||
| 0fb1f44eec | |||
| 26cc96bb7f | |||
| 1c8b22cf05 | |||
| abbbd08931 | |||
| 587cf28dd3 | |||
| 53231a137c | |||
| 104a264d8b | |||
| 75fd582b97 | |||
| 89977412e9 | |||
| ce030b1b36 | |||
| 6c5dc8cd1f | |||
| fb4b38e5ea | |||
| fc405f8882 | |||
| afe61e28e0 | |||
| 4f3f3c9ae2 | |||
| e699685003 | |||
| 9583195e96 | |||
| a526f0770e | |||
| 707e492f0d | |||
| 680dba6524 | |||
| d1bb1d091c | |||
| 6510b876d1 | |||
| e376941e49 | |||
| 4889199b14 | |||
| 2e15225446 | |||
| 9dad71513c | |||
| ed072b4b5d | |||
| 7ffc4e0a21 | |||
| b9403f4f5b | |||
| 9f1aa3141b | |||
| 06e905f87d | |||
| 2ba8dcebff | |||
| 95a8def7c2 | |||
| 777799070d | |||
| 0f83a9550b | |||
| 17f2443350 | |||
| 6bfc995097 | |||
| 8068111c6e | |||
| 6e1c47b021 | |||
| aed4ced032 | |||
| 96160ea5dc | |||
| c76c07ddfe | |||
| 7b82dc7ac5 | |||
| a63e9d38fb | |||
| cc8db1805d | |||
| 948532f3c9 | |||
| 8f39f8d827 | |||
| 5e28c05121 | |||
| 32d15a5858 | |||
| c0b813940e | |||
| d90dc7f75e | |||
| 3c94e91e5e | |||
| 8a1bee1d79 | |||
| 9297439de4 | |||
| bcf78aeb39 | |||
| 02cdb36421 | |||
| b3d4d70bc1 | |||
| 715c0bfc0a |
+2
-2
@@ -445,9 +445,8 @@ reference:
|
|||||||
--force-fallback-for=gdk-pixbuf,pango
|
--force-fallback-for=gdk-pixbuf,pango
|
||||||
-Dintrospection=enabled
|
-Dintrospection=enabled
|
||||||
-Ddocumentation=true
|
-Ddocumentation=true
|
||||||
-Dgtk_doc=true
|
|
||||||
-Dgdk-pixbuf:gtk_doc=true
|
-Dgdk-pixbuf:gtk_doc=true
|
||||||
-Dpango:gtk_doc=true
|
-Dpango:documentation=true
|
||||||
-Dbuild-demos=false
|
-Dbuild-demos=false
|
||||||
-Dbuild-examples=false
|
-Dbuild-examples=false
|
||||||
-Dbuild-tests=false
|
-Dbuild-tests=false
|
||||||
@@ -460,6 +459,7 @@ reference:
|
|||||||
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
||||||
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
||||||
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
|
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
|
||||||
|
- mv _build/docs/reference/gtk/*.html _reference/gtk4/
|
||||||
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
|
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
|
||||||
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
|
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
|
||||||
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ flatpak build ${builddir} meson \
|
|||||||
-Dbuild-examples=false \
|
-Dbuild-examples=false \
|
||||||
-Dintrospection=disabled \
|
-Dintrospection=disabled \
|
||||||
-Dbuild-demos=true \
|
-Dbuild-demos=true \
|
||||||
-Ddemo-profile=devel \
|
-Dprofile=devel \
|
||||||
_flatpak_build
|
_flatpak_build
|
||||||
|
|
||||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||||
|
|||||||
+9
-14
@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
|
|||||||
|
|
||||||
You should not open a new issue for security related questions.
|
You should not open a new issue for security related questions.
|
||||||
|
|
||||||
When in doubt, follow [security](https://security.gnome.org/).
|
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
|
||||||
|
|
||||||
### Bug reports
|
### Bug reports
|
||||||
|
|
||||||
@@ -144,33 +144,28 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
|
|||||||
$ cd gtk
|
$ cd gtk
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: if you plan to push changes to back to the main repository and
|
|
||||||
have a GNOME account, you can skip the fork, and use the following instead:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
|
|
||||||
$ cd gtk
|
|
||||||
```
|
|
||||||
|
|
||||||
To compile the Git version of GTK on your system, you will need to
|
To compile the Git version of GTK on your system, you will need to
|
||||||
configure your build using Meson:
|
configure your build using Meson:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ meson _builddir .
|
$ meson setup _builddir .
|
||||||
$ cd _builddir
|
$ meson compile -C _builddir
|
||||||
$ ninja
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Typically, you should work on your own branch:
|
Typically, you should work on your own branch:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git checkout -b your-branch
|
$ git switch -C your-branch
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you've finished working on the bug fix or feature, push the branch
|
Once you've finished working on the bug fix or feature, push the branch
|
||||||
to the Git repository and open a new merge request, to let the GTK
|
to the Git repository and open a new merge request, to let the GTK
|
||||||
maintainers review your contribution.
|
maintainers review your contribution.
|
||||||
|
|
||||||
|
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
|
||||||
|
Patches cannot be reviewed, and do not not go through the CI pipeline. If
|
||||||
|
you wish to submit your changes to GTK, always use a merge request.
|
||||||
|
|
||||||
### Code reviews
|
### Code reviews
|
||||||
|
|
||||||
Each contribution is reviewed by the core developers of the GTK project.
|
Each contribution is reviewed by the core developers of the GTK project.
|
||||||
@@ -262,4 +257,4 @@ people committing to GTK to follow a few rules:
|
|||||||
|
|
||||||
If you have been contributing to GTK for a while and you don't have commit
|
If you have been contributing to GTK for a while and you don't have commit
|
||||||
access to the repository, you may ask to obtain it following the [GNOME account
|
access to the repository, you may ask to obtain it following the [GNOME account
|
||||||
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).
|
process](https://handbook.gnome.org/infrastructure/developer-access.html).
|
||||||
|
|||||||
@@ -1,6 +1,180 @@
|
|||||||
Overview of Changes in 4.15.0, xx-xx-xxxx
|
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
Overview of Changes in 4.15.1, 21-05-2024
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
* GtkGraphicsOffload:
|
||||||
|
- Don't crash without a child
|
||||||
|
|
||||||
|
* GtkSpinner:
|
||||||
|
- Don't animate when unmapped
|
||||||
|
|
||||||
|
* CSS:
|
||||||
|
- Support the :root selector
|
||||||
|
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
|
||||||
|
- Implement math functions (https://www.w3.org/TR/css-values-4/)
|
||||||
|
- Support modern syntax and calc in rgb() and hsl()
|
||||||
|
|
||||||
|
* Icontheme:
|
||||||
|
- Make symbolic svg loading more efficient
|
||||||
|
- Handle color-free symbolics more efficiently
|
||||||
|
|
||||||
|
* Accessibility:
|
||||||
|
- Make the gtk-demo sidebar search more accessible
|
||||||
|
- Stop emitting focus events
|
||||||
|
- Realize child contexts when necessary
|
||||||
|
|
||||||
|
* GDK:
|
||||||
|
- Support XDG_ACTIVATION_TOKEN
|
||||||
|
- dmabuf: Be more defensive when importing unknown formats to GL
|
||||||
|
- dmabuf: Use narrow range for YUV
|
||||||
|
- vulkan: Recreate swapchains when necessary or beneficial
|
||||||
|
|
||||||
|
* GSK:
|
||||||
|
- Improve logging for GDK_DEBUG=offload
|
||||||
|
- Improve logging for GSK_DEBUG=renderer
|
||||||
|
- gpu: Warn about inefficient texture import
|
||||||
|
- gpu: Handle tiny offscreens correctly
|
||||||
|
- vulkan: Add profiler marks in various places
|
||||||
|
- vulkan: Fix a problem with imported dmabufs showing up black
|
||||||
|
- cairo: Speed up mask nodes, since we use them for symbolic icons
|
||||||
|
|
||||||
|
* Wayland:
|
||||||
|
- Use wl_compositor version 6
|
||||||
|
|
||||||
|
* X11:
|
||||||
|
- Implement a missing method
|
||||||
|
|
||||||
|
* Build:
|
||||||
|
- Fix many ubsan warnings
|
||||||
|
|
||||||
|
* Debugging:
|
||||||
|
- Show more texture details in the recorder
|
||||||
|
- Use GTK_DEBUG=css to see CSS deprecations
|
||||||
|
|
||||||
|
* macOS:
|
||||||
|
- Fix problems with events handed back to the OS
|
||||||
|
- Respect GDK_DEBUG=default-settings
|
||||||
|
- Allow applictions to handle Dock > Quit
|
||||||
|
|
||||||
|
* Deprecations:
|
||||||
|
- Use of @name colors in CSS
|
||||||
|
|
||||||
|
* Translation updates:
|
||||||
|
Catalan
|
||||||
|
Georgian
|
||||||
|
Hungarian
|
||||||
|
Korean
|
||||||
|
Portuguese
|
||||||
|
Turkish
|
||||||
|
|
||||||
|
|
||||||
|
Overview of Changes in 4.15.0, 21-04-2024
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
This release changes the default GSK renderer to be Vulkan, on
|
||||||
|
Wayland. Other platforms still use ngl.
|
||||||
|
|
||||||
|
The intent of this change is to get wider testing and verify that
|
||||||
|
Vulkan drivers are good enough for us to rely on. If significant
|
||||||
|
problems show up, we will revert this change for 4.16.
|
||||||
|
|
||||||
|
You can still override the renderer choice using the GSK_RENDERER
|
||||||
|
environment variable.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
This release also changes font rendering settings by introducing
|
||||||
|
a new high-level gtk-font-rendering settings which gives GTK more
|
||||||
|
freedom to decide on font rendering.
|
||||||
|
|
||||||
|
You can still use the low-level font-related settings by changing
|
||||||
|
the new property to 'manual'.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
* GtkColumnView:
|
||||||
|
- Fix infinite loops in dispose
|
||||||
|
- Fix problems with weak ref cycles in GtkExpression
|
||||||
|
|
||||||
|
* GtkListView:
|
||||||
|
* GtkShortcutManager:
|
||||||
|
- Track the propagation phase of added controllers
|
||||||
|
|
||||||
|
* GtkGLArea:
|
||||||
|
- Produce dmabuf textures, so graphics offload is possible
|
||||||
|
|
||||||
|
* GtkTextView:
|
||||||
|
- Support text shadows
|
||||||
|
|
||||||
|
* GtkGraphicsOffload:
|
||||||
|
- Add a black-background property
|
||||||
|
|
||||||
|
* Settings:
|
||||||
|
- Add a new gtk-font-rendering setting
|
||||||
|
|
||||||
|
* Accessibility:
|
||||||
|
- Add support for GetRangeExtents to GtkAccessibleText
|
||||||
|
- Add support for GetOffsetAtPoint to GtkAccessibleText
|
||||||
|
- Implement GtkAccessibleRange for scrollbars
|
||||||
|
|
||||||
|
* GDK:
|
||||||
|
- Add a callback-based cursor API
|
||||||
|
|
||||||
|
* GSK:
|
||||||
|
- Use the Vulkan renderer by default
|
||||||
|
- Avoid an infinite recursion with offscreens in some cases
|
||||||
|
- Optimize graphics offload to make it more likely that compositors
|
||||||
|
can use direct scanout
|
||||||
|
|
||||||
|
* X11:
|
||||||
|
- Fix some confusing debug messages
|
||||||
|
- Drop a no-longer-relevant optimization that was interfering with
|
||||||
|
getting the current window manager capabilities
|
||||||
|
|
||||||
|
* macOS:
|
||||||
|
- Implement the color picker for macOS 10.15+
|
||||||
|
|
||||||
|
* Debugging:
|
||||||
|
- Snow monitor resolution in the inspector
|
||||||
|
|
||||||
|
* Demos:
|
||||||
|
- Use graphics offload in the shadertoy demo
|
||||||
|
- Show more reliable fps numbers in the fishbowl demo
|
||||||
|
|
||||||
|
* Tools:
|
||||||
|
- Support generating pdf in gtk4-rendernode-tool
|
||||||
|
|
||||||
|
* Build:
|
||||||
|
- Require pango 1.52
|
||||||
|
- Require cairo 1.18
|
||||||
|
- Add a missing dependency that was causing build failures
|
||||||
|
- Drop deprecated build options:
|
||||||
|
gtk_doc -> documentation
|
||||||
|
update_screenshots -> screenshots
|
||||||
|
demo-profile -> profile
|
||||||
|
demos -> build-demos
|
||||||
|
|
||||||
|
* Deprecations:
|
||||||
|
- gdk_widget_set/get_font_options
|
||||||
|
- gdk_wayland/x11_display_set_cursor_theme
|
||||||
|
|
||||||
|
* Translation updates:
|
||||||
|
Basque
|
||||||
|
Brazilian Portuguese
|
||||||
|
British English
|
||||||
|
Chinese (China)
|
||||||
|
Hebrew
|
||||||
|
Kabyle
|
||||||
|
Persian
|
||||||
|
Polish
|
||||||
|
Russian
|
||||||
|
Slovenian
|
||||||
|
Swedish
|
||||||
|
Turkish
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.14.2, 03-04-2024
|
Overview of Changes in 4.14.2, 03-04-2024
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Ddemo-profile=devel"
|
"-Dprofile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Ddemo-profile=devel"
|
"-Dprofile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Ddemo-profile=devel"
|
"-Dprofile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
"config-opts" : [
|
"config-opts" : [
|
||||||
"--libdir=/app/lib",
|
"--libdir=/app/lib",
|
||||||
"-Dbuildtype=debugoptimized",
|
"-Dbuildtype=debugoptimized",
|
||||||
"-Ddemo-profile=devel"
|
"-Dprofile=devel"
|
||||||
],
|
],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -363,7 +363,9 @@ insert_markup_idle (gpointer data)
|
|||||||
|
|
||||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||||
{
|
{
|
||||||
g_idle_add (insert_markup_idle, data);
|
guint id;
|
||||||
|
id = g_idle_add (insert_markup_idle, data);
|
||||||
|
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +400,9 @@ parse_markup_idle (gpointer data)
|
|||||||
do {
|
do {
|
||||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||||
{
|
{
|
||||||
g_idle_add (parse_markup_idle, data);
|
guint id;
|
||||||
|
id = g_idle_add (parse_markup_idle, data);
|
||||||
|
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
|||||||
{
|
{
|
||||||
wchar_t *langname_w = NULL;
|
wchar_t *langname_w = NULL;
|
||||||
wchar_t locale_abbrev_w[9];
|
wchar_t locale_abbrev_w[9];
|
||||||
gchar *langname, *locale_abbrev, *locale, *p;
|
gchar *langname, *locale_abbrev, *locale;
|
||||||
gint i;
|
gint i;
|
||||||
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
||||||
GHashTable *ht_scripts_langs = (GHashTable *) param;
|
GHashTable *ht_scripts_langs = (GHashTable *) param;
|
||||||
@@ -59,7 +59,6 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
|||||||
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
|
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
|
||||||
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
||||||
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
|
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
|
||||||
p = strchr (locale, '-');
|
|
||||||
lang = pango_language_from_string (locale);
|
lang = pango_language_from_string (locale);
|
||||||
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
||||||
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include "demos.h"
|
#include "demos.h"
|
||||||
#include "fontify.h"
|
#include "fontify.h"
|
||||||
@@ -923,6 +924,34 @@ clear_search (GtkSearchBar *bar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
search_results_update (GObject *filter_model,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
GtkEntry *entry)
|
||||||
|
{
|
||||||
|
gsize n_items = g_list_model_get_n_items (G_LIST_MODEL (filter_model));
|
||||||
|
|
||||||
|
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0)
|
||||||
|
{
|
||||||
|
char *text;
|
||||||
|
|
||||||
|
if (n_items > 0)
|
||||||
|
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", n_items), n_items);
|
||||||
|
else
|
||||||
|
text = g_strdup (_("No search results"));
|
||||||
|
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, text,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
g_free (text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_accessible_reset_property (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
activate (GApplication *app)
|
activate (GApplication *app)
|
||||||
{
|
{
|
||||||
@@ -970,6 +999,7 @@ activate (GApplication *app)
|
|||||||
|
|
||||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||||
|
g_signal_connect (filter_model, "notify::n-items", G_CALLBACK (search_results_update), search_entry);
|
||||||
|
|
||||||
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
||||||
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ stroke bounds of the path.
|
|||||||
| offset | `<point>` | 0 0 | non-default |
|
| offset | `<point>` | 0 0 | non-default |
|
||||||
| hint-style | `<hint style>` | slight | non-default |
|
| hint-style | `<hint style>` | slight | non-default |
|
||||||
| antialias | `<antialias>` | gray | non-default |
|
| antialias | `<antialias>` | gray | non-default |
|
||||||
|
| hint-metrics | `<hint metrics>` | off | non-default |
|
||||||
|
|
||||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||||
|
|
||||||
@@ -346,6 +347,7 @@ font, an error node will be returned.
|
|||||||
|
|
||||||
Possible values for hint-style are none, slight or full.
|
Possible values for hint-style are none, slight or full.
|
||||||
Possible value for antialias are none or gray.
|
Possible value for antialias are none or gray.
|
||||||
|
Possible value for hint-metrics are on or off.
|
||||||
|
|
||||||
### texture
|
### texture
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ Title: Cairo interaction
|
|||||||
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
||||||
graphics and image compositing that can be used with GTK.
|
graphics and image compositing that can be used with GTK.
|
||||||
|
|
||||||
GDK does not wrap the Cairo API; instead it allows to create Cairo
|
GDK does not wrap the Cairo API and it is not possible to use cairo directly
|
||||||
drawing contexts which can be used to draw on [class@Gdk.Surface]s.
|
to draw on a [class@Gdk.Surface]. You can either use a
|
||||||
|
[GtkDrawingArea](../gtk4/class.DrawingArea.html) widget or
|
||||||
|
[gtk_snapshot_append_cairo](../gtk4/func.Snapshot.append_cairo.html)
|
||||||
|
for drawing with cairo in a GTK4 application.
|
||||||
|
|
||||||
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
||||||
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ in a selector, widget names must be prefixed with a # character.
|
|||||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||||
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
||||||
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
||||||
|
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
|
||||||
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
||||||
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
||||||
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ spec.
|
|||||||
The following units are supported for basic datatypes:
|
The following units are supported for basic datatypes:
|
||||||
|
|
||||||
Length
|
Length
|
||||||
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
|
: px, pt, em, ex, rem, pc, in, cm, mm
|
||||||
|
|
||||||
Percentage
|
Percentage
|
||||||
: %, calc()
|
: %
|
||||||
|
|
||||||
Angle
|
Angle
|
||||||
: deg, grad, turn, calc()
|
: deg, rad, grad, turn
|
||||||
|
|
||||||
Time
|
Time
|
||||||
: s, ms, calc()
|
: s, ms
|
||||||
|
|
||||||
Length values with the em or ex units are resolved using the font
|
Length values with the em or ex units are resolved using the font
|
||||||
size value, unless they occur in setting the font-size itself, in
|
size value, unless they occur in setting the font-size itself, in
|
||||||
@@ -33,11 +33,15 @@ which case they are resolved using the inherited font size value.
|
|||||||
The rem unit is resolved using the initial font size value, which is
|
The rem unit is resolved using the initial font size value, which is
|
||||||
not quite the same as the CSS definition of rem.
|
not quite the same as the CSS definition of rem.
|
||||||
|
|
||||||
The calc() notation adds considerable expressive power. There are limits
|
Length values using physical units (pt, pc, in, cm, mm) are translated
|
||||||
on what types can be combined in such an expression (e.g. it does not make
|
to px using the dpi value specified by the -gtk-dpi property, which is
|
||||||
sense to add a number and a time). For the full details, see the
|
different from the CSS definition, which uses a fixed dpi of 96.
|
||||||
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
|
|
||||||
spec.
|
The calc() notation adds considerable expressive power to all of these
|
||||||
|
datatypes. There are limits on what types can be combined in such an
|
||||||
|
expression (e.g. it does not make sense to add a number and a time).
|
||||||
|
For the full details, see the
|
||||||
|
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
|
||||||
|
|
||||||
A common pattern among shorthand properties (called 'four sides') is one
|
A common pattern among shorthand properties (called 'four sides') is one
|
||||||
where one to four values can be specified, to determine a value for each
|
where one to four values can be specified, to determine a value for each
|
||||||
@@ -56,38 +60,79 @@ follows:
|
|||||||
1 value:
|
1 value:
|
||||||
: all
|
: all
|
||||||
|
|
||||||
|
## Custom Properties
|
||||||
|
|
||||||
|
GTK supports custom properties as defined in the
|
||||||
|
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1)
|
||||||
|
spec.
|
||||||
|
|
||||||
|
Custom properties are defined as follows:
|
||||||
|
|
||||||
|
```css
|
||||||
|
--prop: red;
|
||||||
|
```
|
||||||
|
|
||||||
|
and used via the `var` keyword:
|
||||||
|
|
||||||
|
```css
|
||||||
|
color: var(--prop);
|
||||||
|
```
|
||||||
|
|
||||||
|
Custom properties can have a fallback for when the referred property is invalid:
|
||||||
|
|
||||||
|
```css
|
||||||
|
color: var(--prop, green);
|
||||||
|
```
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
|
|
||||||
|
### CSS Colors
|
||||||
|
|
||||||
|
Colors can be expressed in numerous ways in CSS (see the
|
||||||
|
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
|
||||||
|
many (but not all) of these.
|
||||||
|
|
||||||
|
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
|
||||||
|
syntax, and calc() can be used as well in color expressions.
|
||||||
|
|
||||||
|
### Non-CSS Colors
|
||||||
|
|
||||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||||
|
|
||||||
|
These extensions are deprecated and should be replaced by the equivalent
|
||||||
|
standard CSS notions.
|
||||||
|
|
||||||
The first is a reference to a color defined via a @define-color rule in CSS.
|
The first is a reference to a color defined via a @define-color rule in CSS.
|
||||||
The syntax for @define-color rules is as follows:
|
The syntax for @define-color rules is as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
@define-color Name Color
|
@define-color name color
|
||||||
```
|
```
|
||||||
|
|
||||||
To refer to the color defined by a @define-color rule, prefix the name with @.
|
To refer to the color defined by a @define-color rule, prefix the name with @.
|
||||||
|
|
||||||
|
The standard CSS mechanisms that should be used instead of @define-color are
|
||||||
|
custom properties, :root and var().
|
||||||
|
|
||||||
GTK also supports color expressions, which allow colors to be transformed to
|
GTK also supports color expressions, which allow colors to be transformed to
|
||||||
new ones. Color expressions can be nested, providing a rich language to
|
new ones. Color expressions can be nested, providing a rich language to
|
||||||
define colors. Color expressions resemble functions, taking 1 or more colors
|
define colors. Color expressions resemble functions, taking 1 or more colors
|
||||||
and in some cases a number as arguments.
|
and in some cases a number as arguments.
|
||||||
|
|
||||||
`lighter(Color)`
|
`lighter(color)`
|
||||||
: produces a brighter variant of Color
|
: produces a brighter variant of `color`.
|
||||||
|
|
||||||
`darker(Color)`
|
`darker(color)`
|
||||||
: produces a darker variant of Color
|
: produces a darker variant of `color`.
|
||||||
|
|
||||||
`shade(Color, Number)`
|
`shade(color, number)`
|
||||||
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
|
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
|
||||||
|
|
||||||
`alpha(Color, Number)`
|
`alpha(color, number)`
|
||||||
: replaces the alpha value of color with number (between 0 and 1)
|
: multiplies the alpha value of `color` by `number` (between 0 and 1).
|
||||||
|
|
||||||
`mix(Color1, Color2, Number)`
|
`mix(color1, color2, number)`
|
||||||
: interpolates between the two colors
|
: interpolates between the two colors.
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
@@ -95,7 +140,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
|
|||||||
To load a themed icon, use
|
To load a themed icon, use
|
||||||
|
|
||||||
```
|
```
|
||||||
-gtk-icontheme(Name)
|
-gtk-icontheme(name)
|
||||||
```
|
```
|
||||||
|
|
||||||
The specified icon name is used to look up a themed icon, while taking into
|
The specified icon name is used to look up a themed icon, while taking into
|
||||||
@@ -124,14 +169,14 @@ and the
|
|||||||
syntax makes this available. -gtk-recolor requires a url as first argument.
|
syntax makes this available. -gtk-recolor requires a url as first argument.
|
||||||
The remaining arguments specify the color palette to use. If the palette is
|
The remaining arguments specify the color palette to use. If the palette is
|
||||||
not explicitly specified, the current value of the -gtk-icon-palette property
|
not explicitly specified, the current value of the -gtk-icon-palette property
|
||||||
is used.
|
is used.
|
||||||
|
|
||||||
GTK supports scaled rendering on hi-resolution displays. This works best if
|
GTK supports scaled rendering on hi-resolution displays. This works best if
|
||||||
images can specify normal and hi-resolution variants. From CSS, this can be
|
images can specify normal and hi-resolution variants. From CSS, this can be
|
||||||
done with
|
done with
|
||||||
|
|
||||||
```
|
```
|
||||||
-gtk-scaled(Image1, Image2)
|
-gtk-scaled(image1, image2)
|
||||||
```
|
```
|
||||||
|
|
||||||
## GTK CSS Properties
|
## GTK CSS Properties
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-broadwayd
|
|||||||
The Broadway display server
|
The Broadway display server
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-builder-tool
|
|||||||
GtkBuilder File Utility
|
GtkBuilder File Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ gtk4-demo-application
|
|||||||
Demonstrate GtkApplication
|
Demonstrate GtkApplication
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-demo
|
|||||||
Demonstrate GTK widgets
|
Demonstrate GTK widgets
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-encode-symbolic-svg
|
|||||||
Symbolic icon conversion utility
|
Symbolic icon conversion utility
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-icon-browser
|
|||||||
List themed icons
|
List themed icons
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-launch
|
|||||||
Launch an application
|
Launch an application
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-node-editor
|
|||||||
Editor render nodes
|
Editor render nodes
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-path-tool
|
|||||||
GskPath Utility
|
GskPath Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-query-settings
|
|||||||
Print name and value of GTK settings
|
Print name and value of GTK settings
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-rendernode-tool
|
|||||||
GskRenderNode Utility
|
GskRenderNode Utility
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||||
@@ -45,13 +49,14 @@ without any titlebar.
|
|||||||
Rendering
|
Rendering
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
|
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
|
||||||
The name of the file to write can be specified as a second FILE argument.
|
image or as pdf document. The name of the file to write can be specified as a second
|
||||||
|
FILE argument.
|
||||||
|
|
||||||
``--renderer=RENDERER``
|
``--renderer=RENDERER``
|
||||||
|
|
||||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||||
about poassible values for the ``RENDERER``.
|
about possible values for the ``RENDERER``.
|
||||||
|
|
||||||
Benchmark
|
Benchmark
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
@@ -93,4 +98,4 @@ exit code is 1. If the images are identical, it is 0.
|
|||||||
|
|
||||||
``--quiet``
|
``--quiet``
|
||||||
|
|
||||||
Don't write results to stdout.`
|
Don't write results to stdout.
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-update-icon-cache
|
|||||||
Icon theme caching utility
|
Icon theme caching utility
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ gtk4-widget-factory
|
|||||||
Showcase GTK widgets and styles
|
Showcase GTK widgets and styles
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
:Version: GTK
|
||||||
|
:Manual section: 1
|
||||||
|
:Manual group: GTK commands
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ content_files = [
|
|||||||
"wayland.md",
|
"wayland.md",
|
||||||
"windows.md",
|
"windows.md",
|
||||||
"x11.md",
|
"x11.md",
|
||||||
|
"tools.md",
|
||||||
"visual_index.md",
|
"visual_index.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ expand_content_md_files = [
|
|||||||
'section-tree-widget.md',
|
'section-tree-widget.md',
|
||||||
'section-list-widget.md',
|
'section-list-widget.md',
|
||||||
'question_index.md',
|
'question_index.md',
|
||||||
'visual_index.md'
|
'visual_index.md',
|
||||||
|
'tools.md',
|
||||||
]
|
]
|
||||||
|
|
||||||
gtk_images = []
|
gtk_images = []
|
||||||
@@ -60,39 +61,39 @@ if get_option('documentation')
|
|||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: docs_dir,
|
install_dir: docs_dir,
|
||||||
|
install_tag: 'doc',
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
rst2man = find_program('rst2man', 'rst2man.py', required: false)
|
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||||
if get_option('man-pages') and not rst2man.found()
|
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
|
||||||
error('No rst2man found, but man pages were explicitly enabled')
|
|
||||||
|
rst_files = [
|
||||||
|
[ 'gtk4-broadwayd', '1' ],
|
||||||
|
[ 'gtk4-builder-tool', '1' ],
|
||||||
|
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||||
|
[ 'gtk4-launch', '1', ],
|
||||||
|
[ 'gtk4-query-settings', '1', ],
|
||||||
|
[ 'gtk4-rendernode-tool', '1' ],
|
||||||
|
[ 'gtk4-update-icon-cache', '1', ],
|
||||||
|
[ 'gtk4-path-tool', '1', ],
|
||||||
|
]
|
||||||
|
|
||||||
|
if get_option('build-demos')
|
||||||
|
rst_files += [
|
||||||
|
[ 'gtk4-demo', '1', ],
|
||||||
|
[ 'gtk4-demo-application', '1', ],
|
||||||
|
[ 'gtk4-widget-factory', '1', ],
|
||||||
|
[ 'gtk4-icon-browser', '1', ],
|
||||||
|
[ 'gtk4-node-editor', '1', ],
|
||||||
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('man-pages') and rst2man.found()
|
rst2x_flags = [
|
||||||
rst_files = [
|
'--syntax-highlight=none',
|
||||||
[ 'gtk4-broadwayd', '1' ],
|
]
|
||||||
[ 'gtk4-builder-tool', '1' ],
|
|
||||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
|
||||||
[ 'gtk4-launch', '1', ],
|
|
||||||
[ 'gtk4-query-settings', '1', ],
|
|
||||||
[ 'gtk4-rendernode-tool', '1' ],
|
|
||||||
[ 'gtk4-update-icon-cache', '1', ],
|
|
||||||
[ 'gtk4-path-tool', '1', ],
|
|
||||||
]
|
|
||||||
|
|
||||||
if get_option('demos')
|
if get_option('man-pages')
|
||||||
rst_files += [
|
|
||||||
[ 'gtk4-demo', '1', ],
|
|
||||||
[ 'gtk4-demo-application', '1', ],
|
|
||||||
[ 'gtk4-widget-factory', '1', ],
|
|
||||||
[ 'gtk4-icon-browser', '1', ],
|
|
||||||
[ 'gtk4-node-editor', '1', ],
|
|
||||||
]
|
|
||||||
endif
|
|
||||||
|
|
||||||
rst2man_flags = [
|
|
||||||
'--syntax-highlight=none',
|
|
||||||
]
|
|
||||||
|
|
||||||
foreach rst: rst_files
|
foreach rst: rst_files
|
||||||
man_name = rst[0]
|
man_name = rst[0]
|
||||||
@@ -103,12 +104,34 @@ if get_option('man-pages') and rst2man.found()
|
|||||||
output: '@0@.@1@'.format(man_name, man_section),
|
output: '@0@.@1@'.format(man_name, man_section),
|
||||||
command: [
|
command: [
|
||||||
rst2man,
|
rst2man,
|
||||||
rst2man_flags,
|
rst2x_flags,
|
||||||
'@INPUT@',
|
'@INPUT@',
|
||||||
],
|
],
|
||||||
capture: true,
|
capture: true,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||||
|
install_tag: 'doc',
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('documentation')
|
||||||
|
|
||||||
|
foreach rst: rst_files
|
||||||
|
man_name = rst[0]
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
input: '@0@.rst'.format(man_name),
|
||||||
|
output: '@0@.html'.format(man_name),
|
||||||
|
command: [
|
||||||
|
rst2html5,
|
||||||
|
rst2x_flags,
|
||||||
|
'@INPUT@',
|
||||||
|
],
|
||||||
|
capture: true,
|
||||||
|
install: true,
|
||||||
|
install_dir: docs_dir / 'gtk4',
|
||||||
|
install_tag: 'doc',
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ GTK is divided into three parts:
|
|||||||
storage types for efficient use in GUI applications, and much more.
|
storage types for efficient use in GUI applications, and much more.
|
||||||
|
|
||||||
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
||||||
[glib]: https://developer.gnome.org/glib/stable/
|
[glib]: https://docs.gtk.org/glib/
|
||||||
[gobject]: https://developer.gnome.org/gobject/stable/
|
[gobject]: https://docs.gtk.org/gobject/
|
||||||
[gio]: https://developer.gnome.org/gio/stable/
|
[gio]: https://docs.gtk.org/gio/
|
||||||
[cairo]: https://www.cairographics.org/manual/
|
[cairo]: https://www.cairographics.org/manual/
|
||||||
[opengl]: https://www.opengl.org/about/
|
[opengl]: https://www.opengl.org/about/
|
||||||
[vulkan]: https://www.vulkan.org/
|
[vulkan]: https://www.vulkan.org/
|
||||||
[pango]: https://pango.gnome.org/
|
[pango]: https://docs.gtk.org/Pango/
|
||||||
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
||||||
[graphene]: https://ebassi.github.io/graphene/
|
[graphene]: https://ebassi.github.io/graphene/
|
||||||
|
|||||||
@@ -217,6 +217,10 @@ A number of options affect behavior instead of logging:
|
|||||||
`no-portals`
|
`no-portals`
|
||||||
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||||
|
|
||||||
|
`force-offload`
|
||||||
|
: Force graphics offload for all textures, even when slower. This allows
|
||||||
|
to debug offloading in the absence of dmabufs.
|
||||||
|
|
||||||
`gl-disable`
|
`gl-disable`
|
||||||
: Disable OpenGL support
|
: Disable OpenGL support
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
|
|||||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
|
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
|
||||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
||||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
||||||
|
| %GTK_ACCESSIBLE_PROPERTY_HELP_TEXT | N/A | translatable string |
|
||||||
|
|
||||||
#### List of accessible relations
|
#### List of accessible relations
|
||||||
|
|
||||||
@@ -216,6 +217,10 @@ are accessible as part of the development process. The GTK Inspector shows
|
|||||||
the accessible attributes of each widget, and also provides an overlay that
|
the accessible attributes of each widget, and also provides an overlay that
|
||||||
can highlight accessibility issues.
|
can highlight accessibility issues.
|
||||||
|
|
||||||
|
If you support some non-standard keyboard interactions for a widget, you
|
||||||
|
**should** set an appropriate `GTK_ACCESSIBLE_PROPERTY_HELP_TEXT` to help
|
||||||
|
discoverability of the behavior.
|
||||||
|
|
||||||
It is possible to set accessible attributes in UI files as well:
|
It is possible to set accessible attributes in UI files as well:
|
||||||
```xml
|
```xml
|
||||||
<object class="GtkButton" id="button1">
|
<object class="GtkButton" id="button1">
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Title: Tools and Demos
|
||||||
|
|
||||||
|
GTK ships with a number of tools and demos that come with their own
|
||||||
|
documentation in the form of man pages.
|
||||||
|
|
||||||
|
- [gtk4-broadwayd](gtk4-broadwayd.html)
|
||||||
|
- [gtk4-builder-tool](gtk4-builder-tool.html)
|
||||||
|
- [gtk4-demo](gtk4-demo.html)
|
||||||
|
- [gtk4-demo-application](gtk4-demo-application.html)
|
||||||
|
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
|
||||||
|
- [gtk4-icon-browser](gtk4-icon-browser.html)
|
||||||
|
- [gtk4-launch](gtk4-launch.html)
|
||||||
|
- [gtk4-node-editor](gtk4-node-editor.html)
|
||||||
|
- [gtk4-path-tool](gtk4-path-tool.html)
|
||||||
|
- [gtk4-query-settings](gtk4-query-settings.html)
|
||||||
|
- [gtk4-rendernode-tool](gtk4-rendernode-tool.html)
|
||||||
|
- [gtk4-update-icon-cache](gtk4-update-icon-cache.html)
|
||||||
|
- [gtk4-widget-factory](gtk4-widget-factory.html)
|
||||||
+132
-17
@@ -91,6 +91,31 @@ const GDK_META_MASK = 1 << 28;
|
|||||||
|
|
||||||
var useDataUrls = window.location.search.includes("datauri");
|
var useDataUrls = window.location.search.includes("datauri");
|
||||||
|
|
||||||
|
/* check if we are on Android and using Chrome */
|
||||||
|
var isAndroidChrome = false;
|
||||||
|
{
|
||||||
|
var ua = navigator.userAgent.toLowerCase();
|
||||||
|
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
|
||||||
|
isAndroidChrome = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* check for the passive option for Event listener */
|
||||||
|
let passiveSupported = false;
|
||||||
|
try {
|
||||||
|
const options = {
|
||||||
|
get passive() { // This function will be called when the browser
|
||||||
|
// attempts to access the passive property.
|
||||||
|
passiveSupported = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("test", null, options);
|
||||||
|
window.removeEventListener("test", null, options);
|
||||||
|
} catch(err) {
|
||||||
|
passiveSupported = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
||||||
|
|
||||||
var b64_lookup = [];
|
var b64_lookup = [];
|
||||||
@@ -215,11 +240,32 @@ function logStackTrace(len) {
|
|||||||
log(callstack[i]);
|
log(callstack[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Helper functions for touch identifier to make it unique on Android */
|
||||||
|
var globalTouchIdentifier = Math.round(Date.now() / 1000);
|
||||||
|
function touchIdentifierStart(tId)
|
||||||
|
{
|
||||||
|
if (isAndroidChrome) {
|
||||||
|
if (tId == 0) {
|
||||||
|
return ++globalTouchIdentifier;
|
||||||
|
}
|
||||||
|
return globalTouchIdentifier + tId;
|
||||||
|
}
|
||||||
|
return tId;
|
||||||
|
}
|
||||||
|
function touchIdentifier(tId)
|
||||||
|
{
|
||||||
|
if (isAndroidChrome) {
|
||||||
|
return globalTouchIdentifier + tId;
|
||||||
|
}
|
||||||
|
return tId;
|
||||||
|
}
|
||||||
|
|
||||||
var grab = new Object();
|
var grab = new Object();
|
||||||
grab.surface = null;
|
grab.surface = null;
|
||||||
grab.ownerEvents = false;
|
grab.ownerEvents = false;
|
||||||
grab.implicit = false;
|
grab.implicit = false;
|
||||||
var keyDownList = [];
|
var keyDownList = [];
|
||||||
|
var inputList = [];
|
||||||
var lastSerial = 0;
|
var lastSerial = 0;
|
||||||
var lastX = 0;
|
var lastX = 0;
|
||||||
var lastY = 0;
|
var lastY = 0;
|
||||||
@@ -987,7 +1033,14 @@ function handleDisplayCommands(display_commands)
|
|||||||
break;
|
break;
|
||||||
case DISPLAY_OP_DELETE_SURFACE:
|
case DISPLAY_OP_DELETE_SURFACE:
|
||||||
var id = cmd[1];
|
var id = cmd[1];
|
||||||
delete surfaces[id];
|
if (id == surfaceWithMouse) {
|
||||||
|
surfaceWithMouse = 0;
|
||||||
|
}
|
||||||
|
if (id == realSurfaceWithMouse) {
|
||||||
|
realSurfaceWithMouse = 0;
|
||||||
|
firstTouchDownId = null;
|
||||||
|
}
|
||||||
|
delete surfaces[id];
|
||||||
break;
|
break;
|
||||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||||
var image = cmd[1];
|
var image = cmd[1];
|
||||||
@@ -1371,8 +1424,14 @@ function getEffectiveEventTarget (id) {
|
|||||||
function updateKeyboardStatus() {
|
function updateKeyboardStatus() {
|
||||||
if (fakeInput != null && showKeyboardChanged) {
|
if (fakeInput != null && showKeyboardChanged) {
|
||||||
showKeyboardChanged = false;
|
showKeyboardChanged = false;
|
||||||
if (showKeyboard)
|
if (showKeyboard) {
|
||||||
|
if (isAndroidChrome) {
|
||||||
|
fakeInput.blur();
|
||||||
|
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
|
||||||
|
// to bring real value here.
|
||||||
|
}
|
||||||
fakeInput.focus();
|
fakeInput.focus();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fakeInput.blur();
|
fakeInput.blur();
|
||||||
}
|
}
|
||||||
@@ -2924,6 +2983,19 @@ function pushKeyEvent(fev) {
|
|||||||
keyDownList.push(fev);
|
keyDownList.push(fev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyInputEvent(ev) {
|
||||||
|
var members = ['inputType', 'data'], i, obj = {};
|
||||||
|
for (i = 0; i < members.length; i++) {
|
||||||
|
if (typeof ev[members[i]] !== "undefined")
|
||||||
|
obj[members[i]] = ev[members[i]];
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushInputEvent(fev) {
|
||||||
|
inputList.push(fev);
|
||||||
|
}
|
||||||
|
|
||||||
function getKeyEvent(keyCode, pop) {
|
function getKeyEvent(keyCode, pop) {
|
||||||
var i, fev = null;
|
var i, fev = null;
|
||||||
for (i = keyDownList.length-1; i >= 0; i--) {
|
for (i = keyDownList.length-1; i >= 0; i--) {
|
||||||
@@ -3022,6 +3094,29 @@ function handleKeyUp(e) {
|
|||||||
keysym = fev.keysym;
|
keysym = fev.keysym;
|
||||||
else {
|
else {
|
||||||
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
||||||
|
if (isAndroidChrome && (ev.keyCode == 229)) {
|
||||||
|
var i, fev = null, len = inputList.length, str;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
fev = inputList[i];
|
||||||
|
switch(fev.inputType) {
|
||||||
|
case "deleteContentBackward":
|
||||||
|
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
|
||||||
|
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
|
||||||
|
break;
|
||||||
|
case "insertText":
|
||||||
|
if (fev.data !== undefined) {
|
||||||
|
for (let sym of fev.data) {
|
||||||
|
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
|
||||||
|
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputList.splice(0, len);
|
||||||
|
}
|
||||||
keysym = 0;
|
keysym = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3030,6 +3125,16 @@ function handleKeyUp(e) {
|
|||||||
return cancelEvent(ev);
|
return cancelEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleInput (e) {
|
||||||
|
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
|
||||||
|
|
||||||
|
fev = copyInputEvent(ev);
|
||||||
|
pushInputEvent(fev);
|
||||||
|
|
||||||
|
// Stop keypress events just in case
|
||||||
|
return cancelEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
function onKeyDown (ev) {
|
function onKeyDown (ev) {
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
return handleKeyDown(ev);
|
return handleKeyDown(ev);
|
||||||
@@ -3045,6 +3150,11 @@ function onKeyUp (ev) {
|
|||||||
return handleKeyUp(ev);
|
return handleKeyUp(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onInput (ev) {
|
||||||
|
updateForEvent(ev);
|
||||||
|
return handleInput(ev);
|
||||||
|
}
|
||||||
|
|
||||||
function cancelEvent(ev)
|
function cancelEvent(ev)
|
||||||
{
|
{
|
||||||
ev = ev ? ev : window.event;
|
ev = ev ? ev : window.event;
|
||||||
@@ -3076,13 +3186,14 @@ function onMouseWheel(ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTouchStart(ev) {
|
function onTouchStart(ev) {
|
||||||
event.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
|
var touchId = touchIdentifierStart(touch.identifier);
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
@@ -3090,7 +3201,7 @@ function onTouchStart(ev) {
|
|||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
|
|
||||||
if (firstTouchDownId == null) {
|
if (firstTouchDownId == null) {
|
||||||
firstTouchDownId = touch.identifier;
|
firstTouchDownId = touchId;
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
|
|
||||||
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
||||||
@@ -3105,52 +3216,54 @@ function onTouchStart(ev) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchMove(ev) {
|
function onTouchMove(ev) {
|
||||||
event.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
|
var touchId = touchIdentifier(touch.identifier);
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touch.identifier) {
|
if (firstTouchDownId == touchId) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchEnd(ev) {
|
function onTouchEnd(ev) {
|
||||||
event.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
updateKeyboardStatus();
|
updateKeyboardStatus();
|
||||||
updateForEvent(ev);
|
updateForEvent(ev);
|
||||||
|
|
||||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||||
var touch = ev.changedTouches.item(i);
|
var touch = ev.changedTouches.item(i);
|
||||||
|
var touchId = touchIdentifier(touch.identifier);
|
||||||
|
|
||||||
var origId = getSurfaceId(touch);
|
var origId = getSurfaceId(touch);
|
||||||
var id = getEffectiveEventTarget (origId);
|
var id = getEffectiveEventTarget (origId);
|
||||||
var pos = getPositionsFromEvent(touch, id);
|
var pos = getPositionsFromEvent(touch, id);
|
||||||
|
|
||||||
var isEmulated = 0;
|
var isEmulated = 0;
|
||||||
if (firstTouchDownId == touch.identifier) {
|
if (firstTouchDownId == touchId) {
|
||||||
isEmulated = 1;
|
isEmulated = 1;
|
||||||
firstTouchDownId = null;
|
firstTouchDownId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3167,11 +3280,11 @@ function setupDocument(document)
|
|||||||
document.onkeyup = onKeyUp;
|
document.onkeyup = onKeyUp;
|
||||||
|
|
||||||
if (document.addEventListener) {
|
if (document.addEventListener) {
|
||||||
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
document.addEventListener('mousewheel', onMouseWheel, false);
|
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
document.addEventListener('touchstart', onTouchStart, false);
|
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
document.addEventListener('touchmove', onTouchMove, false);
|
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
document.addEventListener('touchend', onTouchEnd, false);
|
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
} else if (document.attachEvent) {
|
} else if (document.attachEvent) {
|
||||||
element.attachEvent("onmousewheel", onMouseWheel);
|
element.attachEvent("onmousewheel", onMouseWheel);
|
||||||
}
|
}
|
||||||
@@ -3237,12 +3350,14 @@ function connect()
|
|||||||
};
|
};
|
||||||
|
|
||||||
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
||||||
if (iOS) {
|
if (iOS || isAndroidChrome) {
|
||||||
fakeInput = document.createElement("input");
|
fakeInput = document.createElement("input");
|
||||||
fakeInput.type = "text";
|
fakeInput.type = "text";
|
||||||
fakeInput.style.position = "absolute";
|
fakeInput.style.position = "absolute";
|
||||||
fakeInput.style.left = "-1000px";
|
fakeInput.style.left = "-1000px";
|
||||||
fakeInput.style.top = "-1000px";
|
fakeInput.style.top = "-1000px";
|
||||||
document.body.appendChild(fakeInput);
|
document.body.appendChild(fakeInput);
|
||||||
|
if (isAndroidChrome)
|
||||||
|
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,7 @@ broadwayjs_h = custom_target('broadwayjs.h',
|
|||||||
)
|
)
|
||||||
|
|
||||||
libgdk_broadway = static_library('gdk-broadway',
|
libgdk_broadway = static_library('gdk-broadway',
|
||||||
clienthtml_h, broadwayjs_h,
|
sources: [ clienthtml_h, broadwayjs_h, gdk_broadway_sources, gdk_gen_headers ],
|
||||||
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
|
||||||
include_directories: [confinc, gdkinc],
|
include_directories: [confinc, gdkinc],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DGTK_COMPILATION',
|
'-DGTK_COMPILATION',
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||||
|
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
||||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||||
@@ -142,31 +143,50 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
|||||||
|
|
||||||
#ifdef G_HAS_CONSTRUCTORS
|
#ifdef G_HAS_CONSTRUCTORS
|
||||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_desktop_startup_notification_id)
|
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_and_unset_environment)
|
||||||
#endif
|
#endif
|
||||||
G_DEFINE_CONSTRUCTOR(stash_desktop_startup_notification_id)
|
G_DEFINE_CONSTRUCTOR(stash_and_unset_environment)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *startup_notification_id = NULL;
|
static char *startup_notification_id = NULL;
|
||||||
|
static char *xdg_activation_token = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stash_desktop_startup_notification_id (void)
|
stash_and_unset_environment (void)
|
||||||
{
|
{
|
||||||
const char *desktop_startup_id;
|
/* Copies environment variables and unsets them so they won't be inherited by
|
||||||
|
|
||||||
desktop_startup_id = g_getenv ("DESKTOP_STARTUP_ID");
|
|
||||||
if (desktop_startup_id && *desktop_startup_id != '\0')
|
|
||||||
{
|
|
||||||
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
|
|
||||||
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
|
|
||||||
else
|
|
||||||
startup_notification_id = g_strdup (desktop_startup_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the environment variable so it won't be inherited by
|
|
||||||
* child processes and confuse things.
|
* child processes and confuse things.
|
||||||
|
*
|
||||||
|
* Changing environment variables can be racy so we try to do this as early as
|
||||||
|
* possible in the program flow and before any printing that might involve
|
||||||
|
* environment variables.
|
||||||
*/
|
*/
|
||||||
g_unsetenv ("DESKTOP_STARTUP_ID");
|
struct {
|
||||||
|
const char *key;
|
||||||
|
char **dst;
|
||||||
|
} vars[] = {
|
||||||
|
{ "DESKTOP_STARTUP_ID", &startup_notification_id },
|
||||||
|
{ "XDG_ACTIVATION_TOKEN", &xdg_activation_token },
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||||
|
*vars[i].dst = g_strdup (g_getenv (vars[i].key));
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||||
|
g_unsetenv (vars[i].key);
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||||
|
{
|
||||||
|
if (*vars[i].dst == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_utf8_validate (*vars[i].dst, -1, NULL))
|
||||||
|
{
|
||||||
|
g_warning ("%s contains invalid UTF-8", vars[i].key);
|
||||||
|
g_clear_pointer (vars[i].dst, g_free);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
@@ -291,7 +311,7 @@ gdk_pre_parse (void)
|
|||||||
gdk_gl_backend_use (GDK_GL_WGL);
|
gdk_gl_backend_use (GDK_GL_WGL);
|
||||||
|
|
||||||
#ifndef G_HAS_CONSTRUCTORS
|
#ifndef G_HAS_CONSTRUCTORS
|
||||||
stash_desktop_startup_notification_id ();
|
stash_and_unset_environment ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,15 +345,20 @@ gdk_display_open_default (void)
|
|||||||
/*< private >
|
/*< private >
|
||||||
* gdk_get_startup_notification_id:
|
* gdk_get_startup_notification_id:
|
||||||
*
|
*
|
||||||
* Returns the original value of the DESKTOP_STARTUP_ID environment
|
* Returns the original value of the XDG_ACTIVATION_TOKEN environment
|
||||||
* variable if it was defined and valid, or %NULL otherwise.
|
* variable if it was defined and valid, otherwise it returns the original
|
||||||
|
* value of the DESKTOP_STARTUP_ID environment variable if it was defined
|
||||||
|
* and valid, or %NULL if neither of them were defined and valid.
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer none): the original value of the
|
* Returns: (nullable) (transfer none): the original value of the
|
||||||
* DESKTOP_STARTUP_ID environment variable
|
* XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID environment variable
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
gdk_get_startup_notification_id (void)
|
gdk_get_startup_notification_id (void)
|
||||||
{
|
{
|
||||||
|
if (xdg_activation_token)
|
||||||
|
return xdg_activation_token;
|
||||||
|
|
||||||
return startup_notification_id;
|
return startup_notification_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-8
@@ -41,8 +41,10 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
||||||
|
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
|
||||||
#else
|
#else
|
||||||
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
||||||
|
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make this readable */
|
/* make this readable */
|
||||||
@@ -177,18 +179,23 @@ G_GNUC_UNUSED static inline void
|
|||||||
gdk_array(reserve) (GdkArray *self,
|
gdk_array(reserve) (GdkArray *self,
|
||||||
gsize n)
|
gsize n)
|
||||||
{
|
{
|
||||||
gsize new_size, size;
|
gsize new_capacity, size, capacity;
|
||||||
|
|
||||||
if (n <= gdk_array(get_capacity) (self))
|
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE))
|
||||||
return;
|
g_error ("requesting array size of %zu, but maximum size is %zu", n, GDK_ARRAY_MAX_SIZE);
|
||||||
|
|
||||||
|
capacity = gdk_array(get_capacity) (self);
|
||||||
|
if (n <= capacity)
|
||||||
|
return;
|
||||||
|
|
||||||
size = gdk_array(get_size) (self);
|
size = gdk_array(get_size) (self);
|
||||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
/* capacity * 2 can overflow, that's why we MAX() */
|
||||||
|
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
|
||||||
|
|
||||||
#ifdef GDK_ARRAY_PREALLOC
|
#ifdef GDK_ARRAY_PREALLOC
|
||||||
if (self->start == self->preallocated)
|
if (self->start == self->preallocated)
|
||||||
{
|
{
|
||||||
self->start = g_new (_T_, new_size);
|
self->start = g_new (_T_, new_capacity);
|
||||||
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -196,15 +203,15 @@ gdk_array(reserve) (GdkArray *self,
|
|||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
if (self->start == NULL)
|
if (self->start == NULL)
|
||||||
{
|
{
|
||||||
self->start = g_new (_T_, new_size);
|
self->start = g_new (_T_, new_capacity);
|
||||||
*self->start = *(_T_[1]) { 0 };
|
*self->start = *(_T_[1]) { 0 };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
self->start = g_renew (_T_, self->start, new_size);
|
self->start = g_renew (_T_, self->start, new_capacity);
|
||||||
|
|
||||||
self->end = self->start + size;
|
self->end = self->start + size;
|
||||||
self->end_allocation = self->start + new_size;
|
self->end_allocation = self->start + new_capacity;
|
||||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||||
self->end_allocation--;
|
self->end_allocation--;
|
||||||
#endif
|
#endif
|
||||||
@@ -312,6 +319,7 @@ gdk_array(get) (const GdkArray *self,
|
|||||||
#undef gdk_array_paste
|
#undef gdk_array_paste
|
||||||
#undef gdk_array
|
#undef gdk_array
|
||||||
#undef GDK_ARRAY_REAL_SIZE
|
#undef GDK_ARRAY_REAL_SIZE
|
||||||
|
#undef GDK_ARRAY_MAX_SIZE
|
||||||
|
|
||||||
#undef GDK_ARRAY_BY_VALUE
|
#undef GDK_ARRAY_BY_VALUE
|
||||||
#undef GDK_ARRAY_ELEMENT_TYPE
|
#undef GDK_ARRAY_ELEMENT_TYPE
|
||||||
|
|||||||
@@ -522,8 +522,6 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
|||||||
*
|
*
|
||||||
* If the clipboard is not local, this function does nothing but report success.
|
* If the clipboard is not local, this function does nothing but report success.
|
||||||
*
|
*
|
||||||
* The @callback must call [method@Gdk.Clipboard.store_finish].
|
|
||||||
*
|
|
||||||
* The purpose of this call is to preserve clipboard contents beyond the
|
* The purpose of this call is to preserve clipboard contents beyond the
|
||||||
* lifetime of an application, so this function is typically called on
|
* lifetime of an application, so this function is typically called on
|
||||||
* exit. Depending on the platform, the functionality may not be available
|
* exit. Depending on the platform, the functionality may not be available
|
||||||
@@ -638,9 +636,6 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
|||||||
* Asynchronously requests an input stream to read the @clipboard's
|
* Asynchronously requests an input stream to read the @clipboard's
|
||||||
* contents from.
|
* contents from.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_finish] to get the result of the operation.
|
|
||||||
*
|
|
||||||
* The clipboard will choose the most suitable mime type from the given list
|
* The clipboard will choose the most suitable mime type from the given list
|
||||||
* to fulfill the request, preferring the ones listed first.
|
* to fulfill the request, preferring the ones listed first.
|
||||||
*/
|
*/
|
||||||
@@ -834,9 +829,6 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
|||||||
* Asynchronously request the @clipboard contents converted to the given
|
* Asynchronously request the @clipboard contents converted to the given
|
||||||
* @type.
|
* @type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then call
|
|
||||||
* [method@Gdk.Clipboard.read_value_finish] to get the resulting `GValue`.
|
|
||||||
*
|
|
||||||
* For local clipboard contents that are available in the given `GType`,
|
* For local clipboard contents that are available in the given `GType`,
|
||||||
* the value will be copied directly. Otherwise, GDK will try to use
|
* the value will be copied directly. Otherwise, GDK will try to use
|
||||||
* [func@content_deserialize_async] to convert the clipboard's data.
|
* [func@content_deserialize_async] to convert the clipboard's data.
|
||||||
@@ -895,9 +887,6 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
|||||||
*
|
*
|
||||||
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
|
|
||||||
*
|
|
||||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||||
* need more control over the operation.
|
* need more control over the operation.
|
||||||
@@ -960,9 +949,6 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
|||||||
*
|
*
|
||||||
* Asynchronously request the @clipboard contents converted to a string.
|
* Asynchronously request the @clipboard contents converted to a string.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then
|
|
||||||
* call [method@Gdk.Clipboard.read_text_finish] to get the result.
|
|
||||||
*
|
|
||||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||||
* need more control over the operation.
|
* need more control over the operation.
|
||||||
|
|||||||
@@ -540,9 +540,6 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
|
|||||||
*
|
*
|
||||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||||
* indicate a higher priority.
|
* indicate a higher priority.
|
||||||
*
|
|
||||||
* When the operation is finished, @callback will be called. You must then
|
|
||||||
* call [func@Gdk.content_deserialize_finish] to get the result of the operation.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_content_deserialize_async (GInputStream *stream,
|
gdk_content_deserialize_async (GInputStream *stream,
|
||||||
|
|||||||
@@ -279,10 +279,6 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
|||||||
* Asynchronously writes the contents of @provider to @stream in the given
|
* Asynchronously writes the contents of @provider to @stream in the given
|
||||||
* @mime_type.
|
* @mime_type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must then call
|
|
||||||
* [method@Gdk.ContentProvider.write_mime_type_finish] to get the result
|
|
||||||
* of the operation.
|
|
||||||
*
|
|
||||||
* The given mime type does not need to be listed in the formats returned by
|
* The given mime type does not need to be listed in the formats returned by
|
||||||
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
||||||
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
||||||
|
|||||||
@@ -546,9 +546,6 @@ serialize_not_found (GdkContentSerializer *serializer)
|
|||||||
*
|
*
|
||||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||||
* indicate a higher priority.
|
* indicate a higher priority.
|
||||||
*
|
|
||||||
* When the operation is finished, @callback will be called. You must then
|
|
||||||
* call [func@Gdk.content_serialize_finish] to get the result of the operation.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_content_serialize_async (GOutputStream *stream,
|
gdk_content_serialize_async (GOutputStream *stream,
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_name (const char *name,
|
|||||||
GdkCursor *fallback);
|
GdkCursor *fallback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkCursorGetTestureCallback:
|
* GdkCursorGetTextureCallback:
|
||||||
* @cursor: the `GdkCursor`
|
* @cursor: the `GdkCursor`
|
||||||
* @cursor_size: the nominal cursor size, in application pixels
|
* @cursor_size: the nominal cursor size, in application pixels
|
||||||
* @scale: the device scale
|
* @scale: the device scale
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef enum {
|
|||||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||||
|
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
||||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||||
|
|||||||
+5
-5
@@ -144,8 +144,8 @@ struct _YUVCoefficients
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* multiplied by 65536 */
|
/* multiplied by 65536 */
|
||||||
//static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
||||||
static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
//static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
get_uv_values (const YUVCoefficients *coeffs,
|
get_uv_values (const YUVCoefficients *coeffs,
|
||||||
@@ -229,7 +229,7 @@ download_nv12 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_wide, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
get_uv_values (&itu601_narrow, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -309,7 +309,7 @@ download_yuv_3 (guchar *dst_data,
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
gsize xs, ys;
|
gsize xs, ys;
|
||||||
|
|
||||||
get_uv_values (&itu601_wide, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
get_uv_values (&itu601_narrow, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||||
|
|
||||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||||
@@ -365,7 +365,7 @@ download_yuyv (guchar *dst_data,
|
|||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
get_uv_values (&itu601_wide, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
get_uv_values (&itu601_narrow, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
||||||
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
||||||
if (x + 1 < width)
|
if (x + 1 < width)
|
||||||
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
||||||
|
|||||||
+8
-2
@@ -163,6 +163,8 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
previous = gdk_gl_context_get_current ();
|
previous = gdk_gl_context_get_current ();
|
||||||
|
if (previous)
|
||||||
|
g_object_ref (previous);
|
||||||
formats = gdk_dmabuf_formats_builder_new ();
|
formats = gdk_dmabuf_formats_builder_new ();
|
||||||
external = gdk_dmabuf_formats_builder_new ();
|
external = gdk_dmabuf_formats_builder_new ();
|
||||||
|
|
||||||
@@ -194,7 +196,10 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (previous)
|
if (previous)
|
||||||
gdk_gl_context_make_current (previous);
|
{
|
||||||
|
gdk_gl_context_make_current (previous);
|
||||||
|
g_object_unref (previous);
|
||||||
|
}
|
||||||
|
|
||||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||||
}
|
}
|
||||||
@@ -239,7 +244,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||||
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
attribs[i++] = EGL_YUV_NARROW_RANGE_EXT;
|
||||||
|
|
||||||
#define ADD_PLANE(plane) \
|
#define ADD_PLANE(plane) \
|
||||||
{ \
|
{ \
|
||||||
@@ -265,6 +270,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
|||||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||||
|
|
||||||
attribs[i++] = EGL_NONE;
|
attribs[i++] = EGL_NONE;
|
||||||
|
g_assert (i < G_N_ELEMENTS (attribs));
|
||||||
|
|
||||||
image = eglCreateImageKHR (egl_display,
|
image = eglCreateImageKHR (egl_display,
|
||||||
EGL_NO_CONTEXT,
|
EGL_NO_CONTEXT,
|
||||||
|
|||||||
+11
-1
@@ -62,6 +62,13 @@ struct _GdkDmabufTextureClass
|
|||||||
GdkTextureClass parent_class;
|
GdkTextureClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_dmabuf_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.DmabufTexture] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
||||||
@@ -72,7 +79,10 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
|||||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
||||||
|
|
||||||
if (self->destroy)
|
if (self->destroy)
|
||||||
self->destroy (self->data);
|
{
|
||||||
|
self->destroy (self->data);
|
||||||
|
self->destroy = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
g_clear_object (&self->downloader);
|
g_clear_object (&self->downloader);
|
||||||
g_clear_object (&self->display);
|
g_clear_object (&self->display);
|
||||||
|
|||||||
+2
-6
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
|||||||
|
|
||||||
g_object_get (priv->drag, "content", &content, NULL);
|
g_object_get (priv->drag, "content", &content, NULL);
|
||||||
content_formats = gdk_content_provider_ref_formats (content);
|
content_formats = gdk_content_provider_ref_formats (content);
|
||||||
g_object_unref (content);
|
g_object_unref (content);
|
||||||
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
||||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
|||||||
GdkContentFormats *formats;
|
GdkContentFormats *formats;
|
||||||
GValue *value;
|
GValue *value;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
|
|
||||||
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
||||||
|
|
||||||
task = g_task_new (self, cancellable, callback, user_data);
|
task = g_task_new (self, cancellable, callback, user_data);
|
||||||
@@ -849,10 +849,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
|||||||
* Asynchronously request the drag operation's contents converted
|
* Asynchronously request the drag operation's contents converted
|
||||||
* to the given @type.
|
* to the given @type.
|
||||||
*
|
*
|
||||||
* When the operation is finished @callback will be called. You must
|
|
||||||
* then call [method@Gdk.Drop.read_value_finish] to get the resulting
|
|
||||||
* `GValue`.
|
|
||||||
*
|
|
||||||
* For local drag-and-drop operations that are available in the given
|
* For local drag-and-drop operations that are available in the given
|
||||||
* `GType`, the value will be copied directly. Otherwise, GDK will
|
* `GType`, the value will be copied directly. Otherwise, GDK will
|
||||||
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
||||||
|
|||||||
@@ -1371,6 +1371,8 @@ gdk_event_get_modifier_state (GdkEvent *event)
|
|||||||
* Extract the event surface relative x/y coordinates from an event.
|
* Extract the event surface relative x/y coordinates from an event.
|
||||||
*
|
*
|
||||||
* This position is in [surface coordinates](coordinates.html).
|
* This position is in [surface coordinates](coordinates.html).
|
||||||
|
*
|
||||||
|
* Returns: whether the positions were set
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_event_get_position (GdkEvent *event,
|
gdk_event_get_position (GdkEvent *event,
|
||||||
|
|||||||
@@ -192,13 +192,6 @@ compute_smooth_frame_time (GdkFrameClock *clock,
|
|||||||
* and new_frame_time >= old_frame_time. */
|
* and new_frame_time >= old_frame_time. */
|
||||||
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
||||||
|
|
||||||
if (frames_passed > 1)
|
|
||||||
gdk_profiler_add_markf ((smoothed_frame_time_base - (frame_interval * (frames_passed-1))) * 1000L,
|
|
||||||
frame_interval * (frames_passed-1) * 1000L,
|
|
||||||
"Dropped Frames",
|
|
||||||
"%u frames may have been dropped",
|
|
||||||
frames_passed-1);
|
|
||||||
|
|
||||||
/* We use an approximately whole number of frames in the future from
|
/* We use an approximately whole number of frames in the future from
|
||||||
* last smoothed frame time. This way we avoid minor jitter in the
|
* last smoothed frame time. This way we avoid minor jitter in the
|
||||||
* frame times making the animation speed uneven, but still animate
|
* frame times making the animation speed uneven, but still animate
|
||||||
|
|||||||
+79
-35
@@ -152,6 +152,13 @@ enum {
|
|||||||
|
|
||||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_gl_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.GLContext] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
||||||
@@ -1956,8 +1963,6 @@ gdk_gl_context_get_glsl_version_string (GdkGLContext *self)
|
|||||||
return "#version 310 es";
|
return "#version 310 es";
|
||||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||||
return "#version 300 es";
|
return "#version 300 es";
|
||||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
|
||||||
return "#version 300 es";
|
|
||||||
else
|
else
|
||||||
return "#version 100";
|
return "#version 100";
|
||||||
}
|
}
|
||||||
@@ -2198,12 +2203,78 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
|||||||
|
|
||||||
gdk_display_init_dmabuf (display);
|
gdk_display_init_dmabuf (display);
|
||||||
|
|
||||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
if (gdk_dmabuf_formats_contains (display->egl_dmabuf_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||||
{
|
{
|
||||||
|
/* This is the path for modern drivers that support modifiers */
|
||||||
|
|
||||||
|
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||||
|
{
|
||||||
|
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||||
|
width, height,
|
||||||
|
dmabuf,
|
||||||
|
GL_TEXTURE_2D);
|
||||||
|
if (texture_id == 0)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
*external = FALSE;
|
||||||
|
return texture_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gdk_gl_context_get_use_es (self))
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||||
width, height,
|
width, height,
|
||||||
dmabuf,
|
dmabuf,
|
||||||
GL_TEXTURE_2D);
|
GL_TEXTURE_EXTERNAL_OES);
|
||||||
|
if (texture_id == 0)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
|
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||||
|
width, height,
|
||||||
|
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||||
|
*external = TRUE;
|
||||||
|
return texture_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This is the opportunistic path.
|
||||||
|
* We hit it both for drivers that do not support modifiers as well as for dmabufs
|
||||||
|
* that the driver did not explicitly advertise. */
|
||||||
|
int target;
|
||||||
|
|
||||||
|
if (gdk_gl_context_get_use_es (self))
|
||||||
|
target = GL_TEXTURE_EXTERNAL_OES;
|
||||||
|
else
|
||||||
|
target = GL_TEXTURE_2D;
|
||||||
|
|
||||||
|
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||||
|
width, height,
|
||||||
|
dmabuf,
|
||||||
|
target);
|
||||||
|
|
||||||
if (texture_id == 0)
|
if (texture_id == 0)
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
@@ -2214,40 +2285,13 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as %s texture",
|
||||||
width, height,
|
width, height,
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
(char *) &dmabuf->fourcc, dmabuf->modifier,
|
||||||
*external = FALSE;
|
target == GL_TEXTURE_EXTERNAL_OES ? "GL_TEXTURE_EXTERNAL_OES" : "GL_TEXTURE_2D");
|
||||||
|
*external = target == GL_TEXTURE_EXTERNAL_OES;
|
||||||
return texture_id;
|
return texture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gdk_gl_context_get_use_es (self))
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
|
||||||
width, height,
|
|
||||||
dmabuf,
|
|
||||||
GL_TEXTURE_EXTERNAL_OES);
|
|
||||||
if (texture_id == 0)
|
|
||||||
{
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
|
||||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
|
||||||
width, height,
|
|
||||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
|
||||||
*external = TRUE;
|
|
||||||
return texture_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|||||||
@@ -744,3 +744,11 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MM_PER_INCH 25.4
|
||||||
|
|
||||||
|
double
|
||||||
|
gdk_monitor_get_dpi (GdkMonitor *monitor)
|
||||||
|
{
|
||||||
|
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
|
||||||
|
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
|
||||||
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
|||||||
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
||||||
void gdk_monitor_set_description (GdkMonitor *monitor,
|
void gdk_monitor_set_description (GdkMonitor *monitor,
|
||||||
const char *description);
|
const char *description);
|
||||||
|
double gdk_monitor_get_dpi (GdkMonitor *monitor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -98,9 +98,9 @@ gdk_rgba_free (GdkRGBA *rgba)
|
|||||||
* Returns: %TRUE if the @rgba is clear
|
* Returns: %TRUE if the @rgba is clear
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
(gdk_rgba_is_clear) (const GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
return _gdk_rgba_is_clear (rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,9 +115,9 @@ gdk_rgba_is_clear (const GdkRGBA *rgba)
|
|||||||
* Returns: %TRUE if the @rgba is opaque
|
* Returns: %TRUE if the @rgba is opaque
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
(gdk_rgba_is_opaque) (const GdkRGBA *rgba)
|
||||||
{
|
{
|
||||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
return _gdk_rgba_is_opaque (rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||||
@@ -368,21 +368,10 @@ gdk_rgba_hash (gconstpointer p)
|
|||||||
* Returns: %TRUE if the two colors compare equal
|
* Returns: %TRUE if the two colors compare equal
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_rgba_equal (gconstpointer p1,
|
(gdk_rgba_equal) (gconstpointer p1,
|
||||||
gconstpointer p2)
|
gconstpointer p2)
|
||||||
{
|
{
|
||||||
const GdkRGBA *rgba1, *rgba2;
|
return _gdk_rgba_equal (p1, p2);
|
||||||
|
|
||||||
rgba1 = p1;
|
|
||||||
rgba2 = p2;
|
|
||||||
|
|
||||||
if (rgba1->red == rgba2->red &&
|
|
||||||
rgba1->green == rgba2->green &&
|
|
||||||
rgba1->blue == rgba2->blue &&
|
|
||||||
rgba1->alpha == rgba2->alpha)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -407,10 +396,18 @@ gdk_rgba_equal (gconstpointer p1,
|
|||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
gdk_rgba_to_string (const GdkRGBA *rgba)
|
gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||||
|
{
|
||||||
|
return g_string_free (gdk_rgba_print (rgba, g_string_new ("")), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
GString *
|
||||||
|
gdk_rgba_print (const GdkRGBA *rgba,
|
||||||
|
GString *string)
|
||||||
{
|
{
|
||||||
if (rgba->alpha > 0.999)
|
if (rgba->alpha > 0.999)
|
||||||
{
|
{
|
||||||
return g_strdup_printf ("rgb(%d,%d,%d)",
|
g_string_append_printf (string,
|
||||||
|
"rgb(%d,%d,%d)",
|
||||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
||||||
@@ -421,12 +418,15 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
|
|||||||
|
|
||||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
||||||
|
|
||||||
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
|
g_string_append_printf (string,
|
||||||
|
"rgba(%d,%d,%d,%s)",
|
||||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
||||||
alpha);
|
alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -43,5 +43,37 @@
|
|||||||
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
||||||
GdkRGBA *rgba);
|
GdkRGBA *rgba);
|
||||||
|
|
||||||
|
#define gdk_rgba_is_clear(rgba) _gdk_rgba_is_clear (rgba)
|
||||||
|
#define gdk_rgba_is_opaque(rgba) _gdk_rgba_is_opaque (rgba)
|
||||||
|
#define gdk_rgba_equal(p1, p2) _gdk_rgba_equal (p1, p2)
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||||
|
{
|
||||||
|
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||||
|
{
|
||||||
|
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gdk_rgba_equal (gconstpointer p1,
|
||||||
|
gconstpointer p2)
|
||||||
|
{
|
||||||
|
const GdkRGBA *rgba1 = p1;
|
||||||
|
const GdkRGBA *rgba2 = p2;
|
||||||
|
|
||||||
|
return rgba1->red == rgba2->red &&
|
||||||
|
rgba1->green == rgba2->green &&
|
||||||
|
rgba1->blue == rgba2->blue &&
|
||||||
|
rgba1->alpha == rgba2->alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
GString * gdk_rgba_print (const GdkRGBA *rgba,
|
||||||
|
GString *string);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+162
-13
@@ -48,6 +48,14 @@ gdk_subsurface_class_init (GdkSubsurfaceClass *class)
|
|||||||
object_class->finalize = gdk_subsurface_finalize;
|
object_class->finalize = gdk_subsurface_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_parent:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
*
|
||||||
|
* Returns the parent surface of @subsurface.
|
||||||
|
*
|
||||||
|
* Returns: the parent surface
|
||||||
|
*/
|
||||||
GdkSurface *
|
GdkSurface *
|
||||||
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -108,17 +116,41 @@ insert_subsurface (GdkSubsurface *subsurface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_attach:
|
||||||
|
* @subsurface: the `GdkSubsurface`
|
||||||
|
* @texture: the texture to attach. This typically has to be a `GdkDmabufTexture`
|
||||||
|
* @source: the source rectangle (i.e. the subset of the texture) to display
|
||||||
|
* @dest: the dest rectangle, in application pixels, relative to the parent surface.
|
||||||
|
* It must be integral in application and device pixels, or attaching will fail
|
||||||
|
* @transform: the transform to apply to the texture contents before displaying
|
||||||
|
* @background: (nullable): the background rectangle, in application pixels relative
|
||||||
|
* to the parent surface. This tells GDK to put a black background of this
|
||||||
|
* size below the subsurface. It must be integral in application and device pixels,
|
||||||
|
* or attaching will fail
|
||||||
|
* @above: whether the subsurface should be above its sibling
|
||||||
|
* @sibling: (nullable): the sibling subsurface to stack relative to, or `NULL` to
|
||||||
|
* stack relative to the parent surface
|
||||||
|
*
|
||||||
|
* Attaches content to a subsurface.
|
||||||
|
*
|
||||||
|
* This function takes all the necessary arguments to determine the subsurface
|
||||||
|
* configuration, including its position, size, content, background and stacking.
|
||||||
|
*
|
||||||
|
* Returns: `TRUE` if the attaching succeeded
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
GdkTextureTransform transform,
|
||||||
gboolean lightbox,
|
const graphene_rect_t *background,
|
||||||
gboolean above,
|
gboolean above,
|
||||||
GdkSubsurface *sibling)
|
GdkSubsurface *sibling)
|
||||||
{
|
{
|
||||||
GdkSurface *parent = subsurface->parent;
|
GdkSurface *parent = subsurface->parent;
|
||||||
|
gboolean result;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||||
@@ -132,6 +164,15 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
|||||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||||
|
|
||||||
|
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
||||||
|
texture,
|
||||||
|
source,
|
||||||
|
dest,
|
||||||
|
transform,
|
||||||
|
background,
|
||||||
|
above,
|
||||||
|
sibling);
|
||||||
|
|
||||||
remove_subsurface (subsurface);
|
remove_subsurface (subsurface);
|
||||||
|
|
||||||
if (sibling)
|
if (sibling)
|
||||||
@@ -157,9 +198,17 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, transform, lightbox, above, sibling);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_detach:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
*
|
||||||
|
* Hides the subsurface.
|
||||||
|
*
|
||||||
|
* To show it again, you need to call gdk_subsurface_attach().
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -170,6 +219,14 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
|||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_texture:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
*
|
||||||
|
* Gets the texture that is currently displayed by the subsurface.
|
||||||
|
*
|
||||||
|
* Returns: (nullable): the texture that is displayed
|
||||||
|
*/
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -178,34 +235,91 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
|||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_source_rect:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
* @rect: (out caller-allocates): return location for the rectangle
|
||||||
|
*
|
||||||
|
* Returns the source rect that was specified in the most recent
|
||||||
|
* gdk_subsurface_attach() call for @subsurface.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *source)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||||
g_return_if_fail (source != NULL);
|
g_return_if_fail (rect != NULL);
|
||||||
|
|
||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source_rect (subsurface, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_texture_rect:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
* @rect: (out caller-allocates): return location for the rectangle
|
||||||
|
*
|
||||||
|
* Returns the texture rect that was specified in the most recent
|
||||||
|
* gdk_subsurface_attach() call for @subsurface.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *dest)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||||
g_return_if_fail (dest != NULL);
|
g_return_if_fail (rect != NULL);
|
||||||
|
|
||||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture_rect (subsurface, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_is_above_parent:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
*
|
||||||
|
* Returns whether the subsurface is above the parent surface
|
||||||
|
* or below. Note that a subsurface can be above its parent
|
||||||
|
* surface, and still be covered by sibling subsurfaces.
|
||||||
|
*
|
||||||
|
* Returns: `TRUE` if @subsurface is above its parent
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||||
|
|
||||||
return subsurface->above_parent;
|
return subsurface->above_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private>
|
||||||
|
* gdk_subsurface_get_sibling:
|
||||||
|
* @subsurface: the `GdkSubsurface`
|
||||||
|
* @above: whether to get the subsurface above
|
||||||
|
*
|
||||||
|
* Returns the subsurface above (or below) @subsurface in
|
||||||
|
* the stacking order.
|
||||||
|
*
|
||||||
|
* Returns: the sibling, or `NULL` if there is none.
|
||||||
|
*/
|
||||||
|
GdkSubsurface *
|
||||||
|
gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||||
|
gboolean above)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL);
|
||||||
|
|
||||||
|
if (above)
|
||||||
|
return subsurface->sibling_above;
|
||||||
|
else
|
||||||
|
return subsurface->sibling_below;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_transform:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
*
|
||||||
|
* Returns the transform that was specified in the most recent call to
|
||||||
|
* gdk_subsurface_attach() call for @subsurface.
|
||||||
|
*
|
||||||
|
* Returns: the transform
|
||||||
|
*/
|
||||||
GdkTextureTransform
|
GdkTextureTransform
|
||||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||||
{
|
{
|
||||||
@@ -214,10 +328,45 @@ gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
|||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_background_rect:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
* @rect: (out caller-allocates): return location for the rectangle
|
||||||
|
*
|
||||||
|
* Obtains the background rect that was specified in the most recent
|
||||||
|
* gdk_subsurface_attach() call for @subsurface.
|
||||||
|
*
|
||||||
|
* Returns: `TRUE` if @subsurface has a background
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_subsurface_get_lightbox (GdkSubsurface *subsurface)
|
gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||||
|
g_return_val_if_fail (rect != NULL, FALSE);
|
||||||
|
|
||||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_lightbox (subsurface);
|
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_background_rect (subsurface, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*< private >
|
||||||
|
* gdk_subsurface_get_bounds:
|
||||||
|
* @subsurface: a `GdkSubsurface`
|
||||||
|
* @bounds: (out caller-allocates): return location for the bounds
|
||||||
|
*
|
||||||
|
* Returns the bounds of the subsurface.
|
||||||
|
*
|
||||||
|
* The bounds are the union of the texture and background rects.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *bounds)
|
||||||
|
{
|
||||||
|
graphene_rect_t background;
|
||||||
|
|
||||||
|
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||||
|
g_return_if_fail (bounds != NULL);
|
||||||
|
|
||||||
|
gdk_subsurface_get_texture_rect (subsurface, bounds);
|
||||||
|
if (gdk_subsurface_get_background_rect (subsurface, &background))
|
||||||
|
graphene_rect_union (bounds, &background, bounds);
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-36
@@ -62,48 +62,53 @@ struct _GdkSubsurfaceClass
|
|||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
GdkTextureTransform transform,
|
||||||
gboolean lightbox,
|
const graphene_rect_t *bg,
|
||||||
gboolean above,
|
gboolean above,
|
||||||
GdkSubsurface *sibling);
|
GdkSubsurface *sibling);
|
||||||
void (* detach) (GdkSubsurface *subsurface);
|
void (* detach) (GdkSubsurface *subsurface);
|
||||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||||
void (* get_source) (GdkSubsurface *subsurface,
|
void (* get_source_rect) (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *source);
|
graphene_rect_t *rect);
|
||||||
void (* get_dest) (GdkSubsurface *subsurface,
|
void (* get_texture_rect) (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *dest);
|
graphene_rect_t *rect);
|
||||||
GdkTextureTransform
|
GdkTextureTransform
|
||||||
(* get_transform) (GdkSubsurface *subsurface);
|
(* get_transform) (GdkSubsurface *subsurface);
|
||||||
gboolean (* get_lightbox) (GdkSubsurface *subsurface);
|
gboolean (* get_background_rect) (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *rect);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||||
|
|
||||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
GdkTextureTransform transform,
|
||||||
gboolean lightbox,
|
const graphene_rect_t *background,
|
||||||
gboolean above,
|
gboolean above,
|
||||||
GdkSubsurface *sibling);
|
GdkSubsurface *sibling);
|
||||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
void gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *source);
|
graphene_rect_t *rect);
|
||||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||||
graphene_rect_t *dest);
|
graphene_rect_t *rect);
|
||||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||||
|
GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||||
|
gboolean above);
|
||||||
GdkTextureTransform
|
GdkTextureTransform
|
||||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||||
gboolean gdk_subsurface_get_lightbox (GdkSubsurface *subsurface);
|
gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *rect);
|
||||||
|
void gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||||
|
graphene_rect_t *bounds);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -50,6 +50,13 @@
|
|||||||
#include "loaders/gdktiffprivate.h"
|
#include "loaders/gdktiffprivate.h"
|
||||||
#include "loaders/gdkjpegprivate.h"
|
#include "loaders/gdkjpegprivate.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_texture_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.Texture] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
|
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
|
||||||
|
|
||||||
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
||||||
@@ -563,7 +570,7 @@ gdk_texture_new_from_bytes_internal (GBytes *bytes,
|
|||||||
{
|
{
|
||||||
if (gdk_is_png (bytes))
|
if (gdk_is_png (bytes))
|
||||||
{
|
{
|
||||||
return gdk_load_png (bytes, error);
|
return gdk_load_png (bytes, NULL, error);
|
||||||
}
|
}
|
||||||
else if (gdk_is_jpeg (bytes))
|
else if (gdk_is_jpeg (bytes))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -767,9 +767,6 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
|||||||
* This function asynchronously obtains a handle for a toplevel surface
|
* This function asynchronously obtains a handle for a toplevel surface
|
||||||
* that can be passed to other processes.
|
* that can be passed to other processes.
|
||||||
*
|
*
|
||||||
* When a handle has been obtained, @callback will be called, and can
|
|
||||||
* receive the handle via [method@Gdk.Toplevel.export_handle_finish].
|
|
||||||
*
|
|
||||||
* It is an error to call this function on a surface that is already
|
* It is an error to call this function on a surface that is already
|
||||||
* exported.
|
* exported.
|
||||||
*
|
*
|
||||||
|
|||||||
+6
-3
@@ -118,9 +118,12 @@ typedef enum
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkTitlebarGesture:
|
* GdkTitlebarGesture:
|
||||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
|
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK: double click gesture
|
||||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
|
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK: right click gesture
|
||||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
|
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK: middle click gesture
|
||||||
|
*
|
||||||
|
* The kind of title bar gesture to emit with
|
||||||
|
* [method@Gdk.Toplevel.titlebar_gesture].
|
||||||
*
|
*
|
||||||
* Since: 4.4
|
* Since: 4.4
|
||||||
*/
|
*/
|
||||||
|
|||||||
+68
-17
@@ -29,6 +29,7 @@
|
|||||||
#include "gdkdmabuffourccprivate.h"
|
#include "gdkdmabuffourccprivate.h"
|
||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdkdisplayprivate.h"
|
#include "gdkdisplayprivate.h"
|
||||||
|
#include "gdkprofilerprivate.h"
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -57,6 +58,9 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
|||||||
*
|
*
|
||||||
* Support for `GdkVulkanContext` is platform-specific and context creation
|
* Support for `GdkVulkanContext` is platform-specific and context creation
|
||||||
* can fail, returning %NULL context.
|
* can fail, returning %NULL context.
|
||||||
|
*
|
||||||
|
* Deprecated: 4.14: GTK does not expose any Vulkan internals. This
|
||||||
|
* struct is a leftover that was accidentally exposed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
||||||
@@ -90,6 +94,13 @@ enum {
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_vulkan_error_quark:
|
||||||
|
*
|
||||||
|
* Registers an error quark for [class@Gdk.VulkanContext] errors.
|
||||||
|
*
|
||||||
|
* Returns: the error quark
|
||||||
|
**/
|
||||||
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
@@ -603,7 +614,8 @@ physical_device_check_features (VkPhysicalDevice device)
|
|||||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||||
|
|
||||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) &&
|
||||||
|
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
|
||||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||||
|
|
||||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||||
@@ -628,6 +640,7 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
|||||||
{
|
{
|
||||||
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);
|
||||||
|
VkResult acquire_result;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (depth != priv->current_format)
|
if (depth != priv->current_format)
|
||||||
@@ -649,12 +662,29 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
|||||||
cairo_region_union (priv->regions[i], region);
|
cairo_region_union (priv->regions[i], region);
|
||||||
}
|
}
|
||||||
|
|
||||||
GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
acquire_next_image:
|
||||||
priv->swapchain,
|
acquire_result = GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||||
UINT64_MAX,
|
priv->swapchain,
|
||||||
priv->draw_semaphore,
|
UINT64_MAX,
|
||||||
VK_NULL_HANDLE,
|
priv->draw_semaphore,
|
||||||
&priv->draw_index);
|
VK_NULL_HANDLE,
|
||||||
|
&priv->draw_index);
|
||||||
|
if ((acquire_result == VK_ERROR_OUT_OF_DATE_KHR) ||
|
||||||
|
(acquire_result == VK_SUBOPTIMAL_KHR))
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
GDK_DEBUG (VULKAN, "Recreating the swapchain");
|
||||||
|
|
||||||
|
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||||
|
{
|
||||||
|
g_warning ("%s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
goto acquire_next_image;
|
||||||
|
}
|
||||||
|
|
||||||
cairo_region_union (region, priv->regions[priv->draw_index]);
|
cairo_region_union (region, priv->regions[priv->draw_index]);
|
||||||
}
|
}
|
||||||
@@ -1107,6 +1137,7 @@ gdk_display_load_pipeline_cache (GdkDisplay *display)
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
|
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkPipelineCache cache;
|
VkPipelineCache cache;
|
||||||
@@ -1121,14 +1152,13 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, NULL);
|
GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, NULL);
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (size == display->vk_pipeline_cache_size)
|
if (size == display->vk_pipeline_cache_size)
|
||||||
{
|
{
|
||||||
GDK_DEBUG (VULKAN, "pipeline cache size (%zu bytes) unchanged, skipping save", size);
|
GDK_DEBUG (VULKAN, "pipeline cache size (%zu bytes) unchanged, skipping save", size);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data = g_malloc (size);
|
data = g_malloc (size);
|
||||||
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -1148,7 +1178,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
|
|
||||||
file = gdk_vulkan_get_pipeline_cache_file (display);
|
file = gdk_vulkan_get_pipeline_cache_file (display);
|
||||||
|
|
||||||
GDK_DEBUG (VULKAN, "Saving pipeline cache to %s", g_file_peek_path (file));
|
GDK_DEBUG (VULKAN, "Saving pipeline cache of size %lu to %s", size, g_file_peek_path (file));
|
||||||
|
|
||||||
if (!g_file_replace_contents (file,
|
if (!g_file_replace_contents (file,
|
||||||
data,
|
data,
|
||||||
@@ -1163,7 +1193,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG))
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG))
|
||||||
{
|
{
|
||||||
VkPipelineCache new_cache;
|
VkPipelineCache new_cache;
|
||||||
|
|
||||||
GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current");
|
GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current");
|
||||||
new_cache = gdk_display_load_pipeline_cache (display);
|
new_cache = gdk_display_load_pipeline_cache (display);
|
||||||
if (new_cache)
|
if (new_cache)
|
||||||
@@ -1190,10 +1220,15 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_profiler_end_markf (begin_time,
|
||||||
|
"Save Vulkan pipeline cache", "%s size %lu",
|
||||||
|
g_file_peek_path (file), size);
|
||||||
|
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
g_free (display->vk_pipeline_cache_etag);
|
g_free (display->vk_pipeline_cache_etag);
|
||||||
display->vk_pipeline_cache_etag = etag;
|
display->vk_pipeline_cache_etag = etag;
|
||||||
|
display->vk_pipeline_cache_size = size;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1233,6 +1268,11 @@ gdk_display_create_pipeline_cache (GdkDisplay *display)
|
|||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&display->vk_pipeline_cache);
|
&display->vk_pipeline_cache);
|
||||||
|
GDK_DEBUG (VULKAN, "Creating empty pipeline cache");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GDK_DEBUG (VULKAN, "Loading pipeline cache (%lu bytes)", display->vk_pipeline_cache_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1342,6 +1382,7 @@ static gboolean
|
|||||||
gdk_display_create_vulkan_device (GdkDisplay *display,
|
gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||||
uint32_t i, j, k;
|
uint32_t i, j, k;
|
||||||
const char *override;
|
const char *override;
|
||||||
gboolean list_devices;
|
gboolean list_devices;
|
||||||
@@ -1484,6 +1525,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
|
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||||
|
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
|
||||||
|
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||||
@@ -1550,6 +1592,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
"Hum, what? This should not happen.")));
|
"Hum, what? This should not happen.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_profiler_end_mark (start_time, "Create Vulkan device", NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1588,6 +1632,7 @@ static gboolean
|
|||||||
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
GPtrArray *used_extensions;
|
GPtrArray *used_extensions;
|
||||||
GPtrArray *used_layers;
|
GPtrArray *used_layers;
|
||||||
@@ -1749,6 +1794,8 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
|
|
||||||
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
|
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
|
gdk_profiler_end_mark (start_time, "Create Vulkan instance", NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1819,8 +1866,9 @@ gdk_display_unref_vulkan (GdkDisplay *display)
|
|||||||
{
|
{
|
||||||
g_free (key);
|
g_free (key);
|
||||||
vkDestroyShaderModule (display->vk_device,
|
vkDestroyShaderModule (display->vk_device,
|
||||||
value,
|
*((VkShaderModule *)value),
|
||||||
NULL);
|
NULL);
|
||||||
|
g_free (value);
|
||||||
}
|
}
|
||||||
g_hash_table_unref (display->vk_shader_modules);
|
g_hash_table_unref (display->vk_shader_modules);
|
||||||
|
|
||||||
@@ -1948,13 +1996,13 @@ VkShaderModule
|
|||||||
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||||
const char *resource_name)
|
const char *resource_name)
|
||||||
{
|
{
|
||||||
VkShaderModule shader;
|
VkShaderModule *shader;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
||||||
if (shader)
|
if (shader)
|
||||||
return shader;
|
return *shader;
|
||||||
|
|
||||||
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
||||||
if (bytes == NULL)
|
if (bytes == NULL)
|
||||||
@@ -1964,6 +2012,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
|||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shader = g_new0 (VkShaderModule, 1);
|
||||||
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
||||||
&(VkShaderModuleCreateInfo) {
|
&(VkShaderModuleCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||||
@@ -1971,18 +2020,20 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
|||||||
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
&shader) == VK_SUCCESS)
|
shader) == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shader = VK_NULL_HANDLE;
|
g_free (shader);
|
||||||
|
|
||||||
|
return VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
|
|
||||||
return shader;
|
return *shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* GDK_RENDERING_VULKAN */
|
#else /* GDK_RENDERING_VULKAN */
|
||||||
|
|||||||
+17
-3
@@ -127,15 +127,18 @@ png_simple_warning_callback (png_structp png,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
/* {{{ Public API */
|
/* {{{ Public API */
|
||||||
|
|
||||||
GdkTexture *
|
GdkTexture *
|
||||||
gdk_load_png (GBytes *bytes,
|
gdk_load_png (GBytes *bytes,
|
||||||
GError **error)
|
GHashTable *options,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
png_io io;
|
png_io io;
|
||||||
png_struct *png = NULL;
|
png_struct *png = NULL;
|
||||||
png_info *info;
|
png_info *info;
|
||||||
|
png_textp text;
|
||||||
|
int num_texts;
|
||||||
guint width, height;
|
guint width, height;
|
||||||
gsize i, stride;
|
gsize i, stride;
|
||||||
int depth, color_type;
|
int depth, color_type;
|
||||||
@@ -297,6 +300,17 @@ gdk_load_png (GBytes *bytes,
|
|||||||
texture = gdk_memory_texture_new (width, height, format, out_bytes, stride);
|
texture = gdk_memory_texture_new (width, height, format, out_bytes, stride);
|
||||||
g_bytes_unref (out_bytes);
|
g_bytes_unref (out_bytes);
|
||||||
|
|
||||||
|
if (options && png_get_text (png, info, &text, &num_texts))
|
||||||
|
{
|
||||||
|
for (i = 0; i < num_texts; i++)
|
||||||
|
{
|
||||||
|
if (text->compression != -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_hash_table_insert (options, g_strdup (text->key), g_strdup (text->text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_free (row_pointers);
|
g_free (row_pointers);
|
||||||
png_destroy_read_struct (&png, &info, NULL);
|
png_destroy_read_struct (&png, &info, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#define PNG_SIGNATURE "\x89PNG"
|
#define PNG_SIGNATURE "\x89PNG"
|
||||||
|
|
||||||
GdkTexture *gdk_load_png (GBytes *bytes,
|
GdkTexture *gdk_load_png (GBytes *bytes,
|
||||||
|
GHashTable *options,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GBytes *gdk_save_png (GdkTexture *texture);
|
GBytes *gdk_save_png (GdkTexture *texture);
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ void _gdk_macos_display_send_event (GdkMacosDisp
|
|||||||
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
NSEvent *_gdk_macos_display_get_nsevent (GdkEvent *event);
|
NSEvent *_gdk_macos_display_get_matching_nsevent (GdkEvent *event);
|
||||||
|
NSEvent *_gdk_macos_display_get_exact_nsevent (GdkEvent *event);
|
||||||
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
||||||
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
||||||
NSInteger sequence_number);
|
NSInteger sequence_number);
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ gdk_macos_display_get_setting (GdkDisplay *display,
|
|||||||
const char *setting,
|
const char *setting,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
|
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,17 +994,41 @@ _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
|||||||
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find the matching `NSEvent` for an `GdkEvent`. This function
|
||||||
|
* return the `NSEvent`, also for rewritten `GdkEvent`'s.
|
||||||
|
*/
|
||||||
NSEvent *
|
NSEvent *
|
||||||
_gdk_macos_display_get_nsevent (GdkEvent *event)
|
_gdk_macos_display_get_matching_nsevent (GdkEvent *event)
|
||||||
{
|
{
|
||||||
for (const GList *iter = event_map.head; iter; iter = iter->next)
|
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
const GdkToNSEventMap *map = iter->data;
|
GdkToNSEventMap *map = iter->data;
|
||||||
|
|
||||||
if (map->gdk_event->event_type == event->event_type &&
|
if (map->gdk_event->event_type == event->event_type &&
|
||||||
map->gdk_event->device == event->device &&
|
map->gdk_event->device == event->device &&
|
||||||
map->gdk_event->time == event->time)
|
map->gdk_event->time == event->time)
|
||||||
return map->nsevent;
|
{
|
||||||
|
return map->nsevent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the matching `NSEvent` for the original `GdkEvent`.
|
||||||
|
* If an event was rewritten, it returns `NULL`.
|
||||||
|
*/
|
||||||
|
NSEvent *
|
||||||
|
_gdk_macos_display_get_exact_nsevent (GdkEvent *event)
|
||||||
|
{
|
||||||
|
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||||
|
{
|
||||||
|
GdkToNSEventMap *map = iter->data;
|
||||||
|
|
||||||
|
if (map->gdk_event == event)
|
||||||
|
{
|
||||||
|
return map->nsevent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (self, window);
|
||||||
|
|
||||||
[window setOpaque:NO];
|
[window setOpaque:NO];
|
||||||
[window setBackgroundColor:[NSColor clearColor]];
|
[window setBackgroundColor:[NSColor clearColor]];
|
||||||
[window setDecorated:NO];
|
[window setDecorated:NO];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (self, window);
|
|
||||||
|
|
||||||
frame_clock = _gdk_frame_clock_idle_new ();
|
frame_clock = _gdk_frame_clock_idle_new ();
|
||||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||||
g_object_unref (frame_clock);
|
g_object_unref (frame_clock);
|
||||||
|
|||||||
@@ -738,7 +738,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
|||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
NSEvent *nsevent = _gdk_macos_display_get_exact_nsevent (event);
|
||||||
if (nsevent != NULL)
|
if (nsevent != NULL)
|
||||||
[NSApp sendEvent: nsevent];
|
[NSApp sendEvent: nsevent];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
|||||||
GdkRectangle bounds;
|
GdkRectangle bounds;
|
||||||
GdkRectangle final_rect;
|
GdkRectangle final_rect;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
int shadow_left, shadow_right, shadow_top, shadow_bottom;
|
||||||
|
|
||||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||||
g_assert (layout != NULL);
|
g_assert (layout != NULL);
|
||||||
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
|||||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||||
|
|
||||||
|
gdk_popup_layout_get_shadow_width (layout,
|
||||||
|
&shadow_left,
|
||||||
|
&shadow_right,
|
||||||
|
&shadow_top,
|
||||||
|
&shadow_bottom);
|
||||||
|
|
||||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
shadow_left,
|
||||||
|
shadow_right,
|
||||||
|
shadow_top,
|
||||||
|
shadow_bottom,
|
||||||
monitor,
|
monitor,
|
||||||
&bounds,
|
&bounds,
|
||||||
self->layout,
|
self->layout,
|
||||||
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||||
|
|
||||||
[window setOpaque:NO];
|
[window setOpaque:NO];
|
||||||
[window setBackgroundColor:[NSColor clearColor]];
|
[window setBackgroundColor:[NSColor clearColor]];
|
||||||
[window setDecorated:NO];
|
[window setDecorated:NO];
|
||||||
[window setExcludedFromWindowsMenu:YES];
|
[window setExcludedFromWindowsMenu:YES];
|
||||||
[window setLevel:NSPopUpMenuWindowLevel];
|
[window setLevel:NSPopUpMenuWindowLevel];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
|
||||||
|
|
||||||
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
||||||
|
|
||||||
GDK_END_MACOS_ALLOC_POOL;
|
GDK_END_MACOS_ALLOC_POOL;
|
||||||
|
|||||||
@@ -591,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
|||||||
defer:NO
|
defer:NO
|
||||||
screen:screen];
|
screen:screen];
|
||||||
|
|
||||||
|
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||||
|
|
||||||
/* Allow NSWindow to go fullscreen */
|
/* Allow NSWindow to go fullscreen */
|
||||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||||
|
|
||||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
|
||||||
|
|
||||||
frame_clock = _gdk_frame_clock_idle_new ();
|
frame_clock = _gdk_frame_clock_idle_new ();
|
||||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||||
g_object_unref (frame_clock);
|
g_object_unref (frame_clock);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ gdk_macos_deps = [
|
|||||||
libgdk_c_args += ['-xobjective-c']
|
libgdk_c_args += ['-xobjective-c']
|
||||||
|
|
||||||
libgdk_macos = static_library('gdk-macos',
|
libgdk_macos = static_library('gdk-macos',
|
||||||
gdk_macos_sources, gdkconfig, gdkenum_h,
|
sources: [ gdk_macos_sources, gdk_gen_headers ],
|
||||||
include_directories: [ confinc, gdkinc, ],
|
include_directories: [ confinc, gdkinc, ],
|
||||||
c_args: [ libgdk_c_args, common_cflags, ],
|
c_args: [ libgdk_c_args, common_cflags, ],
|
||||||
link_with: [],
|
link_with: [],
|
||||||
|
|||||||
+10
-4
@@ -128,8 +128,8 @@ install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
|||||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||||
|
|
||||||
gdk_private_h_sources = files([
|
gdk_private_h_sources = files([
|
||||||
'gdkeventsprivate.h',
|
|
||||||
'gdkdevicetoolprivate.h',
|
'gdkdevicetoolprivate.h',
|
||||||
|
'gdkeventsprivate.h',
|
||||||
'gdkhslaprivate.h',
|
'gdkhslaprivate.h',
|
||||||
'gdkmonitorprivate.h',
|
'gdkmonitorprivate.h',
|
||||||
'gdkseatdefaultprivate.h',
|
'gdkseatdefaultprivate.h',
|
||||||
@@ -202,7 +202,13 @@ gdkwayland_inc = include_directories('wayland')
|
|||||||
wlinc = include_directories('.')
|
wlinc = include_directories('.')
|
||||||
win32rcinc = include_directories('win32/rc')
|
win32rcinc = include_directories('win32/rc')
|
||||||
|
|
||||||
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
|
gdk_gen_headers = [
|
||||||
|
gdkenum_h,
|
||||||
|
gdkmarshal_h,
|
||||||
|
gdkconfig,
|
||||||
|
gdkversionmacros_h,
|
||||||
|
gdk_visibility_h,
|
||||||
|
]
|
||||||
|
|
||||||
gdk_deps = [
|
gdk_deps = [
|
||||||
libm,
|
libm,
|
||||||
@@ -278,7 +284,7 @@ if gdk_backends.length() == 0
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
libgdk = static_library('gdk',
|
libgdk = static_library('gdk',
|
||||||
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
sources: [gdk_sources, gdk_backends_gen_headers, gdk_gen_headers],
|
||||||
dependencies: gdk_deps + [libgtk_css_dep],
|
dependencies: gdk_deps + [libgtk_css_dep],
|
||||||
link_with: [libgtk_css],
|
link_with: [libgtk_css],
|
||||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||||
@@ -290,7 +296,7 @@ libgdk = static_library('gdk',
|
|||||||
# list the dependencies and generated headers and such, for use in the
|
# list the dependencies and generated headers and such, for use in the
|
||||||
# "public" libgtk_dep used by internal executables.
|
# "public" libgtk_dep used by internal executables.
|
||||||
libgdk_dep = declare_dependency(
|
libgdk_dep = declare_dependency(
|
||||||
sources: ['gdk.h', gdkconfig, gdkenum_h],
|
sources: ['gdk.h', gdk_gen_headers],
|
||||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||||
dependencies: gdk_deps + [libgtk_css_dep],
|
dependencies: gdk_deps + [libgtk_css_dep],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -198,17 +198,8 @@ static void
|
|||||||
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||||
{
|
{
|
||||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
|
||||||
|
|
||||||
if (!impl->has_pending_subsurface_commits)
|
gdk_wayland_surface_handle_empty_frame (surface);
|
||||||
return;
|
|
||||||
|
|
||||||
gdk_wayland_surface_sync (surface);
|
|
||||||
gdk_wayland_surface_request_frame (surface);
|
|
||||||
|
|
||||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
|
||||||
gdk_wayland_surface_commit (surface);
|
|
||||||
gdk_wayland_surface_notify_committed (surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -165,25 +165,29 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
double *scale)
|
double *scale)
|
||||||
{
|
{
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
int desired_scale_factor;
|
|
||||||
|
|
||||||
desired_scale_factor = (int) ceil (desired_scale);
|
|
||||||
|
|
||||||
if (gdk_cursor_get_name (cursor))
|
if (gdk_cursor_get_name (cursor))
|
||||||
{
|
{
|
||||||
struct wl_cursor *c;
|
struct wl_cursor *c;
|
||||||
|
int scale_factor;
|
||||||
|
|
||||||
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
||||||
goto none;
|
{
|
||||||
|
*hotspot_x = *hotspot_y = 0;
|
||||||
|
*width = *height = 0;
|
||||||
|
*scale = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
scale_factor = (int) ceil (desired_scale);
|
||||||
|
|
||||||
c = gdk_wayland_cursor_load_for_name (display,
|
c = gdk_wayland_cursor_load_for_name (display,
|
||||||
_gdk_wayland_display_get_cursor_theme (display),
|
display->cursor_theme,
|
||||||
desired_scale_factor,
|
scale_factor,
|
||||||
gdk_cursor_get_name (cursor));
|
gdk_cursor_get_name (cursor));
|
||||||
if (c && c->image_count > 0)
|
if (c && c->image_count > 0)
|
||||||
{
|
{
|
||||||
struct wl_cursor_image *image;
|
struct wl_cursor_image *image;
|
||||||
int cursor_scale;
|
|
||||||
|
|
||||||
if (image_index >= c->image_count)
|
if (image_index >= c->image_count)
|
||||||
{
|
{
|
||||||
@@ -195,23 +199,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
|||||||
|
|
||||||
image = c->images[image_index];
|
image = c->images[image_index];
|
||||||
|
|
||||||
cursor_scale = desired_scale_factor;
|
*width = display->cursor_theme_size;
|
||||||
if ((image->width % cursor_scale != 0) ||
|
*height = display->cursor_theme_size;
|
||||||
(image->height % cursor_scale != 0))
|
*scale = image->width / (double) *width;
|
||||||
|
*hotspot_x = image->hotspot_x / scale_factor;
|
||||||
|
*hotspot_y = image->hotspot_y / scale_factor;
|
||||||
|
|
||||||
|
if (*scale != scale_factor && !use_viewporter)
|
||||||
{
|
{
|
||||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
g_warning (G_STRLOC " cursor image size (%d) not an integer "
|
||||||
"multiple of scale (%d)", image->width, image->height,
|
"multiple of theme size (%d)", image->width, *width);
|
||||||
cursor_scale);
|
*width = image->width;
|
||||||
cursor_scale = 1;
|
*height = image->height;
|
||||||
|
*hotspot_x = image->hotspot_x;
|
||||||
|
*hotspot_y = image->hotspot_y;
|
||||||
|
*scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
|
||||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
|
||||||
|
|
||||||
*width = image->width / cursor_scale;
|
|
||||||
*height = image->height / cursor_scale;
|
|
||||||
*scale = cursor_scale;
|
|
||||||
|
|
||||||
return wl_cursor_image_get_buffer (image);
|
return wl_cursor_image_get_buffer (image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,7 +261,7 @@ from_texture:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!use_viewporter)
|
if (!use_viewporter)
|
||||||
*scale = desired_scale_factor;
|
*scale = ceil (desired_scale);
|
||||||
else
|
else
|
||||||
*scale = desired_scale;
|
*scale = desired_scale;
|
||||||
|
|
||||||
@@ -294,28 +298,23 @@ from_texture:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_cursor_get_fallback (cursor))
|
if (gdk_cursor_get_fallback (cursor))
|
||||||
return _gdk_wayland_cursor_get_buffer (display,
|
{
|
||||||
gdk_cursor_get_fallback (cursor),
|
return _gdk_wayland_cursor_get_buffer (display,
|
||||||
desired_scale,
|
gdk_cursor_get_fallback (cursor),
|
||||||
use_viewporter,
|
desired_scale,
|
||||||
image_index,
|
use_viewporter,
|
||||||
hotspot_x, hotspot_y,
|
image_index,
|
||||||
width, height,
|
hotspot_x, hotspot_y,
|
||||||
scale);
|
width, height,
|
||||||
|
scale);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
||||||
goto from_texture;
|
goto from_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
none:
|
g_assert_not_reached ();
|
||||||
*hotspot_x = 0;
|
|
||||||
*hotspot_y = 0;
|
|
||||||
*width = 0;
|
|
||||||
*height = 0;
|
|
||||||
*scale = 1;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
#define OUTPUT_VERSION_WITH_DONE 2
|
#define OUTPUT_VERSION_WITH_DONE 2
|
||||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||||
#define OUTPUT_VERSION 3
|
#define OUTPUT_VERSION 3
|
||||||
|
#define XDG_WM_DIALOG_VERSION 1
|
||||||
|
|
||||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||||
#define XDG_WM_BASE_VERSION 6
|
#define XDG_WM_BASE_VERSION 6
|
||||||
@@ -105,6 +106,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||||
|
static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||||
|
const char *name,
|
||||||
|
int size);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||||
|
|
||||||
@@ -284,93 +288,6 @@ static const struct wl_shm_listener wl_shm_listener = {
|
|||||||
wl_shm_format
|
wl_shm_format
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_done (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
|
||||||
{
|
|
||||||
GDK_DEBUG (MISC, "dmabuf feedback done");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_format_table (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
|
||||||
int32_t fd,
|
|
||||||
uint32_t size)
|
|
||||||
{
|
|
||||||
GdkWaylandDisplay *display_wayland = data;
|
|
||||||
|
|
||||||
display_wayland->linux_dmabuf_n_formats = size / 16;
|
|
||||||
display_wayland->linux_dmabuf_formats = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
|
||||||
|
|
||||||
GDK_DEBUG (MISC, "got dmabuf format table (%lu entries)", display_wayland->linux_dmabuf_n_formats);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_main_device (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
|
||||||
struct wl_array *device)
|
|
||||||
{
|
|
||||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
|
||||||
|
|
||||||
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_done (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
|
||||||
{
|
|
||||||
GDK_DEBUG (MISC, "dmabuf feedback tranche done");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_target_device (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
|
||||||
struct wl_array *device)
|
|
||||||
{
|
|
||||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
|
||||||
|
|
||||||
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_formats (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
|
||||||
struct wl_array *indices)
|
|
||||||
{
|
|
||||||
GdkWaylandDisplay *display_wayland = data;
|
|
||||||
|
|
||||||
GDK_DEBUG (MISC, "got dmabuf tranche formats (%lu entries):", indices->size / sizeof (guint16));
|
|
||||||
guint16 *pos;
|
|
||||||
|
|
||||||
wl_array_for_each (pos, indices)
|
|
||||||
{
|
|
||||||
LinuxDmabufFormat *fmt G_GNUC_UNUSED = &display_wayland->linux_dmabuf_formats[*pos];
|
|
||||||
uint32_t f G_GNUC_UNUSED = fmt->fourcc;
|
|
||||||
uint64_t m G_GNUC_UNUSED = fmt->modifier;
|
|
||||||
GDK_DEBUG (MISC, " %.4s:%#" G_GINT64_MODIFIER "x", (char *) &f, m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
linux_dmabuf_tranche_flags (void *data,
|
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
|
||||||
uint32_t flags)
|
|
||||||
{
|
|
||||||
GDK_DEBUG (MISC,
|
|
||||||
"got dmabuf tranche flags: %s",
|
|
||||||
flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? "scanout" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct zwp_linux_dmabuf_feedback_v1_listener linux_dmabuf_feedback_listener = {
|
|
||||||
linux_dmabuf_done,
|
|
||||||
linux_dmabuf_format_table,
|
|
||||||
linux_dmabuf_main_device,
|
|
||||||
linux_dmabuf_tranche_done,
|
|
||||||
linux_dmabuf_tranche_target_device,
|
|
||||||
linux_dmabuf_tranche_formats,
|
|
||||||
linux_dmabuf_tranche_flags,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
server_decoration_manager_default_mode (void *data,
|
server_decoration_manager_default_mode (void *data,
|
||||||
struct org_kde_kwin_server_decoration_manager *manager,
|
struct org_kde_kwin_server_decoration_manager *manager,
|
||||||
@@ -437,7 +354,7 @@ gdk_registry_handle_global (void *data,
|
|||||||
{
|
{
|
||||||
display_wayland->compositor =
|
display_wayland->compositor =
|
||||||
wl_registry_bind (display_wayland->wl_registry, id,
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
&wl_compositor_interface, MIN (version, 5));
|
&wl_compositor_interface, MIN (version, 6));
|
||||||
}
|
}
|
||||||
else if (strcmp (interface, "wl_shm") == 0)
|
else if (strcmp (interface, "wl_shm") == 0)
|
||||||
{
|
{
|
||||||
@@ -447,12 +364,14 @@ gdk_registry_handle_global (void *data,
|
|||||||
}
|
}
|
||||||
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
|
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
|
||||||
{
|
{
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
||||||
|
|
||||||
display_wayland->linux_dmabuf =
|
display_wayland->linux_dmabuf =
|
||||||
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
|
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
|
||||||
display_wayland->linux_dmabuf_feedback =
|
feedback = zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
||||||
zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
display_wayland->dmabuf_formats_info = dmabuf_formats_info_new (GDK_DISPLAY (display_wayland),
|
||||||
zwp_linux_dmabuf_feedback_v1_add_listener (display_wayland->linux_dmabuf_feedback,
|
"default",
|
||||||
&linux_dmabuf_feedback_listener, display_wayland);
|
feedback);
|
||||||
_gdk_wayland_display_async_roundtrip (display_wayland);
|
_gdk_wayland_display_async_roundtrip (display_wayland);
|
||||||
}
|
}
|
||||||
else if (strcmp (interface, "xdg_wm_base") == 0)
|
else if (strcmp (interface, "xdg_wm_base") == 0)
|
||||||
@@ -464,6 +383,13 @@ gdk_registry_handle_global (void *data,
|
|||||||
{
|
{
|
||||||
display_wayland->zxdg_shell_v6_id = id;
|
display_wayland->zxdg_shell_v6_id = id;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
|
||||||
|
{
|
||||||
|
display_wayland->xdg_wm_dialog =
|
||||||
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
|
&xdg_wm_dialog_v1_interface,
|
||||||
|
MIN (version, XDG_WM_DIALOG_VERSION));
|
||||||
|
}
|
||||||
else if (strcmp (interface, "gtk_shell1") == 0)
|
else if (strcmp (interface, "gtk_shell1") == 0)
|
||||||
{
|
{
|
||||||
display_wayland->gtk_shell =
|
display_wayland->gtk_shell =
|
||||||
@@ -606,7 +532,13 @@ gdk_registry_handle_global (void *data,
|
|||||||
&wp_presentation_interface,
|
&wp_presentation_interface,
|
||||||
MIN (version, 1));
|
MIN (version, 1));
|
||||||
}
|
}
|
||||||
|
else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
|
||||||
|
{
|
||||||
|
display_wayland->single_pixel_buffer =
|
||||||
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
|
&wp_single_pixel_buffer_manager_v1_interface,
|
||||||
|
MIN (version, 1));
|
||||||
|
}
|
||||||
|
|
||||||
g_hash_table_insert (display_wayland->known_globals,
|
g_hash_table_insert (display_wayland->known_globals,
|
||||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||||
@@ -817,10 +749,9 @@ gdk_wayland_display_dispose (GObject *object)
|
|||||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_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->viewporter, wp_viewporter_destroy);
|
||||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
||||||
|
g_clear_pointer (&display_wayland->single_pixel_buffer, wp_single_pixel_buffer_manager_v1_destroy);
|
||||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||||
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
|
||||||
if (display_wayland->linux_dmabuf_formats)
|
|
||||||
munmap (display_wayland->linux_dmabuf_formats, display_wayland->linux_dmabuf_n_formats * 16);
|
|
||||||
|
|
||||||
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
||||||
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
||||||
@@ -1122,7 +1053,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
|||||||
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
||||||
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
||||||
display_class->get_setting = gdk_wayland_display_get_setting;
|
display_class->get_setting = gdk_wayland_display_get_setting;
|
||||||
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
|
display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1195,11 +1126,22 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
|||||||
* @size: the size to use for cursors
|
* @size: the size to use for cursors
|
||||||
*
|
*
|
||||||
* Sets the cursor theme for the given @display.
|
* Sets the cursor theme for the given @display.
|
||||||
|
*
|
||||||
|
* Deprecated: 4.16: Use the cursor-related properties of
|
||||||
|
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||||
const char *name,
|
const char *name,
|
||||||
int size)
|
int size)
|
||||||
|
{
|
||||||
|
_gdk_wayland_display_set_cursor_theme (display, name, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||||
|
const char *name,
|
||||||
|
int size)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||||
struct wl_cursor_theme *theme;
|
struct wl_cursor_theme *theme;
|
||||||
@@ -1268,7 +1210,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
|||||||
else
|
else
|
||||||
name = "default";
|
name = "default";
|
||||||
|
|
||||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
_gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
|
|
||||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||||
@@ -1804,6 +1746,7 @@ static TranslationEntry translations[] = {
|
|||||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
||||||
|
{ FALSE, "org.gnome.desktop.interface", "font-rendering", "gtk-font-rendering", G_TYPE_ENUM, { .i = 0 } },
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||||
@@ -1895,6 +1838,7 @@ apply_portal_setting (TranslationEntry *entry,
|
|||||||
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
||||||
break;
|
break;
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT:
|
||||||
|
case G_TYPE_ENUM:
|
||||||
entry->fallback.i = g_variant_get_int32 (value);
|
entry->fallback.i = g_variant_get_int32 (value);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN:
|
||||||
@@ -2144,6 +2088,9 @@ set_value_from_entry (GdkDisplay *display,
|
|||||||
case G_TYPE_BOOLEAN:
|
case G_TYPE_BOOLEAN:
|
||||||
g_value_set_boolean (value, entry->fallback.b);
|
g_value_set_boolean (value, entry->fallback.b);
|
||||||
break;
|
break;
|
||||||
|
case G_TYPE_ENUM:
|
||||||
|
g_value_set_enum (value, entry->fallback.i);
|
||||||
|
break;
|
||||||
case G_TYPE_NONE:
|
case G_TYPE_NONE:
|
||||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||||
@@ -2194,6 +2141,11 @@ set_value_from_entry (GdkDisplay *display,
|
|||||||
? g_settings_get_boolean (settings, entry->key)
|
? g_settings_get_boolean (settings, entry->key)
|
||||||
: entry->fallback.b);
|
: entry->fallback.b);
|
||||||
break;
|
break;
|
||||||
|
case G_TYPE_ENUM:
|
||||||
|
g_value_set_enum (value, settings && entry->valid
|
||||||
|
? g_settings_get_enum (settings, entry->key)
|
||||||
|
: entry->fallback.i);
|
||||||
|
break;
|
||||||
case G_TYPE_NONE:
|
case G_TYPE_NONE:
|
||||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||||
|
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||||
|
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdkkeys.h>
|
#include <gdk/gdkkeys.h>
|
||||||
@@ -48,6 +50,7 @@
|
|||||||
|
|
||||||
#include "gdkdisplayprivate.h"
|
#include "gdkdisplayprivate.h"
|
||||||
#include "gdkwaylanddevice.h"
|
#include "gdkwaylanddevice.h"
|
||||||
|
#include "gdkdmabuf-wayland-private.h"
|
||||||
#include "cursor/wayland-cursor.h"
|
#include "cursor/wayland-cursor.h"
|
||||||
|
|
||||||
#include <epoxy/egl.h>
|
#include <epoxy/egl.h>
|
||||||
@@ -72,13 +75,6 @@ typedef enum _GdkWaylandShellVariant
|
|||||||
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
||||||
} GdkWaylandShellVariant;
|
} GdkWaylandShellVariant;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t fourcc;
|
|
||||||
uint32_t padding;
|
|
||||||
uint64_t modifier;
|
|
||||||
} LinuxDmabufFormat;
|
|
||||||
|
|
||||||
struct _GdkWaylandDisplay
|
struct _GdkWaylandDisplay
|
||||||
{
|
{
|
||||||
GdkDisplay parent_instance;
|
GdkDisplay parent_instance;
|
||||||
@@ -104,11 +100,10 @@ struct _GdkWaylandDisplay
|
|||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
||||||
struct zwp_linux_dmabuf_feedback_v1 *linux_dmabuf_feedback;
|
DmabufFormatsInfo *dmabuf_formats_info;
|
||||||
gsize linux_dmabuf_n_formats;
|
|
||||||
LinuxDmabufFormat *linux_dmabuf_formats;
|
|
||||||
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 xdg_wm_dialog_v1 *xdg_wm_dialog;
|
||||||
struct gtk_shell1 *gtk_shell;
|
struct gtk_shell1 *gtk_shell;
|
||||||
struct wl_data_device_manager *data_device_manager;
|
struct wl_data_device_manager *data_device_manager;
|
||||||
struct wl_subcompositor *subcompositor;
|
struct wl_subcompositor *subcompositor;
|
||||||
@@ -127,6 +122,7 @@ struct _GdkWaylandDisplay
|
|||||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||||
struct wp_viewporter *viewporter;
|
struct wp_viewporter *viewporter;
|
||||||
struct wp_presentation *presentation;
|
struct wp_presentation *presentation;
|
||||||
|
struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer;
|
||||||
|
|
||||||
GList *async_roundtrips;
|
GList *async_roundtrips;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* gdkdmabuf-wayland.h
|
||||||
|
*
|
||||||
|
* Copyright 2023 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#include <wayland-egl.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <gdk/gdkkeys.h>
|
||||||
|
#include <gdk/gdksurface.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t fourcc;
|
||||||
|
uint32_t padding;
|
||||||
|
uint64_t modifier;
|
||||||
|
} DmabufFormat;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
dev_t target_device;
|
||||||
|
guint32 flags;
|
||||||
|
gsize n_formats;
|
||||||
|
DmabufFormat *formats;
|
||||||
|
} DmabufTranche;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
dev_t main_device;
|
||||||
|
GPtrArray *tranches;
|
||||||
|
} DmabufFormats;
|
||||||
|
|
||||||
|
typedef struct DmabufFormatsInfo DmabufFormatsInfo;
|
||||||
|
|
||||||
|
struct DmabufFormatsInfo
|
||||||
|
{
|
||||||
|
GdkDisplay *display;
|
||||||
|
char *name;
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
||||||
|
|
||||||
|
gsize n_dmabuf_formats;
|
||||||
|
DmabufFormat *dmabuf_format_table;
|
||||||
|
|
||||||
|
DmabufFormats *dmabuf_formats;
|
||||||
|
DmabufFormats *pending_dmabuf_formats;
|
||||||
|
DmabufTranche *pending_tranche;
|
||||||
|
};
|
||||||
|
|
||||||
|
DmabufFormatsInfo * dmabuf_formats_info_new (GdkDisplay *display,
|
||||||
|
const char *name,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback);
|
||||||
|
|
||||||
|
void dmabuf_formats_info_free (DmabufFormatsInfo *info);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gdkdmabuf-wayland-private.h"
|
||||||
|
|
||||||
|
#include "gdkdebugprivate.h"
|
||||||
|
#include "gdkdmabufformatsprivate.h"
|
||||||
|
#include "gdkdmabufformatsbuilderprivate.h"
|
||||||
|
#include "gdkdmabufformatsprivate.h"
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
|
||||||
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
|
|
||||||
|
static DmabufTranche *
|
||||||
|
dmabuf_tranche_new (void)
|
||||||
|
{
|
||||||
|
return g_new0 (DmabufTranche, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dmabuf_tranche_free (DmabufTranche *tranche)
|
||||||
|
{
|
||||||
|
g_free (tranche->formats);
|
||||||
|
g_free (tranche);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DmabufFormats *
|
||||||
|
dmabuf_formats_new (void)
|
||||||
|
{
|
||||||
|
DmabufFormats *formats;
|
||||||
|
|
||||||
|
formats = g_new0 (DmabufFormats, 1);
|
||||||
|
formats->tranches = g_ptr_array_new_with_free_func ((GDestroyNotify) dmabuf_tranche_free);
|
||||||
|
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dmabuf_formats_free (DmabufFormats *formats)
|
||||||
|
{
|
||||||
|
g_ptr_array_unref (formats->tranches);
|
||||||
|
g_free (formats);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_dmabuf_formats (DmabufFormatsInfo *info)
|
||||||
|
{
|
||||||
|
DmabufFormats *formats = info->dmabuf_formats;
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||||
|
"dmabuf format table (%lu entries)", info->n_dmabuf_formats);
|
||||||
|
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||||
|
"dmabuf main device: %u %u",
|
||||||
|
major (formats->main_device),
|
||||||
|
minor (formats->main_device));
|
||||||
|
|
||||||
|
for (gsize i = 0; i < formats->tranches->len; i++)
|
||||||
|
{
|
||||||
|
DmabufTranche *tranche = g_ptr_array_index (formats->tranches, i);
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||||
|
"dmabuf tranche target device: %u %u",
|
||||||
|
major (tranche->target_device),
|
||||||
|
minor (tranche->target_device));
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||||
|
"dmabuf%s tranche (%lu entries):",
|
||||||
|
tranche->flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? " scanout" : "",
|
||||||
|
tranche->n_formats);
|
||||||
|
|
||||||
|
for (gsize j = 0; j < tranche->n_formats; j++)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||||
|
" %.4s:%#" G_GINT64_MODIFIER "x",
|
||||||
|
(char *) &(tranche->formats[j].fourcc),
|
||||||
|
tranche->formats[j].modifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_done (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
|
||||||
|
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
||||||
|
|
||||||
|
info->dmabuf_formats = info->pending_dmabuf_formats;
|
||||||
|
info->pending_dmabuf_formats = NULL;
|
||||||
|
|
||||||
|
update_dmabuf_formats (info);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_format_table (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||||
|
int32_t fd,
|
||||||
|
uint32_t size)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
|
||||||
|
if (info->dmabuf_formats)
|
||||||
|
munmap (info->dmabuf_formats, sizeof (DmabufFormat) * info->n_dmabuf_formats);
|
||||||
|
|
||||||
|
info->n_dmabuf_formats = size / 16;
|
||||||
|
info->dmabuf_format_table = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_main_device (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||||
|
struct wl_array *device)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
dev_t dev;
|
||||||
|
|
||||||
|
memcpy (&dev, device->data, sizeof (dev_t));
|
||||||
|
|
||||||
|
g_assert (info->pending_dmabuf_formats == NULL);
|
||||||
|
|
||||||
|
info->pending_dmabuf_formats = dmabuf_formats_new ();
|
||||||
|
info->pending_dmabuf_formats->main_device = dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_done (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
|
||||||
|
g_ptr_array_add (info->pending_dmabuf_formats->tranches,
|
||||||
|
info->pending_tranche);
|
||||||
|
|
||||||
|
info->pending_tranche = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_target_device (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||||
|
struct wl_array *device)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
dev_t dev;
|
||||||
|
DmabufTranche *tranche;
|
||||||
|
|
||||||
|
memcpy (&dev, device->data, sizeof (dev_t));
|
||||||
|
|
||||||
|
g_assert (info->pending_tranche == NULL);
|
||||||
|
|
||||||
|
tranche = dmabuf_tranche_new ();
|
||||||
|
tranche->target_device = dev;
|
||||||
|
|
||||||
|
info->pending_tranche = tranche;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_formats (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||||
|
struct wl_array *indices)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
DmabufTranche *tranche;
|
||||||
|
int i;
|
||||||
|
guint16 *pos;
|
||||||
|
|
||||||
|
g_assert (info->pending_tranche != NULL);
|
||||||
|
tranche = info->pending_tranche;
|
||||||
|
|
||||||
|
tranche->n_formats = indices->size / sizeof (guint16);
|
||||||
|
tranche->formats = g_new (DmabufFormat, tranche->n_formats);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
wl_array_for_each (pos, indices)
|
||||||
|
{
|
||||||
|
tranche->formats[i++] = info->dmabuf_format_table[*pos];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
linux_dmabuf_tranche_flags (void *data,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info = data;
|
||||||
|
DmabufTranche *tranche;
|
||||||
|
|
||||||
|
g_assert (info->pending_tranche != NULL);
|
||||||
|
tranche = info->pending_tranche;
|
||||||
|
tranche->flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct zwp_linux_dmabuf_feedback_v1_listener feedback_listener = {
|
||||||
|
linux_dmabuf_done,
|
||||||
|
linux_dmabuf_format_table,
|
||||||
|
linux_dmabuf_main_device,
|
||||||
|
linux_dmabuf_tranche_done,
|
||||||
|
linux_dmabuf_tranche_target_device,
|
||||||
|
linux_dmabuf_tranche_formats,
|
||||||
|
linux_dmabuf_tranche_flags,
|
||||||
|
};
|
||||||
|
|
||||||
|
DmabufFormatsInfo *
|
||||||
|
dmabuf_formats_info_new (GdkDisplay *display,
|
||||||
|
const char *name,
|
||||||
|
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||||
|
{
|
||||||
|
DmabufFormatsInfo *info;
|
||||||
|
|
||||||
|
info = g_new0 (DmabufFormatsInfo, 1);
|
||||||
|
|
||||||
|
info->display = display;
|
||||||
|
info->name = g_strdup (name);
|
||||||
|
info->feedback = feedback;
|
||||||
|
|
||||||
|
if (info->feedback)
|
||||||
|
zwp_linux_dmabuf_feedback_v1_add_listener (info->feedback,
|
||||||
|
&feedback_listener, info);
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dmabuf_formats_info_free (DmabufFormatsInfo *info)
|
||||||
|
{
|
||||||
|
g_free (info->name);
|
||||||
|
g_clear_pointer (&info->feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||||
|
if (info->dmabuf_format_table)
|
||||||
|
{
|
||||||
|
munmap (info->dmabuf_format_table, info->n_dmabuf_formats * 16);
|
||||||
|
info->dmabuf_format_table = NULL;
|
||||||
|
}
|
||||||
|
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
||||||
|
g_clear_pointer (&info->pending_dmabuf_formats, dmabuf_formats_free);
|
||||||
|
g_clear_pointer (&info->pending_tranche, dmabuf_tranche_free);
|
||||||
|
|
||||||
|
g_free (info);
|
||||||
|
}
|
||||||
@@ -88,14 +88,7 @@ gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
|||||||
{
|
{
|
||||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||||
|
|
||||||
if (gdk_wayland_surface_needs_commit (surface))
|
gdk_wayland_surface_handle_empty_frame (surface);
|
||||||
{
|
|
||||||
gdk_wayland_surface_sync (surface);
|
|
||||||
gdk_wayland_surface_request_frame (surface);
|
|
||||||
|
|
||||||
gdk_wayland_surface_commit (surface);
|
|
||||||
gdk_wayland_surface_notify_committed (surface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
|||||||
guint *next_image_delay);
|
guint *next_image_delay);
|
||||||
|
|
||||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||||
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
void gdk_wayland_surface_handle_empty_frame (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||||
|
|||||||
@@ -781,8 +781,8 @@ pointer_handle_motion (void *data,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
g_message ("motion %f %f, seat %p state %d",
|
gdk_debug_message ("motion %f %f, seat %p state %d",
|
||||||
x, y, seat, gdk_event_get_modifier_state (event));
|
x, y, seat, gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
||||||
@@ -1664,7 +1664,7 @@ touch_handle_down (void *data,
|
|||||||
{
|
{
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
gdk_event_get_position (event, &xx, &yy);
|
gdk_event_get_position (event, &xx, &yy);
|
||||||
g_message ("touch begin %f %f", xx, yy);
|
gdk_debug_message ("touch begin %f %f", xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1699,7 +1699,7 @@ touch_handle_up (void *data,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
g_message ("touch end %f %f", x, y);
|
gdk_debug_message ("touch end %f %f", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1747,7 +1747,7 @@ touch_handle_motion (void *data,
|
|||||||
{
|
{
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
gdk_event_get_position (event, &xx, &yy);
|
gdk_event_get_position (event, &xx, &yy);
|
||||||
g_message ("touch update %f %f", xx, yy);
|
gdk_debug_message ("touch update %f %f", xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1841,9 +1841,9 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event), x, y, seat,
|
gdk_event_get_event_type (event), x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -1936,10 +1936,10 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event),
|
gdk_event_get_event_type (event),
|
||||||
x, y, seat,
|
x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
@@ -2030,10 +2030,10 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
g_message ("hold event %d, coords: %f %f, seat %p state %d",
|
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||||
gdk_event_get_event_type (event),
|
gdk_event_get_event_type (event),
|
||||||
x, y, seat,
|
x, y, seat,
|
||||||
gdk_event_get_modifier_state (event));
|
gdk_event_get_modifier_state (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||||
|
|||||||
@@ -25,11 +25,16 @@ struct _GdkWaylandSubsurface
|
|||||||
cairo_rectangle_int_t dest;
|
cairo_rectangle_int_t dest;
|
||||||
graphene_rect_t source;
|
graphene_rect_t source;
|
||||||
enum wl_output_transform transform;
|
enum wl_output_transform transform;
|
||||||
gboolean lightbox;
|
|
||||||
|
|
||||||
struct wl_region *opaque_region;
|
struct wl_region *opaque_region;
|
||||||
|
|
||||||
struct wl_callback *frame_callback;
|
struct wl_callback *frame_callback;
|
||||||
|
|
||||||
|
struct wl_surface *bg_surface;
|
||||||
|
struct wl_subsurface *bg_subsurface;
|
||||||
|
struct wp_viewport *bg_viewport;
|
||||||
|
cairo_rectangle_int_t bg_rect;
|
||||||
|
gboolean bg_attached;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkWaylandSubsurfaceClass
|
struct _GdkWaylandSubsurfaceClass
|
||||||
|
|||||||
+404
-107
@@ -25,6 +25,8 @@
|
|||||||
#include "gdkdmabuftextureprivate.h"
|
#include "gdkdmabuftextureprivate.h"
|
||||||
#include "gdksurface-wayland-private.h"
|
#include "gdksurface-wayland-private.h"
|
||||||
#include "gdksubsurfaceprivate.h"
|
#include "gdksubsurfaceprivate.h"
|
||||||
|
#include "gdkdebugprivate.h"
|
||||||
|
#include "gsk/gskrectprivate.h"
|
||||||
|
|
||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
@@ -46,11 +48,55 @@ gdk_wayland_subsurface_finalize (GObject *object)
|
|||||||
g_clear_pointer (&self->viewport, wp_viewport_destroy);
|
g_clear_pointer (&self->viewport, wp_viewport_destroy);
|
||||||
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
||||||
g_clear_pointer (&self->surface, wl_surface_destroy);
|
g_clear_pointer (&self->surface, wl_surface_destroy);
|
||||||
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
|
g_clear_pointer (&self->bg_viewport, wp_viewport_destroy);
|
||||||
|
g_clear_pointer (&self->bg_subsurface, wl_subsurface_destroy);
|
||||||
|
g_clear_pointer (&self->bg_surface, wl_surface_destroy);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
shm_buffer_release (void *data,
|
||||||
|
struct wl_buffer *buffer)
|
||||||
|
{
|
||||||
|
cairo_surface_t *surface = data;
|
||||||
|
|
||||||
|
/* Note: the wl_buffer is destroyed as cairo user data */
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct wl_buffer_listener shm_buffer_listener = {
|
||||||
|
shm_buffer_release,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct wl_buffer *
|
||||||
|
get_shm_wl_buffer (GdkWaylandSubsurface *self,
|
||||||
|
GdkTexture *texture)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||||
|
int width, height;
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
GdkTextureDownloader *downloader;
|
||||||
|
struct wl_buffer *buffer;
|
||||||
|
|
||||||
|
width = gdk_texture_get_width (texture);
|
||||||
|
height = gdk_texture_get_height (texture);
|
||||||
|
surface = gdk_wayland_display_create_shm_surface (display, width, height, &GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||||
|
|
||||||
|
downloader = gdk_texture_downloader_new (texture);
|
||||||
|
|
||||||
|
gdk_texture_downloader_download_into (downloader,
|
||||||
|
cairo_image_surface_get_data (surface),
|
||||||
|
cairo_image_surface_get_stride (surface));
|
||||||
|
|
||||||
|
gdk_texture_downloader_free (downloader);
|
||||||
|
|
||||||
|
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||||
|
wl_buffer_add_listener (buffer, &shm_buffer_listener, surface);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dmabuf_buffer_release (void *data,
|
dmabuf_buffer_release (void *data,
|
||||||
struct wl_buffer *buffer)
|
struct wl_buffer *buffer)
|
||||||
@@ -97,8 +143,8 @@ static const struct zwp_linux_buffer_params_v1_listener params_listener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct wl_buffer *
|
static struct wl_buffer *
|
||||||
get_wl_buffer (GdkWaylandSubsurface *self,
|
get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
|
||||||
GdkTexture *texture)
|
GdkTexture *texture)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||||
const GdkDmabuf *dmabuf;
|
const GdkDmabuf *dmabuf;
|
||||||
@@ -149,6 +195,52 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct wl_buffer *
|
||||||
|
get_wl_buffer (GdkWaylandSubsurface *self,
|
||||||
|
GdkTexture *texture)
|
||||||
|
{
|
||||||
|
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
||||||
|
struct wl_buffer *buffer = NULL;
|
||||||
|
|
||||||
|
if (GDK_IS_DMABUF_TEXTURE (texture))
|
||||||
|
buffer = get_dmabuf_wl_buffer (self, texture);
|
||||||
|
|
||||||
|
if (GDK_DISPLAY_DEBUG_CHECK (display, FORCE_OFFLOAD))
|
||||||
|
{
|
||||||
|
if (!buffer)
|
||||||
|
buffer = get_shm_wl_buffer (self, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sp_buffer_release (void *data,
|
||||||
|
struct wl_buffer *buffer)
|
||||||
|
{
|
||||||
|
wl_buffer_destroy (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct wl_buffer_listener sp_buffer_listener = {
|
||||||
|
sp_buffer_release,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct wl_buffer *
|
||||||
|
get_sp_buffer (GdkWaylandSubsurface *self)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
|
||||||
|
struct wl_buffer *buffer = NULL;
|
||||||
|
|
||||||
|
if (display->single_pixel_buffer)
|
||||||
|
buffer = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer (display->single_pixel_buffer,
|
||||||
|
0, 0, 0, 0xffffffffU);
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
wl_buffer_add_listener (buffer, &sp_buffer_listener, self);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
static inline enum wl_output_transform
|
static inline enum wl_output_transform
|
||||||
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
||||||
{
|
{
|
||||||
@@ -161,25 +253,80 @@ wl_output_transform_to_gdk (enum wl_output_transform transform)
|
|||||||
return (GdkTextureTransform) transform;
|
return (GdkTextureTransform) transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_bg_surface (GdkWaylandSubsurface *self)
|
||||||
|
{
|
||||||
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (GDK_SUBSURFACE (self)->parent);
|
||||||
|
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
|
||||||
|
GdkWaylandDisplay *disp = GDK_WAYLAND_DISPLAY (display);
|
||||||
|
struct wl_region *region;
|
||||||
|
|
||||||
|
if (self->bg_surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
self->bg_surface = wl_compositor_create_surface (disp->compositor);
|
||||||
|
self->bg_subsurface = wl_subcompositor_get_subsurface (disp->subcompositor,
|
||||||
|
self->bg_surface,
|
||||||
|
impl->display_server.wl_surface);
|
||||||
|
self->bg_viewport = wp_viewporter_get_viewport (disp->viewporter, self->bg_surface);
|
||||||
|
|
||||||
|
/* We are opaque */
|
||||||
|
wl_surface_set_opaque_region (self->bg_surface, self->opaque_region);
|
||||||
|
|
||||||
|
/* No input, please */
|
||||||
|
region = wl_compositor_create_region (disp->compositor);
|
||||||
|
wl_surface_set_input_region (self->bg_surface, region);
|
||||||
|
wl_region_destroy (region);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
scaled_rect_is_integral (const graphene_rect_t *rect,
|
||||||
|
float scale,
|
||||||
|
graphene_rect_t *device_rect)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t device_int;
|
||||||
|
|
||||||
|
gsk_rect_scale (rect, scale, scale, device_rect);
|
||||||
|
|
||||||
|
device_int.x = device_rect->origin.x;
|
||||||
|
device_int.y = device_rect->origin.y;
|
||||||
|
device_int.width = device_rect->size.width;
|
||||||
|
device_int.height = device_rect->size.height;
|
||||||
|
|
||||||
|
return device_int.x == device_rect->origin.x &&
|
||||||
|
device_int.y == device_rect->origin.y &&
|
||||||
|
device_int.width == device_rect->size.width &&
|
||||||
|
device_int.height == device_rect->size.height;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||||
GdkTexture *texture,
|
GdkTexture *texture,
|
||||||
const graphene_rect_t *source,
|
const graphene_rect_t *source,
|
||||||
const graphene_rect_t *dest,
|
const graphene_rect_t *dest,
|
||||||
GdkTextureTransform transform,
|
GdkTextureTransform transform,
|
||||||
|
const graphene_rect_t *background,
|
||||||
gboolean above,
|
gboolean above,
|
||||||
gboolean lightbox,
|
|
||||||
GdkSubsurface *sibling)
|
GdkSubsurface *sibling)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
|
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
|
||||||
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (sub->parent));
|
||||||
struct wl_buffer *buffer = NULL;
|
struct wl_buffer *buffer = NULL;
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
|
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
|
||||||
gboolean will_be_above;
|
gboolean will_be_above;
|
||||||
double scale;
|
double scale;
|
||||||
graphene_rect_t device_rect;
|
graphene_rect_t device_rect;
|
||||||
cairo_rectangle_int_t device_dest;
|
gboolean has_background;
|
||||||
|
enum wl_output_transform tf;
|
||||||
|
gboolean dest_changed = FALSE;
|
||||||
|
gboolean source_changed = FALSE;
|
||||||
|
gboolean transform_changed = FALSE;
|
||||||
|
gboolean stacking_changed = FALSE;
|
||||||
|
gboolean needs_commit = FALSE;
|
||||||
|
gboolean background_changed = FALSE;
|
||||||
|
gboolean needs_bg_commit = FALSE;
|
||||||
|
|
||||||
if (sibling)
|
if (sibling)
|
||||||
will_be_above = sibling->above_parent;
|
will_be_above = sibling->above_parent;
|
||||||
@@ -192,72 +339,133 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->dest.x = dest->origin.x;
|
|
||||||
self->dest.y = dest->origin.y;
|
|
||||||
self->dest.width = dest->size.width;
|
|
||||||
self->dest.height = dest->size.height;
|
|
||||||
|
|
||||||
self->source.origin.x = source->origin.x;
|
|
||||||
self->source.origin.y = source->origin.y;
|
|
||||||
self->source.size.width = source->size.width;
|
|
||||||
self->source.size.height = source->size.height;
|
|
||||||
|
|
||||||
self->transform = gdk_texture_transform_to_wl (transform);
|
|
||||||
self->lightbox = lightbox;
|
|
||||||
|
|
||||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
|
||||||
|
|
||||||
device_rect.origin.x = dest->origin.x * scale;
|
|
||||||
device_rect.origin.y = dest->origin.y * scale;
|
|
||||||
device_rect.size.width = dest->size.width * scale;
|
|
||||||
device_rect.size.height = dest->size.height * scale;
|
|
||||||
|
|
||||||
device_dest.x = device_rect.origin.x;
|
|
||||||
device_dest.y = device_rect.origin.y;
|
|
||||||
device_dest.width = device_rect.size.width;
|
|
||||||
device_dest.height = device_rect.size.height;
|
|
||||||
|
|
||||||
if (self->dest.x != dest->origin.x ||
|
if (self->dest.x != dest->origin.x ||
|
||||||
self->dest.y != dest->origin.y ||
|
self->dest.y != dest->origin.y ||
|
||||||
self->dest.width != dest->size.width ||
|
self->dest.width != dest->size.width ||
|
||||||
self->dest.height != dest->size.height)
|
self->dest.height != dest->size.height)
|
||||||
|
{
|
||||||
|
self->dest.x = dest->origin.x;
|
||||||
|
self->dest.y = dest->origin.y;
|
||||||
|
self->dest.width = dest->size.width;
|
||||||
|
self->dest.height = dest->size.height;
|
||||||
|
dest_changed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gsk_rect_equal (&self->source, source))
|
||||||
|
{
|
||||||
|
self->source.origin.x = source->origin.x;
|
||||||
|
self->source.origin.y = source->origin.y;
|
||||||
|
self->source.size.width = source->size.width;
|
||||||
|
self->source.size.height = source->size.height;
|
||||||
|
source_changed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
tf = gdk_texture_transform_to_wl (transform);
|
||||||
|
if (self->transform != tf)
|
||||||
|
{
|
||||||
|
self->transform = tf;
|
||||||
|
transform_changed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sibling != gdk_subsurface_get_sibling (sub, above) ||
|
||||||
|
will_be_above != gdk_subsurface_is_above_parent (sub))
|
||||||
|
stacking_changed = TRUE;
|
||||||
|
|
||||||
|
if (self->texture == NULL)
|
||||||
|
{
|
||||||
|
dest_changed = TRUE;
|
||||||
|
source_changed = TRUE;
|
||||||
|
transform_changed = TRUE;
|
||||||
|
stacking_changed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||||
|
|
||||||
|
if (background)
|
||||||
|
{
|
||||||
|
background_changed =
|
||||||
|
!self->bg_attached ||
|
||||||
|
self->bg_rect.x != background->origin.x ||
|
||||||
|
self->bg_rect.y != background->origin.y ||
|
||||||
|
self->bg_rect.width != background->size.width ||
|
||||||
|
self->bg_rect.height != background->size.height;
|
||||||
|
self->bg_rect.x = background->origin.x;
|
||||||
|
self->bg_rect.y = background->origin.y;
|
||||||
|
self->bg_rect.width = background->size.width;
|
||||||
|
self->bg_rect.height = background->size.height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
background_changed = self->bg_attached;
|
||||||
|
self->bg_rect.x = 0;
|
||||||
|
self->bg_rect.y = 0;
|
||||||
|
self->bg_rect.width = 0;
|
||||||
|
self->bg_rect.height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
|
||||||
|
|
||||||
|
if (has_background)
|
||||||
|
ensure_bg_surface (self);
|
||||||
|
|
||||||
|
if (!scaled_rect_is_integral (dest, 1, &device_rect))
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
"[%p] 🗙 Non-integral coordinates %g %g %g %g",
|
||||||
|
self,
|
||||||
dest->origin.x, dest->origin.y,
|
dest->origin.x, dest->origin.y,
|
||||||
dest->size.width, dest->size.height,
|
dest->size.width, dest->size.height);
|
||||||
gdk_texture_get_width (texture),
|
|
||||||
gdk_texture_get_height (texture),
|
|
||||||
self);
|
|
||||||
}
|
}
|
||||||
else if (device_dest.x != device_rect.origin.x ||
|
else if (!scaled_rect_is_integral (dest, scale, &device_rect))
|
||||||
device_dest.y != device_rect.origin.y ||
|
|
||||||
device_dest.width != device_rect.size.width ||
|
|
||||||
device_dest.height != device_rect.size.height)
|
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"Non-integral device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p",
|
"[%p] 🗙 Non-integral device coordinates %g %g %g %g (scale %.2f)",
|
||||||
|
self,
|
||||||
device_rect.origin.x, device_rect.origin.y,
|
device_rect.origin.x, device_rect.origin.y,
|
||||||
device_rect.size.width, device_rect.size.width,
|
device_rect.size.width, device_rect.size.height,
|
||||||
scale,
|
scale);
|
||||||
self);
|
|
||||||
}
|
}
|
||||||
else if (!GDK_IS_DMABUF_TEXTURE (texture))
|
else if (background && !scaled_rect_is_integral (background, 1, &device_rect))
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"%dx%d %s is not a GdkDmabufTexture, hiding subsurface %p",
|
"[%p] 🗙 Non-integral background coordinates %g %g %g %g",
|
||||||
gdk_texture_get_width (texture),
|
self,
|
||||||
gdk_texture_get_height (texture),
|
background->origin.x, background->origin.y,
|
||||||
|
background->size.width, background->size.height);
|
||||||
|
}
|
||||||
|
else if (background && !scaled_rect_is_integral (background, scale, &device_rect))
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"[%p] 🗙 Non-integral background device coordinates %g %g %g %g (scale %.2f)",
|
||||||
|
self,
|
||||||
|
device_rect.origin.x, device_rect.origin.y,
|
||||||
|
device_rect.size.width, device_rect.size.height,
|
||||||
|
scale);
|
||||||
|
}
|
||||||
|
else if (!GDK_IS_DMABUF_TEXTURE (texture) &&
|
||||||
|
!GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (sub->parent), FORCE_OFFLOAD))
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"[%p] 🗙 %s (%dx%d) is not a GdkDmabufTexture",
|
||||||
|
self,
|
||||||
G_OBJECT_TYPE_NAME (texture),
|
G_OBJECT_TYPE_NAME (texture),
|
||||||
self);
|
gdk_texture_get_width (texture),
|
||||||
|
gdk_texture_get_height (texture));
|
||||||
}
|
}
|
||||||
else if (!will_be_above &&
|
else if (!will_be_above &&
|
||||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE)
|
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE &&
|
||||||
|
!has_background)
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"Cannot offload non-opaque %dx%d texture below, hiding subsurface %p",
|
"[%p] 🗙 Non-opaque texture (%dx%d) below",
|
||||||
|
self,
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture),
|
gdk_texture_get_height (texture));
|
||||||
|
}
|
||||||
|
else if (has_background && !display->single_pixel_buffer)
|
||||||
|
{
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"[%p] 🗙 Texture has background, but no single-pixel buffer support",
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -286,10 +494,13 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"Attached %dx%d texture to subsurface %p at %d %d %d %d",
|
"[%p] %s Attaching texture (%dx%d) at %d %d %d %d",
|
||||||
|
self,
|
||||||
|
will_be_above
|
||||||
|
? (has_background ? "▲" : "△")
|
||||||
|
: (has_background ? "▼" : "▽"),
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture),
|
gdk_texture_get_height (texture),
|
||||||
self,
|
|
||||||
self->dest.x, self->dest.y,
|
self->dest.x, self->dest.y,
|
||||||
self->dest.width, self->dest.height);
|
self->dest.width, self->dest.height);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
@@ -297,36 +508,53 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
"Compositor failed to create wl_buffer for %dx%d texture, hiding subsurface %p",
|
"[%p] 🗙 Failed to create wl_buffer",
|
||||||
gdk_texture_get_width (texture),
|
|
||||||
gdk_texture_get_height (texture),
|
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (dest_changed)
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||||
|
"[%p] %s Moving texture (%dx%d) to %d %d %d %d",
|
||||||
|
self,
|
||||||
|
will_be_above
|
||||||
|
? (has_background ? "▲" : "△")
|
||||||
|
: (has_background ? "▼" : "▽"),
|
||||||
|
gdk_texture_get_width (texture),
|
||||||
|
gdk_texture_get_height (texture),
|
||||||
|
self->dest.x, self->dest.y,
|
||||||
|
self->dest.width, self->dest.height);
|
||||||
|
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
|
||||||
"Moved %dx%d texture in subsurface %p to %d %d %d %d",
|
|
||||||
gdk_texture_get_width (texture),
|
|
||||||
gdk_texture_get_height (texture),
|
|
||||||
self,
|
|
||||||
self->dest.x, self->dest.y,
|
|
||||||
self->dest.width, self->dest.height);
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
if (transform_changed)
|
||||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
{
|
||||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
wl_surface_set_buffer_transform (self->surface, self->transform);
|
||||||
wp_viewport_set_source (self->viewport,
|
needs_commit = TRUE;
|
||||||
wl_fixed_from_double (self->source.origin.x),
|
}
|
||||||
wl_fixed_from_double (self->source.origin.y),
|
|
||||||
wl_fixed_from_double (self->source.size.width),
|
if (dest_changed)
|
||||||
wl_fixed_from_double (self->source.size.height));
|
{
|
||||||
|
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||||
|
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||||
|
needs_commit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source_changed)
|
||||||
|
{
|
||||||
|
wp_viewport_set_source (self->viewport,
|
||||||
|
wl_fixed_from_double (self->source.origin.x),
|
||||||
|
wl_fixed_from_double (self->source.origin.y),
|
||||||
|
wl_fixed_from_double (self->source.size.width),
|
||||||
|
wl_fixed_from_double (self->source.size.height));
|
||||||
|
needs_commit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
@@ -335,39 +563,95 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
|||||||
0, 0,
|
0, 0,
|
||||||
gdk_texture_get_width (texture),
|
gdk_texture_get_width (texture),
|
||||||
gdk_texture_get_height (texture));
|
gdk_texture_get_height (texture));
|
||||||
|
needs_commit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_background)
|
||||||
|
{
|
||||||
|
if (background_changed)
|
||||||
|
{
|
||||||
|
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
|
||||||
|
wp_viewport_set_destination (self->bg_viewport, self->bg_rect.width, self->bg_rect.height);
|
||||||
|
needs_bg_commit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self->bg_attached)
|
||||||
|
{
|
||||||
|
self->bg_attached = TRUE;
|
||||||
|
|
||||||
|
wp_viewport_set_source (self->bg_viewport,
|
||||||
|
wl_fixed_from_int (0),
|
||||||
|
wl_fixed_from_int (0),
|
||||||
|
wl_fixed_from_int (1),
|
||||||
|
wl_fixed_from_int (1));
|
||||||
|
wl_surface_attach (self->bg_surface, get_sp_buffer (self), 0, 0);
|
||||||
|
wl_surface_damage_buffer (self->bg_surface, 0, 0, 1, 1);
|
||||||
|
needs_bg_commit = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (self->bg_attached)
|
||||||
|
{
|
||||||
|
self->bg_attached = FALSE;
|
||||||
|
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||||
|
needs_bg_commit = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_object (&self->texture, NULL);
|
if (g_set_object (&self->texture, NULL))
|
||||||
|
{
|
||||||
|
wl_surface_attach (self->surface, NULL, 0, 0);
|
||||||
|
needs_commit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
wl_surface_attach (self->surface, NULL, 0, 0);
|
if (self->bg_attached)
|
||||||
|
{
|
||||||
|
self->bg_attached = FALSE;
|
||||||
|
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||||
|
needs_bg_commit = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sib)
|
if (stacking_changed)
|
||||||
{
|
{
|
||||||
if (above)
|
if (sib)
|
||||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
{
|
||||||
|
if (above)
|
||||||
|
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||||
|
else
|
||||||
|
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
{
|
||||||
}
|
if (above)
|
||||||
else
|
wl_subsurface_place_above (self->subsurface,
|
||||||
{
|
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||||
if (above)
|
else
|
||||||
wl_subsurface_place_above (self->subsurface,
|
wl_subsurface_place_below (self->subsurface,
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||||
else
|
}
|
||||||
wl_subsurface_place_below (self->subsurface,
|
needs_commit = TRUE;
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
|
||||||
|
if (self->bg_attached)
|
||||||
|
{
|
||||||
|
wl_subsurface_place_below (self->bg_subsurface, self->surface);
|
||||||
|
needs_bg_commit = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_surface_commit (self->surface);
|
if (needs_commit)
|
||||||
|
wl_surface_commit (self->surface);
|
||||||
|
|
||||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
if (needs_bg_commit)
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
wl_surface_commit (self->bg_surface);
|
||||||
|
|
||||||
|
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = needs_commit || needs_bg_commit;
|
||||||
|
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = stacking_changed || dest_changed || background_changed;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -379,7 +663,7 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
|||||||
|
|
||||||
if (sub->parent == NULL)
|
if (sub->parent == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Can't draw to destroyed subsurface %p", self);
|
g_warning ("Can't detach from destroyed subsurface %p", self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +672,13 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
|
|||||||
wl_surface_set_opaque_region (self->surface, self->opaque_region);
|
wl_surface_set_opaque_region (self->surface, self->opaque_region);
|
||||||
wl_surface_commit (self->surface);
|
wl_surface_commit (self->surface);
|
||||||
|
|
||||||
|
if (self->bg_attached)
|
||||||
|
{
|
||||||
|
wl_surface_attach (self->bg_surface, NULL, 0, 0);
|
||||||
|
wl_surface_commit (self->bg_surface);
|
||||||
|
self->bg_attached = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
|
||||||
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
|
||||||
}
|
}
|
||||||
@@ -401,27 +692,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
gdk_wayland_subsurface_get_texture_rect (GdkSubsurface *sub,
|
||||||
graphene_rect_t *dest)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
|
|
||||||
dest->origin.x = self->dest.x;
|
rect->origin.x = self->dest.x;
|
||||||
dest->origin.y = self->dest.y;
|
rect->origin.y = self->dest.y;
|
||||||
dest->size.width = self->dest.width;
|
rect->size.width = self->dest.width;
|
||||||
dest->size.height = self->dest.height;
|
rect->size.height = self->dest.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
gdk_wayland_subsurface_get_source_rect (GdkSubsurface *sub,
|
||||||
graphene_rect_t *source)
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
|
|
||||||
source->origin.x = self->source.origin.x;
|
rect->origin.x = self->source.origin.x;
|
||||||
source->origin.y = self->source.origin.y;
|
rect->origin.y = self->source.origin.y;
|
||||||
source->size.width = self->source.size.width;
|
rect->size.width = self->source.size.width;
|
||||||
source->size.height = self->source.size.height;
|
rect->size.height = self->source.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkTextureTransform
|
static GdkTextureTransform
|
||||||
@@ -433,11 +724,17 @@ gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_wayland_subsurface_get_lightbox (GdkSubsurface *sub)
|
gdk_wayland_subsurface_get_background_rect (GdkSubsurface *sub,
|
||||||
|
graphene_rect_t *rect)
|
||||||
{
|
{
|
||||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||||
|
|
||||||
return self->lightbox;
|
rect->origin.x = self->bg_rect.x;
|
||||||
|
rect->origin.y = self->bg_rect.y;
|
||||||
|
rect->size.width = self->bg_rect.width;
|
||||||
|
rect->size.height = self->bg_rect.height;
|
||||||
|
|
||||||
|
return rect->size.width > 0 && rect->size.height > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -451,10 +748,10 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
|||||||
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
||||||
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
||||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
subsurface_class->get_source_rect = gdk_wayland_subsurface_get_source_rect;
|
||||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
subsurface_class->get_texture_rect = gdk_wayland_subsurface_get_texture_rect;
|
||||||
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
||||||
subsurface_class->get_lightbox = gdk_wayland_subsurface_get_lightbox;
|
subsurface_class->get_background_rect = gdk_wayland_subsurface_get_background_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
#include "presentation-time-client-protocol.h"
|
#include "presentation-time-client-protocol.h"
|
||||||
|
|
||||||
|
#include "gsk/gskrectprivate.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GdkWaylandSurface:
|
* GdkWaylandSurface:
|
||||||
@@ -657,6 +659,7 @@ static void
|
|||||||
gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
||||||
{
|
{
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||||
struct wl_region *wl_region = NULL;
|
struct wl_region *wl_region = NULL;
|
||||||
|
|
||||||
if (!impl->display_server.wl_surface)
|
if (!impl->display_server.wl_surface)
|
||||||
@@ -679,16 +682,21 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sub->texture != NULL)
|
if (sub->texture != NULL)
|
||||||
cairo_region_subtract_rectangle (region, &sub->dest);
|
{
|
||||||
|
graphene_rect_t bounds;
|
||||||
|
cairo_rectangle_int_t rect;
|
||||||
|
|
||||||
|
gdk_subsurface_get_bounds (subsurface, &bounds);
|
||||||
|
gsk_rect_to_cairo_grow (&bounds, &rect);
|
||||||
|
cairo_region_subtract_rectangle (region, &rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
|
wl_region = wl_region_from_cairo_region (display, region);
|
||||||
region);
|
|
||||||
cairo_region_destroy (region);
|
cairo_region_destroy (region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
|
wl_region = wl_region_from_cairo_region (display, impl->opaque_region);
|
||||||
impl->opaque_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region);
|
wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region);
|
||||||
@@ -775,7 +783,7 @@ gdk_wayland_surface_sync (GdkSurface *surface)
|
|||||||
gdk_wayland_surface_sync_viewport (surface);
|
gdk_wayland_surface_sync_viewport (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
||||||
{
|
{
|
||||||
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
|
||||||
@@ -787,6 +795,20 @@ gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
|||||||
self->viewport_dirty;
|
self->viewport_dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gdk_wayland_surface_handle_empty_frame (GdkSurface *surface)
|
||||||
|
{
|
||||||
|
if (!gdk_wayland_surface_needs_commit (surface))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gdk_wayland_surface_sync (surface);
|
||||||
|
gdk_wayland_surface_request_frame (surface);
|
||||||
|
|
||||||
|
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||||
|
gdk_wayland_surface_commit (surface);
|
||||||
|
gdk_wayland_surface_notify_committed (surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
||||||
struct wp_fractional_scale_v1 *fractional_scale,
|
struct wp_fractional_scale_v1 *fractional_scale,
|
||||||
@@ -799,6 +821,11 @@ gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
|||||||
gdk_wayland_surface_update_size (surface,
|
gdk_wayland_surface_update_size (surface,
|
||||||
surface->width, surface->height,
|
surface->width, surface->height,
|
||||||
&GDK_FRACTIONAL_SCALE_INIT (scale));
|
&GDK_FRACTIONAL_SCALE_INIT (scale));
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||||
|
"preferred fractional scale, surface %p scale %f",
|
||||||
|
surface,
|
||||||
|
gdk_fractional_scale_to_double (&GDK_FRACTIONAL_SCALE_INIT (scale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
|
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
|
||||||
@@ -815,8 +842,8 @@ surface_enter (void *data,
|
|||||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||||
GdkMonitor *monitor;
|
GdkMonitor *monitor;
|
||||||
|
|
||||||
GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS,
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||||
"surface enter, surface %p output %p", surface, output);
|
"surface enter, surface %p output %p", surface, output);
|
||||||
|
|
||||||
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
|
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
|
||||||
|
|
||||||
@@ -848,9 +875,38 @@ surface_leave (void *data,
|
|||||||
gdk_surface_leave_monitor (surface, monitor);
|
gdk_surface_leave_monitor (surface, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
surface_preferred_buffer_scale (void *data,
|
||||||
|
struct wl_surface *wl_surface,
|
||||||
|
int32_t factor)
|
||||||
|
{
|
||||||
|
GdkSurface *surface = GDK_SURFACE (data);
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||||
|
"preferred buffer scale, surface %p scale %d",
|
||||||
|
surface, factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
surface_preferred_buffer_transform (void *data,
|
||||||
|
struct wl_surface *wl_surface,
|
||||||
|
uint32_t transform)
|
||||||
|
{
|
||||||
|
GdkSurface *surface = GDK_SURFACE (data);
|
||||||
|
const char *transform_name[] = {
|
||||||
|
"normal", "90", "180", "270", "flipped", "flipped-90", "flipped-180", "flipped-270"
|
||||||
|
};
|
||||||
|
|
||||||
|
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
|
||||||
|
"preferred buffer transform, surface %p transform %s",
|
||||||
|
surface, transform_name[transform]);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_surface_listener surface_listener = {
|
static const struct wl_surface_listener surface_listener = {
|
||||||
surface_enter,
|
surface_enter,
|
||||||
surface_leave
|
surface_leave,
|
||||||
|
surface_preferred_buffer_scale,
|
||||||
|
surface_preferred_buffer_transform,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <wayland/presentation-time-client-protocol.h>
|
#include <wayland/presentation-time-client-protocol.h>
|
||||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||||
|
#include <wayland/xdg-dialog-v1-client-protocol.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -84,6 +85,7 @@ struct _GdkWaylandToplevel
|
|||||||
struct gtk_surface1 *gtk_surface;
|
struct gtk_surface1 *gtk_surface;
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
|
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
|
||||||
|
struct xdg_dialog_v1 *xdg_dialog;
|
||||||
} display_server;
|
} display_server;
|
||||||
|
|
||||||
GdkWaylandToplevel *transient_for;
|
GdkWaylandToplevel *transient_for;
|
||||||
@@ -205,6 +207,7 @@ gdk_wayland_toplevel_clear_saved_size (GdkWaylandToplevel *toplevel)
|
|||||||
|
|
||||||
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
|
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
|
||||||
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
|
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||||
|
static gboolean maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
||||||
@@ -215,6 +218,7 @@ gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
|
|||||||
|
|
||||||
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
|
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
|
||||||
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
|
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
|
||||||
|
g_clear_pointer (&toplevel->display_server.xdg_dialog, xdg_dialog_v1_destroy);
|
||||||
|
|
||||||
if (toplevel->display_server.gtk_surface)
|
if (toplevel->display_server.gtk_surface)
|
||||||
{
|
{
|
||||||
@@ -877,7 +881,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
|
|||||||
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
|
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
|
||||||
|
|
||||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||||
|
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||||
|
|
||||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||||
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
||||||
@@ -1089,12 +1094,40 @@ maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display_wayland =
|
||||||
|
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (wayland_toplevel)));
|
||||||
|
|
||||||
|
if (!display_wayland->xdg_wm_dialog)
|
||||||
|
return FALSE;
|
||||||
|
if (!is_realized_toplevel (GDK_WAYLAND_SURFACE (wayland_toplevel)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!wayland_toplevel->display_server.xdg_dialog)
|
||||||
|
{
|
||||||
|
wayland_toplevel->display_server.xdg_dialog =
|
||||||
|
xdg_wm_dialog_v1_get_xdg_dialog (display_wayland->xdg_wm_dialog,
|
||||||
|
wayland_toplevel->display_server.xdg_toplevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDK_SURFACE (wayland_toplevel)->modal_hint)
|
||||||
|
xdg_dialog_v1_set_modal (wayland_toplevel->display_server.xdg_dialog);
|
||||||
|
else
|
||||||
|
xdg_dialog_v1_unset_modal (wayland_toplevel->display_server.xdg_dialog);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
|
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
|
||||||
gboolean modal)
|
gboolean modal)
|
||||||
{
|
{
|
||||||
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
|
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
|
||||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
|
||||||
|
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
|
||||||
|
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -77,16 +77,8 @@ static void
|
|||||||
gdk_vulkan_context_wayland_empty_frame (GdkDrawContext *context)
|
gdk_vulkan_context_wayland_empty_frame (GdkDrawContext *context)
|
||||||
{
|
{
|
||||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
|
||||||
|
|
||||||
if (!impl->has_pending_subsurface_commits)
|
gdk_wayland_surface_handle_empty_frame (surface);
|
||||||
return;
|
|
||||||
|
|
||||||
gdk_wayland_surface_sync (surface);
|
|
||||||
gdk_wayland_surface_request_frame (surface);
|
|
||||||
|
|
||||||
gdk_wayland_surface_commit (surface);
|
|
||||||
gdk_wayland_surface_notify_committed (surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display);
|
struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
|
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_DEPRECATED_IN_4_16
|
||||||
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||||
const char *name,
|
const char *name,
|
||||||
int size);
|
int size);
|
||||||
@@ -60,7 +60,7 @@ void gdk_wayland_display_set_startup_notification_id (GdkDisp
|
|||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
|
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
|
||||||
const char *global);
|
const char *global);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_4_4
|
GDK_AVAILABLE_IN_4_4
|
||||||
gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display);
|
gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display);
|
||||||
|
|||||||
+121
-65
@@ -8,6 +8,7 @@ gdk_wayland_sources = files([
|
|||||||
'gdkdevice-wayland.c',
|
'gdkdevice-wayland.c',
|
||||||
'gdkdevicepad-wayland.c',
|
'gdkdevicepad-wayland.c',
|
||||||
'gdkdisplay-wayland.c',
|
'gdkdisplay-wayland.c',
|
||||||
|
'gdkdmabuf-wayland.c',
|
||||||
'gdkdrag-wayland.c',
|
'gdkdrag-wayland.c',
|
||||||
'gdkdragsurface-wayland.c',
|
'gdkdragsurface-wayland.c',
|
||||||
'gdkdrop-wayland.c',
|
'gdkdrop-wayland.c',
|
||||||
@@ -47,82 +48,137 @@ gdk_wayland_deps = [
|
|||||||
wlegldep,
|
wlegldep,
|
||||||
]
|
]
|
||||||
|
|
||||||
wayland_scanner = find_program('wayland-scanner')
|
# Fields:
|
||||||
|
# - name: protocol name
|
||||||
# Format:
|
# - stability: protocol stability ('private', 'stable' or 'unstable')
|
||||||
# - protocol name
|
# - version: protocol version
|
||||||
# - protocol stability ('private', 'stable' or 'unstable')
|
# - required: wayland_protocols version check
|
||||||
# - protocol version (if stability is 'unstable')
|
|
||||||
proto_sources = [
|
proto_sources = [
|
||||||
['gtk-shell', 'private', ],
|
{
|
||||||
['primary-selection', 'unstable', 'v1', ],
|
'name': 'gtk-shell',
|
||||||
['pointer-gestures', 'unstable', 'v1', ],
|
'stability': 'private',
|
||||||
['viewporter', 'stable', ],
|
},
|
||||||
['xdg-shell', 'unstable', 'v6', ],
|
{
|
||||||
['xdg-shell', 'stable', ],
|
'name': 'primary-selection',
|
||||||
['xdg-foreign', 'unstable', 'v1', ],
|
'stability': 'unstable',
|
||||||
['xdg-foreign', 'unstable', 'v2', ],
|
'version': 1,
|
||||||
['tablet', 'unstable', 'v2', ],
|
},
|
||||||
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
{
|
||||||
['server-decoration', 'private' ],
|
'name': 'pointer-gestures',
|
||||||
['xdg-output', 'unstable', 'v1', ],
|
'stability': 'unstable',
|
||||||
['idle-inhibit', 'unstable', 'v1', ],
|
'version': 1,
|
||||||
['xdg-activation', 'staging', 'v1', ],
|
},
|
||||||
['fractional-scale', 'staging', 'v1', ],
|
{
|
||||||
['linux-dmabuf', 'unstable', 'v1', ],
|
'name': 'viewporter',
|
||||||
['presentation-time', 'stable', 'v1', ],
|
'stability': 'stable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-shell',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-shell',
|
||||||
|
'stability': 'stable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-foreign',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-foreign',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'tablet',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'keyboard-shortcuts-inhibit',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'server-decoration',
|
||||||
|
'stability': 'private',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-output',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'idle-inhibit',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-activation',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'fractional-scale',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'linux-dmabuf',
|
||||||
|
'stability': 'unstable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'presentation-time',
|
||||||
|
'stability': 'stable',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'single-pixel-buffer',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'xdg-dialog',
|
||||||
|
'stability': 'staging',
|
||||||
|
'version': 1,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
gdk_wayland_gen_headers = []
|
gdk_wayland_gen_headers = []
|
||||||
|
|
||||||
|
wlmod = import('unstable-wayland')
|
||||||
foreach p: proto_sources
|
foreach p: proto_sources
|
||||||
proto_name = p.get(0)
|
if wlprotocolsdep.version().version_compare(p.get('required', '>=0'))
|
||||||
proto_stability = p.get(1)
|
if p.get('stability') == 'private'
|
||||||
|
if (p.has_key('version'))
|
||||||
|
proto_file = 'protocol/@0@-v@1@.xml'.format(p.get('name'), p.get('version'))
|
||||||
|
else
|
||||||
|
proto_file = 'protocol/@0@.xml'.format(p.get('name'))
|
||||||
|
endif
|
||||||
|
elif p.get('stability') == 'stable'
|
||||||
|
proto_file = wlmod.find_protocol(p.get('name'),
|
||||||
|
state: p.get('stability'),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
proto_file = wlmod.find_protocol(p.get('name'),
|
||||||
|
state: p.get('stability'),
|
||||||
|
version: p.get('version'),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
if proto_stability == 'stable'
|
# Returns a list [.c, .h]
|
||||||
output_base = proto_name
|
gen = wlmod.scan_xml(proto_file)
|
||||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
assert(gen.length() == 2)
|
||||||
elif proto_stability == 'staging'
|
gdk_wayland_sources += gen[0]
|
||||||
proto_version = p.get(2)
|
gdk_wayland_gen_headers += gen[1]
|
||||||
output_base = '@0@-@1@'.format(proto_name, proto_version)
|
|
||||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
|
||||||
elif proto_stability == 'private'
|
|
||||||
output_base = proto_name
|
|
||||||
input = files('protocol/@0@.xml'.format(proto_name))
|
|
||||||
else
|
|
||||||
proto_version = p.get(2)
|
|
||||||
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
|
|
||||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
|
|
||||||
input: input,
|
|
||||||
output: '@0@-client-protocol.h'.format(output_base),
|
|
||||||
command: [
|
|
||||||
wayland_scanner,
|
|
||||||
'client-header',
|
|
||||||
'@INPUT@', '@OUTPUT@',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
gdk_wayland_sources += custom_target('@0@ source'.format(output_base),
|
|
||||||
input: input,
|
|
||||||
output: '@0@-protocol.c'.format(output_base),
|
|
||||||
command: [
|
|
||||||
wayland_scanner,
|
|
||||||
'private-code',
|
|
||||||
'@INPUT@', '@OUTPUT@',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
libgdk_wayland = static_library('gdk-wayland',
|
libgdk_wayland = static_library('gdk-wayland',
|
||||||
sources: [
|
sources: [ gdk_wayland_sources, gdk_wayland_gen_headers, gdk_gen_headers ],
|
||||||
gdk_wayland_sources,
|
|
||||||
gdk_wayland_gen_headers,
|
|
||||||
gdkconfig,
|
|
||||||
gdkenum_h,
|
|
||||||
],
|
|
||||||
include_directories: [ confinc, gdkinc, ],
|
include_directories: [ confinc, gdkinc, ],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DGTK_COMPILATION',
|
'-DGTK_COMPILATION',
|
||||||
|
|||||||
@@ -1408,7 +1408,7 @@ register_clipboard_notification ()
|
|||||||
WNDCLASS wclass = { 0, };
|
WNDCLASS wclass = { 0, };
|
||||||
ATOM klass;
|
ATOM klass;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkClipboardNotification";
|
wclass.lpszClassName = L"GdkClipboardNotification";
|
||||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||||
@@ -1506,9 +1506,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
|||||||
GdkWin32ContentFormatPair fmt;
|
GdkWin32ContentFormatPair fmt;
|
||||||
HMODULE user32;
|
HMODULE user32;
|
||||||
|
|
||||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||||
|
|
||||||
user32 = LoadLibrary ("user32.dll");
|
user32 = LoadLibrary (L"user32.dll");
|
||||||
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
||||||
FreeLibrary (user32);
|
FreeLibrary (user32);
|
||||||
|
|
||||||
@@ -1557,21 +1557,21 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
|||||||
* the lead and map the GDK contentformat "image/png" to the clipboard
|
* the lead and map the GDK contentformat "image/png" to the clipboard
|
||||||
* format name "PNG" etc.
|
* format name "PNG" etc.
|
||||||
*/
|
*/
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormatA ("PNG");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormat (L"PNG");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormatA ("JFIF");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormat (L"JFIF");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormatA ("GIF");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormat (L"GIF");
|
||||||
|
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormatA ("UniformResourceLocatorW");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormat (L"UniformResourceLocatorW");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormat (CFSTR_SHELLIDLIST);
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormatA ("HTML Format");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormat (L"HTML Format");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormatA ("text/html");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormat (L"text/html");
|
||||||
|
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormatA ("image/png");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormat (L"image/png");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormatA ("image/jpeg");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormat (L"image/jpeg");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormatA ("image/bmp");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormat (L"image/bmp");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormatA ("image/gif");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormat (L"image/gif");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormatA ("text/uri-list");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormat (L"text/uri-list");
|
||||||
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormatA ("text/plain;charset=utf-8");
|
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormat (L"text/plain;charset=utf-8");
|
||||||
|
|
||||||
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
|
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
|
||||||
|
|
||||||
@@ -2364,9 +2364,9 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
|
|||||||
* check?
|
* check?
|
||||||
*/
|
*/
|
||||||
(IsClipboardFormatAvailable
|
(IsClipboardFormatAvailable
|
||||||
(RegisterClipboardFormatA ("application/x-moz-nativeimage")) ||
|
(RegisterClipboardFormat (L"application/x-moz-nativeimage")) ||
|
||||||
IsClipboardFormatAvailable
|
IsClipboardFormatAvailable
|
||||||
(RegisterClipboardFormatA ("UniformResourceLocatorW"))) &&
|
(RegisterClipboardFormat (L"UniformResourceLocatorW"))) &&
|
||||||
#endif
|
#endif
|
||||||
TRUE)
|
TRUE)
|
||||||
{
|
{
|
||||||
|
|||||||
+38
-35
@@ -31,12 +31,13 @@
|
|||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
char *id;
|
const wchar_t *id;
|
||||||
} default_cursors[] = {
|
} default_cursors[] = {
|
||||||
/* -- Win32 cursor names: -- */
|
/* -- Win32 cursor names: -- */
|
||||||
{ "appstarting", IDC_APPSTARTING },
|
{ "appstarting", IDC_APPSTARTING },
|
||||||
{ "arrow", IDC_ARROW },
|
{ "arrow", IDC_ARROW },
|
||||||
{ "cross", IDC_CROSS },
|
{ "cross", IDC_CROSS },
|
||||||
|
{ "dnd-move", IDC_ARROW },
|
||||||
{ "hand", IDC_HAND },
|
{ "hand", IDC_HAND },
|
||||||
{ "help", IDC_HELP },
|
{ "help", IDC_HELP },
|
||||||
{ "ibeam", IDC_IBEAM },
|
{ "ibeam", IDC_IBEAM },
|
||||||
@@ -456,32 +457,32 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
|
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
|
||||||
result = gdk_win32_hcursor_new (display,
|
result = gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (NULL,
|
LoadImage (NULL,
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
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 (GetModuleHandle (NULL),
|
LoadImage (GetModuleHandle (NULL),
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
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 (this_module (),
|
LoadImage (this_module (),
|
||||||
(const char *) cursor->resource_name,
|
cursor->resource_name,
|
||||||
IMAGE_CURSOR,
|
IMAGE_CURSOR,
|
||||||
cursor->width,
|
cursor->width,
|
||||||
cursor->height,
|
cursor->height,
|
||||||
cursor->load_flags),
|
cursor->load_flags),
|
||||||
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
|
||||||
break;
|
break;
|
||||||
case GDK_WIN32_CURSOR_CREATE:
|
case GDK_WIN32_CURSOR_CREATE:
|
||||||
@@ -498,12 +499,12 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Win32Cursor *
|
static Win32Cursor *
|
||||||
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
win32_cursor_new (GdkWin32CursorLoadType load_type,
|
||||||
gpointer resource_name,
|
wchar_t *resource_name,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
guint load_flags,
|
guint load_flags,
|
||||||
int xcursor_number)
|
int xcursor_number)
|
||||||
{
|
{
|
||||||
Win32Cursor *result;
|
Win32Cursor *result;
|
||||||
|
|
||||||
@@ -631,9 +632,9 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
|
|
||||||
/* Prefer W32 cursors */
|
/* Prefer W32 cursors */
|
||||||
if (cursors[i].builtin)
|
if (cursors[i].builtin)
|
||||||
shared_hcursor = LoadImageA (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
shared_hcursor = LoadImage (NULL, cursors[i].builtin, IMAGE_CURSOR,
|
||||||
size, size,
|
size, size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||||
|
|
||||||
/* Fall back to X cursors, but only if we've got no theme cursor */
|
/* Fall back to X cursors, but only if we've got no theme cursor */
|
||||||
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
|
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
|
||||||
@@ -645,7 +646,7 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
DestroyCursor (x_hcursor);
|
DestroyCursor (x_hcursor);
|
||||||
|
|
||||||
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
|
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
|
||||||
(gpointer) cursors[i].builtin,
|
(wchar_t*) cursors[i].builtin,
|
||||||
size,
|
size,
|
||||||
size,
|
size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||||
@@ -660,14 +661,14 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
|
|||||||
if (default_cursors[i].name == NULL)
|
if (default_cursors[i].name == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
shared_hcursor = LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
shared_hcursor = LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
|
||||||
|
|
||||||
if (shared_hcursor == NULL)
|
if (shared_hcursor == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
|
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
|
||||||
(gpointer) default_cursors[i].id,
|
(wchar_t*) default_cursors[i].id,
|
||||||
size,
|
size,
|
||||||
size,
|
size,
|
||||||
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
|
||||||
@@ -779,8 +780,8 @@ win32hcursor_idc_from_name (GdkWin32Display *display,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
return gdk_win32_hcursor_new (display,
|
return gdk_win32_hcursor_new (display,
|
||||||
LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
|
||||||
LR_SHARED | LR_DEFAULTSIZE),
|
LR_SHARED | LR_DEFAULTSIZE),
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +885,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 (hinstance, name), FALSE);
|
return gdk_win32_hcursor_new (display, LoadCursorA (hinstance, name), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HICON
|
static HICON
|
||||||
@@ -908,7 +909,9 @@ _gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
|||||||
width = cairo_image_surface_get_width (surface);
|
width = cairo_image_surface_get_width (surface);
|
||||||
height = cairo_image_surface_get_height (surface);
|
height = cairo_image_surface_get_height (surface);
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
icon = pixbuf_to_hicon (pixbuf, is_icon, x, y);
|
icon = pixbuf_to_hicon (pixbuf, is_icon, x, y);
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ gdk_device_manager_win32_finalize (GObject *object)
|
|||||||
#if DEBUG_WINTAB
|
#if DEBUG_WINTAB
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_lc(LOGCONTEXT *lc)
|
print_lc(LOGCONTEXTA *lc)
|
||||||
{
|
{
|
||||||
g_print ("lcName = %s\n", lc->lcName);
|
g_print ("lcName = %s\n", lc->lcName);
|
||||||
g_print ("lcOptions =");
|
g_print ("lcOptions =");
|
||||||
@@ -374,13 +374,13 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
|
|
||||||
wintab_contexts = NULL;
|
wintab_contexts = NULL;
|
||||||
|
|
||||||
n = GetSystemDirectory (&dummy, 0);
|
n = GetSystemDirectoryA (&dummy, 0);
|
||||||
|
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
|
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
|
||||||
k = GetSystemDirectory (wintab32_dll_path, n);
|
k = GetSystemDirectoryA (wintab32_dll_path, n);
|
||||||
|
|
||||||
if (k == 0 || k > n)
|
if (k == 0 || k > n)
|
||||||
{
|
{
|
||||||
@@ -392,7 +392,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
|
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
|
||||||
strcat (wintab32_dll_path, WINTAB32_DLL);
|
strcat (wintab32_dll_path, WINTAB32_DLL);
|
||||||
|
|
||||||
if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL)
|
if ((wintab32 = LoadLibraryA (wintab32_dll_path)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
|
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
|
||||||
@@ -433,7 +433,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
|||||||
|
|
||||||
for (devix = 0; devix < ndevices; devix++)
|
for (devix = 0; devix < ndevices; devix++)
|
||||||
{
|
{
|
||||||
LOGCONTEXT lc;
|
LOGCONTEXTA lc;
|
||||||
|
|
||||||
/* We open the Wintab device (hmm, what if there are several, or
|
/* We open the Wintab device (hmm, what if there are several, or
|
||||||
* can there even be several, probably not?) as a system
|
* can there even be several, probably not?) as a system
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ register_display_change_notification (GdkDisplay *display)
|
|||||||
WNDCLASS wclass = { 0, };
|
WNDCLASS wclass = { 0, };
|
||||||
ATOM klass;
|
ATOM klass;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkDisplayChange";
|
wclass.lpszClassName = L"GdkDisplayChange";
|
||||||
wclass.lpfnWndProc = display_change_window_procedure;
|
wclass.lpfnWndProc = display_change_window_procedure;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
@@ -606,7 +606,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
|
|||||||
window_station_name = "WinSta0";
|
window_station_name = "WinSta0";
|
||||||
}
|
}
|
||||||
|
|
||||||
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
|
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
|
||||||
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
|
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
|
||||||
session_id = 0;
|
session_id = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ struct _GdkWin32Display
|
|||||||
guint hasWglEXTSwapControl : 1;
|
guint hasWglEXTSwapControl : 1;
|
||||||
guint hasWglOMLSyncControl : 1;
|
guint hasWglOMLSyncControl : 1;
|
||||||
guint hasWglARBPixelFormat : 1;
|
guint hasWglARBPixelFormat : 1;
|
||||||
|
guint force_enable_depth_bits : 1;
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
guint hasEglKHRCreateContext : 1;
|
guint hasEglKHRCreateContext : 1;
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ _gdk_win32_dnd_thread_main (gpointer data)
|
|||||||
/* Create a message queue */
|
/* Create a message queue */
|
||||||
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||||
|
|
||||||
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
|
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||||
|
|
||||||
/* Signal the main thread that we're ready.
|
/* Signal the main thread that we're ready.
|
||||||
* This is the only time the queue works in reverse.
|
* This is the only time the queue works in reverse.
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ set_up_low_level_keyboard_hook (void)
|
|||||||
else
|
else
|
||||||
WIN32_API_FAILED ("SetWindowsHookEx");
|
WIN32_API_FAILED ("SetWindowsHookEx");
|
||||||
|
|
||||||
aerosnap_message = RegisterWindowMessage ("GDK_WIN32_AEROSNAP_MESSAGE");
|
aerosnap_message = RegisterWindowMessage (L"GDK_WIN32_AEROSNAP_MESSAGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -470,7 +470,7 @@ _gdk_events_init (GdkDisplay *display)
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
|
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Check if we have some input locale identifier loaded that uses a
|
/* Check if we have some input locale identifier loaded that uses a
|
||||||
@@ -1685,7 +1685,7 @@ _gdk_win32_surface_fill_min_max_info (GdkSurface *window,
|
|||||||
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||||
nearest_info.cbSize = sizeof (nearest_info);
|
nearest_info.cbSize = sizeof (nearest_info);
|
||||||
|
|
||||||
if (GetMonitorInfoA (nearest_monitor, &nearest_info))
|
if (GetMonitorInfo (nearest_monitor, &nearest_info))
|
||||||
{
|
{
|
||||||
/* MSDN says that we must specify maximized window
|
/* MSDN says that we must specify maximized window
|
||||||
* size as if it was located on the primary monitor.
|
* size as if it was located on the primary monitor.
|
||||||
@@ -3071,20 +3071,6 @@ gdk_event_translate (MSG *msg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((windowpos->flags & SWP_HIDEWINDOW) &&
|
|
||||||
!GDK_SURFACE_DESTROYED (window))
|
|
||||||
{
|
|
||||||
/* Make transient parent the foreground window when window unmaps */
|
|
||||||
impl = GDK_WIN32_SURFACE (window);
|
|
||||||
|
|
||||||
if (impl->transient_owner &&
|
|
||||||
GetForegroundWindow () == GDK_SURFACE_HWND (window))
|
|
||||||
{
|
|
||||||
SetForegroundWindow (GDK_SURFACE_HWND (impl->transient_owner));
|
|
||||||
SetCapture (GDK_SURFACE_HWND (impl->transient_owner));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(windowpos->flags & SWP_NOCLIENTSIZE))
|
if (!(windowpos->flags & SWP_NOCLIENTSIZE))
|
||||||
{
|
{
|
||||||
if (window->resize_count > 1)
|
if (window->resize_count > 1)
|
||||||
|
|||||||
@@ -142,8 +142,7 @@ get_wgl_pfd (HDC hdc,
|
|||||||
|
|
||||||
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
||||||
|
|
||||||
if (display_win32 != NULL &&
|
if (display_win32->hasWglARBPixelFormat)
|
||||||
display_win32->hasWglARBPixelFormat)
|
|
||||||
{
|
{
|
||||||
UINT num_formats;
|
UINT num_formats;
|
||||||
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||||
@@ -176,15 +175,18 @@ get_wgl_pfd (HDC hdc,
|
|||||||
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
||||||
pixelAttribs[i++] = 8;
|
pixelAttribs[i++] = 8;
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
|
||||||
pixelAttribs[i++] = 0;
|
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
||||||
pixelAttribs[i++] = 0;
|
pixelAttribs[i++] = 0;
|
||||||
|
|
||||||
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
||||||
pixelAttribs[i++] = 0;
|
pixelAttribs[i++] = 0;
|
||||||
|
|
||||||
|
if (!display_win32->force_enable_depth_bits)
|
||||||
|
{
|
||||||
|
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||||
|
pixelAttribs[i++] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
||||||
|
|
||||||
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
||||||
@@ -215,8 +217,20 @@ get_wgl_pfd (HDC hdc,
|
|||||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||||
pfd->cAlphaBits = 8;
|
pfd->cAlphaBits = 8;
|
||||||
pfd->iLayerType = PFD_MAIN_PLANE;
|
pfd->iLayerType = PFD_MAIN_PLANE;
|
||||||
|
pfd->cAccumBits = 0;
|
||||||
|
pfd->cStencilBits = 0;
|
||||||
|
|
||||||
|
if (!display_win32->force_enable_depth_bits)
|
||||||
|
pfd->cDepthBits = 0;
|
||||||
|
|
||||||
best_pf = ChoosePixelFormat (hdc, pfd);
|
best_pf = ChoosePixelFormat (hdc, pfd);
|
||||||
|
|
||||||
|
/* try again if driver enforces depth buffers */
|
||||||
|
if (best_pf == 0 && !display_win32->force_enable_depth_bits)
|
||||||
|
{
|
||||||
|
display_win32->force_enable_depth_bits = TRUE;
|
||||||
|
get_wgl_pfd (hdc, pfd, display_win32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return best_pf;
|
return best_pf;
|
||||||
@@ -234,7 +248,7 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
|
|||||||
|
|
||||||
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
||||||
|
|
||||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, NULL);
|
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, display_win32);
|
||||||
|
|
||||||
if (best_idx != 0)
|
if (best_idx != 0)
|
||||||
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
||||||
@@ -267,9 +281,9 @@ create_dummy_gl_window (void)
|
|||||||
{
|
{
|
||||||
WNDCLASS wclass = { 0, };
|
WNDCLASS wclass = { 0, };
|
||||||
ATOM klass;
|
ATOM klass;
|
||||||
HWND hwnd;
|
HWND hwnd = NULL;
|
||||||
|
|
||||||
wclass.lpszClassName = "GdkGLDummyWindow";
|
wclass.lpszClassName = L"GdkGLDummyWindow";
|
||||||
wclass.lpfnWndProc = DefWindowProc;
|
wclass.lpfnWndProc = DefWindowProc;
|
||||||
wclass.hInstance = this_module ();
|
wclass.hInstance = this_module ();
|
||||||
wclass.style = CS_OWNDC;
|
wclass.style = CS_OWNDC;
|
||||||
|
|||||||
@@ -730,7 +730,7 @@ _gdk_win32_key_to_string (LONG lParam)
|
|||||||
char buf[100];
|
char buf[100];
|
||||||
char *keyname_utf8;
|
char *keyname_utf8;
|
||||||
|
|
||||||
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
|
if (GetKeyNameTextA (lParam, buf, sizeof (buf)) &&
|
||||||
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
|
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
|
||||||
{
|
{
|
||||||
char *retval = static_printf ("%s", keyname_utf8);
|
char *retval = static_printf ("%s", keyname_utf8);
|
||||||
@@ -780,7 +780,7 @@ _gdk_win32_cf_to_string (UINT format)
|
|||||||
if (format >= CF_PRIVATEFIRST &&
|
if (format >= CF_PRIVATEFIRST &&
|
||||||
format <= CF_PRIVATELAST)
|
format <= CF_PRIVATELAST)
|
||||||
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
|
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
|
||||||
if (GetClipboardFormatName (format, buf, sizeof (buf)))
|
if (GetClipboardFormatNameA (format, buf, sizeof (buf)))
|
||||||
return static_printf ("'%s'", buf);
|
return static_printf ("'%s'", buf);
|
||||||
else
|
else
|
||||||
return static_printf ("unk-%#lx", format);
|
return static_printf ("unk-%#lx", format);
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ typedef struct _Win32Cursor Win32Cursor;
|
|||||||
|
|
||||||
struct _Win32Cursor {
|
struct _Win32Cursor {
|
||||||
GdkWin32CursorLoadType load_type;
|
GdkWin32CursorLoadType load_type;
|
||||||
gunichar2 *resource_name;
|
wchar_t *resource_name;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
guint load_flags;
|
guint load_flags;
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
static WNDCLASSEXW wcl;
|
static WNDCLASSEXW wcl;
|
||||||
ATOM klass = 0;
|
ATOM klass = 0;
|
||||||
|
|
||||||
wcl.cbSize = sizeof (WNDCLASSEX);
|
wcl.cbSize = sizeof (WNDCLASSEXW);
|
||||||
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
||||||
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
||||||
*/
|
*/
|
||||||
@@ -340,7 +340,7 @@ RegisterGdkClass (GType wtype)
|
|||||||
/* initialize once! */
|
/* initialize once! */
|
||||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||||
{
|
{
|
||||||
char sLoc [MAX_PATH+1];
|
wchar_t sLoc [MAX_PATH+1];
|
||||||
|
|
||||||
// try to load first icon of executable program
|
// try to load first icon of executable program
|
||||||
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
||||||
@@ -2064,7 +2064,7 @@ stash_window (GdkSurface *window,
|
|||||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||||
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
||||||
|
|
||||||
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
|
if (!GetMonitorInfo (hmonitor, &hmonitor_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (impl->snap_stash == NULL)
|
if (impl->snap_stash == NULL)
|
||||||
@@ -4200,82 +4200,13 @@ BOOL WINAPI
|
|||||||
GtkShowWindow (GdkSurface *window,
|
GtkShowWindow (GdkSurface *window,
|
||||||
int cmd_show)
|
int cmd_show)
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
RECT window_rect;
|
|
||||||
HDC hdc;
|
|
||||||
POINT window_position;
|
|
||||||
SIZE window_size;
|
|
||||||
POINT source_point;
|
|
||||||
BLENDFUNCTION blender;
|
|
||||||
|
|
||||||
HWND hwnd = GDK_SURFACE_HWND (window);
|
|
||||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||||
|
|
||||||
switch (cmd_show)
|
|
||||||
{
|
|
||||||
case SW_FORCEMINIMIZE:
|
|
||||||
case SW_HIDE:
|
|
||||||
case SW_MINIMIZE:
|
|
||||||
break;
|
|
||||||
case SW_MAXIMIZE:
|
|
||||||
case SW_RESTORE:
|
|
||||||
case SW_SHOW:
|
|
||||||
case SW_SHOWDEFAULT:
|
|
||||||
case SW_SHOWMINIMIZED:
|
|
||||||
case SW_SHOWMINNOACTIVE:
|
|
||||||
case SW_SHOWNA:
|
|
||||||
case SW_SHOWNOACTIVATE:
|
|
||||||
case SW_SHOWNORMAL:
|
|
||||||
if (IsWindowVisible (hwnd))
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Window was hidden, will be shown. Erase it, GDK will repaint soon,
|
|
||||||
* but not soon enough, so it's possible to see old content before
|
|
||||||
* the next redraw, unless we erase the window first.
|
|
||||||
*/
|
|
||||||
GetWindowRect (hwnd, &window_rect);
|
|
||||||
source_point.x = source_point.y = 0;
|
|
||||||
|
|
||||||
window_position.x = window_rect.left;
|
|
||||||
window_position.y = window_rect.top;
|
|
||||||
window_size.cx = window_rect.right - window_rect.left;
|
|
||||||
window_size.cy = window_rect.bottom - window_rect.top;
|
|
||||||
|
|
||||||
blender.BlendOp = AC_SRC_OVER;
|
|
||||||
blender.BlendFlags = 0;
|
|
||||||
blender.AlphaFormat = AC_SRC_ALPHA;
|
|
||||||
blender.SourceConstantAlpha = 255;
|
|
||||||
|
|
||||||
/* Create a surface of appropriate size and clear it */
|
|
||||||
surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
|
||||||
window_size.cx,
|
|
||||||
window_size.cy);
|
|
||||||
cairo_surface_set_device_scale (surface, impl->surface_scale, impl->surface_scale);
|
|
||||||
cr = cairo_create (surface);
|
|
||||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
||||||
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
|
|
||||||
cairo_paint (cr);
|
|
||||||
cairo_destroy (cr);
|
|
||||||
cairo_surface_flush (surface);
|
|
||||||
hdc = cairo_win32_surface_get_dc (surface);
|
|
||||||
|
|
||||||
/* No API_CALL() wrapper, don't check for errors */
|
|
||||||
UpdateLayeredWindow (hwnd, NULL,
|
|
||||||
&window_position, &window_size,
|
|
||||||
hdc, &source_point,
|
|
||||||
0, &blender, ULW_ALPHA);
|
|
||||||
|
|
||||||
cairo_surface_destroy (surface);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure that maximized window size is corrected later on */
|
/* Ensure that maximized window size is corrected later on */
|
||||||
if (cmd_show == SW_MAXIMIZE)
|
if (cmd_show == SW_MAXIMIZE)
|
||||||
impl->maximizing = TRUE;
|
impl->maximizing = TRUE;
|
||||||
|
|
||||||
return ShowWindow (hwnd, cmd_show);
|
return ShowWindow (GDK_SURFACE_HWND (window), cmd_show);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -4804,10 +4735,7 @@ gdk_win32_toplevel_set_property (GObject *object,
|
|||||||
GDK_SURFACE (surface)->modal_hint = g_value_get_boolean (value);
|
GDK_SURFACE (surface)->modal_hint = g_value_get_boolean (value);
|
||||||
|
|
||||||
if (GDK_SURFACE (surface)->modal_hint)
|
if (GDK_SURFACE (surface)->modal_hint)
|
||||||
{
|
_gdk_push_modal_window (surface);
|
||||||
SetCapture (GDK_SURFACE_HWND (surface));
|
|
||||||
_gdk_push_modal_window (surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
|||||||
{
|
{
|
||||||
GdkSurface *window = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
GdkSurface *window = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||||
GdkWin32Surface *win32_surface = GDK_WIN32_SURFACE (window);
|
|
||||||
VkWin32SurfaceCreateInfoKHR info;
|
VkWin32SurfaceCreateInfoKHR info;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ gdk_win32_deps = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
libgdk_win32 = static_library('gdk-win32',
|
libgdk_win32 = static_library('gdk-win32',
|
||||||
gdk_win32_sources, gdkconfig, gdkenum_h,
|
sources: [ gdk_win32_sources, gdk_gen_headers ],
|
||||||
include_directories: [ confinc, gdkinc ],
|
include_directories: [ confinc, gdkinc ],
|
||||||
c_args: [
|
c_args: [
|
||||||
'-DGTK_COMPILATION',
|
'-DGTK_COMPILATION',
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user