Compare commits
510 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1038c5d19 | |||
| b16b44f1ae | |||
| 37c151ce0f | |||
| eb7ad4bbad | |||
| cdec487998 | |||
| 80d3c68615 | |||
| ed4b3f8033 | |||
| 451e7a5ad2 | |||
| 89360b26af | |||
| d3d4fe14c2 | |||
| 040175cd92 | |||
| 64b0c63190 | |||
| 8ff540eb4c | |||
| 9194b7388f | |||
| 6831d3e28e | |||
| 800f1c03d5 | |||
| 7a0355fcb1 | |||
| 15d58a868a | |||
| 61f21fc9e9 | |||
| 9e068d3a46 | |||
| 2aa136a19c | |||
| 1dfd514f7f | |||
| 08fbd012ec | |||
| 638508fa20 | |||
| ce6c7bae51 | |||
| 19f7b7ed40 | |||
| e3dba28666 | |||
| 88aa548965 | |||
| 17a9b13af2 | |||
| 1efa781a19 | |||
| 0a19d7ef08 | |||
| 926fb208ba | |||
| e76dee07c5 | |||
| 11a43cf554 | |||
| a7218da202 | |||
| ed362fcc5b | |||
| 17ec74da35 | |||
| 754d6d1a04 | |||
| ff53d5ba11 | |||
| 7233a70d47 | |||
| 12990b3520 | |||
| 95d807ab61 | |||
| 8a1a96a47e | |||
| c31916081f | |||
| 0a1e19f4e3 | |||
| 7d3f3b7ab8 | |||
| 432b741ab7 | |||
| 703f18ce66 | |||
| 4da82bde7b | |||
| feee281cf8 | |||
| 443fd4d63d | |||
| 4b346538e2 | |||
| 0ee58e9ef4 | |||
| bd56bc9055 | |||
| 3e7e862415 | |||
| 4eeb413047 | |||
| 661f3466c2 | |||
| e735554ced | |||
| 520ea7c39d | |||
| ffa345e4ab | |||
| e072d9b28b | |||
| 9f5b04e65c | |||
| d08310096c | |||
| 20d0d6fae2 | |||
| 6b9ac1043b | |||
| c5b4066714 | |||
| b09b2dd2cd | |||
| 72a0828101 | |||
| 7379c34a39 | |||
| 6cd1b9955b | |||
| a6a31827bc | |||
| 84939a612c | |||
| 394ea32e93 | |||
| 2bd36d490b | |||
| ad1bc75dd2 | |||
| 7505c1fd7c | |||
| 8780906b93 | |||
| 0ed2e970be | |||
| 58253d567f | |||
| c09c61769c | |||
| 9b5dc35650 | |||
| 3c9ada14fe | |||
| 6b4d6c3771 | |||
| b15f16e8db | |||
| e3b9dfef1c | |||
| 822c2aba36 | |||
| a11f9fea76 | |||
| f16c829190 | |||
| 16c820c2f0 | |||
| 72ae6daa1e | |||
| 35ba24d2e8 | |||
| 508cb6160c | |||
| b9a76ddd75 | |||
| 038190c5a8 | |||
| 2ae08e632c | |||
| 99eed078bd | |||
| 6720552afd | |||
| 6f01508aa8 | |||
| 632524f679 | |||
| 22e1827f84 | |||
| 3c39613d9c | |||
| 46ff9f891a | |||
| 97ff1b83dc | |||
| 9416856420 | |||
| c1459cc45b | |||
| 4fe8c037c7 | |||
| b1afe5ff23 | |||
| bbd4fb8798 | |||
| b3b29e37fd | |||
| f996ba6585 | |||
| 7ca36cd2d4 | |||
| 2a18f2150d | |||
| a65fd81106 | |||
| ff8217db40 | |||
| a3861bf9a0 | |||
| b86c1446a4 | |||
| 9ce58bdb0c | |||
| 9f252f0ceb | |||
| 7008a531bb | |||
| 458b8a6554 | |||
| 307cc69adb | |||
| ab6b5ae568 | |||
| 0e601c0a70 | |||
| 5425edff82 | |||
| 213c471bb7 | |||
| 9ae0fe7f3a | |||
| abe6876f7c | |||
| 53d74fd2dc | |||
| 3f0a830f3c | |||
| e0323fcdc2 | |||
| cd5cded430 | |||
| 54e4e6cd23 | |||
| 59852d3425 | |||
| d701a89281 | |||
| 5e095cd208 | |||
| d2bdf3d5a1 | |||
| e692385baa | |||
| 1e8df851e9 | |||
| 904db0a8f7 | |||
| 6b7cc8baa6 | |||
| 71fe843d99 | |||
| 552a681816 | |||
| 2f0016eb08 | |||
| f87291cac2 | |||
| 37c3ba2645 | |||
| ba05787a06 | |||
| 12b97ffd24 | |||
| 1ae60cb713 | |||
| 3371e3aa49 | |||
| baeae71d12 | |||
| f8be3229b1 | |||
| b9cfcf07e0 | |||
| eb649d8204 | |||
| 4a00f3bc9a | |||
| 0b17658a82 | |||
| 2486f46c0b | |||
| c03b7e4d45 | |||
| e7a8a4eb06 | |||
| 70fbf8dbb6 | |||
| 93a1b3027d | |||
| 1de7719e34 | |||
| f7f103a322 | |||
| 14be8f6b73 | |||
| 99a344f791 | |||
| 3419d9c04f | |||
| c297d45b8a | |||
| dce8d251c6 | |||
| 89ad7893ad | |||
| da6faf321c | |||
| c8b791a763 | |||
| 0eb728aa51 | |||
| 3300686bef | |||
| 0a96a483c6 | |||
| 5071367794 | |||
| 5ce05a8fd0 | |||
| be2a0971c2 | |||
| 25e9a54902 | |||
| df1c6b6b68 | |||
| 00c791fcf9 | |||
| a5e73820da | |||
| 7fa103717d | |||
| f8646b9733 | |||
| d110fddbce | |||
| b02db72e17 | |||
| e8f30c836d | |||
| 6eaadba008 | |||
| 4495bacfd1 | |||
| 234a21905c | |||
| 13213c710f | |||
| e165267924 | |||
| 00b25d5594 | |||
| 31fb5c287a | |||
| 416ec580dc | |||
| ee14be8ac1 | |||
| f27470aaf4 | |||
| 90eda2b17c | |||
| 68d43c8e5c | |||
| c9aef3fc4d | |||
| e8330c5eec | |||
| 531766fe64 | |||
| 25a53276e0 | |||
| 1149502767 | |||
| 33928a52c3 | |||
| b636df7784 | |||
| 005739371c | |||
| ec854fc503 | |||
| e75e975a38 | |||
| 2bf81b51d9 | |||
| 22211f29fb | |||
| 8991275fbd | |||
| f2d6a7b36a | |||
| e43eb951d6 | |||
| 5205fa0ff7 | |||
| 842af79e97 | |||
| 6b292af6ac | |||
| 1424dd9786 | |||
| 339d3e41b0 | |||
| 9a2f7338df | |||
| bdb127e54c | |||
| e5d23aaaaf | |||
| d662512c44 | |||
| 324af2f701 | |||
| de481a7b5e | |||
| c8018e267a | |||
| 4e264a74be | |||
| 4f49d83e43 | |||
| eaef24c527 | |||
| 777435c470 | |||
| fb325afc79 | |||
| 046190cb8a | |||
| 53592497a4 | |||
| cffa45d5ff | |||
| 14166b09b5 | |||
| 8a0035333a | |||
| 1f8e633fff | |||
| 6e6b4a851f | |||
| 7444b15d47 | |||
| dd625abfc1 | |||
| b6f6df9662 | |||
| aaa4e40a1f | |||
| 8ec254e2bb | |||
| 2a9911724f | |||
| a9b4ac3d59 | |||
| 9df7f0197d | |||
| f169d23cdb | |||
| fcd36e59b1 | |||
| 8196478b19 | |||
| e31bbb41d2 | |||
| 9c948909ac | |||
| 544b8d5a7f | |||
| 6ae5d9ac22 | |||
| 63c6af8d13 | |||
| 199a539ae7 | |||
| dc3d778e01 | |||
| 2154b8e745 | |||
| 9f93464ea4 | |||
| 5987bc5d71 | |||
| 298218b1d2 | |||
| fa7f6ad910 | |||
| b92b7f45b5 | |||
| 2bacc0d4ef | |||
| e4fb4b635c | |||
| 5432f73095 | |||
| 2f64651a3f | |||
| 0852d66f6e | |||
| f3e826f4d6 | |||
| 15eb3bbbf1 | |||
| 96f822434f | |||
| ace183f38f | |||
| 5bf030413b | |||
| 2a3dab5b94 | |||
| 96f0c26306 | |||
| 8cf41c1b66 | |||
| 027ca22def | |||
| bd55c5842e | |||
| c3ff175e3f | |||
| b22c7b8b77 | |||
| 83027c68f1 | |||
| 44931a66df | |||
| 36d986f33c | |||
| 5ac73be976 | |||
| a07a69e24e | |||
| 3e1f59af61 | |||
| da47ccaf3c | |||
| e9082fd9f3 | |||
| 61e88c7421 | |||
| de31bb59a1 | |||
| 07bb29153b | |||
| b35e5eeaf6 | |||
| c0a450e41b | |||
| 785b33f169 | |||
| af749dc1dc | |||
| 47982ae272 | |||
| 0020b735d9 | |||
| e05c1b0244 | |||
| d0b4f9eb29 | |||
| 03375b723a | |||
| e2beb6ec50 | |||
| ef32cff771 | |||
| 366b007024 | |||
| 40337aa1b3 | |||
| 0bb38b903e | |||
| 8acd9ffc76 | |||
| 23b29341ba | |||
| 6e52820fd2 | |||
| 173b1333ca | |||
| 784d6f8d0c | |||
| 3437f85aaf | |||
| 7916b95bc5 | |||
| 7b135c96e4 | |||
| e662438675 | |||
| aa2ca80817 | |||
| 9ccd514682 | |||
| 2c7afc0556 | |||
| 182cb81bdb | |||
| ceef86895f | |||
| 001d076e61 | |||
| 408dd37944 | |||
| 9287e0e7fb | |||
| 28eb1fce04 | |||
| 49427119ab | |||
| 05891b1238 | |||
| b14d99ad7a | |||
| 329638280c | |||
| 06365cdc38 | |||
| 1f808c479a | |||
| 7e8d61b92c | |||
| d01e664c79 | |||
| 858997d172 | |||
| f3d061e879 | |||
| e2c327e025 | |||
| 48910a6d8e | |||
| fbed55dff9 | |||
| 059917b83c | |||
| 163aa82d45 | |||
| ba25e08e7b | |||
| bc2c341d60 | |||
| 7e0266004e | |||
| 93d54ba10b | |||
| 5d07a66d1d | |||
| 8997dc6f31 | |||
| 9f72f4225d | |||
| f1003d6ae8 | |||
| b1327167e2 | |||
| 6719d3044d | |||
| c75fdda8dd | |||
| 170e8bd605 | |||
| 96ccb25f97 | |||
| c3c06e60dc | |||
| ecb8dda309 | |||
| f7975828bc | |||
| 5fdb897f06 | |||
| 8ab2e31b58 | |||
| 0d710b0353 | |||
| 06fe4f0205 | |||
| 910dd7a20a | |||
| 8d8990ccd7 | |||
| bf3ccaa1bf | |||
| eaa20f5cdf | |||
| d07e22dc03 | |||
| 1ec2d1d9f1 | |||
| f59cd392ba | |||
| 6bacb0b0ae | |||
| 530b571d89 | |||
| ce22ef18f9 | |||
| 591f6bd7a9 | |||
| 642503afb4 | |||
| fc0b0b14a8 | |||
| 2de4fc3ec0 | |||
| b2ac42e576 | |||
| b19d4b9006 | |||
| 2c28a0713d | |||
| b423f974db | |||
| 4a430820bd | |||
| 5153cdc01d | |||
| 1db5382c6d | |||
| 6e8c78714d | |||
| 457b6657bb | |||
| 1ddd8586dd | |||
| 5ea45bf57d | |||
| 4e978d6b7a | |||
| b4722b43a1 | |||
| fd95cc56b1 | |||
| d66121c61e | |||
| 35332eb3b0 | |||
| 586e7749d5 | |||
| 904835d4b1 | |||
| cb821d5df3 | |||
| ff056af249 | |||
| 9cce474106 | |||
| 9d84996fea | |||
| c2d77a1f37 | |||
| 54a0037c45 | |||
| 80b988ef6c | |||
| 844801580f | |||
| 28b05eea67 | |||
| ca1d4322a2 | |||
| c94ec4a204 | |||
| 778d884f70 | |||
| e8be45fabc | |||
| c90b0581dd | |||
| 43c0ea676d | |||
| bb4fbe3d8f | |||
| 7c4d8d49b6 | |||
| cac39526a9 | |||
| 4c45410d43 | |||
| 8e9218df03 | |||
| 541c478eeb | |||
| 78e3e42042 | |||
| 33045c3e0b | |||
| 7974751e24 | |||
| daa7d9072d | |||
| 90a34312d4 | |||
| 580863b112 | |||
| fb6a8f5fc1 | |||
| c2e2e2993b | |||
| 5763514ab8 | |||
| 4c5d8547be | |||
| 34987c0b5c | |||
| 3cd4eb0310 | |||
| a1e9ae5259 | |||
| e738a4d129 | |||
| 1ec950d14a | |||
| 92e20deca1 | |||
| cd0332aad5 | |||
| cdd33bbee6 | |||
| bca1f6b64f | |||
| 9b99b89807 | |||
| 62f96bfda6 | |||
| 2c62cde780 | |||
| aab10ea43b | |||
| 9428807c57 | |||
| 21e6e4c026 | |||
| bde4cbe377 | |||
| 0b7e74318b | |||
| e398f63bf6 | |||
| 2244eeb727 | |||
| c3af47f5d9 | |||
| 730154df7d | |||
| 2309e1dd38 | |||
| 90c7f4608a | |||
| 66102dacf1 | |||
| d84b60e5f9 | |||
| 9a03c8b4d8 | |||
| f02521c502 | |||
| c1247a7993 | |||
| b2a747b4d4 | |||
| c1ee2fd54a | |||
| 4c7b00fd20 | |||
| 3fba7f9dce | |||
| 7ca4a94768 | |||
| 1df0a5eab5 | |||
| 6a005c815e | |||
| cb09211ace | |||
| e430e0e2ff | |||
| 6ad1078595 | |||
| cd7e9dcc27 | |||
| 8752f613d7 | |||
| f54d3a3aca | |||
| db525ef213 | |||
| 3f00e42ec9 | |||
| d5fa5b9594 | |||
| 2e5fc35e51 | |||
| 6ff94f3637 | |||
| 80888d7111 | |||
| 48b46c8d08 | |||
| df457cadfc | |||
| 58e8f2332d | |||
| 376dc4d169 | |||
| dfd81f9c64 | |||
| 6d418134ee | |||
| 02646d74f4 | |||
| d62be573ad | |||
| 17eef48835 | |||
| 7ffea02eb4 | |||
| 0b75edc0e1 | |||
| d4bba7de88 | |||
| a8902da4bc | |||
| 8ff18b3d39 | |||
| 81fa63260e | |||
| 6d452f1eb8 | |||
| d51b8ff058 | |||
| b11263ae91 | |||
| 0eb1228902 | |||
| d8603864a9 | |||
| f9ee703af4 | |||
| a232107122 | |||
| 27834b04ae | |||
| cbe207a8de | |||
| 1cab5e03ca | |||
| f8c523fa72 | |||
| e17db0abde | |||
| cc9c45a47a | |||
| a9c3a33620 | |||
| f61d520ab1 | |||
| 7672e6c833 | |||
| faf61cd112 | |||
| 1308ecb0ae | |||
| 4f6096947e | |||
| dc18572a59 | |||
| 8493ebfe98 | |||
| 5870d9d72a | |||
| b5b836668a | |||
| c155ac98c8 | |||
| 600952e295 | |||
| 3b2adf5d1f | |||
| 56d99ab5cd | |||
| 29c9776daa | |||
| eb8e0910c3 | |||
| cfc44e09a0 |
+5
-5
@@ -27,14 +27,14 @@ variables:
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: .pre
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
@@ -66,7 +66,7 @@ fedora-x86_64:
|
||||
<<: *cache-paths
|
||||
|
||||
release-build:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
@@ -168,7 +168,7 @@ flatpak-master:icon-browser:
|
||||
<<: *flatpak-master
|
||||
|
||||
static-scan:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: analysis
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug"
|
||||
@@ -181,7 +181,7 @@ static-scan:
|
||||
allow_failure: true
|
||||
|
||||
reference:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: docs
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
|
||||
@@ -82,7 +82,7 @@ RUN dnf -y install \
|
||||
xorg-x11-server-Xvfb \
|
||||
&& dnf clean all
|
||||
|
||||
RUN pip3 install meson==0.52.1
|
||||
RUN pip3 install meson==0.53.1
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
|
||||
@@ -174,7 +174,7 @@ ul.images li {
|
||||
<div class="failures">
|
||||
<h4><a name="{{ suite_result.suite_name }}-failed">Failures</a></h4>
|
||||
<ul class="failed">
|
||||
{% for failure in suite_result.failures if failure.result in [ 'FAIL', 'UNEXPECTEDPASS' ] %}
|
||||
{% for failure in suite_result.failures if failure.result in [ 'ERROR', 'FAIL', 'UNEXPECTEDPASS' ] %}
|
||||
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
|
||||
{% if failure.stdout %}
|
||||
Output: <pre>{{ failure.stdout }}</pre>
|
||||
@@ -207,24 +207,6 @@ ul.images li {
|
||||
</div>
|
||||
|
||||
<div class="successes">
|
||||
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
|
||||
<ul>
|
||||
{% for success in suite_result.successes if success.result == 'SKIP' %}
|
||||
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
|
||||
<ul class="passed">
|
||||
{% for success in suite_result.successes if success.result == 'OK' %}
|
||||
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4><a name="{{ suite_result.suite_name }}-expected-fail">Expected failures</a></h4>
|
||||
<ul>
|
||||
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
|
||||
@@ -244,6 +226,24 @@ ul.images li {
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
|
||||
<ul>
|
||||
{% for success in suite_result.successes if success.result == 'SKIP' %}
|
||||
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
|
||||
<ul class="passed">
|
||||
{% for success in suite_result.successes if success.result == 'OK' %}
|
||||
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -331,7 +331,7 @@ for name, units in suites.items():
|
||||
print('Processing {} suite {}:'.format(project_name, suite_name))
|
||||
|
||||
def if_failed(unit):
|
||||
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
|
||||
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT', 'ERROR',]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ for name, units in suites.items():
|
||||
print('Processing suite {} (units: {})'.format(name, len(units)))
|
||||
|
||||
def if_failed(unit):
|
||||
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
|
||||
if unit['result'] in ['ERROR', 'FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
Overview of Changes in GTK 3.98.2
|
||||
=================================
|
||||
|
||||
* Introduce GtkShortcutController, and replace key bindings,
|
||||
mnemonics and accelerators by GtkShortcut
|
||||
|
||||
* Derive the HighContrast theme from Adwaita
|
||||
|
||||
* GtkMenuButton: Add a use-underline property
|
||||
|
||||
* GtkTreeView: Fix cell editing
|
||||
|
||||
* Add gdk_toplevel_inhibit_system_shortcuts
|
||||
|
||||
* gtk-demo: Fix issues in multiple demos
|
||||
|
||||
* Translation updates:
|
||||
Polish
|
||||
|
||||
|
||||
Overview of Changes in GTK 3.98.1
|
||||
=================================
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ constraint_view_add_child (ConstraintView *view,
|
||||
|
||||
label = gtk_label_new (name);
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "child");
|
||||
gtk_widget_add_css_class (frame, "child");
|
||||
gtk_widget_set_name (frame, name);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_set_parent (frame, GTK_WIDGET (view));
|
||||
@@ -257,7 +257,7 @@ constraint_view_add_guide (ConstraintView *view,
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
|
||||
gtk_widget_add_css_class (frame, "guide");
|
||||
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
<attribute name="accel"><Control>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/*static GtkWidget *assistant = NULL;*/
|
||||
static GtkWidget *progress_bar = NULL;
|
||||
|
||||
static gboolean
|
||||
@@ -42,10 +41,7 @@ on_assistant_apply (GtkWidget *widget, gpointer data)
|
||||
static void
|
||||
on_assistant_close_cancel (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkWidget **assistant = (GtkWidget **) data;
|
||||
|
||||
gtk_widget_destroy (*assistant);
|
||||
*assistant = NULL;
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -182,6 +178,8 @@ do_assistant (GtkWidget *do_widget)
|
||||
|
||||
gtk_window_set_display (GTK_WINDOW (assistant),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (assistant, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &assistant);
|
||||
|
||||
create_page1 (assistant);
|
||||
create_page2 (assistant);
|
||||
@@ -189,9 +187,9 @@ do_assistant (GtkWidget *do_widget)
|
||||
create_page4 (assistant);
|
||||
|
||||
g_signal_connect (G_OBJECT (assistant), "cancel",
|
||||
G_CALLBACK (on_assistant_close_cancel), &assistant);
|
||||
G_CALLBACK (on_assistant_close_cancel), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "close",
|
||||
G_CALLBACK (on_assistant_close_cancel), &assistant);
|
||||
G_CALLBACK (on_assistant_close_cancel), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "apply",
|
||||
G_CALLBACK (on_assistant_apply), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "prepare",
|
||||
@@ -201,10 +199,7 @@ do_assistant (GtkWidget *do_widget)
|
||||
if (!gtk_widget_get_visible (assistant))
|
||||
gtk_widget_show (assistant);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (assistant);
|
||||
assistant = NULL;
|
||||
}
|
||||
gtk_widget_destroy (assistant);
|
||||
|
||||
return assistant;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="min-content-width">150</property>
|
||||
|
||||
@@ -131,13 +131,11 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
GtkAlign valign, halign;
|
||||
gboolean is_left, is_right, is_top, is_bottom;
|
||||
gboolean has_left, has_right, has_top, has_bottom;
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (child);
|
||||
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
|
||||
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
|
||||
is_left = is_right = is_top = is_bottom = FALSE;
|
||||
|
||||
@@ -160,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
is_bottom = (child_allocation->y + child_allocation->height == height);
|
||||
|
||||
if (has_left && !is_left)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
else if (!has_left && is_left)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
|
||||
if (has_right && !is_right)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
else if (!has_right && is_right)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
|
||||
if (has_top && !is_top)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
else if (!has_top && is_top)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
|
||||
if (has_bottom && !is_bottom)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
else if (!has_bottom && is_bottom)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -104,6 +104,10 @@
|
||||
<file>gtkfishbowl.c</file>
|
||||
<file>gtkfishbowl.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/gears">
|
||||
<file>gtkgears.c</file>
|
||||
<file>gtkgears.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/iconscroll">
|
||||
<file>iconscroll.ui</file>
|
||||
</gresource>
|
||||
@@ -176,6 +180,7 @@
|
||||
<file>font_features.c</file>
|
||||
<file>fontplane.c</file>
|
||||
<file>fontrendering.c</file>
|
||||
<file>gears.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>headerbar.c</file>
|
||||
@@ -202,7 +207,6 @@
|
||||
<file>peg_solitaire.c</file>
|
||||
<file>pickers.c</file>
|
||||
<file>pixbufs.c</file>
|
||||
<file>popover.c</file>
|
||||
<file>printing.c</file>
|
||||
<file>revealer.c</file>
|
||||
<file>rotated_text.c</file>
|
||||
@@ -210,6 +214,7 @@
|
||||
<file>search_entry.c</file>
|
||||
<file>search_entry2.c</file>
|
||||
<file>shortcuts.c</file>
|
||||
<file>shortcut_triggers.c</file>
|
||||
<file>sizegroup.c</file>
|
||||
<file>sidebar.c</file>
|
||||
<file>sliding_puzzle.c</file>
|
||||
@@ -239,9 +244,6 @@
|
||||
<file>messages.txt</file>
|
||||
<file>apple-red.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/popover">
|
||||
<file>popover.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/glarea">
|
||||
<file>glarea-gl.fs.glsl</file>
|
||||
<file>glarea-gl.vs.glsl</file>
|
||||
|
||||
@@ -29,29 +29,29 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">win.new</attribute>
|
||||
<attribute name="accel"><Primary>n</attribute>
|
||||
<attribute name="accel"><Control>n</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Open</attribute>
|
||||
<attribute name="action">win.open</attribute>
|
||||
<attribute name="accel"><Primary>o</attribute>
|
||||
<attribute name="accel"><Control>o</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Save</attribute>
|
||||
<attribute name="action">win.save</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
<attribute name="accel"><Control>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save _As</attribute>
|
||||
<attribute name="action">win.save-as</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
<attribute name="accel"><Control>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">win.quit</attribute>
|
||||
<attribute name="accel"><Primary><Shift>s</attribute>
|
||||
<attribute name="accel"><Control><Shift>s</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
@@ -61,17 +61,17 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Copy</attribute>
|
||||
<attribute name="action">win.copy</attribute>
|
||||
<attribute name="accel"><Primary>c</attribute>
|
||||
<attribute name="accel"><Control>c</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Cut</attribute>
|
||||
<attribute name="action">win.cut</attribute>
|
||||
<attribute name="accel"><Primary>x</attribute>
|
||||
<attribute name="accel"><Control>x</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Paste</attribute>
|
||||
<attribute name="action">win.paste</attribute>
|
||||
<attribute name="accel"><Primary>v</attribute>
|
||||
<attribute name="accel"><Control>v</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
|
||||
@@ -81,7 +81,7 @@ deserialize_widget (GtkDemoWidget *demo)
|
||||
else if (demo->type == GTK_TYPE_SPINNER)
|
||||
{
|
||||
widget = g_object_new (demo->type, "spinning", demo->active, NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||
gtk_widget_add_css_class (widget, "demo");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -114,7 +114,7 @@ new_spinner_cb (GtkWidget *button,
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_spinner_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||
gtk_widget_add_css_class (widget, "demo");
|
||||
gtk_spinner_start (GTK_SPINNER (widget));
|
||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="headers-clickable">0</property>
|
||||
<child internal-child="selection">
|
||||
@@ -95,7 +94,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview2">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="headers-clickable">0</property>
|
||||
<property name="search-column">0</property>
|
||||
<child internal-child="selection">
|
||||
@@ -178,7 +176,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview3">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="headers-clickable">0</property>
|
||||
<property name="search-column">0</property>
|
||||
<child internal-child="selection">
|
||||
|
||||
@@ -62,7 +62,7 @@ create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
gtk_widget_add_css_class (w, "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ create_faces (void)
|
||||
/* Add a face */
|
||||
faces[i].face = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
|
||||
gtk_widget_add_css_class (faces[i].face, faces[i].css_class);
|
||||
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
|
||||
|
||||
/* Set up the transformation for each face */
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<property name="title">Font Explorer</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="tooltip-text">Reset</property>
|
||||
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
@@ -41,7 +39,6 @@
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style|size|variations|features</property>
|
||||
@@ -64,7 +61,6 @@
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="margin-top">10</property>
|
||||
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||
<child>
|
||||
|
||||
@@ -140,17 +140,6 @@ update_value (GtkFontPlane *plane,
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
hold_action (GtkGestureLongPress *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
gboolean handled;
|
||||
|
||||
g_signal_emit_by_name (plane, "popup-menu", &handled);
|
||||
}
|
||||
|
||||
static void
|
||||
plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
gdouble start_x,
|
||||
@@ -161,13 +150,6 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
|
||||
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
|
||||
|
||||
if (button == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
gboolean handled;
|
||||
|
||||
g_signal_emit_by_name (plane, "popup-menu", &handled);
|
||||
}
|
||||
|
||||
if (button != GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
|
||||
@@ -207,8 +189,6 @@ gtk_font_plane_init (GtkFontPlane *plane)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
|
||||
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
G_CALLBACK (plane_drag_gesture_begin), plane);
|
||||
@@ -218,13 +198,6 @@ gtk_font_plane_init (GtkFontPlane *plane)
|
||||
G_CALLBACK (plane_drag_gesture_end), plane);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), plane);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/* OpenGL/Gears
|
||||
*
|
||||
* This is a classic OpenGL demo, running in a GtkGLArea.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkgears.h"
|
||||
|
||||
/************************************************************************
|
||||
* DEMO CODE *
|
||||
************************************************************************/
|
||||
|
||||
static void
|
||||
on_axis_value_change (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkGears *gears = GTK_GEARS (data);
|
||||
int axis = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (adjustment), "axis"));
|
||||
|
||||
gtk_gears_set_axis (gears, axis, gtk_adjustment_get_value (adjustment));
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
create_axis_slider (GtkGears *gears,
|
||||
int axis)
|
||||
{
|
||||
GtkWidget *box, *label, *slider;
|
||||
GtkAdjustment *adj;
|
||||
const char *text;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case GTK_GEARS_X_AXIS:
|
||||
text = "X";
|
||||
break;
|
||||
|
||||
case GTK_GEARS_Y_AXIS:
|
||||
text = "Y";
|
||||
break;
|
||||
|
||||
case GTK_GEARS_Z_AXIS:
|
||||
text = "Z";
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
|
||||
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (on_axis_value_change),
|
||||
gears);
|
||||
slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (box), slider);
|
||||
gtk_widget_set_vexpand (slider, TRUE);
|
||||
gtk_widget_show (slider);
|
||||
|
||||
gtk_widget_show (box);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_gears (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box, *hbox, *fps_label, *gears, *overlay, *frame;
|
||||
int i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gears");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 640, 640);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_widget_set_margin_start (overlay, 12);
|
||||
gtk_widget_set_margin_end (overlay, 12);
|
||||
gtk_widget_set_margin_top (overlay, 12);
|
||||
gtk_widget_set_margin_bottom (overlay, 12);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_halign (frame, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_START);
|
||||
gtk_widget_add_css_class (frame, "app-notification");
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), frame);
|
||||
|
||||
fps_label = gtk_label_new ("");
|
||||
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (frame), fps_label);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), box);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
|
||||
gears = gtk_gears_new ();
|
||||
gtk_widget_set_hexpand (gears, TRUE);
|
||||
gtk_widget_set_vexpand (gears, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gears);
|
||||
|
||||
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
|
||||
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (hbox), 6);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
|
||||
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* OpenGL Area
|
||||
/* OpenGL/OpenGL Area
|
||||
*
|
||||
* GtkGLArea is a widget that allows custom drawing using OpenGL calls.
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ do_headerbar (GtkWidget *do_widget)
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
|
||||
gtk_widget_add_css_class (box, "linked");
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
<property name="baseline-position">top</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="relief">none</property>
|
||||
@@ -109,7 +108,6 @@
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="resent_by_button">
|
||||
<property name="label" translatable="0">reshareer</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="uri">http://www.gtk.org</property>
|
||||
@@ -127,7 +125,6 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="expand_button">
|
||||
<property name="label" translatable="yes">Expand</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="expand_clicked" swapped="yes"/>
|
||||
@@ -140,7 +137,6 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="reply-button">
|
||||
<property name="label" translatable="yes">Reply</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
@@ -148,7 +144,6 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="reshare-button">
|
||||
<property name="label" translatable="yes">Reshare</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="reshare_clicked" swapped="yes"/>
|
||||
@@ -157,7 +152,6 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="favorite-buttton">
|
||||
<property name="label" translatable="yes">Favorite</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="favorite_clicked" swapped="yes"/>
|
||||
@@ -165,7 +159,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="more-button">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="menu-model">menu1</property>
|
||||
<property name="relief">none</property>
|
||||
@@ -231,7 +224,6 @@ FAVORITES</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button5">
|
||||
<property name="label" translatable="yes">Details</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="relief">none</property>
|
||||
<style>
|
||||
|
||||
@@ -310,7 +310,6 @@ static const char *types[] =
|
||||
"GtkIconView ",
|
||||
"GtkCellRendererText ",
|
||||
"GtkContainer ",
|
||||
"GtkAccelGroup ",
|
||||
"GtkPaned ",
|
||||
"GtkPrintOperation ",
|
||||
"GtkPrintContext ",
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="action-name">win.run</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
@@ -62,12 +61,10 @@
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="width-request">120</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="model">treestore</property>
|
||||
<property name="headers-visible">0</property>
|
||||
<child internal-child="selection">
|
||||
@@ -99,7 +96,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="scrollable">1</property>
|
||||
<property name="enable-popup">1</property>
|
||||
<property name="show-border">0</property>
|
||||
@@ -110,10 +106,8 @@
|
||||
<property name="tab-expand">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="can-focus">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="info-textview">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="left-margin">20</property>
|
||||
<property name="right-margin">20</property>
|
||||
<property name="top-margin">20</property>
|
||||
@@ -141,10 +135,8 @@
|
||||
<property name="tab-expand">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkScrolledWindow" id="source-scrolledwindow">
|
||||
<property name="can-focus">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="source-textview">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="left-margin">20</property>
|
||||
<property name="right-margin">20</property>
|
||||
<property name="top-margin">20</property>
|
||||
|
||||
+12
-12
@@ -5,7 +5,7 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">app.new</attribute>
|
||||
<attribute name="accel"><Primary>n</attribute>
|
||||
<attribute name="accel"><Control>n</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Open</attribute>
|
||||
@@ -14,19 +14,19 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Save</attribute>
|
||||
<attribute name="action">app.save</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
<attribute name="accel"><Control>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save _As...</attribute>
|
||||
<attribute name="action">app.save-as</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
<attribute name="accel"><Control>s</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
<attribute name="accel"><Control>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
@@ -45,19 +45,19 @@
|
||||
<attribute name="label" translatable="yes">_Red</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">red</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
<attribute name="accel"><Control>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Green</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">green</attribute>
|
||||
<attribute name="accel"><Primary>g</attribute>
|
||||
<attribute name="accel"><Control>g</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Blue</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">blue</attribute>
|
||||
<attribute name="accel"><Primary>b</attribute>
|
||||
<attribute name="accel"><Control>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
@@ -68,26 +68,26 @@
|
||||
<attribute name="label" translatable="yes">_Square</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">square</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
<attribute name="accel"><Control>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Rectangle</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">rectangle</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
<attribute name="accel"><Control>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Oval</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">oval</attribute>
|
||||
<attribute name="accel"><Primary>o</attribute>
|
||||
<attribute name="accel"><Control>o</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Bold</attribute>
|
||||
<attribute name="action">win.bold</attribute>
|
||||
<attribute name="accel"><Primary><Shift>b</attribute>
|
||||
<attribute name="accel"><Control><Shift>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
@@ -96,7 +96,7 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About</attribute>
|
||||
<attribute name="action">win.about</attribute>
|
||||
<attribute name="accel"><Primary>a</attribute>
|
||||
<attribute name="accel"><Control>a</attribute>
|
||||
</item>
|
||||
</submenu>
|
||||
</menu>
|
||||
|
||||
@@ -28,6 +28,7 @@ demos = files([
|
||||
'fishbowl.c',
|
||||
'fixed.c',
|
||||
'fontrendering.c',
|
||||
'gears.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
'headerbar.c',
|
||||
@@ -54,7 +55,6 @@ demos = files([
|
||||
'peg_solitaire.c',
|
||||
'pickers.c',
|
||||
'pixbufs.c',
|
||||
'popover.c',
|
||||
'printing.c',
|
||||
'revealer.c',
|
||||
'rotated_text.c',
|
||||
@@ -62,6 +62,7 @@ demos = files([
|
||||
'search_entry.c',
|
||||
'search_entry2.c',
|
||||
'shortcuts.c',
|
||||
'shortcut_triggers.c',
|
||||
'sidebar.c',
|
||||
'sizegroup.c',
|
||||
'sliding_puzzle.c',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="resizable">0</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
@@ -17,31 +18,33 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_a</property>
|
||||
<property name="label">Color</property>
|
||||
<property name="label">_Color</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_b</property>
|
||||
<property name="label">Flavors</property>
|
||||
<property name="label">_Flavors</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_c</property>
|
||||
<property name="label">Tools</property>
|
||||
<property name="label">_Tools</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_a">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
@@ -68,14 +71,12 @@
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_b">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.chocolate</property>
|
||||
@@ -101,14 +102,12 @@
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_c">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Hammer</property>
|
||||
|
||||
@@ -56,23 +56,25 @@ do_overlay (GtkWidget *do_widget)
|
||||
}
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_can_target (vbox, FALSE);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_START);
|
||||
|
||||
label = gtk_label_new ("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_widget_set_can_target (label, FALSE);
|
||||
gtk_widget_set_margin_top (label, 8);
|
||||
gtk_widget_set_margin_bottom (label, 50);
|
||||
gtk_widget_set_margin_bottom (label, 8);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
|
||||
gtk_widget_set_margin_top (entry, 50);
|
||||
gtk_widget_set_margin_top (entry, 8);
|
||||
gtk_widget_set_margin_bottom (entry, 8);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ do_password_entry (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (box), entry2);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
gtk_widget_add_css_class (button, "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
/* Popovers
|
||||
*
|
||||
* A bubble-like window containing contextual information or options.
|
||||
* GtkPopovers can be attached to any widget, and will be displayed
|
||||
* within the same window, but on top of all its content.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
toggle_changed_cb (GtkToggleButton *button,
|
||||
GtkWidget *popover)
|
||||
{
|
||||
gtk_widget_set_visible (popover,
|
||||
gtk_toggle_button_get_active (button));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_popover (GtkWidget *parent,
|
||||
GtkWidget *child,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
GtkWidget *popover;
|
||||
|
||||
popover = gtk_popover_new ();
|
||||
gtk_widget_set_parent (popover, parent);
|
||||
gtk_popover_set_position (GTK_POPOVER (popover), pos);
|
||||
gtk_container_add (GTK_CONTAINER (popover), child);
|
||||
gtk_widget_set_margin_start (child, 6);
|
||||
gtk_widget_set_margin_end (child, 6);
|
||||
gtk_widget_set_margin_top (child, 6);
|
||||
gtk_widget_set_margin_bottom (child, 6);
|
||||
gtk_widget_show (child);
|
||||
|
||||
return popover;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_complex_popover (GtkWidget *parent,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
GtkWidget *popover, *window, *content;
|
||||
GtkBuilder *builder;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/popover/popover.ui", NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
content = gtk_bin_get_child (GTK_BIN (window));
|
||||
g_object_ref (content);
|
||||
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (content)),
|
||||
content);
|
||||
gtk_widget_destroy (window);
|
||||
g_object_unref (builder);
|
||||
|
||||
popover = create_popover (parent, content, GTK_POS_BOTTOM);
|
||||
g_object_unref (content);
|
||||
|
||||
return popover;
|
||||
}
|
||||
|
||||
static void
|
||||
entry_size_allocate_cb (GtkEntry *entry,
|
||||
int width,
|
||||
int height,
|
||||
int baseline,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntryIconPosition popover_pos;
|
||||
GtkPopover *popover = user_data;
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
if (gtk_widget_is_visible (GTK_WIDGET (popover)))
|
||||
{
|
||||
popover_pos =
|
||||
GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (entry),
|
||||
"popover-icon-pos"));
|
||||
gtk_entry_get_icon_area (entry, popover_pos, &rect);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
entry_icon_press_cb (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *popover = user_data;
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
gtk_entry_get_icon_area (entry, icon_pos, &rect);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
|
||||
gtk_widget_show (popover);
|
||||
|
||||
g_object_set_data (G_OBJECT (entry), "popover-icon-pos",
|
||||
GUINT_TO_POINTER (icon_pos));
|
||||
}
|
||||
|
||||
static void
|
||||
day_selected_cb (GtkCalendar *calendar,
|
||||
gpointer user_data)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
GtkWidget *popover;
|
||||
GdkEvent *event;
|
||||
gdouble x, y;
|
||||
GtkWidget *widget;
|
||||
|
||||
event = gtk_get_current_event ();
|
||||
|
||||
if (gdk_event_get_event_type (event) != GDK_BUTTON_PRESS)
|
||||
return;
|
||||
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
widget = gtk_native_get_for_surface (gdk_event_get_surface (event));
|
||||
gtk_widget_translate_coordinates (widget,
|
||||
GTK_WIDGET (calendar),
|
||||
x, y,
|
||||
&rect.x, &rect.y);
|
||||
rect.width = rect.height = 1;
|
||||
|
||||
popover = create_popover (GTK_WIDGET (calendar),
|
||||
gtk_entry_new (),
|
||||
GTK_POS_BOTTOM);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
|
||||
|
||||
gtk_widget_show (popover);
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_popover (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *popover, *box, *widget;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Popovers");
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 24);
|
||||
gtk_widget_set_margin_start (box, 24);
|
||||
gtk_widget_set_margin_end (box, 24);
|
||||
gtk_widget_set_margin_top (box, 24);
|
||||
gtk_widget_set_margin_bottom (box, 24);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
widget = gtk_toggle_button_new_with_label ("Button");
|
||||
popover = create_popover (widget,
|
||||
gtk_label_new ("This popover does not grab input"),
|
||||
GTK_POS_TOP);
|
||||
gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
|
||||
g_signal_connect (widget, "toggled",
|
||||
G_CALLBACK (toggle_changed_cb), popover);
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
|
||||
widget = gtk_entry_new ();
|
||||
popover = create_complex_popover (widget, GTK_POS_TOP);
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (widget),
|
||||
GTK_ENTRY_ICON_PRIMARY, "edit-find");
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (widget),
|
||||
GTK_ENTRY_ICON_SECONDARY, "edit-clear");
|
||||
|
||||
g_signal_connect (widget, "icon-press",
|
||||
G_CALLBACK (entry_icon_press_cb), popover);
|
||||
g_signal_connect (widget, "size-allocate",
|
||||
G_CALLBACK (entry_size_allocate_cb), popover);
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
|
||||
widget = gtk_calendar_new ();
|
||||
g_signal_connect (widget, "day-selected",
|
||||
G_CALLBACK (day_selected_cb), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 1</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 2</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 3</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 4</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 5</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 6</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 7</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 8</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 9</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Item 10</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="primary-icon-name">edit-find</property>
|
||||
<property name="secondary-icon-name">edit-clear</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="max-content-height">100</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="headers-visible">0</property>
|
||||
<property name="enable-search">0</property>
|
||||
<property name="search-column">2</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column1">
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderer1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -28,7 +28,7 @@ fancy_shape_renderer (cairo_t *cr,
|
||||
(double) attr->ink_rect.width / PANGO_SCALE,
|
||||
(double) attr->ink_rect.height / PANGO_SCALE);
|
||||
|
||||
if (GPOINTER_TO_UINT (attr->data) == 0x2664) /* U+2665 BLACK HEART SUIT */
|
||||
if (GPOINTER_TO_UINT (attr->data) == 0x2665) /* U+2665 BLACK HEART SUIT */
|
||||
{
|
||||
cairo_move_to (cr, .5, .0);
|
||||
cairo_line_to (cr, .9, -.4);
|
||||
@@ -190,8 +190,7 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
/* Add a drawing area */
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
rotated_text_draw,
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_plain">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-request">200</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
@@ -72,7 +71,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_marks">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-request">200</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment2</property>
|
||||
@@ -108,7 +106,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_discrete">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="width-request">200</property>
|
||||
<property name="round-digits">0</property>
|
||||
<property name="draw-value">0</property>
|
||||
|
||||
@@ -216,11 +216,18 @@ entry_add_to_context_menu (GtkEntry *entry)
|
||||
};
|
||||
GMenuModel *submenu;
|
||||
GMenuItem *item;
|
||||
GAction *action;
|
||||
GVariant *value;
|
||||
|
||||
actions = g_simple_action_group_new ();
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS(entries), entry);
|
||||
gtk_widget_insert_action_group (GTK_WIDGET (entry), "search", G_ACTION_GROUP (actions));
|
||||
|
||||
action = g_action_map_lookup_action (G_ACTION_MAP (actions), "search-by");
|
||||
value = g_variant_ref_sink (g_variant_new_string ("name"));
|
||||
set_search_by (G_SIMPLE_ACTION (action), value, entry);
|
||||
g_variant_unref (value);
|
||||
|
||||
menu = g_menu_new ();
|
||||
item = g_menu_item_new (_("C_lear"), "search.clear");
|
||||
g_menu_item_set_attribute (item, "touch-icon", "s", "edit-clear-symbolic");
|
||||
@@ -297,10 +304,6 @@ do_search_entry (GtkWidget *do_widget)
|
||||
gtk_widget_show (cancel_button);
|
||||
|
||||
/* Set up the search icon */
|
||||
GVariant *value = g_variant_ref_sink (g_variant_new_string ("name"));
|
||||
set_search_by (NULL, value, entry);
|
||||
g_variant_unref (value);
|
||||
|
||||
gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, TRUE);
|
||||
gtk_entry_set_icon_sensitive (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, TRUE);
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Shortcuts
|
||||
*
|
||||
* GtkShortcut is the abstraction used by GTK to handle shortcuts from
|
||||
* keyboard or other input devices.
|
||||
*
|
||||
* Shortcut triggers can be used to weave complex sequences of key
|
||||
* presses into sophisticated mechanisms to activate shortcuts.
|
||||
*
|
||||
* This demo code shows creative ways to do that.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static gboolean
|
||||
shortcut_activated (GtkWidget *widget,
|
||||
GVariant *unused,
|
||||
gpointer row)
|
||||
{
|
||||
g_print ("activated %s\n", gtk_label_get_label (row));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkShortcutTrigger *
|
||||
create_ctrl_g (void)
|
||||
{
|
||||
return gtk_keyval_trigger_new (GDK_KEY_g, GDK_CONTROL_MASK);
|
||||
}
|
||||
|
||||
static GtkShortcutTrigger *
|
||||
create_x (void)
|
||||
{
|
||||
return gtk_keyval_trigger_new (GDK_KEY_x, 0);
|
||||
}
|
||||
|
||||
struct {
|
||||
const char *description;
|
||||
GtkShortcutTrigger * (* create_trigger_func) (void);
|
||||
} shortcuts[] = {
|
||||
{ "Press Ctrl-G", create_ctrl_g },
|
||||
{ "Press X", create_x },
|
||||
};
|
||||
|
||||
GtkWidget *
|
||||
do_shortcut_triggers (GtkWidget *do_widget)
|
||||
{
|
||||
guint i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shortcuts");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
list = gtk_list_box_new ();
|
||||
gtk_widget_set_margin_top (list, 6);
|
||||
gtk_widget_set_margin_bottom (list, 6);
|
||||
gtk_widget_set_margin_start (list, 6);
|
||||
gtk_widget_set_margin_end (list, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), list);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
|
||||
{
|
||||
GtkShortcut *shortcut;
|
||||
GtkWidget *row;
|
||||
|
||||
row = gtk_label_new (shortcuts[i].description);
|
||||
gtk_container_add (GTK_CONTAINER (list), row);
|
||||
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller), GTK_SHORTCUT_SCOPE_GLOBAL);
|
||||
gtk_widget_add_controller (row, controller);
|
||||
|
||||
shortcut = gtk_shortcut_new (shortcuts[i].create_trigger_func(),
|
||||
gtk_callback_action_new (shortcut_activated, row, NULL));
|
||||
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
if (i == 0)
|
||||
{
|
||||
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
|
||||
gtk_widget_add_css_class (widget, "icon-dropshadow");
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -160,47 +160,13 @@ check_solved (GtkWidget *grid)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
puzzle_key_pressed (GtkEventControllerKey *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
GtkWidget *grid)
|
||||
puzzle_key_pressed (GtkWidget *grid,
|
||||
GVariant *args,
|
||||
gpointer unused)
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
case GDK_KEY_KP_Left:
|
||||
case GDK_KEY_Left:
|
||||
/* left */
|
||||
dx = -1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Up:
|
||||
case GDK_KEY_Up:
|
||||
/* up */
|
||||
dy = -1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Right:
|
||||
case GDK_KEY_Right:
|
||||
/* right */
|
||||
dx = 1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Down:
|
||||
case GDK_KEY_Down:
|
||||
/* down */
|
||||
dy = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* We return FALSE here because we didn't handle the key that was pressed */
|
||||
return FALSE;
|
||||
}
|
||||
g_variant_get (args, "(ii)", &dx, &dy);
|
||||
|
||||
if (!move_puzzle (grid, dx, dy))
|
||||
{
|
||||
@@ -276,6 +242,23 @@ puzzle_button_pressed (GtkGestureClick *gesture,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_move_binding (GtkShortcutController *controller,
|
||||
guint keyval,
|
||||
guint kp_keyval,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
GtkShortcut *shortcut;
|
||||
|
||||
shortcut = gtk_shortcut_new_with_arguments (
|
||||
gtk_alternative_trigger_new (gtk_keyval_trigger_new (keyval, 0),
|
||||
gtk_keyval_trigger_new (kp_keyval, 0)),
|
||||
gtk_callback_action_new (puzzle_key_pressed, NULL, NULL),
|
||||
"(ii)", dx, dy);
|
||||
gtk_shortcut_controller_add_shortcut (controller, shortcut);
|
||||
}
|
||||
|
||||
static void
|
||||
start_puzzle (GdkPaintable *paintable)
|
||||
{
|
||||
@@ -298,12 +281,21 @@ start_puzzle (GdkPaintable *paintable)
|
||||
aspect_ratio = 1.0;
|
||||
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, aspect_ratio, FALSE);
|
||||
|
||||
/* Add a key event controller so people can use the arrow
|
||||
/* Add shortcuts so people can use the arrow
|
||||
* keys to move the puzzle */
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (puzzle_key_pressed),
|
||||
grid);
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GDK_KEY_Left, GDK_KEY_KP_Left,
|
||||
-1, 0);
|
||||
add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GDK_KEY_Right, GDK_KEY_KP_Right,
|
||||
1, 0);
|
||||
add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GDK_KEY_Up, GDK_KEY_KP_Up,
|
||||
0, -1);
|
||||
add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GDK_KEY_Down, GDK_KEY_KP_Down,
|
||||
0, 1);
|
||||
gtk_widget_add_controller (GTK_WIDGET (grid), controller);
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
|
||||
@@ -427,7 +419,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (tweaks, 10);
|
||||
|
||||
choices = gtk_flow_box_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (choices), GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (choices, GTK_STYLE_CLASS_VIEW);
|
||||
add_choice (choices, puzzle);
|
||||
add_choice (choices, gtk_nuclear_animation_new ());
|
||||
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
@@ -38,7 +37,6 @@
|
||||
<property name="child">
|
||||
<object class="GtkCheckButton">
|
||||
<property name="label" translatable="yes">Page 2</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -53,7 +51,7 @@
|
||||
<object class="GtkSpinner">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">1</property>
|
||||
<property name="spinning">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
@@ -25,7 +25,7 @@ add_tag (GtkButton *button, DemoTaggedEntry *entry)
|
||||
DemoTaggedEntryTag *tag;
|
||||
|
||||
tag = demo_tagged_entry_tag_new ("Blue");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tag)), "blue");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (tag), "blue");
|
||||
demo_tagged_entry_tag_set_has_close_button (tag, TRUE);
|
||||
g_signal_connect (tag, "button-clicked", G_CALLBACK (closed_cb), entry);
|
||||
|
||||
@@ -98,7 +98,7 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
gtk_widget_add_css_class (button, "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
|
||||
@@ -28,21 +28,18 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Hi, I am a button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">And I'm another button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">This is a button party!</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -17,21 +17,18 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Hi, I am a button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">And I'm another button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">This is a button party!</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>q</property>
|
||||
<property name="accelerator"><Control>q</property>
|
||||
<property name="title">Quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>d</property>
|
||||
<property name="accelerator"><Control>d</property>
|
||||
<property name="title">Switch to dark theme</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -31,7 +31,7 @@
|
||||
<property name="view">page2</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>s</property>
|
||||
<property name="accelerator"><Control>s</property>
|
||||
<property name="title">Search</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -43,7 +43,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>b</property>
|
||||
<property name="accelerator"><Control>b</property>
|
||||
<property name="title">Set background</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -55,19 +55,19 @@
|
||||
<property name="view">page3</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>o</property>
|
||||
<property name="accelerator"><Control>o</property>
|
||||
<property name="title">Open a file</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>r</property>
|
||||
<property name="accelerator"><Control>r</property>
|
||||
<property name="title">Start recording</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Primary>l</property>
|
||||
<property name="accelerator"><Control>l</property>
|
||||
<property name="title">Lock or unlock</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -25,16 +25,83 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static char *current_theme;
|
||||
|
||||
static void
|
||||
change_dark_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
gboolean prefer_dark = g_variant_get_boolean (state);
|
||||
char *theme;
|
||||
const char *new_theme = NULL;
|
||||
|
||||
g_object_get (G_OBJECT (settings),
|
||||
"gtk-theme-name", &theme,
|
||||
NULL);
|
||||
|
||||
if (prefer_dark)
|
||||
{
|
||||
if (strcmp (theme, "Adwaita") == 0)
|
||||
new_theme = "Adwaita-dark";
|
||||
else if (strcmp (theme, "HighContrastInverse") == 0)
|
||||
new_theme = "HighContrast";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (theme, "Adwaita-dark") == 0)
|
||||
new_theme = "Adwaita";
|
||||
else if (strcmp (theme, "HighContrast") == 0)
|
||||
new_theme = "HighContrastInverse";
|
||||
}
|
||||
|
||||
if (new_theme)
|
||||
g_object_set (G_OBJECT (settings),
|
||||
"gtk-theme-name", new_theme,
|
||||
NULL);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
|
||||
g_free (theme);
|
||||
}
|
||||
|
||||
static void
|
||||
change_theme_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
const char *s;
|
||||
const char *theme;
|
||||
|
||||
s = g_variant_get_string (state, NULL);
|
||||
|
||||
if (strcmp (s, "adwaita") == 0)
|
||||
{
|
||||
theme = "Adwaita";
|
||||
}
|
||||
else if (strcmp (s, "adwaita-dark") == 0)
|
||||
{
|
||||
theme = "Adwaita-dark";
|
||||
}
|
||||
else if (strcmp (s, "highcontrast") == 0)
|
||||
{
|
||||
theme = "HighContrast";
|
||||
}
|
||||
else if (strcmp (s, "highcontrast-inverse") == 0)
|
||||
{
|
||||
theme = "HighContrastInverse";
|
||||
}
|
||||
else if (strcmp (s, "current") == 0)
|
||||
{
|
||||
theme = current_theme;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
g_object_set (G_OBJECT (settings),
|
||||
"gtk-application-prefer-dark-theme",
|
||||
g_variant_get_boolean (state),
|
||||
"gtk-theme-name", theme,
|
||||
NULL);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
@@ -391,24 +458,17 @@ on_entry_icon_release (GtkEntry *entry,
|
||||
|
||||
#define EPSILON (1e-10)
|
||||
|
||||
static gboolean
|
||||
on_scale_button_query_tooltip (GtkWidget *button,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean keyboard_mode,
|
||||
GtkTooltip *tooltip,
|
||||
gpointer user_data)
|
||||
static void
|
||||
on_scale_button_value_changed (GtkScaleButton *button,
|
||||
gdouble value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
|
||||
GtkAdjustment *adjustment;
|
||||
gdouble val;
|
||||
gchar *str;
|
||||
AtkImage *image;
|
||||
|
||||
image = ATK_IMAGE (gtk_widget_get_accessible (button));
|
||||
|
||||
adjustment = gtk_scale_button_get_adjustment (scale_button);
|
||||
val = gtk_scale_button_get_value (scale_button);
|
||||
adjustment = gtk_scale_button_get_adjustment (button);
|
||||
val = gtk_scale_button_get_value (button);
|
||||
|
||||
if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
|
||||
{
|
||||
@@ -427,32 +487,21 @@ on_scale_button_query_tooltip (GtkWidget *button,
|
||||
str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
|
||||
}
|
||||
|
||||
gtk_tooltip_set_text (tooltip, str);
|
||||
atk_image_set_image_description (image, str);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (button), str);
|
||||
atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_scale_button_value_changed (GtkScaleButton *button,
|
||||
gdouble value,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_trigger_tooltip_query (GTK_WIDGET (button));
|
||||
}
|
||||
|
||||
static void
|
||||
on_record_button_toggled (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
gtk_style_context_remove_class (context, "destructive-action");
|
||||
gtk_widget_remove_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
else
|
||||
gtk_style_context_add_class (context, "destructive-action");
|
||||
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1671,7 +1720,8 @@ activate (GApplication *app)
|
||||
GtkCssProvider *provider;
|
||||
GMenuModel *model;
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "dark", NULL, NULL, "false", change_theme_state },
|
||||
{ "dark", NULL, NULL, "false", change_dark_state },
|
||||
{ "theme", NULL, "s", "'current'", change_theme_state },
|
||||
{ "transition", NULL, NULL, "false", change_transition_state },
|
||||
{ "search", activate_search, NULL, NULL, NULL },
|
||||
{ "delete", activate_delete, NULL, NULL, NULL },
|
||||
@@ -1686,23 +1736,27 @@ activate (GApplication *app)
|
||||
const gchar *accelerators[2];
|
||||
} accels[] = {
|
||||
{ "app.about", { "F1", NULL } },
|
||||
{ "app.quit", { "<Primary>q", NULL } },
|
||||
{ "app.open-in", { "<Primary>n", NULL } },
|
||||
{ "app.cut", { "<Primary>x", NULL } },
|
||||
{ "app.copy", { "<Primary>c", NULL } },
|
||||
{ "app.paste", { "<Primary>v", NULL } },
|
||||
{ "win.dark", { "<Primary>d", NULL } },
|
||||
{ "win.search", { "<Primary>s", NULL } },
|
||||
{ "app.quit", { "<Control>q", NULL } },
|
||||
{ "app.open-in", { "<Control>n", NULL } },
|
||||
{ "app.cut", { "<Control>x", NULL } },
|
||||
{ "app.copy", { "<Control>c", NULL } },
|
||||
{ "app.paste", { "<Control>v", NULL } },
|
||||
{ "win.dark", { "<Control>d", NULL } },
|
||||
{ "win.search", { "<Control>s", NULL } },
|
||||
{ "win.delete", { "Delete", NULL } },
|
||||
{ "win.background", { "<Primary>b", NULL } },
|
||||
{ "win.open", { "<Primary>o", NULL } },
|
||||
{ "win.record", { "<Primary>r", NULL } },
|
||||
{ "win.lock", { "<Primary>l", NULL } },
|
||||
{ "win.background", { "<Control>b", NULL } },
|
||||
{ "win.open", { "<Control>o", NULL } },
|
||||
{ "win.record", { "<Control>r", NULL } },
|
||||
{ "win.lock", { "<Control>l", NULL } },
|
||||
};
|
||||
gint i;
|
||||
GPermission *permission;
|
||||
GAction *action;
|
||||
|
||||
g_object_get (gtk_settings_get_default (),
|
||||
"gtk-theme-name", ¤t_theme,
|
||||
NULL);
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
@@ -1717,7 +1771,6 @@ activate (GApplication *app)
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"on_entry_icon_release", (GCallback)on_entry_icon_release,
|
||||
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
|
||||
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
|
||||
"on_record_button_toggled", (GCallback)on_record_button_toggled,
|
||||
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||
|
||||
@@ -6,10 +6,36 @@
|
||||
<attribute name="label" translatable="yes">Get Busy</attribute>
|
||||
<attribute name="action">win.busy</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Dark Theme</attribute>
|
||||
<attribute name="action">win.dark</attribute>
|
||||
</item>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">Style</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Current</attribute>
|
||||
<attribute name="action">win.theme</attribute>
|
||||
<attribute name="target">current</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Adwaita</attribute>
|
||||
<attribute name="action">win.theme</attribute>
|
||||
<attribute name="target">adwaita</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Adwaita dark</attribute>
|
||||
<attribute name="action">win.theme</attribute>
|
||||
<attribute name="target">adwaita-dark</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">High contrast</attribute>
|
||||
<attribute name="action">win.theme</attribute>
|
||||
<attribute name="target">highcontrast</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">High contrast inverse</attribute>
|
||||
<attribute name="action">win.theme</attribute>
|
||||
<attribute name="target">highcontrast-inverse</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Slide Pages</attribute>
|
||||
<attribute name="action">win.transition</attribute>
|
||||
@@ -508,7 +534,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button224">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -599,14 +624,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton1">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton2">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
@@ -617,7 +640,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkCheckButton" id="checkbutton3">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
@@ -628,7 +650,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkCheckButton" id="checkbutton4">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -640,7 +661,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkCheckButton" id="checkbutton5">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
@@ -652,7 +672,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
@@ -662,7 +681,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton1">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -673,8 +691,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton2">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -686,8 +702,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkRadioButton" id="radiobutton3">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -699,8 +713,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkRadioButton" id="radiobutton4">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
@@ -711,8 +723,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkRadioButton" id="radiobutton5">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton3</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -725,8 +735,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton3</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -785,7 +793,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton1">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -793,14 +800,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkToggleButton" id="togglebutton2">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton3">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
@@ -809,7 +814,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkToggleButton" id="togglebutton4">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
@@ -841,14 +845,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="fontbutton1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="level">family|style|size|features|variations</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="colorbutton1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="rgba">#31316867a09f</property>
|
||||
<property name="use-alpha">1</property>
|
||||
@@ -860,7 +862,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="linkbutton1">
|
||||
<property name="label" translatable="yes">link button</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<property name="relief">none</property>
|
||||
@@ -939,7 +940,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="homogeneous">1</property>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="restrict-to-fill-level">0</property>
|
||||
<property name="fill-level">75</property>
|
||||
@@ -949,7 +949,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale2">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="restrict-to-fill-level">0</property>
|
||||
<property name="fill-level">75</property>
|
||||
@@ -962,7 +961,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale5">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="has-origin">0</property>
|
||||
<property name="round-digits">0</property>
|
||||
@@ -1010,7 +1008,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale3">
|
||||
<property name="height-request">100</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="restrict-to-fill-level">0</property>
|
||||
@@ -1023,7 +1020,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkScale" id="scale4">
|
||||
<property name="height-request">100</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="restrict-to-fill-level">0</property>
|
||||
@@ -1116,13 +1112,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="width-request">150</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="headers-clickable">0</property>
|
||||
<property name="search-column">0</property>
|
||||
@@ -1193,12 +1187,10 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="textview1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="buffer">textbuffer1</property>
|
||||
<property name="wrap-mode">2</property>
|
||||
<property name="left-margin">10</property>
|
||||
@@ -1220,7 +1212,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="homogeneous">1</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook1">
|
||||
<property name="can-focus">1</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="child">
|
||||
@@ -1268,7 +1259,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook2">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="tab-pos">right</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
@@ -1318,7 +1308,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook3">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="tab-pos">bottom</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
@@ -1368,7 +1357,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook4">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="tab-pos">left</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
@@ -1522,7 +1510,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="value">.5</property>
|
||||
<property name="halign">center</property>
|
||||
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
|
||||
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -1556,7 +1543,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="tvo">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="buffer">textbuffer2</property>
|
||||
<property name="left-margin">10</property>
|
||||
<property name="right-margin">10</property>
|
||||
@@ -1907,7 +1893,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="MyTextView" id="text3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="buffer">textbuffer1</property>
|
||||
<property name="wrap-mode">2</property>
|
||||
<property name="left-margin">10</property>
|
||||
@@ -2008,20 +1993,17 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="expander1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="expanded">1</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow3">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="height-request">226</property>
|
||||
<child>
|
||||
<object class="GtkIconView" id="iconview1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="selection-mode">multiple</property>
|
||||
<property name="model">iconsmodel</property>
|
||||
<child>
|
||||
|
||||
@@ -98,7 +98,10 @@ gdk_display_get_monitor_at_surface
|
||||
gdk_display_get_clipboard
|
||||
gdk_display_get_primary_clipboard
|
||||
gdk_display_get_setting
|
||||
gdk_display_get_keymap
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_display_map_keyval
|
||||
gdk_display_map_keycode
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DISPLAY
|
||||
@@ -212,7 +215,7 @@ gdk_surface_get_height
|
||||
gdk_surface_set_shadow_width
|
||||
gdk_surface_get_device_position
|
||||
GdkModifierType
|
||||
GdkModifierIntent
|
||||
GDK_MODIFIER_MASK
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_get_support_multidevice
|
||||
@@ -337,49 +340,16 @@ gdk_rectangle_get_type
|
||||
<SECTION>
|
||||
<TITLE>Keyboard Handling</TITLE>
|
||||
<FILE>keys</FILE>
|
||||
GdkKeymap
|
||||
GdkKeymapKey
|
||||
gdk_keymap_lookup_key
|
||||
gdk_keymap_translate_keyboard_state
|
||||
gdk_keymap_get_entries_for_keyval
|
||||
gdk_keymap_get_entries_for_keycode
|
||||
gdk_keymap_get_direction
|
||||
gdk_keymap_have_bidi_layouts
|
||||
gdk_keymap_get_caps_lock_state
|
||||
gdk_keymap_get_num_lock_state
|
||||
gdk_keymap_get_scroll_lock_state
|
||||
gdk_keymap_get_modifier_state
|
||||
gdk_keymap_add_virtual_modifiers
|
||||
gdk_keymap_map_virtual_modifiers
|
||||
gdk_keymap_get_modifier_mask
|
||||
gdk_keymap_get_display
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_name
|
||||
gdk_keyval_from_name
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_convert_case
|
||||
gdk_keyval_to_upper
|
||||
gdk_keyval_to_lower
|
||||
gdk_keyval_is_upper
|
||||
gdk_keyval_is_lower
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_to_unicode
|
||||
gdk_unicode_to_keyval
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_KEYMAP
|
||||
GDK_IS_KEYMAP
|
||||
GDK_TYPE_KEYMAP
|
||||
GDK_KEYMAP_CLASS
|
||||
GDK_IS_KEYMAP_CLASS
|
||||
GDK_KEYMAP_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkKeymapClass
|
||||
gdk_keymap_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -541,9 +511,13 @@ gdk_scroll_event_get_deltas
|
||||
gdk_scroll_event_is_stop
|
||||
gdk_key_event_get_keyval
|
||||
gdk_key_event_get_keycode
|
||||
gdk_key_event_get_scancode
|
||||
gdk_key_event_get_group
|
||||
gdk_key_event_get_consumed_modifiers
|
||||
gdk_key_event_get_layout
|
||||
gdk_key_event_get_level
|
||||
gdk_key_event_is_modifier
|
||||
GdkEventMatch
|
||||
gdk_key_event_matches
|
||||
gdk_key_event_get_match
|
||||
gdk_focus_event_get_in
|
||||
gdk_touch_event_get_emulating_pointer
|
||||
gdk_crossing_event_get_mode
|
||||
@@ -681,11 +655,11 @@ gdk_toplevel_set_transient_for
|
||||
gdk_toplevel_set_modal
|
||||
gdk_toplevel_set_icon_list
|
||||
gdk_toplevel_show_window_menu
|
||||
gdk_toplevel_set_accept_focus
|
||||
gdk_toplevel_set_focus_on_map
|
||||
gdk_toplevel_set_decorated
|
||||
gdk_toplevel_set_deletable
|
||||
gdk_toplevel_supports_edge_constraints
|
||||
gdk_toplevel_inhibit_system_shortcuts
|
||||
gdk_toplevel_restore_system_shortcuts
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_TOPLEVEL
|
||||
gdk_toplevel_get_type
|
||||
|
||||
@@ -17,7 +17,6 @@ gdk_event_get_type
|
||||
gdk_frame_clock_get_type
|
||||
gdk_gl_context_get_type
|
||||
gdk_gl_texture_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_memory_texture_get_type
|
||||
gdk_monitor_get_type
|
||||
gdk_paintable_get_type
|
||||
|
||||
@@ -336,6 +336,16 @@
|
||||
<xi:include href="xml/gtkgesturezoom.xml" />
|
||||
<xi:include href="xml/gtkgesturestylus.xml" />
|
||||
<xi:include href="xml/gtkpadcontroller.xml" />
|
||||
<xi:include href="xml/gtkshortcutcontroller.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
<title>Keyboard shortcuts</title>
|
||||
<xi:include href="xml/gtkaccelgroup.xml" />
|
||||
<xi:include href="xml/gtkshortcut.xml" />
|
||||
<xi:include href="xml/gtkshortcuttrigger.xml" />
|
||||
<xi:include href="xml/gtkshortcutaction.xml" />
|
||||
<xi:include href="xml/gtkshortcutmanager.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
@@ -352,10 +362,7 @@
|
||||
<title>GTK Core Reference</title>
|
||||
<xi:include href="xml/gtkmain.xml" />
|
||||
<xi:include href="xml/gtkfeatures.xml" />
|
||||
<xi:include href="xml/gtkaccelgroup.xml" />
|
||||
<xi:include href="xml/gtkaccelmap.xml" />
|
||||
<xi:include href="xml/gtksettings.xml" />
|
||||
<xi:include href="xml/gtkbindings.xml" />
|
||||
<xi:include href="xml/gtkenums.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
<xi:include href="xml/filesystem.xml" />
|
||||
|
||||
@@ -53,26 +53,6 @@ gtk_about_dialog_get_type
|
||||
<SECTION>
|
||||
<FILE>gtkaccelgroup</FILE>
|
||||
<TITLE>Keyboard Accelerators</TITLE>
|
||||
GtkAccelGroup
|
||||
GtkAccelGroupClass
|
||||
gtk_accel_group_new
|
||||
GtkAccelFlags
|
||||
gtk_accel_group_connect
|
||||
gtk_accel_group_connect_by_path
|
||||
GtkAccelGroupActivate
|
||||
GtkAccelGroupFindFunc
|
||||
gtk_accel_group_disconnect
|
||||
gtk_accel_group_disconnect_key
|
||||
gtk_accel_group_activate
|
||||
gtk_accel_group_lock
|
||||
gtk_accel_group_unlock
|
||||
gtk_accel_group_get_is_locked
|
||||
gtk_accel_group_from_accel_closure
|
||||
gtk_accel_group_get_modifier_mask
|
||||
gtk_accel_groups_activate
|
||||
gtk_accel_groups_from_object
|
||||
gtk_accel_group_find
|
||||
GtkAccelKey
|
||||
gtk_accelerator_valid
|
||||
gtk_accelerator_parse
|
||||
gtk_accelerator_name
|
||||
@@ -80,54 +60,7 @@ gtk_accelerator_get_label
|
||||
gtk_accelerator_parse_with_keycode
|
||||
gtk_accelerator_name_with_keycode
|
||||
gtk_accelerator_get_label_with_keycode
|
||||
gtk_accelerator_set_default_mod_mask
|
||||
gtk_accelerator_get_default_mod_mask
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_ACCEL_GROUP
|
||||
GTK_ACCEL_GROUP
|
||||
GTK_IS_ACCEL_GROUP
|
||||
GTK_ACCEL_GROUP_CLASS
|
||||
GTK_IS_ACCEL_GROUP_CLASS
|
||||
GTK_ACCEL_GROUP_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GTK_ACCEL_GROUP_GET_PRIVATE
|
||||
GtkAccelGroupPrivate
|
||||
GtkAccelGroupEntry
|
||||
gtk_accel_group_query
|
||||
gtk_accel_group_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkaccelmap</FILE>
|
||||
<TITLE>Accelerator Maps</TITLE>
|
||||
GtkAccelMap
|
||||
GtkAccelMapForeach
|
||||
gtk_accel_map_add_entry
|
||||
gtk_accel_map_lookup_entry
|
||||
gtk_accel_map_change_entry
|
||||
gtk_accel_map_load
|
||||
gtk_accel_map_save
|
||||
gtk_accel_map_foreach
|
||||
gtk_accel_map_load_fd
|
||||
gtk_accel_map_save_fd
|
||||
gtk_accel_map_load_scanner
|
||||
gtk_accel_map_add_filter
|
||||
gtk_accel_map_foreach_unfiltered
|
||||
gtk_accel_map_get
|
||||
gtk_accel_map_lock_path
|
||||
gtk_accel_map_unlock_path
|
||||
<SUBSECTION Standard>
|
||||
GTK_ACCEL_MAP
|
||||
GTK_TYPE_ACCEL_MAP
|
||||
GTK_IS_ACCEL_MAP
|
||||
GTK_ACCEL_MAP_CLASS
|
||||
GTK_IS_ACCEL_MAP_CLASS
|
||||
GTK_ACCEL_MAP_GET_CLASS
|
||||
GtkAccelMapClass
|
||||
<SUBSECTION Private>
|
||||
gtk_accel_map_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -135,10 +68,6 @@ gtk_accel_map_get_type
|
||||
<TITLE>GtkAccelLabel</TITLE>
|
||||
GtkAccelLabel
|
||||
gtk_accel_label_new
|
||||
gtk_accel_label_set_accel_closure
|
||||
gtk_accel_label_get_accel_closure
|
||||
gtk_accel_label_get_accel_widget
|
||||
gtk_accel_label_set_accel_widget
|
||||
gtk_accel_label_get_accel_width
|
||||
gtk_accel_label_set_accel
|
||||
gtk_accel_label_get_accel
|
||||
@@ -670,6 +599,8 @@ gtk_color_button_new
|
||||
gtk_color_button_new_with_rgba
|
||||
gtk_color_button_set_title
|
||||
gtk_color_button_get_title
|
||||
gtk_color_button_set_modal
|
||||
gtk_color_button_get_modal
|
||||
<SUBSECTION Standard>
|
||||
GTK_COLOR_BUTTON
|
||||
GTK_IS_COLOR_BUTTON
|
||||
@@ -1226,6 +1157,8 @@ gtk_file_chooser_button_get_title
|
||||
gtk_file_chooser_button_set_title
|
||||
gtk_file_chooser_button_get_width_chars
|
||||
gtk_file_chooser_button_set_width_chars
|
||||
gtk_file_chooser_button_get_modal
|
||||
gtk_file_chooser_button_set_modal
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_FILE_CHOOSER_BUTTON
|
||||
@@ -1316,6 +1249,7 @@ GtkFlattenListModel
|
||||
gtk_flatten_list_model_new
|
||||
gtk_flatten_list_model_set_model
|
||||
gtk_flatten_list_model_get_model
|
||||
gtk_flatten_list_model_get_model_for_item
|
||||
<SUBSECTION Standard>
|
||||
GTK_FLATTEN_LIST_MODEL
|
||||
GTK_IS_FLATTEN_LIST_MODEL
|
||||
@@ -1339,6 +1273,8 @@ gtk_font_button_set_use_size
|
||||
gtk_font_button_get_use_size
|
||||
gtk_font_button_set_title
|
||||
gtk_font_button_get_title
|
||||
gtk_font_button_set_modal
|
||||
gtk_font_button_get_modal
|
||||
<SUBSECTION Standard>
|
||||
GTK_FONT_BUTTON
|
||||
GTK_IS_FONT_BUTTON
|
||||
@@ -2368,6 +2304,12 @@ GtkSettingsValue
|
||||
gtk_settings_get_default
|
||||
gtk_settings_get_for_display
|
||||
gtk_settings_reset_property
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_theme_get_dark_variant
|
||||
gtk_theme_get_light_variant
|
||||
gtk_theme_get_available_themes
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkSettingsClass
|
||||
GTK_IS_SETTINGS
|
||||
@@ -4034,10 +3976,9 @@ gtk_widget_add_tick_callback
|
||||
gtk_widget_remove_tick_callback
|
||||
gtk_widget_size_allocate
|
||||
gtk_widget_allocate
|
||||
gtk_widget_add_accelerator
|
||||
gtk_widget_remove_accelerator
|
||||
gtk_widget_set_accel_path
|
||||
gtk_widget_list_accel_closures
|
||||
gtk_widget_class_add_shortcut
|
||||
gtk_widget_class_add_binding
|
||||
gtk_widget_class_add_binding_signal
|
||||
gtk_widget_can_activate_accel
|
||||
gtk_widget_activate
|
||||
gtk_widget_is_focus
|
||||
@@ -4133,7 +4074,6 @@ gtk_widget_get_support_multidevice
|
||||
gtk_widget_get_realized
|
||||
gtk_widget_get_mapped
|
||||
gtk_widget_device_is_shadowed
|
||||
gtk_widget_get_modifier_mask
|
||||
gtk_widget_get_opacity
|
||||
gtk_widget_set_opacity
|
||||
gtk_widget_get_overflow
|
||||
@@ -4253,8 +4193,6 @@ gtk_window_new
|
||||
gtk_window_set_title
|
||||
gtk_window_set_resizable
|
||||
gtk_window_get_resizable
|
||||
gtk_window_add_accel_group
|
||||
gtk_window_remove_accel_group
|
||||
gtk_window_set_modal
|
||||
gtk_window_set_default_size
|
||||
gtk_window_set_hide_on_close
|
||||
@@ -4266,11 +4204,6 @@ gtk_window_is_active
|
||||
gtk_window_is_maximized
|
||||
gtk_window_get_toplevels
|
||||
gtk_window_list_toplevels
|
||||
gtk_window_add_mnemonic
|
||||
gtk_window_remove_mnemonic
|
||||
gtk_window_mnemonic_activate
|
||||
gtk_window_activate_key
|
||||
gtk_window_propagate_key_event
|
||||
gtk_window_get_focus
|
||||
gtk_window_set_focus
|
||||
gtk_window_get_default_widget
|
||||
@@ -4280,20 +4213,13 @@ gtk_window_present_with_time
|
||||
gtk_window_close
|
||||
gtk_window_minimize
|
||||
gtk_window_unminimize
|
||||
gtk_window_stick
|
||||
gtk_window_unstick
|
||||
gtk_window_maximize
|
||||
gtk_window_unmaximize
|
||||
gtk_window_fullscreen
|
||||
gtk_window_fullscreen_on_monitor
|
||||
gtk_window_unfullscreen
|
||||
gtk_window_set_keep_above
|
||||
gtk_window_set_keep_below
|
||||
gtk_window_set_decorated
|
||||
gtk_window_set_deletable
|
||||
gtk_window_set_mnemonic_modifier
|
||||
gtk_window_set_accept_focus
|
||||
gtk_window_set_focus_on_map
|
||||
gtk_window_set_startup_id
|
||||
gtk_window_get_decorated
|
||||
gtk_window_get_deletable
|
||||
@@ -4301,13 +4227,10 @@ gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_icon_name
|
||||
gtk_window_get_mnemonic_modifier
|
||||
gtk_window_get_modal
|
||||
gtk_window_get_size
|
||||
gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
gtk_window_get_accept_focus
|
||||
gtk_window_get_focus_on_map
|
||||
gtk_window_get_group
|
||||
gtk_window_has_group
|
||||
gtk_window_resize
|
||||
@@ -4376,12 +4299,6 @@ gtk_init_check
|
||||
<SUBSECTION>
|
||||
GTK_PRIORITY_RESIZE
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_get_current_event
|
||||
gtk_get_current_event_time
|
||||
gtk_get_current_event_state
|
||||
gtk_get_current_event_device
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_init_abi_check
|
||||
gtk_init_check_abi_check
|
||||
@@ -4526,7 +4443,6 @@ gtk_style_context_get_margin
|
||||
gtk_style_context_lookup_color
|
||||
gtk_style_context_remove_provider
|
||||
gtk_style_context_remove_provider_for_display
|
||||
gtk_style_context_reset_widgets
|
||||
gtk_style_context_restore
|
||||
gtk_style_context_save
|
||||
gtk_style_context_add_class
|
||||
@@ -4617,26 +4533,6 @@ gtk_css_provider_error_quark
|
||||
gtk_css_section_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbindings</FILE>
|
||||
<TITLE>Bindings</TITLE>
|
||||
GtkBindingSet
|
||||
gtk_binding_set_new
|
||||
gtk_binding_set_by_class
|
||||
gtk_binding_set_find
|
||||
gtk_bindings_activate
|
||||
gtk_bindings_activate_event
|
||||
gtk_binding_set_activate
|
||||
gtk_binding_entry_add_action
|
||||
gtk_binding_entry_add_action_variant
|
||||
GtkBindingCallback
|
||||
gtk_binding_entry_add_callback
|
||||
gtk_binding_entry_add_signal
|
||||
gtk_binding_entry_add_signal_from_string
|
||||
gtk_binding_entry_skip
|
||||
gtk_binding_entry_remove
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkenums</FILE>
|
||||
<TITLE>Standard Enumerations</TITLE>
|
||||
@@ -5221,7 +5117,9 @@ gtk_mount_operation_set_parent
|
||||
gtk_mount_operation_get_parent
|
||||
gtk_mount_operation_set_display
|
||||
gtk_mount_operation_get_display
|
||||
gtk_show_uri_on_window
|
||||
gtk_show_uri_full
|
||||
gtk_show_uri_full_finish
|
||||
gtk_show_uri
|
||||
<SUBSECTION Standard>
|
||||
GTK_IS_MOUNT_OPERATION
|
||||
GTK_IS_MOUNT_OPERATION_CLASS
|
||||
@@ -5451,6 +5349,8 @@ gtk_app_chooser_button_get_show_dialog_item
|
||||
gtk_app_chooser_button_set_show_dialog_item
|
||||
gtk_app_chooser_button_get_heading
|
||||
gtk_app_chooser_button_set_heading
|
||||
gtk_app_chooser_button_get_modal
|
||||
gtk_app_chooser_button_set_modal
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_APP_CHOOSER_BUTTON
|
||||
@@ -5925,6 +5825,12 @@ gtk_event_controller_set_propagation_limit
|
||||
gtk_event_controller_get_widget
|
||||
gtk_event_controller_reset
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_event_controller_get_current_event
|
||||
gtk_event_controller_get_current_event_device
|
||||
gtk_event_controller_get_current_event_state
|
||||
gtk_event_controller_get_current_event_time
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_EVENT_CONTROLLER
|
||||
GTK_EVENT_CONTROLLER
|
||||
@@ -6061,6 +5967,152 @@ GTK_EVENT_CONTROLLER_MOTION_GET_CLASS
|
||||
gtk_event_controller_motion_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcuttrigger</FILE>
|
||||
<TITLE>GtkShortcutTrigger</TITLE>
|
||||
GtkShortcutTrigger
|
||||
GtkNeverTrigger
|
||||
|
||||
gtk_shortcut_trigger_trigger
|
||||
gtk_shortcut_trigger_hash
|
||||
gtk_shortcut_trigger_equal
|
||||
gtk_shortcut_trigger_compare
|
||||
gtk_shortcut_trigger_to_string
|
||||
gtk_shortcut_trigger_print
|
||||
gtk_shortcut_trigger_to_label
|
||||
gtk_shortcut_trigger_print_label
|
||||
gtk_shortcut_trigger_parse_string
|
||||
|
||||
<SUBSECTION>
|
||||
GtkKeyvalTrigger
|
||||
gtk_keyval_trigger_new
|
||||
gtk_keyval_trigger_get_modifiers
|
||||
gtk_keyval_trigger_get_keyval
|
||||
|
||||
<SUBSECTION>
|
||||
GtkMnemonicTrigger
|
||||
gtk_mnemonic_trigger_new
|
||||
gtk_mnemonic_trigger_get_keyval
|
||||
|
||||
<SUBSECTION>
|
||||
GtkAlternativeTrigger
|
||||
gtk_alternative_trigger_new
|
||||
gtk_alternative_trigger_get_first
|
||||
|
||||
<SUBSECTION>
|
||||
GtkNeverTrigger
|
||||
gtk_never_trigger_get
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_shortcut_trigger_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcutaction</FILE>
|
||||
<TITLE>GtkShortcutAction</TITLE>
|
||||
GtkShortcutAction
|
||||
gtk_shortcut_action_to_string
|
||||
gtk_shortcut_action_print
|
||||
gtk_shortcut_action_parse_string
|
||||
gtk_shortcut_action_activate
|
||||
|
||||
<SUBSECTION>
|
||||
GtkNothingAction
|
||||
gtk_nothing_action_get
|
||||
|
||||
<SUBSECTION>
|
||||
GtkCallbackAction
|
||||
gtk_callback_action_new
|
||||
|
||||
<SUBSECTION>
|
||||
GtkMnemonicAction
|
||||
gtk_mnemonic_action_get
|
||||
|
||||
<SUBSECTION>
|
||||
GtkActivateAction
|
||||
gtk_activate_action_get
|
||||
|
||||
<SUBSECTION>
|
||||
GtkSignalAction
|
||||
gtk_signal_action_new
|
||||
gtk_signal_action_get_signal_name
|
||||
|
||||
<SUBSECTION>
|
||||
GtkNamedAction
|
||||
gtk_named_action_new
|
||||
gtk_named_action_get_action_name
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_shortcut_action_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcut</FILE>
|
||||
<TITLE>GtkShortcut</TITLE>
|
||||
GtkShortcut
|
||||
gtk_shortcut_new
|
||||
gtk_shortcut_new_with_arguments
|
||||
gtk_shortcut_get_trigger
|
||||
gtk_shortcut_set_trigger
|
||||
gtk_shortcut_get_action
|
||||
gtk_shortcut_set_action
|
||||
gtk_shortcut_get_arguments
|
||||
gtk_shortcut_set_arguments
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SHORTCUT
|
||||
GTK_SHORTCUT
|
||||
GTK_SHORTCUT_CLASS
|
||||
GTK_IS_SHORTCUT
|
||||
GTK_IS_SHORTCUT_CLASS
|
||||
GTK_SHORTCUT_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_shortcut_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcutmanager</FILE>
|
||||
<TITLE>GtkShortcutManager</TITLE>
|
||||
GtkShortcutManager
|
||||
GtkShortcutManagerInterface
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcutcontroller</FILE>
|
||||
<TITLE>GtkShortcutController</TITLE>
|
||||
GtkShortcutController
|
||||
gtk_shortcut_controller_new
|
||||
gtk_shortcut_controller_new_with_model
|
||||
GtkShortcutScope
|
||||
GtkShortcutManager
|
||||
GtkShortcutManagerInterface
|
||||
gtk_shortcut_controller_set_mnemonics_modifiers
|
||||
gtk_shortcut_controller_get_mnemonics_modifiers
|
||||
gtk_shortcut_controller_set_scope
|
||||
gtk_shortcut_controller_get_scope
|
||||
gtk_shortcut_controller_add_shortcut
|
||||
gtk_shortcut_controller_remove_shortcut
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SHORTCUT_CONTROLLER
|
||||
GTK_SHORTCUT_CONTROLLER
|
||||
GTK_SHORTCUT_CONTROLLER_CLASS
|
||||
GTK_IS_SHORTCUT_CONTROLLER
|
||||
GTK_IS_SHORTCUT_CONTROLLER_CLASS
|
||||
GTK_SHORTCUT_CONTROLLER_GET_CLASS
|
||||
GTK_TYPE_SHORTCUT_MANAGER
|
||||
GTK_SHORTCUT_MANAGER
|
||||
GTK_SHORTCUT_MANAGER_CLASS
|
||||
GTK_IS_SHORTCUT_MANAGER
|
||||
GTK_IS_SHORTCUT_MANAGER_CLASS
|
||||
GTK_SHORTCUT_MANAGER_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_shortcut_controller_get_type
|
||||
gtk_shortcut_manager_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerkey</FILE>
|
||||
<TITLE>GtkEventControllerKey</TITLE>
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#include <gtk/gtkunixprint.h>
|
||||
|
||||
gtk_about_dialog_get_type
|
||||
gtk_accel_group_get_type
|
||||
gtk_accel_label_get_type
|
||||
gtk_accel_map_get_type
|
||||
gtk_accessible_get_type
|
||||
gtk_actionable_get_type
|
||||
gtk_action_bar_get_type
|
||||
@@ -165,7 +163,10 @@ gtk_search_entry_get_type
|
||||
gtk_selection_model_get_type
|
||||
gtk_separator_get_type
|
||||
gtk_settings_get_type
|
||||
gtk_shortcut_get_type
|
||||
gtk_shortcut_controller_get_type
|
||||
gtk_shortcut_label_get_type
|
||||
gtk_shortcut_manager_get_type
|
||||
gtk_shortcuts_window_get_type
|
||||
gtk_shortcuts_section_get_type
|
||||
gtk_shortcuts_group_get_type
|
||||
|
||||
@@ -63,25 +63,19 @@
|
||||
GDK translates these raw windowing system events into #GdkEvents.
|
||||
Typical input events are:
|
||||
<simplelist>
|
||||
<member>#GdkEventButton</member>
|
||||
<member>#GdkEventMotion</member>
|
||||
<member>#GdkEventCrossing</member>
|
||||
<member>#GdkEventKey</member>
|
||||
<member>#GdkEventFocus</member>
|
||||
<member>#GdkEventTouch</member>
|
||||
<member>button clicks</member>
|
||||
<member>pointer motion</member>
|
||||
<member>key presses</member>
|
||||
<member>focus changes</member>
|
||||
<member>touch events</member>
|
||||
</simplelist>
|
||||
These are all represented as #GdkEvents, but you can differentiate
|
||||
between different events by looking at their type, using
|
||||
gdk_event_get_event_type().
|
||||
</para>
|
||||
<para>
|
||||
Additionally, GDK/GTK synthesizes other signals to let know whether
|
||||
grabs (system-wide or in-app) are taking input away:
|
||||
<simplelist>
|
||||
<member>#GdkEventGrabBroken</member>
|
||||
<member>#GtkWidget::grab-notify</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
When GTK creates a GdkSurface, it connects to the ::event signal
|
||||
on it, which receives all of these input events. Surfaces have
|
||||
When GTK creates a GdkSurface, it connects to the #GdkSurface::event
|
||||
signal on it, which receives all of these input events. Surfaces have
|
||||
have signals and properties, e.g. to deal with window management
|
||||
related events.
|
||||
</para>
|
||||
@@ -96,14 +90,11 @@
|
||||
</para>
|
||||
<orderedlist>
|
||||
<listitem><para>
|
||||
Compress enter/leave notify events. If the event passed build an
|
||||
enter/leave pair together with the next event (peeked from GDK), both
|
||||
events are thrown away. This is to avoid a backlog of (de-)highlighting
|
||||
widgets crossed by the pointer.
|
||||
Find the widget which got the event.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Find the widget which got the event. If the widget can’t be determined
|
||||
the event is thrown away unless it belongs to a INCR transaction.
|
||||
Generate crossing (i.e. enter and leave) events when the focus or hover
|
||||
location change from one widget to another.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Then the event is pushed onto a stack so you can query the currently
|
||||
@@ -137,24 +128,6 @@
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>
|
||||
When a GDK backend produces an input event, it is tied to a #GdkDevice and
|
||||
a #GdkSurface, which in turn represents a windowing system surface in the
|
||||
backend. If a widget has grabbed the current input device, or all input
|
||||
devices, the event is propagated to that #GtkWidget. Otherwise, it is
|
||||
propagated to the the #GtkRoot which owns the #GdkSurface receiving the event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Grabs are implemented for each input device, and globally. A grab for a
|
||||
specific input device (gtk_device_grab_add()), is sent events in
|
||||
preference to a global grab (gtk_grab_add()). Input grabs only have effect
|
||||
within the #GtkWindowGroup containing the #GtkWidget which registered the
|
||||
event’s #GdkSurface. If this #GtkWidget is a child of the grab widget, the
|
||||
event is propagated to the child — this is the basis for propagating
|
||||
events within modal dialogs.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
An event is propagated down and up the widget hierarchy in three phases
|
||||
(see #GtkPropagationPhase) towards a target widget.
|
||||
@@ -219,71 +192,75 @@
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Grabs</title>
|
||||
|
||||
<para>
|
||||
Grabs are a method to claim all input events from a device,
|
||||
they happen either implicitly on pointer and touch devices,
|
||||
or explicitly. Implicit grabs happen on user interaction, when
|
||||
a #GdkEventButtonPress happens, all events from then on, until
|
||||
after the corresponding #GdkEventButtonRelease, will be reported
|
||||
to the widget that got the first event. Likewise, on touch events,
|
||||
every #GdkEventSequence will deliver only events to the widget
|
||||
that received its %GDK_TOUCH_BEGIN event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Explicit grabs happen programatically (both activation and
|
||||
deactivation), and can be either system-wide (GDK grabs) or
|
||||
application-wide (GTK grabs). On the windowing platforms that
|
||||
support it, GDK grabs will prevent any interaction with any other
|
||||
application/window/widget than the grabbing one, whereas GTK grabs
|
||||
will be effective only within the application (across all its
|
||||
windows), still allowing for interaction with other applications.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
But one important aspect of grabs is that they may potentially
|
||||
happen at any point somewhere else, even while the pointer/touch
|
||||
device is already grabbed. This makes it necessary for widgets to
|
||||
handle the cancellation of any ongoing interaction. Depending on
|
||||
whether a GTK or GDK grab is causing this, the widget will
|
||||
respectively receive a #GtkWidget::grab-notify signal, or a
|
||||
#GdkEventGrabBroken event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On gestures, these signals are handled automatically, causing the
|
||||
gesture to cancel all tracked pointer/touch events, and signal
|
||||
the end of recognition.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Keyboard input</title>
|
||||
|
||||
<para>
|
||||
Every #GtkWindow maintains a single focus location (in
|
||||
the ::focus-widget property). The focus widget is the
|
||||
target widget for key events sent to the window. Only
|
||||
widgets which have ::can-focus set to %TRUE can become
|
||||
the focus. Typically these are input controls such as
|
||||
entries or text fields, but e.g. buttons can take the
|
||||
focus too.
|
||||
Every #GtkWindow maintains a single focus location (in the
|
||||
#GtkWindow:focus-widget property). The focus widget is the target
|
||||
widget for key events sent to the window. Only widgets which have
|
||||
#GtkWidget:can-focus set to %TRUE can become the focus. Typically
|
||||
these are input controls such as entries or text fields, but e.g.
|
||||
buttons can take the focus too.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Input widgets can be given the focus by clicking on them,
|
||||
but focus can also be moved around with certain key
|
||||
events (this is known as “keyboard navigation”). GTK
|
||||
reserves the Tab key to move the focus to the next location,
|
||||
and Shift-Tab to move it back to the previous one. In addition
|
||||
many containers allow “directional navigation” with the
|
||||
arrow keys.
|
||||
Input widgets can be given the focus by clicking on them, but focus
|
||||
can also be moved around with certain key events (this is known as
|
||||
“keyboard navigation”). GTK reserves the Tab key to move the focus
|
||||
to the next location, and Shift-Tab to move it back to the previous
|
||||
one. In addition many containers allow “directional navigation” with
|
||||
the arrow keys.
|
||||
</para>
|
||||
|
||||
<!-- mnemonics, accelerators, bindings -->
|
||||
<para>
|
||||
Many widgets can be “activated” to trigger and action. E.g., you can
|
||||
activate a button or switch by clicking on them, but you can also
|
||||
activate them with the keyboard, by using the Enter or Space keys.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Apart from keyboard navigation, activation and directly typing into
|
||||
entries or text views, GTK widgets can use key events for activating
|
||||
“shortcuts”. Shortcuts generally act as a quick way to move the focus
|
||||
around or to activate a widget that does not currently have the focus.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GTK has traditionally supported different kinds of shortcuts:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Mnmemonics</term>
|
||||
<listitem><para>
|
||||
Mnemonics are usually triggered using Alt as a modifier for a letter.
|
||||
They are used in places where a label is associated with a control,
|
||||
and are indicated by underlining the letter in the label. As a special
|
||||
case, inside menus (i.e. inside #GtkPopoverMenu), mnemonics can be
|
||||
trigered without the modifier.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>Key bindings</term>
|
||||
<listitem><para>
|
||||
Key bindings are specific to individual widgets, such as Ctrl-C or
|
||||
Ctrl-V in an entry copy to or paste from the clipboard. They are only
|
||||
triggered when the widget has focus.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>Accelerators</term>
|
||||
<listitem><para>
|
||||
Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<para>
|
||||
Under the hood, all shortcuts are represented as instances of #GtkShortcut,
|
||||
and they are managed by #GtkShortcutController.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="event-controllers-and-gestures">
|
||||
@@ -330,6 +307,13 @@
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Shortcuts are handled by #GtkShortcutController, which is
|
||||
a complex event handler that can either activate shortcuts
|
||||
itself, or propagate them to another controller, depending
|
||||
on its #GtkShortcutController:scope.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
|
||||
@@ -339,6 +339,15 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using gtk_get_current_... APIs</title>
|
||||
<para>
|
||||
The function gtk_get_current_event() and its variants have been
|
||||
replaced by equivalent event controller APIs:
|
||||
gtk_event_controller_get_current_event(), etc.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to surface API changes</title>
|
||||
<para>
|
||||
@@ -397,8 +406,29 @@
|
||||
<section>
|
||||
<title>Adapt to GdkKeymap API changes</title>
|
||||
<para>
|
||||
The way to get a keymap has changed slightly. gdk_keymap_get_for_display() has
|
||||
been renamed to gdk_display_get_keymap().
|
||||
GdkKeymap no longer exists as an independent object.
|
||||
</para>
|
||||
<para>
|
||||
If you need access to keymap state, it is now exposed as properties
|
||||
on the #GdkDevice representing the keyboard: #GdkDevice:direction,
|
||||
#GdkDevice:has-bidi-layouts, #GdkDevice:caps-lock-state,
|
||||
#GdkDevice:num-lock-state, #GdkDevice:scroll-lock-state and
|
||||
#GdkDevice:modifier-state.
|
||||
To obtain the keyboard device, you can use
|
||||
<literal>gdk_seat_get_keyboard (gdk_display_get_default_seat (display))</literal>.
|
||||
</para>
|
||||
<para>
|
||||
If you need access to translated keys for event handling, #GdkEvent
|
||||
now includes all of the translated key state, including consumed
|
||||
modifiers, group and shift level, so there should be no need to
|
||||
do manually call gdk_keymap_translate_keyboard_state() (which has
|
||||
been removed).
|
||||
</para>
|
||||
<para>
|
||||
If you need to do forward or backward mapping between key codes
|
||||
and key values, use gdk_display_map_keycode() and gdk_display_map_keyval(),
|
||||
which is the replacement for gdk_keymap_get_entries_for_keycode()
|
||||
and gdk_keymap_get_entries_for_keycode().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -417,6 +447,54 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to changes in keyboard modifier handling</title>
|
||||
<para>
|
||||
GTK 3 has the idea that use of modifiers may differ between different
|
||||
platforms, and has a #GdkModifierIntent api to let platforms provide
|
||||
hint about how modifiers are expected to be used. It also promoted
|
||||
the use of <Primary> instead of <Control> to specify
|
||||
accelerators that adapt to platform conventions.
|
||||
</para>
|
||||
<para>
|
||||
In GTK 4, the meaning of modifiers has been fixed, and backends are
|
||||
expected to map the platform conventions to the existing modifiers.
|
||||
The expected use of modifiers in GTK 4 is:
|
||||
<simplelist>
|
||||
<member>GDK_CONTROL_MASK - Primary accelerators</member>
|
||||
<member>GDK_ALT_MASK - Mnemonics</member>
|
||||
<member>GDK_SHIFT_MASK - Extending selections</member>
|
||||
<member>GDK_CONTROL_MASK - Modifying selections</member>
|
||||
<member>GDK_CONTROL_MASK|GDK_ALT_MASK - Prevent text input</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
Consequently, #GdkModifierIntent and related APIs have been removed,
|
||||
and <Control> is preferred over <Primary> in accelerators.
|
||||
</para>
|
||||
<para>
|
||||
A related change is that GTK 4 no longer supports the use of archaic
|
||||
X11 'real' modifiers with the names Mod1,..., Mod5, and %GDK_MOD1_MASK
|
||||
has been renamed to %GDK_ALT_MASK.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Focus handling changes</title>
|
||||
<para>
|
||||
The semantics of the #GtkWidget:can-focus property have changed.
|
||||
In GTK 3, this property only meant that the widget itself would not
|
||||
accept keyboard input, but its children still might (in the case of
|
||||
containers). In GTK 4, if :can-focus is %FALSE, the focus cannot enter
|
||||
the widget or any of its descendents, and the default value has changed
|
||||
from %FALSE to %TRUE.
|
||||
</para>
|
||||
<para>
|
||||
The recommended way to influence focus behavior of custom widgets
|
||||
in GTK 4 is to override the focus() and grab_focus() vfuncs.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkEventBox</title>
|
||||
<para>
|
||||
@@ -808,15 +886,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using tabular menus</title>
|
||||
<para>
|
||||
Tabular menus were rarely used and complicated the menu code,
|
||||
so they have been removed. If you need complex layout in menu-like
|
||||
popups, consider using a #GtkPopover instead.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using gtk_menu_set_display()</title>
|
||||
<para>
|
||||
@@ -943,6 +1012,13 @@
|
||||
can only be constructed from menu models, so the porting effort involves
|
||||
switching to menu models and actions.
|
||||
</para>
|
||||
<para>
|
||||
Tabular menus were rarely used and complicated the menu code,
|
||||
so they have not been brought over to #GtkPopoverMenu. If you need
|
||||
complex layout in menu-like popups, consider directly using a
|
||||
#GtkPopover instead.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Since menus are gone, GtkMenuButton also lost its ability to show menus,
|
||||
and needs to be used with popovers in GTK 4.
|
||||
|
||||
@@ -281,26 +281,20 @@ create_accel_label (void)
|
||||
{
|
||||
WidgetInfo *info;
|
||||
GtkWidget *widget, *button, *box;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
widget = gtk_accel_label_new ("Accel Label");
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (widget), button);
|
||||
gtk_widget_hide (button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
|
||||
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (widget), button);
|
||||
accel_group = gtk_accel_group_new();
|
||||
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (widget), GDK_KEY_Q, GDK_CONTROL_MASK);
|
||||
|
||||
info = new_widget_info ("accel-label", box, SMALL);
|
||||
|
||||
gtk_widget_add_accelerator (button, "activate", accel_group, GDK_KEY_Q, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE | GTK_ACCEL_LOCKED);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -1232,7 +1226,7 @@ create_sidebar (void)
|
||||
stack = gtk_stack_new ();
|
||||
gtk_widget_set_size_request (stack, 120, 120);
|
||||
view = gtk_label_new ("Sidebar");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
|
||||
gtk_widget_add_css_class (view, "view");
|
||||
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_show (view);
|
||||
|
||||
@@ -517,13 +517,13 @@ bloat_pad_startup (GApplication *application)
|
||||
const gchar *action_and_target;
|
||||
const gchar *accelerators[2];
|
||||
} accels[] = {
|
||||
{ "app.new", { "<Primary>n", NULL } },
|
||||
{ "app.quit", { "<Primary>q", NULL } },
|
||||
{ "win.copy", { "<Primary>c", NULL } },
|
||||
{ "win.paste", { "<Primary>p", NULL } },
|
||||
{ "win.justify::left", { "<Primary>l", NULL } },
|
||||
{ "win.justify::center", { "<Primary>m", NULL } },
|
||||
{ "win.justify::right", { "<Primary>r", NULL } }
|
||||
{ "app.new", { "<Control>n", NULL } },
|
||||
{ "app.quit", { "<Control>q", NULL } },
|
||||
{ "win.copy", { "<Control>c", NULL } },
|
||||
{ "win.paste", { "<Control>p", NULL } },
|
||||
{ "win.justify::left", { "<Control>l", NULL } },
|
||||
{ "win.justify::center", { "<Control>m", NULL } },
|
||||
{ "win.justify::right", { "<Control>r", NULL } }
|
||||
};
|
||||
|
||||
G_APPLICATION_CLASS (bloat_pad_parent_class)
|
||||
@@ -592,7 +592,7 @@ bloat_pad_startup (GApplication *application)
|
||||
g_object_unref (item);
|
||||
g_object_unref (icon);
|
||||
|
||||
const gchar *new_accels[] = { "<Primary>n", "<Primary>t", NULL };
|
||||
const gchar *new_accels[] = { "<Control>n", "<Control>t", NULL };
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.new", new_accels);
|
||||
|
||||
dump_accels (GTK_APPLICATION (application));
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include "gdktypes.h"
|
||||
#include "gdkinternals.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -75,14 +75,10 @@ const GDK_CROSSING_GRAB = 1;
|
||||
const GDK_CROSSING_UNGRAB = 2;
|
||||
|
||||
// GdkModifierType
|
||||
const GDK_SHIFT_MASK = 1 << 0;
|
||||
const GDK_SHIFT_MASK = 1 << 0;
|
||||
const GDK_LOCK_MASK = 1 << 1;
|
||||
const GDK_CONTROL_MASK = 1 << 2;
|
||||
const GDK_MOD1_MASK = 1 << 3;
|
||||
const GDK_MOD2_MASK = 1 << 4;
|
||||
const GDK_MOD3_MASK = 1 << 5;
|
||||
const GDK_MOD4_MASK = 1 << 6;
|
||||
const GDK_MOD5_MASK = 1 << 7;
|
||||
const GDK_ALT_MASK = 1 << 3;
|
||||
const GDK_BUTTON1_MASK = 1 << 8;
|
||||
const GDK_BUTTON2_MASK = 1 << 9;
|
||||
const GDK_BUTTON3_MASK = 1 << 10;
|
||||
@@ -91,7 +87,6 @@ const GDK_BUTTON5_MASK = 1 << 12;
|
||||
const GDK_SUPER_MASK = 1 << 26;
|
||||
const GDK_HYPER_MASK = 1 << 27;
|
||||
const GDK_META_MASK = 1 << 28;
|
||||
const GDK_RELEASE_MASK = 1 << 30;
|
||||
|
||||
|
||||
var useDataUrls = window.location.search.includes("datauri");
|
||||
@@ -1384,13 +1379,13 @@ function updateKeyboardStatus() {
|
||||
}
|
||||
|
||||
function updateForEvent(ev) {
|
||||
lastState &= ~(GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_MOD1_MASK);
|
||||
lastState &= ~(GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_ALT_MASK);
|
||||
if (ev.shiftKey)
|
||||
lastState |= GDK_SHIFT_MASK;
|
||||
if (ev.ctrlKey)
|
||||
lastState |= GDK_CONTROL_MASK;
|
||||
if (ev.altKey)
|
||||
lastState |= GDK_MOD1_MASK;
|
||||
lastState |= GDK_ALT_MASK;
|
||||
|
||||
lastTimeStamp = ev.timeStamp;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include "broadway-protocol.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
typedef struct _GdkBroadwayServer GdkBroadwayServer;
|
||||
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
|
||||
|
||||
@@ -266,6 +266,11 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
GINT_TO_POINTER (message->key.surface_id));
|
||||
if (surface)
|
||||
{
|
||||
GdkTranslatedKey translated;
|
||||
translated.keyval = message->key.key;
|
||||
translated.consumed = 0;
|
||||
translated.layout = 0;
|
||||
translated.level = 0;
|
||||
event = gdk_event_key_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
|
||||
? GDK_KEY_PRESS
|
||||
: GDK_KEY_RELEASE,
|
||||
@@ -273,12 +278,11 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
gdk_seat_get_keyboard (seat),
|
||||
gdk_seat_get_keyboard (seat),
|
||||
message->base.time,
|
||||
message->key.key,
|
||||
message->key.state,
|
||||
message->key.key,
|
||||
message->key.key,
|
||||
message->key.key,
|
||||
0,
|
||||
FALSE);
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
|
||||
@@ -187,19 +187,6 @@ gdk_broadway_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
|
||||
{
|
||||
@@ -217,7 +204,5 @@ gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
|
||||
keymap_class->get_entries_for_keycode = gdk_broadway_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_broadway_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_broadway_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_broadway_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_broadway_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
||||
|
||||
@@ -1499,6 +1499,9 @@ gdk_broadway_toplevel_set_property (GObject *object,
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1541,6 +1544,10 @@ gdk_broadway_toplevel_get_property (GObject *object,
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
g_value_set_boolean (value, surface->shortcuts_inhibited);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
||||
@@ -1,21 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import sys
|
||||
import filecmp
|
||||
|
||||
def replace_if_changed(new, old):
|
||||
'''
|
||||
Compare contents and only replace if changed to avoid triggering a rebuild.
|
||||
'''
|
||||
try:
|
||||
changed = not filecmp.cmp(new, old, shallow=False)
|
||||
except FileNotFoundError:
|
||||
changed = True
|
||||
if changed:
|
||||
os.replace(new, old)
|
||||
else:
|
||||
os.remove(new)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--array-name', help='The name of the array variable')
|
||||
parser.add_argument('--output', metavar='FILE', help='Output file',
|
||||
type=argparse.FileType('w'),
|
||||
default=sys.stdout)
|
||||
parser.add_argument('--output', metavar='STRING', help='Output filename',
|
||||
default=None)
|
||||
parser.add_argument('input', metavar='FILE', help='The input file',
|
||||
type=argparse.FileType('r'))
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
args.output.write('static const char {}[] = {{\n'.format(args.array_name))
|
||||
for line in args.input:
|
||||
for ch in line:
|
||||
args.output.write(' 0x{:02x},\n'.format(ord(ch)))
|
||||
if args.output is None:
|
||||
output = sys.stdout
|
||||
else:
|
||||
output = args.output + '~'
|
||||
|
||||
args.output.write('};')
|
||||
with open(output, 'w') as f:
|
||||
f.write('static const char {}[] = {{\n'.format(args.array_name))
|
||||
for line in args.input:
|
||||
for ch in line:
|
||||
f.write(' 0x{:02x},\n'.format(ord(ch)))
|
||||
f.write('};')
|
||||
|
||||
if args.output is not None:
|
||||
replace_if_changed(output, args.output)
|
||||
|
||||
@@ -67,7 +67,7 @@ libgdk_broadway = static_library('gdk-broadway',
|
||||
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
|
||||
|
||||
executable('gtk4-broadwayd',
|
||||
clienthtml_h, broadwayjs_h,
|
||||
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
|
||||
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
|
||||
include_directories: [confinc, gdkinc, include_directories('.')],
|
||||
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
|
||||
|
||||
@@ -32,7 +32,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkKeymap, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
|
||||
|
||||
+133
@@ -24,6 +24,7 @@
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
/* for the use of round() */
|
||||
#include "fallback-c89.c"
|
||||
@@ -101,6 +102,12 @@ enum {
|
||||
PROP_NUM_TOUCHES,
|
||||
PROP_AXES,
|
||||
PROP_TOOL,
|
||||
PROP_DIRECTION,
|
||||
PROP_HAS_BIDI_LAYOUTS,
|
||||
PROP_CAPS_LOCK_STATE,
|
||||
PROP_NUM_LOCK_STATE,
|
||||
PROP_SCROLL_LOCK_STATE,
|
||||
PROP_MODIFIER_STATE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -281,6 +288,48 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
GDK_TYPE_DEVICE_TOOL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_DIRECTION] =
|
||||
g_param_spec_enum ("direction",
|
||||
P_("Direction"),
|
||||
P_("The direction of the current layout of the keyboard"),
|
||||
PANGO_TYPE_DIRECTION, PANGO_DIRECTION_NEUTRAL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_HAS_BIDI_LAYOUTS] =
|
||||
g_param_spec_boolean ("has-bidi-layouts",
|
||||
P_("Has bidi layouts"),
|
||||
P_("Whether the keyboard has bidi layouts"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_CAPS_LOCK_STATE] =
|
||||
g_param_spec_boolean ("caps-lock-state",
|
||||
P_("Caps lock state"),
|
||||
P_("Whether the keyboard caps lock is on"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_NUM_LOCK_STATE] =
|
||||
g_param_spec_boolean ("num-lock-state",
|
||||
P_("Num lock state"),
|
||||
P_("Whether the keyboard num lock is on"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_SCROLL_LOCK_STATE] =
|
||||
g_param_spec_boolean ("scroll-lock-state",
|
||||
P_("Scroll lock state"),
|
||||
P_("Whether the keyboard scroll lock is on"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_MODIFIER_STATE] =
|
||||
g_param_spec_flags ("modifier-state",
|
||||
P_("Modifier state"),
|
||||
P_("The modifier state of the keyboard"),
|
||||
GDK_TYPE_MODIFIER_TYPE, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||
|
||||
/**
|
||||
@@ -473,6 +522,24 @@ gdk_device_get_property (GObject *object,
|
||||
case PROP_TOOL:
|
||||
g_value_set_object (value, device->last_tool);
|
||||
break;
|
||||
case PROP_DIRECTION:
|
||||
g_value_set_enum (value, gdk_device_get_direction (device));
|
||||
break;
|
||||
case PROP_HAS_BIDI_LAYOUTS:
|
||||
g_value_set_boolean (value, gdk_device_has_bidi_layouts (device));
|
||||
break;
|
||||
case PROP_CAPS_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_caps_lock_state (device));
|
||||
break;
|
||||
case PROP_NUM_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_num_lock_state (device));
|
||||
break;
|
||||
case PROP_SCROLL_LOCK_STATE:
|
||||
g_value_set_boolean (value, gdk_device_get_scroll_lock_state (device));
|
||||
break;
|
||||
case PROP_MODIFIER_STATE:
|
||||
g_value_set_flags (value, gdk_device_get_modifier_state (device));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1712,3 +1779,69 @@ gdk_device_get_device_tool (GdkDevice *device)
|
||||
|
||||
return device->last_tool;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_device_get_caps_lock_state (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_get_caps_lock_state (keymap);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_device_get_num_lock_state (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_get_num_lock_state (keymap);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_device_get_scroll_lock_state (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_get_scroll_lock_state (keymap);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GdkModifierType
|
||||
gdk_device_get_modifier_state (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_get_modifier_state (keymap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
gdk_device_get_direction (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_get_direction (keymap);
|
||||
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_device_has_bidi_layouts (GdkDevice *device)
|
||||
{
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (device->display);
|
||||
|
||||
if (device->source == GDK_SOURCE_KEYBOARD)
|
||||
return gdk_keymap_have_bidi_layouts (keymap);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -203,6 +203,24 @@ guint gdk_device_get_num_touches (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_num_lock_state (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoDirection gdk_device_get_direction (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_H__ */
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdkseat.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -1711,3 +1711,75 @@ gdk_display_set_cursor_theme (GdkDisplay *display,
|
||||
if (GDK_DISPLAY_GET_CLASS (display)->set_cursor_theme)
|
||||
GDK_DISPLAY_GET_CLASS (display)->set_cursor_theme (display, name, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_map_keyval:
|
||||
* @display: a #GdkDisplay
|
||||
* @keyval: a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
|
||||
* @keys: (out) (array length=n_keys) (transfer full): return location
|
||||
* for an array of #GdkKeymapKey
|
||||
* @n_keys: return location for number of elements in returned array
|
||||
*
|
||||
* Obtains a list of keycode/group/level combinations that will
|
||||
* generate @keyval. Groups and levels are two kinds of keyboard mode;
|
||||
* in general, the level determines whether the top or bottom symbol
|
||||
* on a key is used, and the group determines whether the left or
|
||||
* right symbol is used.
|
||||
*
|
||||
* On US keyboards, the shift key changes the keyboard level, and there
|
||||
* are no groups. A group switch key might convert a keyboard between
|
||||
* Hebrew to English modes, for example.
|
||||
*
|
||||
* #GdkEventKey contains a %group field that indicates the active
|
||||
* keyboard group. The level is computed from the modifier mask.
|
||||
*
|
||||
* The returned array should be freed with g_free().
|
||||
*
|
||||
* Returns: %TRUE if keys were found and returned
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_map_keyval (GdkDisplay *display,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
int *n_keys)
|
||||
{
|
||||
return gdk_keymap_get_entries_for_keyval (gdk_display_get_keymap (display),
|
||||
keyval,
|
||||
keys,
|
||||
n_keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_map_keycode:
|
||||
* @display: a #GdkDisplay
|
||||
* @keycode: a keycode
|
||||
* @keys: (out) (array length=n_entries) (transfer full) (optional): return
|
||||
* location for array of #GdkKeymapKey, or %NULL
|
||||
* @keyvals: (out) (array length=n_entries) (transfer full) (optional): return
|
||||
* location for array of keyvals, or %NULL
|
||||
* @n_entries: length of @keys and @keyvals
|
||||
*
|
||||
* Returns the keyvals bound to @keycode. The Nth #GdkKeymapKey
|
||||
* in @keys is bound to the Nth keyval in @keyvals.
|
||||
*
|
||||
* When a keycode is pressed by the user, the keyval from
|
||||
* this list of entries is selected by considering the effective
|
||||
* keyboard group and level.
|
||||
*
|
||||
* Free the returned arrays with g_free().
|
||||
*
|
||||
* Returns: %TRUE if there were any entries
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_map_keycode (GdkDisplay *display,
|
||||
guint keycode,
|
||||
GdkKeymapKey **keys,
|
||||
guint **keyvals,
|
||||
int *n_entries)
|
||||
{
|
||||
return gdk_keymap_get_entries_for_keycode (gdk_display_get_keymap (display),
|
||||
keycode,
|
||||
keys,
|
||||
keyvals,
|
||||
n_entries);
|
||||
}
|
||||
|
||||
+11
-1
@@ -116,7 +116,17 @@ GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
|
||||
gboolean gdk_display_map_keyval (GdkDisplay *display,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
int *n_keys);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_map_keycode (GdkDisplay *display,
|
||||
guint keycode,
|
||||
GdkKeymapKey **keys,
|
||||
guint **keyvals,
|
||||
int *n_entries);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_get_setting (GdkDisplay *display,
|
||||
|
||||
@@ -34,7 +34,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK, DRAG_SURFACE, GObject)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_surface_present (GdkDragSurface *drag_icon,
|
||||
gboolean gdk_drag_surface_present (GdkDragSurface *drag_surface,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
||||
+205
-44
@@ -30,6 +30,7 @@
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -551,10 +552,7 @@ gdk_event_get_axis (GdkEvent *event,
|
||||
*
|
||||
* This function returns whether a #GdkEventButton should trigger a
|
||||
* context menu, according to platform conventions. The right mouse
|
||||
* button always triggers context menus. Additionally, if
|
||||
* gdk_keymap_get_modifier_mask() returns a non-0 mask for
|
||||
* %GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
|
||||
* also trigger a context menu if this modifier is pressed.
|
||||
* button always triggers context menus.
|
||||
*
|
||||
* This function should always be used instead of simply checking for
|
||||
* event->button == %GDK_BUTTON_SECONDARY.
|
||||
@@ -569,25 +567,12 @@ gdk_event_triggers_context_menu (GdkEvent *event)
|
||||
if (event->any.type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
GdkDisplay *display;
|
||||
GdkModifierType modifier;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (bevent->any.surface), FALSE);
|
||||
|
||||
if (bevent->button == GDK_BUTTON_SECONDARY &&
|
||||
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
||||
return TRUE;
|
||||
|
||||
display = gdk_surface_get_display (bevent->any.surface);
|
||||
|
||||
modifier = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
|
||||
GDK_MODIFIER_INTENT_CONTEXT_MENU);
|
||||
|
||||
if (modifier != 0 &&
|
||||
bevent->button == GDK_BUTTON_PRIMARY &&
|
||||
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
|
||||
(bevent->state & modifier))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -931,17 +916,16 @@ gdk_event_proximity_new (GdkEventType type,
|
||||
}
|
||||
|
||||
GdkEvent *
|
||||
gdk_event_key_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
guint keyval,
|
||||
guint16 keycode,
|
||||
guint16 scancode,
|
||||
guint8 group,
|
||||
gboolean is_modifier)
|
||||
gdk_event_key_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
gboolean is_modifier,
|
||||
GdkTranslatedKey *translated,
|
||||
GdkTranslatedKey *no_lock)
|
||||
{
|
||||
GdkEventKey *event;
|
||||
|
||||
@@ -956,12 +940,11 @@ gdk_event_key_new (GdkEventType type,
|
||||
event->any.surface = g_object_ref (surface);
|
||||
event->any.device = g_object_ref (device);
|
||||
event->any.source_device = g_object_ref (source_device);
|
||||
event->keycode = keycode;
|
||||
event->state = state;
|
||||
event->keyval = keyval;
|
||||
event->hardware_keycode = keycode;
|
||||
event->key_scancode = scancode;
|
||||
event->group = group;
|
||||
event->any.key_is_modifier = is_modifier;
|
||||
event->translated[0] = *translated;
|
||||
event->translated[1] = *no_lock;
|
||||
|
||||
return (GdkEvent *)event;
|
||||
}
|
||||
@@ -1669,7 +1652,7 @@ gdk_key_event_get_keyval (GdkEvent *event)
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, 0);
|
||||
|
||||
return event->key.keyval;
|
||||
return event->key.translated[0].keyval;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1686,41 +1669,58 @@ gdk_key_event_get_keycode (GdkEvent *event)
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, 0);
|
||||
|
||||
return event->key.hardware_keycode;
|
||||
return event->key.keycode;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_scancode:
|
||||
* gdk_key_event_get_level:
|
||||
* @event: a key event
|
||||
*
|
||||
* Extracts the scancode from a key event.
|
||||
* Extracts the shift level from a key event.
|
||||
*
|
||||
* Returns: the scancode of @event
|
||||
* Returns: the shift level of @event
|
||||
*/
|
||||
guint
|
||||
gdk_key_event_get_scancode (GdkEvent *event)
|
||||
gdk_key_event_get_level (GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, 0);
|
||||
|
||||
return event->key.key_scancode;
|
||||
return event->key.translated[0].level;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_group:
|
||||
* gdk_key_event_get_layout:
|
||||
* @event: a key event
|
||||
*
|
||||
* Extracts the group from a key event.
|
||||
* Extracts the layout from a key event.
|
||||
*
|
||||
* Returns: the group of @event
|
||||
* Returns: the layout of @event
|
||||
*/
|
||||
guint
|
||||
gdk_key_event_get_group (GdkEvent *event)
|
||||
gdk_key_event_get_layout (GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, 0);
|
||||
|
||||
return event->key.group;
|
||||
return event->key.translated[0].layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_consumed_modifiers:
|
||||
* @event: a key event
|
||||
*
|
||||
* Extracts the consumed modifiers from a key event.
|
||||
*
|
||||
* Returns: the consumed modifiers or @event
|
||||
*/
|
||||
GdkModifierType
|
||||
gdk_key_event_get_consumed_modifiers (GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, 0);
|
||||
|
||||
return event->key.translated[0].consumed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2110,3 +2110,164 @@ gdk_grab_broken_event_get_grab_surface (GdkEvent *event)
|
||||
|
||||
return event->grab_broken.grab_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_matches:
|
||||
* @event: a key #GdkEvent
|
||||
* @keyval: the keyval to match
|
||||
* @modifiers: the modifiers to match
|
||||
*
|
||||
* Matches a key event against a keyboard shortcut that is specified
|
||||
* as a keyval and modifiers. Partial matches are possible where the
|
||||
* combination matches if the currently active group is ignored.
|
||||
*
|
||||
* Note that we ignore Caps Lock for matching.
|
||||
*
|
||||
* Returns: a GdkKeyMatch value describing whether @event matches
|
||||
*/
|
||||
GdkKeyMatch
|
||||
gdk_key_event_matches (GdkEvent *event,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers)
|
||||
{
|
||||
guint keycode;
|
||||
GdkModifierType state;
|
||||
GdkModifierType mask;
|
||||
guint ev_keyval;
|
||||
int layout;
|
||||
int level;
|
||||
GdkModifierType consumed_modifiers;
|
||||
GdkModifierType shift_group_mask;
|
||||
gboolean group_mod_is_accel_mod = FALSE;
|
||||
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, GDK_KEY_MATCH_NONE);
|
||||
|
||||
keycode = event->key.keycode;
|
||||
state = event->key.state & ~GDK_LOCK_MASK;
|
||||
ev_keyval = event->key.translated[1].keyval;
|
||||
layout = event->key.translated[1].layout;
|
||||
level = event->key.translated[1].level;
|
||||
consumed_modifiers = event->key.translated[1].consumed;
|
||||
|
||||
mask = GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_ALT_MASK|
|
||||
GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK;
|
||||
|
||||
/* if the group-toggling modifier is part of the default accel mod
|
||||
* mask, and it is active, disable it for matching
|
||||
*
|
||||
* FIXME: get shift group mask from backends
|
||||
*/
|
||||
shift_group_mask = 0;
|
||||
|
||||
if (mask & shift_group_mask)
|
||||
group_mod_is_accel_mod = TRUE;
|
||||
|
||||
if ((modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask))
|
||||
{
|
||||
/* modifier match */
|
||||
GdkKeymapKey *keys;
|
||||
int n_keys;
|
||||
int i;
|
||||
guint key;
|
||||
|
||||
/* Shift gets consumed and applied for the event,
|
||||
* so apply it to our keyval to match
|
||||
*/
|
||||
key = keyval;
|
||||
if (modifiers & GDK_SHIFT_MASK)
|
||||
{
|
||||
if (key == GDK_KEY_Tab)
|
||||
key = GDK_KEY_ISO_Left_Tab;
|
||||
else
|
||||
key = gdk_keyval_to_upper (key);
|
||||
}
|
||||
|
||||
if (ev_keyval == key && /* exact match */
|
||||
(!group_mod_is_accel_mod ||
|
||||
(state & shift_group_mask) == (modifiers & shift_group_mask)))
|
||||
{
|
||||
return GDK_KEY_MATCH_EXACT;
|
||||
}
|
||||
|
||||
gdk_display_map_keyval (gdk_event_get_display (event), keyval, &keys, &n_keys);
|
||||
|
||||
for (i = 0; i < n_keys; i++)
|
||||
{
|
||||
if (keys[i].keycode == keycode &&
|
||||
keys[i].level == level &&
|
||||
/* Only match for group if it's an accel mod */
|
||||
(!group_mod_is_accel_mod || keys[i].group == layout))
|
||||
{
|
||||
/* partial match */
|
||||
g_free (keys);
|
||||
|
||||
return GDK_KEY_MATCH_PARTIAL;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (keys);
|
||||
}
|
||||
|
||||
|
||||
return GDK_KEY_MATCH_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_key_event_get_match:
|
||||
* @event: a key #GdkEvent
|
||||
* @keyval: (out): return location for a keyval
|
||||
* @modifiers: (out): return location for modifiers
|
||||
*
|
||||
* Gets a keyval and modifier combination that will cause
|
||||
* gdk_event_match() to successfully match the given event.
|
||||
*
|
||||
* Returns: %TRUE on success
|
||||
*/
|
||||
gboolean
|
||||
gdk_key_event_get_match (GdkEvent *event,
|
||||
guint *keyval,
|
||||
GdkModifierType *modifiers)
|
||||
{
|
||||
GdkModifierType mask;
|
||||
guint key;
|
||||
guint accel_key;
|
||||
GdkModifierType accel_mods;
|
||||
GdkModifierType consumed_modifiers;
|
||||
|
||||
g_return_val_if_fail (event->any.type == GDK_KEY_PRESS ||
|
||||
event->any.type == GDK_KEY_RELEASE, FALSE);
|
||||
|
||||
mask = GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_ALT_MASK|
|
||||
GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK;
|
||||
|
||||
accel_key = event->key.translated[1].keyval;
|
||||
accel_mods = event->key.state;
|
||||
consumed_modifiers = event->key.translated[1].consumed;
|
||||
|
||||
if (accel_key == GDK_KEY_Sys_Req &&
|
||||
(accel_mods & GDK_ALT_MASK) != 0)
|
||||
{
|
||||
/* HACK: we don't want to use SysRq as a keybinding (but we do
|
||||
* want Alt+Print), so we avoid translation from Alt+Print to SysRq
|
||||
*/
|
||||
*keyval = GDK_KEY_Print;
|
||||
*modifiers = accel_mods & mask;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
key = gdk_keyval_to_lower (accel_key);
|
||||
|
||||
if (key == GDK_KEY_ISO_Left_Tab)
|
||||
key = GDK_KEY_Tab;
|
||||
|
||||
accel_mods &= mask & ~consumed_modifiers;
|
||||
|
||||
if (accel_key != key)
|
||||
accel_mods |= GDK_SHIFT_MASK;
|
||||
|
||||
*keyval = key;
|
||||
*modifiers = accel_mods;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+30
-2
@@ -363,9 +363,11 @@ guint gdk_key_event_get_keyval (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_key_event_get_keycode (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_key_event_get_scancode (GdkEvent *event);
|
||||
GdkModifierType gdk_key_event_get_consumed_modifiers (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_key_event_get_group (GdkEvent *event);
|
||||
guint gdk_key_event_get_layout (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_key_event_get_level (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_key_event_is_modifier (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -428,6 +430,32 @@ gboolean gdk_events_get_center (GdkEvent *event1,
|
||||
double *x,
|
||||
double *y);
|
||||
|
||||
/**
|
||||
* GdkKeyMatch:
|
||||
* @GDK_KEY_MATCH_NONE: The key event does not match
|
||||
* @GDK_KEY_MATCH_PARTIAL: The key event matches if keyboard state
|
||||
* (specifically, the currently active group) is ignored
|
||||
* @GDK_KEY_MATCH_EXACT: The key event matches
|
||||
*
|
||||
* The possible return values from gdk_key_event_matches()
|
||||
* describe how well an event matches a given keyval and modifiers.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_KEY_MATCH_NONE,
|
||||
GDK_KEY_MATCH_PARTIAL,
|
||||
GDK_KEY_MATCH_EXACT
|
||||
} GdkKeyMatch;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkKeyMatch gdk_key_event_matches (GdkEvent *event,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_key_event_get_match (GdkEvent *event,
|
||||
guint *keyval,
|
||||
GdkModifierType *modifiers);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_EVENTS_H__ */
|
||||
|
||||
+22
-22
@@ -223,6 +223,13 @@ struct _GdkEventScroll
|
||||
GdkDeviceTool *tool;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
guint keyval;
|
||||
GdkModifierType consumed;
|
||||
guint layout;
|
||||
guint level;
|
||||
} GdkTranslatedKey;
|
||||
|
||||
/*
|
||||
* GdkEventKey:
|
||||
* @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
|
||||
@@ -232,13 +239,9 @@ struct _GdkEventScroll
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See #GdkModifierType.
|
||||
* @keyval: the key that was pressed or released. See the
|
||||
* `gdk/gdkkeysyms.h` header file for a
|
||||
* complete list of GDK key codes.
|
||||
* @hardware_keycode: the raw code of the key that was pressed or released.
|
||||
* @group: the keyboard group.
|
||||
* @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
|
||||
* modifier
|
||||
* @keycode: the raw code of the key that was pressed or released.
|
||||
* @translated: the result of translating @keycode. First with the full
|
||||
* @state, then while ignoring Caps Lock.
|
||||
*
|
||||
* Describes a key press or key release event.
|
||||
*/
|
||||
@@ -246,10 +249,8 @@ struct _GdkEventKey
|
||||
{
|
||||
GdkEventAny any;
|
||||
GdkModifierType state;
|
||||
guint keyval;
|
||||
guint16 hardware_keycode;
|
||||
guint16 key_scancode;
|
||||
guint8 group;
|
||||
guint32 keycode;
|
||||
GdkTranslatedKey translated[2];
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -594,17 +595,16 @@ GdkEvent * gdk_event_proximity_new (GdkEventType type,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time);
|
||||
|
||||
GdkEvent * gdk_event_key_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
guint keyval,
|
||||
guint16 keycode,
|
||||
guint16 scancode,
|
||||
guint8 group,
|
||||
gboolean is_modifier);
|
||||
GdkEvent * gdk_event_key_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
gboolean is_modifier,
|
||||
GdkTranslatedKey *translated,
|
||||
GdkTranslatedKey *no_lock);
|
||||
|
||||
GdkEvent * gdk_event_focus_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -181,6 +182,8 @@ void gdk_surface_get_unscaled_size (GdkSurface *surface,
|
||||
int *unscaled_width,
|
||||
int *unscaled_height);
|
||||
gboolean gdk_surface_handle_event (GdkEvent *event);
|
||||
GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface,
|
||||
GdkEvent *event);
|
||||
|
||||
/*****************************************
|
||||
* Interfaces provided by windowing code *
|
||||
@@ -222,6 +225,45 @@ void gdk_synthesize_surface_state (GdkSurface *surface,
|
||||
GdkSurfaceState unset_flags,
|
||||
GdkSurfaceState set_flags);
|
||||
|
||||
/**
|
||||
* GdkGrabStatus:
|
||||
* @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
|
||||
* @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
|
||||
* @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
|
||||
* specified time.
|
||||
* @GDK_GRAB_NOT_VIEWABLE: the grab surface or the @confine_to surface are not
|
||||
* viewable.
|
||||
* @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
|
||||
* @GDK_GRAB_FAILED: the grab failed for some other reason
|
||||
*
|
||||
* Returned by gdk_device_grab() to indicate success or the reason for the
|
||||
* failure of the grab attempt.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_GRAB_SUCCESS = 0,
|
||||
GDK_GRAB_ALREADY_GRABBED = 1,
|
||||
GDK_GRAB_INVALID_TIME = 2,
|
||||
GDK_GRAB_NOT_VIEWABLE = 3,
|
||||
GDK_GRAB_FROZEN = 4,
|
||||
GDK_GRAB_FAILED = 5
|
||||
} GdkGrabStatus;
|
||||
|
||||
/**
|
||||
* GdkGrabOwnership:
|
||||
* @GDK_OWNERSHIP_NONE: All other devices’ events are allowed.
|
||||
* @GDK_OWNERSHIP_SURFACE: Other devices’ events are blocked for the grab surface.
|
||||
* @GDK_OWNERSHIP_APPLICATION: Other devices’ events are blocked for the whole application.
|
||||
*
|
||||
* Defines how device grabs interact with other devices.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_OWNERSHIP_NONE,
|
||||
GDK_OWNERSHIP_SURFACE,
|
||||
GDK_OWNERSHIP_APPLICATION
|
||||
} GdkGrabOwnership;
|
||||
|
||||
GdkGrabStatus gdk_device_grab (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkGrabOwnership grab_ownership,
|
||||
@@ -281,6 +323,7 @@ void gdk_seat_ungrab (GdkSeat *seat);
|
||||
GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
|
||||
const GdkRectangle *position);
|
||||
|
||||
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+83
-153
@@ -36,8 +36,9 @@
|
||||
* @Title: Key Values
|
||||
*
|
||||
* Key values are the codes which are sent whenever a key is pressed or released.
|
||||
* They appear in the #GdkEventKey.keyval field of the #GdkEventKey structure.
|
||||
* The complete list of key values can be found in the `gdk/gdkkeysyms.h` header file.
|
||||
* They are included in the data contained in a key press or release #GdkEvent.
|
||||
* The complete list of key values can be found in the `gdk/gdkkeysyms.h` header
|
||||
* file.
|
||||
*
|
||||
* Key values are regularly updated from the upstream X.org X11 implementation,
|
||||
* so new values are added regularly. They will be prefixed with GDK_KEY_ rather
|
||||
@@ -56,43 +57,87 @@
|
||||
*
|
||||
* # Groups # {#key-group-explanation}
|
||||
*
|
||||
* One #GdkKeymap object exists for each user display. To obtain keymaps for
|
||||
* a display, use gdk_display_get_keymap(). A keymap is a mapping from
|
||||
* #GdkKeymapKey to key values. You can think of a #GdkKeymapKey as a
|
||||
* representation of a symbol printed on a physical keyboard key. That is, it
|
||||
* contains three pieces of information. First, it contains the hardware keycode;
|
||||
* this is an identifying number for a physical key. Second, it contains the
|
||||
* “level” of the key. The level indicates which symbol on the
|
||||
* key will be used, in a vertical direction. So on a standard US keyboard, the key
|
||||
* with the number “1“ on it also has the exclamation point (”!”) character on
|
||||
* it. The level indicates whether to use the “1” or the “!” symbol. The letter
|
||||
* keys are considered to have a lowercase letter at level 0, and an uppercase
|
||||
* letter at level 1, though only the uppercase letter is printed. Third, the
|
||||
* #GdkKeymapKey contains a group; groups are not used on standard US keyboards,
|
||||
* but are used in many other countries. On a keyboard with groups, there can be 3
|
||||
* or 4 symbols printed on a single key. The group indicates movement in a
|
||||
* horizontal direction. Usually groups are used for two different languages. In
|
||||
* group 0, a key might have two English characters, and in group 1 it might have
|
||||
* two Hebrew characters. The Hebrew characters will be printed on the key next to
|
||||
* the English characters.
|
||||
* At the lowest level, physical keys on the keyboard are represented by
|
||||
* numeric keycodes, and GDK knows how to translate these keycodes into
|
||||
* key values according to the configured keyboard layout and the current
|
||||
* state of the keyboard. In the GDK api, the mapping from keycodes to key
|
||||
* values is available via gdk_display_map_keycode(), and the reverse mapping
|
||||
* is available via gdk_display_map_keyval(). The results of these functions
|
||||
* are returned in #GdkKeymapKey structs.
|
||||
*
|
||||
* In order to use a keymap to interpret a key event, it’s necessary to first
|
||||
* convert the keyboard state into an effective group and level. This is done via a
|
||||
* set of rules that varies widely according to type of keyboard and user
|
||||
* configuration. The function gdk_keymap_translate_keyboard_state() accepts a
|
||||
* keyboard state -- consisting of hardware keycode pressed, active modifiers, and
|
||||
* active group -- applies the appropriate rules, and returns the group/level to be
|
||||
* used to index the keymap, along with the modifiers which did not affect the
|
||||
* group and level. i.e. it returns “unconsumed modifiers.” The keyboard group may
|
||||
* differ from the effective group used for keymap lookups because some keys don't
|
||||
* have multiple groups - e.g. the Enter key is always in group 0 regardless of
|
||||
* keyboard state.
|
||||
* You can think of a #GdkKeymapKey as a representation of a symbol printed on
|
||||
* a physical keyboard key. That is, it contains three pieces of information.
|
||||
* First, it contains the hardware keycode; this is an identifying number for
|
||||
* a physical key. Second, it contains the “level” of the key. The level indicates
|
||||
* which symbol on the key will be used, in a vertical direction. So on a standard
|
||||
* US keyboard, the key with the number “1“ on it also has the exclamation point
|
||||
* (”!”) character on it. The level indicates whether to use the “1” or the “!”
|
||||
* symbol. The letter keys are considered to have a lowercase letter at level 0,
|
||||
* and an uppercase letter at level 1, though normally only the uppercase letter
|
||||
* is printed on the key. Third, the #GdkKeymapKey contains a group; groups are
|
||||
* not used on standard US keyboards, but are used in many other countries. On a
|
||||
* keyboard with groups, there can be 3 or 4 symbols printed on a single key.
|
||||
* The group indicates movement in a horizontal direction. Usually groups are
|
||||
* used for two different languages. In group 0, a key might have two English
|
||||
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
|
||||
* characters will be printed on the key next to the English characters.
|
||||
*
|
||||
* Note that gdk_keymap_translate_keyboard_state() also returns the keyval, i.e. it
|
||||
* goes ahead and performs the keymap lookup in addition to telling you which
|
||||
* effective group/level values were used for the lookup. #GdkEventKey already
|
||||
* contains this keyval, however, so you don’t normally need to call
|
||||
* gdk_keymap_translate_keyboard_state() just to get the keyval.
|
||||
* When GDK creates a key event in order to deliver a key press or release,
|
||||
* it first converts the current keyboard state into an effective group and
|
||||
* level. This is done via a set of rules that varies widely according to
|
||||
* type of keyboard and user configuration. The input to this translation
|
||||
* consists of the hardware keycode pressed, the active modifiers, and the
|
||||
* active group. It then applies the appropriate rules, and returns the
|
||||
* group/level to be used to index the keymap, along with the modifiers
|
||||
* which did not affect the group and level. i.e. it returns “unconsumed
|
||||
* modifiers.” The keyboard group may differ from the effective group used
|
||||
* for lookups because some keys don't have multiple groups - e.g. the Enter
|
||||
* key is always in group 0 regardless of keyboard state.
|
||||
*
|
||||
* The results of the translation, including the keyval, are all included
|
||||
* in the key event and can be obtained via #GdkEvent getters.
|
||||
*
|
||||
* # Consumed modifiers
|
||||
*
|
||||
* The @consumed_modifiers in a key event are modifiers that should be masked
|
||||
* out from @state when comparing this key press to a hot key. For instance,
|
||||
* on a US keyboard, the `plus` symbol is shifted, so when comparing a key
|
||||
* press to a `<Control>plus` accelerator `<Shift>` should be masked out.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* // We want to ignore irrelevant modifiers like ScrollLock
|
||||
* #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_ALT_MASK)
|
||||
* state = gdk_event_get_modifier_state (event);
|
||||
* gdk_keymap_translate_keyboard_state (keymap,
|
||||
* gdk_key_event_get_keycode (event),
|
||||
* state,
|
||||
* gdk_key_event_get_group (event),
|
||||
* &keyval, NULL, NULL, &consumed);
|
||||
* if (keyval == GDK_PLUS &&
|
||||
* (state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
|
||||
* // Control was pressed
|
||||
* ]|
|
||||
*
|
||||
* An older interpretation @consumed_modifiers was that it contained
|
||||
* all modifiers that might affect the translation of the key;
|
||||
* this allowed accelerators to be stored with irrelevant consumed
|
||||
* modifiers, by doing:
|
||||
* |[<!-- language="C" -->
|
||||
* // XXX Don’t do this XXX
|
||||
* if (keyval == accel_keyval &&
|
||||
* (state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
|
||||
* // Accelerator was pressed
|
||||
* ]|
|
||||
*
|
||||
* However, this did not work if multi-modifier combinations were
|
||||
* used in the keymap, since, for instance, `<Control>` would be
|
||||
* masked out even if only `<Control><Alt>` was used in the keymap.
|
||||
* To support this usage as well as well as possible, all single
|
||||
* modifier combinations that could affect the key for any combination
|
||||
* of modifiers will be returned in @consumed_modifiers; multi-modifier
|
||||
* combinations are returned only when actually found in @state. When
|
||||
* you store accelerators, you should always store them with consumed
|
||||
* modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`.
|
||||
*/
|
||||
|
||||
enum {
|
||||
@@ -111,9 +156,6 @@ enum {
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GdkModifierType gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
@@ -161,8 +203,6 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
object_class->get_property = gdk_keymap_get_property;
|
||||
object_class->set_property = gdk_keymap_set_property;
|
||||
|
||||
klass->get_modifier_mask = gdk_keymap_real_get_modifier_mask;
|
||||
|
||||
props[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
"Display",
|
||||
@@ -558,7 +598,7 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* // We want to ignore irrelevant modifiers like ScrollLock
|
||||
* #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
|
||||
* #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_ALT_MASK)
|
||||
* state = gdk_event_get_modifier_state (event);
|
||||
* gdk_keymap_translate_keyboard_state (keymap,
|
||||
* gdk_key_event_get_keycode (event),
|
||||
@@ -615,116 +655,6 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
consumed_modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_add_virtual_modifiers:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @state: (inout): pointer to the modifier mask to change
|
||||
*
|
||||
* Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
|
||||
* in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
|
||||
* set the corresponding bits in @state.
|
||||
*
|
||||
* GDK already does this before delivering key events, but for
|
||||
* compatibility reasons, it only sets the first virtual modifier
|
||||
* it finds, whereas this function sets all matching virtual modifiers.
|
||||
*
|
||||
* This function is useful when matching key events against
|
||||
* accelerators.
|
||||
*/
|
||||
void
|
||||
gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_KEYMAP (keymap));
|
||||
|
||||
GDK_KEYMAP_GET_CLASS (keymap)->add_virtual_modifiers (keymap, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_map_virtual_modifiers:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @state: (inout): pointer to the modifier state to map
|
||||
*
|
||||
* Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
|
||||
* are set in @state to their non-virtual counterparts (i.e. Mod2,
|
||||
* Mod3,...) and set the corresponding bits in @state.
|
||||
*
|
||||
* This function is useful when matching key events against
|
||||
* accelerators.
|
||||
*
|
||||
* Returns: %FALSE if two virtual modifiers were mapped to the
|
||||
* same non-virtual modifier. Note that %FALSE is also returned
|
||||
* if a virtual modifier is mapped to a non-virtual modifier that
|
||||
* was already set in @state.
|
||||
*/
|
||||
gboolean
|
||||
gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
switch (intent)
|
||||
{
|
||||
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
|
||||
return 0;
|
||||
|
||||
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
|
||||
return GDK_SHIFT_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
|
||||
return GDK_MOD1_MASK | GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
|
||||
return 0;
|
||||
|
||||
case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
|
||||
return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
|
||||
GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK);
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_get_modifier_mask:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @intent: the use case for the modifier mask
|
||||
*
|
||||
* Returns the modifier mask the @keymap’s windowing system backend
|
||||
* uses for a particular purpose.
|
||||
*
|
||||
* Note that this function always returns real hardware modifiers, not
|
||||
* virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
|
||||
* #GDK_META_MASK if the backend maps MOD1 to META), so there are use
|
||||
* cases where the return value of this function has to be transformed
|
||||
* by gdk_keymap_add_virtual_modifiers() in order to contain the
|
||||
* expected result.
|
||||
*
|
||||
* Returns: the modifier mask used for @intent.
|
||||
**/
|
||||
GdkModifierType
|
||||
gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
|
||||
}
|
||||
|
||||
#include "gdkkeynames.c"
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,104 +34,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GdkKeymapKey GdkKeymapKey;
|
||||
|
||||
/**
|
||||
* GdkKeymapKey:
|
||||
* @keycode: the hardware keycode. This is an identifying number for a
|
||||
* physical key.
|
||||
* @group: indicates movement in a horizontal direction. Usually groups are used
|
||||
* for two different languages. In group 0, a key might have two English
|
||||
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
|
||||
* characters will be printed on the key next to the English characters.
|
||||
* @level: indicates which symbol on the key will be used, in a vertical direction.
|
||||
* So on a standard US keyboard, the key with the number “1” on it also has the
|
||||
* exclamation point ("!") character on it. The level indicates whether to use
|
||||
* the “1” or the “!” symbol. The letter keys are considered to have a lowercase
|
||||
* letter at level 0, and an uppercase letter at level 1, though only the
|
||||
* uppercase letter is printed.
|
||||
*
|
||||
* A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
|
||||
*/
|
||||
struct _GdkKeymapKey
|
||||
{
|
||||
guint keycode;
|
||||
gint group;
|
||||
gint level;
|
||||
};
|
||||
|
||||
|
||||
#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
|
||||
#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
|
||||
#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
|
||||
|
||||
/**
|
||||
* GdkKeymap:
|
||||
*
|
||||
* A #GdkKeymap defines the translation from keyboard state
|
||||
* (including a hardware key, a modifier mask, and active keyboard group)
|
||||
* to a keyval. This translation has two phases. The first phase is
|
||||
* to determine the effective keyboard group and level for the keyboard
|
||||
* state; the second phase is to look up the keycode/group/level triplet
|
||||
* in the keymap and see what keyval it corresponds to.
|
||||
*/
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_keymap_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
const GdkKeymapKey *key);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkModifierType state,
|
||||
gint group,
|
||||
guint *keyval,
|
||||
gint *effective_group,
|
||||
gint *level,
|
||||
GdkModifierType *consumed_modifiers);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
gint *n_keys);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkKeymapKey **keys,
|
||||
guint **keyvals,
|
||||
gint *n_entries);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
|
||||
/* Key values
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char *gdk_keyval_name (guint keyval) G_GNUC_CONST;
|
||||
|
||||
|
||||
+35
-6
@@ -22,10 +22,14 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
|
||||
#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
|
||||
#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
|
||||
#define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
|
||||
#define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
|
||||
#define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))
|
||||
|
||||
typedef struct _GdkKeymap GdkKeymap;
|
||||
typedef struct _GdkKeymapClass GdkKeymapClass;
|
||||
|
||||
struct _GdkKeymapClass
|
||||
@@ -56,12 +60,6 @@ struct _GdkKeymapClass
|
||||
gint *effective_group,
|
||||
gint *level,
|
||||
GdkModifierType *consumed_modifiers);
|
||||
void (* add_virtual_modifiers) (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
guint (* get_modifier_state) (GdkKeymap *keymap);
|
||||
|
||||
|
||||
@@ -77,6 +75,37 @@ struct _GdkKeymap
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
GType gdk_keymap_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
|
||||
|
||||
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
const GdkKeymapKey *key);
|
||||
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkModifierType state,
|
||||
gint group,
|
||||
guint *keyval,
|
||||
gint *effective_group,
|
||||
gint *level,
|
||||
GdkModifierType *consumed_modifiers);
|
||||
gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
gint *n_keys);
|
||||
gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkKeymapKey **keys,
|
||||
guint **keyvals,
|
||||
gint *n_entries);
|
||||
|
||||
PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap);
|
||||
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
+34
-14
@@ -2815,17 +2815,18 @@ rewrite_event_for_toplevel (GdkEvent *event)
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_focus_event_get_in (event));
|
||||
else
|
||||
return gdk_event_key_new (gdk_event_get_event_type (event),
|
||||
surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_key_event_get_keyval (event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_key_event_get_scancode (event),
|
||||
gdk_key_event_get_group (event),
|
||||
gdk_key_event_is_modifier (event));
|
||||
{
|
||||
return gdk_event_key_new (gdk_event_get_event_type (event),
|
||||
surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_key_event_is_modifier (event),
|
||||
&event->key.translated[0],
|
||||
&event->key.translated[1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2874,13 +2875,13 @@ add_event_mark (GdkEvent *event,
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
{
|
||||
message = g_strdup_printf ("%s {keyval=%u, state=0x%x, hardware_keycode=%u key_scancode=%u group=%u is_modifier=%u}",
|
||||
message = g_strdup_printf ("%s {keyval=%u, state=0x%x, keycode=%u layout=%u level=%u is_modifier=%u}",
|
||||
kind,
|
||||
gdk_key_event_get_keyval (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_key_event_get_scancode (event),
|
||||
gdk_key_event_get_group (event),
|
||||
gdk_key_event_get_layout (event),
|
||||
gdk_key_event_get_level (event),
|
||||
gdk_key_event_is_modifier (event));
|
||||
break;
|
||||
}
|
||||
@@ -3015,3 +3016,22 @@ gdk_surface_translate_coordinates (GdkSurface *from,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GdkSeat *
|
||||
gdk_surface_get_seat_from_event (GdkSurface *surface,
|
||||
GdkEvent *event)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
GdkDevice *device = gdk_event_get_device (event);
|
||||
GdkSeat *seat = NULL;
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
if (device)
|
||||
seat = gdk_device_get_seat (device);
|
||||
|
||||
if (seat)
|
||||
return seat;
|
||||
}
|
||||
return gdk_display_get_default_seat (surface->display);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,9 @@ struct _GdkSurface
|
||||
GdkDrawContext *paint_context;
|
||||
|
||||
cairo_region_t *opaque_region;
|
||||
|
||||
guint shortcuts_inhibited : 1;
|
||||
GdkSeat *current_shortcuts_inhibited_seat;
|
||||
};
|
||||
|
||||
struct _GdkSurfaceClass
|
||||
|
||||
@@ -73,6 +73,17 @@ gdk_toplevel_default_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GdkEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_restore_system_shortcuts (GdkToplevel *toplevel)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
{
|
||||
@@ -82,6 +93,8 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
iface->focus = gdk_toplevel_default_focus;
|
||||
iface->show_window_menu = gdk_toplevel_default_show_window_menu;
|
||||
iface->supports_edge_constraints = gdk_toplevel_default_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_toplevel_default_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_toplevel_default_restore_system_shortcuts;
|
||||
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_flags ("state",
|
||||
@@ -137,6 +150,12 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
GDK_TYPE_FULLSCREEN_MODE,
|
||||
GDK_FULLSCREEN_ON_CURRENT_MONITOR,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_boolean ("shortcuts-inhibited",
|
||||
"Shortcuts inhibited",
|
||||
"Whether keyboard shortcuts are inhibited",
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
|
||||
}
|
||||
|
||||
guint
|
||||
@@ -152,6 +171,7 @@ gdk_toplevel_install_properties (GObjectClass *object_class,
|
||||
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DECORATED, "decorated");
|
||||
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DELETABLE, "deletable");
|
||||
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE, "fullscreen-mode");
|
||||
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED, "shortcuts-inhibited");
|
||||
|
||||
return GDK_TOPLEVEL_NUM_PROPERTIES;
|
||||
}
|
||||
@@ -439,3 +459,56 @@ gdk_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
|
||||
return GDK_TOPLEVEL_GET_IFACE (toplevel)->supports_edge_constraints (toplevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_inhibit_system_shortcuts:
|
||||
* @toplevel: the #GdkToplevel requesting system keyboard shortcuts
|
||||
* @event: (nullable): the #GdkEvent that is triggering the inhibit
|
||||
* request, or %NULL if none is available.
|
||||
*
|
||||
* Requests that the @toplevel inhibit the system shortcuts, asking the
|
||||
* desktop environment/windowing system to let all keyboard events reach
|
||||
* the surface, as long as it is focused, instead of triggering system
|
||||
* actions.
|
||||
*
|
||||
* If granted, the rerouting remains active until the default shortcuts
|
||||
* processing is restored with gdk_toplevel_restore_system_shortcuts(),
|
||||
* or the request is revoked by the desktop enviroment, windowing system
|
||||
* or the user.
|
||||
*
|
||||
* A typical use case for this API is remote desktop or virtual machine
|
||||
* viewers which need to inhibit the default system keyboard shortcuts
|
||||
* so that the remote session or virtual host gets those instead of the
|
||||
* local environment.
|
||||
*
|
||||
* The windowing system or desktop environment may ask the user to grant
|
||||
* or deny the request or even choose to ignore the request entirely.
|
||||
*
|
||||
* The caller can be notified whenever the request is granted or revoked
|
||||
* by listening to the GdkToplevel::shortcuts-inhibited property.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GdkEvent *event)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->inhibit_system_shortcuts (toplevel,
|
||||
event);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_restore_system_shortcuts:
|
||||
* @toplevel: a #GdkToplevel
|
||||
*
|
||||
* Restore default system keyboard shortcuts which were previously
|
||||
* requested to be inhibited by gdk_toplevel_inhibit_system_shortcuts().
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->restore_system_shortcuts (toplevel);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkseat.h>
|
||||
#include <gdk/gdksurface.h>
|
||||
#include <gdk/gdktoplevellayout.h>
|
||||
|
||||
@@ -87,6 +88,14 @@ void gdk_toplevel_set_deletable (GdkToplevel *toplevel,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_toplevel_supports_edge_constraints (GdkToplevel *toplevel);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_TOPLEVEL_H__ */
|
||||
|
||||
@@ -293,7 +293,7 @@ gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout)
|
||||
* Returns the monitor that the layout is fullscreening
|
||||
* the surface on.
|
||||
*
|
||||
* Returns: (nullable): the monitor on which @layout fullscreens
|
||||
* Returns: (nullable) (transfer none): the monitor on which @layout fullscreens
|
||||
*/
|
||||
GdkMonitor *
|
||||
gdk_toplevel_layout_get_fullscreen_monitor (GdkToplevelLayout *layout)
|
||||
|
||||
@@ -21,6 +21,9 @@ struct _GdkToplevelInterface
|
||||
gboolean (* show_window_menu) (GdkToplevel *toplevel,
|
||||
GdkEvent *event);
|
||||
gboolean (* supports_edge_constraints) (GdkToplevel *toplevel);
|
||||
void (* inhibit_system_shortcuts) (GdkToplevel *toplevel,
|
||||
GdkEvent *event);
|
||||
void (* restore_system_shortcuts) (GdkToplevel *toplevel);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -34,6 +37,7 @@ typedef enum
|
||||
GDK_TOPLEVEL_PROP_DECORATED,
|
||||
GDK_TOPLEVEL_PROP_DELETABLE,
|
||||
GDK_TOPLEVEL_PROP_FULLSCREEN_MODE,
|
||||
GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED,
|
||||
GDK_TOPLEVEL_NUM_PROPERTIES
|
||||
} GdkToplevelProperties;
|
||||
|
||||
|
||||
+100
-147
@@ -122,7 +122,6 @@ typedef struct _GdkClipboard GdkClipboard;
|
||||
typedef struct _GdkDisplayManager GdkDisplayManager;
|
||||
typedef struct _GdkDisplay GdkDisplay;
|
||||
typedef struct _GdkSurface GdkSurface;
|
||||
typedef struct _GdkKeymap GdkKeymap;
|
||||
typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
|
||||
typedef struct _GdkSeat GdkSeat;
|
||||
typedef struct _GdkSnapshot GdkSnapshot;
|
||||
@@ -199,188 +198,54 @@ typedef enum
|
||||
* @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
|
||||
* X server this may either be CapsLock or ShiftLock).
|
||||
* @GDK_CONTROL_MASK: the Control key.
|
||||
* @GDK_MOD1_MASK: the fourth modifier key (it depends on the modifier
|
||||
* @GDK_ALT_MASK: the fourth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier, but
|
||||
* normally it is the Alt key).
|
||||
* @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier).
|
||||
* @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier).
|
||||
* @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier).
|
||||
* @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier).
|
||||
* @GDK_BUTTON1_MASK: the first mouse button.
|
||||
* @GDK_BUTTON2_MASK: the second mouse button.
|
||||
* @GDK_BUTTON3_MASK: the third mouse button.
|
||||
* @GDK_BUTTON4_MASK: the fourth mouse button.
|
||||
* @GDK_BUTTON5_MASK: the fifth mouse button.
|
||||
* @GDK_MODIFIER_RESERVED_13_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_14_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_15_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_16_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_17_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_18_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_19_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_20_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_21_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_22_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_23_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_24_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_MODIFIER_RESERVED_25_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_SUPER_MASK: the Super modifier
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
* @GDK_MODIFIER_RESERVED_29_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_RELEASE_MASK: not used in GDK itself. GTK uses it to differentiate
|
||||
* between (keyval, modifiers) pairs from key press and release events.
|
||||
* @GDK_MODIFIER_MASK: a mask covering all modifier types.
|
||||
*
|
||||
* A set of bit-flags to indicate the state of modifier keys and mouse buttons
|
||||
* in various event types. Typical modifier keys are Shift, Control, Meta,
|
||||
* Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
|
||||
*
|
||||
* Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
|
||||
*
|
||||
* GDK recognizes which of the Meta, Super or Hyper keys are mapped
|
||||
* to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
|
||||
* %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
|
||||
*
|
||||
* Note that GDK may add internal values to events which include
|
||||
* reserved values such as %GDK_MODIFIER_RESERVED_13_MASK. Your code
|
||||
* should preserve and ignore them. You can use %GDK_MODIFIER_MASK to
|
||||
* remove all reserved values.
|
||||
*
|
||||
* Also note that the GDK X backend interprets button press events for button
|
||||
* 4-7 as scroll events, so %GDK_BUTTON4_MASK and %GDK_BUTTON5_MASK will never
|
||||
* be set.
|
||||
* Note that GDK may add internal values to events which include values outside
|
||||
* of this enumeration. Your code should preserve and ignore them. You can use
|
||||
* %GDK_MODIFIER_MASK to remove all private values.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_SHIFT_MASK = 1 << 0,
|
||||
GDK_LOCK_MASK = 1 << 1,
|
||||
GDK_CONTROL_MASK = 1 << 2,
|
||||
GDK_MOD1_MASK = 1 << 3,
|
||||
GDK_MOD2_MASK = 1 << 4,
|
||||
GDK_MOD3_MASK = 1 << 5,
|
||||
GDK_MOD4_MASK = 1 << 6,
|
||||
GDK_MOD5_MASK = 1 << 7,
|
||||
GDK_ALT_MASK = 1 << 3,
|
||||
|
||||
GDK_BUTTON1_MASK = 1 << 8,
|
||||
GDK_BUTTON2_MASK = 1 << 9,
|
||||
GDK_BUTTON3_MASK = 1 << 10,
|
||||
GDK_BUTTON4_MASK = 1 << 11,
|
||||
GDK_BUTTON5_MASK = 1 << 12,
|
||||
|
||||
GDK_MODIFIER_RESERVED_13_MASK = 1 << 13,
|
||||
GDK_MODIFIER_RESERVED_14_MASK = 1 << 14,
|
||||
GDK_MODIFIER_RESERVED_15_MASK = 1 << 15,
|
||||
GDK_MODIFIER_RESERVED_16_MASK = 1 << 16,
|
||||
GDK_MODIFIER_RESERVED_17_MASK = 1 << 17,
|
||||
GDK_MODIFIER_RESERVED_18_MASK = 1 << 18,
|
||||
GDK_MODIFIER_RESERVED_19_MASK = 1 << 19,
|
||||
GDK_MODIFIER_RESERVED_20_MASK = 1 << 20,
|
||||
GDK_MODIFIER_RESERVED_21_MASK = 1 << 21,
|
||||
GDK_MODIFIER_RESERVED_22_MASK = 1 << 22,
|
||||
GDK_MODIFIER_RESERVED_23_MASK = 1 << 23,
|
||||
GDK_MODIFIER_RESERVED_24_MASK = 1 << 24,
|
||||
GDK_MODIFIER_RESERVED_25_MASK = 1 << 25,
|
||||
|
||||
/* The next few modifiers are used by XKB, so we skip to the end.
|
||||
* Bits 15 - 25 are currently unused. Bit 29 is used internally.
|
||||
*/
|
||||
|
||||
GDK_SUPER_MASK = 1 << 26,
|
||||
GDK_HYPER_MASK = 1 << 27,
|
||||
GDK_META_MASK = 1 << 28,
|
||||
|
||||
GDK_MODIFIER_RESERVED_29_MASK = 1 << 29,
|
||||
|
||||
GDK_RELEASE_MASK = 1 << 30,
|
||||
|
||||
/* Combination of GDK_SHIFT_MASK..GDK_BUTTON5_MASK + GDK_SUPER_MASK
|
||||
+ GDK_HYPER_MASK + GDK_META_MASK + GDK_RELEASE_MASK */
|
||||
GDK_MODIFIER_MASK = 0x5c001fff
|
||||
} GdkModifierType;
|
||||
|
||||
/**
|
||||
* GdkModifierIntent:
|
||||
* @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
|
||||
* menu accelerators.
|
||||
* @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
|
||||
* Note that mouse button 3 always triggers context menus. When this modifier
|
||||
* is not 0, it additionally triggers context menus when used with mouse button 1.
|
||||
* @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
|
||||
* using `modifier`-click or `modifier`-cursor-key
|
||||
* @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
|
||||
* which in most cases means toggling the clicked item into or out of the selection.
|
||||
* @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
|
||||
* key event cannot produce a symbol directly. This is meant to be used for
|
||||
* input methods, and for use cases like typeahead search.
|
||||
* @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
|
||||
* groups (AltGr on X11/Windows and Option/Alt on OS X).
|
||||
* @GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK: The set of modifier masks accepted
|
||||
* as modifiers in accelerators. Needed because Command is mapped to MOD2 on
|
||||
* OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a
|
||||
* mod key is problematic at best.
|
||||
* Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.
|
||||
*
|
||||
* This enum is used with gdk_keymap_get_modifier_mask()
|
||||
* in order to determine what modifiers the
|
||||
* currently used windowing system backend uses for particular
|
||||
* purposes. For example, on X11/Windows, the Control key is used for
|
||||
* invoking menu shortcuts (accelerators), whereas on Apple computers
|
||||
* it’s the Command key (which correspond to %GDK_CONTROL_MASK and
|
||||
* %GDK_MOD2_MASK, respectively).
|
||||
**/
|
||||
typedef enum
|
||||
{
|
||||
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
|
||||
GDK_MODIFIER_INTENT_CONTEXT_MENU,
|
||||
GDK_MODIFIER_INTENT_EXTEND_SELECTION,
|
||||
GDK_MODIFIER_INTENT_MODIFY_SELECTION,
|
||||
GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
|
||||
GDK_MODIFIER_INTENT_SHIFT_GROUP,
|
||||
GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK,
|
||||
} GdkModifierIntent;
|
||||
|
||||
/**
|
||||
* GdkGrabStatus:
|
||||
* @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
|
||||
* @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
|
||||
* @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
|
||||
* specified time.
|
||||
* @GDK_GRAB_NOT_VIEWABLE: the grab surface or the @confine_to surface are not
|
||||
* viewable.
|
||||
* @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
|
||||
* @GDK_GRAB_FAILED: the grab failed for some other reason
|
||||
* GDK_MODIFIER_MASK:
|
||||
*
|
||||
* Returned by gdk_device_grab() to indicate success or the reason for the
|
||||
* failure of the grab attempt.
|
||||
* A mask covering all entries in #GdkModifierType.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_GRAB_SUCCESS = 0,
|
||||
GDK_GRAB_ALREADY_GRABBED = 1,
|
||||
GDK_GRAB_INVALID_TIME = 2,
|
||||
GDK_GRAB_NOT_VIEWABLE = 3,
|
||||
GDK_GRAB_FROZEN = 4,
|
||||
GDK_GRAB_FAILED = 5
|
||||
} GdkGrabStatus;
|
||||
|
||||
/**
|
||||
* GdkGrabOwnership:
|
||||
* @GDK_OWNERSHIP_NONE: All other devices’ events are allowed.
|
||||
* @GDK_OWNERSHIP_SURFACE: Other devices’ events are blocked for the grab surface.
|
||||
* @GDK_OWNERSHIP_APPLICATION: Other devices’ events are blocked for the whole application.
|
||||
*
|
||||
* Defines how device grabs interact with other devices.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_OWNERSHIP_NONE,
|
||||
GDK_OWNERSHIP_SURFACE,
|
||||
GDK_OWNERSHIP_APPLICATION
|
||||
} GdkGrabOwnership;
|
||||
#define GDK_MODIFIER_MASK (GDK_SHIFT_MASK|GDK_LOCK_MASK|GDK_CONTROL_MASK| \
|
||||
GDK_ALT_MASK|GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
|
||||
GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK| \
|
||||
GDK_BUTTON4_MASK|GDK_BUTTON5_MASK)
|
||||
|
||||
/**
|
||||
* GdkEventMask:
|
||||
@@ -624,6 +489,94 @@ typedef enum
|
||||
*/
|
||||
#define GDK_ACTION_ALL (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK)
|
||||
|
||||
/*
|
||||
* GDK_DECLARE_INTERNAL_TYPE:
|
||||
* @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
|
||||
* @module_obj_name: The name of the new type in lowercase, with words
|
||||
* separated by '_' (like 'gtk_widget')
|
||||
* @MODULE: The name of the module, in all caps (like 'GTK')
|
||||
* @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
|
||||
* @ParentName: the name of the parent type, in camel case (like GtkWidget)
|
||||
*
|
||||
* A convenience macro for emitting the usual declarations in the
|
||||
* header file for a type which is intended to be subclassed only
|
||||
* by internal consumers.
|
||||
*
|
||||
* This macro differs from %G_DECLARE_DERIVABLE_TYPE and %G_DECLARE_FINAL_TYPE
|
||||
* by declaring a type that is only derivable internally. Internal users can
|
||||
* derive this type, assuming they have access to the instance and class
|
||||
* structures; external users will not be able to subclass this type.
|
||||
*/
|
||||
#define GDK_DECLARE_INTERNAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
|
||||
GType module_obj_name##_get_type (void); \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
typedef struct _##ModuleObjName ModuleObjName; \
|
||||
typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
|
||||
\
|
||||
_GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \
|
||||
\
|
||||
G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
|
||||
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
|
||||
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
||||
return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
||||
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
|
||||
return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
|
||||
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
||||
return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \
|
||||
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \
|
||||
return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct _GdkKeymapKey GdkKeymapKey;
|
||||
|
||||
/**
|
||||
* GdkKeymapKey:
|
||||
* @keycode: the hardware keycode. This is an identifying number for a
|
||||
* physical key.
|
||||
* @group: indicates movement in a horizontal direction. Usually groups are used
|
||||
* for two different languages. In group 0, a key might have two English
|
||||
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
|
||||
* characters will be printed on the key next to the English characters.
|
||||
* @level: indicates which symbol on the key will be used, in a vertical direction.
|
||||
* So on a standard US keyboard, the key with the number “1” on it also has the
|
||||
* exclamation point ("!") character on it. The level indicates whether to use
|
||||
* the “1” or the “!” symbol. The letter keys are considered to have a lowercase
|
||||
* letter at level 0, and an uppercase letter at level 1, though only the
|
||||
* uppercase letter is printed.
|
||||
*
|
||||
* A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
|
||||
*/
|
||||
struct _GdkKeymapKey
|
||||
{
|
||||
guint keycode;
|
||||
gint group;
|
||||
gint level;
|
||||
};
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/*< private >
|
||||
* GDK_EXTERN_VAR:
|
||||
*
|
||||
* A macro to annotate extern variables so that they show up properly in
|
||||
* Windows DLLs.
|
||||
*/
|
||||
#ifndef GDK_EXTERN_VAR
|
||||
# ifdef G_PLATFORM_WIN32
|
||||
# ifdef GTK_COMPILATION
|
||||
# ifdef DLL_EXPORT
|
||||
# define GDK_EXTERN_VAR __declspec(dllexport)
|
||||
# else /* !DLL_EXPORT */
|
||||
# define GDK_EXTERN_VAR extern
|
||||
# endif /* !DLL_EXPORT */
|
||||
# else /* !GTK_COMPILATION */
|
||||
# define GDK_EXTERN_VAR extern __declspec(dllimport)
|
||||
# endif /* !GTK_COMPILATION */
|
||||
# else /* !G_PLATFORM_WIN32 */
|
||||
# define GDK_EXTERN_VAR _GDK_EXTERN
|
||||
# endif /* !G_PLATFORM_WIN32 */
|
||||
#endif /* GDK_EXTERN_VAR */
|
||||
|
||||
#endif /* __GDK_TYPES_H__ */
|
||||
|
||||
@@ -5,6 +5,20 @@
|
||||
# Usage: gen-gdk-gresources-xml SRCDIR_GDK [OUTPUT-FILE]
|
||||
|
||||
import os, sys
|
||||
import filecmp
|
||||
|
||||
def replace_if_changed(new, old):
|
||||
'''
|
||||
Compare contents and only replace if changed to avoid triggering a rebuild.
|
||||
'''
|
||||
try:
|
||||
changed = not filecmp.cmp(new, old, shallow=False)
|
||||
except FileNotFoundError:
|
||||
changed = True
|
||||
if changed:
|
||||
os.replace(new, old)
|
||||
else:
|
||||
os.remove(new)
|
||||
|
||||
srcdir = sys.argv[1]
|
||||
|
||||
@@ -26,8 +40,9 @@ xml += '''
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
outfile = sys.argv[2]
|
||||
f = open(outfile, 'w')
|
||||
f.write(xml)
|
||||
f.close()
|
||||
tmpfile = outfile + '~'
|
||||
with open(tmpfile, 'w') as f:
|
||||
f.write(xml)
|
||||
replace_if_changed(tmpfile, outfile)
|
||||
else:
|
||||
print(xml)
|
||||
|
||||
@@ -288,7 +288,7 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
|
||||
if (nsflags & NSControlKeyMask)
|
||||
modifiers |= GDK_CONTROL_MASK;
|
||||
if (nsflags & NSAlternateKeyMask)
|
||||
modifiers |= GDK_MOD1_MASK;
|
||||
modifiers |= GDK_ALT_MASK;
|
||||
if (nsflags & NSCommandKeyMask)
|
||||
modifiers |= GDK_MOD2_MASK;
|
||||
|
||||
@@ -1162,7 +1162,7 @@ fill_key_event (GdkSurface *window,
|
||||
break;
|
||||
case GDK_KEY_Alt_R:
|
||||
case GDK_KEY_Alt_L:
|
||||
mask = GDK_MOD1_MASK;
|
||||
mask = GDK_ALT_MASK;
|
||||
break;
|
||||
case GDK_KEY_Control_R:
|
||||
case GDK_KEY_Control_L:
|
||||
@@ -1280,7 +1280,7 @@ _gdk_quartz_events_get_current_keyboard_modifiers (void)
|
||||
if (carbon_modifiers & controlKey)
|
||||
modifiers |= GDK_CONTROL_MASK;
|
||||
if (carbon_modifiers & optionKey)
|
||||
modifiers |= GDK_MOD1_MASK;
|
||||
modifiers |= GDK_ALT_MASK;
|
||||
if (carbon_modifiers & cmdKey)
|
||||
modifiers |= GDK_MOD2_MASK;
|
||||
|
||||
|
||||
@@ -735,40 +735,6 @@ gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
switch (intent)
|
||||
{
|
||||
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
|
||||
return GDK_SHIFT_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
|
||||
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
|
||||
return GDK_MOD1_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
|
||||
return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
|
||||
GDK_MOD2_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK |
|
||||
GDK_META_MASK);
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* What sort of key event is this? Returns one of
|
||||
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
|
||||
*/
|
||||
@@ -881,5 +847,4 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
|
||||
keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
|
||||
}
|
||||
|
||||
+113
-12
@@ -30,6 +30,7 @@
|
||||
#include "gdkseat-wayland.h"
|
||||
#include "gdkwayland.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicepadprivate.h"
|
||||
@@ -1856,16 +1857,38 @@ keyboard_handle_keymap (void *data,
|
||||
{
|
||||
GdkWaylandSeat *seat = data;
|
||||
PangoDirection direction;
|
||||
gboolean bidi;
|
||||
gboolean caps_lock;
|
||||
gboolean num_lock;
|
||||
gboolean scroll_lock;
|
||||
GdkModifierType modifiers;
|
||||
|
||||
direction = gdk_keymap_get_direction (seat->keymap);
|
||||
bidi = gdk_keymap_have_bidi_layouts (seat->keymap);
|
||||
caps_lock = gdk_keymap_get_caps_lock_state (seat->keymap);
|
||||
num_lock = gdk_keymap_get_num_lock_state (seat->keymap);
|
||||
scroll_lock = gdk_keymap_get_scroll_lock_state (seat->keymap);
|
||||
modifiers = gdk_keymap_get_modifier_state (seat->keymap);
|
||||
|
||||
_gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size);
|
||||
|
||||
g_signal_emit_by_name (seat->keymap, "keys-changed");
|
||||
g_signal_emit_by_name (seat->keymap, "state-changed");
|
||||
|
||||
if (direction != gdk_keymap_get_direction (seat->keymap))
|
||||
g_signal_emit_by_name (seat->keymap, "direction-changed");
|
||||
|
||||
if (direction != gdk_keymap_get_direction (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "direction");
|
||||
if (bidi != gdk_keymap_have_bidi_layouts (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "has-bidi-layouts");
|
||||
if (caps_lock != gdk_keymap_get_caps_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "caps-lock-state");
|
||||
if (num_lock != gdk_keymap_get_num_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "num-lock-state");
|
||||
if (scroll_lock != gdk_keymap_get_scroll_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "scroll-lock-state");
|
||||
if (modifiers != gdk_keymap_get_modifier_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "modifier-state");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1934,6 +1957,7 @@ keyboard_handle_leave (void *data,
|
||||
g_object_unref (seat->keyboard_focus);
|
||||
seat->keyboard_focus = NULL;
|
||||
seat->repeat_key = 0;
|
||||
seat->key_modifiers = 0;
|
||||
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("focus out, seat %p surface %p",
|
||||
@@ -1997,9 +2021,13 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
struct xkb_state *xkb_state;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
GdkKeymap *keymap;
|
||||
xkb_keysym_t sym;
|
||||
guint delay, interval, timeout;
|
||||
gint64 begin_time, now;
|
||||
xkb_mod_mask_t consumed;
|
||||
GdkTranslatedKey translated;
|
||||
GdkTranslatedKey no_lock;
|
||||
xkb_mod_mask_t modifiers;
|
||||
xkb_mod_index_t caps_lock;
|
||||
|
||||
begin_time = g_get_monotonic_time ();
|
||||
|
||||
@@ -2009,36 +2037,69 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
|
||||
xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
|
||||
|
||||
sym = xkb_state_key_get_one_sym (xkb_state, key);
|
||||
if (sym == XKB_KEY_NoSymbol)
|
||||
translated.keyval = xkb_state_key_get_one_sym (xkb_state, key);
|
||||
modifiers = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (xkb_state, key, modifiers);
|
||||
translated.consumed = gdk_wayland_keymap_get_gdk_modifiers (keymap, consumed);
|
||||
translated.layout = xkb_state_key_get_layout (xkb_state, key);
|
||||
translated.level = xkb_state_key_get_level (xkb_state, key, translated.layout);
|
||||
|
||||
if (translated.keyval == XKB_KEY_NoSymbol)
|
||||
return;
|
||||
|
||||
seat->pointer_info.time = time_;
|
||||
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
|
||||
|
||||
|
||||
modifiers = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
caps_lock = xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||
if (modifiers & (1 << caps_lock))
|
||||
{
|
||||
struct xkb_state *tmp_state = xkb_state_new (xkb_keymap);
|
||||
xkb_layout_index_t layout;
|
||||
|
||||
modifiers &= ~(1 << caps_lock);
|
||||
layout = xkb_state_serialize_layout (xkb_state, XKB_STATE_LAYOUT_EFFECTIVE);
|
||||
xkb_state_update_mask (tmp_state, modifiers, 0, 0, layout, 0, 0);
|
||||
|
||||
no_lock.keyval = xkb_state_key_get_one_sym (tmp_state, key);
|
||||
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (tmp_state, key, modifiers);
|
||||
no_lock.consumed = gdk_wayland_keymap_get_gdk_modifiers (keymap, consumed);
|
||||
no_lock.layout = xkb_state_key_get_layout (tmp_state, key);
|
||||
no_lock.level = xkb_state_key_get_level (tmp_state, key, no_lock.layout);
|
||||
|
||||
xkb_state_unref (tmp_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
no_lock = translated;
|
||||
}
|
||||
|
||||
event = gdk_event_key_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
|
||||
seat->keyboard_focus,
|
||||
seat->master_keyboard,
|
||||
seat->keyboard,
|
||||
time_,
|
||||
key,
|
||||
device_get_modifiers (seat->master_pointer),
|
||||
sym,
|
||||
key,
|
||||
key,
|
||||
0,
|
||||
_gdk_wayland_keymap_key_is_modifier (keymap, key));
|
||||
_gdk_wayland_keymap_key_is_modifier (keymap, key),
|
||||
&translated,
|
||||
&no_lock);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("keyboard %s event%s, surface %p, code %d, sym %d, "
|
||||
"mods 0x%x",
|
||||
"mods 0x%x, consumed 0x%x, layout %d level %d",
|
||||
(state ? "press" : "release"),
|
||||
(from_key_repeat ? " (repeat)" : ""),
|
||||
gdk_event_get_surface (event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_key_event_get_keyval (event),
|
||||
gdk_event_get_modifier_state (event)));
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_key_event_get_consumed_modifiers (event),
|
||||
gdk_key_event_get_layout (event),
|
||||
gdk_key_event_get_level (event)));
|
||||
|
||||
if (!xkb_keymap_key_repeats (xkb_keymap, key))
|
||||
return;
|
||||
@@ -2154,11 +2215,38 @@ keyboard_handle_modifiers (void *data,
|
||||
GdkKeymap *keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
PangoDirection direction;
|
||||
gboolean bidi;
|
||||
gboolean caps_lock;
|
||||
gboolean num_lock;
|
||||
gboolean scroll_lock;
|
||||
GdkModifierType modifiers;
|
||||
|
||||
keymap = seat->keymap;
|
||||
direction = gdk_keymap_get_direction (keymap);
|
||||
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
|
||||
|
||||
direction = gdk_keymap_get_direction (seat->keymap);
|
||||
bidi = gdk_keymap_have_bidi_layouts (seat->keymap);
|
||||
caps_lock = gdk_keymap_get_caps_lock_state (seat->keymap);
|
||||
num_lock = gdk_keymap_get_num_lock_state (seat->keymap);
|
||||
scroll_lock = gdk_keymap_get_scroll_lock_state (seat->keymap);
|
||||
modifiers = gdk_keymap_get_modifier_state (seat->keymap);
|
||||
|
||||
|
||||
/* Note: the docs for xkb_state_update mask state that all parameters
|
||||
* must be passed, or we may end up with an 'incoherent' state. But the
|
||||
* Wayland modifiers event only includes a single group field, so we
|
||||
* can't pass depressed/latched/locked groups.
|
||||
*
|
||||
* We assume that the compositor is sending us the 'effective' group
|
||||
* (the protocol is not clear on that point), and pass it as the depressed
|
||||
* group - we are basically pretending that the user holds down a key for
|
||||
* this group at all times.
|
||||
*
|
||||
* This means that our xkb_state would answer a few questions differently
|
||||
* from the compositors xkb_state - e.g. if you asked it about the latched
|
||||
* group. But nobody is asking it those questions, so it does not really
|
||||
* matter. We hope.
|
||||
*/
|
||||
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
|
||||
|
||||
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
|
||||
@@ -2166,6 +2254,19 @@ keyboard_handle_modifiers (void *data,
|
||||
g_signal_emit_by_name (keymap, "state-changed");
|
||||
if (direction != gdk_keymap_get_direction (keymap))
|
||||
g_signal_emit_by_name (keymap, "direction-changed");
|
||||
|
||||
if (direction != gdk_keymap_get_direction (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "direction");
|
||||
if (bidi != gdk_keymap_have_bidi_layouts (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "has-bidi-layouts");
|
||||
if (caps_lock != gdk_keymap_get_caps_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "caps-lock-state");
|
||||
if (num_lock != gdk_keymap_get_num_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "num-lock-state");
|
||||
if (scroll_lock != gdk_keymap_get_scroll_lock_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "scroll-lock-state");
|
||||
if (modifiers != gdk_keymap_get_modifier_state (seat->keymap))
|
||||
g_object_notify (G_OBJECT (seat->master_keyboard), "modifier-state");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -431,6 +431,7 @@ gdk_registry_handle_global (void *data,
|
||||
else if (strcmp (interface, "xdg_wm_base") == 0)
|
||||
{
|
||||
display_wayland->xdg_wm_base_id = id;
|
||||
display_wayland->xdg_wm_base_version = version;
|
||||
}
|
||||
else if (strcmp (interface, "zxdg_shell_v6") == 0)
|
||||
{
|
||||
@@ -659,7 +660,8 @@ _gdk_wayland_display_open (const gchar *display_name)
|
||||
display_wayland->xdg_wm_base =
|
||||
wl_registry_bind (display_wayland->wl_registry,
|
||||
display_wayland->xdg_wm_base_id,
|
||||
&xdg_wm_base_interface, 1);
|
||||
&xdg_wm_base_interface,
|
||||
MIN (display_wayland->xdg_wm_base_version, 3));
|
||||
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
||||
&xdg_wm_base_listener,
|
||||
display_wayland);
|
||||
|
||||
@@ -86,6 +86,7 @@ struct _GdkWaylandDisplay
|
||||
guint32 serial;
|
||||
|
||||
uint32_t xdg_wm_base_id;
|
||||
int xdg_wm_base_version;
|
||||
uint32_t zxdg_shell_v6_id;
|
||||
GdkWaylandShellVariant shell_variant;
|
||||
|
||||
|
||||
@@ -258,16 +258,8 @@ get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL);
|
||||
if (state & GDK_MOD1_MASK)
|
||||
if (state & GDK_ALT_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
|
||||
if (state & GDK_MOD2_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM);
|
||||
if (state & GDK_MOD3_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
|
||||
if (state & GDK_MOD4_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO);
|
||||
if (state & GDK_MOD5_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5");
|
||||
if (state & GDK_SUPER_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Super");
|
||||
if (state & GDK_HYPER_MASK)
|
||||
@@ -291,15 +283,7 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL)))
|
||||
state |= GDK_CONTROL_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
|
||||
state |= GDK_MOD1_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM)))
|
||||
state |= GDK_MOD2_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
|
||||
state |= GDK_MOD3_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
|
||||
state |= GDK_MOD4_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5")))
|
||||
state |= GDK_MOD5_MASK;
|
||||
state |= GDK_ALT_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super")))
|
||||
state |= GDK_SUPER_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper")))
|
||||
@@ -310,12 +294,21 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
* rely on that behavior.
|
||||
*/
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")) &&
|
||||
(state & GDK_MOD1_MASK) == 0)
|
||||
(state & GDK_ALT_MASK) == 0)
|
||||
state |= GDK_META_MASK;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
GdkModifierType
|
||||
gdk_wayland_keymap_get_gdk_modifiers (GdkKeymap *keymap,
|
||||
guint32 mods)
|
||||
{
|
||||
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
|
||||
|
||||
return get_gdk_modifiers (xkb_keymap, mods);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
@@ -376,68 +369,6 @@ gdk_wayland_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
return get_gdk_modifiers (xkb_keymap, mods);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
xkb_mod_index_t idx;
|
||||
uint32_t mods, real;
|
||||
struct { const char *name; GdkModifierType mask; } vmods[] = {
|
||||
{ "Super", GDK_SUPER_MASK },
|
||||
{ "Hyper", GDK_HYPER_MASK },
|
||||
{ "Meta", GDK_META_MASK },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
int i;
|
||||
|
||||
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
|
||||
mods = get_xkb_modifiers (xkb_keymap, *state);
|
||||
|
||||
xkb_state = xkb_state_new (xkb_keymap);
|
||||
|
||||
for (i = 0; vmods[i].name; i++)
|
||||
{
|
||||
idx = xkb_keymap_mod_get_index (xkb_keymap, vmods[i].name);
|
||||
if (idx == XKB_MOD_INVALID)
|
||||
continue;
|
||||
|
||||
xkb_state_update_mask (xkb_state, 1 << idx, 0, 0, 0, 0, 0);
|
||||
real = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
real &= 0xf0; /* ignore mapping to Lock, Shift, Control, Mod1 */
|
||||
if (mods & real)
|
||||
*state |= vmods[i].mask;
|
||||
xkb_state_update_mask (xkb_state, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
uint32_t mods, mapped;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
|
||||
mods = get_xkb_modifiers (xkb_keymap, *state);
|
||||
|
||||
xkb_state = xkb_state_new (xkb_keymap);
|
||||
xkb_state_update_mask (xkb_state, mods & ~0xff, 0, 0, 0, 0, 0);
|
||||
mapped = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
if ((mapped & mods & 0xff) != 0)
|
||||
ret = FALSE;
|
||||
*state |= get_gdk_modifiers (xkb_keymap, mapped);
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
|
||||
{
|
||||
@@ -456,8 +387,6 @@ _gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
|
||||
keymap_class->lookup_key = gdk_wayland_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_wayland_keymap_translate_keyboard_state;
|
||||
keymap_class->get_modifier_state = gdk_wayland_keymap_get_modifier_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_wayland_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_wayland_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -201,5 +201,7 @@ void gdk_wayland_surface_update_scale (GdkSurface *surface);
|
||||
|
||||
GdkSurface * create_dnd_surface (GdkDisplay *display);
|
||||
|
||||
GdkModifierType gdk_wayland_keymap_get_gdk_modifiers (GdkKeymap *keymap,
|
||||
guint32 mods);
|
||||
|
||||
#endif /* __GDK_PRIVATE_WAYLAND_H__ */
|
||||
|
||||
+306
-107
@@ -59,6 +59,7 @@ static guint signals[LAST_SIGNAL];
|
||||
typedef enum _PopupState
|
||||
{
|
||||
POPUP_STATE_IDLE,
|
||||
POPUP_STATE_WAITING_FOR_REPOSITIONED,
|
||||
POPUP_STATE_WAITING_FOR_CONFIGURE,
|
||||
POPUP_STATE_WAITING_FOR_FRAME,
|
||||
} PopupState;
|
||||
@@ -94,6 +95,9 @@ struct _GdkWaylandSurface
|
||||
EGLSurface egl_surface;
|
||||
EGLSurface dummy_egl_surface;
|
||||
|
||||
uint32_t reposition_token;
|
||||
uint32_t received_reposition_token;
|
||||
|
||||
PopupState popup_state;
|
||||
|
||||
unsigned int initial_configure_received : 1;
|
||||
@@ -103,8 +107,6 @@ struct _GdkWaylandSurface
|
||||
unsigned int awaiting_frame_frozen : 1;
|
||||
unsigned int is_drag_surface : 1;
|
||||
GdkSurfaceTypeHint hint;
|
||||
GdkSurface *transient_for;
|
||||
GdkSurface *popup_parent;
|
||||
|
||||
int pending_buffer_offset_x;
|
||||
int pending_buffer_offset_y;
|
||||
@@ -167,12 +169,18 @@ struct _GdkWaylandSurface
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
uint32_t repositioned_token;
|
||||
gboolean has_repositioned_token;
|
||||
} popup;
|
||||
|
||||
gboolean is_initial_configure;
|
||||
|
||||
uint32_t serial;
|
||||
gboolean is_dirty;
|
||||
} pending;
|
||||
|
||||
uint32_t last_configure_serial;
|
||||
|
||||
int state_freeze_count;
|
||||
|
||||
struct {
|
||||
@@ -190,6 +198,76 @@ struct _GdkWaylandSurfaceClass
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
typedef struct _GdkWaylandToplevel GdkWaylandToplevel;
|
||||
struct _GdkWaylandToplevel
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
|
||||
GdkWaylandToplevel *transient_for;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandToplevelClass;
|
||||
|
||||
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
|
||||
|
||||
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define GDK_IS_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_TOPLEVEL))
|
||||
#define GDK_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_TOPLEVEL, GdkWaylandToplevel))
|
||||
|
||||
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
|
||||
gdk_wayland_toplevel_iface_init))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
} GdkWaylandPopup;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandPopupClass;
|
||||
|
||||
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
|
||||
|
||||
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define GDK_IS_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_POPUP))
|
||||
#define GDK_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_POPUP, GdkWaylandPopup))
|
||||
|
||||
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
|
||||
gdk_wayland_popup_iface_init))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
} GdkWaylandDragSurface;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandDragSurfaceClass;
|
||||
|
||||
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
|
||||
|
||||
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define GDK_IS_WAYLAND_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_SURFACE))
|
||||
|
||||
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
|
||||
gdk_wayland_drag_surface_iface_init))
|
||||
|
||||
static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
@@ -221,16 +299,6 @@ static void update_popup_layout_state (GdkSurface *surface,
|
||||
|
||||
static gboolean gdk_wayland_surface_is_exported (GdkSurface *surface);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
|
||||
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
|
||||
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_init (GdkWaylandSurface *impl)
|
||||
{
|
||||
@@ -438,6 +506,7 @@ frame_callback (void *data,
|
||||
switch (impl->popup_state)
|
||||
{
|
||||
case POPUP_STATE_IDLE:
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
case POPUP_STATE_WAITING_FOR_CONFIGURE:
|
||||
break;
|
||||
case POPUP_STATE_WAITING_FOR_FRAME:
|
||||
@@ -632,6 +701,9 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
"display", display,
|
||||
"frame-clock", frame_clock,
|
||||
NULL);
|
||||
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels,
|
||||
surface);
|
||||
g_warn_if_fail (!parent);
|
||||
break;
|
||||
case GDK_SURFACE_POPUP:
|
||||
surface = g_object_new (GDK_TYPE_WAYLAND_POPUP,
|
||||
@@ -678,10 +750,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
|
||||
gdk_wayland_surface_set_title (surface, get_default_title ());
|
||||
|
||||
if (parent == NULL)
|
||||
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels, surface);
|
||||
|
||||
impl->transient_for = parent;
|
||||
|
||||
gdk_wayland_surface_create_surface (surface);
|
||||
|
||||
@@ -772,8 +840,6 @@ gdk_wayland_surface_dispose (GObject *object)
|
||||
|
||||
impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
g_clear_object (&impl->popup_parent);
|
||||
|
||||
if (impl->event_queue)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
@@ -903,6 +969,7 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (impl);
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkWaylandSurface *impl_parent = NULL;
|
||||
@@ -913,8 +980,8 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
|
||||
if (!is_realized_toplevel (surface))
|
||||
return;
|
||||
|
||||
if (impl->transient_for)
|
||||
impl_parent = GDK_WAYLAND_SURFACE (impl->transient_for);
|
||||
if (toplevel->transient_for)
|
||||
impl_parent = GDK_WAYLAND_SURFACE (toplevel->transient_for);
|
||||
else if (parent)
|
||||
impl_parent = GDK_WAYLAND_SURFACE (parent);
|
||||
|
||||
@@ -1282,8 +1349,17 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
||||
impl->pending.serial);
|
||||
}
|
||||
|
||||
if (impl->pending.popup.has_repositioned_token)
|
||||
impl->received_reposition_token = impl->pending.popup.repositioned_token;
|
||||
|
||||
switch (impl->popup_state)
|
||||
{
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
if (impl->received_reposition_token != impl->reposition_token)
|
||||
return;
|
||||
else
|
||||
gdk_surface_thaw_updates (surface);
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case POPUP_STATE_WAITING_FOR_CONFIGURE:
|
||||
impl->popup_state = POPUP_STATE_WAITING_FOR_FRAME;
|
||||
break;
|
||||
@@ -1306,6 +1382,10 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
||||
width, height,
|
||||
impl->popup.layout);
|
||||
|
||||
if (!impl->pending.popup.has_repositioned_token &&
|
||||
!impl->pending.is_initial_configure)
|
||||
g_signal_emit_by_name (surface, "popup-layout-changed");
|
||||
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
@@ -1318,6 +1398,7 @@ gdk_wayland_surface_configure (GdkSurface *surface)
|
||||
{
|
||||
gdk_surface_thaw_updates (surface);
|
||||
impl->initial_configure_received = TRUE;
|
||||
impl->pending.is_initial_configure = TRUE;
|
||||
}
|
||||
|
||||
if (is_realized_popup (surface))
|
||||
@@ -1327,6 +1408,8 @@ gdk_wayland_surface_configure (GdkSurface *surface)
|
||||
else
|
||||
g_warn_if_reached ();
|
||||
|
||||
impl->last_configure_serial = impl->pending.serial;
|
||||
|
||||
memset (&impl->pending, 0, sizeof (impl->pending));
|
||||
}
|
||||
|
||||
@@ -1663,9 +1746,31 @@ xdg_popup_done (void *data,
|
||||
gdk_surface_hide (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_popup_repositioned (void *data,
|
||||
struct xdg_popup *xdg_popup,
|
||||
uint32_t token)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
||||
g_message ("repositioned %p", surface));
|
||||
|
||||
if (impl->popup_state != POPUP_STATE_WAITING_FOR_REPOSITIONED)
|
||||
{
|
||||
g_warning ("Unexpected xdg_popup.repositioned event, probably buggy compositor");
|
||||
return;
|
||||
}
|
||||
|
||||
impl->pending.popup.repositioned_token = token;
|
||||
impl->pending.popup.has_repositioned_token = TRUE;
|
||||
}
|
||||
|
||||
static const struct xdg_popup_listener xdg_popup_listener = {
|
||||
xdg_popup_configure,
|
||||
xdg_popup_done,
|
||||
xdg_popup_repositioned,
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -2052,7 +2157,8 @@ static gpointer
|
||||
create_dynamic_positioner (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
GdkPopupLayout *layout)
|
||||
GdkPopupLayout *layout,
|
||||
gboolean ack_parent_configure)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkSurface *parent = surface->parent;
|
||||
@@ -2129,6 +2235,30 @@ create_dynamic_positioner (GdkSurface *surface,
|
||||
xdg_positioner_set_constraint_adjustment (positioner,
|
||||
constraint_adjustment);
|
||||
|
||||
if (xdg_positioner_get_version (positioner) >=
|
||||
XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION)
|
||||
xdg_positioner_set_reactive (positioner);
|
||||
|
||||
if (ack_parent_configure &&
|
||||
xdg_positioner_get_version (positioner) >=
|
||||
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
|
||||
{
|
||||
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
|
||||
int parent_width;
|
||||
int parent_height;
|
||||
|
||||
parent_width = parent->width - (parent_impl->margin_left +
|
||||
parent_impl->margin_right);
|
||||
parent_height = parent->height - (parent_impl->margin_top +
|
||||
parent_impl->margin_bottom);
|
||||
|
||||
xdg_positioner_set_parent_size (positioner,
|
||||
parent_width,
|
||||
parent_height);
|
||||
xdg_positioner_set_parent_configure (positioner,
|
||||
parent_impl->last_configure_serial);
|
||||
}
|
||||
|
||||
return positioner;
|
||||
}
|
||||
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
|
||||
@@ -2233,7 +2363,7 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
positioner = create_dynamic_positioner (surface, width, height, layout);
|
||||
positioner = create_dynamic_positioner (surface, width, height, layout, FALSE);
|
||||
|
||||
switch (display->shell_variant)
|
||||
{
|
||||
@@ -2307,7 +2437,6 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
freeze_popup_toplevel_state (surface);
|
||||
}
|
||||
|
||||
g_set_object (&impl->popup_parent, parent);
|
||||
display->current_popups = g_list_append (display->current_popups, surface);
|
||||
if (grab_input_seat)
|
||||
{
|
||||
@@ -2396,9 +2525,8 @@ unmap_popups_for_surface (GdkSurface *surface)
|
||||
for (l = display_wayland->current_popups; l; l = l->next)
|
||||
{
|
||||
GdkSurface *popup = l->data;
|
||||
GdkWaylandSurface *popup_impl = GDK_WAYLAND_SURFACE (popup);
|
||||
|
||||
if (popup_impl->popup_parent == surface)
|
||||
if (popup->parent == surface)
|
||||
{
|
||||
g_warning ("Tried to unmap the parent of a popup");
|
||||
gdk_surface_hide (popup);
|
||||
@@ -2501,6 +2629,9 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
{
|
||||
switch (impl->popup_state)
|
||||
{
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
gdk_surface_thaw_updates (surface);
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case POPUP_STATE_WAITING_FOR_CONFIGURE:
|
||||
case POPUP_STATE_WAITING_FOR_FRAME:
|
||||
thaw_popup_toplevel_state (surface);
|
||||
@@ -2602,6 +2733,7 @@ do_queue_relayout (GdkSurface *surface,
|
||||
GdkPopupLayout *layout)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
struct xdg_positioner *positioner;
|
||||
|
||||
g_assert (is_realized_popup (surface));
|
||||
g_assert (impl->popup_state == POPUP_STATE_IDLE ||
|
||||
@@ -2612,7 +2744,41 @@ do_queue_relayout (GdkSurface *surface,
|
||||
impl->popup.unconstrained_width = width;
|
||||
impl->popup.unconstrained_height = height;
|
||||
|
||||
queue_relayout_fallback (surface, layout);
|
||||
if (!impl->display_server.xdg_popup ||
|
||||
xdg_popup_get_version (impl->display_server.xdg_popup) <
|
||||
XDG_POPUP_REPOSITION_SINCE_VERSION)
|
||||
{
|
||||
g_warning_once ("Compositor doesn't support moving popups, "
|
||||
"relying on remapping");
|
||||
queue_relayout_fallback (surface, layout);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
positioner = create_dynamic_positioner (surface,
|
||||
width, height, layout,
|
||||
TRUE);
|
||||
xdg_popup_reposition (impl->display_server.xdg_popup,
|
||||
positioner,
|
||||
++impl->reposition_token);
|
||||
xdg_positioner_destroy (positioner);
|
||||
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
switch (impl->popup_state)
|
||||
{
|
||||
case POPUP_STATE_IDLE:
|
||||
freeze_popup_toplevel_state (surface);
|
||||
break;
|
||||
case POPUP_STATE_WAITING_FOR_FRAME:
|
||||
break;
|
||||
case POPUP_STATE_WAITING_FOR_CONFIGURE:
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
impl->popup_state = POPUP_STATE_WAITING_FOR_REPOSITIONED;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2623,6 +2789,9 @@ is_relayout_finished (GdkSurface *surface)
|
||||
if (!impl->initial_configure_received)
|
||||
return FALSE;
|
||||
|
||||
if (impl->reposition_token != impl->received_reposition_token)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2707,6 +2876,7 @@ reposition_popup (GdkSurface *surface,
|
||||
case POPUP_STATE_WAITING_FOR_FRAME:
|
||||
do_queue_relayout (surface, width, height, layout);
|
||||
break;
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
case POPUP_STATE_WAITING_FOR_CONFIGURE:
|
||||
g_warn_if_reached ();
|
||||
break;
|
||||
@@ -3172,44 +3342,46 @@ gdk_wayland_surface_set_startup_id (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_transient_for_loop (GdkSurface *surface,
|
||||
GdkSurface *parent)
|
||||
check_transient_for_loop (GdkWaylandToplevel *toplevel,
|
||||
GdkWaylandToplevel *parent)
|
||||
{
|
||||
while (parent)
|
||||
{
|
||||
GdkWaylandSurface *impl;
|
||||
|
||||
if (!GDK_IS_WAYLAND_SURFACE (parent))
|
||||
return FALSE;
|
||||
|
||||
impl = GDK_WAYLAND_SURFACE (parent);
|
||||
if (impl->transient_for == surface)
|
||||
if (parent->transient_for == toplevel)
|
||||
return TRUE;
|
||||
parent = impl->transient_for;
|
||||
parent = parent->transient_for;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_set_transient_for (GdkSurface *surface,
|
||||
GdkSurface *parent)
|
||||
gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
|
||||
GdkSurface *parent)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
g_return_if_fail (!parent || GDK_IS_WAYLAND_TOPLEVEL (parent));
|
||||
g_return_if_fail (!parent ||
|
||||
gdk_surface_get_display (GDK_SURFACE (toplevel)) == gdk_surface_get_display (parent));
|
||||
|
||||
g_assert (parent == NULL ||
|
||||
gdk_surface_get_display (surface) == gdk_surface_get_display (parent));
|
||||
|
||||
if (check_transient_for_loop (surface, parent))
|
||||
if (parent)
|
||||
{
|
||||
g_warning ("Setting %p transient for %p would create a loop", surface, parent);
|
||||
return;
|
||||
GdkWaylandToplevel *parent_toplevel = GDK_WAYLAND_TOPLEVEL (parent);
|
||||
|
||||
if (check_transient_for_loop (toplevel, parent_toplevel))
|
||||
{
|
||||
g_warning ("Setting %p transient for %p would create a loop",
|
||||
toplevel, parent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unset_transient_for_exported (surface);
|
||||
unset_transient_for_exported (GDK_SURFACE (toplevel));
|
||||
|
||||
impl->transient_for = parent;
|
||||
if (parent)
|
||||
toplevel->transient_for = GDK_WAYLAND_TOPLEVEL (parent);
|
||||
else
|
||||
toplevel->transient_for = NULL;
|
||||
|
||||
gdk_wayland_surface_sync_parent (surface, NULL);
|
||||
gdk_wayland_surface_sync_parent (GDK_SURFACE (toplevel), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4097,7 +4269,7 @@ gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_wayland_surface_set_transient_for (surface, NULL);
|
||||
gdk_wayland_toplevel_set_transient_for (GDK_WAYLAND_TOPLEVEL (impl), NULL);
|
||||
|
||||
impl->imported_transient_for =
|
||||
zxdg_importer_v1_import (display_wayland->xdg_importer, parent_handle_str);
|
||||
@@ -4112,9 +4284,9 @@ gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
|
||||
|
||||
static struct zwp_keyboard_shortcuts_inhibitor_v1 *
|
||||
gdk_wayland_surface_get_inhibitor (GdkWaylandSurface *impl,
|
||||
struct wl_seat *seat)
|
||||
GdkSeat *gdk_seat)
|
||||
{
|
||||
return g_hash_table_lookup (impl->shortcuts_inhibitors, seat);
|
||||
return g_hash_table_lookup (impl->shortcuts_inhibitors, gdk_seat);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4130,14 +4302,14 @@ gdk_wayland_surface_inhibit_shortcuts (GdkSurface *surface,
|
||||
if (display->keyboard_shortcuts_inhibit == NULL)
|
||||
return;
|
||||
|
||||
if (gdk_wayland_surface_get_inhibitor (impl, seat))
|
||||
return; /* Already inhibitted */
|
||||
if (gdk_wayland_surface_get_inhibitor (impl, gdk_seat))
|
||||
return; /* Already inhibited */
|
||||
|
||||
inhibitor =
|
||||
zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts (
|
||||
display->keyboard_shortcuts_inhibit, wl_surface, seat);
|
||||
|
||||
g_hash_table_insert (impl->shortcuts_inhibitors, seat, inhibitor);
|
||||
g_hash_table_insert (impl->shortcuts_inhibitors, gdk_seat, inhibitor);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4145,15 +4317,14 @@ gdk_wayland_surface_restore_shortcuts (GdkSurface *surface,
|
||||
GdkSeat *gdk_seat)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
struct wl_seat *seat = gdk_wayland_seat_get_wl_seat (gdk_seat);
|
||||
struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor;
|
||||
|
||||
inhibitor = gdk_wayland_surface_get_inhibitor (impl, seat);
|
||||
inhibitor = gdk_wayland_surface_get_inhibitor (impl, gdk_seat);
|
||||
if (inhibitor == NULL)
|
||||
return; /* Not inhibitted */
|
||||
|
||||
zwp_keyboard_shortcuts_inhibitor_v1_destroy (inhibitor);
|
||||
g_hash_table_remove (impl->shortcuts_inhibitors, seat);
|
||||
g_hash_table_remove (impl->shortcuts_inhibitors, gdk_seat);
|
||||
}
|
||||
|
||||
GdkSurface *
|
||||
@@ -4170,22 +4341,6 @@ create_dnd_surface (GdkDisplay *display)
|
||||
|
||||
#define LAST_PROP 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
} GdkWaylandPopup;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandPopupClass;
|
||||
|
||||
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
|
||||
gdk_wayland_popup_iface_init))
|
||||
|
||||
static void
|
||||
gdk_wayland_popup_init (GdkWaylandPopup *popup)
|
||||
{
|
||||
@@ -4295,22 +4450,6 @@ gdk_wayland_popup_iface_init (GdkPopupInterface *iface)
|
||||
iface->get_position_y = gdk_wayland_popup_get_position_y;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
} GdkWaylandToplevel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandToplevelClass;
|
||||
|
||||
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
|
||||
gdk_wayland_toplevel_iface_init))
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_init (GdkWaylandToplevel *toplevel)
|
||||
{
|
||||
@@ -4323,6 +4462,7 @@ gdk_wayland_toplevel_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (object);
|
||||
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -4337,7 +4477,8 @@ gdk_wayland_toplevel_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
|
||||
gdk_wayland_surface_set_transient_for (surface, g_value_get_object (value));
|
||||
gdk_wayland_toplevel_set_transient_for (toplevel,
|
||||
g_value_get_object (value));
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||
break;
|
||||
|
||||
@@ -4360,6 +4501,9 @@ gdk_wayland_toplevel_set_property (GObject *object,
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -4374,6 +4518,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (object);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -4390,7 +4535,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
|
||||
g_value_set_object (value, impl->transient_for);
|
||||
g_value_set_object (value, toplevel->transient_for);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_MODAL:
|
||||
@@ -4411,6 +4556,10 @@ gdk_wayland_toplevel_get_property (GObject *object,
|
||||
g_value_set_enum (value, surface->fullscreen_mode);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
g_value_set_boolean (value, surface->shortcuts_inhibited);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -4534,6 +4683,70 @@ gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
return gdk_wayland_surface_supports_edge_constraints (GDK_SURFACE (toplevel));
|
||||
}
|
||||
|
||||
static void
|
||||
inhibitor_active (void *data,
|
||||
struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor)
|
||||
{
|
||||
GdkToplevel *toplevel = GDK_TOPLEVEL (data);
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
|
||||
surface->shortcuts_inhibited = TRUE;
|
||||
g_object_notify (G_OBJECT (toplevel), "shortcuts-inhibited");
|
||||
}
|
||||
|
||||
static void
|
||||
inhibitor_inactive (void *data,
|
||||
struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor)
|
||||
{
|
||||
GdkToplevel *toplevel = GDK_TOPLEVEL (data);
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
|
||||
surface->shortcuts_inhibited = FALSE;
|
||||
g_object_notify (G_OBJECT (toplevel), "shortcuts-inhibited");
|
||||
}
|
||||
|
||||
static const struct zwp_keyboard_shortcuts_inhibitor_v1_listener
|
||||
zwp_keyboard_shortcuts_inhibitor_listener = {
|
||||
inhibitor_active,
|
||||
inhibitor_inactive,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GdkEvent *event)
|
||||
{
|
||||
struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor;
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkWaylandSurface *impl= GDK_WAYLAND_SURFACE (surface);
|
||||
GdkSeat *gdk_seat;
|
||||
|
||||
if (surface->shortcuts_inhibited)
|
||||
return;
|
||||
|
||||
gdk_seat = gdk_surface_get_seat_from_event (surface, event);
|
||||
gdk_wayland_surface_inhibit_shortcuts (surface, gdk_seat);
|
||||
|
||||
inhibitor = gdk_wayland_surface_get_inhibitor (impl, gdk_seat);
|
||||
if (!inhibitor)
|
||||
return;
|
||||
|
||||
surface->current_shortcuts_inhibited_seat = gdk_seat;
|
||||
zwp_keyboard_shortcuts_inhibitor_v1_add_listener
|
||||
(inhibitor, &zwp_keyboard_shortcuts_inhibitor_listener, toplevel);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
|
||||
gdk_wayland_surface_restore_shortcuts (surface,
|
||||
surface->current_shortcuts_inhibited_seat);
|
||||
surface->current_shortcuts_inhibited_seat = NULL;
|
||||
surface->shortcuts_inhibited = FALSE;
|
||||
g_object_notify (G_OBJECT (toplevel), "shortcuts-inhibited");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
{
|
||||
@@ -4543,24 +4756,10 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->focus = gdk_wayland_toplevel_focus;
|
||||
iface->show_window_menu = gdk_wayland_toplevel_show_window_menu;
|
||||
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurface parent_instance;
|
||||
} GdkWaylandDragSurface;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandSurfaceClass parent_class;
|
||||
} GdkWaylandDragSurfaceClass;
|
||||
|
||||
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
|
||||
gdk_wayland_drag_surface_iface_init))
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_surface_init (GdkWaylandDragSurface *surface)
|
||||
{
|
||||
|
||||
@@ -37,10 +37,6 @@ gdk_wayland_deps = [
|
||||
wlegldep,
|
||||
]
|
||||
|
||||
# wayland protocols
|
||||
proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir')
|
||||
assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
|
||||
|
||||
wayland_scanner = find_program('wayland-scanner')
|
||||
|
||||
# Format:
|
||||
@@ -68,14 +64,14 @@ foreach p: proto_sources
|
||||
|
||||
if proto_stability == 'stable'
|
||||
output_base = proto_name
|
||||
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
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 = 'protocol/@0@.xml'.format(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 = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
|
||||
endif
|
||||
|
||||
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
|
||||
|
||||
@@ -79,7 +79,7 @@ get_current_mask (void)
|
||||
if (kbd[VK_CONTROL] & 0x80)
|
||||
mask |= GDK_CONTROL_MASK;
|
||||
if (kbd[VK_MENU] & 0x80)
|
||||
mask |= GDK_MOD1_MASK;
|
||||
mask |= GDK_ALT_MASK;
|
||||
if (kbd[VK_LBUTTON] & 0x80)
|
||||
mask |= GDK_BUTTON1_MASK;
|
||||
if (kbd[VK_MBUTTON] & 0x80)
|
||||
|
||||
@@ -54,7 +54,7 @@ get_current_mask (void)
|
||||
if (kbd[VK_CONTROL] & 0x80)
|
||||
mask |= GDK_CONTROL_MASK;
|
||||
if (kbd[VK_MENU] & 0x80)
|
||||
mask |= GDK_MOD1_MASK;
|
||||
mask |= GDK_ALT_MASK;
|
||||
if (kbd[VK_LBUTTON] & 0x80)
|
||||
mask |= GDK_BUTTON1_MASK;
|
||||
if (kbd[VK_MBUTTON] & 0x80)
|
||||
|
||||
@@ -844,7 +844,7 @@ get_modifier_key_state (void)
|
||||
if (GetKeyState (VK_SHIFT) < 0)
|
||||
state |= GDK_SHIFT_MASK;
|
||||
if (GetKeyState (VK_MENU) < 0)
|
||||
state |= GDK_MOD1_MASK;
|
||||
state |= GDK_ALT_MASK;
|
||||
if (GetKeyState (VK_CAPITAL) & 0x1)
|
||||
state |= GDK_LOCK_MASK;
|
||||
|
||||
|
||||
@@ -1869,7 +1869,7 @@ manufacture_keystate_from_GMT (GdkModifierType state)
|
||||
{
|
||||
DWORD key_state = 0;
|
||||
|
||||
if (state & GDK_MOD1_MASK)
|
||||
if (state & GDK_ALT_MASK)
|
||||
key_state |= MK_ALT;
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
key_state |= MK_CONTROL;
|
||||
@@ -2415,22 +2415,22 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
|
||||
case GDK_KEY_Up:
|
||||
case GDK_KEY_KP_Up:
|
||||
dy = (state & GDK_MOD1_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
dy = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Down:
|
||||
case GDK_KEY_KP_Down:
|
||||
dy = (state & GDK_MOD1_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
dy = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Left:
|
||||
case GDK_KEY_KP_Left:
|
||||
dx = (state & GDK_MOD1_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
dx = (state & GDK_ALT_MASK) ? -BIG_STEP : -SMALL_STEP;
|
||||
break;
|
||||
|
||||
case GDK_KEY_Right:
|
||||
case GDK_KEY_KP_Right:
|
||||
dx = (state & GDK_MOD1_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
dx = (state & GDK_ALT_MASK) ? BIG_STEP : SMALL_STEP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+35
-28
@@ -72,6 +72,8 @@
|
||||
|
||||
#include <imm.h>
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
|
||||
#ifndef XBUTTON1
|
||||
#define XBUTTON1 1
|
||||
#define XBUTTON2 2
|
||||
@@ -662,14 +664,14 @@ build_key_event_state (BYTE *key_state)
|
||||
if (key_state[VK_RCONTROL] & 0x80)
|
||||
state |= GDK_CONTROL_MASK;
|
||||
if (key_state[VK_LMENU] & 0x80)
|
||||
state |= GDK_MOD1_MASK;
|
||||
state |= GDK_ALT_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key_state[VK_CONTROL] & 0x80)
|
||||
state |= GDK_CONTROL_MASK;
|
||||
if (key_state[VK_MENU] & 0x80)
|
||||
state |= GDK_MOD1_MASK;
|
||||
state |= GDK_ALT_MASK;
|
||||
}
|
||||
|
||||
return state;
|
||||
@@ -724,7 +726,7 @@ build_pointer_event_state (MSG *msg)
|
||||
state |= GDK_SHIFT_MASK;
|
||||
|
||||
if (GetKeyState (VK_MENU) < 0)
|
||||
state |= GDK_MOD1_MASK;
|
||||
state |= GDK_ALT_MASK;
|
||||
|
||||
if (GetKeyState (VK_CAPITAL) & 0x1)
|
||||
state |= GDK_LOCK_MASK;
|
||||
@@ -741,11 +743,8 @@ print_event_state (guint state)
|
||||
CASE (SHIFT);
|
||||
CASE (LOCK);
|
||||
CASE (CONTROL);
|
||||
CASE (MOD1);
|
||||
CASE (ALT);
|
||||
CASE (MOD2);
|
||||
CASE (MOD3);
|
||||
CASE (MOD4);
|
||||
CASE (MOD5);
|
||||
CASE (BUTTON1);
|
||||
CASE (BUTTON2);
|
||||
CASE (BUTTON3);
|
||||
@@ -810,7 +809,7 @@ _gdk_win32_print_event (GdkEvent *event)
|
||||
kvname = gdk_keyval_name (gdk_key_event_get_keyval (event));
|
||||
g_print ("%#.02x group:%d %s",
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_key_event_get_group (event),
|
||||
gdk_key_event_get_layout (event),
|
||||
(kvname ? kvname : "??"));
|
||||
print_event_state (gdk_event_get_modifier_state (event));
|
||||
break;
|
||||
@@ -2051,12 +2050,12 @@ gdk_event_translate (MSG *msg,
|
||||
GdkModifierType state;
|
||||
guint keyval;
|
||||
guint16 keycode;
|
||||
guint16 scancode;
|
||||
guint8 group;
|
||||
gboolean is_modifier;
|
||||
|
||||
double delta_x, delta_y;
|
||||
GdkScrollDirection direction;
|
||||
GdkTranslatedKey translated;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
win32_display = GDK_WIN32_DISPLAY (display);
|
||||
@@ -2130,17 +2129,20 @@ gdk_event_translate (MSG *msg,
|
||||
gdk_display_setting_changed (display, "gtk-im-module");
|
||||
|
||||
/* Generate a dummy key event to "nudge" IMContext */
|
||||
translated.keyval = GDK_KEY_VoidSymbol;
|
||||
translated.consumed = 0;
|
||||
translated.layout = 0;
|
||||
translated.level = 0;
|
||||
event = gdk_event_key_new (GDK_KEY_PRESS,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
0,
|
||||
GDK_KEY_VoidSymbol,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
FALSE);
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated);
|
||||
_gdk_win32_append_event (event);
|
||||
break;
|
||||
|
||||
@@ -2226,7 +2228,6 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
keyval = GDK_KEY_VoidSymbol;
|
||||
keycode = msg->wParam;
|
||||
scancode = msg->lParam >> 16;
|
||||
|
||||
if (HIWORD (msg->lParam) & KF_EXTENDED)
|
||||
{
|
||||
@@ -2326,10 +2327,15 @@ gdk_event_translate (MSG *msg,
|
||||
both_shift_pressed[0] = both_shift_pressed[1] = 0;
|
||||
}
|
||||
|
||||
/* Reset MOD1_MASK if it is the Alt key itself */
|
||||
/* Reset ALT_MASK if it is the Alt key itself */
|
||||
if (msg->wParam == VK_MENU)
|
||||
state &= ~GDK_MOD1_MASK;
|
||||
state &= ~GDK_ALT_MASK;
|
||||
|
||||
/* FIXME do proper translation */
|
||||
translated.keyval = keyval;
|
||||
translated.consumed = 0;
|
||||
translated.layout = group;
|
||||
translated.level = 0;
|
||||
event = gdk_event_key_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
|
||||
? GDK_KEY_PRESS
|
||||
: GDK_KEY_RELEASE,
|
||||
@@ -2338,11 +2344,10 @@ gdk_event_translate (MSG *msg,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
state,
|
||||
keyval,
|
||||
keycode,
|
||||
scancode,
|
||||
group,
|
||||
is_modifier);
|
||||
is_modifier,
|
||||
&translated,
|
||||
&translated);
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
|
||||
@@ -2404,17 +2409,20 @@ gdk_event_translate (MSG *msg,
|
||||
for (i = 0; i < ccount; i++)
|
||||
{
|
||||
/* Build a key press event */
|
||||
translated.keyval = gdk_unicode_to_keyval (wbuf[i]);
|
||||
translated.consumed = 0;
|
||||
translated.layout = get_active_group ();
|
||||
translated.level = 0;
|
||||
event = gdk_event_key_new (GDK_KEY_PRESS,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_key_event_state (key_state),
|
||||
gdk_unicode_to_keyval (wbuf[i]),
|
||||
0,
|
||||
0,
|
||||
get_active_group (),
|
||||
FALSE);
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated);
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
|
||||
@@ -2425,11 +2433,10 @@ gdk_event_translate (MSG *msg,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_key_event_state (key_state),
|
||||
gdk_unicode_to_keyval (wbuf[i]),
|
||||
0,
|
||||
0,
|
||||
get_active_group (),
|
||||
FALSE);
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated);
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkwin32keys.h"
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
|
||||
enum _GdkWin32KeyLevelState
|
||||
{
|
||||
GDK_WIN32_LEVEL_NONE = 0,
|
||||
@@ -1671,20 +1673,6 @@ gdk_win32_keymap_translate_keyboard_state (GdkKeymap *gdk_keymap,
|
||||
return tmp_keyval != GDK_KEY_VoidSymbol;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
/* FIXME: Is this the right thing to do? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
|
||||
{
|
||||
@@ -1702,6 +1690,4 @@ gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
|
||||
keymap_class->get_entries_for_keycode = gdk_win32_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_win32_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_win32_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_win32_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_win32_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
||||
@@ -288,10 +288,10 @@ extern UINT _gdk_input_codepage;
|
||||
extern guint _gdk_keymap_serial;
|
||||
|
||||
/* The singleton clipdrop object pointer */
|
||||
GdkWin32Clipdrop *_win32_clipdrop;
|
||||
extern GdkWin32Clipdrop *_win32_clipdrop;
|
||||
|
||||
/* Used to identify the main thread */
|
||||
GThread *_win32_main_thread;
|
||||
extern GThread *_win32_main_thread;
|
||||
|
||||
void _gdk_win32_dnd_do_dragdrop (void);
|
||||
|
||||
|
||||
@@ -4907,6 +4907,9 @@ gdk_win32_toplevel_set_property (GObject *object,
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -4953,6 +4956,10 @@ gdk_win32_toplevel_get_property (GObject *object,
|
||||
g_value_set_enum (value, surface->fullscreen_mode);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
||||
g_value_set_boolean (value, surface->shortcuts_inhibited);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user