Compare commits
481 Commits
glyph-cach
...
offload-li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87c4262bd9 | ||
|
|
460eaac1f4 | ||
|
|
02d7817632 | ||
|
|
3080e2974d | ||
|
|
be9d98ed38 | ||
|
|
944274bc58 | ||
|
|
b555e909c4 | ||
|
|
9fe9ea34fd | ||
|
|
f36f1b9829 | ||
|
|
2b09f5ea1e | ||
|
|
f51c82a2aa | ||
|
|
11d3be278d | ||
|
|
cc98282caa | ||
|
|
85f2e1ccd8 | ||
|
|
91b98bc9e2 | ||
|
|
704ee6a9d0 | ||
|
|
72e9f30937 | ||
|
|
aadaf4adf2 | ||
|
|
d83ad6b505 | ||
|
|
b647d1a58c | ||
|
|
68cff3b108 | ||
|
|
84846aace7 | ||
|
|
7bd93730d1 | ||
|
|
c5d05fdc88 | ||
|
|
f6ff2cd1cb | ||
|
|
9b0060e84d | ||
|
|
8d5633cb88 | ||
|
|
f74b1d48b6 | ||
|
|
27ebf756fe | ||
|
|
631da2e723 | ||
|
|
b5531d3d6f | ||
|
|
5e6bc41fdd | ||
|
|
d0581af2af | ||
|
|
cec746804d | ||
|
|
ade1aaa8be | ||
|
|
345d23898d | ||
|
|
415717276a | ||
|
|
cebe640bce | ||
|
|
73084b761f | ||
|
|
eb13ecfbe7 | ||
|
|
85c4507609 | ||
|
|
fcb6c8e447 | ||
|
|
0b27f39c2b | ||
|
|
2101f880af | ||
|
|
2cc241732d | ||
|
|
c01782b0a9 | ||
|
|
a62831562f | ||
|
|
40dd81e1a4 | ||
|
|
a9f3a52c18 | ||
|
|
0978912922 | ||
|
|
3c9923d395 | ||
|
|
0296f49eb0 | ||
|
|
4b7a550366 | ||
|
|
37e18b784e | ||
|
|
1275a2cb8d | ||
|
|
67a6f343a0 | ||
|
|
a98e6bff85 | ||
|
|
d0f5644771 | ||
|
|
b1a3ac8330 | ||
|
|
80811069ac | ||
|
|
6e3dc1e669 | ||
|
|
d1aa0a74e4 | ||
|
|
7a6fb09179 | ||
|
|
5732c5e3d0 | ||
|
|
79fb3d9b0c | ||
|
|
17455054f1 | ||
|
|
763f51cb98 | ||
|
|
9fb78603ec | ||
|
|
f802be88e9 | ||
|
|
b9d2049991 | ||
|
|
cfe3558610 | ||
|
|
35d15de3b6 | ||
|
|
23a336df0e | ||
|
|
bacdc735a4 | ||
|
|
19a168446e | ||
|
|
47ec7bc66d | ||
|
|
b4178870dd | ||
|
|
03ef792802 | ||
|
|
7955efef6c | ||
|
|
3134003376 | ||
|
|
a508860d1f | ||
|
|
c835ca41e0 | ||
|
|
2d5eafd014 | ||
|
|
9b34878208 | ||
|
|
4b1b956d27 | ||
|
|
0dd58c4d1b | ||
|
|
4b2b6d6212 | ||
|
|
2cdb53d524 | ||
|
|
4f7721e742 | ||
|
|
29c29b0e64 | ||
|
|
3d7fc0a598 | ||
|
|
9e3e0052dc | ||
|
|
5ecfcaec0d | ||
|
|
cc24401dfb | ||
|
|
f445d8b518 | ||
|
|
af4c9ea61e | ||
|
|
4a75c288b2 | ||
|
|
89fca57e68 | ||
|
|
d50b780551 | ||
|
|
f4a8787219 | ||
|
|
979d0f4b1d | ||
|
|
5af7c7d0f2 | ||
|
|
90aff59826 | ||
|
|
f0f3ea1b3e | ||
|
|
f4b7f5de2f | ||
|
|
ca5af396b0 | ||
|
|
9f56be3551 | ||
|
|
389f41ead7 | ||
|
|
62108f8c30 | ||
|
|
d3206f9b67 | ||
|
|
9b81f4cc31 | ||
|
|
a864084a4e | ||
|
|
ba44464d2a | ||
|
|
9509876f10 | ||
|
|
f79549f5fc | ||
|
|
bfb451ff4d | ||
|
|
edfbfb2ba7 | ||
|
|
6aa37a116d | ||
|
|
a34c018592 | ||
|
|
710d8b948b | ||
|
|
3df85581d5 | ||
|
|
91e3bc4496 | ||
|
|
1f5df481a5 | ||
|
|
768522ce7f | ||
|
|
5f4e5db91b | ||
|
|
c5f73cb406 | ||
|
|
86c4a9b3bd | ||
|
|
fb915dc8da | ||
|
|
7a2569be14 | ||
|
|
b1eed1c153 | ||
|
|
fac6f6c712 | ||
|
|
3f1fc798f0 | ||
|
|
e6a86f61dc | ||
|
|
2799632c02 | ||
|
|
8ffa681e02 | ||
|
|
154035e76f | ||
|
|
1d4c664bfa | ||
|
|
85a650afce | ||
|
|
f6c4d3731c | ||
|
|
5e9070145e | ||
|
|
81ced841dd | ||
|
|
9837a9dcfd | ||
|
|
1704ec3c7d | ||
|
|
c70a326055 | ||
|
|
53616a73e9 | ||
|
|
2d3a3d6a78 | ||
|
|
6ca9e5987b | ||
|
|
2c1590001f | ||
|
|
82aee038e9 | ||
|
|
a94d7abf0d | ||
|
|
3b87903889 | ||
|
|
191f826075 | ||
|
|
5d52c43074 | ||
|
|
f6a67aeb20 | ||
|
|
370e2f0940 | ||
|
|
2ec9fc26d3 | ||
|
|
c2d898d462 | ||
|
|
7c04231255 | ||
|
|
08216dcee9 | ||
|
|
9817df12ff | ||
|
|
5b0e8eb574 | ||
|
|
cecde85faa | ||
|
|
aa95b4f341 | ||
|
|
816f8807a3 | ||
|
|
26d3c407b3 | ||
|
|
a973e8ea8d | ||
|
|
b007597c58 | ||
|
|
1e83a44c93 | ||
|
|
e1406d2e95 | ||
|
|
259ad83de9 | ||
|
|
2fe467983c | ||
|
|
b4f5432d5a | ||
|
|
4fe4523c49 | ||
|
|
ee4a56ed4a | ||
|
|
2408e227aa | ||
|
|
144cd2d91c | ||
|
|
6abd9def55 | ||
|
|
f5685cc0ae | ||
|
|
54bd03573e | ||
|
|
bc81b33990 | ||
|
|
de764d61ef | ||
|
|
68fa9bcf2e | ||
|
|
2f124bc712 | ||
|
|
c648bb7b19 | ||
|
|
90956b15d9 | ||
|
|
195ebf6848 | ||
|
|
0615b48318 | ||
|
|
aff34e8d1b | ||
|
|
c05bb504ff | ||
|
|
47307dc7c1 | ||
|
|
16ea91c1fe | ||
|
|
96b800fa0c | ||
|
|
e7a2baf78c | ||
|
|
438d86fcf5 | ||
|
|
4fd848c9de | ||
|
|
a23a7d4149 | ||
|
|
1cbdf88b0f | ||
|
|
0a0feef57d | ||
|
|
2701a2bfdd | ||
|
|
2aea75f426 | ||
|
|
b1fb7cd4ae | ||
|
|
33ffe28236 | ||
|
|
fd90b56df6 | ||
|
|
43373e6350 | ||
|
|
afd5ea53d8 | ||
|
|
f725bdad25 | ||
|
|
cfbe3709bf | ||
|
|
4e453acd4f | ||
|
|
3a04542146 | ||
|
|
d6a1eb1b2f | ||
|
|
802110bfe5 | ||
|
|
141769fb46 | ||
|
|
0fdb6a9243 | ||
|
|
d007d136c5 | ||
|
|
cb374efb9a | ||
|
|
8334d21c87 | ||
|
|
6e132463f1 | ||
|
|
3f8f6f6792 | ||
|
|
93cdcc5e88 | ||
|
|
d51912c0b4 | ||
|
|
bad6e1e102 | ||
|
|
28a8dc5a14 | ||
|
|
975cdd8c30 | ||
|
|
153b78e2bc | ||
|
|
de2b10e46c | ||
|
|
7cf4414f4a | ||
|
|
a9dfec8478 | ||
|
|
60ddf7c421 | ||
|
|
1922174c9f | ||
|
|
3c39c5259e | ||
|
|
f5a6d93939 | ||
|
|
30dddf2412 | ||
|
|
19a9215e4f | ||
|
|
b43950d0f7 | ||
|
|
6e5a183c98 | ||
|
|
d224110b48 | ||
|
|
8f356c2e8c | ||
|
|
139ed2c900 | ||
|
|
32e21d5402 | ||
|
|
fb3d8b8523 | ||
|
|
380523b41b | ||
|
|
2fda256bb0 | ||
|
|
c71a66b6f6 | ||
|
|
cb92778478 | ||
|
|
ab67936a64 | ||
|
|
0ae2c1a8a7 | ||
|
|
4e166f39fe | ||
|
|
5f79958716 | ||
|
|
aee0af34af | ||
|
|
7e32eb2e98 | ||
|
|
7ea7d5c390 | ||
|
|
e3e9dda429 | ||
|
|
a3ab25bf1d | ||
|
|
095dec9238 | ||
|
|
0e34365139 | ||
|
|
88a62564f1 | ||
|
|
6ac94dc5c3 | ||
|
|
5a9a0874bd | ||
|
|
91992111c3 | ||
|
|
120d874805 | ||
|
|
9454bad891 | ||
|
|
9cb410fd9b | ||
|
|
0f3fbed13c | ||
|
|
43ee9746bd | ||
|
|
7283c5c22f | ||
|
|
8b71fe4af6 | ||
|
|
b627fb5970 | ||
|
|
be3ad1ef99 | ||
|
|
54264a9f78 | ||
|
|
65380c66bd | ||
|
|
8c96991ce0 | ||
|
|
07a44993ac | ||
|
|
60d2d25463 | ||
|
|
907f99b176 | ||
|
|
ce6aa73c64 | ||
|
|
257bef85d0 | ||
|
|
a48df87a85 | ||
|
|
fe4cd7cf0f | ||
|
|
229b34d478 | ||
|
|
1985f2c9ad | ||
|
|
01d57a7566 | ||
|
|
7a4b2c10c7 | ||
|
|
208b2d37b6 | ||
|
|
ef98912779 | ||
|
|
b1e3b18ede | ||
|
|
0194cadbc0 | ||
|
|
b4dfc4adfc | ||
|
|
fd556ec377 | ||
|
|
1dbc1d67f5 | ||
|
|
8790c83a76 | ||
|
|
6b202fb838 | ||
|
|
f69476435f | ||
|
|
8df6e2cdaf | ||
|
|
2861ab38ac | ||
|
|
23c2122c13 | ||
|
|
5b83ffa4a0 | ||
|
|
cf8e3157a7 | ||
|
|
7323172755 | ||
|
|
cfee8f4b11 | ||
|
|
7ae099c94c | ||
|
|
42298d8ab1 | ||
|
|
68912698f1 | ||
|
|
c8c56f8d42 | ||
|
|
7f48b5a05c | ||
|
|
1e5e977b37 | ||
|
|
62d44b6bc7 | ||
|
|
862afeffe0 | ||
|
|
92f9195015 | ||
|
|
fc6e08082b | ||
|
|
af7516b797 | ||
|
|
3f1821e372 | ||
|
|
b569470b87 | ||
|
|
f1a3235039 | ||
|
|
34e90005af | ||
|
|
4f1cc8ec6d | ||
|
|
5242205a65 | ||
|
|
59633a6781 | ||
|
|
d82316edda | ||
|
|
0815640b22 | ||
|
|
26de2eae20 | ||
|
|
8fa358c4d4 | ||
|
|
fc72449228 | ||
|
|
84a304e66e | ||
|
|
ecf1b7c18a | ||
|
|
a7c5b53f46 | ||
|
|
09736dde93 | ||
|
|
66c00dc9f3 | ||
|
|
3eacf8bd39 | ||
|
|
34e9ef9e78 | ||
|
|
a5955106ea | ||
|
|
ea0cfed735 | ||
|
|
f312d1ee6a | ||
|
|
69b6f4cf4f | ||
|
|
d7e1c377fe | ||
|
|
cc17577763 | ||
|
|
ef4ae61c66 | ||
|
|
e04ea3f311 | ||
|
|
77a2cd4d8d | ||
|
|
0986981d1a | ||
|
|
913f850f83 | ||
|
|
ed31da3730 | ||
|
|
428ff6c4ab | ||
|
|
53786841cc | ||
|
|
8f8ece44a8 | ||
|
|
41a892b958 | ||
|
|
b494ed5876 | ||
|
|
7b589f991d | ||
|
|
d83faf82d7 | ||
|
|
cd46016238 | ||
|
|
f2a3218455 | ||
|
|
85b1959714 | ||
|
|
b23600ae4b | ||
|
|
bdc43b8fca | ||
|
|
da2ef6911f | ||
|
|
0626246367 | ||
|
|
0edfafdfdf | ||
|
|
1863b79fb3 | ||
|
|
9aa90f8df0 | ||
|
|
8080d9e7c1 | ||
|
|
f432ee775f | ||
|
|
77f9cb11a9 | ||
|
|
d92e3cb864 | ||
|
|
733fa156b9 | ||
|
|
d181d53762 | ||
|
|
644e6f8ebe | ||
|
|
0b4c695d65 | ||
|
|
448287bd58 | ||
|
|
5e6aff69c6 | ||
|
|
d88e616711 | ||
|
|
0e5c94a094 | ||
|
|
bb0aeec99c | ||
|
|
880e3ef289 | ||
|
|
94a09263d7 | ||
|
|
ab9106ac89 | ||
|
|
ff6451a77e | ||
|
|
4f2d63b8ac | ||
|
|
81c97f0910 | ||
|
|
d1b52cc292 | ||
|
|
ddedb39329 | ||
|
|
d45987e637 | ||
|
|
b95eceea60 | ||
|
|
2774e80fc4 | ||
|
|
7c207c4868 | ||
|
|
c6c8abcf21 | ||
|
|
a59c967675 | ||
|
|
c3329f5fcc | ||
|
|
4f06e46759 | ||
|
|
7e522a8c55 | ||
|
|
d9447fd2e7 | ||
|
|
95214f3697 | ||
|
|
fe64c998f8 | ||
|
|
84582ad762 | ||
|
|
fcc7a58058 | ||
|
|
8a48becb7e | ||
|
|
465446430e | ||
|
|
4060c43ae7 | ||
|
|
4ec9a2a330 | ||
|
|
90c017a762 | ||
|
|
e011434223 | ||
|
|
b1ccb4103d | ||
|
|
8033809f8b | ||
|
|
66ba1f76ba | ||
|
|
0ca822c716 | ||
|
|
4ac288c1b4 | ||
|
|
64316ab185 | ||
|
|
4d90a693ae | ||
|
|
0c5f943783 | ||
|
|
42fc165b94 | ||
|
|
20a4e3f351 | ||
|
|
f3f90e1d71 | ||
|
|
b018da2acd | ||
|
|
ab5f3f59ce | ||
|
|
0127217e10 | ||
|
|
16a476fe22 | ||
|
|
c8ca6930c5 | ||
|
|
c4f33f36de | ||
|
|
0543c48862 | ||
|
|
fcb17a86e6 | ||
|
|
5633b5b637 | ||
|
|
f7eaf69d67 | ||
|
|
32411943ea | ||
|
|
58fa5d7617 | ||
|
|
f9ee1967f4 | ||
|
|
6a376f0a30 | ||
|
|
66826c26db | ||
|
|
8d1e37789e | ||
|
|
6c39a5946e | ||
|
|
2a98928286 | ||
|
|
c7806eb908 | ||
|
|
9015734e65 | ||
|
|
f5159e1ecb | ||
|
|
aec2f50d82 | ||
|
|
74860f7602 | ||
|
|
a9175e0c03 | ||
|
|
e1c56555af | ||
|
|
24120c8fd0 | ||
|
|
f284331f79 | ||
|
|
a82de96e1a | ||
|
|
eba9b116ed | ||
|
|
1f89b3c7df | ||
|
|
c739b9fe7f | ||
|
|
556b729b97 | ||
|
|
9fd5558acd | ||
|
|
b7422c0f62 | ||
|
|
ace684c7ab | ||
|
|
752e704e99 | ||
|
|
8c7e13746b | ||
|
|
c2311c7154 | ||
|
|
44fa748826 | ||
|
|
dfed398371 | ||
|
|
962ba49a8e | ||
|
|
5811e443f8 | ||
|
|
f55e1392d4 | ||
|
|
0fbe5ba40c | ||
|
|
980ea63d78 | ||
|
|
85cf995af7 | ||
|
|
dcc3533363 | ||
|
|
28964aa0a4 | ||
|
|
7fd8a0ac99 | ||
|
|
d919ed4e4b | ||
|
|
61ec6fb5eb | ||
|
|
237eb8bb90 | ||
|
|
ff57cd9331 | ||
|
|
c97d02f487 | ||
|
|
36ced69ebf | ||
|
|
427a52a9ad | ||
|
|
9b5aee0d1b | ||
|
|
882387a62a | ||
|
|
73f7370ead | ||
|
|
8e9241f3ba | ||
|
|
3c67931f5f | ||
|
|
34028ea31e | ||
|
|
4244314a40 | ||
|
|
575bd64698 | ||
|
|
ee06ac3ad2 | ||
|
|
19a8870f76 | ||
|
|
99a3a7e94e | ||
|
|
a516441513 | ||
|
|
e6046e9493 | ||
|
|
2f5278a139 | ||
|
|
e5ffbb19c0 |
@@ -219,11 +219,13 @@ macos:
|
||||
- if: $RUNNER == "macosintel"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
|
||||
when: manual
|
||||
allow_failure: true
|
||||
- if: $RUNNER == "macosarm"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX11.3.sdk
|
||||
NINJA_PKG: ninja==1.11.1.1
|
||||
stage: build
|
||||
parallel:
|
||||
matrix:
|
||||
@@ -246,7 +248,7 @@ macos:
|
||||
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
- source .venv/bin/activate
|
||||
- pip3 install meson==1.3.2 ninja==1.11.1.1
|
||||
- pip3 install meson==1.3.2 $NINJA_PKG
|
||||
# We're not setting up ccache here on purpose as it accelerates the build
|
||||
# so much that it triggers race conditions in the gobject-introspection
|
||||
# subproject.
|
||||
|
||||
@@ -2,8 +2,6 @@ FROM fedora:39
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
atk-devel \
|
||||
at-spi2-atk-devel \
|
||||
avahi-gobject-devel \
|
||||
cairo-devel \
|
||||
cairo-gobject-devel \
|
||||
@@ -18,7 +16,6 @@ RUN dnf -y install \
|
||||
dejavu-sans-mono-fonts \
|
||||
desktop-file-utils \
|
||||
diffutils \
|
||||
docbook-style-xsl \
|
||||
elfutils-libelf-devel \
|
||||
expat-devel \
|
||||
fribidi-devel \
|
||||
|
||||
@@ -19,7 +19,6 @@ flatpak build ${builddir} meson \
|
||||
--buildtype=debugoptimized \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dvulkan=disabled \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-testsuite=false \
|
||||
-Dbuild-examples=false \
|
||||
|
||||
@@ -34,7 +34,8 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
||||
mingw-w64-$MSYS2_ARCH-python-gobject \
|
||||
mingw-w64-$MSYS2_ARCH-shaderc \
|
||||
mingw-w64-$MSYS2_ARCH-vulkan
|
||||
mingw-w64-$MSYS2_ARCH-vulkan \
|
||||
mingw-w64-$MSYS2_ARCH-vulkan-headers
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
@@ -44,7 +45,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson \
|
||||
meson setup \
|
||||
-Dx11-backend=false \
|
||||
-Dwayland-backend=false \
|
||||
-Dwin32-backend=true \
|
||||
|
||||
199
NEWS
@@ -1,11 +1,206 @@
|
||||
Overview of Changes in 4.13.9, xx-xx-xxxx
|
||||
Overview of Changes in 4.15.0, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.14.2, 03-04-2024
|
||||
=========================================
|
||||
|
||||
* GtkScale:
|
||||
- Improve positioning of values in some cases
|
||||
|
||||
* Theme:
|
||||
- Make progress in entries visible
|
||||
|
||||
* Accessibility:
|
||||
- Fix text insertion handling
|
||||
|
||||
* GDK:
|
||||
- dnd: Use the default cursor durion motion
|
||||
- dnd: Use a better cursor for indicating the move action
|
||||
|
||||
* GSK:
|
||||
- gl: Handle offloads in offscreen context better
|
||||
- Fix text rendering problems with some fonts
|
||||
|
||||
* Wayland:
|
||||
- Tighten up some protocol version checks
|
||||
- Use the presentation time protocol
|
||||
- Fix a crash with subsurfaces
|
||||
- Improve settings portal handling
|
||||
|
||||
* macOS:
|
||||
- Fix up the app menu support
|
||||
|
||||
* Windows:
|
||||
- Fix problems with minimization
|
||||
- Fix build without fontconfig
|
||||
|
||||
* Debugging:
|
||||
- Add font settings in the inspector
|
||||
|
||||
* Demos:
|
||||
- Clean up the application demo
|
||||
- Update cursor images for the cursor demo
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Czech
|
||||
French
|
||||
Georgian
|
||||
Hebrew
|
||||
Persian
|
||||
Slovenian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.14.1, 16-03-2024
|
||||
=========================================
|
||||
|
||||
* GtkTextView:
|
||||
- Fix a mixup of cursor and anchor when retrieving surrounding text
|
||||
in input methods
|
||||
|
||||
* Printing:
|
||||
- Avoid accessing freed printers
|
||||
|
||||
* Accessibility:
|
||||
- Fix memory leaks
|
||||
|
||||
* GDK:
|
||||
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
|
||||
- Add a GDK_GL_DISABLE environment variable
|
||||
|
||||
* GSK:
|
||||
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
|
||||
- Speed up handling of repeated ops, which should help for text
|
||||
- Speed up the inner loop of text node conversion
|
||||
- Drop the glyph-align optimization flag
|
||||
- ngl: Avoid reusing frames while they are in use
|
||||
- Fix flickering thumbnails in nautilus
|
||||
- Speed up buffer handling in both ngl and Vulkan
|
||||
|
||||
* Demos:
|
||||
- Skip demos using gl shaders when we're not using the gl renderer
|
||||
|
||||
* Build:
|
||||
- Fix some ubsan warnings
|
||||
- Avoid zink in ci since it spams stderr
|
||||
|
||||
* Translation updates:
|
||||
Czech
|
||||
German
|
||||
Korean
|
||||
Russian
|
||||
|
||||
|
||||
Overview of Changes in 4.14.0, 12-03-2024
|
||||
=========================================
|
||||
|
||||
Note: The new renderers and dmabuf support are using graphics drivers
|
||||
in different ways than the old gl renderer, and trigger new driver bugs,
|
||||
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
|
||||
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
|
||||
recommended to use the latest mesa release (24.0) with the new renderers.
|
||||
recommended to use the latest mesa release (24.x) with the new renderers.
|
||||
|
||||
* GtkTextView:
|
||||
- Don't snapshot children twice
|
||||
- Don't blink the cursor when hidden
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix presentation selector handling
|
||||
|
||||
* GtkSnapshot:
|
||||
- Fix wrong nodes with transformed shadows
|
||||
|
||||
* GtkIMContext:
|
||||
- Make gtk_im_context_activate_osk public
|
||||
|
||||
* Accessibility:
|
||||
- Implement get_contents_at for all our text widgets
|
||||
- Add GtkAccessibleText.get_default_attributes
|
||||
|
||||
* GSK:
|
||||
- Don't fall back to cairo for software rendering. gl+llvmpipe is better
|
||||
- Round vertical glyph position to a device pixel position if the font is hinted
|
||||
- Fix problems with clip handling
|
||||
- Make vulkan and ngl match their font handling
|
||||
- Fix some corner-cases with offloading and clips
|
||||
- Fix problem with rendering of missing glyphs in hinted fonts
|
||||
|
||||
* MacOs:
|
||||
- Implement cursor-from-texture
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
British English
|
||||
French
|
||||
Indonesian
|
||||
Kazakh
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian Bokmål
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.13.9, 02-03-2024
|
||||
=========================================
|
||||
|
||||
* GtkEditable:
|
||||
- Fix preconditions to be not too strict
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Support search in the locale as well as in English
|
||||
|
||||
* GtkIconTheme:
|
||||
- Make gtk_icon_paintable_new_for_file support symbolics
|
||||
|
||||
* GtkVideo:
|
||||
- Fix a problem with cursor handling that could lead to crashes
|
||||
|
||||
* Accessibility:
|
||||
- Fix GetCharacterAtOffset implementation
|
||||
- Add a Terminal role
|
||||
- Make TextCaretMoved match gtk3
|
||||
- Support multiple levels of GtkEditable delegates
|
||||
|
||||
* GSK:
|
||||
- Make the node parser more flexible for text nodes
|
||||
- Change the way font scaling is handled to avoid clipping
|
||||
- Fix handling of missing glyphs in the new renderers
|
||||
|
||||
* X11:
|
||||
- Don't claim to support shadows without a compositor
|
||||
|
||||
* Wayland:
|
||||
- Fix handling of output scales
|
||||
|
||||
* Tools:
|
||||
- Add a compare command to gtk4-rendernode-tool
|
||||
|
||||
* Build:
|
||||
- Fix some ubsan complaints
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
British English
|
||||
Catalan
|
||||
Finnish
|
||||
Galician
|
||||
Georgian
|
||||
Hebrew
|
||||
Indonesian
|
||||
Kazakh
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Russian
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.13.8, 20-02-2024
|
||||
|
||||
@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
|
||||
How to report bugs
|
||||
------------------
|
||||
|
||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
|
||||
In the bug report please include:
|
||||
|
||||
|
||||
@@ -185,7 +185,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -131,7 +130,6 @@
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -131,7 +130,6 @@
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -15,12 +15,54 @@ on_destroy (gpointer data)
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
cursor_callback (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
int scaled_size;
|
||||
|
||||
scaled_size = ceil (cursor_size * scale);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
|
||||
scaled_size, scaled_size,
|
||||
TRUE,
|
||||
&error);
|
||||
if (!pixbuf)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
*width = cursor_size;
|
||||
*height = cursor_size;
|
||||
*hotspot_x = 18 * cursor_size / 32.0;
|
||||
*hotspot_y = 2 * cursor_size / 32.0;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_cursors (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *logo_callback;
|
||||
GdkCursor *cursor;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -29,6 +71,10 @@ do_cursors (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
|
||||
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
|
||||
gtk_widget_set_cursor (logo_callback, cursor);
|
||||
g_object_unref (cursor);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<file>w_resize_cursor.png</file>
|
||||
<file>zoom_in_cursor.png</file>
|
||||
<file>zoom_out_cursor.png</file>
|
||||
<file>gtk-logo.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/dnd">
|
||||
<file>dnd.css</file>
|
||||
|
||||
@@ -184,6 +184,12 @@ create_cogs (void)
|
||||
return picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_cogs (GtkFishbowl *fb)
|
||||
{
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
|
||||
}
|
||||
|
||||
static void
|
||||
mapped (GtkWidget *w)
|
||||
{
|
||||
@@ -218,36 +224,41 @@ create_graph (void)
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (*create_func) (void);
|
||||
GtkWidget * (* create_func) (void);
|
||||
gboolean (* check) (GtkFishbowl *fb);
|
||||
} widget_types[] = {
|
||||
{ "Icon", create_icon },
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar", create_level_bar },
|
||||
{ "Label", create_label },
|
||||
{ "Spinner", create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
{ "Switch", create_switch },
|
||||
{ "Menubutton", create_menu_button },
|
||||
{ "Shader", create_cogs },
|
||||
{ "Tiger", create_tiger },
|
||||
{ "Graph", create_graph },
|
||||
{ "Icon", create_icon, NULL },
|
||||
{ "Button", create_button, NULL },
|
||||
{ "Blurbutton", create_blurred_button, NULL },
|
||||
{ "Fontbutton", create_font_button, NULL },
|
||||
{ "Levelbar", create_level_bar, NULL },
|
||||
{ "Label", create_label, NULL },
|
||||
{ "Spinner", create_spinner, NULL },
|
||||
{ "Spinbutton", create_spinbutton, NULL },
|
||||
{ "Video", create_video, NULL },
|
||||
{ "Gears", create_gears, NULL },
|
||||
{ "Switch", create_switch, NULL },
|
||||
{ "Menubutton", create_menu_button, NULL },
|
||||
{ "Shader", create_cogs, check_cogs },
|
||||
{ "Tiger", create_tiger, NULL },
|
||||
{ "Graph", create_graph, NULL },
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
set_widget_type (GtkFishbowl *fishbowl,
|
||||
int widget_type_index)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
return TRUE;
|
||||
|
||||
if (widget_types[widget_type_index].check != NULL &&
|
||||
!widget_types[widget_type_index].check (fishbowl))
|
||||
return FALSE;
|
||||
|
||||
selected_widget_type = widget_type_index;
|
||||
|
||||
@@ -257,6 +268,8 @@ set_widget_type (GtkFishbowl *fishbowl,
|
||||
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
|
||||
gtk_window_set_title (GTK_WINDOW (window),
|
||||
widget_types[selected_widget_type].name);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
@@ -264,14 +277,17 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
int new_index = selected_widget_type;
|
||||
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
do
|
||||
{
|
||||
if (new_index + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = new_index + 1;
|
||||
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
while (!set_widget_type (fishbowl, new_index));
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
@@ -279,14 +295,18 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
int new_index = selected_widget_type;
|
||||
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
do
|
||||
{
|
||||
if (new_index - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = new_index - 1;
|
||||
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
while (!set_widget_type (fishbowl, new_index));
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
|
||||
@@ -600,8 +600,8 @@ update_display (void)
|
||||
if (s->len > 0)
|
||||
{
|
||||
pango_font_description_set_variations (desc, s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
font_desc = pango_font_description_to_string (desc);
|
||||
|
||||
|
||||
138
demos/gtk-demo/gtk-logo.svg
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="128"
|
||||
height="128"
|
||||
id="svg6843"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
||||
version="1.0"
|
||||
sodipodi:docname="gtk-logo.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
|
||||
inkscape:export-xdpi="192"
|
||||
inkscape:export-ydpi="192">
|
||||
<defs
|
||||
id="defs6845">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-50 : 600 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="700 : 600 : 1"
|
||||
inkscape:persp3d-origin="300 : 400 : 1"
|
||||
id="perspective13" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8284271"
|
||||
inkscape:cx="69.874353"
|
||||
inkscape:cy="64.313526"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
width="128px"
|
||||
height="128px"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1016"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid7947" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata6848">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:date />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier />
|
||||
<dc:source />
|
||||
<dc:relation />
|
||||
<dc:language />
|
||||
<dc:subject>
|
||||
<rdf:Bag />
|
||||
</dc:subject>
|
||||
<dc:coverage />
|
||||
<dc:description />
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
<cc:license
|
||||
rdf:resource="" />
|
||||
</cc:Work>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
id="path6976"
|
||||
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
|
||||
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
id="path6978"
|
||||
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
|
||||
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
id="path6980"
|
||||
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
|
||||
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccc"
|
||||
id="path6982"
|
||||
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
|
||||
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path6984"
|
||||
d="M 70.434539,17.875593 L 70.434539,66.984877"
|
||||
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
@@ -456,43 +456,33 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkFrameTimings *start, *end;
|
||||
gint64 start_counter, end_counter;
|
||||
gint64 n_frames, expected_frames;
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
GdkFrameTimings *end;
|
||||
gint64 end_counter;
|
||||
double fps, expected_fps;
|
||||
gint64 interval;
|
||||
|
||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||
if (frame_clock == NULL)
|
||||
return;
|
||||
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
fps = gdk_frame_clock_get_fps (frame_clock);
|
||||
if (fps <= 0.0)
|
||||
return;
|
||||
|
||||
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||
if (start_timestamp == 0 || end_timestamp == 0)
|
||||
{
|
||||
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||
}
|
||||
|
||||
n_frames = end_counter - start_counter;
|
||||
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||
priv->framerate = ((int)(priv->framerate * 100))/100.0;
|
||||
|
||||
priv->framerate = fps;
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
|
||||
if (!priv->benchmark)
|
||||
return;
|
||||
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end == NULL)
|
||||
return;
|
||||
|
||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||
if (interval == 0)
|
||||
{
|
||||
@@ -500,16 +490,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
if (interval == 0)
|
||||
return;
|
||||
}
|
||||
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||
expected_fps = (double) G_USEC_PER_SEC / interval;
|
||||
|
||||
if (n_frames >= expected_frames)
|
||||
if (fps > (expected_fps - 1))
|
||||
{
|
||||
if (priv->last_benchmark_change > 0)
|
||||
priv->last_benchmark_change *= 2;
|
||||
else
|
||||
priv->last_benchmark_change = 1;
|
||||
}
|
||||
else if (n_frames + 1 < expected_frames)
|
||||
else if (0.95 * fps < expected_fps)
|
||||
{
|
||||
if (priv->last_benchmark_change < 0)
|
||||
priv->last_benchmark_change--;
|
||||
|
||||
@@ -116,7 +116,9 @@ static gboolean gtk_shadertoy_tick (GtkWidget *widget,
|
||||
GtkWidget *
|
||||
gtk_shadertoy_new (void)
|
||||
{
|
||||
return g_object_new (gtk_shadertoy_get_type (), NULL);
|
||||
return g_object_new (gtk_shadertoy_get_type (),
|
||||
"allowed-apis", GDK_GL_API_GL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -354,6 +354,7 @@ do_images (GtkWidget *do_widget)
|
||||
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
|
||||
image = gtk_image_new_from_gicon (gicon);
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
g_object_unref (gicon);
|
||||
|
||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||
|
||||
|
||||
@@ -827,13 +827,25 @@ demo_search_changed_cb (GtkSearchEntry *entry,
|
||||
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
demo_can_run (GtkWidget *window,
|
||||
const char *name)
|
||||
{
|
||||
if (name != NULL && strcmp (name, "gltransition") == 0)
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
create_demo_model (void)
|
||||
create_demo_model (GtkWidget *window)
|
||||
{
|
||||
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
|
||||
DemoData *demo = gtk_demos;
|
||||
GtkDemo *d;
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
d->name = "main";
|
||||
d->title = "GTK Demo";
|
||||
@@ -845,16 +857,20 @@ create_demo_model (void)
|
||||
|
||||
while (demo->title)
|
||||
{
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
DemoData *children = demo->children;
|
||||
DemoData *children = demo->children;
|
||||
|
||||
d->name = demo->name;
|
||||
d->title = demo->title;
|
||||
d->keywords = demo->keywords;
|
||||
d->filename = demo->filename;
|
||||
d->func = demo->func;
|
||||
if (demo_can_run (window, demo->name))
|
||||
{
|
||||
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
|
||||
g_list_store_append (store, d);
|
||||
d->name = demo->name;
|
||||
d->title = demo->title;
|
||||
d->keywords = demo->keywords;
|
||||
d->filename = demo->filename;
|
||||
d->func = demo->func;
|
||||
|
||||
g_list_store_append (store, d);
|
||||
}
|
||||
|
||||
if (children)
|
||||
{
|
||||
@@ -862,15 +878,19 @@ create_demo_model (void)
|
||||
|
||||
while (children->title)
|
||||
{
|
||||
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
if (demo_can_run (window, children->name))
|
||||
{
|
||||
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
|
||||
|
||||
child->name = children->name;
|
||||
child->title = children->title;
|
||||
child->keywords = children->keywords;
|
||||
child->filename = children->filename;
|
||||
child->func = children->func;
|
||||
child->name = children->name;
|
||||
child->title = children->title;
|
||||
child->keywords = children->keywords;
|
||||
child->filename = children->filename;
|
||||
child->func = children->func;
|
||||
|
||||
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
||||
}
|
||||
|
||||
g_list_store_append (G_LIST_STORE (d->children_model), child);
|
||||
children++;
|
||||
}
|
||||
}
|
||||
@@ -936,7 +956,7 @@ activate (GApplication *app)
|
||||
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
|
||||
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
||||
|
||||
listmodel = create_demo_model ();
|
||||
listmodel = create_demo_model (window);
|
||||
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
||||
FALSE,
|
||||
TRUE,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<interface>
|
||||
<menu id="menubar">
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Application</attribute>
|
||||
<attribute name="label" translatable="yes">_File</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
@@ -33,7 +33,7 @@
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_File</attribute>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -338,7 +338,7 @@ do_path_maze (GtkWidget *do_widget)
|
||||
GskPath *path;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
|
||||
gtk_box_append (GTK_BOX (box), aspect);
|
||||
|
||||
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);
|
||||
|
||||
@@ -322,12 +322,14 @@ stroke bounds of the path.
|
||||
|
||||
### text
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ------------------- | ------------------- | ----------- |
|
||||
| color | `<color>` | black | non-default |
|
||||
| font | `<string>` `<url>`? | "Cantarell 11" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| ------------ | ------------------- | ------------------- | ----------- |
|
||||
| color | `<color>` | black | non-default |
|
||||
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
@@ -336,12 +338,15 @@ font that is specified in the string. It can be either a data url containing
|
||||
a base64-encoded font file, or a regular url that points to a font file.
|
||||
|
||||
Glyphs can be specified as an ASCII string, or as a comma-separated list of
|
||||
their glyph ID and advance width. Optionally, x and y offsets and flags can
|
||||
their glyph IDs. Optionally, the advance width, x and y offsets and flags can
|
||||
be specified as well, like this: 40 10 0 0 color.
|
||||
|
||||
If the given font does not exist or the given glyphs are invalid for the given
|
||||
font, an error node will be returned.
|
||||
|
||||
Possible values for hint-style are none, slight or full.
|
||||
Possible value for antialias are none or gray.
|
||||
|
||||
### texture
|
||||
|
||||
| property | syntax | default | printed |
|
||||
|
||||
@@ -69,9 +69,9 @@ Image:
|
||||
4 CARD32 IMAGE_DATA_OFFSET
|
||||
|
||||
ICON_FLAGS
|
||||
HAS_SUFFIX_PNG 1
|
||||
HAS_SUFFIX_XPM 2
|
||||
HAS_SUFFIX_SVG 4
|
||||
HAS_SUFFIX_XPM 1
|
||||
HAS_SUFFIX_SVG 2
|
||||
HAS_SUFFIX_PNG 4
|
||||
HAS_ICON_FILE 8
|
||||
|
||||
ImageData:
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -38,13 +38,13 @@ can run the build, using Ninja:
|
||||
|
||||
```
|
||||
cd builddir
|
||||
ninja
|
||||
ninja install
|
||||
meson compile
|
||||
meson install
|
||||
```
|
||||
|
||||
If you don't have permission to write to the directory you are
|
||||
installing in, you may have to change to root temporarily before
|
||||
running `ninja install`.
|
||||
running `meson install`.
|
||||
|
||||
Several environment variables are useful to pass to set before
|
||||
running *meson*. `CPPFLAGS` contains options to pass to the C
|
||||
@@ -112,10 +112,10 @@ responsible for controlling the debugging features of GTK with
|
||||
|
||||
## Dependencies
|
||||
|
||||
Before you can compile the GTK widget toolkit, you need to have
|
||||
various other tools and libraries installed on your
|
||||
system. Dependencies of GTK have their own build systems, so
|
||||
you will need to refer to their own installation instructions.
|
||||
Before you can compile GTK, you need to have various other tools and
|
||||
libraries installed on your system. Dependencies of GTK have their own
|
||||
build systems, so you will need to refer to their own installation
|
||||
instructions.
|
||||
|
||||
A particular important tool used by GTK to find its dependencies
|
||||
is `pkg-config`.
|
||||
@@ -156,8 +156,8 @@ Other libraries are maintained separately.
|
||||
the development environment for these libraries that your
|
||||
operating system vendor provides.
|
||||
- The [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/)
|
||||
library provides Pango with a standard way of locating
|
||||
fonts and matching them against font names.
|
||||
library provides Pango with a standard way of locating fonts and matching
|
||||
them against font names.
|
||||
- [Cairo](https://www.cairographics.org) is a graphics library that
|
||||
supports vector graphics and image compositing. Both Pango and GTK
|
||||
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
||||
@@ -220,13 +220,12 @@ meson configure builddir
|
||||
|
||||
### `x11-backend`, `win32-backend`, `broadway-backend`, `wayland-backend` and `macos-backend`
|
||||
|
||||
Enable specific backends for GDK. If none of these options
|
||||
are given, the Wayland backend will be enabled by default,
|
||||
if the platform is Linux; the X11 backend will also be enabled
|
||||
by default, unless the platform is Windows, in which case the
|
||||
default is win32, or the platform is macOS, in which case the
|
||||
default is macOS. If any backend is explicitly enabled or disabled,
|
||||
no other platform will be enabled automatically.
|
||||
Enable specific backends for GDK. If none of these options are given, the
|
||||
Wayland backend will be enabled by default, if the platform is Linux; the
|
||||
X11 backend will also be enabled by default, unless the platform is Windows,
|
||||
in which case the default is win32, or the platform is macOS, in which case
|
||||
the default is macOS. If any backend is explicitly enabled or disabled, no
|
||||
other platform will be enabled automatically.
|
||||
|
||||
### `vulkan`
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Title: CSS in GTK
|
||||
Slug: css
|
||||
|
||||
This chapter describes how GTK uses CSS for styling and layout.
|
||||
This chapter describes how GTK uses CSS for styling and layout.
|
||||
It is not meant to be an explanation of CSS from first principles,
|
||||
but focuses on listing supported CSS features and differences
|
||||
between Web CSS and GTK.
|
||||
|
||||
@@ -28,6 +28,9 @@ GTK depends on the following libraries:
|
||||
- **OpenGL**: OpenGL is the premier environment for developing portable,
|
||||
interactive 2D and 3D graphics applications. More information available
|
||||
on the [Khronos website][opengl].
|
||||
- **Vulkan**: Vulkan is the a newer graphics API, that can be considered
|
||||
the successor of OpenGL. More information available on the
|
||||
[Khronos website][vulkan].
|
||||
- **Pango**: Pango is a library for internationalized text handling. It
|
||||
centers around the `PangoLayout` object, representing a paragraph of
|
||||
text. Pango provides the engine for `GtkTextView`, `GtkLabel`,
|
||||
@@ -60,6 +63,7 @@ GTK is divided into three parts:
|
||||
[gio]: https://developer.gnome.org/gio/stable/
|
||||
[cairo]: https://www.cairographics.org/manual/
|
||||
[opengl]: https://www.opengl.org/about/
|
||||
[vulkan]: https://www.vulkan.org/
|
||||
[pango]: https://pango.gnome.org/
|
||||
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||
[graphene]: https://ebassi.github.io/graphene/
|
||||
|
||||
@@ -27,7 +27,7 @@ the question you have, this list is a good place to start.
|
||||
Every major version of GTK comes with a [migration guide](#migrating). You may also
|
||||
find useful information in the documentation for specific widgets and functions. If
|
||||
you have a question not covered in the manual, feel free to ask, and please
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/new) against the
|
||||
[file a bug report](https://gitlab.gnome.org/GNOME/gtk/issues/) against the
|
||||
documentation.
|
||||
|
||||
* Should I maintain parallel versions of my UI in GTK x and GTK y?
|
||||
@@ -54,7 +54,7 @@ the question you have, this list is a good place to start.
|
||||
For strings returned from functions, they will be declared "const" if they should
|
||||
not be freed. Non-const strings should be freed with `g_free()`. Arrays follow the
|
||||
same rule. If you find an undocumented exception to the rules, please
|
||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
[file a bug report.](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
|
||||
The transfer annotations for gobject-introspection that are part of the
|
||||
documentation can provide useful hints for memory handling semantics as well.
|
||||
|
||||
@@ -4,7 +4,7 @@ Slug: gtk-resources
|
||||
## Opening a bug or feature request
|
||||
|
||||
If you encounter a bug, misfeature, or missing feature in GTK, please
|
||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/new).
|
||||
file a bug report on our [GitLab project](https://gitlab.gnome.org/GNOME/gtk/issues/).
|
||||
You should also file issues if the documentation is out of date with the
|
||||
existing API, or unclear.
|
||||
|
||||
|
||||
@@ -278,14 +278,11 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
: OpenGL renderer information
|
||||
|
||||
`vulkan`
|
||||
: Vulkan renderer information
|
||||
: Check Vulkan errors
|
||||
|
||||
`shaders`
|
||||
: Information about shaders
|
||||
|
||||
`surface`
|
||||
: Information about surfaces
|
||||
|
||||
`fallback`
|
||||
: Information about fallback usage in renderers
|
||||
|
||||
@@ -303,9 +300,6 @@ A number of options affect behavior instead of logging:
|
||||
`full-redraw`
|
||||
: Force full redraws
|
||||
|
||||
`sync`
|
||||
: Sync after each frame
|
||||
|
||||
`staging`
|
||||
: Use a staging image for texture upload (Vulkan only)
|
||||
|
||||
@@ -347,6 +341,28 @@ a `*`, which means: try all remaining backends. The special value
|
||||
backends. For more information about selecting backends,
|
||||
see the [func@Gdk.DisplayManager.get] function.
|
||||
|
||||
### `GDK_GL_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable extension features of the OpenGL support.
|
||||
Note that these features may already be disabled if the GL driver
|
||||
does not support them.
|
||||
|
||||
`debug`
|
||||
: GL_KHR_debug
|
||||
|
||||
`unpack-subimage`
|
||||
:GL_EXT_unpack_subimage
|
||||
|
||||
`half-float`
|
||||
:GL_OES_vertex_half_float
|
||||
|
||||
`sync`
|
||||
:GL_ARB_sync
|
||||
|
||||
`base-instance`
|
||||
:GL_EXT_base_instance
|
||||
|
||||
### `GDK_VULKAN_DEVICE`
|
||||
|
||||
This variable can be set to the index of a Vulkan device to override
|
||||
@@ -354,7 +370,7 @@ the default selection of the device that is used for Vulkan rendering.
|
||||
The special value `list` can be used to obtain a list of all Vulkan
|
||||
devices.
|
||||
|
||||
### `GDK_VULKAN_SKIP`
|
||||
### `GDK_VULKAN_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable features of the Vulkan support.
|
||||
@@ -434,7 +450,7 @@ using and the GDK backend supports them:
|
||||
installation.
|
||||
|
||||
|
||||
### `GSK_GPU_SKIP`
|
||||
### `GSK_GPU_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GSK to
|
||||
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
@@ -454,9 +470,6 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
`mipmap`
|
||||
: Avoid creating mipmaps
|
||||
|
||||
`gl-baseinstance`
|
||||
: Assume no ARB/EXT_base_instance support
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -469,10 +482,10 @@ n seconds. The default timeout is 15 seconds.
|
||||
|
||||
### `GSK_MAX_TEXTURE_SIZE`
|
||||
|
||||
Limit texture size to the minimum of this value and the OpenGL limit
|
||||
for texture sizes. This can be used to debug issues with texture slicing
|
||||
on systems where the OpenGL texture size limit would otherwise make
|
||||
texture slicing difficult to test.
|
||||
Limit texture size to the minimum of this value and the OpenGL limit for
|
||||
texture sizes in the "gl" renderer. This can be used to debug issues with
|
||||
texture slicing on systems where the OpenGL texture size limit would
|
||||
otherwise make texture slicing difficult to test.
|
||||
|
||||
### `GTK_CSD`
|
||||
|
||||
|
||||
@@ -156,6 +156,9 @@ gdk_cursor_finalize (GObject *object)
|
||||
g_clear_object (&cursor->texture);
|
||||
g_clear_object (&cursor->fallback);
|
||||
|
||||
if (cursor->destroy)
|
||||
cursor->destroy (cursor->data);
|
||||
|
||||
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -253,6 +256,11 @@ gdk_cursor_hash (gconstpointer pointer)
|
||||
hash ^= g_str_hash (cursor->name);
|
||||
else if (cursor->texture)
|
||||
hash ^= g_direct_hash (cursor->texture);
|
||||
else if (cursor->callback)
|
||||
{
|
||||
hash ^= g_direct_hash (cursor->callback);
|
||||
hash ^= g_direct_hash (cursor->data);
|
||||
}
|
||||
|
||||
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
|
||||
|
||||
@@ -281,6 +289,10 @@ gdk_cursor_equal (gconstpointer a,
|
||||
ca->hotspot_y != cb->hotspot_y)
|
||||
return FALSE;
|
||||
|
||||
if (ca->callback != cb->callback ||
|
||||
ca->data != cb->data)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -355,6 +367,45 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_new_from_callback:
|
||||
* @callback: the `GdkCursorGetTextureCallback`
|
||||
* @data: data to pass to @callback
|
||||
* @destroy: destroy notify for @data
|
||||
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
||||
* this one cannot be supported
|
||||
*
|
||||
* Creates a new callback-based cursor object.
|
||||
*
|
||||
* Cursors of this kind produce textures for the cursor
|
||||
* image on demand, when the @callback is called.
|
||||
*
|
||||
* Returns: (nullable): a new `GdkCursor`
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkCursor *
|
||||
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy,
|
||||
GdkCursor *fallback)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_val_if_fail (callback != NULL, NULL);
|
||||
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
|
||||
|
||||
cursor = g_object_new (GDK_TYPE_CURSOR,
|
||||
"fallback", fallback,
|
||||
NULL);
|
||||
|
||||
cursor->callback = callback;
|
||||
cursor->data = data;
|
||||
cursor->destroy = destroy;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
|
||||
* @cursor: a `GdkCursor`
|
||||
@@ -459,3 +510,22 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
|
||||
|
||||
return cursor->hotspot_y;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y)
|
||||
{
|
||||
if (cursor->callback == NULL)
|
||||
return NULL;
|
||||
|
||||
return cursor->callback (cursor,
|
||||
cursor_size, scale,
|
||||
width, height,
|
||||
hotspot_x, hotspot_y,
|
||||
cursor->data);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,52 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||
GdkCursor *fallback);
|
||||
|
||||
/**
|
||||
* GdkCursorGetTestureCallback:
|
||||
* @cursor: the `GdkCursor`
|
||||
* @cursor_size: the nominal cursor size, in application pixels
|
||||
* @scale: the device scale
|
||||
* @width: (out): return location for the actual cursor width,
|
||||
* in application pixels
|
||||
* @height: (out): return location for the actual cursor height,
|
||||
* in application pixels
|
||||
* @hotspot_x: (out): return location for the hotspot X position,
|
||||
* in application pixels
|
||||
* @hotspot_y: (out): return location for the hotspot Y position,
|
||||
* in application pixels
|
||||
* @data: User data for the callback
|
||||
*
|
||||
* The type of callback used by a dynamic `GdkCursor` to generate
|
||||
* a texture for the cursor image at the given @cursor_size
|
||||
* and @scale.
|
||||
*
|
||||
* The actual cursor size in application pixels may be different
|
||||
* from @cursor_size x @cursor_size, and will be returned in
|
||||
* @width, @height. The returned texture should have a size that
|
||||
* corresponds to the actual cursor size, in device pixels (i.e.
|
||||
* application pixels, multiplied by @scale).
|
||||
*
|
||||
* This function may fail and return `NULL`, in which case
|
||||
* the fallback cursor will be used.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the cursor image, or
|
||||
* `NULL` if none could be produced.
|
||||
*/
|
||||
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
gpointer data);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy,
|
||||
GdkCursor *fallback);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -44,6 +44,10 @@ struct _GdkCursor
|
||||
GdkTexture *texture;
|
||||
int hotspot_x;
|
||||
int hotspot_y;
|
||||
|
||||
GdkCursorGetTextureCallback callback;
|
||||
gpointer data;
|
||||
GDestroyNotify destroy;
|
||||
};
|
||||
|
||||
struct _GdkCursorClass
|
||||
@@ -55,5 +59,13 @@ guint gdk_cursor_hash (gconstpointer
|
||||
gboolean gdk_cursor_equal (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
|
||||
int cursor_size,
|
||||
double scale,
|
||||
int *width,
|
||||
int *height,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -1538,6 +1538,7 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
EGLConfig egl_config)
|
||||
{
|
||||
EGLint red, green, blue, alpha, type;
|
||||
EGLint depth, stencil;
|
||||
|
||||
if (egl_config == NULL)
|
||||
return g_strdup ("-");
|
||||
@@ -1556,7 +1557,16 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
else
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_DEPTH_SIZE, &depth))
|
||||
depth = 0;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_STENCIL_SIZE, &stencil))
|
||||
stencil = 0;
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s, depth %d, stencil %d", red, green, blue, alpha,
|
||||
type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float",
|
||||
depth,
|
||||
stencil);
|
||||
}
|
||||
|
||||
gpointer
|
||||
@@ -2037,9 +2047,12 @@ gdk_display_get_dmabuf_formats (GdkDisplay *display)
|
||||
GdkDebugFlags
|
||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||
{
|
||||
if (display == NULL)
|
||||
return _gdk_debug_flags;
|
||||
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
return display ? priv->debug_flags : _gdk_debug_flags;
|
||||
return priv->debug_flags;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabuftexturebuilderprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include <gdk/gdkglcontext.h>
|
||||
#include <gdk/gdkgltexturebuilder.h>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkdmabuftexturebuilderprivate.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
@@ -948,22 +949,20 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
|
||||
*
|
||||
* Builds a new `GdkTexture` with the values set up in the builder.
|
||||
*
|
||||
* It is a programming error to call this function if any mandatory
|
||||
* property has not been set.
|
||||
* It is a programming error to call this function if any mandatory property has not been set.
|
||||
*
|
||||
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
|
||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
|
||||
* format is not supported by GTK, %NULL will be returned and @error will be set.
|
||||
*
|
||||
* The `destroy` function gets called when the returned texture gets released.
|
||||
*
|
||||
* It is possible to call this function multiple times to create multiple textures,
|
||||
* possibly with changing properties in between.
|
||||
*
|
||||
* It is the responsibility of the caller to keep the file descriptors for the planes
|
||||
* open until the created texture is no longer used, and close them afterwards (possibly
|
||||
* using the @destroy notify).
|
||||
*
|
||||
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
|
||||
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
|
||||
* It is possible to call this function multiple times to create multiple textures,
|
||||
* possibly with changing properties in between.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
|
||||
* if the format is not supported
|
||||
@@ -1004,3 +1003,19 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
|
||||
{
|
||||
return &self->dmabuf;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
|
||||
const GdkDmabuf *dmabuf)
|
||||
{
|
||||
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
|
||||
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
|
||||
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
|
||||
|
||||
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
|
||||
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
|
||||
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
|
||||
}
|
||||
}
|
||||
|
||||
14
gdk/gdkdmabuftexturebuilderprivate.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkdmabuftexturebuilder.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||
|
||||
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
|
||||
const GdkDmabuf *dmabuf);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
|
||||
|
||||
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
GDestroyNotify destroy,
|
||||
gpointer data,
|
||||
|
||||
@@ -50,18 +50,6 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
|
||||
static struct {
|
||||
GdkDragAction action;
|
||||
const char *name;
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "move", NULL },
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
{ 0, "no-drop", NULL },
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CONTENT,
|
||||
@@ -786,6 +774,20 @@ gdk_drag_handle_source_event (GdkEvent *event)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static struct {
|
||||
GdkDragAction action;
|
||||
const char *name;
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ 0, "default", NULL },
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "dnd-move", NULL }, /* Not using move here, since move is stuck using
|
||||
* a mismatched visual metaphor in Adwaita
|
||||
*/
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
};
|
||||
|
||||
GdkCursor *
|
||||
gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
|
||||
@@ -79,14 +79,23 @@ static guint signals[LAST_SIGNAL];
|
||||
|
||||
static guint fps_counter;
|
||||
|
||||
#define FRAME_HISTORY_MAX_LENGTH 128
|
||||
/* 60Hz plus some extra for monotonic time inaccuracy */
|
||||
#define FRAME_HISTORY_DEFAULT_LENGTH 64
|
||||
|
||||
#define frame_timings_unref(x) gdk_frame_timings_unref((GdkFrameTimings *) (x))
|
||||
|
||||
#define GDK_ARRAY_NAME timings
|
||||
#define GDK_ARRAY_TYPE_NAME Timings
|
||||
#define GDK_ARRAY_ELEMENT_TYPE GdkFrameTimings *
|
||||
#define GDK_ARRAY_PREALLOC FRAME_HISTORY_DEFAULT_LENGTH
|
||||
#define GDK_ARRAY_FREE_FUNC frame_timings_unref
|
||||
#include "gdk/gdkarrayimpl.c"
|
||||
|
||||
struct _GdkFrameClockPrivate
|
||||
{
|
||||
gint64 frame_counter;
|
||||
int n_timings;
|
||||
int current;
|
||||
GdkFrameTimings *timings[FRAME_HISTORY_MAX_LENGTH];
|
||||
Timings timings;
|
||||
int n_freeze_inhibitors;
|
||||
};
|
||||
|
||||
@@ -99,11 +108,8 @@ static void
|
||||
gdk_frame_clock_finalize (GObject *object)
|
||||
{
|
||||
GdkFrameClockPrivate *priv = GDK_FRAME_CLOCK (object)->priv;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FRAME_HISTORY_MAX_LENGTH; i++)
|
||||
if (priv->timings[i] != 0)
|
||||
gdk_frame_timings_unref (priv->timings[i]);
|
||||
timings_clear (&priv->timings);
|
||||
|
||||
G_OBJECT_CLASS (gdk_frame_clock_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -257,7 +263,8 @@ gdk_frame_clock_init (GdkFrameClock *clock)
|
||||
clock->priv = priv = gdk_frame_clock_get_instance_private (clock);
|
||||
|
||||
priv->frame_counter = -1;
|
||||
priv->current = FRAME_HISTORY_MAX_LENGTH - 1;
|
||||
priv->current = 0;
|
||||
timings_init (&priv->timings);
|
||||
|
||||
if (fps_counter == 0)
|
||||
fps_counter = gdk_profiler_define_counter ("fps", "Frames per Second");
|
||||
@@ -416,7 +423,7 @@ gdk_frame_clock_get_frame_counter (GdkFrameClock *frame_clock)
|
||||
static inline gint64
|
||||
_gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
{
|
||||
return frame_clock->priv->frame_counter + 1 - frame_clock->priv->n_timings;
|
||||
return frame_clock->priv->frame_counter + 1 - timings_get_size (&frame_clock->priv->timings);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,31 +452,44 @@ gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock)
|
||||
_gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock,
|
||||
gint64 monotonic_time)
|
||||
{
|
||||
GdkFrameClockPrivate *priv;
|
||||
|
||||
g_return_if_fail (GDK_IS_FRAME_CLOCK (frame_clock));
|
||||
|
||||
priv = frame_clock->priv;
|
||||
|
||||
priv->frame_counter++;
|
||||
priv->current = (priv->current + 1) % FRAME_HISTORY_MAX_LENGTH;
|
||||
|
||||
/* Try to steal the previous frame timing instead of discarding
|
||||
* and allocating a new one.
|
||||
*/
|
||||
if G_LIKELY (priv->n_timings == FRAME_HISTORY_MAX_LENGTH &&
|
||||
_gdk_frame_timings_steal (priv->timings[priv->current],
|
||||
priv->frame_counter))
|
||||
return;
|
||||
|
||||
if (priv->n_timings < FRAME_HISTORY_MAX_LENGTH)
|
||||
priv->n_timings++;
|
||||
if (G_UNLIKELY (timings_get_size (&priv->timings) == 0))
|
||||
timings_append (&priv->timings, _gdk_frame_timings_new (priv->frame_counter));
|
||||
else
|
||||
gdk_frame_timings_unref (priv->timings[priv->current]);
|
||||
{
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
priv->timings[priv->current] = _gdk_frame_timings_new (priv->frame_counter);
|
||||
priv->current = (priv->current + 1) % timings_get_size (&priv->timings);
|
||||
|
||||
timings = timings_get (&priv->timings, priv->current);
|
||||
|
||||
if (timings->frame_time + G_USEC_PER_SEC > monotonic_time)
|
||||
{
|
||||
/* Keep the timings, not a second old yet */
|
||||
timings = _gdk_frame_timings_new (priv->frame_counter);
|
||||
timings_splice (&priv->timings, priv->current, 0, FALSE, &timings, 1);
|
||||
}
|
||||
else if (_gdk_frame_timings_steal (timings, priv->frame_counter))
|
||||
{
|
||||
/* Stole the previous frame timing instead of discarding
|
||||
* and allocating a new one, so nothing to do
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
timings = _gdk_frame_timings_new (priv->frame_counter);
|
||||
timings_splice (&priv->timings, priv->current, 1, FALSE, &timings, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline GdkFrameTimings *
|
||||
@@ -477,17 +497,21 @@ _gdk_frame_clock_get_timings (GdkFrameClock *frame_clock,
|
||||
gint64 frame_counter)
|
||||
{
|
||||
GdkFrameClockPrivate *priv = frame_clock->priv;
|
||||
int pos;
|
||||
gsize size, pos;
|
||||
|
||||
if (frame_counter > priv->frame_counter)
|
||||
return NULL;
|
||||
|
||||
if (frame_counter <= priv->frame_counter - priv->n_timings)
|
||||
size = timings_get_size (&priv->timings);
|
||||
if (G_UNLIKELY (size == 0))
|
||||
return NULL;
|
||||
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
|
||||
if (priv->frame_counter - frame_counter >= size)
|
||||
return NULL;
|
||||
|
||||
return priv->timings[pos];
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + size) % size;
|
||||
|
||||
return timings_get (&priv->timings, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -779,7 +803,10 @@ gdk_frame_clock_get_fps (GdkFrameClock *frame_clock)
|
||||
|
||||
start_counter = _gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = _gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (start = _gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
end_counter > start_counter && start != NULL && !gdk_frame_timings_get_complete (start);
|
||||
start = _gdk_frame_clock_get_timings (frame_clock, start_counter))
|
||||
start_counter++;
|
||||
for (end = _gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = _gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
|
||||
@@ -192,6 +192,13 @@ compute_smooth_frame_time (GdkFrameClock *clock,
|
||||
* and new_frame_time >= old_frame_time. */
|
||||
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
||||
|
||||
if (frames_passed > 1)
|
||||
gdk_profiler_add_markf ((smoothed_frame_time_base - (frame_interval * (frames_passed-1))) * 1000L,
|
||||
frame_interval * (frames_passed-1) * 1000L,
|
||||
"Dropped Frames",
|
||||
"%u frames may have been dropped",
|
||||
frames_passed-1);
|
||||
|
||||
/* We use an approximately whole number of frames in the future from
|
||||
* last smoothed frame time. This way we avoid minor jitter in the
|
||||
* frame times making the animation speed uneven, but still animate
|
||||
@@ -548,7 +555,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
priv->smoothed_frame_time_period = frame_interval;
|
||||
priv->smoothed_frame_time_reported = priv->smoothed_frame_time_base;
|
||||
|
||||
_gdk_frame_clock_begin_frame (clock);
|
||||
_gdk_frame_clock_begin_frame (clock, priv->frame_time);
|
||||
/* Note "current" is different now so timings != prev_timings */
|
||||
timings = gdk_frame_clock_get_current_timings (clock);
|
||||
|
||||
|
||||
@@ -106,7 +106,8 @@ struct _GdkFrameTimings
|
||||
void _gdk_frame_clock_inhibit_freeze (GdkFrameClock *clock);
|
||||
void _gdk_frame_clock_uninhibit_freeze (GdkFrameClock *clock);
|
||||
|
||||
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock);
|
||||
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock,
|
||||
gint64 monotonic_time);
|
||||
void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
GdkFrameTimings *timings);
|
||||
void _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *frame_clock,
|
||||
|
||||
@@ -125,7 +125,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
* the GL_UNPACK_ROW_LENGTH support
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (paint_context) &&
|
||||
!(version >= 300 || gdk_gl_context_has_unpack_subimage (paint_context)))
|
||||
!(version >= 300 || gdk_gl_context_has_feature (paint_context, GDK_GL_FEATURE_UNPACK_SUBIMAGE)))
|
||||
return;
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
|
||||
@@ -103,6 +103,15 @@
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
|
||||
static const GdkDebugKey gdk_gl_feature_keys[] = {
|
||||
{ "debug", GDK_GL_FEATURE_DEBUG, "GL_KHR_debug" },
|
||||
{ "unpack-subimage", GDK_GL_FEATURE_UNPACK_SUBIMAGE, "GL_EXT_unpack_subimage" },
|
||||
{ "half-float", GDK_GL_FEATURE_VERTEX_HALF_FLOAT, "GL_OES_vertex_half_float" },
|
||||
{ "sync", GDK_GL_FEATURE_SYNC, "GL_ARB_sync" },
|
||||
{ "base-instance", GDK_GL_FEATURE_BASE_INSTANCE, "GL_ARB_base_instance" },
|
||||
{ "buffer-storage", GDK_GL_FEATURE_BUFFER_STORAGE, "GL_EXT_buffer_storage" },
|
||||
};
|
||||
|
||||
typedef struct _GdkGLContextPrivate GdkGLContextPrivate;
|
||||
|
||||
struct _GdkGLContextPrivate
|
||||
@@ -112,13 +121,9 @@ struct _GdkGLContextPrivate
|
||||
|
||||
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
|
||||
|
||||
guint has_khr_debug : 1;
|
||||
GdkGLFeatures features;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_half_float : 1;
|
||||
guint has_sync : 1;
|
||||
guint has_unpack_subimage : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint has_bgra : 1;
|
||||
guint extensions_checked : 1;
|
||||
guint debug_enabled : 1;
|
||||
guint forward_compatible : 1;
|
||||
@@ -290,7 +295,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
GdkGLContextPrivate *share_priv = share ? gdk_gl_context_get_instance_private (share) : NULL;
|
||||
EGLConfig egl_config;
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
|
||||
@@ -658,6 +663,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
EGLSurface egl_surface;
|
||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (priv->egl_context == NULL)
|
||||
return;
|
||||
@@ -666,8 +672,6 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
egl_surface = gdk_surface_get_egl_surface (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL swap buffers", NULL);
|
||||
|
||||
if (priv->eglSwapBuffersWithDamage)
|
||||
{
|
||||
EGLint stack_rects[4 * 4]; /* 4 rects */
|
||||
@@ -698,6 +702,8 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
else
|
||||
eglSwapBuffers (gdk_display_get_egl_display (display), egl_surface);
|
||||
#endif
|
||||
|
||||
gdk_profiler_add_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "EGL swap buffers", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -897,11 +903,12 @@ gdk_gl_context_label_object_printf (GdkGLContext *context,
|
||||
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_unpack_subimage (GdkGLContext *context)
|
||||
gdk_gl_context_has_feature (GdkGLContext *self,
|
||||
GdkGLFeatures feature)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_unpack_subimage;
|
||||
return (priv->features & feature) == feature;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1663,10 +1670,53 @@ gdk_gl_version_init_epoxy (GdkGLVersion *version)
|
||||
*version = GDK_GL_VERSION_INIT (epoxy_version / 10, epoxy_version % 10);
|
||||
}
|
||||
|
||||
static GdkGLFeatures
|
||||
gdk_gl_context_check_features (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLFeatures features = 0;
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
|
||||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage"))
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
features |= GDK_GL_FEATURE_UNPACK_SUBIMAGE;
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_KHR_debug"))
|
||||
features |= GDK_GL_FEATURE_DEBUG;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float"))
|
||||
features |= GDK_GL_FEATURE_VERTEX_HALF_FLOAT;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync"))
|
||||
features |= GDK_GL_FEATURE_SYNC;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "4.2", "9.9") ||
|
||||
epoxy_has_gl_extension ("GL_EXT_base_instance") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_base_instance"))
|
||||
features |= GDK_GL_FEATURE_BASE_INSTANCE;
|
||||
|
||||
if (gdk_gl_context_check_version (context, "4.4", "9.9") ||
|
||||
epoxy_has_gl_extension ("GL_EXT_buffer_storage") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_buffer_storage"))
|
||||
features |= GDK_GL_FEATURE_BUFFER_STORAGE;
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkGLFeatures supported_features, disabled_features;
|
||||
gboolean gl_debug = FALSE;
|
||||
GdkDisplay *display;
|
||||
|
||||
@@ -1684,69 +1734,54 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
if (priv->has_debug_output && gl_debug)
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
glEnable (GL_DEBUG_OUTPUT);
|
||||
glEnable (GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback (gl_debug_message_callback, NULL);
|
||||
}
|
||||
|
||||
if (gdk_gl_context_get_use_es (context))
|
||||
{
|
||||
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
|
||||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
|
||||
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
|
||||
priv->has_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888");
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->has_unpack_subimage = TRUE;
|
||||
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
|
||||
priv->has_bgra = TRUE;
|
||||
/* If we asked for a core profile, but didn't get one, we're in legacy mode */
|
||||
if (!gdk_gl_context_get_use_es (context) &&
|
||||
!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
priv->is_legacy = TRUE;
|
||||
|
||||
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
|
||||
if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
priv->is_legacy = TRUE;
|
||||
}
|
||||
supported_features = gdk_gl_context_check_features (context);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_GL_DISABLE",
|
||||
gdk_gl_feature_keys,
|
||||
G_N_ELEMENTS (gdk_gl_feature_keys));
|
||||
|
||||
if (priv->has_khr_debug && gl_debug)
|
||||
priv->features = supported_features & ~disabled_features;
|
||||
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
if ((priv->features & GDK_GL_FEATURE_DEBUG) && gl_debug)
|
||||
{
|
||||
priv->use_khr_debug = TRUE;
|
||||
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
|
||||
}
|
||||
|
||||
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
|
||||
|
||||
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync");
|
||||
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
{
|
||||
int max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
|
||||
"%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Max texture size: %d\n"
|
||||
"* Extensions checked:\n"
|
||||
" - GL_KHR_debug: %s\n"
|
||||
" - GL_EXT_unpack_subimage: %s\n"
|
||||
" - half float: %s\n"
|
||||
" - sync: %s\n"
|
||||
" - bgra: %s",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
max_texture_size,
|
||||
priv->has_khr_debug ? "yes" : "no",
|
||||
priv->has_unpack_subimage ? "yes" : "no",
|
||||
priv->has_half_float ? "yes" : "no",
|
||||
priv->has_sync ? "yes" : "no",
|
||||
priv->has_bgra ? "yes" : "no");
|
||||
}
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, OPENGL))
|
||||
{
|
||||
int i, max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
gdk_debug_message ("%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Max texture size: %d\n",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
max_texture_size);
|
||||
gdk_debug_message ("Enabled features (use GDK_GL_DISABLE env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gdk_gl_feature_keys); i++)
|
||||
{
|
||||
gdk_debug_message (" %s: %s",
|
||||
gdk_gl_feature_keys[i].key,
|
||||
(priv->features & gdk_gl_feature_keys[i].value) ? "YES" :
|
||||
((disabled_features & gdk_gl_feature_keys[i].value) ? "disabled via env var" :
|
||||
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "not supported" :
|
||||
"Hum, what? This should not happen.")));
|
||||
}
|
||||
}
|
||||
|
||||
priv->extensions_checked = TRUE;
|
||||
}
|
||||
@@ -2015,30 +2050,6 @@ gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
return priv->memory_flags[format];
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_debug (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->debug_enabled || priv->use_khr_debug;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_half_float;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_sync (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_sync;
|
||||
}
|
||||
|
||||
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
|
||||
* can be used
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_FEATURE_DEBUG = 1 << 0,
|
||||
GDK_GL_FEATURE_UNPACK_SUBIMAGE = 1 << 1,
|
||||
GDK_GL_FEATURE_VERTEX_HALF_FLOAT = 1 << 2,
|
||||
GDK_GL_FEATURE_SYNC = 1 << 3,
|
||||
GDK_GL_FEATURE_BASE_INSTANCE = 1 << 4,
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 5,
|
||||
} GdkGLFeatures;
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
@@ -142,7 +151,6 @@ void gdk_gl_context_get_matching_version (GdkGLContext
|
||||
gboolean legacy,
|
||||
GdkGLVersion *out_version);
|
||||
|
||||
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
|
||||
void gdk_gl_context_push_debug_group (GdkGLContext *context,
|
||||
const char *message);
|
||||
void gdk_gl_context_push_debug_group_printf (GdkGLContext *context,
|
||||
@@ -163,14 +171,11 @@ const char * gdk_gl_context_get_glsl_version_string (GdkGLContext
|
||||
|
||||
GdkGLMemoryFlags gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
GdkMemoryFormat format) G_GNUC_PURE;
|
||||
gboolean gdk_gl_context_has_debug (GdkGLContext *self) G_GNUC_PURE;
|
||||
gboolean gdk_gl_context_has_feature (GdkGLContext *self,
|
||||
GdkGLFeatures feature) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
@@ -494,7 +494,7 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
|
||||
self->id = gdk_gl_texture_builder_get_id (builder);
|
||||
GDK_TEXTURE (self)->format = gdk_gl_texture_builder_get_format (builder);
|
||||
self->has_mipmap = gdk_gl_texture_builder_get_has_mipmap (builder);
|
||||
if (gdk_gl_context_has_sync (self->context))
|
||||
if (gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_SYNC))
|
||||
self->sync = gdk_gl_texture_builder_get_sync (builder);
|
||||
self->destroy = destroy;
|
||||
self->data = data;
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef enum {
|
||||
* @get_current_image: return a `GdkPaintable` that does not change over
|
||||
* time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
|
||||
* `GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
|
||||
* @get_flags: Get the flags for this instance. See [enum@Gdk.PaintableFlags]
|
||||
* @get_flags: Get the flags for this instance. See [flags@Gdk.PaintableFlags]
|
||||
* for details.
|
||||
* @get_intrinsic_width: The preferred width for this object to be
|
||||
* snapshot at or 0 if none. This is purely a hint. The object must still
|
||||
|
||||
@@ -113,6 +113,8 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
@@ -155,7 +157,7 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, transform, lightbox, above, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -203,3 +205,19 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
|
||||
return subsurface->above_parent;
|
||||
}
|
||||
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), GDK_TEXTURE_TRANSFORM_NORMAL);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_subsurface_get_lightbox (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_lightbox (subsurface);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,16 @@ struct _GdkSubsurface
|
||||
GdkSubsurface *sibling_below;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GDK_TEXTURE_TRANSFORM_NORMAL,
|
||||
GDK_TEXTURE_TRANSFORM_90,
|
||||
GDK_TEXTURE_TRANSFORM_180,
|
||||
GDK_TEXTURE_TRANSFORM_270,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_90,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_180,
|
||||
GDK_TEXTURE_TRANSFORM_FLIPPED_270,
|
||||
} GdkTextureTransform;
|
||||
|
||||
struct _GdkSubsurfaceClass
|
||||
{
|
||||
@@ -56,6 +66,8 @@ struct _GdkSubsurfaceClass
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
@@ -64,15 +76,21 @@ struct _GdkSubsurfaceClass
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
GdkTextureTransform
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
gboolean (* get_lightbox) (GdkSubsurface *subsurface);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean lightbox,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
@@ -82,6 +100,9 @@ void gdk_subsurface_get_source (GdkSubsurface *subsurfac
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_get_lightbox (GdkSubsurface *subsurface);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -260,6 +260,11 @@ gdk_vulkan_strerror (VkResult result)
|
||||
case VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT:
|
||||
return "The provided binary shader code is not compatible with this device. (VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT)";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 274
|
||||
case VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR:
|
||||
return "The specified Video Std parameters do not adhere to the syntactic or semantic requirements of the used video compression standard or implementation";
|
||||
#endif
|
||||
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
@@ -547,9 +552,8 @@ physical_device_supports_extension (VkPhysicalDevice device,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
physical_device_check_features (VkPhysicalDevice device,
|
||||
GdkVulkanFeatures *out_features)
|
||||
static GdkVulkanFeatures
|
||||
physical_device_check_features (VkPhysicalDevice device)
|
||||
{
|
||||
VkPhysicalDeviceVulkan12Features v12_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
||||
@@ -558,15 +562,16 @@ physical_device_check_features (VkPhysicalDevice device,
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
|
||||
.pNext = &v12_features
|
||||
};
|
||||
VkPhysicalDeviceFeatures2 features = {
|
||||
VkPhysicalDeviceFeatures2 v10_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
|
||||
.pNext = &ycbcr_features
|
||||
};
|
||||
VkExternalSemaphoreProperties semaphore_props = {
|
||||
.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES,
|
||||
};
|
||||
GdkVulkanFeatures features;
|
||||
|
||||
vkGetPhysicalDeviceFeatures2 (device, &features);
|
||||
vkGetPhysicalDeviceFeatures2 (device, &v10_features);
|
||||
vkGetPhysicalDeviceExternalSemaphoreProperties (device,
|
||||
&(VkPhysicalDeviceExternalSemaphoreInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
|
||||
@@ -574,46 +579,46 @@ physical_device_check_features (VkPhysicalDevice device,
|
||||
},
|
||||
&semaphore_props);
|
||||
|
||||
*out_features = 0;
|
||||
features = 0;
|
||||
|
||||
if (features.features.shaderUniformBufferArrayDynamicIndexing &&
|
||||
features.features.shaderSampledImageArrayDynamicIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
|
||||
if (v10_features.features.shaderUniformBufferArrayDynamicIndexing &&
|
||||
v10_features.features.shaderSampledImageArrayDynamicIndexing)
|
||||
features |= GDK_VULKAN_FEATURE_DYNAMIC_INDEXING;
|
||||
|
||||
if (v12_features.descriptorIndexing &&
|
||||
v12_features.descriptorBindingPartiallyBound &&
|
||||
v12_features.descriptorBindingVariableDescriptorCount &&
|
||||
v12_features.descriptorBindingSampledImageUpdateAfterBind &&
|
||||
v12_features.descriptorBindingStorageBufferUpdateAfterBind)
|
||||
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
else if (physical_device_supports_extension (device, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME))
|
||||
*out_features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
features |= GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING;
|
||||
|
||||
if (v12_features.shaderSampledImageArrayNonUniformIndexing &&
|
||||
v12_features.shaderStorageBufferArrayNonUniformIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
|
||||
if (ycbcr_features.samplerYcbcrConversion ||
|
||||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
|
||||
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
||||
*out_features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||
{
|
||||
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT)
|
||||
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
|
||||
features |= GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT;
|
||||
|
||||
if (semaphore_props.externalSemaphoreFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT)
|
||||
*out_features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
|
||||
features |= GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT;
|
||||
}
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME))
|
||||
*out_features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
|
||||
features |= GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT;
|
||||
|
||||
return TRUE;
|
||||
return features;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1361,7 +1366,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
first = 0;
|
||||
last = n_devices;
|
||||
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_SKIP",
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
|
||||
@@ -1449,8 +1454,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
GdkVulkanFeatures features, device_features;
|
||||
uint32_t n_queue_props;
|
||||
|
||||
if (!physical_device_check_features (devices[i], &device_features))
|
||||
continue;
|
||||
device_features = physical_device_check_features (devices[i]);
|
||||
|
||||
features = device_features & ~skip_features;
|
||||
|
||||
@@ -1535,7 +1539,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
display->vk_queue_family_index = j;
|
||||
display->vulkan_features = features;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_SKIP env var to disable):");
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_DISABLE env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gsk_vulkan_feature_keys); i++)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, " %s: %s",
|
||||
|
||||
@@ -214,22 +214,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setFrame:(NSRect)frame display:(BOOL)display
|
||||
{
|
||||
NSRect contentRect = [self contentRectForFrameRect:frame];
|
||||
GdkSurface *surface = GDK_SURFACE (gdk_surface);
|
||||
gboolean maximized = (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0;
|
||||
|
||||
if (maximized && !inMaximizeTransition && !NSEqualRects (lastMaximizedFrame, frame))
|
||||
{
|
||||
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
|
||||
_gdk_surface_update_size (surface);
|
||||
}
|
||||
|
||||
[super setFrame:frame display:display];
|
||||
[[self contentView] setFrame:NSMakeRect (0, 0, contentRect.size.width, contentRect.size.height)];
|
||||
}
|
||||
|
||||
-(id)initWithContentRect:(NSRect)contentRect
|
||||
styleMask:(NSWindowStyleMask)styleMask
|
||||
backing:(NSBackingStoreType)backingType
|
||||
@@ -312,10 +296,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle geometry;
|
||||
GdkRectangle workarea;
|
||||
int shadow_top = 0;
|
||||
int shadow_left = 0;
|
||||
int shadow_right = 0;
|
||||
int shadow_bottom = 0;
|
||||
GdkRectangle window_gdk;
|
||||
GdkPoint pointer_position;
|
||||
GdkPoint new_origin;
|
||||
@@ -323,13 +303,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
if (!inManualMove)
|
||||
return NO;
|
||||
|
||||
/* Get our shadow so we can adjust the window position sans-shadow */
|
||||
_gdk_macos_surface_get_shadow (gdk_surface,
|
||||
&shadow_top,
|
||||
&shadow_right,
|
||||
&shadow_bottom,
|
||||
&shadow_left);
|
||||
|
||||
windowFrame = [self frame];
|
||||
currentLocation = [NSEvent mouseLocation];
|
||||
|
||||
@@ -355,21 +328,9 @@ typedef NSString *CALayerContentsGravity;
|
||||
window_gdk.width = windowFrame.size.width;
|
||||
window_gdk.height = windowFrame.size.height;
|
||||
|
||||
/* Subtract our shadowin from the window */
|
||||
window_gdk.x += shadow_left;
|
||||
window_gdk.y += shadow_top;
|
||||
window_gdk.width = window_gdk.width - shadow_left - shadow_right;
|
||||
window_gdk.height = window_gdk.height - shadow_top - shadow_bottom;
|
||||
|
||||
/* Now place things on the monitor */
|
||||
_edge_snapping_motion (&self->snapping, &pointer_position, &window_gdk);
|
||||
|
||||
/* And add our shadow back to the frame */
|
||||
window_gdk.x -= shadow_left;
|
||||
window_gdk.y -= shadow_top;
|
||||
window_gdk.width += shadow_left + shadow_right;
|
||||
window_gdk.height += shadow_top + shadow_bottom;
|
||||
|
||||
/* Convert to quartz coordinates */
|
||||
_gdk_macos_display_to_display_coords ([self gdkDisplay],
|
||||
window_gdk.x,
|
||||
@@ -387,12 +348,17 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
if ([self isZoomed])
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
|
||||
else
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
|
||||
|
||||
_gdk_macos_surface_configure ([self gdkSurface]);
|
||||
}
|
||||
|
||||
-(void)windowDidResize:(NSNotification *)notification
|
||||
{
|
||||
_gdk_macos_surface_configure (gdk_surface);
|
||||
[self windowDidMove: notification];
|
||||
|
||||
/* If we're using server-side decorations, this notification is coming
|
||||
* in from a display-side change. We need to request a layout in
|
||||
@@ -413,7 +379,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)beginManualMove
|
||||
{
|
||||
gboolean maximized = GDK_SURFACE (gdk_surface)->state & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
||||
NSPoint initialMoveLocation;
|
||||
GdkPoint point;
|
||||
GdkMonitor *monitor;
|
||||
@@ -432,13 +397,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
initialMoveLocation = [NSEvent mouseLocation];
|
||||
|
||||
if (maximized)
|
||||
[self setFrame:NSMakeRect (initialMoveLocation.x - (int)lastUnmaximizedFrame.size.width/2,
|
||||
initialMoveLocation.y,
|
||||
lastUnmaximizedFrame.size.width,
|
||||
lastUnmaximizedFrame.size.height)
|
||||
display:YES];
|
||||
|
||||
_gdk_macos_display_from_display_coords ([self gdkDisplay],
|
||||
initialMoveLocation.x,
|
||||
initialMoveLocation.y,
|
||||
@@ -734,26 +692,16 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)setStyleMask:(NSWindowStyleMask)styleMask
|
||||
{
|
||||
gboolean was_fullscreen;
|
||||
gboolean is_fullscreen;
|
||||
gboolean was_opaque;
|
||||
gboolean is_opaque;
|
||||
|
||||
was_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
|
||||
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
[super setStyleMask:styleMask];
|
||||
|
||||
is_fullscreen = (([self styleMask] & NSWindowStyleMaskFullScreen) != 0);
|
||||
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
if (was_fullscreen != is_fullscreen)
|
||||
{
|
||||
if (was_fullscreen)
|
||||
[self setFrame:lastUnfullscreenFrame display:NO];
|
||||
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
}
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
|
||||
if (was_opaque != is_opaque)
|
||||
{
|
||||
@@ -766,58 +714,20 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
|
||||
{
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
NSRect rect;
|
||||
int shadow_top;
|
||||
|
||||
/* Allow the window to move up "shadow_top" more than normally allowed
|
||||
* by the default impl. This makes it possible to move windows with
|
||||
* client side shadow right up to the screen's menu bar. */
|
||||
_gdk_macos_surface_get_shadow (surface, &shadow_top, NULL, NULL, NULL);
|
||||
rect = [super constrainFrameRect:frameRect toScreen:screen];
|
||||
if (frameRect.origin.y > rect.origin.y)
|
||||
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y + shadow_top);
|
||||
rect.origin.y = MIN (frameRect.origin.y, rect.origin.y);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
/* Implementing this method avoids new windows move around the screen. */
|
||||
-(NSRect)windowWillUseStandardFrame:(NSWindow *)nsWindow
|
||||
defaultFrame:(NSRect)newFrame
|
||||
{
|
||||
NSRect screenFrame = [[self screen] visibleFrame];
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
gboolean maximized = GDK_SURFACE (surface)->state & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
||||
|
||||
if (!maximized)
|
||||
return screenFrame;
|
||||
else
|
||||
return lastUnmaximizedFrame;
|
||||
}
|
||||
|
||||
-(BOOL)windowShouldZoom:(NSWindow *)nsWindow
|
||||
toFrame:(NSRect)newFrame
|
||||
{
|
||||
GdkMacosSurface *surface = gdk_surface;
|
||||
GdkToplevelState state = GDK_SURFACE (surface)->state;
|
||||
|
||||
if (state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
{
|
||||
lastMaximizedFrame = newFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastUnmaximizedFrame = [nsWindow frame];
|
||||
gdk_synthesize_surface_state (GDK_SURFACE (gdk_surface), 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
|
||||
}
|
||||
|
||||
inMaximizeTransition = YES;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(void)windowDidEndLiveResize:(NSNotification *)aNotification
|
||||
{
|
||||
inMaximizeTransition = NO;
|
||||
return newFrame;
|
||||
}
|
||||
|
||||
-(NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
|
||||
@@ -828,7 +738,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
-(void)windowWillEnterFullScreen:(NSNotification *)aNotification
|
||||
{
|
||||
inFullscreenTransition = YES;
|
||||
lastUnfullscreenFrame = [self frame];
|
||||
}
|
||||
|
||||
-(void)windowDidEnterFullScreen:(NSNotification *)aNotification
|
||||
|
||||
@@ -49,10 +49,6 @@
|
||||
|
||||
EdgeSnapping snapping;
|
||||
|
||||
NSRect lastUnmaximizedFrame;
|
||||
NSRect lastMaximizedFrame;
|
||||
NSRect lastUnfullscreenFrame;
|
||||
BOOL inMaximizeTransition;
|
||||
BOOL inFullscreenTransition;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkmacoscursor-private.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
|
||||
@interface NSCursor()
|
||||
-(long long)_coreCursorType;
|
||||
@@ -151,6 +152,57 @@ create_blank_cursor (void)
|
||||
return nscursor;
|
||||
}
|
||||
|
||||
static NSCursor *
|
||||
create_cursor_from_texture (GdkTexture *texture,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guchar *pixels;
|
||||
gsize stride;
|
||||
GdkTextureDownloader *downloader;
|
||||
NSCursor *nscursor;
|
||||
NSBitmapImageRep *nsbitmap;
|
||||
NSImage *nsimage;
|
||||
|
||||
if (texture == NULL)
|
||||
return create_blank_cursor ();
|
||||
|
||||
width = gdk_texture_get_width (texture);
|
||||
height = gdk_texture_get_height (texture);
|
||||
|
||||
nsbitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:width
|
||||
pixelsHigh:height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:0
|
||||
bitsPerPixel:0];
|
||||
pixels = [nsbitmap bitmapData];
|
||||
stride = [nsbitmap bytesPerRow];
|
||||
|
||||
downloader = gdk_texture_downloader_new (texture);
|
||||
gdk_texture_downloader_set_format (downloader, GDK_MEMORY_R8G8B8A8_PREMULTIPLIED);
|
||||
gdk_texture_downloader_download_into (downloader,
|
||||
pixels,
|
||||
stride);
|
||||
gdk_texture_downloader_free (downloader);
|
||||
|
||||
nsimage = [[NSImage alloc] init];
|
||||
[nsimage addRepresentation:nsbitmap];
|
||||
[nsimage setSize:NSMakeSize(width, height)];
|
||||
[nsbitmap release];
|
||||
|
||||
nscursor = [[NSCursor alloc] initWithImage:nsimage
|
||||
hotSpot:NSMakePoint(x, y)];
|
||||
[nsimage release];
|
||||
return nscursor;
|
||||
}
|
||||
|
||||
NSCursor *
|
||||
_gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
||||
{
|
||||
@@ -161,7 +213,33 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
|
||||
g_return_val_if_fail (!cursor || GDK_IS_CURSOR (cursor), NULL);
|
||||
|
||||
if (cursor != NULL)
|
||||
name = gdk_cursor_get_name (cursor);
|
||||
{
|
||||
name = gdk_cursor_get_name (cursor);
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int hotspot_x, hotspot_y;
|
||||
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
|
||||
hotspot_y = gdk_cursor_get_hotspot_y (cursor);
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
int size = 32; // FIXME
|
||||
int width, height;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
}
|
||||
|
||||
nscursor = create_cursor_from_texture (texture, hotspot_x, hotspot_y);
|
||||
|
||||
return nscursor;
|
||||
}
|
||||
}
|
||||
|
||||
if (name == NULL)
|
||||
goto load_cursor;
|
||||
|
||||
@@ -47,20 +47,20 @@ _gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
|
||||
/* Try to center on top of the parent but also try to make the whole thing
|
||||
* visible in case that lands us under the topbar/panel/etc.
|
||||
*/
|
||||
parent_rect.x = parent->root_x + parent->shadow_left;
|
||||
parent_rect.y = parent->root_y + parent->shadow_top;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width - parent->shadow_left - parent->shadow_right;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height - parent->shadow_top - parent->shadow_bottom;
|
||||
parent_rect.x = parent->root_x;
|
||||
parent_rect.y = parent->root_y;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height;
|
||||
|
||||
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
surface_rect.width = GDK_SURFACE (surface)->width;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height;
|
||||
surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2);
|
||||
surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@@ -99,15 +99,15 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
/* First place at top-left of current monitor */
|
||||
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
surface_rect.width = GDK_SURFACE (surface)->width;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height;
|
||||
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
|
||||
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
*x = surface_rect.x;
|
||||
*y = surface_rect.y;
|
||||
|
||||
/* Try to see if there are any other surfaces at this origin and if so,
|
||||
* adjust until we get something better.
|
||||
@@ -119,11 +119,11 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
*y += WARP_OFFSET_Y;
|
||||
|
||||
/* If we reached the bottom right, just bail and try the workspace origin */
|
||||
if (*x + surface->shadow_left + WARP_OFFSET_X > workarea.x + workarea.width ||
|
||||
*y + surface->shadow_top + WARP_OFFSET_Y > workarea.y + workarea.height)
|
||||
if (*x + WARP_OFFSET_X > workarea.x + workarea.width ||
|
||||
*y + WARP_OFFSET_Y > workarea.y + workarea.height)
|
||||
{
|
||||
*x = workarea.x - surface->shadow_left;
|
||||
*y = workarea.y - surface->shadow_top;
|
||||
*x = workarea.x;
|
||||
*y = workarea.y;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,7 +998,9 @@ _gdk_macos_display_get_nsevent (GdkEvent *event)
|
||||
{
|
||||
const GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event == event)
|
||||
if (map->gdk_event->event_type == event->event_type &&
|
||||
map->gdk_event->device == event->device &&
|
||||
map->gdk_event->time == event->time)
|
||||
return map->nsevent;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,19 +68,10 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
&self->parent_instance.shadow_left,
|
||||
&self->parent_instance.shadow_right,
|
||||
&self->parent_instance.shadow_top,
|
||||
&self->parent_instance.shadow_bottom);
|
||||
|
||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||
width,
|
||||
height,
|
||||
self->parent_instance.shadow_left,
|
||||
self->parent_instance.shadow_right,
|
||||
self->parent_instance.shadow_top,
|
||||
self->parent_instance.shadow_bottom,
|
||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
||||
monitor,
|
||||
&bounds,
|
||||
self->layout,
|
||||
|
||||
@@ -61,11 +61,6 @@ struct _GdkMacosSurface
|
||||
int height;
|
||||
} next_layout;
|
||||
|
||||
int shadow_top;
|
||||
int shadow_right;
|
||||
int shadow_bottom;
|
||||
int shadow_left;
|
||||
|
||||
cairo_rectangle_int_t next_frame;
|
||||
|
||||
gint64 pending_frame_counter;
|
||||
@@ -91,16 +86,6 @@ CGDirectDisplayID _gdk_macos_surface_get_screen_id (GdkMacosSurface
|
||||
const char *_gdk_macos_surface_get_title (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_set_title (GdkMacosSurface *self,
|
||||
const char *title);
|
||||
void _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
|
||||
int *top,
|
||||
int *right,
|
||||
int *bottom,
|
||||
int *left);
|
||||
void _gdk_macos_surface_set_shadow (GdkMacosSurface *self,
|
||||
int top,
|
||||
int right,
|
||||
int bottom,
|
||||
int left);
|
||||
gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
|
||||
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
|
||||
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);
|
||||
|
||||
@@ -56,14 +56,6 @@ enum {
|
||||
|
||||
static GParamSpec *properties [LAST_PROP];
|
||||
|
||||
static gboolean
|
||||
window_is_fullscreen (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
return ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_request_frame (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -244,32 +236,6 @@ gdk_macos_surface_get_scale (GdkSurface *surface)
|
||||
return [self->window backingScaleFactor];
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
|
||||
int top,
|
||||
int right,
|
||||
int bottom,
|
||||
int left)
|
||||
{
|
||||
GdkMacosSurface *self = (GdkMacosSurface *)surface;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->shadow_top == top &&
|
||||
self->shadow_right == right &&
|
||||
self->shadow_bottom == bottom &&
|
||||
self->shadow_left == left)
|
||||
return;
|
||||
|
||||
self->shadow_top = top;
|
||||
self->shadow_right = right;
|
||||
self->shadow_bottom = bottom;
|
||||
self->shadow_left = left;
|
||||
|
||||
if (top || right || bottom || left)
|
||||
[self->window setHasShadow:NO];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_surface_begin_frame (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -587,29 +553,6 @@ gdk_macos_surface_init (GdkMacosSurface *self)
|
||||
self->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_get_shadow (GdkMacosSurface *self,
|
||||
int *top,
|
||||
int *right,
|
||||
int *bottom,
|
||||
int *left)
|
||||
{
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (top)
|
||||
*top = self->shadow_top;
|
||||
|
||||
if (left)
|
||||
*left = self->shadow_left;
|
||||
|
||||
if (bottom)
|
||||
*bottom = self->shadow_bottom;
|
||||
|
||||
if (right)
|
||||
*right = self->shadow_right;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -758,7 +701,7 @@ _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self)
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
state = GDK_SURFACE (self)->state;
|
||||
is_fullscreen = window_is_fullscreen (self);
|
||||
is_fullscreen = ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
|
||||
was_fullscreen = (state & GDK_TOPLEVEL_STATE_FULLSCREEN) != 0;
|
||||
|
||||
if (is_fullscreen != was_fullscreen)
|
||||
@@ -1105,16 +1048,12 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
|
||||
|
||||
g_set_object (&child->best_monitor, best);
|
||||
|
||||
area.x = self->root_x + GDK_SURFACE (child)->x + child->shadow_left;
|
||||
area.y = self->root_y + GDK_SURFACE (child)->y + child->shadow_top;
|
||||
area.width = GDK_SURFACE (child)->width - child->shadow_left - child->shadow_right;
|
||||
area.height = GDK_SURFACE (child)->height - child->shadow_top - child->shadow_bottom;
|
||||
area.x = self->root_x + GDK_SURFACE (child)->x;
|
||||
area.y = self->root_y + GDK_SURFACE (child)->y;
|
||||
area.width = GDK_SURFACE (child)->width;
|
||||
area.height = GDK_SURFACE (child)->height;
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area);
|
||||
|
||||
area.x -= child->shadow_left;
|
||||
area.y -= child->shadow_top;
|
||||
|
||||
_gdk_macos_surface_move (child, area.x, area.y);
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL);
|
||||
}
|
||||
|
||||
@@ -96,37 +96,26 @@ _gdk_macos_toplevel_surface_unminimize (GdkMacosToplevelSurface *self)
|
||||
[window deminiaturize:window];
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel;
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)surface;
|
||||
GdkMacosSurface *macos_surface = (GdkMacosSurface *)surface;
|
||||
GdkToplevelSize size;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
int bounds_width, bounds_height;
|
||||
int width, height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
NSWindowStyleMask style_mask;
|
||||
gboolean maximize;
|
||||
gboolean fullscreen;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
|
||||
|
||||
if (layout != self->layout)
|
||||
{
|
||||
g_clear_pointer (&self->layout, gdk_toplevel_layout_unref);
|
||||
self->layout = gdk_toplevel_layout_copy (layout);
|
||||
}
|
||||
if (!GDK_MACOS_SURFACE (surface)->geometry_dirty)
|
||||
return FALSE;
|
||||
|
||||
_gdk_macos_toplevel_surface_attach_to_parent (self);
|
||||
|
||||
style_mask = [nswindow styleMask];
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = FALSE;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
|
||||
if (monitor)
|
||||
@@ -144,59 +133,121 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (toplevel, &size);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
|
||||
if (gdk_toplevel_layout_get_resizable (layout))
|
||||
if (self->layout != NULL &&
|
||||
gdk_toplevel_layout_get_resizable (self->layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
|
||||
/* Only set 'Resizable' mask to get native resize zones if the window is
|
||||
* titled, otherwise we do this internally for CSD and do not need
|
||||
* NSWindow to do it for us. Additionally, it can mess things up when
|
||||
* doing a window resize since it can cause mouseDown to get passed
|
||||
* through to the next window.
|
||||
*/
|
||||
if ((style_mask & NSWindowStyleMaskTitled) != 0)
|
||||
style_mask |= NSWindowStyleMaskResizable;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = width;
|
||||
geometry.max_height = geometry.min_height = height;
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
|
||||
|
||||
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED) ||
|
||||
[macos_surface->window inLiveResize])
|
||||
return FALSE;
|
||||
|
||||
/* If we delayed a user resize until the beginning of the frame,
|
||||
* apply it now so we can start processing updates for it.
|
||||
*/
|
||||
if (macos_surface->next_layout.width > 0 &&
|
||||
macos_surface->next_layout.height > 0)
|
||||
{
|
||||
int root_x = macos_surface->next_layout.root_x;
|
||||
int root_y = macos_surface->next_layout.root_y;
|
||||
int width = macos_surface->next_layout.width;
|
||||
int height = macos_surface->next_layout.height;
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
width, height,
|
||||
&width, &height);
|
||||
|
||||
macos_surface->next_layout.width = 0;
|
||||
macos_surface->next_layout.height = 0;
|
||||
|
||||
_gdk_macos_surface_move_resize (macos_surface,
|
||||
root_x, root_y,
|
||||
width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if ((size.width != self->last_computed_width ||
|
||||
size.height != self->last_computed_height) &&
|
||||
(size.width != surface->width ||
|
||||
size.height != surface->height))
|
||||
{
|
||||
self->last_computed_width = size.width;
|
||||
self->last_computed_height = size.height;
|
||||
|
||||
_gdk_macos_surface_resize (macos_surface, size.width, size.height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)toplevel;
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
NSWindowStyleMask style_mask;
|
||||
gboolean maximize;
|
||||
gboolean fullscreen;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
|
||||
|
||||
if (layout != self->layout)
|
||||
{
|
||||
g_clear_pointer (&self->layout, gdk_toplevel_layout_unref);
|
||||
self->layout = gdk_toplevel_layout_copy (layout);
|
||||
}
|
||||
|
||||
_gdk_macos_toplevel_surface_attach_to_parent (self);
|
||||
_gdk_macos_toplevel_surface_compute_size (surface);
|
||||
|
||||
/* Only set 'Resizable' mask to get native resize zones if the window is
|
||||
* titled, otherwise we do this internally for CSD and do not need
|
||||
* NSWindow to do it for us. Additionally, it can mess things up when
|
||||
* doing a window resize since it can cause mouseDown to get passed
|
||||
* through to the next window.
|
||||
*/
|
||||
style_mask = [nswindow styleMask];
|
||||
if (gdk_toplevel_layout_get_resizable (layout) &&
|
||||
(style_mask & NSWindowStyleMaskTitled) != 0)
|
||||
style_mask |= NSWindowStyleMaskResizable;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskResizable;
|
||||
|
||||
if (style_mask != [nswindow styleMask])
|
||||
[nswindow setStyleMask:style_mask];
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
|
||||
GDK_DEBUG (MISC, "Resizing \"%s\" to %dx%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
width, height);
|
||||
|
||||
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
|
||||
|
||||
/* Maximized state */
|
||||
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
|
||||
{
|
||||
@@ -378,125 +429,6 @@ _gdk_macos_toplevel_surface_hide (GdkSurface *surface)
|
||||
GDK_SURFACE_CLASS (_gdk_macos_toplevel_surface_parent_class)->hide (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)surface;
|
||||
GdkMacosSurface *macos_surface = (GdkMacosSurface *)surface;
|
||||
GdkToplevelSize size;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
int bounds_width, bounds_height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
|
||||
if (!GDK_MACOS_SURFACE (surface)->geometry_dirty)
|
||||
return FALSE;
|
||||
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = FALSE;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle workarea;
|
||||
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
bounds_width = workarea.width;
|
||||
bounds_height = workarea.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
|
||||
if (self->layout != NULL &&
|
||||
gdk_toplevel_layout_get_resizable (self->layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (macos_surface,
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (macos_surface, &geometry, mask);
|
||||
|
||||
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED) ||
|
||||
[macos_surface->window inLiveResize])
|
||||
return FALSE;
|
||||
|
||||
/* If we delayed a user resize until the beginning of the frame,
|
||||
* apply it now so we can start processing updates for it.
|
||||
*/
|
||||
if (macos_surface->next_layout.width > 0 &&
|
||||
macos_surface->next_layout.height > 0)
|
||||
{
|
||||
int root_x = macos_surface->next_layout.root_x;
|
||||
int root_y = macos_surface->next_layout.root_y;
|
||||
int width = macos_surface->next_layout.width;
|
||||
int height = macos_surface->next_layout.height;
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
width, height,
|
||||
&width, &height);
|
||||
|
||||
macos_surface->next_layout.width = 0;
|
||||
macos_surface->next_layout.height = 0;
|
||||
|
||||
_gdk_macos_surface_move_resize (macos_surface,
|
||||
root_x, root_y,
|
||||
width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if ((size.width != self->last_computed_width ||
|
||||
size.height != self->last_computed_height) &&
|
||||
(size.width != surface->width ||
|
||||
size.height != surface->height))
|
||||
{
|
||||
self->last_computed_width = size.width;
|
||||
self->last_computed_height = size.height;
|
||||
|
||||
_gdk_macos_surface_resize (macos_surface, size.width, size.height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_request_layout (GdkSurface *surface)
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ static const struct {
|
||||
{ "move", "dnd-move" },
|
||||
{ "no-drop", "dnd-none" },
|
||||
{ "dnd-ask", "dnd-copy" }, /* not CSS, but we want to guarantee it anyway */
|
||||
{ "dnd-move", "default" },
|
||||
{ "not-allowed", "crossed_circle" },
|
||||
{ "grab", "hand2" },
|
||||
{ "grabbing", "hand2" },
|
||||
@@ -154,15 +155,19 @@ static const struct wl_buffer_listener buffer_listener = {
|
||||
struct wl_buffer *
|
||||
_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
guint desired_scale,
|
||||
double desired_scale,
|
||||
gboolean use_viewporter,
|
||||
guint image_index,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
int *width,
|
||||
int *height,
|
||||
int *scale)
|
||||
double *scale)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int desired_scale_factor;
|
||||
|
||||
desired_scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
{
|
||||
@@ -173,7 +178,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale,
|
||||
desired_scale_factor,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c && c->image_count > 0)
|
||||
{
|
||||
@@ -190,7 +195,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale;
|
||||
cursor_scale = desired_scale_factor;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
@@ -210,7 +215,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (gdk_cursor_get_texture (cursor))
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
@@ -225,7 +230,7 @@ from_texture:
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||
|
||||
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
@@ -249,11 +254,50 @@ from_texture:
|
||||
|
||||
return buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!use_viewporter)
|
||||
*scale = desired_scale_factor;
|
||||
else
|
||||
*scale = desired_scale;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor,
|
||||
display->cursor_theme_size,
|
||||
*scale,
|
||||
width,
|
||||
height,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
surface = gdk_wayland_display_create_shm_surface (display,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
|
||||
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
cairo_surface_mark_dirty (surface);
|
||||
|
||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||
wl_buffer_add_listener (buffer, &buffer_listener, surface);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
if (gdk_cursor_get_fallback (cursor))
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
|
||||
@@ -62,6 +62,7 @@ struct _GdkWaylandPointerData {
|
||||
uint32_t grab_time;
|
||||
|
||||
struct wl_surface *pointer_surface;
|
||||
struct wp_viewport *pointer_surface_viewport;
|
||||
guint cursor_is_default: 1;
|
||||
GdkCursor *cursor;
|
||||
guint cursor_timeout_id;
|
||||
@@ -69,7 +70,7 @@ struct _GdkWaylandPointerData {
|
||||
guint cursor_image_delay;
|
||||
guint touchpad_event_sequence;
|
||||
|
||||
guint current_output_scale;
|
||||
double current_output_scale;
|
||||
GSList *pointer_surface_outputs;
|
||||
|
||||
/* Accumulated event data for a pointer frame */
|
||||
@@ -182,6 +183,8 @@ struct _GdkWaylandSeat
|
||||
GdkWaylandPointerData pointer_info;
|
||||
GdkWaylandPointerData touch_info;
|
||||
|
||||
uint32_t latest_touch_down_serial;
|
||||
|
||||
GdkModifierType key_modifiers;
|
||||
GdkSurface *keyboard_focus;
|
||||
GdkSurface *grab_surface;
|
||||
|
||||
@@ -260,18 +260,25 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
GdkWaylandPointerData *pointer =
|
||||
gdk_wayland_device_get_pointer (wayland_device);
|
||||
struct wl_buffer *buffer;
|
||||
int x, y, w, h, scale;
|
||||
int x, y, w, h;
|
||||
double scale;
|
||||
guint next_image_index, next_image_delay;
|
||||
gboolean retval = G_SOURCE_REMOVE;
|
||||
GdkWaylandTabletData *tablet;
|
||||
gboolean use_viewport;
|
||||
|
||||
tablet = gdk_wayland_seat_find_tablet (seat, device);
|
||||
|
||||
use_viewport = pointer->pointer_surface_viewport != NULL;
|
||||
if (g_getenv ("NO_POINTER_VIEWPORT"))
|
||||
use_viewport = FALSE;
|
||||
|
||||
if (pointer->cursor)
|
||||
{
|
||||
buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display),
|
||||
pointer->cursor,
|
||||
pointer->current_output_scale,
|
||||
use_viewport,
|
||||
pointer->cursor_image_index,
|
||||
&x, &y, &w, &h, &scale);
|
||||
}
|
||||
@@ -310,7 +317,17 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
if (buffer)
|
||||
{
|
||||
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
|
||||
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
|
||||
if (use_viewport)
|
||||
{
|
||||
wp_viewport_set_source (pointer->pointer_surface_viewport,
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_int (0),
|
||||
wl_fixed_from_double (w * scale),
|
||||
wl_fixed_from_double (h * scale));
|
||||
wp_viewport_set_destination (pointer->pointer_surface_viewport, w, h);
|
||||
}
|
||||
else if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
|
||||
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
|
||||
wl_surface_damage (pointer->pointer_surface, 0, 0, w, h);
|
||||
wl_surface_commit (pointer->pointer_surface);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||
#include <wayland/server-decoration-client-protocol.h>
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
#include "wm-button-layout-translation.h"
|
||||
|
||||
@@ -95,7 +96,6 @@
|
||||
#define GTK_SHELL1_VERSION 5
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
#define XDG_ACTIVATION_VERSION 1
|
||||
#define OUTPUT_VERSION 3
|
||||
|
||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||
@@ -585,21 +585,25 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
display_wayland->xdg_activation =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&xdg_activation_v1_interface,
|
||||
MIN (version, XDG_ACTIVATION_VERSION));
|
||||
&xdg_activation_v1_interface, 1);
|
||||
}
|
||||
else if (strcmp (interface, "wp_fractional_scale_manager_v1") == 0)
|
||||
{
|
||||
display_wayland->fractional_scale =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_fractional_scale_manager_v1_interface,
|
||||
MIN (version, 1));
|
||||
&wp_fractional_scale_manager_v1_interface, 1);
|
||||
}
|
||||
else if (strcmp (interface, "wp_viewporter") == 0)
|
||||
{
|
||||
display_wayland->viewporter =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_viewporter_interface,
|
||||
&wp_viewporter_interface, 1);
|
||||
}
|
||||
else if (strcmp (interface, "wp_presentation") == 0)
|
||||
{
|
||||
display_wayland->presentation =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_presentation_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
@@ -700,7 +704,8 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
process_on_globals_closures (display_wayland);
|
||||
|
||||
/* Wait for initializing to complete. This means waiting for all
|
||||
* asynchronous roundtrips that were triggered during initial roundtrip. */
|
||||
* asynchronous roundtrips that were triggered during initial roundtrip.
|
||||
*/
|
||||
while (display_wayland->async_roundtrips != NULL)
|
||||
{
|
||||
if (wl_display_dispatch (display_wayland->wl_display) < 0)
|
||||
@@ -710,6 +715,18 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that we got all the required globals */
|
||||
if (display_wayland->compositor == NULL ||
|
||||
display_wayland->shm == NULL ||
|
||||
display_wayland->data_device_manager == NULL)
|
||||
{
|
||||
g_warning ("The Wayland compositor does not provide one or more of the required interfaces, "
|
||||
"not using Wayland display");
|
||||
g_object_unref (display);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (display_wayland->xdg_wm_base_id)
|
||||
{
|
||||
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL;
|
||||
@@ -799,6 +816,7 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||
if (display_wayland->linux_dmabuf_formats)
|
||||
@@ -1996,9 +2014,10 @@ init_settings (GdkDisplay *display)
|
||||
|
||||
g_variant_get (ret, "(a{sa{sv}})", &iter);
|
||||
|
||||
if (g_variant_n_children (ret) == 0)
|
||||
if (g_variant_iter_n_children (iter) == 0)
|
||||
{
|
||||
g_debug ("Received no portal settings");
|
||||
g_clear_pointer (&iter, g_variant_iter_free);
|
||||
g_clear_pointer (&ret, g_variant_unref);
|
||||
|
||||
goto fallback;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -125,6 +126,7 @@ struct _GdkWaylandDisplay
|
||||
struct xdg_activation_v1 *xdg_activation;
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_presentation *presentation;
|
||||
|
||||
GList *async_roundtrips;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||
#include <gdk/wayland/gdkseat-wayland.h>
|
||||
#include <gdk/wayland/gdkwaylandpresentationtime-private.h>
|
||||
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
@@ -115,13 +116,14 @@ void gdk_wayland_display_system_bell (GdkDisplay *display,
|
||||
|
||||
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
guint desired_scale,
|
||||
double desired_scale,
|
||||
gboolean use_viewporter,
|
||||
guint image_index,
|
||||
int *hotspot_x,
|
||||
int *hotspot_y,
|
||||
int *w,
|
||||
int *h,
|
||||
int *scale);
|
||||
double *scale);
|
||||
guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
GdkCursor *cursor,
|
||||
guint scale,
|
||||
|
||||
@@ -1640,6 +1640,7 @@ touch_handle_down (void *data,
|
||||
touch->x = wl_fixed_to_double (x);
|
||||
touch->y = wl_fixed_to_double (y);
|
||||
touch->touch_down_serial = serial;
|
||||
seat->latest_touch_down_serial = serial;
|
||||
|
||||
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
@@ -3766,8 +3767,7 @@ pointer_surface_update_scale (GdkDevice *device)
|
||||
GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
|
||||
GdkWaylandPointerData *pointer =
|
||||
gdk_wayland_device_get_pointer (wayland_device);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
guint32 scale;
|
||||
double scale;
|
||||
GSList *l;
|
||||
|
||||
if (wl_surface_get_version (pointer->pointer_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
|
||||
@@ -3782,8 +3782,8 @@ pointer_surface_update_scale (GdkDevice *device)
|
||||
scale = 1;
|
||||
for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next)
|
||||
{
|
||||
guint32 output_scale = gdk_wayland_display_get_output_scale (display_wayland, l->data);
|
||||
scale = MAX (scale, output_scale);
|
||||
GdkMonitor *monitor = gdk_wayland_display_get_monitor_for_output (seat->display, l->data);
|
||||
scale = MAX (scale, gdk_monitor_get_scale (monitor));
|
||||
}
|
||||
|
||||
if (pointer->current_output_scale == scale)
|
||||
@@ -3878,6 +3878,7 @@ gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
|
||||
g_clear_object (&pointer->cursor);
|
||||
wl_surface_destroy (pointer->pointer_surface);
|
||||
g_slist_free (pointer->pointer_surface_outputs);
|
||||
g_clear_pointer (&pointer->pointer_surface_viewport, wp_viewport_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4241,6 +4242,9 @@ init_pointer_data (GdkWaylandPointerData *pointer_data,
|
||||
wl_surface_add_listener (pointer_data->pointer_surface,
|
||||
&pointer_surface_listener,
|
||||
logical_device);
|
||||
|
||||
if (display_wayland->viewporter)
|
||||
pointer_data->pointer_surface_viewport = wp_viewporter_get_viewport (display_wayland->viewporter, pointer_data->pointer_surface);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4390,15 +4394,24 @@ _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
||||
serial = tablet->pointer_info.press_serial;
|
||||
}
|
||||
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
||||
if (g_hash_table_size (seat->touches) > 0)
|
||||
{
|
||||
if (touch->touch_down_serial > serial)
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
|
||||
{
|
||||
if (sequence)
|
||||
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||
serial = touch->touch_down_serial;
|
||||
if (touch->touch_down_serial > serial)
|
||||
{
|
||||
if (sequence)
|
||||
*sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||
serial = touch->touch_down_serial;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (seat->latest_touch_down_serial > serial)
|
||||
serial = seat->latest_touch_down_serial;
|
||||
}
|
||||
|
||||
return serial;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
|
||||
#include "wayland-client-protocol.h"
|
||||
|
||||
typedef struct _GdkWaylandSubsurface GdkWaylandSubsurface;
|
||||
typedef struct _GdkWaylandSubsurfaceClass GdkWaylandSubsurfaceClass;
|
||||
@@ -23,6 +24,8 @@ struct _GdkWaylandSubsurface
|
||||
GdkTexture *texture;
|
||||
cairo_rectangle_int_t dest;
|
||||
graphene_rect_t source;
|
||||
enum wl_output_transform transform;
|
||||
gboolean lightbox;
|
||||
|
||||
struct wl_region *opaque_region;
|
||||
|
||||
|
||||
@@ -149,12 +149,26 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline enum wl_output_transform
|
||||
gdk_texture_transform_to_wl (GdkTextureTransform transform)
|
||||
{
|
||||
return (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
static inline GdkTextureTransform
|
||||
wl_output_transform_to_gdk (enum wl_output_transform transform)
|
||||
{
|
||||
return (GdkTextureTransform) transform;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean above,
|
||||
gboolean lightbox,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
@@ -188,6 +202,9 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
|
||||
self->transform = gdk_texture_transform_to_wl (transform);
|
||||
self->lightbox = lightbox;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
device_rect.origin.x = dest->origin.x * scale;
|
||||
@@ -302,6 +319,7 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
|
||||
if (result)
|
||||
{
|
||||
wl_surface_set_buffer_transform (self->surface, self->transform);
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
wp_viewport_set_source (self->viewport,
|
||||
@@ -406,6 +424,22 @@ gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
source->size.height = self->source.size.height;
|
||||
}
|
||||
|
||||
static GdkTextureTransform
|
||||
gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return wl_output_transform_to_gdk (self->transform);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_get_lightbox (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return self->lightbox;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
{
|
||||
@@ -419,6 +453,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
|
||||
subsurface_class->get_lightbox = gdk_wayland_subsurface_get_lightbox;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -466,9 +502,9 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
|
||||
GdkWaylandSubsurface *sub;
|
||||
struct wl_region *region;
|
||||
|
||||
if (disp->viewporter == NULL)
|
||||
if (disp->subcompositor == NULL || disp->viewporter == NULL)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without viewporter");
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without subcompositor and viewporter");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ struct _GdkWaylandSurface
|
||||
struct wl_event_queue *event_queue;
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
GdkWaylandPresentationTime *presentation_time;
|
||||
|
||||
unsigned int initial_configure_received : 1;
|
||||
unsigned int has_uncommitted_ack_configure : 1;
|
||||
unsigned int has_pending_subsurface_commits : 1;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "gdktoplevel-wayland-private.h"
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -201,17 +202,23 @@ get_egl_window_size (GdkSurface *surface,
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_NO_FRACTIONAL))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window", gdk_fractional_scale_to_int (&impl->scale));
|
||||
|
||||
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
|
||||
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window (%d %d => %d %d)",
|
||||
gdk_fractional_scale_to_int (&impl->scale),
|
||||
surface->width, surface->height,
|
||||
*width, *height);
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
|
||||
|
||||
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
|
||||
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window (%d %d => %d %d)",
|
||||
gdk_fractional_scale_to_double (&impl->scale),
|
||||
surface->width, surface->height,
|
||||
*width, *height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +271,20 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
||||
_gdk_surface_update_size (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_clear_frame_callback (GdkWaylandSurface *self)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (self);
|
||||
|
||||
g_clear_pointer (&self->frame_callback, wl_callback_destroy);
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
gdk_wayland_subsurface_clear_frame_callback (subsurface);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
uint32_t time)
|
||||
@@ -277,13 +298,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
|
||||
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
|
||||
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
gdk_wayland_subsurface_clear_frame_callback (subsurface);
|
||||
}
|
||||
gdk_wayland_surface_clear_frame_callback (impl);
|
||||
|
||||
GDK_WAYLAND_SURFACE_GET_CLASS (impl)->handle_frame (impl);
|
||||
|
||||
@@ -397,6 +412,17 @@ gdk_wayland_surface_request_frame (GdkSurface *surface)
|
||||
wl_proxy_set_queue ((struct wl_proxy *) self->frame_callback, NULL);
|
||||
wl_callback_add_listener (self->frame_callback, &frame_listener, surface);
|
||||
|
||||
if (self->presentation_time == NULL)
|
||||
{
|
||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
self->presentation_time = gdk_wayland_presentation_time_new (wayland_display);
|
||||
}
|
||||
|
||||
gdk_wayland_presentation_time_track (self->presentation_time,
|
||||
clock,
|
||||
self->display_server.wl_surface,
|
||||
gdk_frame_clock_get_frame_counter (clock));
|
||||
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
@@ -1042,7 +1068,8 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
|
||||
unmap_popups_for_surface (surface);
|
||||
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
g_clear_pointer (&impl->presentation_time, gdk_wayland_presentation_time_free);
|
||||
gdk_wayland_surface_clear_frame_callback (impl);
|
||||
if (impl->awaiting_frame_frozen)
|
||||
{
|
||||
impl->awaiting_frame_frozen = FALSE;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "gdktoplevelprivate.h"
|
||||
#include "gdkdevice-wayland-private.h"
|
||||
|
||||
#include <wayland/presentation-time-client-protocol.h>
|
||||
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
|
||||
|
||||
@@ -122,6 +123,8 @@ struct _GdkWaylandToplevel
|
||||
|
||||
struct wl_output *initial_fullscreen_output;
|
||||
|
||||
struct wp_presentation_feedback *feedback;
|
||||
|
||||
struct {
|
||||
GdkToplevelState unset_flags;
|
||||
GdkToplevelState set_flags;
|
||||
@@ -458,6 +461,49 @@ gdk_wayland_toplevel_compute_size (GdkSurface *surface)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_per_edge_tiling_info (GdkToplevelState state)
|
||||
{
|
||||
return state & (GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED);
|
||||
}
|
||||
|
||||
static GdkToplevelState
|
||||
infer_edge_constraints (GdkToplevelState state)
|
||||
{
|
||||
if (state & (GDK_TOPLEVEL_STATE_MAXIMIZED | GDK_TOPLEVEL_STATE_FULLSCREEN))
|
||||
return state;
|
||||
|
||||
if (!(state & GDK_TOPLEVEL_STATE_TILED) || !has_per_edge_tiling_info (state))
|
||||
return state |
|
||||
GDK_TOPLEVEL_STATE_TOP_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE |
|
||||
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE;
|
||||
|
||||
if (!(state & GDK_TOPLEVEL_STATE_TOP_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_TOP_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_RIGHT_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_BOTTOM_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE;
|
||||
if (!(state & GDK_TOPLEVEL_STATE_LEFT_TILED))
|
||||
state |= GDK_TOPLEVEL_STATE_LEFT_RESIZABLE;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
supports_native_edge_constraints (GdkWaylandToplevel*toplevel)
|
||||
{
|
||||
struct gtk_surface1 *gtk_surface = toplevel->display_server.gtk_surface;
|
||||
if (!gtk_surface)
|
||||
return FALSE;
|
||||
return gtk_surface1_get_version (gtk_surface) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_toplevel_handle_configure (GdkWaylandSurface *wayland_surface)
|
||||
{
|
||||
@@ -475,6 +521,9 @@ gdk_wayland_toplevel_handle_configure (GdkWaylandSurface *wayland_surface)
|
||||
new_state = wayland_toplevel->pending.state;
|
||||
wayland_toplevel->pending.state = 0;
|
||||
|
||||
if (!supports_native_edge_constraints (wayland_toplevel))
|
||||
new_state = infer_edge_constraints (new_state);
|
||||
|
||||
is_resizing = wayland_toplevel->pending.is_resizing;
|
||||
wayland_toplevel->pending.is_resizing = FALSE;
|
||||
|
||||
@@ -1990,13 +2039,7 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
{
|
||||
GdkWaylandToplevel *wayland_toplevel = GDK_WAYLAND_TOPLEVEL (toplevel);
|
||||
struct gtk_surface1 *gtk_surface = wayland_toplevel->display_server.gtk_surface;
|
||||
|
||||
if (!gtk_surface)
|
||||
return FALSE;
|
||||
|
||||
return gtk_surface1_get_version (gtk_surface) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2667,7 +2710,7 @@ gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE);
|
||||
|
||||
if (!display_wayland->xdg_importer)
|
||||
if (!display_wayland->xdg_importer && !display_wayland->xdg_importer_v2)
|
||||
{
|
||||
g_warning ("Server is missing xdg_foreign support");
|
||||
return FALSE;
|
||||
|
||||
19
gdk/wayland/gdkwaylandpresentationtime-private.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdkframeclock.h>
|
||||
#include <gdk/wayland/gdkdisplay-wayland.h>
|
||||
#include <gdk/wayland/gdksurface-wayland.h>
|
||||
#include <gdk/wayland/gdkwaylanddisplay.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkWaylandPresentationTime GdkWaylandPresentationTime;
|
||||
|
||||
GdkWaylandPresentationTime *gdk_wayland_presentation_time_new (GdkWaylandDisplay *display);
|
||||
void gdk_wayland_presentation_time_track (GdkWaylandPresentationTime *self,
|
||||
GdkFrameClock *frame_clock,
|
||||
struct wl_surface *surface,
|
||||
gint64 frame_number);
|
||||
void gdk_wayland_presentation_time_free (GdkWaylandPresentationTime *self);
|
||||
|
||||
G_END_DECLS
|
||||
152
gdk/wayland/gdkwaylandpresentationtime.c
Normal file
@@ -0,0 +1,152 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdkframeclockprivate.h>
|
||||
|
||||
#include "gdkwaylandpresentationtime-private.h"
|
||||
|
||||
typedef struct _GdkWaylandPresentationFrame
|
||||
{
|
||||
GdkWaylandPresentationTime *self;
|
||||
struct wp_presentation_feedback *feedback;
|
||||
GdkFrameClock *frame_clock;
|
||||
gint64 frame_number;
|
||||
} GdkWaylandPresentationFrame;
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_frame_free (GdkWaylandPresentationFrame *frame)
|
||||
{
|
||||
g_clear_pointer (&frame->feedback, wp_presentation_feedback_destroy);
|
||||
g_clear_object (&frame->frame_clock);
|
||||
frame->self = NULL;
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
struct _GdkWaylandPresentationTime
|
||||
{
|
||||
GdkWaylandDisplay *display;
|
||||
GPtrArray *frames;
|
||||
};
|
||||
|
||||
GdkWaylandPresentationTime *
|
||||
gdk_wayland_presentation_time_new (GdkWaylandDisplay *display)
|
||||
{
|
||||
GdkWaylandPresentationTime *self;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
|
||||
|
||||
self = g_new0 (GdkWaylandPresentationTime, 1);
|
||||
self->display = g_object_ref (display);
|
||||
self->frames = g_ptr_array_new_with_free_func ((GDestroyNotify)gdk_wayland_presentation_frame_free);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_presentation_time_free (GdkWaylandPresentationTime *self)
|
||||
{
|
||||
g_clear_pointer (&self->frames, g_ptr_array_unref);
|
||||
g_clear_object (&self->display);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
static gint64
|
||||
time_from_wayland (uint32_t tv_sec_hi,
|
||||
uint32_t tv_sec_lo,
|
||||
uint32_t tv_nsec)
|
||||
{
|
||||
guint64 t = tv_sec_hi;
|
||||
t <<= 32;
|
||||
t |= tv_sec_lo;
|
||||
t *= G_USEC_PER_SEC;
|
||||
t += tv_nsec / 1000L;
|
||||
return (gint64)t;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_sync_output (void *data,
|
||||
struct wp_presentation_feedback *feedback,
|
||||
struct wl_output *output)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_presented (void *data,
|
||||
struct wp_presentation_feedback *feedback,
|
||||
uint32_t tv_sec_hi,
|
||||
uint32_t tv_sec_lo,
|
||||
uint32_t tv_nsec,
|
||||
uint32_t refresh,
|
||||
uint32_t seq_hi,
|
||||
uint32_t seq_lo,
|
||||
uint32_t flags)
|
||||
{
|
||||
GdkWaylandPresentationFrame *frame = data;
|
||||
GdkWaylandPresentationTime *self;
|
||||
GdkFrameTimings *timings;
|
||||
guint pos;
|
||||
|
||||
g_assert (frame != NULL);
|
||||
g_assert (frame->self != NULL);
|
||||
|
||||
self = frame->self;
|
||||
|
||||
if ((timings = gdk_frame_clock_get_timings (frame->frame_clock, frame->frame_number)))
|
||||
{
|
||||
timings->presentation_time = time_from_wayland (tv_sec_hi, tv_sec_lo, tv_nsec);
|
||||
timings->complete = TRUE;
|
||||
}
|
||||
|
||||
if (g_ptr_array_find (self->frames, frame, &pos))
|
||||
g_ptr_array_remove_index_fast (self->frames, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_presentation_feedback_discarded (void *data,
|
||||
struct wp_presentation_feedback *feedback)
|
||||
{
|
||||
GdkWaylandPresentationFrame *frame = data;
|
||||
guint pos;
|
||||
|
||||
g_assert (frame != NULL);
|
||||
g_assert (frame->self != NULL);
|
||||
|
||||
if (g_ptr_array_find (frame->self->frames, frame, &pos))
|
||||
g_ptr_array_remove_index_fast (frame->self->frames, pos);
|
||||
}
|
||||
|
||||
static const struct wp_presentation_feedback_listener gdk_wayland_presentation_feedback_listener = {
|
||||
gdk_wayland_presentation_feedback_sync_output,
|
||||
gdk_wayland_presentation_feedback_presented,
|
||||
gdk_wayland_presentation_feedback_discarded,
|
||||
};
|
||||
|
||||
void
|
||||
gdk_wayland_presentation_time_track (GdkWaylandPresentationTime *self,
|
||||
GdkFrameClock *frame_clock,
|
||||
struct wl_surface *surface,
|
||||
gint64 frame_number)
|
||||
{
|
||||
struct wp_presentation_feedback *feedback;
|
||||
GdkWaylandPresentationFrame *frame;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (surface != NULL);
|
||||
|
||||
if (self->display->presentation == NULL)
|
||||
return;
|
||||
|
||||
if (!(feedback = wp_presentation_feedback (self->display->presentation, surface)))
|
||||
return;
|
||||
|
||||
frame = g_new0 (GdkWaylandPresentationFrame, 1);
|
||||
frame->self = self;
|
||||
frame->frame_clock = g_object_ref (frame_clock);
|
||||
frame->frame_number = frame_number;
|
||||
frame->feedback = g_steal_pointer (&feedback);
|
||||
|
||||
g_ptr_array_add (self->frames, frame);
|
||||
|
||||
wp_presentation_feedback_add_listener (frame->feedback,
|
||||
&gdk_wayland_presentation_feedback_listener,
|
||||
frame);
|
||||
}
|
||||
@@ -22,6 +22,7 @@ gdk_wayland_sources = files([
|
||||
'gdktoplevel-wayland.c',
|
||||
'gdkpopup-wayland.c',
|
||||
'gdkvulkancontext-wayland.c',
|
||||
'gdkwaylandpresentationtime.c',
|
||||
'wm-button-layout-translation.c',
|
||||
])
|
||||
|
||||
@@ -69,6 +70,7 @@ proto_sources = [
|
||||
['xdg-activation', 'staging', 'v1', ],
|
||||
['fractional-scale', 'staging', 'v1', ],
|
||||
['linux-dmabuf', 'unstable', 'v1', ],
|
||||
['presentation-time', 'stable', 'v1', ],
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkwin32.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
|
||||
#include "gdkdisplay-win32.h"
|
||||
|
||||
@@ -1481,6 +1482,7 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkWin32HCursor *win32hcursor;
|
||||
const char *cursor_name;
|
||||
GdkTexture *texture;
|
||||
GdkCursor *fallback;
|
||||
|
||||
g_return_val_if_fail (cursor != NULL, NULL);
|
||||
@@ -1494,14 +1496,32 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
|
||||
return win32hcursor;
|
||||
|
||||
cursor_name = gdk_cursor_get_name (cursor);
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
|
||||
if (cursor_name)
|
||||
win32hcursor = gdk_win32hcursor_create_for_name (display, cursor_name);
|
||||
else
|
||||
else if (texture)
|
||||
win32hcursor = gdk_win32hcursor_create_for_texture (display,
|
||||
gdk_cursor_get_texture (cursor),
|
||||
texture,
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
else
|
||||
{
|
||||
int size = display->cursor_theme_size;
|
||||
int width, height, hotspot_x, hotspot_y;
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
if (texture)
|
||||
{
|
||||
win32hcursor = gdk_win32hcursor_create_for_texture (display,
|
||||
texture,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (win32hcursor != NULL)
|
||||
{
|
||||
|
||||
@@ -1627,7 +1627,7 @@ _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
|
||||
has_any_decorations = FALSE;
|
||||
|
||||
if (style & (WS_BORDER | WS_THICKFRAME | WS_CAPTION |
|
||||
WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX))
|
||||
WS_SYSMENU | WS_MAXIMIZEBOX))
|
||||
has_any_decorations = TRUE;
|
||||
else
|
||||
GDK_NOTE (MISC, g_print ("Window %p (handle %p): has no decorations (style %lx)\n",
|
||||
@@ -1696,7 +1696,6 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
|
||||
update_single_bit (&new_style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,11 +370,33 @@ gdk_x11_display_get_xcursor (GdkDisplay *display,
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
xcursor = gdk_x11_cursor_create_for_name (display, gdk_cursor_get_name (cursor));
|
||||
else
|
||||
else if (gdk_cursor_get_texture (cursor))
|
||||
xcursor = gdk_x11_cursor_create_for_texture (display,
|
||||
gdk_cursor_get_texture (cursor),
|
||||
gdk_cursor_get_hotspot_x (cursor),
|
||||
gdk_cursor_get_hotspot_y (cursor));
|
||||
else
|
||||
{
|
||||
int size;
|
||||
GdkTexture *texture;
|
||||
int width, height;
|
||||
int hotspot_x, hotspot_y;
|
||||
|
||||
size = XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
|
||||
|
||||
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
|
||||
&width, &height,
|
||||
&hotspot_x, &hotspot_y);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
xcursor = gdk_x11_cursor_create_for_texture (display,
|
||||
texture,
|
||||
hotspot_x,
|
||||
hotspot_y);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (xcursor != None)
|
||||
{
|
||||
|
||||
@@ -3015,6 +3015,8 @@ gdk_x11_display_init_gl_backend (GdkX11Display *self,
|
||||
|
||||
self->egl_version = epoxy_egl_version (egl_display);
|
||||
|
||||
XFree (visinfo);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,12 +488,14 @@ gsk_gl_command_queue_new (GdkGLContext *context,
|
||||
int max_texture_size = atoi (g_getenv ("GSK_MAX_TEXTURE_SIZE"));
|
||||
if (max_texture_size == 0)
|
||||
{
|
||||
g_warning ("Failed to parse GSK_MAX_TEXTURE_SIZE");
|
||||
g_warning ("Failed to parse %s", "GSK_MAX_TEXTURE_SIZE");
|
||||
}
|
||||
else
|
||||
{
|
||||
max_texture_size = MAX (max_texture_size, 512);
|
||||
GSK_DEBUG(OPENGL, "Limiting max texture size to %d", max_texture_size);
|
||||
GSK_DEBUG (RENDERER,
|
||||
"Limiting texture size in the GL renderer to %d (via %s)",
|
||||
max_texture_size, "GSK_MAX_TEXTURE_SIZE");
|
||||
self->max_texture_size = MIN (self->max_texture_size, max_texture_size);
|
||||
}
|
||||
}
|
||||
@@ -1622,7 +1624,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
{
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data);
|
||||
}
|
||||
else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context))
|
||||
else if (stride % bpp == 0 && gdk_gl_context_has_feature (self->context, GDK_GL_FEATURE_UNPACK_SUBIMAGE))
|
||||
{
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
|
||||
|
||||
|
||||
@@ -1835,7 +1835,7 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
state = g_new0 (GskGLTextureState, 1);
|
||||
state->texture_id = texture_id;
|
||||
state->context = g_object_ref (self->command_queue->context);
|
||||
if (gdk_gl_context_has_sync (self->command_queue->context))
|
||||
if (gdk_gl_context_has_feature (self->command_queue->context, GDK_GL_FEATURE_SYNC))
|
||||
state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
g_hash_table_steal (self->textures, GUINT_TO_POINTER (texture_id));
|
||||
|
||||
@@ -194,7 +194,7 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (!gdk_gl_context_has_vertex_half_float (context))
|
||||
if (!gdk_gl_context_has_feature (context, GDK_GL_FEATURE_VERTEX_HALF_FLOAT))
|
||||
{
|
||||
int major, minor;
|
||||
|
||||
|
||||
@@ -52,8 +52,6 @@
|
||||
#include "ninesliceprivate.h"
|
||||
#include "fp16private.h"
|
||||
|
||||
#define ALLOW_OFFLOAD_FOR_ANY_TEXTURE 1
|
||||
|
||||
#define ORTHO_NEAR_PLANE -10000
|
||||
#define ORTHO_FAR_PLANE 10000
|
||||
#define MAX_GRADIENT_STOPS 6
|
||||
@@ -176,6 +174,8 @@ struct _GskGLRenderJob
|
||||
* looking at the format of the framebuffer we are rendering on.
|
||||
*/
|
||||
int target_format;
|
||||
|
||||
guint offscreen_count; /* if > 0, we're rendering to an offscreen */
|
||||
};
|
||||
|
||||
typedef struct _GskGLRenderOffscreen
|
||||
@@ -1235,7 +1235,7 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
|
||||
texture = gdk_texture_new_for_surface (surface);
|
||||
texture_id = gsk_gl_driver_load_texture (job->driver, texture, FALSE);
|
||||
|
||||
if (gdk_gl_context_has_debug (job->command_queue->context))
|
||||
if (gdk_gl_context_has_feature (job->command_queue->context, GDK_GL_FEATURE_DEBUG))
|
||||
gdk_gl_context_label_object_printf (job->command_queue->context, GL_TEXTURE, texture_id,
|
||||
"Fallback %s %d",
|
||||
g_type_name_from_instance ((GTypeInstance *) node),
|
||||
@@ -2532,7 +2532,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
|
||||
get_target_format (job, node),
|
||||
&render_target);
|
||||
|
||||
if (gdk_gl_context_has_debug (context))
|
||||
if (gdk_gl_context_has_feature (context, GDK_GL_FEATURE_DEBUG))
|
||||
{
|
||||
gdk_gl_context_label_object_printf (context,
|
||||
GL_TEXTURE,
|
||||
@@ -4002,9 +4002,15 @@ gsk_gl_render_job_visit_subsurface_node (GskGLRenderJob *job,
|
||||
{
|
||||
if (!gdk_subsurface_is_above_parent (subsurface))
|
||||
{
|
||||
/* Clear the area so we can see through */
|
||||
if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)))
|
||||
if (job->offscreen_count > 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_gl_context_get_display (job->command_queue->context), OFFLOAD, "Hiding subsurface %p in offscreen context", subsurface);
|
||||
gdk_subsurface_detach (subsurface);
|
||||
gsk_gl_render_job_visit_node (job, gsk_subsurface_node_get_child (node));
|
||||
}
|
||||
else if (gsk_gl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)))
|
||||
{
|
||||
/* Clear the area so we can see through */
|
||||
GskGLCommandBatch *batch;
|
||||
guint16 color[4];
|
||||
rgba_to_half (&(GdkRGBA){0,0,0,0}, color);
|
||||
@@ -4382,7 +4388,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
&render_target))
|
||||
g_assert_not_reached ();
|
||||
|
||||
if (gdk_gl_context_has_debug (job->command_queue->context))
|
||||
if (gdk_gl_context_has_feature (job->command_queue->context, GDK_GL_FEATURE_DEBUG))
|
||||
{
|
||||
gdk_gl_context_label_object_printf (job->command_queue->context,
|
||||
GL_TEXTURE,
|
||||
@@ -4422,8 +4428,12 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
reset_clip = TRUE;
|
||||
}
|
||||
|
||||
job->offscreen_count++;
|
||||
|
||||
gsk_gl_render_job_visit_node (job, node);
|
||||
|
||||
job->offscreen_count--;
|
||||
|
||||
if (reset_clip)
|
||||
gsk_gl_render_job_pop_clip (job);
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
#include "gskglbufferprivate.h"
|
||||
|
||||
/* {{{ GskGLBuffer */
|
||||
|
||||
struct _GskGLBuffer
|
||||
{
|
||||
GskGpuBuffer parent_instance;
|
||||
|
||||
GLenum target;
|
||||
GLuint buffer_id;
|
||||
GLenum access;
|
||||
guchar *data;
|
||||
};
|
||||
|
||||
@@ -19,7 +20,6 @@ gsk_gl_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
g_free (self->data);
|
||||
glDeleteBuffers (1, &self->buffer_id);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_buffer_parent_class)->finalize (object);
|
||||
@@ -34,13 +34,9 @@ gsk_gl_buffer_map (GskGpuBuffer *buffer)
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_buffer_unmap (GskGpuBuffer *buffer)
|
||||
gsk_gl_buffer_unmap (GskGpuBuffer *buffer,
|
||||
gsize used)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (buffer);
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferSubData (self->target, 0, gsk_gpu_buffer_get_size (buffer), self->data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -60,28 +56,6 @@ gsk_gl_buffer_init (GskGLBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_buffer_new (GLenum target,
|
||||
gsize size,
|
||||
GLenum access)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_BUFFER, NULL);
|
||||
|
||||
gsk_gpu_buffer_setup (GSK_GPU_BUFFER (self), size);
|
||||
|
||||
self->target = target;
|
||||
self->access = access;
|
||||
|
||||
glGenBuffers (1, &self->buffer_id);
|
||||
glBindBuffer (target, self->buffer_id);
|
||||
glBufferData (target, size, NULL, GL_STATIC_DRAW);
|
||||
self->data = malloc (size);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_buffer_bind (GskGLBuffer *self)
|
||||
{
|
||||
@@ -95,3 +69,140 @@ gsk_gl_buffer_bind_base (GskGLBuffer *self,
|
||||
glBindBufferBase (self->target, index, self->buffer_id);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_buffer_setup (GskGLBuffer *self,
|
||||
GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
gsk_gpu_buffer_setup (GSK_GPU_BUFFER (self), size);
|
||||
|
||||
self->target = target;
|
||||
|
||||
glGenBuffers (1, &self->buffer_id);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GskGLMappedBuffer */
|
||||
|
||||
struct _GskGLMappedBuffer
|
||||
{
|
||||
GskGLBuffer parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskGLMappedBuffer, gsk_gl_mapped_buffer, GSK_TYPE_GL_BUFFER)
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
glUnmapBuffer (self->target);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_mapped_buffer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_class_init (GskGLMappedBufferClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gsk_gl_mapped_buffer_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_mapped_buffer_init (GskGLMappedBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_mapped_buffer_new (GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_MAPPED_BUFFER, NULL);
|
||||
|
||||
gsk_gl_buffer_setup (self, target, size);
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferStorage (target,
|
||||
size,
|
||||
NULL,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
self->data = glMapBufferRange (target,
|
||||
0,
|
||||
size,
|
||||
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GskGLCopiedBuffer */
|
||||
|
||||
struct _GskGLCopiedBuffer
|
||||
{
|
||||
GskGLBuffer parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskGLCopiedBuffer, gsk_gl_copied_buffer, GSK_TYPE_GL_BUFFER)
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_finalize (GObject *object)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (object);
|
||||
|
||||
g_free (self->data);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_copied_buffer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_unmap (GskGpuBuffer *buffer,
|
||||
gsize used)
|
||||
{
|
||||
GskGLBuffer *self = GSK_GL_BUFFER (buffer);
|
||||
|
||||
if (used == 0)
|
||||
return;
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferSubData (self->target, 0, used, self->data);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_class_init (GskGLCopiedBufferClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GskGpuBufferClass *buffer_class = GSK_GPU_BUFFER_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gsk_gl_copied_buffer_finalize;
|
||||
|
||||
buffer_class->unmap = gsk_gl_copied_buffer_unmap;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_copied_buffer_init (GskGLCopiedBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskGpuBuffer *
|
||||
gsk_gl_copied_buffer_new (GLenum target,
|
||||
gsize size)
|
||||
{
|
||||
GskGLBuffer *self;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_COPIED_BUFFER, NULL);
|
||||
|
||||
gsk_gl_buffer_setup (self, target, size);
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
glBufferData (target, size, NULL, GL_STATIC_DRAW);
|
||||
self->data = malloc (size);
|
||||
|
||||
return GSK_GPU_BUFFER (self);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -7,12 +7,17 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_GL_BUFFER (gsk_gl_buffer_get_type ())
|
||||
#define GSK_TYPE_GL_MAPPED_BUFFER (gsk_gl_mapped_buffer_get_type ())
|
||||
#define GSK_TYPE_GL_COPIED_BUFFER (gsk_gl_copied_buffer_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GskGLBuffer, gsk_gl_buffer, GSK, GL_BUFFER, GskGpuBuffer)
|
||||
G_DECLARE_FINAL_TYPE (GskGLMappedBuffer, gsk_gl_mapped_buffer, GSK, GL_MAPPED_BUFFER, GskGLBuffer)
|
||||
G_DECLARE_FINAL_TYPE (GskGLCopiedBuffer, gsk_gl_copied_buffer, GSK, GL_COPIED_BUFFER, GskGLBuffer)
|
||||
|
||||
GskGpuBuffer * gsk_gl_buffer_new (GLenum target,
|
||||
gsize size,
|
||||
GLenum access);
|
||||
GskGpuBuffer * gsk_gl_mapped_buffer_new (GLenum target,
|
||||
gsize size);
|
||||
GskGpuBuffer * gsk_gl_copied_buffer_new (GLenum target,
|
||||
gsize size);
|
||||
|
||||
void gsk_gl_buffer_bind (GskGLBuffer *self);
|
||||
void gsk_gl_buffer_bind_base (GskGLBuffer *self,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "gdk/gdkdisplayprivate.h"
|
||||
#include "gdk/gdkglcontextprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
@@ -473,6 +474,7 @@ gsk_gl_device_load_program (GskGLDevice *self,
|
||||
guint n_external_textures,
|
||||
GError **error)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
GLuint vertex_shader_id, fragment_shader_id, program_id;
|
||||
GLint link_status;
|
||||
|
||||
@@ -527,6 +529,11 @@ gsk_gl_device_load_program (GskGLDevice *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
gdk_profiler_end_markf (begin_time,
|
||||
"Compile Program",
|
||||
"name=%s id=%u frag=%u vert=%u",
|
||||
op_class->shader_name, program_id, fragment_shader_id, vertex_shader_id);
|
||||
|
||||
return program_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ struct _GskGLFrame
|
||||
|
||||
GLuint globals_buffer_id;
|
||||
guint next_texture_slot;
|
||||
GLsync sync;
|
||||
|
||||
GHashTable *vaos;
|
||||
};
|
||||
@@ -34,7 +35,23 @@ G_DEFINE_TYPE (GskGLFrame, gsk_gl_frame, GSK_TYPE_GPU_FRAME)
|
||||
static gboolean
|
||||
gsk_gl_frame_is_busy (GskGpuFrame *frame)
|
||||
{
|
||||
return FALSE;
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (!self->sync)
|
||||
return FALSE;
|
||||
|
||||
return glClientWaitSync (self->sync, 0, 0) == GL_TIMEOUT_EXPIRED;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_frame_wait (GskGpuFrame *frame)
|
||||
{
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (!self->sync)
|
||||
return;
|
||||
|
||||
glClientWaitSync (self->sync, 0, G_MAXINT64);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -50,6 +67,12 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
|
||||
{
|
||||
GskGLFrame *self = GSK_GL_FRAME (frame);
|
||||
|
||||
if (self->sync)
|
||||
{
|
||||
glClientWaitSync (self->sync, 0, -1);
|
||||
g_clear_pointer (&self->sync, glDeleteSync);
|
||||
}
|
||||
|
||||
self->next_texture_slot = 0;
|
||||
|
||||
GSK_GPU_FRAME_CLASS (gsk_gl_frame_parent_class)->cleanup (frame);
|
||||
@@ -124,14 +147,22 @@ gsk_gl_frame_create_vertex_buffer (GskGpuFrame *frame,
|
||||
*/
|
||||
g_hash_table_remove_all (self->vaos);
|
||||
|
||||
return gsk_gl_buffer_new (GL_ARRAY_BUFFER, size, GL_WRITE_ONLY);
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE))
|
||||
return gsk_gl_mapped_buffer_new (GL_ARRAY_BUFFER, size);
|
||||
else
|
||||
return gsk_gl_copied_buffer_new (GL_ARRAY_BUFFER, size);
|
||||
}
|
||||
|
||||
static GskGpuBuffer *
|
||||
gsk_gl_frame_create_storage_buffer (GskGpuFrame *frame,
|
||||
gsize size)
|
||||
{
|
||||
return gsk_gl_buffer_new (GL_UNIFORM_BUFFER, size, GL_WRITE_ONLY);
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE))
|
||||
return gsk_gl_mapped_buffer_new (GL_UNIFORM_BUFFER, size);
|
||||
else
|
||||
return gsk_gl_copied_buffer_new (GL_UNIFORM_BUFFER, size);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -160,6 +191,10 @@ gsk_gl_frame_submit (GskGpuFrame *frame,
|
||||
{
|
||||
op = gsk_gpu_op_gl_command (op, frame, &state);
|
||||
}
|
||||
|
||||
if (gdk_gl_context_has_feature (GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame)),
|
||||
GDK_GL_FEATURE_SYNC))
|
||||
self->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -180,6 +215,7 @@ gsk_gl_frame_class_init (GskGLFrameClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gpu_frame_class->is_busy = gsk_gl_frame_is_busy;
|
||||
gpu_frame_class->wait = gsk_gl_frame_wait;
|
||||
gpu_frame_class->setup = gsk_gl_frame_setup;
|
||||
gpu_frame_class->cleanup = gsk_gl_frame_cleanup;
|
||||
gpu_frame_class->upload_texture = gsk_gl_frame_upload_texture;
|
||||
|
||||
@@ -17,23 +17,16 @@ struct _GskGpuBlendModeOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_blend_mode_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
gsk_gpu_blend_mode_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
{
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBlendmodeInstance *instance;
|
||||
GskGpuBlendmodeInstance *instance = (GskGpuBlendmodeInstance *) instance_;
|
||||
|
||||
instance = (GskGpuBlendmodeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blend-mode");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->top_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
@@ -41,7 +34,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBlendModeOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_blend_mode_op_print,
|
||||
gsk_gpu_shader_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -52,6 +45,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_blendmode_info,
|
||||
#endif
|
||||
gsk_gpu_blend_mode_op_print_instance,
|
||||
gsk_gpu_blendmode_setup_attrib_locations,
|
||||
gsk_gpu_blendmode_setup_vao
|
||||
};
|
||||
|
||||
@@ -20,22 +20,15 @@ struct _GskGpuBlurOp
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_blur_op_print (GskGpuOp *op,
|
||||
GskGpuFrame *frame,
|
||||
GString *string,
|
||||
guint indent)
|
||||
gsk_gpu_blur_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
{
|
||||
GskGpuShaderOp *shader = (GskGpuShaderOp *) op;
|
||||
GskGpuBlurInstance *instance;
|
||||
GskGpuBlurInstance *instance = (GskGpuBlurInstance *) instance_;
|
||||
|
||||
instance = (GskGpuBlurInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blur");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
g_string_append_printf (string, "%g,%g ", instance->blur_direction[0], instance->blur_direction[1]);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
@@ -43,7 +36,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
GSK_GPU_OP_SIZE (GskGpuBlurOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_blur_op_print,
|
||||
gsk_gpu_shader_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
@@ -54,6 +47,7 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_blur_info,
|
||||
#endif
|
||||
gsk_gpu_blur_op_print_instance,
|
||||
gsk_gpu_blur_setup_attrib_locations,
|
||||
gsk_gpu_blur_setup_vao
|
||||
};
|
||||
|
||||