mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-26 19:29:42 +01:00
Compare commits
412 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
396b5c6e35 | ||
|
|
0a99632956 | ||
|
|
89797f94c9 | ||
|
|
90a36251b6 | ||
|
|
5a29d4ade9 | ||
|
|
a0b235eb24 | ||
|
|
20546081aa | ||
|
|
b99c1e7b5c | ||
|
|
aebc0cdb79 | ||
|
|
d757108517 | ||
|
|
6ea9530d9f | ||
|
|
9fe5c778d9 | ||
|
|
529d5c8bcc | ||
|
|
9331ecada6 | ||
|
|
8781991e67 | ||
|
|
7a24f5a493 | ||
|
|
82dcb03358 | ||
|
|
691e7d46ed | ||
|
|
51ec616d23 | ||
|
|
b3a41ba6d9 | ||
|
|
2fb4c904ab | ||
|
|
ab1e8dc136 | ||
|
|
e480592b39 | ||
|
|
99dae8d59e | ||
|
|
2e672f6c2f | ||
|
|
a31ba4ca30 | ||
|
|
1e900726f9 | ||
|
|
6f60cad1a9 | ||
|
|
b74750d845 | ||
|
|
48478ca6e2 | ||
|
|
6b7ccbdccc | ||
|
|
c3839647c6 | ||
|
|
a7b4c9449a | ||
|
|
380c17456c | ||
|
|
ba7496606d | ||
|
|
1ee493a1f9 | ||
|
|
fc25d3598c | ||
|
|
598452f079 | ||
|
|
c49e042535 | ||
|
|
94a4eb7002 | ||
|
|
fa160d2d7d | ||
|
|
c0397fbade | ||
|
|
d5868e8fe1 | ||
|
|
e40bb508e3 | ||
|
|
c92af06680 | ||
|
|
178708f1cb | ||
|
|
2e2cae243c | ||
|
|
7a2a7986be | ||
|
|
5839539379 | ||
|
|
1b04112158 | ||
|
|
a5dcce7541 | ||
|
|
976c97f409 | ||
|
|
4ef573bfb7 | ||
|
|
0efbe5d9b9 | ||
|
|
7a2ccfc521 | ||
|
|
969255904b | ||
|
|
27d2f21f65 | ||
|
|
7f032e3fe7 | ||
|
|
6b50fc8871 | ||
|
|
81d989b511 | ||
|
|
acdc0ea38e | ||
|
|
4cd8e27964 | ||
|
|
8445f53d85 | ||
|
|
eaa04303a7 | ||
|
|
29c8d3fecf | ||
|
|
41e89505be | ||
|
|
30d479fbd4 | ||
|
|
4399dc382c | ||
|
|
e21bc70e8f | ||
|
|
08ea095216 | ||
|
|
7884d54f48 | ||
|
|
483234fe7d | ||
|
|
6790353282 | ||
|
|
0fb5c9ed61 | ||
|
|
5a63351d2a | ||
|
|
eae772aca9 | ||
|
|
b3c4cc9e52 | ||
|
|
57e46e5dcd | ||
|
|
ba69b0d47d | ||
|
|
e1c6172e9a | ||
|
|
322526458a | ||
|
|
8ae0be8eb6 | ||
|
|
4b09614a0e | ||
|
|
08ae9ff034 | ||
|
|
251068294e | ||
|
|
cce5c34181 | ||
|
|
ec241e4a0a | ||
|
|
f42e6bb30b | ||
|
|
b3dacc9146 | ||
|
|
a2059db21b | ||
|
|
5119eeee12 | ||
|
|
d9dfc3c6c5 | ||
|
|
1acada7cac | ||
|
|
ec9bd95bfe | ||
|
|
5d35e72065 | ||
|
|
cf7d535b03 | ||
|
|
c959b23697 | ||
|
|
bdd644eaac | ||
|
|
d45a8d2113 | ||
|
|
15f7368309 | ||
|
|
aa13c8b4ea | ||
|
|
83843f9124 | ||
|
|
ed806bf652 | ||
|
|
56b69b2813 | ||
|
|
da03ef94f8 | ||
|
|
76abb69262 | ||
|
|
2a2e1cfb36 | ||
|
|
12de3e287e | ||
|
|
9cc5cbc99b | ||
|
|
46e4cdfcbd | ||
|
|
897a8fc34e | ||
|
|
52405e5dfa | ||
|
|
bcae402dc8 | ||
|
|
c423003bd4 | ||
|
|
9dbcf194c9 | ||
|
|
7b27b1b042 | ||
|
|
7911ed796c | ||
|
|
df8927dbb7 | ||
|
|
a86bde7a19 | ||
|
|
2ea40c8d84 | ||
|
|
a159468873 | ||
|
|
8c86ad3e96 | ||
|
|
1c3477df2e | ||
|
|
25ca06766f | ||
|
|
42d83e8388 | ||
|
|
e4a3889cf0 | ||
|
|
2b0ad27393 | ||
|
|
0d2326ff34 | ||
|
|
114b8af38f | ||
|
|
62f9d1f46a | ||
|
|
0429e74e9d | ||
|
|
e12c1d6f0d | ||
|
|
984ee6de6d | ||
|
|
baa0bcc47b | ||
|
|
a974a4bbf8 | ||
|
|
f4ad93af52 | ||
|
|
1d5b16fd63 | ||
|
|
40cfdce94b | ||
|
|
1cccea91e9 | ||
|
|
21a7269ceb | ||
|
|
58b8ccc854 | ||
|
|
64566ca44c | ||
|
|
de2d07fe1f | ||
|
|
c65f663dcb | ||
|
|
da3730d6ce | ||
|
|
262d1ddf1f | ||
|
|
1de7835d1d | ||
|
|
677d4d3eb1 | ||
|
|
a0d84192bb | ||
|
|
8af0800269 | ||
|
|
869aabd8b2 | ||
|
|
eaba1a6346 | ||
|
|
7c16f77492 | ||
|
|
5d9faf7c80 | ||
|
|
f2d4934d48 | ||
|
|
8b14351736 | ||
|
|
1c86964a86 | ||
|
|
a959da2d69 | ||
|
|
618061de22 | ||
|
|
f904e0178e | ||
|
|
e1cda1822f | ||
|
|
7c19f7a134 | ||
|
|
8ef4fe8295 | ||
|
|
2f2d0406ac | ||
|
|
558f0efc8c | ||
|
|
19ae35dd6f | ||
|
|
692d03cede | ||
|
|
219844961a | ||
|
|
87023a078c | ||
|
|
49d3fc810e | ||
|
|
915a162c8a | ||
|
|
8954790601 | ||
|
|
bb857b8557 | ||
|
|
8edb0464c1 | ||
|
|
28a73b545d | ||
|
|
e812af9f42 | ||
|
|
a9e8af6270 | ||
|
|
2c3a64f901 | ||
|
|
ea3ed16d6d | ||
|
|
529d816862 | ||
|
|
d79c9e4957 | ||
|
|
7d45943917 | ||
|
|
3ba9e9e4d1 | ||
|
|
7ef6ea624e | ||
|
|
f737bc3621 | ||
|
|
25a31564d8 | ||
|
|
83c4ae980d | ||
|
|
824c573811 | ||
|
|
fe6d5b2a52 | ||
|
|
6e4fabb087 | ||
|
|
9301dc410d | ||
|
|
b05477ba7c | ||
|
|
47af566600 | ||
|
|
47ccf390c3 | ||
|
|
b4f5bf8bd3 | ||
|
|
d7551500de | ||
|
|
05b725a6da | ||
|
|
7deb1789d3 | ||
|
|
ffc8f45780 | ||
|
|
9bc95fb2f0 | ||
|
|
6547132b8a | ||
|
|
46c6cf5f35 | ||
|
|
d889bab9fb | ||
|
|
61d8496cfd | ||
|
|
b20bd86a21 | ||
|
|
6479da50e2 | ||
|
|
b66591c77e | ||
|
|
724e964295 | ||
|
|
39039c2416 | ||
|
|
a1f9c32ddf | ||
|
|
ca0d576263 | ||
|
|
3d7557d7e2 | ||
|
|
3e0db035b2 | ||
|
|
9243823fbd | ||
|
|
6dbdd87a32 | ||
|
|
b0a1a1a634 | ||
|
|
2a1e510c1f | ||
|
|
3f7c8dd3e7 | ||
|
|
c1d1494573 | ||
|
|
e871dc0abf | ||
|
|
9ae04eada2 | ||
|
|
1e11f3a6d8 | ||
|
|
e0ad91db68 | ||
|
|
4a032cf6c5 | ||
|
|
246655a960 | ||
|
|
2020112807 | ||
|
|
5c53f38ec6 | ||
|
|
e5e0f0ae3b | ||
|
|
58162a4803 | ||
|
|
6333b9f008 | ||
|
|
1c67381903 | ||
|
|
bf3d9b9891 | ||
|
|
5042274cad | ||
|
|
ae613356ea | ||
|
|
5fbb52191d | ||
|
|
7d8c539268 | ||
|
|
6a25123067 | ||
|
|
2f022325b0 | ||
|
|
134e8c4798 | ||
|
|
e3771f75b0 | ||
|
|
523988e12d | ||
|
|
03bf56e8ff | ||
|
|
c562fdce46 | ||
|
|
cea2506581 | ||
|
|
fc656b75b4 | ||
|
|
ba24a55e7a | ||
|
|
562b7623e5 | ||
|
|
bee63f6b8f | ||
|
|
4331f72e0a | ||
|
|
b680502d78 | ||
|
|
29c3b8035a | ||
|
|
487a0cb89f | ||
|
|
1fcdac97ed | ||
|
|
d8796fc895 | ||
|
|
6606ee93d5 | ||
|
|
0081bdd6bc | ||
|
|
ed99711837 | ||
|
|
580ea2b861 | ||
|
|
f8bf5b94da | ||
|
|
e5f579f928 | ||
|
|
50cdd824b8 | ||
|
|
2dcc5f045b | ||
|
|
90de3b119f | ||
|
|
9ae5bc1fce | ||
|
|
d32a958776 | ||
|
|
f2126682e8 | ||
|
|
a56c9bd36d | ||
|
|
47f63ddec9 | ||
|
|
d4f23f6cab | ||
|
|
043686d649 | ||
|
|
29985b6c0d | ||
|
|
9c77effb3b | ||
|
|
734bb46798 | ||
|
|
36bf031da8 | ||
|
|
af31a2f634 | ||
|
|
d4d2409947 | ||
|
|
1bf1546703 | ||
|
|
8c7c75195f | ||
|
|
4b5e87f162 | ||
|
|
a30a8852f4 | ||
|
|
7a42b99514 | ||
|
|
735bb0b81c | ||
|
|
10f57c2915 | ||
|
|
328b2c647c | ||
|
|
0748a9b63f | ||
|
|
8a789d61a9 | ||
|
|
94bfa56922 | ||
|
|
eabc7977a7 | ||
|
|
0aa1c20cf1 | ||
|
|
cac4760d87 | ||
|
|
a82a3ffbf1 | ||
|
|
f68b3043dc | ||
|
|
0134ec0a23 | ||
|
|
44a2d03996 | ||
|
|
10ce765c20 | ||
|
|
af40b4e1d0 | ||
|
|
4ea6839dee | ||
|
|
aa80960737 | ||
|
|
907ee46e59 | ||
|
|
410c7daa75 | ||
|
|
1373e65863 | ||
|
|
8780ac4183 | ||
|
|
8086cff234 | ||
|
|
a8b0f565e4 | ||
|
|
bca035a384 | ||
|
|
0d3048339f | ||
|
|
fc674452a2 | ||
|
|
533913d0b4 | ||
|
|
d86ba25b1d | ||
|
|
372397a76c | ||
|
|
b8f0618681 | ||
|
|
4c85b20f95 | ||
|
|
ba474bcfdd | ||
|
|
660fd8a3c8 | ||
|
|
c38615fdca | ||
|
|
366bd6c3c4 | ||
|
|
ab67248c83 | ||
|
|
396bcd7653 | ||
|
|
179c440804 | ||
|
|
1021dce957 | ||
|
|
9d9687bace | ||
|
|
d832e2dcde | ||
|
|
266d389c19 | ||
|
|
5000cf32d2 | ||
|
|
af3ebd40ab | ||
|
|
b57830deaf | ||
|
|
df40e259ea | ||
|
|
96c225a86e | ||
|
|
12515379ef | ||
|
|
6d3266e7f8 | ||
|
|
3f8ff03d63 | ||
|
|
44b995832b | ||
|
|
f0f7032ffc | ||
|
|
26b4b71251 | ||
|
|
8a4f73dec9 | ||
|
|
2ef26c346d | ||
|
|
f1bfb4b93a | ||
|
|
9e461b9cfb | ||
|
|
9645d6d6ce | ||
|
|
9fec4ab8bc | ||
|
|
bb3abaeddc | ||
|
|
7618bc21e4 | ||
|
|
e89edc17b0 | ||
|
|
6f9ee713ac | ||
|
|
b27c65bd65 | ||
|
|
e497ff5f18 | ||
|
|
e1127f6887 | ||
|
|
6e1a192696 | ||
|
|
6c38912958 | ||
|
|
08265c8a8a | ||
|
|
c5dd604ef8 | ||
|
|
d781571d7e | ||
|
|
be04489104 | ||
|
|
80855b3dd9 | ||
|
|
8f571a5887 | ||
|
|
176aed1c33 | ||
|
|
dbf59696bb | ||
|
|
83b360a88a | ||
|
|
624aa68718 | ||
|
|
6b799847b0 | ||
|
|
6d47616124 | ||
|
|
d233632c35 | ||
|
|
c676a05f0a | ||
|
|
43ce2bb92a | ||
|
|
37ba62c6c3 | ||
|
|
805e7dbc44 | ||
|
|
6d4928a1e6 | ||
|
|
1a5ba408a1 | ||
|
|
461b0b5cd4 | ||
|
|
6bbe7102e2 | ||
|
|
0900a705bc | ||
|
|
fe97147ea2 | ||
|
|
bdd52c4c89 | ||
|
|
5511e8eae8 | ||
|
|
f6fc65d014 | ||
|
|
eb493ef1bf | ||
|
|
da86fbacae | ||
|
|
4e7c0b5e50 | ||
|
|
b210facd6b | ||
|
|
3801db7e12 | ||
|
|
22efc1419c | ||
|
|
b7acd7f6f6 | ||
|
|
2646c8bb5b | ||
|
|
c276444bee | ||
|
|
4c7870a3b4 | ||
|
|
4e1330dfb2 | ||
|
|
2ca8f09c02 | ||
|
|
a71b0a3e0d | ||
|
|
cef29e8100 | ||
|
|
9e768377db | ||
|
|
68c2fd0e3b | ||
|
|
7967532f3f | ||
|
|
73f993d10c | ||
|
|
e838103a24 | ||
|
|
e7ca6db66b | ||
|
|
d9656a178b | ||
|
|
5f6351b0c4 | ||
|
|
c3a0ec902d | ||
|
|
567d96c428 | ||
|
|
1666f05b23 | ||
|
|
ae823a660b | ||
|
|
f6a31f444c | ||
|
|
a1b4cd964a | ||
|
|
5845719fe5 | ||
|
|
dae56a9e8b | ||
|
|
9cc97b0c00 | ||
|
|
936dc2c40b | ||
|
|
db6c43b6f4 | ||
|
|
bd9a95d6fb | ||
|
|
8d9bac395e | ||
|
|
f652c790f4 | ||
|
|
8e59bb2f09 |
12
README.md
12
README.md
@@ -43,7 +43,7 @@ $ docker run -v `pwd`../../../../:/JetBrainsRuntime -it 942ea9900054
|
||||
|
||||
## Linux (Ubuntu 18.10 desktop)
|
||||
```
|
||||
$ sudo apt-get install autoconf make build-essential libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev install libcups2-dev libfontconfig1-dev libasound2-dev
|
||||
$ sudo apt-get install autoconf make build-essential libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libxrandr-dev libcups2-dev libfontconfig1-dev libasound2-dev
|
||||
|
||||
$ cd JetBrainsRuntime
|
||||
$ sh ./configure --disable-warnings-as-errors
|
||||
@@ -54,7 +54,15 @@ $ make images
|
||||
#### TBD
|
||||
|
||||
## OSX
|
||||
#### TBD
|
||||
|
||||
install Xcode console tools, autoconf (via homebrew)
|
||||
|
||||
run
|
||||
|
||||
```
|
||||
sh ./configure --prefix=$(pwd)/build --disable-warnings-as-errors
|
||||
make images
|
||||
```
|
||||
|
||||
## Contribution
|
||||
We will be happy to receive your pull requests. Before you submit one, please sign our Contributor License Agreement (CLA) https://www.jetbrains.com/agreements/cla/
|
||||
|
||||
2
jb/project/jdk-cmake/.gitignore
vendored
Normal file
2
jb/project/jdk-cmake/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.idea
|
||||
cmake-build-*
|
||||
16
jb/project/tools/mac/scripts/entitlements.xml
Normal file
16
jb/project/tools/mac/scripts/entitlements.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
120
jb/project/tools/mac/scripts/notarize.sh
Executable file
120
jb/project/tools/mac/scripts/notarize.sh
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIRECTORY=$1
|
||||
APPL_USER=$2
|
||||
APPL_PASSWORD=$3
|
||||
APP_NAME=$4
|
||||
BUNDLE_ID=$5
|
||||
FAKE_ROOT="${6:-fake-root}"
|
||||
|
||||
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$APPL_USER" ]] || [[ -z "$APPL_PASSWORD" ]]; then
|
||||
echo "Usage: $0 AppDirectory Username Password"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$APP_DIRECTORY" ]]; then
|
||||
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
function publish-log() {
|
||||
id=$1
|
||||
file=$2
|
||||
curl -T "$file" "$ARTIFACTORY_URL/$id" || true
|
||||
}
|
||||
|
||||
function altool-upload() {
|
||||
# Since altool uses same file for upload token we have to trick it into using different folders for token file location
|
||||
# Also it copies zip into TMPDIR so we override it too, to simplify cleanup
|
||||
OLD_HOME="$HOME"
|
||||
export HOME="$FAKE_ROOT/home"
|
||||
export TMPDIR="$FAKE_ROOT/tmp"
|
||||
mkdir -p "$HOME"
|
||||
mkdir -p "$TMPDIR"
|
||||
export _JAVA_OPTIONS="-Duser.home=$HOME -Djava.io.tmpdir=$TMPDIR"
|
||||
# Reduce amount of downloads, cache transporter libraries
|
||||
shared_itmstransporter="$OLD_HOME/shared-itmstransporter"
|
||||
if [[ -f "$shared_itmstransporter" ]]; then
|
||||
cp -r "$shared_itmstransporter" "$HOME/.itmstransporter"
|
||||
fi
|
||||
# For some reason altool prints everything to stderr, not stdout
|
||||
set +e
|
||||
xcrun altool --notarize-app \
|
||||
--username "$APPL_USER" --password "$APPL_PASSWORD" \
|
||||
--primary-bundle-id "$BUNDLE_ID" \
|
||||
--asc-provider JetBrainssro --file "$1" 2>&1 | tee "altool.init.out"
|
||||
unset TMPDIR
|
||||
export HOME="$OLD_HOME"
|
||||
set -e
|
||||
}
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
file="$APP_NAME.zip"
|
||||
|
||||
log "Zipping $file..."
|
||||
rm -rf "$file"
|
||||
ditto -c -k --sequesterRsrc --keepParent "$APP_DIRECTORY/Contents" "$file"
|
||||
|
||||
log "Notarizing $file..."
|
||||
rm -rf "altool.init.out" "altool.check.out"
|
||||
altool-upload "$file"
|
||||
|
||||
rm -rf "$file"
|
||||
|
||||
notarization_info="$(grep -e "RequestUUID" "altool.init.out" | grep -oE '([0-9a-f-]{36})')"
|
||||
|
||||
if [ -z "$notarization_info" ]; then
|
||||
log "Faile to read RequestUUID from altool.init.out"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
PATH="$PATH:/usr/local/bin/"
|
||||
|
||||
log "Notarization request sent, awaiting response"
|
||||
spent=0
|
||||
|
||||
while true; do
|
||||
# For some reason altool prints everything to stderr, not stdout
|
||||
xcrun altool --username "$APPL_USER" --notarization-info "$notarization_info" --password "$APPL_PASSWORD" >"altool.check.out" 2>&1 || true
|
||||
status="$(grep -oe 'Status: .*' "altool.check.out" | cut -c 9- || true)"
|
||||
log "Current status: $status"
|
||||
if [ "$status" = "invalid" ]; then
|
||||
log "Notarization failed"
|
||||
ec=1
|
||||
elif [ "$status" = "success" ]; then
|
||||
log "Notarization succeeded"
|
||||
ec=0
|
||||
else
|
||||
if [ "$status" != "in progress" ]; then
|
||||
log "Unknown notarization status, waiting more, altool output:"
|
||||
cat "altool.check.out"
|
||||
fi
|
||||
if [[ $spent -gt 60 ]]; then
|
||||
log "Waiting time out (apx 60 minutes)"
|
||||
ec=2
|
||||
break
|
||||
fi
|
||||
sleep 60
|
||||
((spent += 1))
|
||||
continue
|
||||
fi
|
||||
developer_log="developer_log.json"
|
||||
log "Fetching $developer_log"
|
||||
# TODO: Replace cut with trim or something better
|
||||
url="$(grep -oe 'LogFileURL: .*' "altool.check.out" | cut -c 13-)"
|
||||
wget "$url" -O "$developer_log" && cat "$developer_log" || true
|
||||
if [ $ec != 0 ]; then
|
||||
log "Publishing $developer_log"
|
||||
publish-log "$notarization_info" "$developer_log"
|
||||
fi
|
||||
break
|
||||
done
|
||||
cat "altool.check.out"
|
||||
|
||||
rm -rf "altool.init.out" "altool.check.out"
|
||||
exit $ec
|
||||
93
jb/project/tools/mac/scripts/sign.sh
Executable file
93
jb/project/tools/mac/scripts/sign.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIRECTORY=$1
|
||||
JB_CERT=$2
|
||||
|
||||
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$JB_CERT" ]]; then
|
||||
echo "Usage: $0 AppDirectory CertificateID"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$APP_DIRECTORY" ]]; then
|
||||
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
# Cleanup files left from previous sign attempt (if any)
|
||||
find "$APP_DIRECTORY" -name '*.cstemp' -exec rm '{}' \;
|
||||
|
||||
log "Signing libraries and executables..."
|
||||
# -perm +111 searches for executables
|
||||
for f in \
|
||||
"Contents/Home/bin" \
|
||||
"Contents/Home/lib"; do
|
||||
if [ -d "$APP_DIRECTORY/$f" ]; then
|
||||
find "$APP_DIRECTORY/$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
|
||||
-exec codesign --timestamp \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
log "Signing libraries in jars in $PWD"
|
||||
|
||||
# todo: add set -euo pipefail; into the inner sh -c
|
||||
# `-e` prevents `grep -q && printf` loginc
|
||||
# with `-o pipefail` there's no input for 'while' loop
|
||||
find "$APP_DIRECTORY" -name '*.jar' \
|
||||
-exec sh -c "set -u; unzip -l \"\$0\" | grep -q -e '\.dylib\$' -e '\.jnilib\$' -e '\.so\$' -e '^jattach\$' && printf \"\$0\0\" " {} \; |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
log "Processing libraries in $file"
|
||||
|
||||
rm -rf jarfolder jar.jar
|
||||
mkdir jarfolder
|
||||
filename="${file##*/}"
|
||||
log "Filename: $filename"
|
||||
cp "$file" jarfolder && (cd jarfolder && jar xf "$filename" && rm "$filename")
|
||||
|
||||
find jarfolder \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "jattach" \) \
|
||||
-exec codesign --timestamp \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
|
||||
(cd jarfolder; zip -q -r -o ../jar.jar .)
|
||||
mv jar.jar "$file"
|
||||
done
|
||||
|
||||
rm -rf jarfolder jar.jar
|
||||
|
||||
log "Signing other files..."
|
||||
for f in \
|
||||
"Contents/MacOS"; do
|
||||
if [ -d "$APP_DIRECTORY/$f" ]; then
|
||||
find "$APP_DIRECTORY/$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
|
||||
-exec codesign --timestamp \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
#log "Signing executable..."
|
||||
#codesign --timestamp \
|
||||
# -v -s "$JB_CERT" --options=runtime \
|
||||
# --force \
|
||||
# --entitlements entitlements.xml "$APP_DIRECTORY/Contents/MacOS/idea"
|
||||
|
||||
log "Signing whole app..."
|
||||
codesign --timestamp \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--force \
|
||||
--entitlements entitlements.xml "$APP_DIRECTORY"
|
||||
|
||||
log "Verifying java is not broken"
|
||||
find "$APP_DIRECTORY" \
|
||||
-type f -name 'java' -perm +111 -exec {} -version \;
|
||||
121
jb/project/tools/mac/scripts/signapp.sh
Executable file
121
jb/project/tools/mac/scripts/signapp.sh
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
|
||||
export COPYFILE_DISABLE=true
|
||||
|
||||
INPUT_FILE=$1
|
||||
EXPLODED=$2.exploded
|
||||
USERNAME=$3
|
||||
PASSWORD=$4
|
||||
CODESIGN_STRING=$5
|
||||
NOTARIZE=$6
|
||||
BUNDLE_ID=$7
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
log "Deleting $EXPLODED ..."
|
||||
if test -d "$EXPLODED"; then
|
||||
find "$EXPLODED" -mindepth 1 -maxdepth 1 -exec chmod -R u+wx '{}' \;
|
||||
fi
|
||||
rm -rf "$EXPLODED"
|
||||
mkdir "$EXPLODED"
|
||||
|
||||
log "Unzipping $INPUT_FILE to $EXPLODED ..."
|
||||
tar -xzvf "$INPUT_FILE" --directory $EXPLODED --exclude "jmods"
|
||||
rm "$INPUT_FILE"
|
||||
BUILD_NAME="$(ls "$EXPLODED")"
|
||||
#log "$INPUT_FILE unzipped and removed"
|
||||
log "$INPUT_FILE extracted and removed"
|
||||
|
||||
APPLICATION_PATH="$EXPLODED/$BUILD_NAME"
|
||||
|
||||
find "$APPLICATION_PATH/Contents/Home/bin" \
|
||||
-maxdepth 1 -type f -name '*.jnilib' -print0 |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
if [ -f "$file" ]; then
|
||||
log "Linking $file"
|
||||
b="$(basename "$file" .jnilib)"
|
||||
ln -sf "$b.jnilib" "$(dirname "$file")/$b.dylib"
|
||||
fi
|
||||
done
|
||||
|
||||
find "$APPLICATION_PATH/Contents/" \
|
||||
-maxdepth 1 -type f -name '*.txt' -print0 |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
if [ -f "$file" ]; then
|
||||
log "Moving $file"
|
||||
mv "$file" "$APPLICATION_PATH/Contents/Resources"
|
||||
fi
|
||||
done
|
||||
|
||||
non_plist=$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist' | wc -l)
|
||||
if [[ $non_plist -gt 0 ]]; then
|
||||
log "Only Info.plist file is allowed in Contents directory but found $non_plist file(s):"
|
||||
log "$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist')"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Unlocking keychain..."
|
||||
# Make sure *.p12 is imported into local KeyChain
|
||||
security unlock-keychain -p "$PASSWORD" "/Users/$USERNAME/Library/Keychains/login.keychain"
|
||||
|
||||
attempt=1
|
||||
limit=3
|
||||
set +e
|
||||
while [[ $attempt -le $limit ]]; do
|
||||
log "Signing (attempt $attempt) $APPLICATION_PATH ..."
|
||||
./sign.sh "$APPLICATION_PATH" "$CODESIGN_STRING"
|
||||
ec=$?
|
||||
if [[ $ec -ne 0 ]]; then
|
||||
((attempt += 1))
|
||||
if [ $attempt -eq $limit ]; then
|
||||
set -e
|
||||
fi
|
||||
log "Signing failed, wait for 30 sec and try to sign again"
|
||||
sleep 30
|
||||
else
|
||||
log "Signing done"
|
||||
codesign -v "$APPLICATION_PATH" -vvvvv
|
||||
log "Check sign done"
|
||||
((attempt += limit))
|
||||
fi
|
||||
done
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$NOTARIZE" = "yes" ]; then
|
||||
log "Notarizing..."
|
||||
# shellcheck disable=SC1090
|
||||
source "$HOME/.notarize_token"
|
||||
APP_NAME=$(echo ${INPUT_FILE} | awk -F"." '{ print $1 }')
|
||||
# Since notarization tool uses same file for upload token we have to trick it into using different folders, hence fake root
|
||||
# Also it leaves copy of zip file in TMPDIR, so notarize.sh overrides it and uses FAKE_ROOT as location for temp TMPDIR
|
||||
FAKE_ROOT="$(pwd)/fake-root"
|
||||
mkdir -p "$FAKE_ROOT"
|
||||
echo "Notarization will use fake root: $FAKE_ROOT"
|
||||
./notarize.sh "$APPLICATION_PATH" "$APPLE_USERNAME" "$APPLE_PASSWORD" "$APP_NAME" "$BUNDLE_ID" "$FAKE_ROOT"
|
||||
rm -rf "$FAKE_ROOT"
|
||||
|
||||
set +e
|
||||
log "Stapling..."
|
||||
xcrun stapler staple "$APPLICATION_PATH"
|
||||
else
|
||||
log "Notarization disabled"
|
||||
log "Stapling disabled"
|
||||
fi
|
||||
|
||||
log "Zipping $BUILD_NAME to $INPUT_FILE ..."
|
||||
(
|
||||
cd "$EXPLODED"
|
||||
ditto -c -k --sequesterRsrc --keepParent "$BUILD_NAME" "../$INPUT_FILE"
|
||||
log "Finished zipping"
|
||||
)
|
||||
rm -rf "$EXPLODED"
|
||||
log "Done"
|
||||
@@ -543,12 +543,9 @@ endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
|
||||
endif
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
endif
|
||||
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
|
||||
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
|
||||
|
||||
|
||||
@@ -274,9 +274,9 @@ void ClassListParser::error(const char *msg, ...) {
|
||||
// This function is used for loading classes for customized class loaders
|
||||
// during archive dumping.
|
||||
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
|
||||
#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS)))
|
||||
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit
|
||||
//
|
||||
#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(__APPLE__) || defined(_WINDOWS) ))
|
||||
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
|
||||
// (3) MacOSX/64-bit and (4) Windows/64-bit
|
||||
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
|
||||
// method in test/lib/jdk/test/lib/Platform.java.
|
||||
error("AppCDS custom class loaders not supported on this platform");
|
||||
@@ -364,7 +364,11 @@ Klass* ClassListParser::load_current_class(TRAPS) {
|
||||
if (!HAS_PENDING_EXCEPTION && (obj != NULL)) {
|
||||
klass = java_lang_Class::as_Klass(obj);
|
||||
} else { // load classes in bootclasspath/a
|
||||
tty->print_cr("Class %s was not loaded from the system classloader", this->current_class_name());
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
|
||||
@@ -373,6 +377,7 @@ Klass* ClassListParser::load_current_class(TRAPS) {
|
||||
if (k != NULL) {
|
||||
klass = k;
|
||||
} else {
|
||||
tty->print_cr("Class %s is not found from SystemDictionary::resolve_or_null(..) == null", this->current_class_name());
|
||||
if (!HAS_PENDING_EXCEPTION) {
|
||||
THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
|
||||
}
|
||||
|
||||
@@ -270,6 +270,7 @@ InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS)
|
||||
ClassFileStream* stream = NULL;
|
||||
ClassPathEntry* e = find_classpath_entry_from_cache(path, CHECK_NULL);
|
||||
if (e == NULL) {
|
||||
tty->print_cr("Preload Warning: ClassPathEntry is not found for class %s and path %s", class_name, path);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
@@ -336,12 +337,14 @@ ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path
|
||||
struct stat st;
|
||||
if (os::stat(path, &st) != 0) {
|
||||
// File or directory not found
|
||||
tty->print_cr("Preload Warning: Source path %s is not found", path);
|
||||
return NULL;
|
||||
}
|
||||
ClassPathEntry* new_entry = NULL;
|
||||
|
||||
new_entry = create_class_path_entry(path, &st, false, false, CHECK_NULL);
|
||||
if (new_entry == NULL) {
|
||||
tty->print_cr("Preload Warning: The create_class_path_entry() call for path %s returned NULL", path);
|
||||
return NULL;
|
||||
}
|
||||
ccpe._path = strdup(path);
|
||||
@@ -351,5 +354,14 @@ ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path
|
||||
}
|
||||
|
||||
Klass* ClassLoaderExt::load_one_class(ClassListParser* parser, TRAPS) {
|
||||
return parser->load_current_class(THREAD);
|
||||
Klass* result = parser->load_current_class(THREAD);
|
||||
if (result == NULL) {
|
||||
tty->print_cr("Preload Warning: Class %s was not loaded", parser->current_class_name());
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1736,10 +1736,16 @@ int MetaspaceShared::preload_classes(const char* class_list_path, TRAPS) {
|
||||
while (parser.parse_one_line()) {
|
||||
Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
if (klass == NULL &&
|
||||
(PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) {
|
||||
// print a warning only when the pending exception is class not found
|
||||
tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name());
|
||||
if (klass == NULL) {
|
||||
if (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException()) {
|
||||
// print a warning only when the pending exception is class not found
|
||||
tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name());
|
||||
} else {
|
||||
tty->print_cr("Preload Warning: Exception loading class %s", parser.current_class_name());
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
}
|
||||
}
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
@@ -1787,6 +1793,11 @@ bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Preload Warning: Verification failed for %s",
|
||||
ik->external_name());
|
||||
|
||||
oop throwable = PENDING_EXCEPTION;
|
||||
java_lang_Throwable::print(throwable, tty);
|
||||
tty->cr();
|
||||
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
ik->set_in_error_state();
|
||||
_has_error_classes = true;
|
||||
|
||||
@@ -82,11 +82,11 @@ public class AquaImageFactory {
|
||||
}
|
||||
|
||||
static Image getGenericJavaIcon() {
|
||||
return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
|
||||
return checkValidOrStub(java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
|
||||
public Image run() {
|
||||
return com.apple.eawt.Application.getApplication().getDockIconImage();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
static String getPathToThisApplication() {
|
||||
@@ -496,4 +496,23 @@ public class AquaImageFactory {
|
||||
public static Color getSelectionInactiveForegroundColorUIResource() {
|
||||
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
|
||||
}
|
||||
|
||||
private static class EmptyImage {
|
||||
static final BufferedImage INSTANCE;
|
||||
static {
|
||||
INSTANCE = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics g = INSTANCE.createGraphics();
|
||||
g.setColor(new Color(0, 0, 0, 0));
|
||||
g.fillRect(0, 0, 16, 16);
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// [tav] a workaround for JBR-1492
|
||||
private static Image checkValidOrStub(Image image) {
|
||||
if (image == null || image.getWidth(null) <= 0 || image.getHeight(null) <= 0) {
|
||||
return EmptyImage.INSTANCE;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ final class ScreenMenu extends Menu
|
||||
final Component[] items = fInvoker.getMenuComponents();
|
||||
if (needsUpdate(items, childHashArray)) {
|
||||
removeAll();
|
||||
fItems.clear();
|
||||
if (count <= 0) return;
|
||||
|
||||
childHashArray = new int[count];
|
||||
@@ -246,7 +247,7 @@ final class ScreenMenu extends Menu
|
||||
synchronized (getTreeLock()) {
|
||||
super.addNotify();
|
||||
if (fModelPtr == 0) {
|
||||
fInvoker.addContainerListener(this);
|
||||
fInvoker.getPopupMenu().addContainerListener(this);
|
||||
fInvoker.addComponentListener(this);
|
||||
fPropertyListener = new ScreenMenuPropertyListener(this);
|
||||
fInvoker.addPropertyChangeListener(fPropertyListener);
|
||||
@@ -281,7 +282,7 @@ final class ScreenMenu extends Menu
|
||||
if (fModelPtr != 0) {
|
||||
removeMenuListeners(fModelPtr);
|
||||
fModelPtr = 0;
|
||||
fInvoker.removeContainerListener(this);
|
||||
fInvoker.getPopupMenu().removeContainerListener(this);
|
||||
fInvoker.removeComponentListener(this);
|
||||
fInvoker.removePropertyChangeListener(fPropertyListener);
|
||||
}
|
||||
@@ -302,11 +303,10 @@ final class ScreenMenu extends Menu
|
||||
@Override
|
||||
public void componentRemoved(final ContainerEvent e) {
|
||||
final Component child = e.getChild();
|
||||
final MenuItem sm = fItems.get(child);
|
||||
final MenuItem sm = fItems.remove(child);
|
||||
if (sm == null) return;
|
||||
|
||||
remove(sm);
|
||||
fItems.remove(sm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.awt.geom.Rectangle2D;
|
||||
// For some reason the JNI IsInstanceOf was not working correctly
|
||||
// so we are checking the class specifically. If we subclass this
|
||||
// we need to modify the native code in CFontWrapper.m
|
||||
public final class CFont extends PhysicalFont implements FontSubstitution {
|
||||
public final class CFont extends PhysicalFont implements FontSubstitution, FontWithDerivedItalic {
|
||||
|
||||
/* CFontStrike doesn't call these methods so they are unimplemented.
|
||||
* They are here to meet the requirements of PhysicalFont, needed
|
||||
@@ -266,4 +266,8 @@ public final class CFont extends PhysicalFont implements FontSubstitution {
|
||||
", familyName: " + familyName + ", style: " + style +
|
||||
" } aka: " + super.toString();
|
||||
}
|
||||
|
||||
public Font2D createItalic() {
|
||||
return this.createItalicVariant(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package sun.font;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
@@ -34,13 +35,11 @@ import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
|
||||
import sun.awt.FontConfiguration;
|
||||
import sun.awt.HeadlessToolkit;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.lwawt.macosx.*;
|
||||
|
||||
public final class CFontManager extends SunFontManager {
|
||||
@@ -141,6 +140,18 @@ public final class CFontManager extends SunFontManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerJREFonts() {
|
||||
String[] files = AccessController.doPrivileged((PrivilegedAction<String[]>) () ->
|
||||
new File(jreFontDirName).list(getTrueTypeFilter()));
|
||||
|
||||
if (files != null) {
|
||||
for (String f : files) {
|
||||
loadNativeDirFonts(jreFontDirName + File.separator + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void registerFontsInDir(final String dirName, boolean useJavaRasterizer,
|
||||
int fontRank, boolean defer, boolean resolveSymLinks) {
|
||||
|
||||
@@ -162,42 +173,16 @@ public final class CFontManager extends SunFontManager {
|
||||
private native void loadNativeFonts();
|
||||
|
||||
void registerFont(String fontName, String fontFamilyName) {
|
||||
// Use different family for specific font faces
|
||||
String newFontFamily = jreFamilyMap.get(fontName);
|
||||
if (newFontFamily != null) {
|
||||
fontFamilyName = newFontFamily;
|
||||
}
|
||||
final CFont font = new CFont(fontName, fontFamilyName);
|
||||
|
||||
registerGenericFont(font);
|
||||
}
|
||||
|
||||
void registerItalicDerived() {
|
||||
FontFamily[] famArr = FontFamily.getAllFontFamilies();
|
||||
for (int i=0; i<famArr.length; i++) {
|
||||
FontFamily family = famArr[i];
|
||||
|
||||
Font2D f2dPlain = family.getFont(Font.PLAIN);
|
||||
if (f2dPlain != null && !(f2dPlain instanceof CFont)) continue;
|
||||
Font2D f2dBold = family.getFont(Font.BOLD);
|
||||
if (f2dBold != null && !(f2dBold instanceof CFont)) continue;
|
||||
Font2D f2dItalic = family.getFont(Font.ITALIC);
|
||||
if (f2dItalic != null && !(f2dItalic instanceof CFont)) continue;
|
||||
Font2D f2dBoldItalic = family.getFont(Font.BOLD|Font.ITALIC);
|
||||
if (f2dBoldItalic != null && !(f2dBoldItalic instanceof CFont)) continue;
|
||||
|
||||
CFont plain = (CFont)f2dPlain;
|
||||
CFont bold = (CFont)f2dBold;
|
||||
CFont italic = (CFont)f2dItalic;
|
||||
CFont boldItalic = (CFont)f2dBoldItalic;
|
||||
|
||||
if (bold == null) bold = plain;
|
||||
if (plain == null && bold == null) continue;
|
||||
if (italic != null && boldItalic != null) continue;
|
||||
if (plain != null && italic == null) {
|
||||
registerGenericFont(plain.createItalicVariant(true), true);
|
||||
}
|
||||
if (bold != null && boldItalic == null) {
|
||||
registerGenericFont(bold.createItalicVariant(true), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object waitForFontsToBeLoaded = new Object();
|
||||
private boolean loadedAllFonts = false;
|
||||
|
||||
@@ -211,7 +196,6 @@ public final class CFontManager extends SunFontManager {
|
||||
public Object run() {
|
||||
if (!loadedAllFonts) {
|
||||
loadNativeFonts();
|
||||
registerItalicDerived();
|
||||
loadedAllFonts = true;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1262,9 +1262,10 @@ public class LWWindowPeer
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (platformWindow.rejectFocusRequest(cause)) {
|
||||
// return false;
|
||||
// }
|
||||
if (platformWindow.rejectFocusRequest(cause)) {
|
||||
rejectFocusRequest.run();
|
||||
return false;
|
||||
}
|
||||
|
||||
AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget());
|
||||
KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor()
|
||||
@@ -1307,7 +1308,7 @@ public class LWWindowPeer
|
||||
|
||||
// In case the toplevel is active but not focused, change focus directly,
|
||||
// as requesting native focus on it will not have effect.
|
||||
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {
|
||||
} else if (getTarget() == currentActive && !getTarget().isFocused()) {
|
||||
changeFocusedWindow(true, opposite, lightweightRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ final class CCursorManager extends LWCursorManager {
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
private static void resetCurrentCursor() {
|
||||
if (theInstance != null) {
|
||||
theInstance.currentCursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private volatile Cursor currentCursor;
|
||||
|
||||
private CCursorManager() { }
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
#import "jni_util.h"
|
||||
#import "ThreadUtilities.h"
|
||||
#import "AWTView.h"
|
||||
#import "AWTWindow.h"
|
||||
@@ -63,6 +64,7 @@ static BOOL shouldUsePressAndHold() {
|
||||
return shouldUsePressAndHold;
|
||||
}
|
||||
|
||||
extern bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, NSString * chars);
|
||||
|
||||
@implementation AWTView
|
||||
|
||||
@@ -361,9 +363,7 @@ static BOOL shouldUsePressAndHold() {
|
||||
NSUInteger deviceIndependentModifierFlagsMask =
|
||||
[event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
|
||||
|
||||
return ((deviceIndependentModifierFlagsMask == NSCommandKeyMask)
|
||||
|| (deviceIndependentModifierFlagsMask == (NSCommandKeyMask & NSShiftKeyMask)))
|
||||
&& [[event characters] isEqualToString:@"`"];
|
||||
return isSystemShortcut_NextWindowInApplication(deviceIndependentModifierFlagsMask, [event characters]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,6 +436,28 @@ static BOOL shouldUsePressAndHold() {
|
||||
[AWTToolkit scrollStateWithEvent: event]);
|
||||
CHECK_NULL(jEvent);
|
||||
|
||||
AWTWindow *awtWindow = (AWTWindow*)[event window];
|
||||
|
||||
if (![AWTWindow isAWTWindow: awtWindow]) {
|
||||
NSLog(@"awt Window is not an AWTWindow instance");
|
||||
return;
|
||||
}
|
||||
|
||||
AWTWindow* aDelegate = (AWTWindow*)[awtWindow delegate];
|
||||
|
||||
jobject platformWindow = [aDelegate.javaPlatformWindow jObjectWithEnv:env];
|
||||
|
||||
if (platformWindow == nil) {
|
||||
NSLog(@"Platform window is nil");
|
||||
return;
|
||||
}
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
|
||||
|
||||
if (!JNFIsInstanceOf(env, platformWindow, &jc_PlatformWindow)) {
|
||||
NSLog(@"Platform window is not an instance of CPlatformWindow");
|
||||
}
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
|
||||
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
|
||||
jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
// NSWindow overrides delegate methods
|
||||
- (BOOL) canBecomeKeyWindow;
|
||||
- (void) becomeKeyWindow;
|
||||
- (BOOL) canBecomeMainWindow;
|
||||
- (BOOL) worksWhenModal;
|
||||
- (void)sendEvent:(NSEvent *)event;
|
||||
|
||||
@@ -97,10 +97,19 @@ static NSPoint lastTopLeftPoint;
|
||||
return [(AWTWindow*)[self delegate] worksWhenModal]; \
|
||||
} \
|
||||
\
|
||||
- (void)cursorUpdate:(NSEvent *)event { \
|
||||
/* Prevent cursor updates from OS side */ \
|
||||
} \
|
||||
\
|
||||
- (void)sendEvent:(NSEvent *)event { \
|
||||
[(AWTWindow*)[self delegate] sendEvent:event]; \
|
||||
[super sendEvent:event]; \
|
||||
}
|
||||
} \
|
||||
\
|
||||
- (void)becomeKeyWindow { \
|
||||
[super becomeKeyWindow]; \
|
||||
[(AWTWindow*)[self delegate] becomeKeyWindow]; \
|
||||
} \
|
||||
|
||||
@implementation AWTWindow_Normal
|
||||
AWT_NS_WINDOW_IMPLEMENTATION
|
||||
@@ -529,6 +538,17 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
return self.isEnabled && (IS(self.styleBits, SHOULD_BECOME_KEY) || [self isSimpleWindowOwnedByEmbeddedFrame]);
|
||||
}
|
||||
|
||||
- (void) becomeKeyWindow {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// Reset current cursor in CCursorManager such that any following mouse update event
|
||||
// restores the correct cursor to the frame context specific one.
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
static JNF_CLASS_CACHE(jc_CCursorManager, "sun/lwawt/macosx/CCursorManager");
|
||||
static JNF_STATIC_MEMBER_CACHE(sjm_resetCurrentCursor, jc_CCursorManager, "resetCurrentCursor", "()V");
|
||||
JNFCallStaticVoidMethod(env, sjm_resetCurrentCursor);
|
||||
}
|
||||
|
||||
- (BOOL) canBecomeMainWindow {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
if (!self.isEnabled) {
|
||||
@@ -981,6 +1001,16 @@ JNF_COCOA_ENTER(env);
|
||||
NSView *contentView = OBJC(contentViewPtr);
|
||||
NSRect frameRect = NSMakeRect(x, y, w, h);
|
||||
AWTWindow *owner = [OBJC(ownerPtr) delegate];
|
||||
|
||||
BOOL isIgnoreMouseEvents = NO;
|
||||
static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
|
||||
jobject awtWindow = JNFGetObjectField(env, obj, jf_target);
|
||||
if (awtWindow != NULL) {
|
||||
static JNF_CLASS_CACHE(jc_Window, "java/awt/Window");
|
||||
static JNF_MEMBER_CACHE(jm_isIgnoreMouseEvents, jc_Window, "isIgnoreMouseEvents", "()Z");
|
||||
isIgnoreMouseEvents = JNFCallBooleanMethod(env, awtWindow, jm_isIgnoreMouseEvents) == JNI_TRUE ? YES : NO;
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
|
||||
window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
|
||||
@@ -990,7 +1020,12 @@ JNF_COCOA_ENTER(env);
|
||||
contentView:contentView];
|
||||
// the window is released is CPlatformWindow.nativeDispose()
|
||||
|
||||
if (window) [window.nsWindow retain];
|
||||
if (window) {
|
||||
[window.nsWindow retain];
|
||||
if (isIgnoreMouseEvents) {
|
||||
[window.nsWindow setIgnoresMouseEvents:YES];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
@@ -187,8 +187,9 @@ canChooseDirectories:(BOOL)inChooseDirectories
|
||||
};
|
||||
|
||||
[thePanel beginSheetModalForWindow:fOwner completionHandler:^(NSInteger result) {
|
||||
onComplete(result == NSFileHandlingPanelOKButton, YES);
|
||||
onComplete(result == NSFileHandlingPanelOKButton, YES);
|
||||
}];
|
||||
|
||||
[NSApp runModalForWindow:thePanel];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -59,17 +59,8 @@ extern jint* gButtonDownMasks;
|
||||
#define kCFCoreFoundationVersionNumber10_13_Max 1499
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber10_14_Max
|
||||
#define kCFCoreFoundationVersionNumber10_14_Max 1599
|
||||
#endif
|
||||
|
||||
#ifndef IS_OSX_GT10_13
|
||||
#define IS_OSX_GT10_13 (floor(kCFCoreFoundationVersionNumber) > \
|
||||
kCFCoreFoundationVersionNumber10_13_Max)
|
||||
#endif
|
||||
|
||||
#ifndef IS_OSX_GT10_14
|
||||
#define IS_OSX_GT10_14 (floor(kCFCoreFoundationVersionNumber) > \
|
||||
kCFCoreFoundationVersionNumber10_14_Max)
|
||||
#endif
|
||||
|
||||
|
||||
781
src/java.desktop/macosx/native/libawt_lwawt/awt/SystemHotkey.m
Normal file
781
src/java.desktop/macosx/native/libawt_lwawt/awt/SystemHotkey.m
Normal file
@@ -0,0 +1,781 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "CRobotKeyCode.h"
|
||||
#import "java_awt_event_KeyEvent.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include "jni_util.h"
|
||||
|
||||
|
||||
extern JavaVM *jvm;
|
||||
|
||||
enum LOG_LEVEL {
|
||||
LL_TRACE,
|
||||
LL_DEBUG,
|
||||
LL_INFO,
|
||||
LL_WARNING,
|
||||
LL_ERROR
|
||||
};
|
||||
|
||||
void plog(int logLevel, const char *formatMsg, ...) {
|
||||
if (!jvm)
|
||||
return;
|
||||
if (logLevel < LL_TRACE || logLevel > LL_ERROR || formatMsg == NULL)
|
||||
return;
|
||||
|
||||
// TODO: check whether current logLevel is enabled in PlatformLogger
|
||||
static jobject loggerObject = NULL;
|
||||
static jclass clazz = NULL;
|
||||
static jmethodID midTrace = NULL, midDebug = NULL, midInfo = NULL, midWarn = NULL, midError = NULL;
|
||||
|
||||
if (loggerObject == NULL) {
|
||||
JNIEnv* env;
|
||||
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL);
|
||||
jclass shkClass = (*env)->FindClass(env, "java/awt/desktop/SystemHotkey");
|
||||
if (shkClass == NULL)
|
||||
return;
|
||||
jfieldID fieldId = (*env)->GetStaticFieldID(env, shkClass, "ourLog", "Lsun/util/logging/PlatformLogger;");
|
||||
if (fieldId == NULL)
|
||||
return;
|
||||
loggerObject = (*env)->GetStaticObjectField(env, shkClass, fieldId);
|
||||
loggerObject = (*env)->NewGlobalRef(env, loggerObject);
|
||||
|
||||
clazz = (*env)->GetObjectClass(env, loggerObject);
|
||||
if (clazz == NULL) {
|
||||
NSLog(@"plogImpl: can't find PlatformLogger class");
|
||||
return;
|
||||
}
|
||||
|
||||
midTrace = (*env)->GetMethodID(env, clazz, "finest", "(Ljava/lang/String;)V");
|
||||
midDebug = (*env)->GetMethodID(env, clazz, "fine", "(Ljava/lang/String;)V");
|
||||
midInfo = (*env)->GetMethodID(env, clazz, "info", "(Ljava/lang/String;)V");
|
||||
midWarn = (*env)->GetMethodID(env, clazz, "warning", "(Ljava/lang/String;)V");
|
||||
midError = (*env)->GetMethodID(env, clazz, "severe", "(Ljava/lang/String;)V");
|
||||
}
|
||||
|
||||
jmethodID mid = midTrace;
|
||||
switch (logLevel) {
|
||||
case LL_DEBUG: mid = midDebug; break;
|
||||
case LL_INFO: mid = midInfo; break;
|
||||
case LL_WARNING: mid = midWarn; break;
|
||||
case LL_ERROR: mid = midError; break;
|
||||
}
|
||||
if (mid == NULL) {
|
||||
NSLog(@"plogImpl: undefined log-method for level %d", logLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, formatMsg);
|
||||
const int bufSize = 512;
|
||||
char buf[bufSize];
|
||||
vsnprintf(buf, bufSize, formatMsg, args);
|
||||
va_end(args);
|
||||
|
||||
JNIEnv* env;
|
||||
jstring jstr;
|
||||
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL);
|
||||
jstr = (*env)->NewStringUTF(env, buf);
|
||||
|
||||
(*env)->CallVoidMethod(env, loggerObject, mid, jstr);
|
||||
(*env)->DeleteLocalRef(env, jstr);
|
||||
}
|
||||
|
||||
static const char * toCString(id obj) {
|
||||
return obj == nil ? "nil" : [NSString stringWithFormat:@"%@", obj].UTF8String;
|
||||
}
|
||||
|
||||
// Copy of java.awt.event.KeyEvent.[MODIFIER]_DOWN_MASK
|
||||
static const int AWT_SHIFT_DOWN_MASK = 1 << 6;
|
||||
static const int AWT_CTRL_DOWN_MASK = 1 << 7;
|
||||
static const int AWT_META_DOWN_MASK = 1 << 8;
|
||||
static const int AWT_ALT_DOWN_MASK = 1 << 9;
|
||||
|
||||
static int symbolicHotKeysModifiers2java(int mask) {
|
||||
// NOTE: these masks doesn't coincide with macos events masks
|
||||
// and can be used only to parse data from settings domain "com.apple.symbolichotkeys"
|
||||
const int MACOS_SHIFT_MASK = 0x020000;
|
||||
const int MACOS_CONTROL_MASK = 0x040000;
|
||||
const int MACOS_OPTION_MASK = 0x080000;
|
||||
const int MACOS_CMD_MASK = 0x100000;
|
||||
|
||||
int result = 0;
|
||||
if (mask & MACOS_SHIFT_MASK)
|
||||
result |= AWT_SHIFT_DOWN_MASK;
|
||||
if (mask & MACOS_CONTROL_MASK)
|
||||
result |= AWT_CTRL_DOWN_MASK;
|
||||
if (mask & MACOS_OPTION_MASK)
|
||||
result |= AWT_ALT_DOWN_MASK;
|
||||
if (mask & MACOS_CMD_MASK)
|
||||
result |= AWT_META_DOWN_MASK;
|
||||
return result;
|
||||
}
|
||||
|
||||
static NSString * getAppleSymbolicHotKeysDescription(int hotKeyId) {
|
||||
static NSDictionary * hotkeyId2DescMap = nil;
|
||||
if (hotkeyId2DescMap == nil) {
|
||||
hotkeyId2DescMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Move focus to the menu bar", [NSNumber numberWithInt:7],
|
||||
@"Move focus to the Dock", [NSNumber numberWithInt:8],
|
||||
@"Move focus to active or next window", [NSNumber numberWithInt:9],
|
||||
@"Move focus to window toolbar", [NSNumber numberWithInt:10],
|
||||
@"Move focus to floating window", [NSNumber numberWithInt:11],
|
||||
@"Change the way Tab moves focus", [NSNumber numberWithInt:13],
|
||||
@"Turn zoom on or off", [NSNumber numberWithInt:15],
|
||||
@"Zoom in", [NSNumber numberWithInt:17],
|
||||
@"Zoom out", [NSNumber numberWithInt:19],
|
||||
@"Reverse Black and White", [NSNumber numberWithInt:21],
|
||||
@"Turn image smoothing on or off", [NSNumber numberWithInt:23],
|
||||
@"Increase Contrast", [NSNumber numberWithInt:25],
|
||||
@"Decrease Contrast", [NSNumber numberWithInt:26],
|
||||
@"Move focus to the next window in application", [NSNumber numberWithInt:27],
|
||||
@"Save picture of screen as file", [NSNumber numberWithInt:28],
|
||||
@"Copy picture of screen to clipboard", [NSNumber numberWithInt:29],
|
||||
@"Save picture of selected area as file", [NSNumber numberWithInt:30],
|
||||
@"Copy picture of selected area to clipboard", [NSNumber numberWithInt:31],
|
||||
@"All Windows", [NSNumber numberWithInt:32],
|
||||
@"Application Windows", [NSNumber numberWithInt:33],
|
||||
@"All Windows (Slow)", [NSNumber numberWithInt:34],
|
||||
@"Application Windows (Slow)", [NSNumber numberWithInt:35],
|
||||
@"Desktop", [NSNumber numberWithInt:36],
|
||||
@"Desktop (Slow)", [NSNumber numberWithInt:37],
|
||||
@"Move focus to the window drawer", [NSNumber numberWithInt:51],
|
||||
@"Turn Dock Hiding On/Off", [NSNumber numberWithInt:52],
|
||||
@"Move focus to the status menus", [NSNumber numberWithInt:57],
|
||||
@"Turn VoiceOver on / off", [NSNumber numberWithInt:59],
|
||||
@"Select the previous input source", [NSNumber numberWithInt:60],
|
||||
@"Select the next source in the Input Menu", [NSNumber numberWithInt:61],
|
||||
@"Dashboard", [NSNumber numberWithInt:62],
|
||||
@"Dashboard (Slow)", [NSNumber numberWithInt:63],
|
||||
@"Show Spotlight search field", [NSNumber numberWithInt:64],
|
||||
@"Show Spotlight window", [NSNumber numberWithInt:65],
|
||||
@"Dictionary MouseOver", [NSNumber numberWithInt:70],
|
||||
@"Hide and show Front Row", [NSNumber numberWithInt:73],
|
||||
@"Activate Spaces", [NSNumber numberWithInt:75],
|
||||
@"Activate Spaces (Slow)", [NSNumber numberWithInt:76],
|
||||
@"Spaces Left", [NSNumber numberWithInt:79],
|
||||
@"Spaces Right", [NSNumber numberWithInt:81],
|
||||
@"Spaces Down", [NSNumber numberWithInt:83],
|
||||
@"Spaces Up", [NSNumber numberWithInt:85],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:91],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:92],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:98],
|
||||
@"Switch to Space 1", [NSNumber numberWithInt:118],
|
||||
@"Switch to Space 2", [NSNumber numberWithInt:119],
|
||||
@"Switch to Space 3", [NSNumber numberWithInt:120],
|
||||
@"Switch to Space 4", [NSNumber numberWithInt:121],
|
||||
@"Show Launchpad", [NSNumber numberWithInt:160],
|
||||
@"Show Accessibility Controls", [NSNumber numberWithInt:162],
|
||||
@"Show Notification Center", [NSNumber numberWithInt:163],
|
||||
@"Turn Do-Not-Disturb On/Off", [NSNumber numberWithInt:175],
|
||||
@"Turn focus following On/Off", [NSNumber numberWithInt:179],
|
||||
nil
|
||||
];
|
||||
|
||||
[hotkeyId2DescMap retain];
|
||||
}
|
||||
|
||||
return [hotkeyId2DescMap objectForKey : [NSNumber numberWithInt : hotKeyId]];
|
||||
}
|
||||
|
||||
@interface DefaultParams: NSObject
|
||||
@property (assign) BOOL enabled;
|
||||
@property (strong) NSString *key_equivalent;
|
||||
+(DefaultParams *) create:(NSString *)key_equivalent enabled:(BOOL)enabled;
|
||||
@end
|
||||
|
||||
@implementation DefaultParams
|
||||
+(DefaultParams *) create:(NSString *)key_equivalent enabled:(BOOL)enabled {
|
||||
DefaultParams * result = [[[DefaultParams alloc] init] autorelease];
|
||||
result.enabled = enabled;
|
||||
result.key_equivalent = key_equivalent;
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
|
||||
static NSMutableDictionary * createDefaultParams();
|
||||
|
||||
static int NSModifiers2java(int mask) {
|
||||
int result = 0;
|
||||
if (mask & shiftKey)
|
||||
result |= AWT_SHIFT_DOWN_MASK;
|
||||
if (mask & controlKey)
|
||||
result |= AWT_CTRL_DOWN_MASK;
|
||||
if (mask & optionKey)
|
||||
result |= AWT_ALT_DOWN_MASK;
|
||||
if (mask & cmdKey)
|
||||
result |= AWT_META_DOWN_MASK;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int javaModifiers2NS(int jmask) {
|
||||
int result = 0;
|
||||
if (jmask & AWT_SHIFT_DOWN_MASK)
|
||||
result |= NSShiftKeyMask;
|
||||
if (jmask & AWT_CTRL_DOWN_MASK)
|
||||
result |= NSControlKeyMask;
|
||||
if (jmask & AWT_ALT_DOWN_MASK)
|
||||
result |= NSAlternateKeyMask;
|
||||
if (jmask & AWT_META_DOWN_MASK)
|
||||
result |= NSCommandKeyMask;
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef bool (^ Visitor)(int, const char *, int, const char *, int);
|
||||
|
||||
static void visitServicesShortcut(Visitor visitorBlock, NSString * key_equivalent, NSString * desc) {
|
||||
// @ - command
|
||||
// $ - shift
|
||||
// ^ - control
|
||||
// ~ - alt(option)
|
||||
const bool modIsSHIFT = [key_equivalent containsString:@"$"];
|
||||
const bool modIsCONTROL = [key_equivalent containsString:@"^"];
|
||||
const bool modIsOPTION = [key_equivalent containsString:@"~"];
|
||||
const bool modIsCMD = [key_equivalent containsString:@"@"];
|
||||
int modifiers = 0;
|
||||
if (modIsSHIFT)
|
||||
modifiers |= AWT_SHIFT_DOWN_MASK;
|
||||
if (modIsCONTROL)
|
||||
modifiers |= AWT_CTRL_DOWN_MASK;
|
||||
if (modIsOPTION)
|
||||
modifiers |= AWT_ALT_DOWN_MASK;
|
||||
if (modIsCMD)
|
||||
modifiers |= AWT_META_DOWN_MASK;
|
||||
|
||||
NSCharacterSet * excludeSet = [NSCharacterSet characterSetWithCharactersInString:@"@$^~"];
|
||||
NSString * keyChar = [key_equivalent stringByTrimmingCharactersInSet:excludeSet];
|
||||
|
||||
visitorBlock(-1, keyChar.UTF8String, modifiers, desc.UTF8String, -1);
|
||||
}
|
||||
|
||||
void readSystemHotkeysImpl(Visitor visitorBlock) {
|
||||
// 1. read from com.apple.symbolichotkeys.plist (domain with custom (user defined) shortcuts)
|
||||
@try {
|
||||
|
||||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary<NSString *,id> * shk = [defaults persistentDomainForName:@"com.apple.symbolichotkeys"];
|
||||
if (shk != nil) {
|
||||
// AppleSymbolicHotKeys = {
|
||||
// 10 = {
|
||||
// enabled = 1;
|
||||
// value = {
|
||||
// parameters = (
|
||||
// 65535,
|
||||
// 96,
|
||||
// 8650752
|
||||
// );
|
||||
// type = standard;
|
||||
// };
|
||||
// };
|
||||
// ......
|
||||
// }
|
||||
id hotkeys = [shk valueForKey:@"AppleSymbolicHotKeys"];
|
||||
if (hotkeys == nil)
|
||||
plog(LL_DEBUG, "key AppleSymbolicHotKeys doesn't exist in domain com.apple.symbolichotkeys");
|
||||
else if (![hotkeys isKindOfClass:[NSDictionary class]])
|
||||
plog(LL_DEBUG, "object for key 'AppleSymbolicHotKeys' isn't NSDictionary (class=%s)", [hotkeys className].UTF8String);
|
||||
else {
|
||||
for (id keyObj in hotkeys) {
|
||||
if (![keyObj isKindOfClass:[NSString class]]) {
|
||||
plog(LL_DEBUG, "key '%s' isn't instance of NSString (class=%s)", toCString(keyObj), [keyObj className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
NSString *hkNumber = keyObj;
|
||||
id hkDesc = hotkeys[hkNumber];
|
||||
if (![hkDesc isKindOfClass:[NSDictionary class]]) {
|
||||
plog(LL_DEBUG, "hotkey descriptor '%s' isn't instance of NSDictionary (class=%s)", toCString(hkDesc), [hkDesc className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
NSDictionary<id, id> *sdict = hkDesc;
|
||||
id objValue = sdict[@"value"];
|
||||
if (objValue == nil)
|
||||
continue;
|
||||
|
||||
if (![objValue isKindOfClass:[NSDictionary class]]) {
|
||||
plog(LL_DEBUG, "property 'value' %s isn't instance of NSDictionary (class=%s)", toCString(objValue), [objValue className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
id objEnabled = sdict[@"enabled"];
|
||||
BOOL enabled = objEnabled != nil && [objEnabled boolValue] == YES;
|
||||
|
||||
if (!enabled)
|
||||
continue;
|
||||
|
||||
NSDictionary * value = objValue;
|
||||
id objParams = value[@"parameters"];
|
||||
if (![objParams isKindOfClass:[NSArray class]]) {
|
||||
plog(LL_DEBUG, "property 'parameters' %s isn't instance of NSArray (class=%s)", toCString(objParams), [objParams className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
NSArray *parameters = objParams;
|
||||
if ([parameters count] < 3) {
|
||||
plog(LL_DEBUG, "too small lenght of parameters %d", [parameters count]);
|
||||
continue;
|
||||
}
|
||||
|
||||
id p0 = parameters[0];
|
||||
id p1 = parameters[1];
|
||||
id p2 = parameters[2];
|
||||
|
||||
if (![p0 isKindOfClass:[NSNumber class]] || ![p1 isKindOfClass:[NSNumber class]] || ![p2 isKindOfClass:[NSNumber class]]) {
|
||||
plog(LL_DEBUG, "some of parameters isn't instance of NSNumber (%s, %s, %s)", [p0 className].UTF8String, [p1 className].UTF8String, [p2 className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
//parameter 1: ASCII code of the character (or 65535 - hex 0xFFFF - for non-ASCII characters).
|
||||
//parameter 2: the keyboard key code for the character.
|
||||
//Parameter 3: the sum of the control, command, shift and option keys. these are bits 17-20 in binary: shift is bit 17, control is bit 18, option is bit 19, and command is bit 20.
|
||||
// 0x020000 => "Shift",
|
||||
// 0x040000 => "Control",
|
||||
// 0x080000 => "Option",
|
||||
// 0x100000 => "Command"
|
||||
|
||||
int asciiCode = p0 == nil ? 0xFFFF : [p0 intValue];
|
||||
int vkeyCode = p1 == nil ? -1 : [p1 intValue];
|
||||
int modifiers = p2 == nil ? 0 : [p2 intValue];
|
||||
|
||||
char keyCharBuf[64];
|
||||
const char * keyCharStr = keyCharBuf;
|
||||
if (asciiCode >= 0 && asciiCode <= 0xFF) {
|
||||
sprintf(keyCharBuf, "%c", asciiCode);
|
||||
} else
|
||||
keyCharStr = NULL;
|
||||
NSString * description = getAppleSymbolicHotKeysDescription([hkNumber intValue]);
|
||||
visitorBlock(vkeyCode, keyCharStr, symbolicHotKeysModifiers2java(modifiers), description == nil ? NULL : description.UTF8String, [hkNumber intValue]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plog(LL_DEBUG, "domain com.apple.symbolichotkeys doesn't exist");
|
||||
}
|
||||
|
||||
// 2. read from Pbs (domain with services shortcuts)
|
||||
NSMutableDictionary * allDefParams = createDefaultParams();
|
||||
NSDictionary<NSString *,id> * pbs = [defaults persistentDomainForName:@"pbs"];
|
||||
if (pbs) {
|
||||
// NSServicesStatus = {
|
||||
// "com.apple.Terminal - Open man Page in Terminal - openManPage" = {
|
||||
// "key_equivalent" = "@$m";
|
||||
// };
|
||||
// "com.apple.Terminal - Search man Page Index in Terminal - searchManPages" = {
|
||||
// "enabled_context_menu" = 0;
|
||||
// "enabled_services_menu" = 0;
|
||||
// "key_equivalent" = "@$a";
|
||||
// "presentation_modes" = {
|
||||
// ContextMenu = 0;
|
||||
// ServicesMenu = 0;
|
||||
// };
|
||||
// };
|
||||
// };
|
||||
// }
|
||||
|
||||
NSDictionary<NSString *, id> *services = [pbs valueForKey:@"NSServicesStatus"];
|
||||
if (services) {
|
||||
for (NSString *key in services) {
|
||||
id value = services[key];
|
||||
if (![value isKindOfClass:[NSDictionary class]]) {
|
||||
plog(LL_DEBUG, "'%s' isn't instance of NSDictionary (class=%s)", toCString(value), [value className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
// NOTE: unchanged default params will not appear here, check allDefParams at the end of this loop
|
||||
DefaultParams * defParams = [allDefParams objectForKey:key];
|
||||
[allDefParams removeObjectForKey:key];
|
||||
|
||||
NSDictionary<NSString *, id> *sdict = value;
|
||||
NSString *key_equivalent = sdict[@"key_equivalent"];
|
||||
if (!key_equivalent && defParams != nil) {
|
||||
key_equivalent = defParams.key_equivalent;
|
||||
}
|
||||
if (!key_equivalent)
|
||||
continue;
|
||||
|
||||
NSString *enabled = sdict[@"enabled_services_menu"];
|
||||
if (enabled != nil && [enabled boolValue] == NO) {
|
||||
continue;
|
||||
}
|
||||
if (enabled == nil && defParams != nil && !defParams.enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
visitServicesShortcut(visitorBlock, key_equivalent, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through rest of allDefParams
|
||||
for (NSString* key in allDefParams) {
|
||||
DefaultParams * defParams = allDefParams[key];
|
||||
if (!defParams.enabled) {
|
||||
continue;
|
||||
}
|
||||
visitServicesShortcut(visitorBlock, defParams.key_equivalent, key);
|
||||
}
|
||||
|
||||
#ifdef USE_CARBON_CopySymbolicHotKeys
|
||||
// 3. read from core services
|
||||
CFArrayRef registeredHotKeys;
|
||||
if(CopySymbolicHotKeys(®isteredHotKeys) == noErr) {
|
||||
CFIndex count = CFArrayGetCount(registeredHotKeys);
|
||||
for(CFIndex i = 0; i < count; i++) {
|
||||
CFDictionaryRef hotKeyInfo = CFArrayGetValueAtIndex(registeredHotKeys, i);
|
||||
CFNumberRef hotKeyCode = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode);
|
||||
CFNumberRef hotKeyModifiers = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers);
|
||||
CFBooleanRef hotKeyEnabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled);
|
||||
|
||||
int64_t vkeyCode = -1;
|
||||
CFNumberGetValue(hotKeyCode, kCFNumberSInt64Type, &vkeyCode);
|
||||
int64_t keyModifiers = 0;
|
||||
CFNumberGetValue(hotKeyModifiers, kCFNumberSInt64Type, &keyModifiers);
|
||||
Boolean enabled = CFBooleanGetValue(hotKeyEnabled);
|
||||
if (!enabled)
|
||||
continue;
|
||||
|
||||
visitorBlock(vkeyCode, NULL, NSModifiers2java(keyModifiers), NULL, -1);
|
||||
}
|
||||
|
||||
CFRelease(registeredHotKeys);
|
||||
}
|
||||
#endif // USE_CARBON_CopySymbolicHotKeys
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
NSLog(@"readSystemHotkeys: catched exception, reason '%@'", exception.reason);
|
||||
}
|
||||
}
|
||||
|
||||
bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, NSString * chars) {
|
||||
const int shortcutUid_NextWindowInApplication = 27;
|
||||
static NSString * shortcutCharacter = nil;
|
||||
static int shortcutMask = 0;
|
||||
if (shortcutCharacter == nil) {
|
||||
readSystemHotkeysImpl(
|
||||
^bool(int vkeyCode, const char * keyCharStr, int jmodifiers, const char * descriptionStr, int hotkeyUid) {
|
||||
if (hotkeyUid != shortcutUid_NextWindowInApplication)
|
||||
return true;
|
||||
|
||||
if (keyCharStr != NULL) {
|
||||
shortcutCharacter = [[NSString stringWithFormat:@"%s", keyCharStr] retain];
|
||||
shortcutMask = javaModifiers2NS(jmodifiers);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
if (shortcutCharacter == nil) {
|
||||
shortcutCharacter = @"`";
|
||||
shortcutMask = NSCommandKeyMask;
|
||||
}
|
||||
}
|
||||
|
||||
return ((modifiersMask == shortcutMask)
|
||||
|| (modifiersMask == (shortcutMask & NSShiftKeyMask)))
|
||||
&& [chars isEqualToString:shortcutCharacter];
|
||||
}
|
||||
|
||||
void Java_java_awt_desktop_SystemHotkeyReader_readSystemHotkeys(JNIEnv* env, jobject reader) {
|
||||
jclass clsReader = (*env)->GetObjectClass(env, reader);
|
||||
jmethodID methodAdd = (*env)->GetMethodID(env, clsReader, "add", "(ILjava/lang/String;ILjava/lang/String;)V");
|
||||
|
||||
readSystemHotkeysImpl(
|
||||
^bool(int vkeyCode, const char * keyCharStr, int jmodifiers, const char * descriptionStr, int hotkeyUid){
|
||||
jstring jkeyChar = keyCharStr == NULL ? NULL : (*env)->NewStringUTF(env, keyCharStr);
|
||||
jstring jdesc = descriptionStr == NULL ? NULL : (*env)->NewStringUTF(env, descriptionStr);
|
||||
(*env)->CallVoidMethod(
|
||||
env, reader, methodAdd, (jint)vkeyCode, jkeyChar, (jint)jmodifiers, jdesc
|
||||
);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
jint Java_java_awt_desktop_SystemHotkeyReader_osx2java(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osx2javaMap = nil;
|
||||
if (osx2javaMap == nil) {
|
||||
osx2javaMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_SPACE], [NSNumber numberWithInt:OSX_Delete],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_TAB], [NSNumber numberWithInt:OSX_kVK_Tab],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ENTER], [NSNumber numberWithInt:OSX_kVK_Return],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CLEAR], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadClear],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SHIFT], [NSNumber numberWithInt:OSX_Shift],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CONTROL], [NSNumber numberWithInt:OSX_Control],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ALT], [NSNumber numberWithInt:OSX_Option],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ALT_GRAPH], [NSNumber numberWithInt:OSX_RightOption],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CAPS_LOCK], [NSNumber numberWithInt:OSX_CapsLock],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ESCAPE], [NSNumber numberWithInt:OSX_Escape],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SPACE], [NSNumber numberWithInt:OSX_kVK_Space],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PAGE_UP], [NSNumber numberWithInt:OSX_PageUp],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PAGE_DOWN], [NSNumber numberWithInt:OSX_PageDown],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_END], [NSNumber numberWithInt:OSX_End],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_HOME], [NSNumber numberWithInt:OSX_Home],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_LEFT], [NSNumber numberWithInt:OSX_LeftArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_UP], [NSNumber numberWithInt:OSX_UpArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_RIGHT], [NSNumber numberWithInt:OSX_RightArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DOWN], [NSNumber numberWithInt:OSX_DownArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_COMMA], [NSNumber numberWithInt:OSX_kVK_ANSI_Comma],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_MINUS], [NSNumber numberWithInt:OSX_kVK_ANSI_Minus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PERIOD], [NSNumber numberWithInt:OSX_kVK_ANSI_Period],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SLASH], [NSNumber numberWithInt:OSX_kVK_ANSI_Slash],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_0], [NSNumber numberWithInt:OSX_kVK_ANSI_0],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_1], [NSNumber numberWithInt:OSX_kVK_ANSI_1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_2], [NSNumber numberWithInt:OSX_kVK_ANSI_2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_3], [NSNumber numberWithInt:OSX_kVK_ANSI_3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_4], [NSNumber numberWithInt:OSX_kVK_ANSI_4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_5], [NSNumber numberWithInt:OSX_kVK_ANSI_5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_6], [NSNumber numberWithInt:OSX_kVK_ANSI_6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_7], [NSNumber numberWithInt:OSX_kVK_ANSI_7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_8], [NSNumber numberWithInt:OSX_kVK_ANSI_8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_9], [NSNumber numberWithInt:OSX_kVK_ANSI_9],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SEMICOLON], [NSNumber numberWithInt:OSX_kVK_ANSI_Semicolon],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_EQUALS], [NSNumber numberWithInt:OSX_kVK_ANSI_Equal],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_A], [NSNumber numberWithInt:OSX_kVK_ANSI_A],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_B], [NSNumber numberWithInt:OSX_kVK_ANSI_B],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_C], [NSNumber numberWithInt:OSX_kVK_ANSI_C],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_D], [NSNumber numberWithInt:OSX_kVK_ANSI_D],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_E], [NSNumber numberWithInt:OSX_kVK_ANSI_E],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F], [NSNumber numberWithInt:OSX_kVK_ANSI_F],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_G], [NSNumber numberWithInt:OSX_kVK_ANSI_G],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_H], [NSNumber numberWithInt:OSX_kVK_ANSI_H],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_I], [NSNumber numberWithInt:OSX_kVK_ANSI_I],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_J], [NSNumber numberWithInt:OSX_kVK_ANSI_J],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_K], [NSNumber numberWithInt:OSX_kVK_ANSI_K],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_L], [NSNumber numberWithInt:OSX_kVK_ANSI_L],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_M], [NSNumber numberWithInt:OSX_kVK_ANSI_M],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_N], [NSNumber numberWithInt:OSX_kVK_ANSI_N],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_O], [NSNumber numberWithInt:OSX_kVK_ANSI_O],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_P], [NSNumber numberWithInt:OSX_kVK_ANSI_P],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Q], [NSNumber numberWithInt:OSX_kVK_ANSI_Q],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_R], [NSNumber numberWithInt:OSX_kVK_ANSI_R],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_S], [NSNumber numberWithInt:OSX_kVK_ANSI_S],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_T], [NSNumber numberWithInt:OSX_kVK_ANSI_T],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_U], [NSNumber numberWithInt:OSX_kVK_ANSI_U],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_V], [NSNumber numberWithInt:OSX_kVK_ANSI_V],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_W], [NSNumber numberWithInt:OSX_kVK_ANSI_W],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_X], [NSNumber numberWithInt:OSX_kVK_ANSI_X],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Y], [NSNumber numberWithInt:OSX_kVK_ANSI_Y],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Z], [NSNumber numberWithInt:OSX_kVK_ANSI_Z],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_OPEN_BRACKET], [NSNumber numberWithInt:OSX_kVK_ANSI_LeftBracket],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_SLASH], [NSNumber numberWithInt:OSX_kVK_ANSI_Backslash],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CLOSE_BRACKET], [NSNumber numberWithInt:OSX_kVK_ANSI_RightBracket],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD0], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad0],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD1], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD2], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD3], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD4], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD5], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD6], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD7], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD8], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD9], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad9],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_MULTIPLY], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadMultiply],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ADD], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadPlus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SUBTRACT], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadMinus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DECIMAL], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadDecimal],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DIVIDE], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadDivide],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F1], [NSNumber numberWithInt:OSX_F1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F2], [NSNumber numberWithInt:OSX_F2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F3], [NSNumber numberWithInt:OSX_F3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F4], [NSNumber numberWithInt:OSX_F4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F5], [NSNumber numberWithInt:OSX_F5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F6], [NSNumber numberWithInt:OSX_F6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F7], [NSNumber numberWithInt:OSX_F7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F8], [NSNumber numberWithInt:OSX_F8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F9], [NSNumber numberWithInt:OSX_F9],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F10], [NSNumber numberWithInt:OSX_F10],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F11], [NSNumber numberWithInt:OSX_F11],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F12], [NSNumber numberWithInt:OSX_F12],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DELETE], [NSNumber numberWithInt:OSX_ForwardDelete],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_HELP], [NSNumber numberWithInt:OSX_Help],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_META], [NSNumber numberWithInt:OSX_Command],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_QUOTE], [NSNumber numberWithInt:OSX_kVK_ANSI_Grave],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_QUOTE], [NSNumber numberWithInt:OSX_kVK_ANSI_Quote],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F13], [NSNumber numberWithInt:OSX_F13],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F14], [NSNumber numberWithInt:OSX_F14],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F15], [NSNumber numberWithInt:OSX_F15],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F16], [NSNumber numberWithInt:OSX_F16],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F17], [NSNumber numberWithInt:OSX_F17],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F18], [NSNumber numberWithInt:OSX_F18],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F19], [NSNumber numberWithInt:OSX_F19],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F20], [NSNumber numberWithInt:OSX_F20],
|
||||
nil
|
||||
];
|
||||
|
||||
[osx2javaMap retain];
|
||||
}
|
||||
|
||||
id val = [osx2javaMap objectForKey : [NSNumber numberWithInt : osxKeyCode]];
|
||||
if (nil != val)
|
||||
return [val intValue];
|
||||
|
||||
return java_awt_event_KeyEvent_VK_UNDEFINED;
|
||||
}
|
||||
|
||||
jstring Java_java_awt_desktop_SystemHotkey_osxKeyCodeDescription(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osxCode2DescMap = nil;
|
||||
if (osxCode2DescMap == nil) {
|
||||
osxCode2DescMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"A", [NSNumber numberWithInt:kVK_ANSI_A],
|
||||
@"S", [NSNumber numberWithInt:kVK_ANSI_S],
|
||||
@"D", [NSNumber numberWithInt:kVK_ANSI_D],
|
||||
@"F", [NSNumber numberWithInt:kVK_ANSI_F],
|
||||
@"H", [NSNumber numberWithInt:kVK_ANSI_H],
|
||||
@"G", [NSNumber numberWithInt:kVK_ANSI_G],
|
||||
@"Z", [NSNumber numberWithInt:kVK_ANSI_Z],
|
||||
@"X", [NSNumber numberWithInt:kVK_ANSI_X],
|
||||
@"C", [NSNumber numberWithInt:kVK_ANSI_C],
|
||||
@"V", [NSNumber numberWithInt:kVK_ANSI_V],
|
||||
@"B", [NSNumber numberWithInt:kVK_ANSI_B],
|
||||
@"Q", [NSNumber numberWithInt:kVK_ANSI_Q],
|
||||
@"W", [NSNumber numberWithInt:kVK_ANSI_W],
|
||||
@"E", [NSNumber numberWithInt:kVK_ANSI_E],
|
||||
@"R", [NSNumber numberWithInt:kVK_ANSI_R],
|
||||
@"Y", [NSNumber numberWithInt:kVK_ANSI_Y],
|
||||
@"T", [NSNumber numberWithInt:kVK_ANSI_T],
|
||||
@"1", [NSNumber numberWithInt:kVK_ANSI_1],
|
||||
@"2", [NSNumber numberWithInt:kVK_ANSI_2],
|
||||
@"3", [NSNumber numberWithInt:kVK_ANSI_3],
|
||||
@"4", [NSNumber numberWithInt:kVK_ANSI_4],
|
||||
@"6", [NSNumber numberWithInt:kVK_ANSI_6],
|
||||
@"5", [NSNumber numberWithInt:kVK_ANSI_5],
|
||||
@"Equal", [NSNumber numberWithInt:kVK_ANSI_Equal],
|
||||
@"9", [NSNumber numberWithInt:kVK_ANSI_9],
|
||||
@"7", [NSNumber numberWithInt:kVK_ANSI_7],
|
||||
@"Minus", [NSNumber numberWithInt:kVK_ANSI_Minus],
|
||||
@"8", [NSNumber numberWithInt:kVK_ANSI_8],
|
||||
@"0", [NSNumber numberWithInt:kVK_ANSI_0],
|
||||
@"RightBracket", [NSNumber numberWithInt:kVK_ANSI_RightBracket],
|
||||
@"O", [NSNumber numberWithInt:kVK_ANSI_O],
|
||||
@"U", [NSNumber numberWithInt:kVK_ANSI_U],
|
||||
@"LeftBracket", [NSNumber numberWithInt:kVK_ANSI_LeftBracket],
|
||||
@"I", [NSNumber numberWithInt:kVK_ANSI_I],
|
||||
@"P", [NSNumber numberWithInt:kVK_ANSI_P],
|
||||
@"L", [NSNumber numberWithInt:kVK_ANSI_L],
|
||||
@"J", [NSNumber numberWithInt:kVK_ANSI_J],
|
||||
@"Quote", [NSNumber numberWithInt:kVK_ANSI_Quote],
|
||||
@"K", [NSNumber numberWithInt:kVK_ANSI_K],
|
||||
@"Semicolon", [NSNumber numberWithInt:kVK_ANSI_Semicolon],
|
||||
@"Backslash", [NSNumber numberWithInt:kVK_ANSI_Backslash],
|
||||
@"Comma", [NSNumber numberWithInt:kVK_ANSI_Comma],
|
||||
@"Slash", [NSNumber numberWithInt:kVK_ANSI_Slash],
|
||||
@"N", [NSNumber numberWithInt:kVK_ANSI_N],
|
||||
@"M", [NSNumber numberWithInt:kVK_ANSI_M],
|
||||
@"Period", [NSNumber numberWithInt:kVK_ANSI_Period],
|
||||
@"Grave", [NSNumber numberWithInt:kVK_ANSI_Grave],
|
||||
@"KeypadDecimal", [NSNumber numberWithInt:kVK_ANSI_KeypadDecimal],
|
||||
@"KeypadMultiply", [NSNumber numberWithInt:kVK_ANSI_KeypadMultiply],
|
||||
@"KeypadPlus", [NSNumber numberWithInt:kVK_ANSI_KeypadPlus],
|
||||
@"KeypadClear", [NSNumber numberWithInt:kVK_ANSI_KeypadClear],
|
||||
@"KeypadDivide", [NSNumber numberWithInt:kVK_ANSI_KeypadDivide],
|
||||
@"KeypadEnter", [NSNumber numberWithInt:kVK_ANSI_KeypadEnter],
|
||||
@"KeypadMinus", [NSNumber numberWithInt:kVK_ANSI_KeypadMinus],
|
||||
@"KeypadEquals", [NSNumber numberWithInt:kVK_ANSI_KeypadEquals],
|
||||
@"Keypad0", [NSNumber numberWithInt:kVK_ANSI_Keypad0],
|
||||
@"Keypad1", [NSNumber numberWithInt:kVK_ANSI_Keypad1],
|
||||
@"Keypad2", [NSNumber numberWithInt:kVK_ANSI_Keypad2],
|
||||
@"Keypad3", [NSNumber numberWithInt:kVK_ANSI_Keypad3],
|
||||
@"Keypad4", [NSNumber numberWithInt:kVK_ANSI_Keypad4],
|
||||
@"Keypad5", [NSNumber numberWithInt:kVK_ANSI_Keypad5],
|
||||
@"Keypad6", [NSNumber numberWithInt:kVK_ANSI_Keypad6],
|
||||
@"Keypad7", [NSNumber numberWithInt:kVK_ANSI_Keypad7],
|
||||
@"Keypad8", [NSNumber numberWithInt:kVK_ANSI_Keypad8],
|
||||
@"Keypad9", [NSNumber numberWithInt:kVK_ANSI_Keypad9],
|
||||
|
||||
/* keycodes for keys that are independent of keyboard layout*/
|
||||
@"Return", [NSNumber numberWithInt:kVK_Return],
|
||||
@"Tab", [NSNumber numberWithInt:kVK_Tab],
|
||||
@"Space", [NSNumber numberWithInt:kVK_Space],
|
||||
@"Delete", [NSNumber numberWithInt:kVK_Delete],
|
||||
@"Escape", [NSNumber numberWithInt:kVK_Escape],
|
||||
@"Command", [NSNumber numberWithInt:kVK_Command],
|
||||
@"Shift", [NSNumber numberWithInt:kVK_Shift],
|
||||
@"CapsLock", [NSNumber numberWithInt:kVK_CapsLock],
|
||||
@"Option", [NSNumber numberWithInt:kVK_Option],
|
||||
@"Control", [NSNumber numberWithInt:kVK_Control],
|
||||
@"RightCommand", [NSNumber numberWithInt:kVK_RightCommand],
|
||||
@"RightShift", [NSNumber numberWithInt:kVK_RightShift],
|
||||
@"RightOption", [NSNumber numberWithInt:kVK_RightOption],
|
||||
@"RightControl", [NSNumber numberWithInt:kVK_RightControl],
|
||||
@"Function", [NSNumber numberWithInt:kVK_Function],
|
||||
@"F17", [NSNumber numberWithInt:kVK_F17],
|
||||
@"VolumeUp", [NSNumber numberWithInt:kVK_VolumeUp],
|
||||
@"VolumeDown", [NSNumber numberWithInt:kVK_VolumeDown],
|
||||
@"Mute", [NSNumber numberWithInt:kVK_Mute],
|
||||
@"F18", [NSNumber numberWithInt:kVK_F18],
|
||||
@"F19", [NSNumber numberWithInt:kVK_F19],
|
||||
@"F20", [NSNumber numberWithInt:kVK_F20],
|
||||
@"F5", [NSNumber numberWithInt:kVK_F5],
|
||||
@"F6", [NSNumber numberWithInt:kVK_F6],
|
||||
@"F7", [NSNumber numberWithInt:kVK_F7],
|
||||
@"F3", [NSNumber numberWithInt:kVK_F3],
|
||||
@"F8", [NSNumber numberWithInt:kVK_F8],
|
||||
@"F9", [NSNumber numberWithInt:kVK_F9],
|
||||
@"F11", [NSNumber numberWithInt:kVK_F11],
|
||||
@"F13", [NSNumber numberWithInt:kVK_F13],
|
||||
@"F16", [NSNumber numberWithInt:kVK_F16],
|
||||
@"F14", [NSNumber numberWithInt:kVK_F14],
|
||||
@"F10", [NSNumber numberWithInt:kVK_F10],
|
||||
@"F12", [NSNumber numberWithInt:kVK_F12],
|
||||
@"F15", [NSNumber numberWithInt:kVK_F15],
|
||||
@"Help", [NSNumber numberWithInt:kVK_Help],
|
||||
@"Home", [NSNumber numberWithInt:kVK_Home],
|
||||
@"PageUp", [NSNumber numberWithInt:kVK_PageUp],
|
||||
@"ForwardDelete", [NSNumber numberWithInt:kVK_ForwardDelete],
|
||||
@"F4", [NSNumber numberWithInt:kVK_F4],
|
||||
@"End", [NSNumber numberWithInt:kVK_End],
|
||||
@"F2", [NSNumber numberWithInt:kVK_F2],
|
||||
@"PageDown", [NSNumber numberWithInt:kVK_PageDown],
|
||||
@"F1", [NSNumber numberWithInt:kVK_F1],
|
||||
@"LeftArrow", [NSNumber numberWithInt:kVK_LeftArrow],
|
||||
@"RightArrow", [NSNumber numberWithInt:kVK_RightArrow],
|
||||
@"DownArrow", [NSNumber numberWithInt:kVK_DownArrow],
|
||||
@"UpArrow", [NSNumber numberWithInt:kVK_UpArrow],
|
||||
nil
|
||||
];
|
||||
|
||||
[osxCode2DescMap retain];
|
||||
}
|
||||
|
||||
NSString * val = [osxCode2DescMap objectForKey : [NSNumber numberWithInt : osxKeyCode]];
|
||||
if (val == nil)
|
||||
return NULL;
|
||||
|
||||
return (*env)->NewStringUTF(env, val.UTF8String);
|
||||
}
|
||||
|
||||
static NSDictionary * getDefaultParams() {
|
||||
static NSDictionary * sid2defaults = nil;
|
||||
if (sid2defaults == nil) {
|
||||
sid2defaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[DefaultParams create:@"@$b" enabled:NO], @"com.apple.BluetoothFileExchange - Send File To Bluetooth Device - sendFileUsingBluetoothOBEXService",
|
||||
[DefaultParams create:@"@^$c" enabled:YES], @"com.apple.ChineseTextConverterService - Convert Text from Simplified to Traditional Chinese - convertTextToTraditionalChinese",
|
||||
[DefaultParams create:@"@~^$c" enabled:YES], @"com.apple.ChineseTextConverterService - Convert Text from Traditional to Simplified Chinese - convertTextToSimplifiedChinese",
|
||||
[DefaultParams create:@"@$l" enabled:YES], @"com.apple.Safari - Search With %WebSearchProvider@ - searchWithWebSearchProvider",
|
||||
[DefaultParams create:@"@*" enabled:NO], @"com.apple.ScriptEditor2 - Script Editor/Get Result of AppleScript - runAsAppleScript",
|
||||
[DefaultParams create:@"@$f" enabled:NO], @"com.apple.SpotlightService - SEARCH_WITH_SPOTLIGHT - doSearchWithSpotlight",
|
||||
[DefaultParams create:@"@$y" enabled:YES], @"com.apple.Stickies - Make Sticky - makeStickyFromTextService",
|
||||
[DefaultParams create:@"@$m" enabled:YES], @"com.apple.Terminal - Open man Page in Terminal - openManPage",
|
||||
[DefaultParams create:@"@$a" enabled:YES], @"com.apple.Terminal - Search man Page Index in Terminal - searchManPages",
|
||||
nil
|
||||
];
|
||||
|
||||
[sid2defaults retain];
|
||||
}
|
||||
|
||||
return sid2defaults;
|
||||
}
|
||||
|
||||
static NSMutableDictionary * createDefaultParams() {
|
||||
NSDictionary * sid2defaults = getDefaultParams();
|
||||
NSMutableDictionary * result = [NSMutableDictionary dictionaryWithCapacity:[sid2defaults count]];
|
||||
[result setDictionary:sid2defaults];
|
||||
return result;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,6 @@
|
||||
#import "CGGlyphOutlines.h"
|
||||
#import "CoreTextSupport.h"
|
||||
#include "fontscalerdefs.h"
|
||||
#import "LWCToolkit.h"
|
||||
|
||||
/* Use THIS_FILE when it is available. */
|
||||
#ifndef THIS_FILE
|
||||
@@ -162,7 +161,7 @@ JNF_COCOA_ENTER(env);
|
||||
CGGlyph glyph;
|
||||
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
|
||||
const CGFontRef cgFallback = CTFontCopyGraphicsFont(fallback, NULL);
|
||||
if (IS_OSX_GT10_14 || CGGI_IsColorFont(cgFallback)) {
|
||||
if (CGGI_IsColorFont(cgFallback)) {
|
||||
CGAffineTransform matrix = awtStrike->fAltTx;
|
||||
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
|
||||
CTFontRef font = CTFontCreateWithGraphicsFont(cgFallback, fontSize, NULL, NULL);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#import "fontscalerdefs.h" // contains the definition of GlyphInfo struct
|
||||
|
||||
#import "sun_awt_SunHints.h"
|
||||
#import "LWCToolkit.h"
|
||||
|
||||
//#define USE_IMAGE_ALIGNED_MEMORY 1
|
||||
//#define CGGI_DEBUG 1
|
||||
@@ -629,8 +628,7 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
|
||||
static inline void
|
||||
CGGI_CreateImageForGlyph
|
||||
(CGFontRef cgFont, CGGI_GlyphCanvas *canvas, const CGGlyph glyph,
|
||||
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike,
|
||||
const bool isCatalinaOrAbove)
|
||||
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike)
|
||||
{
|
||||
if (isnan(info->topLeftX) || isnan(info->topLeftY)) {
|
||||
// Explicitly set glyphInfo width/height to be 0 to ensure
|
||||
@@ -650,7 +648,7 @@ CGGI_CreateImageForGlyph
|
||||
CGFloat x = -info->topLeftX;
|
||||
CGFloat y = canvas->image->height + info->topLeftY;
|
||||
|
||||
if (isCatalinaOrAbove || glyphDescriptor == &argb) {
|
||||
if (glyphDescriptor == &argb) {
|
||||
CGAffineTransform matrix = CGContextGetTextMatrix(canvas->context);
|
||||
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
|
||||
CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, fontSize, NULL, NULL);
|
||||
@@ -694,8 +692,7 @@ CGGI_CreateImageForGlyph
|
||||
static inline GlyphInfo *
|
||||
CGGI_CreateImageForUnicode
|
||||
(CGGI_GlyphCanvas *canvas, const AWTStrike *strike,
|
||||
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar,
|
||||
const bool isCatalinaOrAbove)
|
||||
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar)
|
||||
{
|
||||
// save the state of the world
|
||||
CGContextSaveGState(canvas->context);
|
||||
@@ -740,7 +737,7 @@ CGGI_CreateImageForUnicode
|
||||
CFRelease(cgFallback);
|
||||
|
||||
// clean the canvas - align, strike, and copy the glyph from the canvas into the info
|
||||
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike, isCatalinaOrAbove);
|
||||
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike);
|
||||
|
||||
// restore the state of the world
|
||||
CGContextRestoreGState(canvas->context);
|
||||
@@ -785,15 +782,14 @@ CGGI_FillImagesForGlyphsWithSizedCanvas(CGGI_GlyphCanvas *canvas,
|
||||
|
||||
CGGI_GlyphInfoDescriptor* mainFontDescriptor = CGGI_GetGlyphInfoDescriptor(mode, strike->fAWTFont->fNativeCGFont);
|
||||
|
||||
const bool isCatalinaOrAbove = IS_OSX_GT10_14;
|
||||
CFIndex i;
|
||||
for (i = 0; i < len; i++) {
|
||||
GlyphInfo *info = (GlyphInfo *)jlong_to_ptr(glyphInfos[i]);
|
||||
if (info != NULL) {
|
||||
CGGI_CreateImageForGlyph(strike->fAWTFont->fNativeCGFont,
|
||||
canvas, glyphs[i], info, mainFontDescriptor, strike, isCatalinaOrAbove);
|
||||
canvas, glyphs[i], info, mainFontDescriptor, strike);
|
||||
} else {
|
||||
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i], isCatalinaOrAbove);
|
||||
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i]);
|
||||
glyphInfos[i] = ptr_to_jlong(info);
|
||||
}
|
||||
#ifdef CGGI_DEBUG
|
||||
|
||||
@@ -50,7 +50,7 @@ BOOL postEventDuringEventSynthesis = NO;
|
||||
* Subtypes of NSApplicationDefined, which are used for custom events.
|
||||
*/
|
||||
enum {
|
||||
ExecuteBlockEvent = 777, NativeSyncQueueEvent
|
||||
ExecuteBlockEvent, NativeSyncQueueEvent
|
||||
};
|
||||
|
||||
@implementation NSApplicationAWT
|
||||
@@ -366,15 +366,11 @@ untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
|
||||
{
|
||||
if ([event type] == NSApplicationDefined
|
||||
&& TS_EQUAL([event timestamp], dummyEventTimestamp)
|
||||
&& (short)[event subtype] == NativeSyncQueueEvent
|
||||
&& [event data1] == NativeSyncQueueEvent
|
||||
&& [event data2] == NativeSyncQueueEvent) {
|
||||
&& [event subtype] == NativeSyncQueueEvent) {
|
||||
[seenDummyEventLock lockWhenCondition:NO];
|
||||
[seenDummyEventLock unlockWithCondition:YES];
|
||||
|
||||
} else if ([event type] == NSApplicationDefined
|
||||
&& (short)[event subtype] == ExecuteBlockEvent
|
||||
&& [event data1] != 0 && [event data2] == ExecuteBlockEvent) {
|
||||
} else if ([event type] == NSApplicationDefined && [event subtype] == ExecuteBlockEvent) {
|
||||
void (^block)() = (void (^)()) [event data1];
|
||||
block();
|
||||
[block release];
|
||||
@@ -405,7 +401,7 @@ untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
|
||||
context: nil
|
||||
subtype: ExecuteBlockEvent
|
||||
data1: encode
|
||||
data2: ExecuteBlockEvent];
|
||||
data2: 0];
|
||||
|
||||
[NSApp postEvent: event atStart: NO];
|
||||
[pool drain];
|
||||
@@ -423,8 +419,8 @@ untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
|
||||
windowNumber: 0
|
||||
context: nil
|
||||
subtype: NativeSyncQueueEvent
|
||||
data1: NativeSyncQueueEvent
|
||||
data2: NativeSyncQueueEvent];
|
||||
data1: 0
|
||||
data2: 0];
|
||||
if (useCocoa) {
|
||||
[NSApp postEvent:event atStart:NO];
|
||||
} else {
|
||||
|
||||
@@ -615,7 +615,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
*/
|
||||
long eventMask = AWTEvent.INPUT_METHODS_ENABLED_MASK;
|
||||
|
||||
private static final boolean INPUT_METHODS_DISABLED;
|
||||
private static boolean INPUT_METHODS_DISABLED;
|
||||
|
||||
/**
|
||||
* Static properties for incremental drawing.
|
||||
@@ -10530,5 +10530,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
void updateZOrder() {
|
||||
peer.setZOrder(getHWPeerAboveMe());
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable IM-events dispatching (global).
|
||||
* Usage of IM under Linux can cause freezes and crashes, disabling increases stability
|
||||
*/
|
||||
public static void disableInputMethodSupport() {
|
||||
INPUT_METHODS_DISABLED = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3984,6 +3984,19 @@ public class Window extends Container implements Accessible {
|
||||
hasCustomDecoration = true;
|
||||
}
|
||||
|
||||
private volatile boolean ignoreMouseEvents;
|
||||
|
||||
boolean isIgnoreMouseEvents() {
|
||||
return ignoreMouseEvents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set via reflection (JB JdkEx API).
|
||||
*/
|
||||
void setIgnoreMouseEvents(boolean ignore) {
|
||||
ignoreMouseEvents = ignore;
|
||||
}
|
||||
|
||||
// ************************** MIXING CODE *******************************
|
||||
|
||||
// A window has an owner, but it does NOT have a container
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package java.awt.desktop;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collection;
|
||||
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
|
||||
/**
|
||||
* Provides info about system hotkeys
|
||||
*/
|
||||
public class SystemHotkey extends AWTKeyStroke {
|
||||
private static final PlatformLogger ourLog = PlatformLogger.getLogger(java.awt.desktop.SystemHotkey.class.getName());
|
||||
private static final Map<Integer, String> ourCodeDescriptionCache = new HashMap<>();
|
||||
|
||||
private final int myNativeKeyCode;
|
||||
private final String myDescription;
|
||||
|
||||
SystemHotkey(char keyChar, int javaKeyCode, int javaModifiers, String description, int nativeKeyCode) {
|
||||
super(keyChar, javaKeyCode, javaModifiers, true);
|
||||
this.myNativeKeyCode = nativeKeyCode;
|
||||
this.myDescription = description;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("desc='%s' char=%s mod='%s' nativeKeyCode=0x%X ['%s'] javaKeyCode=0x%X",
|
||||
String.valueOf(myDescription), String.valueOf(getKeyChar()), InputEvent.getModifiersExText(getModifiers()),
|
||||
myNativeKeyCode, getOsxKeyCodeDescription(myNativeKeyCode), getKeyCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets hotkey description
|
||||
* @return hotkey description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads all registered hotkeys
|
||||
* @return list of all registered hotkeys
|
||||
*/
|
||||
public static List<SystemHotkey> readSystemHotkeys() {
|
||||
final SystemHotkeyReader reader = new SystemHotkeyReader();
|
||||
reader.readSystemHotkeys();
|
||||
return reader.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets virtual code description
|
||||
* @param code (virtual keycode)
|
||||
* @return virtual keycode description
|
||||
*/
|
||||
private static String getOsxKeyCodeDescription(int code) {
|
||||
return ourCodeDescriptionCache.computeIfAbsent(code, (c)->{
|
||||
final String desc = osxKeyCodeDescription(c);
|
||||
return desc == null || desc.isEmpty() ? String.format("Unknown_key_code_0x%X", c) : desc;
|
||||
});
|
||||
}
|
||||
|
||||
private static native String osxKeyCodeDescription(int osxCode);
|
||||
}
|
||||
|
||||
class SystemHotkeyReader {
|
||||
private final List<SystemHotkey> myResult = new ArrayList<>();
|
||||
|
||||
void add(int keyCode, String keyChar, int modifiers, String desc) {
|
||||
myResult.add(new SystemHotkey(
|
||||
keyChar == null || keyChar.isEmpty() ? KeyEvent.CHAR_UNDEFINED : keyChar.charAt(0),
|
||||
keyCode == -1 ? KeyEvent.VK_UNDEFINED : osx2java(keyCode),
|
||||
modifiers, desc, keyCode
|
||||
));
|
||||
}
|
||||
|
||||
List<SystemHotkey> getResult() { return myResult; }
|
||||
|
||||
native void readSystemHotkeys();
|
||||
|
||||
private static native int osx2java(int osxCode);
|
||||
}
|
||||
@@ -111,6 +111,10 @@ public abstract class FileFont extends PhysicalFont {
|
||||
return 1; // DEFAULT_CHARSET
|
||||
}
|
||||
|
||||
int getFontDataSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the public interface. The subclasses need to implement
|
||||
* this. The returned block may be longer than the requested length.
|
||||
|
||||
@@ -404,7 +404,8 @@ public class FileFontStrike extends PhysicalStrike {
|
||||
int glyphCode,
|
||||
boolean fracMetrics,
|
||||
int rotation,
|
||||
byte charset);
|
||||
byte charset,
|
||||
int fontDataSize);
|
||||
|
||||
private native long _getGlyphImageFromWindowsUsingDirectWrite(String family,
|
||||
int style,
|
||||
@@ -441,7 +442,12 @@ public class FileFontStrike extends PhysicalStrike {
|
||||
}
|
||||
if (ptr == 0) {
|
||||
boolean fm = desc.fmHint == INTVAL_FRACTIONALMETRICS_ON;
|
||||
ptr = _getGlyphImageFromWindows(family, style, size, glyphCode, fm, rotation, charset);
|
||||
ptr = _getGlyphImageFromWindows(family, style, size, glyphCode, fm, rotation, charset,
|
||||
fileFont.getFontDataSize());
|
||||
if (ptr == 0 && FontUtilities.isLogging()) {
|
||||
FontUtilities.getLogger().warning("Failed to render glyph via GDI: code=" + glyphCode
|
||||
+ ", fontFamily=" + family + ", style=" + style + ", size=" + size + ", rotation=" + rotation);
|
||||
}
|
||||
if (ptr != 0 && fm) {
|
||||
Point2D.Float metrics = new Point2D.Float();
|
||||
fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);
|
||||
|
||||
@@ -53,7 +53,6 @@ public abstract class Font2D {
|
||||
public static final int NATIVE_RANK = 5;
|
||||
public static final int UNKNOWN_RANK = 6;
|
||||
public static final int DEFAULT_RANK = 4;
|
||||
public static final int IDEA_RANK = 7;
|
||||
|
||||
private static final String[] boldNames = {
|
||||
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", "black", "coder-b"};
|
||||
|
||||
@@ -28,10 +28,8 @@ package sun.font;
|
||||
import java.io.File;
|
||||
import java.awt.Font;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class FontFamily {
|
||||
|
||||
@@ -44,6 +42,8 @@ public class FontFamily {
|
||||
protected Font2D bold;
|
||||
protected Font2D italic;
|
||||
protected Font2D bolditalic;
|
||||
private final List<FontAndStyle> fontSequence = new ArrayList<FontAndStyle>();
|
||||
private boolean initialized = false;
|
||||
protected boolean logicalFont = false;
|
||||
protected int familyRank;
|
||||
|
||||
@@ -66,6 +66,7 @@ public class FontFamily {
|
||||
if (family == null) {
|
||||
return;
|
||||
}
|
||||
family.ensureFontsLoaded();
|
||||
if (family.plain == font2D) {
|
||||
family.plain = null;
|
||||
}
|
||||
@@ -244,16 +245,51 @@ public class FontFamily {
|
||||
}
|
||||
FontUtilities.getLogger().info(msg);
|
||||
}
|
||||
synchronized (fontSequence) {
|
||||
if (initialized) {
|
||||
doSetFont(font, style);
|
||||
return;
|
||||
}
|
||||
fontSequence.add(new FontAndStyle(font, style));
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureFontsLoaded() {
|
||||
synchronized (fontSequence) {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
if (FontUtilities.isMacOSX) {
|
||||
fontSequence.sort(Comparator.comparing(FontAndStyle::getWeight));
|
||||
}
|
||||
for (FontAndStyle fontAndStyle : fontSequence) {
|
||||
doSetFont(fontAndStyle.font, fontAndStyle.style);
|
||||
}
|
||||
if (italic == null && plain instanceof FontWithDerivedItalic) {
|
||||
italic = ((FontWithDerivedItalic)plain).createItalic();
|
||||
}
|
||||
if (bolditalic == null) {
|
||||
Font2D boldItalicPrototype = bold != null ? bold : plain;
|
||||
if (boldItalicPrototype instanceof FontWithDerivedItalic) {
|
||||
bolditalic = ((FontWithDerivedItalic)boldItalicPrototype).createItalic();
|
||||
}
|
||||
}
|
||||
fontSequence.clear();
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void doSetFont(Font2D font, int style) {
|
||||
/* Allow a lower-rank font only if its a file font
|
||||
* from the exact same source as any previous font.
|
||||
*/
|
||||
if ((font.getRank() > familyRank) && !isFromSameSource(font)) {
|
||||
if (FontUtilities.isLogging()) {
|
||||
FontUtilities.getLogger()
|
||||
.warning("Rejecting adding " + font +
|
||||
" of lower rank " + font.getRank() +
|
||||
" to family " + this +
|
||||
" of rank " + familyRank);
|
||||
.warning("Rejecting adding " + font +
|
||||
" of lower rank " + font.getRank() +
|
||||
" to family " + this +
|
||||
" of rank " + familyRank);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -290,7 +326,7 @@ public class FontFamily {
|
||||
}
|
||||
|
||||
public Font2D getFontWithExactStyleMatch(int style) {
|
||||
|
||||
ensureFontsLoaded();
|
||||
switch (style) {
|
||||
|
||||
case Font.PLAIN:
|
||||
@@ -319,7 +355,7 @@ public class FontFamily {
|
||||
* same location.
|
||||
*/
|
||||
public Font2D getFont(int style) {
|
||||
|
||||
ensureFontsLoaded();
|
||||
switch (style) {
|
||||
|
||||
case Font.PLAIN:
|
||||
@@ -367,7 +403,7 @@ public class FontFamily {
|
||||
* it might as well be from the same family.
|
||||
*/
|
||||
Font2D getClosestStyle(int style) {
|
||||
|
||||
ensureFontsLoaded();
|
||||
switch (style) {
|
||||
/* if you ask for a plain font try to return a non-italic one,
|
||||
* then a italic one, finally a bold italic one */
|
||||
@@ -444,8 +480,23 @@ public class FontFamily {
|
||||
" plain="+plain+
|
||||
" bold=" + bold +
|
||||
" italic=" + italic +
|
||||
" bolditalic=" + bolditalic;
|
||||
" bolditalic=" + bolditalic +
|
||||
" initialized=" + initialized;
|
||||
|
||||
}
|
||||
|
||||
private static class FontAndStyle {
|
||||
private final Font2D font;
|
||||
private final int style;
|
||||
|
||||
private FontAndStyle(Font2D inFont, int inStyle) {
|
||||
font = inFont;
|
||||
style = inStyle;
|
||||
}
|
||||
|
||||
int getWeight() {
|
||||
return font.getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package sun.font;
|
||||
|
||||
interface FontWithDerivedItalic {
|
||||
Font2D createItalic();
|
||||
}
|
||||
@@ -82,27 +82,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TTFilterIdea extends TTFilter {
|
||||
final private boolean positive;
|
||||
final private HashSet<String> ideaSet;
|
||||
|
||||
public TTFilterIdea(boolean positive, HashSet<String> ideaSet) {
|
||||
this.positive = positive;
|
||||
this.ideaSet = ideaSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
if (super.accept(dir, name)) {
|
||||
if (ideaSet.contains(name))
|
||||
return positive;
|
||||
else
|
||||
return !positive;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class T1Filter implements FilenameFilter {
|
||||
public boolean accept(File dir,String name) {
|
||||
if (noType1Font) {
|
||||
@@ -208,9 +187,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private boolean loaded1dot0Fonts = false;
|
||||
boolean loadedAllFonts = false;
|
||||
boolean loadedAllFontFiles = false;
|
||||
HashMap<String,String> jreFontMap;
|
||||
HashSet<String> jreBundledFontFiles;
|
||||
HashSet<String> ideaFontSet;
|
||||
private HashMap<String,String> jreFontMap;
|
||||
private HashSet<String> jreBundledFontFiles;
|
||||
HashMap<String,String> jreFamilyMap;
|
||||
String[] jreOtherFontFiles;
|
||||
boolean noOtherJREFontFiles = false; // initial assumption.
|
||||
|
||||
@@ -246,8 +225,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private static final FilenameFilter ttFilter = new TTFilter();
|
||||
private static final FilenameFilter t1Filter = new T1Filter();
|
||||
|
||||
private FilenameFilter ttFilterIdea;
|
||||
private FilenameFilter ttFilterJre;
|
||||
private Font[] allFonts;
|
||||
private String[] allFamilies; // cache for default locale only
|
||||
private Locale lastDefaultLocale;
|
||||
@@ -304,6 +281,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
*/
|
||||
jreFontMap = new HashMap<String, String>();
|
||||
jreBundledFontFiles = new HashSet<String>();
|
||||
jreFamilyMap = new HashMap<>();
|
||||
|
||||
/* Droid Sans Mono Family */
|
||||
jreFontMap.put("droid sans0", "DroidSans.ttf");
|
||||
@@ -332,6 +310,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("FiraCode retina", "FiraCode-Retina.ttf");
|
||||
jreFontMap.put("FiraCode regular", "FiraCode-Regular.ttf");
|
||||
|
||||
jreFamilyMap.put("FiraCode-Medium", "Fira Code Medium");
|
||||
jreFamilyMap.put("FiraCode-Retina", "Fira Code Retina");
|
||||
jreFamilyMap.put("FiraCode-Light", "Fira Code Light");
|
||||
|
||||
jreFontMap.put("SourceCodePro bold italic", "SourceCodePro-BoldIt.ttf");
|
||||
jreFontMap.put("SourceCodePro regular", "SourceCodePro-Regular.ttf");
|
||||
jreFontMap.put("SourceCodePro bold", "SourceCodePro-Bold.ttf");
|
||||
@@ -342,26 +324,15 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("Roboto light", "Roboto-Light.ttf");
|
||||
jreFontMap.put("Roboto thin", "Roboto-Thin.ttf");
|
||||
|
||||
ideaFontSet = new HashSet<>();
|
||||
ideaFontSet.add("FiraCode-Bold.ttf");
|
||||
ideaFontSet.add("FiraCode-Light.ttf");
|
||||
ideaFontSet.add("FiraCode-Medium.ttf");
|
||||
ideaFontSet.add("FiraCode-Retina.ttf");
|
||||
ideaFontSet.add("FiraCode-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-BoldIt.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Bold.ttf");
|
||||
ideaFontSet.add("SourceCodePro-It.ttf");
|
||||
ideaFontSet.add("Inconsolata.ttf");
|
||||
ideaFontSet.add("Roboto-Light.ttf");
|
||||
ideaFontSet.add("Roboto-Thin.ttf");
|
||||
jreFamilyMap.put("Roboto-Light", "Roboto Light");
|
||||
jreFamilyMap.put("Roboto-Thin", "Roboto Thin");
|
||||
|
||||
ttFilterIdea = new TTFilterIdea(true, ideaFontSet);
|
||||
ttFilterJre = new TTFilterIdea(false, ideaFontSet);
|
||||
jreFontMap.put("JetBrains Mono Bold", "JetBrainsMono-Bold.ttf");
|
||||
jreFontMap.put("JetBrains Mono Regular", "JetBrainsMono-Regular.ttf");
|
||||
jreFontMap.put("JetBrains Mono Italic", "JetBrainsMono-Italic.ttf");
|
||||
jreFontMap.put("JetBrains Mono Bold Italic", "JetBrainsMono-Bold-Italic.ttf");
|
||||
|
||||
for (String ffile : jreFontMap.values()) {
|
||||
jreBundledFontFiles.add(ffile);
|
||||
}
|
||||
jreBundledFontFiles.addAll(jreFontMap.values());
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -3364,14 +3335,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
protected void registerJREFonts() {
|
||||
File pathFile = new File(jreFontDirName);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterIdea,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.IDEA_RANK,
|
||||
true, false);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterJre,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.JRE_RANK,
|
||||
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
|
||||
true, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@ public class TrueTypeFont extends FileFont {
|
||||
private String localeFullName;
|
||||
|
||||
private Byte supportedCharset;
|
||||
private int fontDataSize;
|
||||
|
||||
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
|
||||
boolean javaRasterizer)
|
||||
@@ -539,11 +540,13 @@ public class TrueTypeFont extends FileFont {
|
||||
fontIndex = fIndex;
|
||||
buffer = readBlock(TTCHEADERSIZE+4*fIndex, 4);
|
||||
headerOffset = buffer.getInt();
|
||||
fontDataSize = Math.max(0, fileSize - headerOffset);
|
||||
break;
|
||||
|
||||
case v1ttTag:
|
||||
case trueTag:
|
||||
case ottoTag:
|
||||
fontDataSize = fileSize;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1780,6 +1783,11 @@ public class TrueTypeFont extends FileFont {
|
||||
|
||||
private static native void getSupportedCharsetsForFamily(String familyName, Map<String, Byte> supportedCharsets);
|
||||
|
||||
@Override
|
||||
int getFontDataSize() {
|
||||
return fontDataSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "** TrueType Font: Family="+familyName+ " Name="+fullName+
|
||||
|
||||
BIN
src/java.desktop/share/fonts/JetBrainsMono-Bold-Italic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Bold-Italic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Bold.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Bold.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Italic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Italic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Regular.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Regular.ttf
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
169
|
||||
449
|
||||
DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-adobe-standard
|
||||
DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-ascii-0
|
||||
DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
@@ -168,3 +168,283 @@ DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-ru
|
||||
DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-u
|
||||
DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-uni
|
||||
DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-ascii-0
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-koi8-e
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-koi8-r
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-koi8-u
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
FiraCode-Bold.ttf -misc-fira code-bold-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-ascii-0
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-koi8-e
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-koi8-r
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-koi8-u
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
FiraCode-Light.ttf -misc-fira code light-light-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-ascii-0
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-koi8-e
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-koi8-r
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-koi8-u
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
FiraCode-Medium.ttf -misc-fira code medium-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-ascii-0
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-koi8-e
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-koi8-r
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-koi8-u
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
FiraCode-Regular.ttf -misc-fira code-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-ascii-0
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-koi8-e
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-koi8-r
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-koi8-u
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
FiraCode-Retina.ttf -misc-fira code retina-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-ascii-0
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-iso10646-1
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-iso8859-1
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-iso8859-15
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-iso8859-2
|
||||
Inconsolata.ttf -misc-inconsolata-medium-r-normal--0-0-0-0-c-0-iso8859-9
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-ascii-0
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso10646-1
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-1
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-10
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-13
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-15
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-16
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-2
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-3
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-4
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-iso8859-9
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-koi8-r
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-koi8-u
|
||||
JetBrainsMono-Bold-Italic.ttf -misc-jetbrains mono-bold-i-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-ascii-0
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-10
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-13
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-15
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-16
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-3
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-koi8-r
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-koi8-u
|
||||
JetBrainsMono-Bold.ttf -misc-jetbrains mono-bold-r-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-ascii-0
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso10646-1
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-1
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-10
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-13
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-15
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-16
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-2
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-3
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-4
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-iso8859-9
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-koi8-r
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-koi8-u
|
||||
JetBrainsMono-Italic.ttf -misc-jetbrains mono-medium-i-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-ascii-0
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-10
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-13
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-15
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-16
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-3
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-koi8-r
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-koi8-u
|
||||
JetBrainsMono-Regular.ttf -misc-jetbrains mono-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-adobe-standard
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-ascii-0
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-10
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-13
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-15
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-16
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-3
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-5
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-koi8-e
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-koi8-r
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-koi8-ru
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-koi8-u
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-koi8-uni
|
||||
Roboto-Light.ttf -misc-roboto light-light-r-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-adobe-standard
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-ascii-0
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso10646-1
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-1
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-10
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-13
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-15
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-2
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-3
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-4
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-5
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-iso8859-9
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-koi8-e
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-koi8-r
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-koi8-ru
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-koi8-u
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-koi8-uni
|
||||
Roboto-Thin.ttf -misc-roboto thin-light-r-normal--0-0-0-0-p-0-microsoft-cp1252
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-adobe-standard
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-ascii-0
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-ibm-cp437
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-koi8-e
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-koi8-r
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-koi8-u
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
SourceCodePro-Bold.ttf -adobe-source code pro-bold-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-adobe-standard
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-ascii-0
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-ibm-cp850
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-ibm-cp852
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso10646-1
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-1
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-10
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-13
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-15
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-16
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-2
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-3
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-4
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-iso8859-9
|
||||
SourceCodePro-BoldIt.ttf -adobe-source code pro-bold-i-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-adobe-standard
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-ascii-0
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-ibm-cp850
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-ibm-cp852
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso10646-1
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-1
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-10
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-13
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-15
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-16
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-2
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-3
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-4
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-iso8859-9
|
||||
SourceCodePro-It.ttf -adobe-source code pro-medium-i-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-adobe-standard
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-ascii-0
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-ibm-cp437
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-ibm-cp850
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-ibm-cp852
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-ibm-cp866
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso10646-1
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-1
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-10
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-13
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-15
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-16
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-2
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-3
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-4
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-5
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-iso8859-9
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-koi8-e
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-koi8-r
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-koi8-ru
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-koi8-u
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-koi8-uni
|
||||
SourceCodePro-Regular.ttf -adobe-source code pro-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
|
||||
|
||||
@@ -30,14 +30,12 @@
|
||||
#include "sun_font_FreetypeFontScaler.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(_WIN32) || defined(MACOSX)
|
||||
#define DISABLE_FONTCONFIG
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
#if !defined(_WIN32) && !defined(__APPLE_)
|
||||
#include <dlfcn.h>
|
||||
#else
|
||||
#define DISABLE_FONTCONFIG
|
||||
#endif
|
||||
|
||||
#include "ft2build.h"
|
||||
@@ -48,6 +46,7 @@
|
||||
#include FT_SIZES_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_SYNTHESIS_H
|
||||
#include FT_MODULE_H
|
||||
#include FT_LCD_FILTER_H
|
||||
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
@@ -447,6 +446,52 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream,
|
||||
}
|
||||
}
|
||||
|
||||
typedef FT_Error (*FT_Prop_Set_Func)(FT_Library library,
|
||||
const FT_String* module_name,
|
||||
const FT_String* property_name,
|
||||
const void* value );
|
||||
|
||||
/**
|
||||
* Prefer the older v35 freetype byte code interpreter.
|
||||
*/
|
||||
static void setInterpreterVersion(FT_Library library) {
|
||||
|
||||
char* props = getenv("FREETYPE_PROPERTIES");
|
||||
int version = 35;
|
||||
const char* module = "truetype";
|
||||
const char* property = "interpreter-version";
|
||||
|
||||
/* If some one is setting this, don't override it */
|
||||
if (props != NULL && strstr(property, props)) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* FT_Property_Set was introduced in 2.4.11.
|
||||
* Some older supported Linux OSes may not include it so look
|
||||
* this up dynamically.
|
||||
* And if its not available it doesn't matter, since the reason
|
||||
* we need it dates from 2.7.
|
||||
* On Windows & Mac the library is always bundled so it is safe
|
||||
* to use directly in those cases.
|
||||
*/
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
FT_Property_Set(library, module, property, (void*)(&version));
|
||||
#else
|
||||
void *lib = dlopen("libfreetype.so", RTLD_LOCAL|RTLD_LAZY);
|
||||
if (lib == NULL) {
|
||||
lib = dlopen("libfreetype.so.6", RTLD_LOCAL|RTLD_LAZY);
|
||||
if (lib == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
FT_Prop_Set_Func func = (FT_Prop_Set_Func)dlsym(lib, "FT_Property_Set");
|
||||
if (func != NULL) {
|
||||
func(library, module, property, (void*)(&version));
|
||||
}
|
||||
dlclose(lib);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_FreetypeFontScaler
|
||||
* Method: initNativeScaler
|
||||
@@ -486,6 +531,7 @@ Java_sun_font_FreetypeFontScaler_initNativeScaler(
|
||||
free(scalerInfo);
|
||||
return 0;
|
||||
}
|
||||
setInterpreterVersion(scalerInfo->library);
|
||||
|
||||
#define TYPE1_FROM_JAVA 2
|
||||
|
||||
@@ -662,16 +708,40 @@ static void setupLoadRenderFlags(FTScalerContext *context, int fcHintStyle, FcBo
|
||||
}
|
||||
#endif
|
||||
|
||||
// values used by FreeType (as of version 2.10.1) for italics transformation matrix in FT_GlyphSlot_Oblique
|
||||
#define FT_MATRIX_ONE 0x10000
|
||||
#define FT_MATRIX_OBLIQUE_XY 0x0366A
|
||||
|
||||
static void setupTransform(FT_Matrix* target, FTScalerContext *context) {
|
||||
FT_Matrix* transform = &context->transform;
|
||||
if (context->doItalize) {
|
||||
// we cannot use FT_GlyphSlot_Oblique as it doesn't work well with arbitrary transforms,
|
||||
// so we add corresponding shear transform to the requested glyph transformation
|
||||
target->xx = FT_MATRIX_ONE;
|
||||
target->xy = FT_MATRIX_OBLIQUE_XY;
|
||||
target->yx = 0;
|
||||
target->yy = FT_MATRIX_ONE;
|
||||
FT_Matrix_Multiply(transform, target);
|
||||
} else {
|
||||
target->xx = transform->xx;
|
||||
target->xy = transform->xy;
|
||||
target->yx = transform->yx;
|
||||
target->yy = transform->yy;
|
||||
}
|
||||
}
|
||||
|
||||
static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo, FTScalerContext *context,
|
||||
FT_Bool configureFont) {
|
||||
FT_Matrix matrix;
|
||||
int errCode = 0;
|
||||
scalerInfo->env = env;
|
||||
scalerInfo->font2D = font2D;
|
||||
|
||||
if (context != NULL) {
|
||||
FT_UInt dpi = (FT_UInt) getScreenResolution(env);
|
||||
FT_Set_Transform(scalerInfo->face, &context->transform, NULL);
|
||||
setupTransform(&matrix, context);
|
||||
FT_Set_Transform(scalerInfo->face, &matrix, NULL);
|
||||
|
||||
FT_UInt dpi = (FT_UInt) getScreenResolution(env);
|
||||
errCode = FT_Set_Char_Size(scalerInfo->face, 0, ADJUST_FONT_SIZE(context->ptsz, dpi), dpi, dpi);
|
||||
if (errCode) return errCode;
|
||||
|
||||
@@ -869,11 +939,8 @@ static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ftsynth.c uses (0x10000, 0x0366A, 0x0, 0x10000) matrix to get oblique
|
||||
outline. Therefore x coordinate will change by 0x0366A*y.
|
||||
Note that y coordinate does not change. These values are based on
|
||||
libfreetype version 2.9.1. */
|
||||
#define OBLIQUE_MODIFIER(y) (context->doItalize ? ((y)*0x366A/0x10000) : 0)
|
||||
// using same values as for the transformation matrix
|
||||
#define OBLIQUE_MODIFIER(y) (context->doItalize ? ((y)*FT_MATRIX_OBLIQUE_XY/FT_MATRIX_ONE) : 0)
|
||||
|
||||
/* FT_GlyphSlot_Embolden (ftsynth.c) uses FT_MulFix(units_per_EM, y_scale) / 24
|
||||
* strength value when glyph format is FT_GLYPH_FORMAT_OUTLINE. This value has
|
||||
@@ -1242,9 +1309,6 @@ Java_sun_font_FreetypeFontScaler_getGlyphImageNative(
|
||||
if (context->doBold) { /* if bold style */
|
||||
FT_GlyphSlot_Embolden(ftglyph);
|
||||
}
|
||||
if (context->doItalize) { /* if oblique */
|
||||
FT_GlyphSlot_Oblique(ftglyph);
|
||||
}
|
||||
|
||||
/* generate bitmap if it is not done yet
|
||||
e.g. if algorithmic styling is performed and style was added to outline */
|
||||
@@ -1470,9 +1534,6 @@ static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
|
||||
if (context->doBold) { /* if bold style */
|
||||
FT_GlyphSlot_Embolden(ftglyph);
|
||||
}
|
||||
if (context->doItalize) { /* if oblique */
|
||||
FT_GlyphSlot_Oblique(ftglyph);
|
||||
}
|
||||
|
||||
FT_Outline_Translate(&ftglyph->outline,
|
||||
FloatToF26Dot6(xpos),
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
|
||||
#include "hb.h"
|
||||
#include "hb-jdk.h"
|
||||
#ifdef MACOSX
|
||||
#include "hb-coretext.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
@@ -370,12 +367,6 @@ JNIEXPORT jlong JNICALL Java_sun_font_SunLayoutEngine_createFace(JNIEnv *env,
|
||||
jobject font2D,
|
||||
jboolean aat,
|
||||
jlong platformFontPtr) {
|
||||
#ifdef MACOSX
|
||||
if (aat && platformFontPtr) {
|
||||
hb_face_t *face = hb_coretext_face_create((CGFontRef)platformFontPtr);
|
||||
return ptr_to_jlong(face);
|
||||
}
|
||||
#endif
|
||||
Font2DPtr *fi = (Font2DPtr*)malloc(sizeof(Font2DPtr));
|
||||
if (!fi) {
|
||||
return 0;
|
||||
@@ -423,26 +414,8 @@ static hb_font_t* _hb_jdk_font_create(hb_face_t* face,
|
||||
return font;
|
||||
}
|
||||
|
||||
#ifdef MACOSX
|
||||
static hb_font_t* _hb_jdk_ct_font_create(hb_face_t* face,
|
||||
JDKFontInfo *jdkFontInfo) {
|
||||
|
||||
hb_font_t *font = NULL;
|
||||
font = hb_font_create(face);
|
||||
hb_font_set_scale(font,
|
||||
HBFloatToFixed(jdkFontInfo->ptSize),
|
||||
HBFloatToFixed(jdkFontInfo->ptSize));
|
||||
return font;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_font_t* hb_jdk_font_create(hb_face_t* hbFace,
|
||||
JDKFontInfo *jdkFontInfo,
|
||||
hb_destroy_func_t destroy) {
|
||||
#ifdef MACOSX
|
||||
if (jdkFontInfo->aat && jdkFontInfo->nativeFont) {
|
||||
return _hb_jdk_ct_font_create(hbFace, jdkFontInfo);
|
||||
}
|
||||
#endif
|
||||
return _hb_jdk_font_create(hbFace, jdkFontInfo, destroy);
|
||||
}
|
||||
|
||||
@@ -586,17 +586,21 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
||||
return false;
|
||||
}
|
||||
|
||||
x = (int)(xclient.get_data(2) >> 16);
|
||||
y = (int)(xclient.get_data(2) & 0xFFFF);
|
||||
|
||||
XWindow xwindow = null;
|
||||
{
|
||||
XBaseWindow xbasewindow = XToolkit.windowToXWindow(xclient.get_window());
|
||||
if (xbasewindow instanceof XWindow) {
|
||||
xwindow = (XWindow)xbasewindow;
|
||||
// xclient can be a system-generated or a sent event (see XDragSourceContextPeer)
|
||||
// so x/y is expected to be presented in device space
|
||||
x = xbasewindow.scaleDown(x);
|
||||
y = xbasewindow.scaleDown(y);
|
||||
}
|
||||
}
|
||||
|
||||
x = (int)(xclient.get_data(2) >> 16);
|
||||
y = (int)(xclient.get_data(2) & 0xFFFF);
|
||||
|
||||
if (xwindow == null) {
|
||||
long receiver =
|
||||
XDropTargetRegistry.getRegistry().getEmbeddedDropSite(
|
||||
|
||||
@@ -524,8 +524,9 @@ public final class XDragSourceContextPeer
|
||||
updateTargetWindow(xmotion);
|
||||
|
||||
if (dragProtocol != null) {
|
||||
dragProtocol.sendMoveMessage(scaleDown(xmotion.get_x_root()),
|
||||
scaleDown(xmotion.get_y_root()),
|
||||
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
|
||||
dragProtocol.sendMoveMessage(xmotion.get_x_root(),
|
||||
xmotion.get_y_root(),
|
||||
sourceAction, sourceActions,
|
||||
xmotion.get_time());
|
||||
}
|
||||
@@ -533,8 +534,9 @@ public final class XDragSourceContextPeer
|
||||
|
||||
private void processDrop(XButtonEvent xbutton) {
|
||||
try {
|
||||
dragProtocol.initiateDrop(scaleDown(xbutton.get_x_root()),
|
||||
scaleDown(xbutton.get_y_root()),
|
||||
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
|
||||
dragProtocol.initiateDrop(xbutton.get_x_root(),
|
||||
xbutton.get_y_root(),
|
||||
sourceAction, sourceActions,
|
||||
xbutton.get_time());
|
||||
} catch (XException e) {
|
||||
|
||||
@@ -72,16 +72,16 @@ public class XInputMethod extends X11InputMethod {
|
||||
return createXICNative(peer.getContentWindow());
|
||||
}
|
||||
|
||||
protected boolean recreateXIC() {
|
||||
protected boolean recreateXIC(int ctxid) {
|
||||
final XComponentPeer peer = (XComponentPeer)getPeer(clientComponentWindow);
|
||||
if (peer == null || pData == 0)
|
||||
return true;
|
||||
return recreateXICNative(peer.getContentWindow(), pData);
|
||||
return recreateXICNative(peer.getContentWindow(), pData, ctxid);
|
||||
}
|
||||
protected void releaseXIC() {
|
||||
protected int releaseXIC() {
|
||||
if (pData == 0)
|
||||
return;
|
||||
releaseXICNative(pData);
|
||||
return 0;
|
||||
return releaseXICNative(pData);
|
||||
}
|
||||
|
||||
private static volatile long xicFocus = 0;
|
||||
@@ -161,8 +161,8 @@ public class XInputMethod extends X11InputMethod {
|
||||
*/
|
||||
private native boolean openXIMNative(long display);
|
||||
private native boolean createXICNative(long window);
|
||||
private native boolean recreateXICNative(long window, long px11data);
|
||||
private native void releaseXICNative(long px11data);
|
||||
private native boolean recreateXICNative(long window, long px11data, int ctxid);
|
||||
private native int releaseXICNative(long px11data);
|
||||
private native void setXICFocusNative(long window,
|
||||
boolean value, boolean active);
|
||||
private native void adjustStatusWindow(long window);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -34,6 +35,7 @@ import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.text.AttributedString;
|
||||
import java.util.Map;
|
||||
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
@@ -364,19 +366,21 @@ public abstract class X11InputMethod extends X11InputMethodBase {
|
||||
|
||||
static void recreateAllXIC() {
|
||||
// NOTE: called from native within AWT_LOCK
|
||||
for (X11InputMethod im : activeInputMethods)
|
||||
im.releaseXIC();
|
||||
Map<X11InputMethod, Integer> im2ctxid = new HashMap<>(activeInputMethods.size());
|
||||
for (X11InputMethod im : activeInputMethods) {
|
||||
im2ctxid.put(im, im.releaseXIC());
|
||||
}
|
||||
if (!recreateX11InputMethod()) {
|
||||
log.warning("can't recreate X11 InputMethod");
|
||||
return;
|
||||
}
|
||||
for (X11InputMethod im : activeInputMethods) {
|
||||
if (!im.recreateXIC())
|
||||
if (!im.recreateXIC(im2ctxid.get(im)))
|
||||
log.warning("can't recreate XIC for " + im.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean recreateXIC();
|
||||
protected abstract void releaseXIC();
|
||||
protected abstract boolean recreateXIC(int ctxid);
|
||||
protected abstract int releaseXIC();
|
||||
private static native boolean recreateX11InputMethod();
|
||||
}
|
||||
|
||||
@@ -1423,21 +1423,35 @@ finally:
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_recreateXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong window, jlong pData)
|
||||
jlong window, jlong pData, jint ctxid)
|
||||
{
|
||||
// NOTE: must be called under AWT_LOCK
|
||||
return createXIC(env, (X11InputMethodData *)pData, window);
|
||||
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
|
||||
jboolean result = createXIC(env, pX11IMData, window);
|
||||
if (result) {
|
||||
if (ctxid == 1)
|
||||
pX11IMData->current_ic = pX11IMData->ic_active;
|
||||
else if (ctxid == 2)
|
||||
pX11IMData->current_ic = pX11IMData->ic_passive;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JNIEXPORT int JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_releaseXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong pData)
|
||||
{
|
||||
// NOTE: must be called under AWT_LOCK
|
||||
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
|
||||
int result = 0;
|
||||
if (pX11IMData->current_ic == pX11IMData->ic_active)
|
||||
result = 1;
|
||||
else if (pX11IMData->current_ic == pX11IMData->ic_passive)
|
||||
result = 2;
|
||||
pX11IMData->current_ic = NULL;
|
||||
destroyXInputContexts(pX11IMData);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -324,8 +324,6 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
/* GDK */
|
||||
fp_gdk_get_default_root_window =
|
||||
dl_symbol("gdk_get_default_root_window");
|
||||
fp_gdk_window_get_scale_factor =
|
||||
dl_symbol("gdk_window_get_scale_factor");
|
||||
|
||||
/* Pixbuf */
|
||||
fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new");
|
||||
@@ -400,6 +398,8 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
} else {
|
||||
fp_gdk_window_create_similar_image_surface =
|
||||
dl_symbol("gdk_window_create_similar_image_surface");
|
||||
fp_gdk_window_get_scale_factor =
|
||||
dl_symbol("gdk_window_get_scale_factor");
|
||||
}
|
||||
gtk3_version_3_14 = !fp_gtk_check_version(3, 14, 0);
|
||||
|
||||
@@ -2892,9 +2892,13 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
|
||||
jint *ary;
|
||||
|
||||
GdkWindow *root = (*fp_gdk_get_default_root_window)();
|
||||
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
|
||||
root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5));
|
||||
if (gtk3_version_3_10) {
|
||||
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
|
||||
root, x, y, (int) (width / (float) win_scale + 0.5), (int) (height / (float) win_scale + 0.5));
|
||||
} else {
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
|
||||
}
|
||||
|
||||
if (pixbuf && scale != 1) {
|
||||
GdkPixbuf *scaledPixbuf;
|
||||
|
||||
@@ -956,6 +956,10 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative
|
||||
return XRenderCreateGlyphSet(awt_display, (XRenderPictFormat *) jlong_to_ptr(format));
|
||||
}
|
||||
|
||||
static jboolean fits16Bit(jint x) {
|
||||
return (((x & 0xffff8000) + 0x8000) & 0xffff0000) == 0 ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
|
||||
(JNIEnv *env, jclass cls, jint op, jint src, jint dst,
|
||||
@@ -970,6 +974,11 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
|
||||
unsigned int sids[256];
|
||||
int charCnt = 0;
|
||||
|
||||
if (fits16Bit(sx) == JNI_FALSE || fits16Bit(sy) == JNI_FALSE) {
|
||||
// X Rendering Extension protocol supports only 16-bit initial coordinates
|
||||
return;
|
||||
}
|
||||
|
||||
if ((MAX_PAYLOAD / sizeof(XGlyphElt32) < (unsigned)eltCnt)
|
||||
|| (MAX_PAYLOAD / sizeof(unsigned int) < (unsigned)glyphCnt)
|
||||
|| ((MAX_PAYLOAD - sizeof(XGlyphElt32)*(unsigned)eltCnt) /
|
||||
|
||||
@@ -669,7 +669,7 @@ static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
|
||||
if (parsedVal > 0)
|
||||
filteredEventsThreshold = parsedVal;
|
||||
else if (strncmp(utf8string, "true", 4) == 0)
|
||||
filteredEventsThreshold = 10;
|
||||
filteredEventsThreshold = 5;
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
|
||||
}
|
||||
|
||||
@@ -1758,7 +1758,7 @@ void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
|
||||
int dpi = device ? device->GetScaleX() * 96 : 96;
|
||||
|
||||
// GetSystemMetricsForDpi gives incorrect values, use AdjustWindowRectExForDpi for border metrics instead
|
||||
RECT rect = {0};
|
||||
RECT rect = {};
|
||||
DWORD style = pFrame->IsResizable() ? WS_OVERLAPPEDWINDOW : WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;
|
||||
AwtToolkit::AdjustWindowRectExForDpi(&rect, style, FALSE, NULL, dpi);
|
||||
::SetRect(insets, -rect.left, -rect.top, rect.right, rect.bottom);
|
||||
@@ -1772,7 +1772,7 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
|
||||
GetWindowRect(frame->GetHWnd(), &rcWindow);
|
||||
|
||||
// Get the frame rectangle, adjusted for the style without a caption.
|
||||
RECT rcFrame = {0};
|
||||
RECT rcFrame = {};
|
||||
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
|
||||
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
@@ -171,8 +171,8 @@ JNIEXPORT jboolean JNICALL
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
|
||||
(JNIEnv *env, jobject unused,
|
||||
jstring fontFamily, jint style, jint size, jint glyphCode, jboolean fm, jint rotation, jbyte charset) {
|
||||
(JNIEnv *env, jobject unused, jstring fontFamily, jint style, jint size,
|
||||
jint glyphCode, jboolean fm, jint rotation, jbyte charset, jint fontDataSize) {
|
||||
|
||||
GLYPHMETRICS glyphMetrics;
|
||||
LOGFONTW lf;
|
||||
@@ -188,6 +188,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
|
||||
LPWSTR name;
|
||||
HFONT oldFont, hFont;
|
||||
MAT2 mat2;
|
||||
DWORD actualFontDataSize;
|
||||
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
@@ -255,6 +256,17 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
|
||||
}
|
||||
oldFont = SelectObject(hMemoryDC, hFont);
|
||||
|
||||
if (fontDataSize > 0) {
|
||||
// We cannot specify via GDI which font file to use,
|
||||
// so we check that it picks the exact font we need by validating font size.
|
||||
// If it doesn't match, we cannot proceed, as same glyph code can correspond
|
||||
// to a completely different glyph in the selected font.
|
||||
actualFontDataSize = GetFontData(hMemoryDC, 0, 0, NULL, 0);
|
||||
if (actualFontDataSize != fontDataSize) {
|
||||
FREE_AND_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
tmpBitmap = CreateCompatibleBitmap(hDesktopDC, 1, 1);
|
||||
if (tmpBitmap == NULL) {
|
||||
FREE_AND_RETURN;
|
||||
|
||||
@@ -42,18 +42,20 @@ applications/jcstress/acqrel/Test.java generic-all
|
||||
|
||||
# :hotspot_compiler
|
||||
|
||||
compiler/ciReplay/TestSAServer.java 8029528 generic-all
|
||||
compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
|
||||
compiler/codegen/Test6896617.java 8193479 generic-all
|
||||
compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
|
||||
compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all
|
||||
compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
|
||||
compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
|
||||
compiler/tiered/LevelTransitionTest.java 8067651 generic-all
|
||||
compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
|
||||
compiler/types/correctness/OffTest.java 8066173 generic-all
|
||||
compiler/ciReplay/TestSAServer.java 8029528 generic-all
|
||||
compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
|
||||
compiler/codegen/Test6896617.java 8193479 generic-all
|
||||
compiler/codegen/aes/TestCipherBlockChainingEncrypt.java 8219513 generic-all
|
||||
compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
|
||||
compiler/jsr292/ContinuousCallSiteTargetChange.java 8222030 generic-all
|
||||
compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all
|
||||
compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
|
||||
compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
|
||||
compiler/tiered/LevelTransitionTest.java 8067651 generic-all
|
||||
compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
|
||||
compiler/types/correctness/OffTest.java 8066173 generic-all
|
||||
|
||||
compiler/c2/Test6852078.java 8194310 generic-all
|
||||
compiler/c2/Test6852078.java 8194310 generic-all
|
||||
|
||||
applications/ctw/modules/java_desktop.java 8189604 windows-all
|
||||
applications/ctw/modules/java_desktop_2.java 8189604,8204842 generic-all
|
||||
@@ -65,14 +67,15 @@ compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
|
||||
|
||||
# :hotspot_gc
|
||||
|
||||
gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java 8156755 generic-all
|
||||
gc/survivorAlignment/TestPromotionToSurvivor.java 8129886 generic-all
|
||||
gc/g1/logging/TestG1LoggingFailure.java 8169634 generic-all
|
||||
gc/g1/humongousObjects/TestHeapCounters.java 8178918 generic-all
|
||||
gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
|
||||
gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
|
||||
gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 8177765 generic-all
|
||||
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
|
||||
gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java 8156755 generic-all
|
||||
gc/survivorAlignment/TestPromotionToSurvivor.java 8129886 generic-all
|
||||
gc/g1/logging/TestG1LoggingFailure.java 8169634 generic-all
|
||||
gc/g1/humongousObjects/TestHeapCounters.java 8178918 generic-all
|
||||
gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
|
||||
gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
|
||||
gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 8177765 generic-all
|
||||
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
|
||||
gc/stress/TestReclaimStringsLeaksMemory.java 8224847 generic-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
@@ -80,6 +83,9 @@ gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
|
||||
|
||||
runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
|
||||
runtime/NMT/MallocStressTest.java 8079353 generic-all
|
||||
runtime/SelectionResolution/InvokeInterfaceICCE.java 8224795 generic-all
|
||||
runtime/SelectionResolution/InvokeVirtualICCE.java 8224795 generic-all
|
||||
runtime/SelectionResolution/InvokeVirtualSuccessTest.java 8224795 generic-all
|
||||
runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java 8013728 generic-all
|
||||
runtime/memory/ReadFromNoaccessArea.java nobug generic-all crash is the expected behaviour
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FileDialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 8234522
|
||||
* @requires (os.family == "mac")
|
||||
*/
|
||||
public final class MacOSGoToFolderCrash {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
EventQueue.invokeLater(() -> {
|
||||
FileDialog fd = new FileDialog((Frame) null);
|
||||
fd.setVisible(true);
|
||||
});
|
||||
Robot robot = new Robot();
|
||||
robot.setAutoDelay(400);
|
||||
robot.waitForIdle();
|
||||
// "⌘+Shift+G" – Open "Go To Folder" window
|
||||
robot.keyPress(KeyEvent.VK_META);
|
||||
robot.keyPress(KeyEvent.VK_SHIFT);
|
||||
robot.keyPress(KeyEvent.VK_G);
|
||||
robot.keyRelease(KeyEvent.VK_G);
|
||||
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||
robot.keyRelease(KeyEvent.VK_META);
|
||||
// Select something
|
||||
robot.keyPress(KeyEvent.VK_DOWN);
|
||||
robot.keyRelease(KeyEvent.VK_DOWN);
|
||||
robot.keyPress(KeyEvent.VK_ENTER);
|
||||
robot.keyRelease(KeyEvent.VK_ENTER);
|
||||
// Close File dialog
|
||||
robot.keyPress(KeyEvent.VK_ESCAPE);
|
||||
robot.keyRelease(KeyEvent.VK_ESCAPE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class JEditorPanePreferredSizeTest3 {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Exception[] exception = new Exception[1];
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
JEditorPane editorPane = createEditor();
|
||||
Dimension initialSize = editorPane.getPreferredSize();
|
||||
JEditorPane anotherPane = createEditor();
|
||||
anotherPane.setSize(initialSize.width / 2, initialSize.height);
|
||||
Dimension newSize = anotherPane.getPreferredSize();
|
||||
if (newSize.height <= initialSize.height) {
|
||||
exception[0] = new RuntimeException("Unexpected size: " + newSize + ", initial size: " + initialSize);
|
||||
}
|
||||
});
|
||||
if (exception[0] != null) throw exception[0];
|
||||
}
|
||||
|
||||
private static JEditorPane createEditor() {
|
||||
return new JEditorPane("text/html", "Very long line");
|
||||
}
|
||||
}
|
||||
186
test/jdk/jb/java/awt/Focus/ChainOfPopupsFocusTest.java
Normal file
186
test/jdk/jb/java/awt/Focus/ChainOfPopupsFocusTest.java
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.FocusTraversalPolicy;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-1417: JBR 11 does not support chain of popups
|
||||
* @requires (jdk.version.major >= 8)
|
||||
* @run main ChainOfPopupsFocusTest
|
||||
*/
|
||||
|
||||
/*
|
||||
* Description: Test checks that focus goes to the parent popup when child popup is closed.
|
||||
* Test opens several popups one by one, setting current popup as a parent for the next one.
|
||||
* Then the popups are closed one by one. Test fails if focus went somewhere else than the parent popup.
|
||||
*/
|
||||
|
||||
public class ChainOfPopupsFocusTest implements Runnable, ActionListener {
|
||||
|
||||
private static final int DEPTH = 5;
|
||||
private static final String FRAMENAME = "MainFrame";
|
||||
private static final String POPUPNAME = "Popup";
|
||||
|
||||
private static volatile Component focusOwner;
|
||||
private static volatile int popupsCount;
|
||||
private static Robot robot;
|
||||
private JFrame frame;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
|
||||
ChainOfPopupsFocusTest test = new ChainOfPopupsFocusTest();
|
||||
SwingUtilities.invokeAndWait(test);
|
||||
robot.delay(3000);
|
||||
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
|
||||
if(focusOwner == null || !focusOwner.getName().equals(FRAMENAME)) {
|
||||
throw new RuntimeException("Test ERROR: " + FRAMENAME + " is not focused");
|
||||
}
|
||||
|
||||
for (int count = 1; count <= DEPTH; count++) {
|
||||
pressCtrlKey(KeyEvent.VK_N);
|
||||
robot.delay(1000);
|
||||
}
|
||||
|
||||
if(popupsCount != DEPTH) {
|
||||
throw new RuntimeException("Test ERROR: Number of open popups is "
|
||||
+ popupsCount + ", but " + DEPTH + " is expected");
|
||||
}
|
||||
for (int count = DEPTH-1; count >= 0; count--) {
|
||||
pressCtrlKey(KeyEvent.VK_X);
|
||||
robot.delay(1000);
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
|
||||
String focusedComponent = (focusOwner != null ? focusOwner.getName() : "Nothing");
|
||||
String expectedComponent = (count == 0 ? FRAMENAME : POPUPNAME + count);
|
||||
if(!focusedComponent.equals(expectedComponent)) {
|
||||
throw new RuntimeException("Test FAILED: "
|
||||
+ focusedComponent + " is focused instead of " + expectedComponent);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(() -> test.frame.dispose());
|
||||
robot.delay(2000);
|
||||
}
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
|
||||
private static void pressCtrlKey(int vk) {
|
||||
robot.keyPress(KeyEvent.VK_CONTROL);
|
||||
robot.keyPress(vk);
|
||||
robot.keyRelease(vk);
|
||||
robot.keyRelease(KeyEvent.VK_CONTROL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
JTextArea area = createTextArea(FRAMENAME);
|
||||
frame = new JFrame(getClass().getSimpleName());
|
||||
frame.add(new JScrollPane(area));
|
||||
frame.pack();
|
||||
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
frame.toFront();
|
||||
area.requestFocusInWindow();
|
||||
}
|
||||
|
||||
private JTextArea createTextArea(String locatedOn) {
|
||||
JTextArea area = new JTextArea(20, 40);
|
||||
area.setName(locatedOn);
|
||||
area.registerKeyboardAction(this, "show", KeyStroke.getKeyStroke("control N"), JComponent.WHEN_FOCUSED);
|
||||
area.registerKeyboardAction(event -> SwingUtilities.getWindowAncestor((Component) event.getSource()).setVisible(false), KeyStroke.getKeyStroke("control X"), JComponent.WHEN_FOCUSED);
|
||||
area.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentShown(ComponentEvent event) {
|
||||
area.requestFocus();
|
||||
}
|
||||
});
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Component source = (Component) event.getSource();
|
||||
switch (event.getActionCommand()) {
|
||||
case "show":
|
||||
Point point = source.getLocationOnScreen();
|
||||
Component area = createTextArea(POPUPNAME + ++popupsCount);
|
||||
Popup popup = PopupFactory.getSharedInstance().getPopup(source, new JScrollPane(area), point.x + 10, point.y + 10);
|
||||
Window window = SwingUtilities.getWindowAncestor(area);
|
||||
window.setAutoRequestFocus(true);
|
||||
window.setFocusable(true);
|
||||
window.setFocusableWindowState(true);
|
||||
window.setFocusTraversalPolicy(new FocusTraversalPolicy() {
|
||||
@Override
|
||||
public Component getComponentAfter(Container container, Component component) {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponentBefore(Container container, Component component) {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getFirstComponent(Container container) {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getLastComponent(Container container) {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDefaultComponent(Container container) {
|
||||
return area;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
break;
|
||||
case "hide":
|
||||
SwingUtilities.getWindowAncestor(source).setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ cd ${TESTSRC}
|
||||
${TESTJAVA}/bin/javac -d ${TESTCLASSES} Font430.java
|
||||
|
||||
${TESTJAVA}/bin/java -cp ${TESTCLASSES} Font430 t1.bmp true
|
||||
${TESTJAVA}/bin/java -cp ${TESTCLASSES} Font430 t2.bmp true
|
||||
${TESTJAVA}/bin/java -cp ${TESTCLASSES} Font430 t2.bmp false
|
||||
|
||||
cmp t1.bmp t2.bmp
|
||||
exit_code=$?
|
||||
@@ -49,6 +49,7 @@ case $exit_code in
|
||||
0) echo "PASSED"
|
||||
;;
|
||||
*) echo "FAILED: $exit_code"
|
||||
mv t[1..2].bmp ${TESTCLASSES}
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
166
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Key.java
Normal file
166
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Key.java
Normal file
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* Class containing common key functionality
|
||||
*/
|
||||
public class Key {
|
||||
|
||||
// KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
private final String vkName;
|
||||
// KeyChars mapped to the key on the current keyboard layout
|
||||
private final MappedKeyChars mappedKeyChars;
|
||||
|
||||
Key(String vkName, MappedKeyChars mappedKeyChars) {
|
||||
this.vkName = vkName;
|
||||
this.mappedKeyChars = mappedKeyChars;
|
||||
}
|
||||
|
||||
// Returns the virtual key code for US keyboard layout.
|
||||
// Robot only knows US keyboard layout.
|
||||
// So to press some key on the current layout, one needs to pass corresponding US layout key code to Robot.
|
||||
// So every key stores corresponding KeyEvent.VK_ constant name to provide mapping to US layout.
|
||||
int getKeyCode_US() {
|
||||
try {
|
||||
return KeyEvent.class.getField(vkName).getInt(null);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
|
||||
// Returns key code for the current layout.
|
||||
// Key that generates VK_ code when using a US keyboard layout also generates a unique code for other layout.
|
||||
// Test firstly determines char mapped to the key on the current layout
|
||||
// and then uses KeyEvent.getExtendedKeyCodeForChar(c) to get the key code.
|
||||
int getKeyCode() {
|
||||
KeyChar keyChar = mappedKeyChars.getKeyChar();
|
||||
char ch = keyChar.getChar();
|
||||
if (latinKeyCodesMap.containsKey(ch)) {
|
||||
// TODO Fix this in jbruntime
|
||||
// KeyEvent.getExtendedKeyCodeForChar(ch) does not return corresponding VK_ constant for non-English keys
|
||||
return latinKeyCodesMap.get(ch);
|
||||
} else if (keyChar.isDead() && deadKeyCodesMap.containsKey(ch)) {
|
||||
// KeyEvent.getExtendedKeyCodeForChar(ch) does not return corresponding VK_ constant for dead keys
|
||||
return deadKeyCodesMap.get(ch);
|
||||
} else {
|
||||
return KeyEvent.getExtendedKeyCodeForChar(ch);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns key char for the current layout
|
||||
public char getChar(Modifier modifier) {
|
||||
return mappedKeyChars.getKeyChar(modifier).getChar();
|
||||
}
|
||||
|
||||
// Checks if no char is mapped to the modifier + key
|
||||
public boolean isCharNull(Modifier modifier) {
|
||||
return (mappedKeyChars.getKeyChar(modifier).getChar() == Character.MIN_VALUE);
|
||||
}
|
||||
|
||||
// Checks if modifier + key is a shortcut
|
||||
public boolean isCharUndefined(Modifier modifier) {
|
||||
return (mappedKeyChars.getKeyChar(modifier).getChar() == Character.MAX_VALUE);
|
||||
}
|
||||
|
||||
// Checks if key is a dead key, no modifiers
|
||||
public boolean isDead() {
|
||||
return mappedKeyChars.getKeyChar().isDead();
|
||||
}
|
||||
|
||||
// Checks if modifier + key is a dead key, always false for shortcut
|
||||
public boolean isDead(Modifier modifier) {
|
||||
return mappedKeyChars.getKeyChar(modifier).isDead();
|
||||
}
|
||||
|
||||
// TODO Remove this map when KeyEvent.getExtendedKeyCodeForChar(ch) is fixed for latin keys in jbruntime
|
||||
// Map storing latin chars and corresponding VK_ codes
|
||||
private static final HashMap<Character, Integer> latinKeyCodesMap = new HashMap<Character, Integer>() {
|
||||
{
|
||||
// Please see:
|
||||
// jbruntime/src/java.desktop/share/classes/java/awt/event/KeyEvent.java
|
||||
|
||||
put((char) 0x00E0, KeyEvent.VK_A_WITH_GRAVE);
|
||||
put((char) 0x00E1, KeyEvent.VK_A_WITH_ACUTE);
|
||||
put((char) 0x00E2, KeyEvent.VK_A_WITH_CIRCUMFLEX);
|
||||
put((char) 0x00E3, KeyEvent.VK_A_WITH_TILDE);
|
||||
put((char) 0x00E4, KeyEvent.VK_A_WITH_DIAERESIS);
|
||||
put((char) 0x00E5, KeyEvent.VK_A_WITH_RING_ABOVE);
|
||||
put((char) 0x00E6, KeyEvent.VK_AE);
|
||||
put((char) 0x00E7, KeyEvent.VK_C_WITH_CEDILLA);
|
||||
put((char) 0x00E8, KeyEvent.VK_E_WITH_GRAVE);
|
||||
put((char) 0x00E9, KeyEvent.VK_E_WITH_ACUTE);
|
||||
put((char) 0x00EA, KeyEvent.VK_E_WITH_CIRCUMFLEX);
|
||||
put((char) 0x00EB, KeyEvent.VK_E_WITH_DIAERESIS);
|
||||
put((char) 0x00EC, KeyEvent.VK_I_WITH_GRAVE);
|
||||
put((char) 0x00ED, KeyEvent.VK_I_WITH_GRAVE);
|
||||
put((char) 0x00EE, KeyEvent.VK_I_WITH_CIRCUMFLEX);
|
||||
put((char) 0x00EF, KeyEvent.VK_I_WITH_DIAERESIS);
|
||||
put((char) 0x00F0, KeyEvent.VK_ETH);
|
||||
put((char) 0x00F1, KeyEvent.VK_N_WITH_TILDE);
|
||||
put((char) 0x00F2, KeyEvent.VK_O_WITH_GRAVE);
|
||||
put((char) 0x00F3, KeyEvent.VK_O_WITH_ACUTE);
|
||||
put((char) 0x00F4, KeyEvent.VK_O_WITH_CIRCUMFLEX);
|
||||
put((char) 0x00F5, KeyEvent.VK_O_WITH_TILDE);
|
||||
put((char) 0x00F6, KeyEvent.VK_O_WITH_DIAERESIS);
|
||||
put((char) 0x00F7, KeyEvent.VK_DIVISION_SIGN);
|
||||
put((char) 0x00F8, KeyEvent.VK_O_WITH_SLASH);
|
||||
put((char) 0x00F9, KeyEvent.VK_U_WITH_GRAVE);
|
||||
put((char) 0x00FA, KeyEvent.VK_U_WITH_ACUTE);
|
||||
put((char) 0x00FB, KeyEvent.VK_U_WITH_CIRCUMFLEX);
|
||||
put((char) 0x00FC, KeyEvent.VK_U_WITH_DIAERESIS);
|
||||
put((char) 0x00FD, KeyEvent.VK_Y_WITH_ACUTE);
|
||||
put((char) 0x00FE, KeyEvent.VK_THORN);
|
||||
put((char) 0x00FF, KeyEvent.VK_Y_WITH_DIAERESIS);
|
||||
}
|
||||
};
|
||||
|
||||
// Map storing possible dead key chars and corresponding VK_ codes
|
||||
private static final HashMap<Character, Integer> deadKeyCodesMap = new HashMap<Character, Integer>() {
|
||||
{
|
||||
// Please see:
|
||||
// jbruntime/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
|
||||
// jbruntime/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m
|
||||
|
||||
put((char) 0x02D9, KeyEvent.VK_DEAD_ABOVEDOT);
|
||||
put((char) 0x02DA, KeyEvent.VK_DEAD_ABOVERING);
|
||||
put((char) 0x00B4, KeyEvent.VK_DEAD_ACUTE); // ACUTE ACCENT
|
||||
put((char) 0x0384, KeyEvent.VK_DEAD_ACUTE); // GREEK TONOS
|
||||
// TODO Should test map ' to acute as sometimes it may add either acute or cedilla to the next key
|
||||
//put((char) 0x0027 /* ' */, KeyEvent.VK_DEAD_ACUTE); // APOSTROPHE
|
||||
put((char) 0x02D8, KeyEvent.VK_DEAD_BREVE);
|
||||
put((char) 0x02C7, KeyEvent.VK_DEAD_CARON);
|
||||
put((char) 0x00B8, KeyEvent.VK_DEAD_CEDILLA); // CEDILLA
|
||||
put((char) 0x002C /* , */, KeyEvent.VK_DEAD_CEDILLA); // COMMA
|
||||
put((char) 0x02C6, KeyEvent.VK_DEAD_CIRCUMFLEX); // MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
put((char) 0x005E, KeyEvent.VK_DEAD_CIRCUMFLEX); // CIRCUMFLEX ACCENT
|
||||
put((char) 0x00A8, KeyEvent.VK_DEAD_DIAERESIS); // DIAERESIS
|
||||
put((char) 0x0022 /* " */, KeyEvent.VK_DEAD_DIAERESIS); // QUOTATION MARK
|
||||
put((char) 0x02DD, KeyEvent.VK_DEAD_DOUBLEACUTE);
|
||||
put((char) 0x0060, KeyEvent.VK_DEAD_GRAVE);
|
||||
put((char) 0x037A, KeyEvent.VK_DEAD_IOTA);
|
||||
put((char) 0x02C9, KeyEvent.VK_DEAD_MACRON); // MODIFIER LETTER MACRON
|
||||
put((char) 0x00AF, KeyEvent.VK_DEAD_MACRON); // MACRON
|
||||
put((char) 0x02DB, KeyEvent.VK_DEAD_OGONEK);
|
||||
put((char) 0x02DC, KeyEvent.VK_DEAD_TILDE); // SMALL TILDE
|
||||
put((char) 0x007E, KeyEvent.VK_DEAD_TILDE); // TILDE
|
||||
put((char) 0x309B, KeyEvent.VK_DEAD_VOICED_SOUND);
|
||||
put((char) 0x309C, KeyEvent.VK_DEAD_SEMIVOICED_SOUND);
|
||||
}
|
||||
};
|
||||
}
|
||||
58
test/jdk/jb/sun/awt/macos/NationalLayoutTest/KeyChar.java
Normal file
58
test/jdk/jb/sun/awt/macos/NationalLayoutTest/KeyChar.java
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Class describing a key char
|
||||
*/
|
||||
public class KeyChar {
|
||||
|
||||
// Char value
|
||||
private final char ch;
|
||||
// Dead or not
|
||||
private final boolean isDead;
|
||||
|
||||
// Private constructor for an ordinal key char
|
||||
private KeyChar(char ch) {
|
||||
this.ch = ch;
|
||||
this.isDead = false;
|
||||
}
|
||||
|
||||
// Private constructor for a dead key char
|
||||
private KeyChar(char ch, boolean isDead) {
|
||||
this.ch = ch;
|
||||
this.isDead = isDead;
|
||||
}
|
||||
|
||||
// Helper method for an ordinal key char creation
|
||||
static KeyChar ch(char ch) {
|
||||
return new KeyChar(ch);
|
||||
}
|
||||
|
||||
// Helper method for a dead key char creation
|
||||
static KeyChar dead(char ch) {
|
||||
return new KeyChar(ch, true);
|
||||
}
|
||||
|
||||
// Returns dead marker
|
||||
boolean isDead() {
|
||||
return isDead;
|
||||
}
|
||||
|
||||
// Returns char value
|
||||
char getChar() {
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
49
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Layout.java
Normal file
49
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Layout.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates macOS keyboard layouts covered by this test
|
||||
*/
|
||||
public enum Layout {
|
||||
|
||||
ABC ("ABC", Layout_ABC.values()),
|
||||
US_INTERNATIONAL_PC ("USInternational-PC", Layout_US_INTERNATIONAL_PC.values()),
|
||||
SPANISH_ISO ("Spanish-ISO", Layout_SPANISH_ISO.values()),
|
||||
FRENCH_PC ("French-PC", Layout_FRENCH_PC.values()),
|
||||
GERMAN ("German", Layout_GERMAN.values()),
|
||||
|
||||
;
|
||||
|
||||
// Real macOS keyboard layout name without "com.apple.keylayout." prefix
|
||||
private String name;
|
||||
// Array of test keys for the layout
|
||||
private LayoutKey[] layoutKeys;
|
||||
|
||||
Layout(String name, LayoutKey[] layoutKeys) {
|
||||
this.name = name;
|
||||
this.layoutKeys = layoutKeys;
|
||||
}
|
||||
|
||||
// Return array of test keys for the layout
|
||||
LayoutKey[] getLayoutKeys() {
|
||||
return layoutKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.apple.keylayout." + name;
|
||||
}
|
||||
}
|
||||
26
test/jdk/jb/sun/awt/macos/NationalLayoutTest/LayoutKey.java
Normal file
26
test/jdk/jb/sun/awt/macos/NationalLayoutTest/LayoutKey.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Common interface for all test layouts.
|
||||
* Keyboard layouts are declared as a separate enums to allow testing of different key sets for different layouts.
|
||||
* As layouts are declared as enums, they cannot extend any other class, but need to have some common functionality.
|
||||
*/
|
||||
public interface LayoutKey {
|
||||
|
||||
// Return Key object containing common key functionality
|
||||
Key getKey();
|
||||
}
|
||||
113
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Layout_ABC.java
Normal file
113
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Layout_ABC.java
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for IDEA-165950: National keyboard layouts support
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
* @modules java.desktop/sun.lwawt.macosx
|
||||
* @run main NationalLayoutTest ABC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates keys under test for com.apple.keylayout.ABC (macOS 10.14.5)
|
||||
*/
|
||||
public enum Layout_ABC implements LayoutKey {
|
||||
|
||||
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
|
||||
|
||||
// Robot cannot press section sign key (16777383),
|
||||
// located on the left side of the key 1 on the Apple International English keyboard
|
||||
// SECTION ('§', '§', '±', '±'),
|
||||
|
||||
VK_MINUS ('-', '–', '_', '—'),
|
||||
VK_EQUALS ('=', '≠', '+', '±'),
|
||||
|
||||
VK_OPEN_BRACKET ('[', '“', '{', '”'),
|
||||
VK_CLOSE_BRACKET (']', '‘', '}', '’'),
|
||||
|
||||
VK_SEMICOLON (';', '…', ':', 'Ú'),
|
||||
VK_QUOTE ('\'', 'æ', '"', 'Æ'),
|
||||
VK_BACK_SLASH ('\\', '«', '|', '»'),
|
||||
|
||||
VK_BACK_QUOTE (KeyChar.ch('`'), KeyChar.dead('`'), KeyChar.ch('~'), KeyChar.ch('`')),
|
||||
VK_COMMA (',', '≤', '<', '¯'),
|
||||
VK_PERIOD ('.', '≥', '>', '˘'),
|
||||
VK_SLASH ('/', '÷', '?', '¿'),
|
||||
|
||||
//VK_1 ('1', '¡', '!', '⁄'),
|
||||
//VK_2 ('2', '™', '@', '€'),
|
||||
//VK_3 ('3', '£', '#', '‹'),
|
||||
//VK_4 ('4', '¢', '$', '›'),
|
||||
//VK_5 ('5', '∞', '%', 'fi'),
|
||||
//VK_6 ('6', '§', '^', 'fl'),
|
||||
//VK_7 ('7', '¶', '&', '‡'),
|
||||
//VK_8 ('8', '•', '*', '°'),
|
||||
//VK_9 ('9', 'ª', '(', '·'),
|
||||
//VK_0 ('0', 'º', ')', '‚'),
|
||||
|
||||
// macOS system shortcuts: Shift+Cmd+Q - Log Out, Ctrl+Cmd+Q - Lock Screen
|
||||
//VK_Q ('q', 'œ', 'Q', 'Œ'),
|
||||
//VK_W ('w', '∑', 'W', '„'),
|
||||
//VK_E (KeyChar.ch('e'), KeyChar.dead('´') ,KeyChar.ch('E'), KeyChar.ch('´')),
|
||||
//VK_R ('r', '®', 'R', '‰'),
|
||||
//VK_T ('t', '†', 'T', 'ˇ'),
|
||||
//VK_Y ('y', '¥', 'Y', 'Á'),
|
||||
//VK_U (KeyChar.ch('u'), KeyChar.dead('¨'), KeyChar.ch('U'), KeyChar.ch('¨')),
|
||||
//VK_I (KeyChar.ch('i'), KeyChar.dead('ˆ'), KeyChar.ch('I'), KeyChar.ch('ˆ')),
|
||||
//VK_O ('o', 'ø', 'O', 'Ø'),
|
||||
//VK_P ('p', 'π', 'P', '∏'),
|
||||
|
||||
//VK_A ('a', 'å', 'A', 'Å'),
|
||||
//VK_S ('s', 'ß', 'S', 'Í'),
|
||||
//VK_D ('d', '∂', 'D', 'Î'),
|
||||
//VK_F ('f', 'ƒ', 'F', 'Ï'),
|
||||
//VK_G ('g', '©', 'G', '˝'),
|
||||
// macOS system shortcuts: Cmd+H - Hide the windows of the front app
|
||||
//VK_H ('h', '˙', 'H', 'Ó'),
|
||||
//VK_J ('j', '∆', 'J', 'Ô'),
|
||||
//VK_K ('k', '˚', 'K', ''),
|
||||
//VK_L ('l', '¬', 'L', 'Ò'),
|
||||
|
||||
//VK_Z ('z', 'Ω', 'Z', '¸'),
|
||||
//VK_X ('x', '≈', 'X', '˛'),
|
||||
//VK_C ('c', 'ç', 'C', 'Ç'),
|
||||
// macOS system shortcuts: Cmd+V - Paste the contents of the Clipboard into the current document or app
|
||||
//VK_V ('v', '√', 'V', '◊'),
|
||||
//VK_B ('b', '∫', 'B', 'ı'),
|
||||
//VK_N (KeyChar.ch('n'), KeyChar.dead('˜'), KeyChar.ch('N'), KeyChar.ch('˜')),
|
||||
//VK_M ('m', 'µ', 'M', 'Â'),
|
||||
|
||||
;
|
||||
|
||||
// Common code for any LayoutKey enum
|
||||
|
||||
private final Key key;
|
||||
|
||||
Layout_ABC(char no, char alt, char shift, char alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
Layout_ABC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for IDEA-165950: National keyboard layouts support
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
* @modules java.desktop/sun.lwawt.macosx
|
||||
* @run main NationalLayoutTest FRENCH_PC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates keys under test for com.apple.keylayout.French-PC (macOS 10.14.5)
|
||||
*/
|
||||
public enum Layout_FRENCH_PC implements LayoutKey {
|
||||
|
||||
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
|
||||
|
||||
VK_MINUS (')', ']', '°', ']'),
|
||||
VK_EQUALS ('=', '}', '+', '≠'),
|
||||
|
||||
VK_OPEN_BRACKET (KeyChar.dead('^'), KeyChar.ch('ô'), KeyChar.dead('¨'), KeyChar.ch('Ô')),
|
||||
VK_CLOSE_BRACKET ('$', '¤', '£', '¥'),
|
||||
|
||||
VK_SEMICOLON ('m', 'µ', 'M', 'Ó'),
|
||||
VK_QUOTE ('ù', 'Ù', '%', '‰'),
|
||||
VK_BACK_SLASH ('*', '@', 'μ', '#'),
|
||||
|
||||
VK_BACK_QUOTE ('<', '«', '>', '≥'),
|
||||
VK_COMMA (';', '…', '.', '•'),
|
||||
VK_PERIOD (':', '÷', '/', '\\'),
|
||||
VK_SLASH ('!', '¡', '§', '±'),
|
||||
|
||||
;
|
||||
|
||||
// Common code for any LayoutKey enum
|
||||
|
||||
private final Key key;
|
||||
|
||||
Layout_FRENCH_PC(char no, char alt, char shift, char alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
Layout_FRENCH_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for IDEA-165950: National keyboard layouts support
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
* @modules java.desktop/sun.lwawt.macosx
|
||||
* @run main NationalLayoutTest GERMAN
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates keys under test for com.apple.keylayout.German (macOS 10.14.5)
|
||||
*/
|
||||
public enum Layout_GERMAN implements LayoutKey {
|
||||
|
||||
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
|
||||
|
||||
// Eszett
|
||||
VK_MINUS ('ß', '¿', '?', '˙'),
|
||||
VK_EQUALS (KeyChar.dead('´'), KeyChar.ch('\''), KeyChar.dead('`'), KeyChar.ch('˚')),
|
||||
|
||||
VK_OPEN_BRACKET ('ü', '•', 'Ü', '°'),
|
||||
VK_CLOSE_BRACKET ('+', '±', '*', ''),
|
||||
|
||||
VK_SEMICOLON ('ö', 'œ', 'Ö', 'Œ'),
|
||||
VK_QUOTE ('ä', 'æ', 'Ä', 'Æ'),
|
||||
VK_BACK_SLASH ('#', '‘', '\'', '’'),
|
||||
|
||||
VK_BACK_QUOTE ('<', '≤', '>', '≥'),
|
||||
VK_COMMA (',', '∞', ';', '˛'),
|
||||
VK_PERIOD ('.', '…', ':', '÷'),
|
||||
VK_SLASH ('-', '–', '_', '—'),
|
||||
|
||||
;
|
||||
|
||||
// Common code for any LayoutKey enum
|
||||
|
||||
private final Key key;
|
||||
|
||||
Layout_GERMAN(char no, char alt, char shift, char alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
Layout_GERMAN(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for IDEA-165950: National keyboard layouts support
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
* @modules java.desktop/sun.lwawt.macosx
|
||||
* @run main NationalLayoutTest SPANISH_ISO
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates keys under test for com.apple.keylayout.Spanish-ISO (macOS 10.14.5)
|
||||
*/
|
||||
public enum Layout_SPANISH_ISO implements LayoutKey {
|
||||
|
||||
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
|
||||
|
||||
VK_MINUS ('\'', '´', '?', '¸'),
|
||||
VK_EQUALS ('¡', '‚', '¿', '˛'),
|
||||
|
||||
VK_OPEN_BRACKET (KeyChar.dead('`'), KeyChar.ch('['), KeyChar.dead('^'), KeyChar.ch('ˆ')),
|
||||
VK_CLOSE_BRACKET ('+', ']', '*', '±'),
|
||||
|
||||
VK_SEMICOLON (KeyChar.ch('ñ'), KeyChar.dead('~'), KeyChar.ch('Ñ'), KeyChar.ch('˜')),
|
||||
VK_QUOTE (KeyChar.dead('´'), KeyChar.ch('{'), KeyChar.dead('¨'), KeyChar.ch('«')),
|
||||
VK_BACK_SLASH ('ç', '}', 'Ç', '»'),
|
||||
|
||||
VK_BACK_QUOTE ('<', '≤', '>', '≥'),
|
||||
VK_COMMA (',', '„', ';', '\u0000'),
|
||||
VK_PERIOD ('.', '…', ':', '…'),
|
||||
VK_SLASH ('-', '–', '_', '—'),
|
||||
|
||||
;
|
||||
|
||||
// Common code for any LayoutKey enum
|
||||
|
||||
private final Key key;
|
||||
|
||||
Layout_SPANISH_ISO(char no, char alt, char shift, char alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
Layout_SPANISH_ISO(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for IDEA-165950: National keyboard layouts support
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
* @modules java.desktop/sun.lwawt.macosx
|
||||
* @run main NationalLayoutTest US_INTERNATIONAL_PC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enumerates keys under test for com.apple.keylayout.USInternational-PC (macOS 10.14.5)
|
||||
*/
|
||||
public enum Layout_US_INTERNATIONAL_PC implements LayoutKey {
|
||||
|
||||
// Enum name must be the same as KeyEvent.VK_ constant name corresponding to the key on US keyboard layout
|
||||
// Note that '\u0000' may be used if no char is mapped to a key + modifier or if one wants to skip its testing
|
||||
|
||||
VK_MINUS ('-', '–', '_', '—'),
|
||||
VK_EQUALS ('=', '≠', '+', '±'),
|
||||
|
||||
VK_OPEN_BRACKET ('[', '“', '{', '”'),
|
||||
VK_CLOSE_BRACKET (']', '‘', '}', '’'),
|
||||
|
||||
VK_SEMICOLON (';', '…', ':', 'Ú'),
|
||||
// ' is a special dead symbol, which may add either acute or cedilla to the next key
|
||||
VK_QUOTE (KeyChar.dead('\''), KeyChar.ch('æ'), KeyChar.dead('\"'), KeyChar.ch('Æ')),
|
||||
VK_BACK_SLASH ('\\', '«', '|', '»'),
|
||||
|
||||
VK_BACK_QUOTE (KeyChar.dead('`'), KeyChar.dead('`'), KeyChar.dead('~'), KeyChar.ch('`')),
|
||||
VK_COMMA (',', '≤', '<', '¯'),
|
||||
VK_PERIOD ('.', '≥', '>', '˘'),
|
||||
VK_SLASH ('/', '÷', '?', '¿'),
|
||||
|
||||
;
|
||||
|
||||
// Common code for any LayoutKey enum
|
||||
|
||||
private final Key key;
|
||||
|
||||
Layout_US_INTERNATIONAL_PC(char no, char alt, char shift, char alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
Layout_US_INTERNATIONAL_PC(KeyChar no, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
key = new Key(name(), new MappedKeyChars(no, alt, shift, alt_shift));
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defines chars mapped to the key on the current keyboard layout
|
||||
*/
|
||||
public class MappedKeyChars {
|
||||
|
||||
private final KeyChar no_modifier;
|
||||
private final KeyChar alt;
|
||||
private final KeyChar shift;
|
||||
private final KeyChar alt_shift;
|
||||
|
||||
MappedKeyChars(char no_modifier, char alt, char shift, char alt_shift) {
|
||||
this.no_modifier = KeyChar.ch(no_modifier);
|
||||
this.alt = KeyChar.ch(alt);
|
||||
this.shift = KeyChar.ch(shift);
|
||||
this.alt_shift = KeyChar.ch(alt_shift);
|
||||
}
|
||||
|
||||
MappedKeyChars(KeyChar no_modifier, KeyChar alt, KeyChar shift, KeyChar alt_shift) {
|
||||
this.no_modifier = no_modifier;
|
||||
this.alt = alt;
|
||||
this.shift = shift;
|
||||
this.alt_shift = alt_shift;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Return char mapped to key + modifier on the current layout.
|
||||
* Return "undefined" char '\uffff', if modifier is a shortcut, i.e. other than Alt, Shift or Alt+Shift or empty.
|
||||
* Return "null" char '\u0000', if there is no char mapped to the key + modifier or its testing is skipped.
|
||||
*/
|
||||
KeyChar getKeyChar(Modifier modifier) {
|
||||
if(modifier.isEmpty()) {
|
||||
return no_modifier;
|
||||
}
|
||||
if(modifier.isAlt()) {
|
||||
return alt;
|
||||
}
|
||||
if(modifier.isShift()) {
|
||||
return shift;
|
||||
}
|
||||
if(modifier.isAltShift()) {
|
||||
return alt_shift;
|
||||
}
|
||||
return KeyChar.ch(Character.MAX_VALUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return char mapped to the low registry key on the current layout, i.e. with no modifier.
|
||||
*/
|
||||
KeyChar getKeyChar() {
|
||||
return no_modifier;
|
||||
}
|
||||
}
|
||||
104
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Modifier.java
Normal file
104
test/jdk/jb/sun/awt/macos/NationalLayoutTest/Modifier.java
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
* Enumerates modifier combinations covered by this test
|
||||
*/
|
||||
public enum Modifier {
|
||||
|
||||
E(),
|
||||
//A(KeyEvent.VK_ALT),
|
||||
//S(KeyEvent.VK_SHIFT),
|
||||
//SA(KeyEvent.VK_SHIFT, KeyEvent.VK_ALT),
|
||||
|
||||
// Shortcuts
|
||||
|
||||
M(KeyEvent.VK_META),
|
||||
C(KeyEvent.VK_CONTROL),
|
||||
|
||||
//CS(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT),
|
||||
//CA(KeyEvent.VK_CONTROL, KeyEvent.VK_ALT),
|
||||
//CM(KeyEvent.VK_CONTROL, KeyEvent.VK_META),
|
||||
//MS(KeyEvent.VK_META, KeyEvent.VK_SHIFT),
|
||||
//MA(KeyEvent.VK_META, KeyEvent.VK_ALT),
|
||||
|
||||
//CMS(KeyEvent.VK_CONTROL, KeyEvent.VK_META, KeyEvent.VK_SHIFT),
|
||||
//CMA(KeyEvent.VK_CONTROL, KeyEvent.VK_META, KeyEvent.VK_ALT),
|
||||
//CSA(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_ALT),
|
||||
//MSA(KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_ALT),
|
||||
|
||||
//CMSA(KeyEvent.VK_CONTROL, KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_ALT),
|
||||
|
||||
;
|
||||
|
||||
// Holds array of int modifier values, where every int value corresponds to modifier KeyEvent.VK_ code
|
||||
private int[] modifiers;
|
||||
|
||||
// Creates empty Modifier
|
||||
Modifier() {
|
||||
this(new int[0]);
|
||||
}
|
||||
|
||||
// Creates Modifier using given KeyEvent.VK_ codes
|
||||
Modifier(int... modifiers) {
|
||||
for(int key : modifiers) {
|
||||
if ((key != KeyEvent.VK_CONTROL) && (key != KeyEvent.VK_META)
|
||||
&& (key != KeyEvent.VK_SHIFT) && (key != KeyEvent.VK_ALT)) {
|
||||
throw new IllegalArgumentException("Bad modifier: " + key);
|
||||
}
|
||||
}
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
// Returns array of int modifier values, where every int value corresponds to modifier KeyEvent.VK_ code
|
||||
int[] getModifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
// Checks if no modifier is set
|
||||
boolean isEmpty() {
|
||||
return (modifiers.length == 0);
|
||||
}
|
||||
|
||||
// Checks if modifier is Alt
|
||||
boolean isAlt() {
|
||||
return ((modifiers.length == 1) && (modifiers[0] == KeyEvent.VK_ALT));
|
||||
}
|
||||
|
||||
// Checks if modifier is Shift
|
||||
boolean isShift() {
|
||||
return ((modifiers.length == 1) && (modifiers[0] == KeyEvent.VK_SHIFT));
|
||||
}
|
||||
|
||||
// Checks if modifier is Alt+Shift
|
||||
boolean isAltShift() {
|
||||
List<Integer> list = Arrays.stream(modifiers).boxed().collect(Collectors.toList());
|
||||
return ((modifiers.length == 2) && list.contains(KeyEvent.VK_ALT) && list.contains(KeyEvent.VK_SHIFT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (modifiers.length == 0) {
|
||||
return "no";
|
||||
}
|
||||
return Arrays.stream(modifiers).boxed().map(i -> KeyEvent.getKeyText(i)).collect(Collectors.joining(" "));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import sun.lwawt.macosx.LWCToolkit;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Label;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Robot;
|
||||
import java.awt.TextArea;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.event.InputMethodListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.text.CharacterIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
* Description: Tests national keyboard layouts on macOS.
|
||||
*
|
||||
* Test goes over existing Layout and Modifier enums.
|
||||
* Each layout key will be tested with all possible modifier combinations.
|
||||
* Test switches to the requested layout (or user changes it by hands).
|
||||
* Then Robot keeps pressing modifier + key, while test keeps tracking of keyPressed, charsTyped and inputMethod events.
|
||||
* Finally, test compares the resulting key presses and typed chars with the expected ones using the assumptions below.
|
||||
*
|
||||
* Test based on the following assumptions:
|
||||
* TODO check if these assumptions are correct
|
||||
* - Pressing "modifier + key" always generates "modifier key code + low registry key code" for any key and modifier.
|
||||
* - No keyTyped event is expected as the result of pressing dead key + key.
|
||||
* - Pressing "dead key + space" generates corresponding diacritic character,
|
||||
* which may be obtained using inputMethodTextChanged event.
|
||||
* - Cmd, Ctrl and its combinations with other modifiers are considered as a "shortcut",
|
||||
* no keyTyped event is expected as the result of pressing a shortcut,
|
||||
* no attempts are made to check inputMethodTextChanged event result for a "shortcut".
|
||||
*
|
||||
* WARNING: Test sends many key presses which may match system and IDE shortcuts.
|
||||
*
|
||||
* !!! DISABLE MACOS SYSTEM SHORTCUTS BEFORE RUNNING THIS TEST !!!
|
||||
* !!! DO NOT RUN THIS TEST FROM IDE !!!
|
||||
*
|
||||
* MacOS accessibility permission should be granted on macOS >= 10.14 for the application launching this test, so
|
||||
* Java Robot is able to access keyboard (use System Preferences -> Security&Privacy -> Privacy tab -> Accessibility).
|
||||
*
|
||||
* Test can only be compiled by JBRSDK as it uses private LWCToolkit API for switching system keyboard layout.
|
||||
* Test may be run by any JRE, but in case of non-JBR, one needs to manually switch the keyboard layout during testing.
|
||||
*
|
||||
* Compilation:
|
||||
* <javac-1.8.*> -bootclasspath <jbrsdk8>/Contents/Home/jre/lib/rt.jar:. NationalLayoutTest.java
|
||||
* <javac-11.*> --add-exports java.desktop/sun.lwawt.macosx=ALL-UNNAMED NationalLayoutTest.java
|
||||
*
|
||||
* Usage:
|
||||
* <java> NationalLayoutTest [manual] [layout1] [layout2] ... , where layoutN is one of the existing Layout enum values
|
||||
*
|
||||
* Examples:
|
||||
* > java NationalLayoutTest
|
||||
* > java NationalLayoutTest ABC SPANISH_ISO
|
||||
* > java NationalLayoutTest manual US_INTERNATIONAL_PC
|
||||
*
|
||||
*/
|
||||
|
||||
public class NationalLayoutTest {
|
||||
|
||||
private static final String MANUAL= "manual";
|
||||
|
||||
private static final int PAUSE = 2000;
|
||||
|
||||
// Test control keys
|
||||
private static final int NEXT_KEY = KeyEvent.VK_ENTER;
|
||||
private static final int NEXT_MODIFIER = KeyEvent.VK_ESCAPE;
|
||||
private static final int TERMINATE_KEY = KeyEvent.VK_SPACE;
|
||||
|
||||
private static CountDownLatch nextKey;
|
||||
private static CountDownLatch nextModifierSet;
|
||||
|
||||
private static boolean jbr = true;
|
||||
private static boolean autoTest = true;
|
||||
private static boolean showKeyCodeHex = false;
|
||||
|
||||
private static Frame mainFrame;
|
||||
|
||||
private static TextArea inputArea;
|
||||
private static TextArea pressArea;
|
||||
private static TextArea typeArea;
|
||||
|
||||
private static Robot robot;
|
||||
|
||||
// Synchronized lists for storing results of different key events
|
||||
private static CopyOnWriteArrayList<Integer> keysPressed = new CopyOnWriteArrayList();
|
||||
private static CopyOnWriteArrayList<Character> charsTyped = new CopyOnWriteArrayList();
|
||||
private static CopyOnWriteArrayList<Character> inputMethodChars = new CopyOnWriteArrayList();
|
||||
|
||||
/*
|
||||
* Test entry point
|
||||
*/
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
|
||||
// Check if the testing could be performed using Java Robot
|
||||
try {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
} catch (AWTException e) {
|
||||
throw new RuntimeException("TEST ERROR: Cannot create Java Robot " + e);
|
||||
}
|
||||
|
||||
// Check if program arguments contain known layouts to test
|
||||
List<Layout> layoutList = new ArrayList();
|
||||
for (String arg : args) {
|
||||
if(!arg.equals(MANUAL)) {
|
||||
try {
|
||||
layoutList.add(Layout.valueOf(arg));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new RuntimeException("ERROR: Unexpected argument: " + arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// JBR internal API from LWCToolkit is used to switch system keyboard layout.
|
||||
// So running the test for other java implementations is only possible in manual mode.
|
||||
// During the test run one should switch to the requested keyboard layout by hands
|
||||
// and then proceed with testing by pressing NEXT_MODIFIER.
|
||||
if (!System.getProperty("java.vm.vendor").toLowerCase().contains("jetbrains")) {
|
||||
System.out.println("WARNING - Not JBR mode: Cannot automatically switch keyboard layout");
|
||||
jbr = false;
|
||||
}
|
||||
|
||||
// One may want to use MANUAL mode to simply improve visibility.
|
||||
// Please proceed with layout testing by pressing NEXT_MODIFIER.
|
||||
if(Arrays.asList(args).contains(MANUAL) || !(jbr)) {
|
||||
System.out.println("WARNING - Manual mode: Press " + KeyEvent.getKeyText(NEXT_MODIFIER)
|
||||
+ " to start testing keyboard layout with the modifier set");
|
||||
autoTest = false;
|
||||
}
|
||||
|
||||
String initialLayoutName = null;
|
||||
try {
|
||||
// Create test GUI
|
||||
createGUI();
|
||||
|
||||
// Save initial keyboard layout
|
||||
if(jbr) {
|
||||
initialLayoutName = LWCToolkit.getKeyboardLayoutId();
|
||||
}
|
||||
|
||||
boolean failed = false;
|
||||
// Test layouts defined in the command line or all enumerated test layouts in case command line is empty
|
||||
for(Layout layout : (layoutList.isEmpty()
|
||||
? Layout.values() : layoutList.toArray(new Layout[layoutList.size()]))) {
|
||||
// Test layout with all enumerated modifier combinations
|
||||
for (Modifier modifier : Modifier.values()) {
|
||||
if(!testLayout(layout, modifier)) {
|
||||
failed = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
// Provide the test result
|
||||
if(failed) {
|
||||
throw new RuntimeException("TEST FAILED: Some keyboard layout tests failed, check the test output");
|
||||
} else {
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
|
||||
} finally {
|
||||
// Restore initial keyboard layout
|
||||
if(initialLayoutName != null && !initialLayoutName.isEmpty()) {
|
||||
LWCToolkit.switchKeyboardLayout(initialLayoutName);
|
||||
}
|
||||
// Destroy test GUI
|
||||
destroyGUI();
|
||||
// Wait for EDT auto-shutdown
|
||||
Thread.sleep(PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
// Helpers for checking whether type area got focus
|
||||
private static final CountDownLatch typeAreaGainedFocus = new CountDownLatch(1);
|
||||
private static final FocusListener typeAreaFocusListener = new FocusAdapter() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
typeAreaGainedFocus.countDown();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Create the test GUI - main frame with three text areas:
|
||||
* 1) input area shows the current test key combination pressed by Java Robot
|
||||
* 2) press area shows what key pressed events was received as the result of 1
|
||||
* 3) type area (which is initially focused) shows symbols typed as the result of 1
|
||||
*/
|
||||
private static void createGUI() throws InterruptedException {
|
||||
|
||||
mainFrame = new Frame("Test Frame");
|
||||
inputArea = new TextArea("",50, 30);
|
||||
pressArea = new TextArea("", 50, 30);
|
||||
typeArea = new TextArea("",50, 30);
|
||||
|
||||
// Add listeners to track keyboard events
|
||||
typeArea.addFocusListener(typeAreaFocusListener);
|
||||
typeArea.addKeyListener(keyListener);
|
||||
typeArea.addInputMethodListener(inputMethodListener);
|
||||
|
||||
Panel labelPanel = new Panel();
|
||||
labelPanel.add(new Label("Input Keys ---> Pressed Keys ---> Typed Chars"));
|
||||
|
||||
Panel textPanel = new Panel();
|
||||
textPanel.setLayout(new FlowLayout());
|
||||
textPanel.add(inputArea);
|
||||
textPanel.add(pressArea);
|
||||
textPanel.add(typeArea);
|
||||
|
||||
mainFrame.setLocation(200, 200);
|
||||
mainFrame.add(labelPanel, BorderLayout.NORTH);
|
||||
mainFrame.add(textPanel, BorderLayout.SOUTH);
|
||||
mainFrame.pack();
|
||||
mainFrame.setVisible(true);
|
||||
|
||||
typeArea.requestFocusInWindow();
|
||||
// Check if type area got focus.
|
||||
// Corresponding latch is released in the typeAreaFocusListener.
|
||||
if(!typeAreaGainedFocus.await(PAUSE, TimeUnit.MILLISECONDS)) {
|
||||
throw new RuntimeException("TEST ERROR: Failed to request focus in the text area for typing");
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy the test GUI
|
||||
*/
|
||||
private static void destroyGUI() {
|
||||
if(typeArea != null) {
|
||||
typeArea.removeFocusListener(typeAreaFocusListener);
|
||||
typeArea.removeKeyListener(keyListener);
|
||||
typeArea.removeInputMethodListener(inputMethodListener);
|
||||
}
|
||||
if(mainFrame != null) {
|
||||
mainFrame.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Listener for keyPressed and keyTyped events
|
||||
*/
|
||||
private static final KeyListener keyListener = new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
// Obtain pressed key code
|
||||
int keyCode = e.getKeyCode();
|
||||
if (keyCode == KeyEvent.VK_UNDEFINED) {
|
||||
keyCode = e.getExtendedKeyCode();
|
||||
}
|
||||
if (keyCode == NEXT_MODIFIER) {
|
||||
// Support for manual mode: notify main thread that testing may be continued
|
||||
nextModifierSet.countDown();
|
||||
} else if (keyCode == NEXT_KEY) {
|
||||
// Update press area with the next line
|
||||
pressArea.append("\n");
|
||||
// Notify main thread that all events related to the key testing should already have been received
|
||||
nextKey.countDown();
|
||||
} else if (keyCode == TERMINATE_KEY) {
|
||||
// Do nothing, press TERMINATE_KEY_SEQUENCE to support dead key testing
|
||||
} else {
|
||||
String keyText = KeyEvent.getKeyText(keyCode);
|
||||
// Update press area with the pressed key text
|
||||
pressArea.append(keysPressed.isEmpty() ? keyText : " " + keyText);
|
||||
// Store pressed key code to the corresponding list
|
||||
keysPressed.add(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
// Obtain typed char
|
||||
char keyChar = e.getKeyChar();
|
||||
int keyCode = KeyEvent.getExtendedKeyCodeForChar(keyChar);
|
||||
if ((keyCode != NEXT_MODIFIER) && (keyCode != NEXT_KEY) && (keyCode != TERMINATE_KEY)) {
|
||||
// Store typed char to the corresponding list
|
||||
charsTyped.add(keyChar);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Test listener for InputMethod events.
|
||||
* Such events may occur for a special case when a character is generated by pressing more than one key,
|
||||
* for example, when attaching specific diacritic to a base letter, by pressing dead key + base key.
|
||||
*/
|
||||
static final InputMethodListener inputMethodListener = new InputMethodListener() {
|
||||
@Override
|
||||
public void inputMethodTextChanged(InputMethodEvent e) {
|
||||
// Store generated chars to the corresponding list
|
||||
if(e.getCommittedCharacterCount() > 0) {
|
||||
CharacterIterator text = e.getText();
|
||||
for (char ch = text.first(); ch != CharacterIterator.DONE; ch = text.next()) {
|
||||
inputMethodChars.add(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretPositionChanged(InputMethodEvent event) {
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Main method for testing defined layout keys with the specific modifier set
|
||||
*/
|
||||
private static boolean testLayout(Layout layout, Modifier modifier) throws InterruptedException {
|
||||
boolean result = true;
|
||||
System.out.println("\nStart testing " + layout + " layout with " + modifier + " modifier(s):");
|
||||
|
||||
// Switch current keyboard layout to the test one
|
||||
if(jbr) {
|
||||
LWCToolkit.switchKeyboardLayout(layout.toString());
|
||||
}
|
||||
|
||||
// Support for manual mode: wait while user switches the keyboard layout (if needed)
|
||||
// and proceed with layout + modifier testing by pressing NEXT_MODIFIER.
|
||||
// Corresponding latch is released in the keyListener when NEXT_MODIFIER key event is received.
|
||||
nextModifierSet = new CountDownLatch(1);
|
||||
if(autoTest) {
|
||||
pressKey(NEXT_MODIFIER);
|
||||
}
|
||||
if(!nextModifierSet.await(PAUSE*10, TimeUnit.MILLISECONDS)) {
|
||||
throw new RuntimeException("TEST ERROR: User has not proceeded with manual testing");
|
||||
};
|
||||
|
||||
// Clean up the test text areas
|
||||
inputArea.setText("");
|
||||
pressArea.setText("");
|
||||
// Workaround jdk8 setText() issue
|
||||
typeArea.setText(" ");
|
||||
|
||||
// Store modifier keys to array
|
||||
int[] modifiers = modifier.getModifiers();
|
||||
|
||||
// Go over all keys defined for the layout
|
||||
for(LayoutKey layoutKey : layout.getLayoutKeys()) {
|
||||
|
||||
// Clean up synchronized lists which store pressed key codes and typed chars
|
||||
keysPressed = new CopyOnWriteArrayList();
|
||||
charsTyped = new CopyOnWriteArrayList();
|
||||
inputMethodChars = new CopyOnWriteArrayList();
|
||||
|
||||
// Get Key object from LayoutKey enum
|
||||
Key key = layoutKey.getKey();
|
||||
|
||||
// Obtain the key code for the current layout
|
||||
int keyCode = key.getKeyCode();
|
||||
|
||||
// Append input area with the modifiers + key under test
|
||||
if(!modifier.isEmpty()) {
|
||||
inputArea.append(modifier + " ");
|
||||
}
|
||||
inputArea.append(KeyEvent.getKeyText(keyCode) + "\n");
|
||||
|
||||
// Robot only knows US keyboard layout.
|
||||
// So, to press modifier + key under test on the current layout,
|
||||
// one need to pass corresponding US layout key code to Robot.
|
||||
pressKey(key.getKeyCode_US(), modifiers);
|
||||
|
||||
// The key under test may be a dead key which does not generate a character by itself.
|
||||
// But it modifies the character generated by the key pressed immediately after.
|
||||
// So need to press some TERMINATE_KEY key to avoid dead key influence on the next key under test.
|
||||
// Corresponding diacritic character by itself can be generated by pressing dead key followed by space.
|
||||
// That is why pressing TERMINATE_KEY=space after a dead key resets the dead key modifier
|
||||
// and allows testing the generated character which may be useful for some layouts.
|
||||
// Test does two checks: if modifier + key is a dead key and if key with no modifier is a dead key.
|
||||
// Second check is needed for shortcuts as key.isDead(modifier) is always false for a shortcut.
|
||||
if(key.isDead(modifier) || key.isDead()) {
|
||||
pressKey(TERMINATE_KEY);
|
||||
}
|
||||
|
||||
// Wait while NEXT_KEY is pressed, which identifies that modifier + key testing is finished.
|
||||
// Corresponding latch is released in the keyListener when NEXT_KEY key event is received.
|
||||
nextKey = new CountDownLatch(1);
|
||||
pressKey(NEXT_KEY);
|
||||
if(!nextKey.await(PAUSE, TimeUnit.MILLISECONDS)) {
|
||||
throw new RuntimeException("TEST ERROR: "
|
||||
+ KeyEvent.getKeyText(NEXT_KEY) + " key pressed event was not received");
|
||||
};
|
||||
|
||||
// Define array of key codes expected to be pressed as the result of modifiers + key
|
||||
int[] keysPattern = Arrays.copyOf(modifiers, modifiers.length + 1);
|
||||
keysPattern[modifiers.length] = keyCode;
|
||||
|
||||
// Define array of key codes which were really pressed as the result of modifiers + key
|
||||
int[] keysResult = listToInts(keysPressed);
|
||||
|
||||
// Do not check the resulting character in case it is null,
|
||||
// i.e. no char is mapped to the modifier or there is no need to test it.
|
||||
if (key.isCharNull(modifier)) {
|
||||
// Check if the pressed key codes are equal to the expected ones
|
||||
if(!checkResult(keysPattern, keysResult, null,null)) {
|
||||
result = false;
|
||||
};
|
||||
} else {
|
||||
// Define array of chars expected to be typed as the result of modifiers + key
|
||||
// Do not expect any char typed as the result of shortcut (char is undefined in this case)
|
||||
char[] charsPattern = key.isCharUndefined(modifier)
|
||||
? new char[0] : new char[] { key.getChar(modifier) };
|
||||
// Define array of chars which were really typed as the result of modifiers + key
|
||||
// No keyTyped events may be generated as the result of pressing a dead key + space,
|
||||
// so check if input method text was updated in this case.
|
||||
char[] charsResult = (key.isDead(modifier) && charsTyped.isEmpty())
|
||||
? listToChars(inputMethodChars) : listToChars(charsTyped);
|
||||
// Check if pressed key codes and typed chars are equal to the expected ones
|
||||
if(!checkResult(keysPattern, keysResult, charsPattern, charsResult)) {
|
||||
result = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
// Provide layout + modifier testing result
|
||||
System.out.println("Finish testing " + layout + " layout with " + modifier + " modifier(s): "
|
||||
+ (result ? "PASSED" : "FAILED"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use Java Robot to press the key with specific modifiers
|
||||
*/
|
||||
private static void pressKey(int keyCode, int... modifiers) {
|
||||
robot.waitForIdle();
|
||||
for (int modifier : modifiers) {
|
||||
robot.keyPress(modifier);
|
||||
}
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
for (int modifier : modifiers) {
|
||||
robot.keyRelease(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if keys pressed and char typed are equal to the expected ones
|
||||
*/
|
||||
private static boolean checkResult(int[] patternKeys, int[] resultKeys, char[] patternChars, char[] resultChars) {
|
||||
|
||||
boolean checkKeys = Arrays.equals(patternKeys, resultKeys);
|
||||
boolean checkChars = Arrays.equals(patternChars, resultChars);
|
||||
|
||||
boolean result = (checkKeys & checkChars);
|
||||
|
||||
if(!result) {
|
||||
String[] patternStr = (patternKeys != null) ? intsToStrings(patternKeys) : null;
|
||||
String[] resultStr = (resultKeys != null) ? intsToStrings(resultKeys) : null;
|
||||
String eqKeys = checkKeys ? " == " : " != ";
|
||||
System.err.println("keyText : " + Arrays.toString(patternStr) + eqKeys + Arrays.toString(resultStr));
|
||||
System.err.println("keyCode : " + Arrays.toString(patternKeys) + eqKeys + Arrays.toString(resultKeys));
|
||||
if(showKeyCodeHex) {
|
||||
String[] patternHex = intsToHexStrings(patternKeys);
|
||||
String[] resultHex = intsToHexStrings(resultKeys);
|
||||
System.err.println("keyCodeHex: " + Arrays.toString(patternHex) + eqKeys + Arrays.toString(resultHex));
|
||||
}
|
||||
}
|
||||
if(!checkChars) {
|
||||
String[] patternHex = (patternChars != null) ? charsToHexStrings(patternChars) : null;
|
||||
String[] resultHex = (resultChars != null) ? charsToHexStrings(resultChars) : null;
|
||||
String eqChars = checkChars ? " == " : " != ";
|
||||
System.err.println("keyChar : " + Arrays.toString(patternChars) + eqChars + Arrays.toString(resultChars));
|
||||
System.err.println("keyCharHex: " + Arrays.toString(patternHex) + eqChars + Arrays.toString(resultHex));
|
||||
}
|
||||
if(!result) {
|
||||
System.err.println();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform list of Integers to int array
|
||||
*/
|
||||
private static int[] listToInts(List<Integer> list) {
|
||||
return list.stream().mapToInt(i->i).toArray();
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform list of Characters to char array
|
||||
*/
|
||||
private static char[] listToChars(List<Character> list) {
|
||||
return list.stream().map(c -> c.toString()).collect(Collectors.joining()).toCharArray();
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform array of int keys to array of Strings, mapping an int key to its text representation
|
||||
*/
|
||||
private static String[] intsToStrings(int[] ints) {
|
||||
return Arrays.stream(ints).boxed().map(i -> KeyEvent.getKeyText(i)).toArray(String[]::new);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform array of int keys to array of Strings, mapping an int key to its hex representation
|
||||
*/
|
||||
private static String[] intsToHexStrings(int[] ints) {
|
||||
return Arrays.stream(ints).boxed().map(i -> String.format("0x%1$04X", i)).toArray(String[]::new);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform array of char to array of Strings, mapping a char to its hex representation
|
||||
*/
|
||||
private static String[] charsToHexStrings(char[] chars) {
|
||||
int[] result = new int[chars.length];
|
||||
Arrays.setAll(result, i -> (int) chars[i]);
|
||||
return intsToHexStrings(result);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ java/awt/BasicStroke/DashZeroWidth.java
|
||||
java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java 8169108 windows-all
|
||||
java/awt/Choice/ChoiceGeneratesItemEvents/ChoiceGeneratesItemEvents.html 8047703 generic-all
|
||||
java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.html 6849922 macosx-all,windows-all
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,windows-all
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,windows-all,linux-all
|
||||
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all,windows-all
|
||||
java/awt/Choice/GrabLockTest/GrabLockTest.java JRE-839 windows-all,macosx-all,linux-all
|
||||
java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html 8194045 generic-all
|
||||
@@ -138,6 +138,7 @@ java/awt/Debug/DumpOnKey/DumpOnKey.java
|
||||
java/awt/Dialog/DialogAboveFrame/DialogAboveFrame.java 8214923 windows-all,macosx-all
|
||||
java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java 8215105 macosx-all,windows-all
|
||||
java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java 8225790 linux-all
|
||||
java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java 8215105,8221383 macosx-all,windows-all
|
||||
java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java 8159069 windows-all
|
||||
java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java 8203047 macosx-all,linux-all,windows-all
|
||||
java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html 8073636 macosx-all
|
||||
@@ -180,7 +181,7 @@ java/awt/Focus/NoAutotransferToDisabledCompTest/NoAutotransferToDisabledCompTest
|
||||
java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html 7124275 macosx-all
|
||||
java/awt/Focus/NonFocusableWindowTest/NoEventsTest.java 8000171 windows-all
|
||||
java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java 8169110 macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java JRE-898 macosx-all,linux-all,windows-all reproduced with Adopt, OpenJDK
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java JRE-898 macosx-all,linux-all,windows-all
|
||||
java/awt/Focus/RequestFocusToDisabledCompTest/RequestFocusToDisabledCompTest.java JRE-898 macosx-all
|
||||
java/awt/Focus/ResetMostRecentFocusOwnerTest/ResetMostRecentFocusOwnerTest.java 8168294 macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java JRE-898 macosx-all,linux-all
|
||||
@@ -198,6 +199,7 @@ java/awt/FontMetrics/MaxAdvanceIsMax.java
|
||||
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786,8055833 macosx-all,linux-all
|
||||
java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java 8198237 macosx-all
|
||||
java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all
|
||||
java/awt/Frame/FrameLocation/FrameLocation.java 8019803 macosx-all
|
||||
java/awt/Frame/InvisibleOwner/InvisibleOwner.java 8169111 macosx-all,windows-all
|
||||
java/awt/Frame/LayoutOnMaximizeTest/LayoutOnMaximizeTest.java 8169472 windows-all
|
||||
java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all
|
||||
@@ -208,7 +210,7 @@ java/awt/Frame/UnfocusableMaximizedFrameResizablity/UnfocusableMaximizedFrameRes
|
||||
java/awt/Frame/WindowDragTest/WindowDragTest.java 8169470 generic-all
|
||||
java/awt/FullScreen/8013581/bug8013581.java 8169471 macosx-all,windows-all,linux-all
|
||||
java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java 8047218 generic-all
|
||||
java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469 windows-all,linux-all (linux: NPE commit testing)
|
||||
java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469,JBR-1897 windows-all,macosx-all,linux-all (linux: NPE commit testing)
|
||||
java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java 7019055 windows-all,linux-all,macosx-all
|
||||
java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java 8169468 windows-all,macosx-all
|
||||
java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 7188711 macosx-all
|
||||
@@ -221,15 +223,16 @@ java/awt/Graphics2D/DrawString/TextRenderingTest.java
|
||||
java/awt/Graphics2D/FillTexturePaint/FillTexturePaint.java 8169463 windows-all
|
||||
java/awt/Graphics2D/FlipDrawImage/FlipDrawImage.java 8169462 windows-all
|
||||
java/awt/Graphics2D/ScaledTransform/ScaledTransform.java 8165951 windows-all,linux-all
|
||||
java/awt/GraphicsDevice/CheckDisplayModes.java 8213119 macosx-all
|
||||
java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java 8197814 macosx-all,linux-all,windows-all
|
||||
java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java 8197814 macosx-all,linux-all,windows-all
|
||||
java/awt/GridLayout/LayoutExtraGaps/LayoutExtraGaps.java 8000171 windows-all
|
||||
java/awt/JAWT/JAWT.sh 8197798 windows-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.html JRE-898 macosx-all,linux-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all,windows-all,linux-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all,windows-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all,windows-all,linux-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html 8198624 macosx-all,linux-all,windows-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all,windows-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all,windows-all,linux-all
|
||||
java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java 8159252 generic-all
|
||||
java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html 8169461 windows-all
|
||||
java/awt/List/KeyEventsTest/KeyEventsTest.html 8047703 windows-all
|
||||
@@ -531,14 +534,14 @@ java/awt/Modal/ToFront/FrameToFrontTKModal2Test.java
|
||||
java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java 8196441 macosx-all,windows-all,linux-all
|
||||
java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java 8196441 macosx-all,windows-all,linux-all
|
||||
java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java 8196441 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java 8177326 macosx-all,windows-all
|
||||
java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java 8177326 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java JRE-898 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all
|
||||
java/awt/Mouse/ExtraMouseClick/ExtraMouseClick.html 8169534 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java 8168388 windows-all,macosx-all,linux-all
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 8196017 windows-all,linux-all (linux: NPE commit testing)
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 8196017 windows-all,macosx-all,linux-all (macosx,linux: NPE commit testing)
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java 8052166 linux-all
|
||||
java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676,8129775 generic-all
|
||||
java/awt/Mouse/MouseModifiersUnitTest/ExtraButtonDrag.java 8013428 generic-all
|
||||
@@ -549,6 +552,7 @@ java/awt/Mouse/TitleBarDoubleClick/TitleBarDoubleClick.html
|
||||
java/awt/MouseInfo/GetPointerInfoTest.java 8158798 windows-all
|
||||
java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java 7124230 generic-all
|
||||
java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java 8155744 windows-all,linux-all
|
||||
java/awt/Multiscreen/WindowGCChangeTest/WindowGCChangeTest.html 8168132 macosx-all,linux-all
|
||||
java/awt/Paint/PaintNativeOnUpdate.java 8028000 generic-all
|
||||
java/awt/Paint/bug8024864.java 8176512 windows-all,macosx-all,linux-all
|
||||
java/awt/PrintJob/PrinterException.java 8194045 generic-all
|
||||
@@ -560,7 +564,7 @@ java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java
|
||||
java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java 8196018 windows-all,linux-all
|
||||
java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java 8061235,8159592,8134231 macosx-all,windows-all,linux-all
|
||||
java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java 8203004 linux-all
|
||||
java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java 8213120 macosx-all,linux-4.15.0-45-generic (kubuntu)
|
||||
java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java 8213120 macosx-all,linux-all, windows-all (windows, linux - time out)
|
||||
java/awt/TextArea/DisposeTest/TestDispose.java JBR-1905 generic-all
|
||||
java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java 8196300 windows-all
|
||||
java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java 8169533 macosx-all,windows-all
|
||||
@@ -582,7 +586,7 @@ java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java
|
||||
java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java 8197575,8150540 macosx-all,windows-all
|
||||
java/awt/TrayIcon/TrayIconPopup/TrayIconPopupClickTest.java 8197575,8150540 macosx-all,windows-all
|
||||
java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java 8197575,8150540 macosx-all,windows-all
|
||||
java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java 8196440 linux-all
|
||||
java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java 8196440 linux-all,macosx-all (commit: mac OOME)
|
||||
java/awt/Window/8159168/SetShapeTest.java 8208507 generic-all
|
||||
java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java 8142536 generic-all
|
||||
java/awt/Window/Grab/GrabTest.java 8196019 macosx-all,windows-all,linux-all
|
||||
@@ -597,6 +601,7 @@ java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java
|
||||
java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java 8078999,8198690 macosx-all,linux-all,windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucentWindowClick.java 8013450 macosx-all,linux-all,windows-all (windows: commit testing time out)
|
||||
java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java 8198690,8165218 macosx-all,linux-all,windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java 8222328 linux-all,windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/TranslucentChoice.java 8194129 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/TranslucentWindowClick.java 8194129 macosx-all,windows-all,linux-all
|
||||
java/awt/Window/AlwaysOnTop/AutoTestOnTop.java 6847593,8194045 macosx-all,windows-all,linux-all
|
||||
@@ -755,7 +760,6 @@ javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java
|
||||
|
||||
# jdk_net
|
||||
|
||||
java/net/CookieHandler/B6791927.java 8234007 general-all
|
||||
java/net/MulticastSocket/NoLoopbackPackets.java 7122846 macosx-all
|
||||
java/net/MulticastSocket/SetLoopbackMode.java 7122846 macosx-all
|
||||
java/net/MulticastSocket/Test.java 7145658,8207404 macosx-all,aix-all
|
||||
@@ -910,7 +914,7 @@ javax/sound/midi/Sequencer/Recording.java
|
||||
# jdk_swing
|
||||
|
||||
com/sun/java/swing/plaf/windows/Test8173145.java 8198334 windows-all
|
||||
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all
|
||||
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all,linux-all
|
||||
javax/swing/Action/8133039/bug8133039.java 8196089 windows-all,macosx-all
|
||||
javax/swing/JButton/4368790/bug4368790.java 8065582 macosx-all
|
||||
javax/swing/JButton/8151303/PressedIconTest.java 8198689 macosx-all,windows-all (windows: commit testing)
|
||||
@@ -921,7 +925,7 @@ javax/swing/JColorChooser/Test6541987.java
|
||||
javax/swing/JColorChooser/Test6827032.java 8197825 windows-all
|
||||
javax/swing/JColorChooser/Test7194184.java 8194126,8072110 linux-all,macosx-all,windows-all
|
||||
javax/swing/JColorChooser/Test8051548.java 8197552 macosx-all,windows-all,linux-all
|
||||
javax/swing/JComboBox/4743225/bug4743225.java 8171302 windows-all,macosx-all
|
||||
javax/swing/JComboBox/4743225/bug4743225.java 8171302 windows-all,macosx-all,linux-all
|
||||
javax/swing/JComboBox/6236162/bug6236162.java 8028707 windows-all,macosx-all
|
||||
javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all,linux-all
|
||||
javax/swing/JComboBox/6607130/bug6607130.java 8196091 windows-all
|
||||
@@ -941,6 +945,7 @@ javax/swing/JComponent/4337267/bug4337267.java
|
||||
javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all
|
||||
javax/swing/JComponent/7154030/bug7154030.java 7190978 generic-all
|
||||
javax/swing/DataTransfer/8059739/bug8059739.java 8199074 generic-all
|
||||
javax/swing/GraphicsConfigNotifier/StalePreferredSize.java 8213121 macosx-all,windows-all
|
||||
javax/swing/GroupLayout/6613904/bug6613904.java 8199072 generic-all
|
||||
javax/swing/JEditorPane/5076514/bug5076514.java 8198321 generic-all
|
||||
javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all,windows-all
|
||||
@@ -958,6 +963,7 @@ javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.j
|
||||
javax/swing/JFrame/8016356/bug8016356.java 8169955 windows-all
|
||||
javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all
|
||||
javax/swing/JInternalFrame/5066752/bug5066752.java 8207850 macosx-all,windows-all
|
||||
javax/swing/JInternalFrame/8020708/bug8020708.java 8226230 linux-all
|
||||
javax/swing/JInternalFrame/8069348/bug8069348.java 8208570 macosx-all,windows-all,linux-all
|
||||
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java 8203918 windows-all,linux-all
|
||||
javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java 8194944 macosx-all,windows-all,linux-all
|
||||
@@ -965,7 +971,7 @@ javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java
|
||||
javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java 8186513 generic-all
|
||||
javax/swing/JInternalFrame/DockIconRepaint/DockIconRepaint.java 8208289 macosx-all
|
||||
javax/swing/JInternalFrame/Test6325652.java 8160880,8196467 linux-all,macosx-all,windows-all
|
||||
javax/swing/JInternalFrame/Test6505027.java 8172535 macosx-all,windows-all
|
||||
javax/swing/JInternalFrame/Test6505027.java 8172535 macosx-all,windows-all,linux-all
|
||||
javax/swing/JLabel/6596966/bug6596966.java 8197552,8040914 macosx-all,windows-all,linux-all
|
||||
javax/swing/JList/6462008/bug6462008.java 7156347 generic-all
|
||||
javax/swing/JMenu/4213634/bug4213634.java 8197552 macosx-all,windows-all,linux-all
|
||||
@@ -980,7 +986,7 @@ javax/swing/JMenuItem/4171437/bug4171437.java
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java 8172536 macosx-all,windows-all,linux-all
|
||||
javax/swing/JMenuItem/6209975/bug6209975.java 8204062 macosx-all,windows-all
|
||||
javax/swing/JMenuItem/6249972/bug6249972.java 8197552 macosx-all,windows-all,linux-all
|
||||
javax/swing/JPopupMenu/4458079/bug4458079.java 8040917 macosx-all,windows-all
|
||||
javax/swing/JPopupMenu/4458079/bug4458079.java 8040917 macosx-all,windows-all,linux-all
|
||||
javax/swing/JPopupMenu/4769039/bug4769039.java 8194045 generic-all
|
||||
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
|
||||
javax/swing/JPopupMenu/4966112/bug4966112.java 8064915,7151826 macosx-all,linux-all
|
||||
@@ -1025,7 +1031,7 @@ javax/swing/JTextArea/TextViewOOM/TextViewOOM.java
|
||||
javax/swing/JTextField/4306756/bug4306756.java 8194045 generic-all
|
||||
javax/swing/JTextField/8036819/bug8036819.java 8197552 macosx-all,windows-all,linux-all
|
||||
javax/swing/JToolTip/4846413/bug4846413.java 8172407 macosx-all,windows-all
|
||||
javax/swing/JTree/4330357/bug4330357.java 8029682,8003839 macosx-all,windows-all
|
||||
javax/swing/JTree/4330357/bug4330357.java 8029682,8003839 macosx-all,windows-all,linux-all
|
||||
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all
|
||||
javax/swing/JTree/4908142/bug4908142.java 8197552,8172065 macosx-all,windows-all,linux-all
|
||||
javax/swing/JTree/4927934/bug4927934.java 8197552,8172063 macosx-all,windows-all,linux-all
|
||||
@@ -1043,11 +1049,11 @@ javax/swing/LookAndFeel/8145547/DemandGTK2.sh
|
||||
javax/swing/LookAndFeel/8145547/DemandGTK3.sh 8215539,8212903 linux-all
|
||||
javax/swing/MultiUIDefaults/4300666/bug4300666.java 7105119 macosx-all
|
||||
javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
|
||||
javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
|
||||
javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all,windows-all
|
||||
javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java 8065099,8208565 macosx-all,windows-all,linux-all
|
||||
javax/swing/PopupFactory/8048506/bug8048506.java 8202660 windows-all
|
||||
javax/swing/ProgressMonitor/ProgressMonitorEscapeKeyPress.java 8197552 macosx-all,windows-all,linux-all
|
||||
javax/swing/RepaintManager/IconifyTest/IconifyTest.java 8072110 linux-all,windows-all
|
||||
javax/swing/RepaintManager/IconifyTest/IconifyTest.java 8072110,8221903 linux-all,windows-all,macosx-all (commit: macosx)
|
||||
javax/swing/SpringLayout/4726194/bug4726194.java 8198399 generic-all
|
||||
javax/swing/SwingUtilities/4917669/bug4917669.java 8197552,8172064 macosx-all,windows-all,linux-all
|
||||
javax/swing/SwingUtilities/6797139/bug6797139.java 8198400 generic-all
|
||||
@@ -1186,6 +1192,7 @@ com/sun/jdi/RedefineCrossEvent.java
|
||||
############################################################################
|
||||
|
||||
jdk/internal/platform/cgroup/TestCgroupMetrics.java 8222533 linux-all
|
||||
jdk/internal/platform/docker/TestSystemMetrics.java 8224502 linux-all
|
||||
|
||||
# jdk_jfr
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@ java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
|
||||
java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java nobug macosx-all,windows-all
|
||||
java/awt/Choice/GetSizeTest/GetSizeTest.java nobug macosx-all,windows-all
|
||||
java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java nobug windows-all,linux-all
|
||||
java/awt/Component/7097771/bug7097771.java nobug windows-all
|
||||
java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java nobug macosx-all
|
||||
java/awt/Component/F10TopToplevel/F10TopToplevel.html nobug linux-all
|
||||
java/awt/Component/PaintAll/PaintAll.java nobug linux-all
|
||||
java/awt/Container/isRemoveNotifyNeeded/JInternalFrameTest.java nobug generic-all
|
||||
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java nobug macosx-all,windows-all
|
||||
java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java nobug macosx-all,windows-all
|
||||
java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Dialog/NonResizableDialogSysMenuResize/NonResizableDialogSysMenuResize.java nobug macosx-all,windows-all
|
||||
java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java nobug macosx-all,windows-all
|
||||
java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html nobug macosx-all,windows-all
|
||||
@@ -30,6 +29,7 @@ java/awt/Focus/NonFocusableResizableTooSmall/NonFocusableResizableTooSmall.java
|
||||
java/awt/Focus/NonFocusableWindowTest/NonfocusableOwnerTest.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java nobug macosx-all
|
||||
java/awt/Focus/RequestFocusAndHideTest/RequestFocusAndHideTest.java nobug macosx-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java nobug linux-all,macosx-all,windows-all reproduced with Adopt, OpenJDK
|
||||
java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java nobug macosx-all,windows-all
|
||||
java/awt/Frame/8158918/SetExtendedState.java nobug linux-all
|
||||
java/awt/Frame/FrameLocation/FrameLocation.java nobug linux-all
|
||||
@@ -58,8 +58,6 @@ java/awt/List/ItemEventTest/ItemEventTest.java
|
||||
java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java nobug macosx-all,windows-all
|
||||
java/awt/List/ListGarbageCollectionTest/AwtListGarbageCollectionTest.java nobug linux-all
|
||||
java/awt/Menu/NullMenuLabelTest/NullMenuLabelTest.java nobug linux-all
|
||||
java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/HWDisappear.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/JButtonInGlassPane.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mixing/LWComboBox.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -70,6 +68,7 @@ java/awt/Mixing/Validating.java
|
||||
java/awt/Modal/LWModalTest/LWModalTest.java nobug macosx-all,windows-all
|
||||
java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java nobug macosx-all,windows-all
|
||||
java/awt/Modal/ToBack/ToBackModeless6Test.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java nobug macosx-all,linux-all
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mouse/MouseWheelAbsXY/MouseWheelAbsXY.java nobug macosx-all,windows-all
|
||||
@@ -95,14 +94,14 @@ java/awt/Toolkit/RealSync/Test.java
|
||||
java/awt/Toolkit/SunDisplayChangerLeakTest/SunDisplayChangerLeakTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java nobug macosx-all,windows-all
|
||||
java/awt/Window/ChangeWindowResizabilty/ChangeWindowResizabiltyTest.java nobug windows-all,linux-all
|
||||
java/awt/Window/FindOwner/FindOwnerTest.html nobug macosx-all,windows-all
|
||||
java/awt/Window/FindOwner/FindOwnerTest.html nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java nobug macosx-all
|
||||
java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java nobug macosx-all,linux-all
|
||||
java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java nobug linux-all
|
||||
java/awt/Window/ScreenLocation/ScreenLocationTest.java nobug linux-all
|
||||
java/awt/Window/SetWindowLocationByPlatformTest/SetWindowLocationByPlatformTest.java nobug linux-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java nobug windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java nobug windows-all,macosx-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/WindowOpacity.java nobug windows-all
|
||||
java/awt/Window/TopLevelLocation/TopLevelLocation.java nobug linux-all,macosx-all
|
||||
java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java nobug macosx-all
|
||||
@@ -124,7 +123,6 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
|
||||
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java nobug macosx-all,windows-all
|
||||
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.html nobug linux-all,windows-all
|
||||
java/awt/event/KeyEvent/RobotCrash/RobotCrash.java nobug linux-all,windows-all
|
||||
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java nobug macosx-all,linux-all
|
||||
java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java nobug macosx-all,windows-all
|
||||
java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -144,6 +142,7 @@ java/awt/hidpi/properties/HiDPIPropertiesUnixTest.java
|
||||
java/awt/hidpi/properties/HiDPIPropertiesWindowsTest.java nobug windows-all
|
||||
java/awt/image/DrawImage/EABlitTest.java nobug windows-all
|
||||
java/awt/image/DrawImage/IncorrectOffset.java nobug windows-all
|
||||
java/awt/image/DrawImage/UnmanagedDrawImagePerformance.java JBR-1801 windows-all
|
||||
java/awt/image/VolatileImage/DrawBufImgOp.java nobug windows-all
|
||||
java/awt/image/VolatileImage/DrawHugeImageTest.java nobug windows-all
|
||||
java/awt/image/VolatileImage/TransparentVImage.java nobug windows-all
|
||||
@@ -153,8 +152,9 @@ java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsT
|
||||
java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java nobug windows-all,linux-all
|
||||
|
||||
javax/swing/JComboBox/4199622/bug4199622.java nobug windows-all
|
||||
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all
|
||||
javax/swing/JDialog/Transparency/TransparencyTest.java nobug macosx-all,windows-all
|
||||
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all,linux-all
|
||||
javax/swing/JComponent/6989617/bug6989617.java nobug macosx-all
|
||||
javax/swing/JDialog/Transparency/TransparencyTest.java nobug linux-all,macosx-all,windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest.java nobug windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest_i18n.java nobug windows-all
|
||||
javax/swing/JFileChooser/6489130/bug6489130.java nobug macosx-all
|
||||
@@ -167,27 +167,31 @@ javax/swing/JInternalFrame/6725409/bug6725409.java
|
||||
javax/swing/JInternalFrame/8020708/bug8020708.java nobug windows-all,linux-all
|
||||
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java nobug macosx-all,linux-all,windows-all
|
||||
javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java nobug macosx-all
|
||||
javax/swing/JInternalFrame/NormalBoundsTest.java nobug macosx-all
|
||||
javax/swing/JInternalFrame/Test6802868.java nobug macosx-all,linux-all
|
||||
javax/swing/JLabel/7004134/bug7004134.java nobug macosx-all,linux-all
|
||||
javax/swing/JList/6510999/bug6510999.java nobug linux-all,macosx-all,windows-all
|
||||
javax/swing/JList/BasicListTest.java nobug macosx-all
|
||||
javax/swing/JMenu/6538132/bug6538132.java nobug windows-all
|
||||
javax/swing/JMenu/8178430/LabelDotTest.java nobug linux-all
|
||||
javax/swing/JMenuItem/8139169/ScreenMenuBarInputTwice.java nobug macosx-all
|
||||
javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java nobug windows-all
|
||||
javax/swing/JOptionPane/6428694/bug6428694.java nobug windows-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java nobug windows-all
|
||||
javax/swing/JPopupMenu/6544309/bug6544309.java nobug linux-all,windows-all
|
||||
javax/swing/JPopupMenu/6691503/bug6691503.java nobug macosx-all
|
||||
javax/swing/JPopupMenu/6827786/bug6827786.java nobug windows-all
|
||||
javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java nobug macosx-all,windows-all
|
||||
javax/swing/JRadioButton/8041561/bug8041561.java nobug windows-all
|
||||
javax/swing/JScrollBar/7163696/Test7163696.java nobug windows-all
|
||||
javax/swing/JScrollBar/bug4202954/bug4202954.java nobug windows-all
|
||||
javax/swing/JSlider/6401380/bug6401380.java nobug windows-all
|
||||
javax/swing/JTabbedPane/7161568/bug7161568.java nobug windows-all
|
||||
javax/swing/JTextArea/7049024/bug7049024.java.bug7049024 nobug linux-all
|
||||
javax/swing/JTabbedPane/7161568/bug7161568.java nobug windows-all,linux-all
|
||||
javax/swing/JTabbedPane/7170310/bug7170310.java nobug macosx-all,linux-all
|
||||
javax/swing/JTextArea/8149849/DNDTextToScaledArea.java nobug windows-all
|
||||
javax/swing/JToolTip/6219960/bug6219960.java nobug macosx-all,windows-all
|
||||
javax/swing/JTree/4633594/JTreeFocusTest.java nobug macosx-all,windows-all
|
||||
javax/swing/JTree/6578666/bug6578666.java nobug macosx-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucent.java nobug windows-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentGradient.java nobug windows-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -198,7 +202,7 @@ javax/swing/event/RightAltKeyTest.java
|
||||
javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java nobug linux-all,windows-all
|
||||
javax/swing/plaf/nimbus/8041642/ScrollBarThumbVisibleTest.java nobug windows-all
|
||||
javax/swing/plaf/nimbus/8041642/bug8041642.java nobug windows-all
|
||||
javax/swing/plaf/nimbus/8057791/bug8057791.java nobug windows-all
|
||||
javax/swing/plaf/nimbus/8057791/bug8057791.java nobug windows-all,linux-all
|
||||
javax/swing/plaf/nimbus/TestNimbusOverride.java nobug windows-all
|
||||
javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java nobug windows-all
|
||||
javax/swing/plaf/synth/SynthScrollbarThumbPainter/SynthScrollbarThumbPainterTest.java nobug windows-all
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.awt.geom.QuadCurve2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -44,6 +45,7 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class RenderPerfTest {
|
||||
private final static int N = 1000;
|
||||
private final static int K = 5;
|
||||
private final static float WIDTH = 800;
|
||||
private final static float HEIGHT = 800;
|
||||
private final static float R = 25;
|
||||
@@ -187,6 +189,32 @@ public class RenderPerfTest {
|
||||
}
|
||||
}
|
||||
|
||||
static class RandomTextParticleRenderer extends TextParticleRenderer {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
Random rnd = new Random();
|
||||
int sLen;
|
||||
|
||||
|
||||
RandomTextParticleRenderer(int n, int k, float r, Object hint) {
|
||||
super(n, r, hint);
|
||||
sLen = k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, hint);
|
||||
|
||||
setPaint(g2d, id);
|
||||
buffer.setLength(0);
|
||||
for (int i = 0; i < sLen; i++) {
|
||||
buffer.appendCodePoint(0x20 + (Math.abs(rnd.nextInt()) % 0xfd0));
|
||||
}
|
||||
|
||||
g2d.drawString(buffer.toString(),
|
||||
(int)(x[id] - r), (int)(y[id] - r));
|
||||
}
|
||||
|
||||
}
|
||||
static class FlatOvalRotParticleRenderer extends FlatParticleRenderer {
|
||||
|
||||
|
||||
@@ -516,6 +544,8 @@ public class RenderPerfTest {
|
||||
private static final ParticleRenderer whiteTextRendererGray =
|
||||
new WhiteTextParticleRenderer(R, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
|
||||
private static final ParticleRenderer randomTextRendererGray =
|
||||
new RandomTextParticleRenderer(N, K, R, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
|
||||
@Test
|
||||
public void testFlatBubbles() throws Exception {
|
||||
@@ -752,6 +782,25 @@ public class RenderPerfTest {
|
||||
report("TextLCD", fps);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRandomTextBubblesGray() throws Exception {
|
||||
|
||||
double fps = (new PerfMeter()).exec(new Renderable() {
|
||||
@Override
|
||||
public void render(Graphics2D g2d) {
|
||||
balls.render(g2d, randomTextRendererGray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
balls.update();
|
||||
}
|
||||
});
|
||||
|
||||
report("RandomTextGray", fps);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextBubblesGray() throws Exception {
|
||||
|
||||
|
||||
139
test/jdk/jbu/quality/text/BundledFontTest.java
Normal file
139
test/jdk/jbu/quality/text/BundledFontTest.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package quality.text;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BundledFontTest {
|
||||
/* Tests for the following font names:
|
||||
"droid sans"
|
||||
"droid sans bold"
|
||||
"droid sans mono"
|
||||
"droid sans mono slashed"
|
||||
"droid sans mono dotted"
|
||||
"droid serif"
|
||||
"droid serif bold"
|
||||
"fira code"
|
||||
"fira code light"
|
||||
"fira code medium"
|
||||
"fira code retina"
|
||||
"inconsolata"
|
||||
"roboto light"
|
||||
"roboto thin"
|
||||
"source code pro"
|
||||
"jetbrains mono"
|
||||
*/
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private void doTestFont(String name, int style) {
|
||||
|
||||
Font f = new Font(name, style, 20);
|
||||
String family = f.getFamily(Locale.ENGLISH);
|
||||
|
||||
Assert.assertTrue(family.equalsIgnoreCase(name));
|
||||
}
|
||||
|
||||
private void doTestFont(String name)
|
||||
throws Exception {
|
||||
doTestFont(name, Font.PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSans() throws Exception {
|
||||
doTestFont("Droid Sans");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSansBold() throws Exception {
|
||||
doTestFont("Droid Sans");
|
||||
doTestFont("Droid Sans", Font.BOLD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSansMono() throws Exception {
|
||||
doTestFont("Droid Sans Mono");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSansMonoSlashed() throws Exception {
|
||||
doTestFont("Droid Sans Mono Slashed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSansMonoDotted() throws Exception {
|
||||
doTestFont("Droid Sans Mono Dotted");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSerif() throws Exception {
|
||||
doTestFont("Droid Serif");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSerifBold() throws Exception {
|
||||
doTestFont("Droid Serif");
|
||||
doTestFont("Droid Serif", Font.BOLD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDroidSerifItalic() throws Exception {
|
||||
doTestFont("Droid Serif");
|
||||
doTestFont("Droid Serif", Font.ITALIC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFiraCode() throws Exception {
|
||||
doTestFont("Fira Code");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFiraCodeLight() throws Exception {
|
||||
doTestFont("Fira Code Light");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFiraCodeMedium() throws Exception {
|
||||
doTestFont("Fira Code Medium");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInconsolata() throws Exception {
|
||||
doTestFont("Inconsolata");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotoLight() throws Exception {
|
||||
doTestFont("Roboto Light");
|
||||
}
|
||||
@Test
|
||||
public void testRobotoThin() throws Exception {
|
||||
doTestFont("Roboto Thin");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSourceCodePro() throws Exception {
|
||||
doTestFont("Source Code Pro");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJetBrainsMono() throws Exception {
|
||||
doTestFont("JetBrains Mono");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJetBrainsMonoBold() throws Exception {
|
||||
doTestFont("JetBrains Mono", Font.BOLD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJetBrainsMonoItalic() throws Exception {
|
||||
doTestFont("JetBrains Mono", Font.ITALIC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJetBrainsMonoBoldItalic() throws Exception {
|
||||
doTestFont("JetBrains Mono", Font.BOLD | Font.ITALIC);
|
||||
}
|
||||
}
|
||||
@@ -354,10 +354,6 @@ public class Platform {
|
||||
* This should match the #if condition in ClassListParser::load_class_from_source().
|
||||
*/
|
||||
public static boolean areCustomLoadersSupportedForCDS() {
|
||||
boolean isLinux = Platform.isLinux();
|
||||
boolean is64 = Platform.is64bit();
|
||||
boolean isSolaris = Platform.isSolaris();
|
||||
|
||||
return (is64 && (isLinux || isSolaris));
|
||||
return (is64bit() && (isLinux() || isSolaris() || isOSX() || isWindows()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user