Compare commits

..

112 Commits

Author SHA1 Message Date
Alexey Ushakov
396b5c6e35 Merge branch 'new_fonts' of github.com:/JetBrains/JetBrainsRuntime into new_fonts 2019-10-18 20:19:32 +03:00
Alexey Ushakov
0a99632956 JBR-1925 JetBrainsMono fonts update to v0.20
Updated the fonts to v0.20
2019-10-18 20:11:22 +03:00
Alexey Ushakov
89797f94c9 JBR-1925 JetBrainsMono fonts update to v0.20
Updated the fonts to v0.20
2019-10-18 20:02:54 +03:00
Vitaly Provodin
90a36251b6 JBR-1821: Notarize JBR bundles as a standalone app (follow up) 2019-10-18 20:23:59 +07:00
Kirill Kirichenko
5a29d4ade9 JBR-1874 Cursor not changing from 'default' to 'text'. Additional fix after reopening. 2019-10-18 10:43:30 +03:00
Alexey Ushakov
a0b235eb24 Revert "JBR-1756 use CoreText for all font rendering on Catalina"
This reverts commit acdc0ea3
2019-10-17 20:16:16 +03:00
Alexey Ushakov
20546081aa Revert "JBR-1863, JBR-1868 correct advances on Catalina"
This reverts commit d5868e8f
2019-10-17 20:16:16 +03:00
Elena Sayapina
b99c1e7b5c JBR-1417 Regression test update, fixed focus issue on a certain TC agents by adding frame.toFront() 2019-10-16 19:42:25 +07:00
Vitaly Provodin
aebc0cdb79 JBR-1821: Notarize JBR bundles as a standalone app 2019-10-16 17:05:06 +07:00
Elena Sayapina
d757108517 JBR-1417 Regression test update, additional focus check was added 2019-10-16 13:20:11 +07:00
Elena Sayapina
6ea9530d9f JBR-1417 Regression test update, fixed test compilation, added missed import 2019-10-16 12:22:27 +07:00
Elena Sayapina
9fe5c778d9 JBR-1417 Regression test update, made fail check more straightforward 2019-10-15 19:09:57 +07:00
Konstantin Bulenkov
529d5c8bcc Remove JetBrains Mono Italic until UX-973 is fixed 2019-10-12 14:57:33 +03:00
Vitaly Provodin
9331ecada6 updated JTreg exclude list 2019-10-11 18:17:55 +07:00
Vitaly Provodin
8781991e67 updated JTreg exclude list 2019-10-11 18:17:00 +07:00
Eugene Petrenko
7a24f5a493 project setup improvements
git ignore .idea and cmake build folders folder under /jb
make configure script unix executable to support ./configure runs
add section for building on macOS
2019-10-10 12:24:41 +02:00
Eugene Petrenko
82dcb03358 cds - add more logging to -Xshare:dump errors
log exception along with "Preload Warning: Verification failed" warning messages
advanced debug logging to diagnose listed class was not defined error from -Xshare:dump
more detailed error logging from the Xshare:dump phase
2019-10-10 12:24:41 +02:00
Eugene Petrenko
691e7d46ed Support AppCDS on Windows via a variation of the older JDK fix 8185145
8185145: AppCDS custom loader support on Mac OS X
2019-10-10 12:24:41 +02:00
Calvin Cheung
51ec616d23 8185145: AppCDS custom loader support on Mac OS X
Reviewed-by: dholmes, gziemski
2019-10-10 12:24:41 +02:00
Vitaly Provodin
b3a41ba6d9 updated JTreg exclude list 2019-10-10 09:09:50 +07:00
Vitaly Provodin
2fb4c904ab Revert "cds - log exception along with "Preload Warning: Verification failed" warning messages"
This reverts commit c3839647
2019-10-05 10:43:18 +07:00
Vitaly Provodin
ab1e8dc136 Revert "add section for building on macOS"
This reverts commit 6b7ccbdc
2019-10-05 10:43:09 +07:00
Vitaly Provodin
e480592b39 Revert "cds - advanced debug logging to diagnose listed class was not defined error from -Xshare:dump"
This reverts commit 48478ca6
2019-10-05 10:43:00 +07:00
Vitaly Provodin
99dae8d59e Revert "cds - more detailed error logging from the Xshare:dump phase"
This reverts commit b74750d8
2019-10-05 10:42:51 +07:00
Vitaly Provodin
2e672f6c2f updated JTreg exclude list 2019-10-05 06:35:26 +07:00
Vitaly Provodin
a31ba4ca30 Merge remote-tracking branch 'origin/master' 2019-10-05 06:35:19 +07:00
Alexey Ushakov
1e900726f9 JBR-1721 Cant open project on macOS 10.15
Removed workaround for early Catalina betas
2019-10-04 13:58:57 +03:00
Dmitry Batrak
6f60cad1a9 JBR-1879 Wrong symbols in evaluate expression dialog
add clarifying comment to code
2019-10-03 11:57:33 +03:00
Eugene Petrenko
b74750d845 cds - more detailed error logging from the Xshare:dump phase 2019-10-03 11:35:49 +07:00
Eugene Petrenko
48478ca6e2 cds - advanced debug logging to diagnose listed class was not defined error from -Xshare:dump 2019-10-03 11:35:48 +07:00
Eugene Petrenko
6b7ccbdccc add section for building on macOS 2019-10-03 11:35:48 +07:00
Eugene Petrenko
c3839647c6 cds - log exception along with "Preload Warning: Verification failed" warning messages 2019-10-03 11:35:47 +07:00
Alexey Ushakov
a7b4c9449a JBR-1885 JetBrainsMono fonts update to v0.19
Updated the fonts to v0.19. Bundled italic fonts
2019-10-01 22:52:11 +03:00
Vitaly Provodin
380c17456c moving test/jdk/jb/java/awt/font/TextLayout to test/jdk/jb/java/awt/Font/TextLayout 2019-10-01 10:06:39 +07:00
Dmitry Batrak
ba7496606d JBR-1879 Wrong symbols in evaluate expression dialog
a better check that font used by GDI matches the font used by JRE
2019-09-30 14:47:16 +03:00
Dmitry Batrak
1ee493a1f9 JBR-1879 Wrong symbols in evaluate expression dialog
rollback fix for JBR-1777
2019-09-30 14:46:51 +03:00
Dmitry Batrak
fc25d3598c test case for JBR-1875 2019-09-27 15:11:32 +03:00
Dmitry Batrak
598452f079 JBR-1875 Modal dialogs text partly lost
This reverts JBR-1838 (Backport fix for JDK-8226513 from OpenJDK)
2019-09-27 15:11:00 +03:00
Vitaly Provodin
c49e042535 updated JTreg exclude list 2019-09-27 08:34:44 +07:00
Alexey Ushakov
94a4eb7002 JBR-1874 Cursor not changing from 'default' to 'text'
Prevent OS from changing cursor
2019-09-26 12:58:52 +03:00
Alexey Ushakov
fa160d2d7d JBR-1872 Backport JDK-8217731 Font rendering and glyph spacing has changed from jdk-8 to jdk-11
The fix backported with some minor modifications
2019-09-25 17:42:50 +03:00
Vitaly Provodin
c0397fbade updated JTreg exclude list 2019-09-25 16:51:32 +07:00
Dennis Ushakov
d5868e8fe1 JBR-1863, JBR-1868 correct advances on Catalina 2019-09-24 19:56:24 +03:00
Dennis Ushakov
e40bb508e3 JBR-1850: on macOS fonts should be sorted by weight to ensure proper population of the families 2019-09-24 18:48:51 +03:00
Denis Konoplev
c92af06680 Fix package name 2019-09-24 18:01:45 +03:00
Vitaly Provodin
178708f1cb updated JTreg exclude list 2019-09-23 16:49:54 +07:00
Vitaly Provodin
2e2cae243c updated JTreg exclude list 2019-09-20 17:09:23 +07:00
Vitaly Provodin
7a2a7986be updated JTreg exclude list 2019-09-20 14:09:41 +07:00
Artem Bochkarev
5839539379 JBR-1851: check NSArray length
and make more exception-safe
and minor optimization for logging (cache jobjects)
2019-09-17 18:28:32 +03:00
Vitaly Provodin
1b04112158 updated JTreg exclude list 2019-09-17 10:35:38 +07:00
Denis Fokin
a5dcce7541 JBR-1844 Settings window header color is not changed when switching and applying a theme 2019-09-16 12:54:00 +03:00
Vitaly Provodin
976c97f409 updated JTreg exclude list 2019-09-16 15:50:50 +07:00
Vitaly Provodin
4ef573bfb7 updated JTreg exclude list 2019-09-14 06:19:23 +07:00
Artem Bochkarev
0efbe5d9b9 JBR-1762: fixed review comments 2019-09-13 18:54:55 +03:00
Artem Bochkarev
7a2ccfc521 JBR-1762: request focus of immediate parent when dispose popup
because requesting focus for frame-parent causes to close whole popup chain
2019-09-13 18:54:49 +03:00
Artem Bochkarev
969255904b JBR-1841: allow deferred disabling of InputMethods-support 2019-09-13 16:05:01 +03:00
Vitaly Provodin
27d2f21f65 updated JTreg exclude list 2019-09-12 14:41:54 +07:00
Alexey Ushakov
7f032e3fe7 JBR-1840 Update new fonts up to v0.18
Updated new fonts
2019-09-12 00:48:40 +03:00
Dmitry Batrak
6b50fc8871 IDEA-222435 Backport fix for JDK-8226513 from OpenJDK
apply fix from OpenJDK
2019-09-11 11:36:27 +03:00
Dmitry Batrak
81d989b511 IDEA-222435 Backport fix for JDK-8226513 from OpenJDK
revert fixes for JBR-934 and JBR-1604
2019-09-11 11:34:39 +03:00
Dennis Ushakov
acdc0ea38e JBR-1756 use CoreText for all font rendering on Catalina 2019-09-10 10:46:32 +03:00
Artem Bochkarev
4cd8e27964 JBR-1788: use old codepath of CFileDialog (with completionHandler) when running under mojave (or previous)
fixed JBR-1788: File Chooser on Mac is in the center of the screen
2019-09-09 19:51:01 +03:00
Artem Bochkarev
8445f53d85 JBR-1668: add hardcoded default values for preferences node NSServicesStatus 2019-09-09 19:09:49 +03:00
Anton Tarasov
eaa04303a7 JBR-1834 [linux] runtime hidpi switch is broken 2019-09-09 17:29:44 +03:00
Vitaly Provodin
29c8d3fecf updated JTreg exclude list 2019-09-06 14:48:30 +07:00
Elena Sayapina
41e89505be JBR-1417 Added new regression test (JBR 11 does not support chain of popups) 2019-09-05 17:56:56 +07:00
Artem Bochkarev
30d479fbd4 JBR-1515: obtain shortcut from OS to check inside AWTView.performKeyEquivalent 2019-09-05 13:06:30 +03:00
Anton Tarasov
4399dc382c JBR-1824 export NSWindow::setIgnoresMouseEvents to java internal API 2019-09-05 12:56:32 +03:00
Alexey Ushakov
e21bc70e8f JBR-1756 San Francisco rendering is broken on Catalina
Added performance test with random glyphs
2019-09-04 15:59:32 +03:00
Vitaly Provodin
08ea095216 updated JTreg exclude list 2019-09-04 16:34:27 +07:00
Dmitry Batrak
7884d54f48 JBR-1777 Wrong glyphs are rendered for Roboto font
refactoring following JR-CR-483
2019-09-04 09:43:35 +03:00
Konstantin Bulenkov
483234fe7d Revert "Update JetBrains Mono to 0.17"
This reverts commit 0fb5c9ed
2019-09-02 16:27:35 +02:00
Dmitry Batrak
6790353282 JBR-1805 Hard to read font rendering for Courier New
updating fix for JBR-1777
2019-09-02 12:15:55 +03:00
Konstantin Bulenkov
0fb5c9ed61 Update JetBrains Mono to 0.17 2019-08-30 15:52:11 +03:00
Vitaly Provodin
5a63351d2a updated JTreg exclude list 2019-08-30 16:44:58 +07:00
Anton Tarasov
eae772aca9 JBR-1802 com/sun/java/accessibility/util/8051626/Bug8051626.java: access denied ("java.lang.RuntimePermission" "getClassLoader") 2019-08-30 12:13:54 +03:00
Vitaly Provodin
b3c4cc9e52 updated JTreg exclude list 2019-08-30 10:10:28 +07:00
Sergey Malenkov
57e46e5dcd Rollback to d4b529ad49 2019-08-29 23:02:04 +03:00
Sergey Malenkov
ba69b0d47d Revert all attempts to fix JBR-1076 2019-08-29 20:59:47 +03:00
Dmitry Batrak
e1c6172e9a JBR-1777 Wrong glyphs are rendered for Roboto font 2019-08-28 17:06:25 +03:00
Anton Tarasov
322526458a JBR-1795 Project opened from Welcome screen goes to backgound after loading 2019-08-27 22:41:19 +03:00
Anton Tarasov
8ae0be8eb6 JBR-1609 Jupyter Notebook eventually causes IDEA to become unresponsive on Mac OSX 2019-08-26 17:24:33 +03:00
Anton Tarasov
4b09614a0e JBR-1786 Weird white border for IDE window 2019-08-26 16:52:15 +03:00
Alexey Ushakov
08ae9ff034 JBR-1778 Font in editor incorrect (always italics)
More unique patterns for 'Anka/Coder'
2019-08-26 16:40:47 +03:00
Alexey Ushakov
251068294e JBR-1778 Font in editor incorrect (always italics)
'Anka/Coder' font support
2019-08-26 15:56:25 +03:00
Denis Fokin
cce5c34181 Exports break windows build because lack of packages 2019-08-26 13:53:51 +03:00
Alexey Ushakov
ec241e4a0a JBR-1778 Font in editor incorrect (always italics)
Added some more patterns to bold and italic detection code
2019-08-23 15:12:07 +03:00
Denis Fokin
f42e6bb30b JBR-1784 File dialogs aren't themed on macOS 2019-08-23 14:39:57 +03:00
Denis Fokin
b3dacc9146 JBR-1779 Can't assign and use Force Touch in 2019.1 2019-08-23 12:55:18 +03:00
Denis Fokin
a2059db21b Export eawt packages 2019-08-23 12:55:18 +03:00
Alexey Ushakov
5119eeee12 JBR-1778 Font in editor incorrect (always italics)
Added -it pattern into italic detection code
2019-08-22 18:59:59 +03:00
Anton Tarasov
d9dfc3c6c5 JBR-1770 [windows] frame does not open as maximized 2019-08-21 14:42:38 +03:00
Artem Bochkarev
1acada7cac JBR-1771: fixed compilation errors (macosx-x86_64-normal-server-fastdebug) 2019-08-21 09:50:38 +03:00
Artem Bochkarev
ec9bd95bfe JBR-1721: don't use completion handler to obtain results from NSOpenPanel
it doesn't invoked in catalina, move handler's logic just after runModal
2019-08-20 17:19:21 +03:00
Dmitry Batrak
5d35e72065 JBR-1761 Printing a comment block in landscape mode results in oddly rotated italic letters 2019-08-20 11:49:58 +03:00
Artem Bochkarev
cf7d535b03 Merge branch 'system_hotkeys' 2019-08-19 18:41:57 +03:00
Egor Ushakov
c959b23697 JBR-1655 Disable "WARNING: An illegal reflective access operation has occurred" - use property jdk.module.illegalAccess.silent 2019-08-16 14:46:55 +03:00
Vitaly Provodin
bdd644eaac updated JTreg exclude list 2019-08-16 09:45:52 +07:00
Dennis Ushakov
d45a8d2113 faster font family loading & lazy font family population
1. NSFont.familyName is faster than loading allFamilyNames
2. Prebuilt list of system fonts
3. Cleanup San Francisco family loading
4. Avoid calling expensive native getWidth on font when creating font family, load styles only when they would be used.
2019-08-15 15:22:19 +03:00
Artem Bochkarev
15f7368309 JBR-1668: add hardcoded descriptions of system actions
and minor fixes

fix memory management
2019-08-14 20:39:34 +03:00
Alexey Ushakov
aa13c8b4ea JBR-1690 Bundle new fonts
Test correction
2019-08-13 15:56:12 +03:00
Alexey Ushakov
83843f9124 JBR-1690 Bundle new fonts
Removed excessive fonts
2019-08-13 14:51:44 +03:00
Alexey Ushakov
ed806bf652 Revert "8194873: right ALT key hotkeys no longer work in Swing components Reviewed-by: serb, psadhukhan"
This reverts commit 05e1a1b2
2019-08-11 13:43:52 +03:00
Alexey Ushakov
56b69b2813 Reverted fix of JDK-8041928: MouseEvent.getModifiersEx gives wrong result because it breaks AltGr shortcuts 2019-08-11 13:43:52 +03:00
Denis Fokin
da03ef94f8 JBR-448 Keyboard shortcuts do not work the same way on different layouts (mac) 2019-08-09 13:49:44 +03:00
Alexey Ushakov
76abb69262 JBR-1690 Bundle new fonts
Update family name for JetBrainsMono-Thin
2019-08-08 17:37:38 +03:00
Alexey Ushakov
2a2e1cfb36 JBR-1690 Bundle new fonts
Updated bundled fonts
2019-08-07 12:35:59 +03:00
Anton Tarasov
12de3e287e JBR-1693 difficult to input Japanese text with "Fast" Key Repeat 2019-08-02 20:17:58 +03:00
Dmitry Batrak
9cc5cbc99b JBR-1714 Italic text is displayed using incorrect glyphs on Windows
improved fix - it keeps generating synthetic italic for system fonts which exist in plain variant only
2019-08-02 17:15:11 +03:00
Dmitry Batrak
46e4cdfcbd JBR-1714 Italic text is displayed using incorrect glyphs on Windows 2019-08-02 15:30:23 +03:00
Artem Bochkarev
9dbcf194c9 JBR-1668: minor fixes
fixed review comments
2019-07-31 13:54:03 +03:00
Artem Bochkarev
6bbe7102e2 JBR-1668: read system keyboard shortcuts
initial support for OS X
2019-07-18 15:13:53 +03:00
67 changed files with 3255 additions and 690 deletions

View File

@@ -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/

0
configure vendored Normal file → Executable file
View File

2
jb/project/jdk-cmake/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.idea
cmake-build-*

View 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>

View 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

View 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 \;

View 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"

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2011, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package com.apple.eawt.event;
/**
* Event indicating a swipe was performed by the user.
*
* @see PressureListener
*
* @since Java for Mac OS X 10.10 Update 3, JDK 8
*/
public class PressureEvent extends GestureEvent {
public double getPressure() {
return pressure;
}
public double getStage() {
return stage;
}
private double pressure;
private double stage;
PressureEvent(double pressure, double stage) {
this.pressure = pressure;
this.stage = stage;
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2011, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package com.apple.eawt.event;
/**
* Listener interface for receiving pressure events.
*
* @see PressureEvent
* @see GestureUtilities
*
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
*/
public interface PressureListener extends GestureListener {
public void pressure(final PressureEvent e);
}

View File

@@ -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());
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -71,6 +71,10 @@ public final class IllegalAccessLogger {
* Prints warnings and a stack trace when illegal access succeeds
*/
DEBUG,
/**
* No warnings when illegal access succeeds
*/
SILENT
}
/**
@@ -123,7 +127,9 @@ public final class IllegalAccessLogger {
public void complete() {
Map<Module, Set<String>> map1 = unmodifiableMap(moduleToConcealedPackages);
Map<Module, Set<String>> map2 = unmodifiableMap(moduleToExportedPackages);
logger = new IllegalAccessLogger(mode, warningStream, map1, map2);
if (mode != Mode.SILENT) {
logger = new IllegalAccessLogger(mode, warningStream, map1, map2);
}
complete = true;
}
}

View File

@@ -734,6 +734,12 @@ public final class ModuleBootstrap {
return;
}
}
// Silence warnings completely if requested explicitly
if (System.getProperty("jdk.module.illegalAccess.silent") != null) {
mode = IllegalAccessLogger.Mode.SILENT;
}
IllegalAccessLogger.Builder builder
= new IllegalAccessLogger.Builder(mode, System.err);

View File

@@ -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);
}
}

View File

@@ -183,37 +183,6 @@ public final class CFontManager extends SunFontManager {
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;
@@ -227,7 +196,6 @@ public final class CFontManager extends SunFontManager {
public Object run() {
if (!loadedAllFonts) {
loadNativeFonts();
registerItalicDerived();
loadedAllFonts = true;
}
return null;

View File

@@ -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() { }

View File

@@ -877,46 +877,21 @@ public class CInputMethod extends InputMethodAdapter {
return false;
}
static void await(CountDownLatch latch) {
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// Executed on AppKit
static void invoke(Runnable runnable, sun.awt.im.InputContext inputContext, Component targetToAppContext) throws InvocationTargetException {
CountDownLatch edtLatch = new CountDownLatch(1);
CountDownLatch tkLatch = new CountDownLatch(1);
AtomicBoolean runOnAppKit = new AtomicBoolean(false);
// Emulate EventQueue.invokeAndWait(runnable) for the runnable that delegates execution
// back to AppKit (JavaFX Event thread), without running secondary loop on AppKit.
InvocationEvent event = new InvocationEvent(targetToAppContext, () -> {
try {
runOnAppKit.set(instanceofJFXPanel(getClientComponent(inputContext)));
if (!runOnAppKit.get()) {
runnable.run();
}
} finally {
edtLatch.countDown();
await(tkLatch);
}
});
assert targetToAppContext != null;
AppContext appContext = SunToolkit.targetToAppContext(targetToAppContext);
SunToolkit.postEvent(appContext, event);
SunToolkit.flushPendingEvents(appContext);
await(edtLatch);
try {
if (runOnAppKit.get()) {
// 1) Do not run secondary msg loop in this case.
// 2) Delegate runnable back to FX when applicable.
LWCToolkit.invokeAndWait(() -> {
runOnAppKit.set(instanceofJFXPanel(getClientComponent(inputContext)));
if (!runOnAppKit.get()) {
runnable.run();
}
} finally {
tkLatch.countDown();
}, targetToAppContext);
if (runOnAppKit.get()) {
runnable.run();
}
}
}

View File

@@ -35,7 +35,9 @@ import java.awt.event.MouseEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.KeyEvent;
import java.security.PrivilegedAction;import java.util.Locale;import java.util.MissingResourceException;import java.util.ResourceBundle;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Locale;import java.util.MissingResourceException;import java.util.ResourceBundle;
/**
* Translates NSEvents/NPCocoaEvents into AWT events.
@@ -199,13 +201,28 @@ final class CPlatformResponder {
return ch;
}
private static final String [] cyrillicKeyboardLayouts = new String [] {
"com.apple.keylayout.Russian",
"com.apple.keylayout.RussianWin",
"com.apple.keylayout.Russian-Phonetic",
"com.apple.keylayout.Byelorussian",
"com.apple.keylayout.Ukrainian",
"com.apple.keylayout.UkrainianWin",
"com.apple.keylayout.Bulgarian",
"com.apple.keylayout.Serbian"
};
private static boolean isCyrillicKeyboardLayout() {
return Arrays.stream(cyrillicKeyboardLayouts).anyMatch(l -> l.equals(LWCToolkit.getKeyboardLayoutId()));
}
/**
* Handles key events.
*/
void handleKeyEvent(NSEvent nsEvent)
{
if (useOldKeyEventProcessing) {
if (useOldKeyEventProcessing || isCyrillicKeyboardLayout()) {
handleKeyEvent(
nsEvent.getType(),
nsEvent.getModifierFlags(),

View File

@@ -147,7 +147,8 @@ public final class LWCToolkit extends LWToolkit {
private static native void initIDs();
private static native void initAppkit(ThreadGroup appKitThreadGroup, boolean headless);
private static native void switchKeyboardLayoutNative(String layoutName);
private static native String getKeyboardLayoutNativeId();
static native String getKeyboardLayoutNativeId();
private static CInputMethodDescriptor sInputMethodDescriptor;
@@ -479,7 +480,9 @@ public final class LWCToolkit extends LWToolkit {
@Override
public Insets getScreenInsets(final GraphicsConfiguration gc) {
return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
CGraphicsDevice gd = ((CGraphicsConfig) gc).getDevice();
// Avoid deadlock with input methods
return LWCToolkit.SelectorPerformer.perform(gd::getScreenInsets);
}
@Override
@@ -747,19 +750,21 @@ public final class LWCToolkit extends LWToolkit {
assert EventQueue.isDispatchThread();
if (executor == null) {
// init on EDT
executor = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
60L, TimeUnit.SECONDS,
new SynchronousQueue<>(),
new ThreadFactory() {
private ThreadFactory factory = Executors.privilegedThreadFactory();
@Override
public Thread newThread(Runnable r) {
Thread t = factory.newThread(r);
t.setDaemon(true);
t.setName("AWT-SelectorPerformer " + t.getName());
return t;
}
});
AccessController.doPrivileged((PrivilegedAction<?>)() ->
executor = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
60L, TimeUnit.SECONDS,
new SynchronousQueue<>(),
new ThreadFactory() {
private ThreadFactory factory = Executors.privilegedThreadFactory();
@Override
public Thread newThread(Runnable r) {
Thread t = factory.newThread(r);
t.setDaemon(true);
t.setName("AWT-SelectorPerformer " + t.getName());
return t;
}
})
);
}
LinkedBlockingQueue<InvocationEvent> currentQueue;
synchronized (invocations) {

View File

@@ -64,6 +64,7 @@ static BOOL shouldUsePressAndHold() {
return shouldUsePressAndHold;
}
extern bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, NSString * chars);
@implementation AWTView
@@ -362,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]);
}
/**

View File

@@ -73,6 +73,7 @@
// NSWindow overrides delegate methods
- (BOOL) canBecomeKeyWindow;
- (void) becomeKeyWindow;
- (BOOL) canBecomeMainWindow;
- (BOOL) worksWhenModal;
- (void)sendEvent:(NSEvent *)event;

View File

@@ -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
@@ -165,6 +174,15 @@ AWT_NS_WINDOW_IMPLEMENTATION
b:[event deltaY]];
}
- (void)pressureChangeWithEvent:(NSEvent *)event {
float pressure = event.pressure;
[self postGesture:event
as:com_apple_eawt_event_GestureHandler_PRESSURE
a:pressure
b:(([event respondsToSelector:@selector(stage)]) ? ((NSInteger)[event stage]) : -1)
];
}
@end
@implementation AWTWindow_Panel
AWT_NS_WINDOW_IMPLEMENTATION
@@ -331,12 +349,6 @@ AWT_ASSERT_APPKIT_THREAD;
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
}
if (IS(self.styleBits, DARK)) {
[self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
} else {
[self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantLight]];
}
return self;
}
@@ -526,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) {
@@ -978,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
@@ -987,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);
@@ -1025,6 +1063,12 @@ JNF_COCOA_ENTER(env);
}
window.styleBits = newBits;
if (IS(window.styleBits, DARK)) {
[nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
} else {
[nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantLight]];
}
}];
JNF_COCOA_EXIT(env);

View File

@@ -165,26 +165,30 @@ canChooseDirectories:(BOOL)inChooseDirectories
[CMenuBar activate:menuBar modallyDisabled:isDisabled];
}
[thePanel beginSheetModalForWindow:fOwner completionHandler:^(NSInteger result) {
[thePanel setAppearance:fOwner.appearance];
if (result == NSFileHandlingPanelOKButton) {
void (^onComplete)(BOOL, BOOL) = ^(BOOL responseOK, BOOL doStopModal) {
if (responseOK) {
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
fURLs = (fMode == java_awt_FileDialog_LOAD)
? [openPanel URLs]
: [NSArray arrayWithObject:[openPanel URL]];
fPanelResult = NSFileHandlingPanelOKButton;
} else {
fURLs = [NSArray array];
}
[fURLs retain];
[NSApp stopModal];
if (menuBar != nil) {
[CMenuBar activate:menuBar modallyDisabled:NO];
}
} else {
fURLs = [NSArray array];
}
];
[fURLs retain];
if (doStopModal)
[NSApp stopModal];
if (menuBar != nil) {
[CMenuBar activate:menuBar modallyDisabled:NO];
}
};
[thePanel beginSheetModalForWindow:fOwner completionHandler:^(NSInteger result) {
onComplete(result == NSFileHandlingPanelOKButton, YES);
}];
[NSApp runModalForWindow:thePanel];
}

View 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(&registeredHotKeys) == 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

View File

@@ -636,9 +636,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
"Menu.submenuPopupOffsetX", -2,
"Menu.submenuPopupOffsetY", 3,
"Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask(), metaMask,
SwingUtilities2.setAltGraphMask(
SwingUtilities2.getSystemMnemonicKeyMask())
SwingUtilities2.getSystemMnemonicKeyMask(), metaMask
},
"Menu.cancelMode", "hideMenuTree",

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -496,18 +496,9 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
}
}
if (isPaint) {
// Fallback to normal painting in undecorated non-opaque dialogs
// and frames to resolve black background problem
Window window = SunToolkit.getContainingWindow(c);
if ((window instanceof Dialog && ((Dialog)window).isUndecorated() ||
window instanceof Frame && ((Frame)window).isUndecorated()) &&
bsg != null && !window.isOpaque() &&
((SunGraphics2D)bsg).getSurfaceData().getTransparency() ==
Transparency.OPAQUE) {
return false;
}
}
if (bsg != null && !c.isOpaque() &&
((SunGraphics2D)bsg).getSurfaceData().getTransparency() ==
Transparency.OPAQUE) return false;
if (isPaint && c == rootJ && x == 0 && y == 0 &&
c.getWidth() == w && c.getHeight() == h) {

View File

@@ -26,8 +26,8 @@
package javax.swing.plaf.basic;
import sun.swing.DefaultLookup;
import sun.swing.SwingUtilities2;
import sun.swing.UIAction;
import sun.swing.SwingUtilities2;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
@@ -156,17 +156,8 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
map.clear();
map.put(KeyStroke.getKeyStroke(m, BasicLookAndFeel.getFocusAcceleratorKeyMask(), false),
"pressed");
map.put(KeyStroke.getKeyStroke(m, SwingUtilities2.setAltGraphMask
(BasicLookAndFeel.getFocusAcceleratorKeyMask()),
false),
"pressed");
map.put(KeyStroke.getKeyStroke(m, BasicLookAndFeel.getFocusAcceleratorKeyMask(), true),
"released");
map.put(KeyStroke.getKeyStroke(m,
SwingUtilities2.setAltGraphMask
(BasicLookAndFeel.getFocusAcceleratorKeyMask()), true),
"released");
map.put(KeyStroke.getKeyStroke(m, 0, true), "released");
}
else {

View File

@@ -36,7 +36,6 @@ import javax.swing.text.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.Component;
import java.awt.Container;
@@ -403,10 +402,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
}
inputMap.clear();
inputMap.put(KeyStroke.getKeyStroke(dka, BasicLookAndFeel.getFocusAcceleratorKeyMask(), false), "press");
inputMap.put(KeyStroke.getKeyStroke(dka,
SwingUtilities2.setAltGraphMask (
BasicLookAndFeel.getFocusAcceleratorKeyMask()),
false), "press");
}
else {
InputMap inputMap = SwingUtilities.getUIInputMap
@@ -525,8 +520,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
int dka = label.getDisplayedMnemonic();
putOnRelease(inputMap, dka, BasicLookAndFeel
.getFocusAcceleratorKeyMask());
putOnRelease(inputMap, dka, SwingUtilities2.setAltGraphMask (
BasicLookAndFeel.getFocusAcceleratorKeyMask()));
// Need this when the sticky keys are enabled
putOnRelease(inputMap, dka, 0);
// Need this if ALT is released before the accelerator
@@ -546,9 +539,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
int dka = label.getDisplayedMnemonic();
removeOnRelease(inputMap, dka, BasicLookAndFeel
.getFocusAcceleratorKeyMask());
removeOnRelease(inputMap, dka,
SwingUtilities2.setAltGraphMask (
BasicLookAndFeel.getFocusAcceleratorKeyMask()));
removeOnRelease(inputMap, dka, 0);
removeOnRelease(inputMap, KeyEvent.VK_ALT, 0);
}
@@ -565,9 +555,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
} else {
putOnRelease(inputMap, dka, BasicLookAndFeel
.getFocusAcceleratorKeyMask());
putOnRelease(inputMap, dka,
SwingUtilities2.setAltGraphMask (
BasicLookAndFeel.getFocusAcceleratorKeyMask()));
// Need this when the sticky keys are enabled
putOnRelease(inputMap, dka, 0);
}
@@ -585,9 +572,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
if (isCommand) {
removeOnRelease(inputMap, dka, BasicLookAndFeel
.getFocusAcceleratorKeyMask());
removeOnRelease(inputMap, dka,
SwingUtilities2.setAltGraphMask (
BasicLookAndFeel.getFocusAcceleratorKeyMask()));
removeOnRelease(inputMap, dka, 0);
} else {
removeOnRelease(inputMap, KeyEvent.VK_ALT, 0);

View File

@@ -1093,9 +1093,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
"Menu.submenuPopupOffsetX", 0,
"Menu.submenuPopupOffsetY", 0,
"Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask(),
SwingUtilities2.setAltGraphMask(
SwingUtilities2.getSystemMnemonicKeyMask())
SwingUtilities2.getSystemMnemonicKeyMask()
},
"Menu.crossMenuMnemonic", Boolean.TRUE,
// Menu.cancelMode affects the cancel menu action behaviour;

View File

@@ -434,7 +434,6 @@ public class BasicMenuItemUI extends MenuItemUI
return null;
}
@SuppressWarnings("deprecation")
void updateAcceleratorBinding() {
KeyStroke accelerator = menuItem.getAccelerator();
InputMap windowInputMap = SwingUtilities.getUIInputMap(
@@ -451,45 +450,6 @@ public class BasicMenuItemUI extends MenuItemUI
JComponent.WHEN_IN_FOCUSED_WINDOW, windowInputMap);
}
windowInputMap.put(accelerator, "doClick");
int modifiers = accelerator.getModifiers();
if (((modifiers & InputEvent.ALT_DOWN_MASK) != 0) &&
((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0)) {
//When both ALT and ALT_GRAPH are set, add the ALT only
// modifier keystroke which is used for left ALT key.
// Unsetting the ALT_GRAPH will do that as ALT is already set
modifiers &= ~InputEvent.ALT_GRAPH_DOWN_MASK;
modifiers &= ~InputEvent.ALT_GRAPH_MASK;
KeyStroke keyStroke = KeyStroke.getKeyStroke(accelerator.getKeyCode(),
modifiers, accelerator.isOnKeyRelease());
windowInputMap.put(keyStroke, "doClick");
} else if (((modifiers & InputEvent.ALT_DOWN_MASK) != 0) && (
(modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) == 0)) {
//When only ALT modifier is set, add the ALT + ALT_GRAPH
// modifier keystroke which is used for right ALT key
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
KeyStroke keyStroke = KeyStroke.getKeyStroke(accelerator.getKeyCode(),
modifiers, accelerator.isOnKeyRelease());
windowInputMap.put(keyStroke, "doClick");
} else if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
//When only ALT_GRAPH is set, remove the ALT_GRAPH only
// modifier and add the ALT and ALT+ALT_GRAPH modifiers
// keystroke which are used for left ALT key and right ALT
// respectively
modifiers &= ~InputEvent.ALT_GRAPH_DOWN_MASK;
modifiers &= ~InputEvent.ALT_GRAPH_MASK;
modifiers |= InputEvent.ALT_DOWN_MASK;
KeyStroke keyStroke = KeyStroke.getKeyStroke(accelerator.getKeyCode(),
modifiers, accelerator.isOnKeyRelease());
windowInputMap.put(keyStroke, "doClick");
//Add ALT+ALT_GRAPH modifier which is used for right ALT key
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
keyStroke = KeyStroke.getKeyStroke(accelerator.getKeyCode(),
modifiers, accelerator.isOnKeyRelease());
windowInputMap.put(keyStroke, "doClick");
}
}
}

View File

@@ -129,8 +129,7 @@ public class BasicMenuUI extends BasicMenuItemUI
int[] shortcutKeys = (int[])DefaultLookup.get(menuItem, this,
"Menu.shortcutKeys");
if (shortcutKeys == null) {
shortcutKeys = new int[] {KeyEvent.ALT_MASK,
KeyEvent.ALT_MASK | KeyEvent.ALT_GRAPH_MASK};
shortcutKeys = new int[] {KeyEvent.ALT_MASK};
}
if (mnemonic == lastMnemonic) {
return;

View File

@@ -606,10 +606,6 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
}
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, BasicLookAndFeel.getFocusAcceleratorKeyMask()),
"setSelectedIndex");
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic,
SwingUtilities2.setAltGraphMask(
BasicLookAndFeel.getFocusAcceleratorKeyMask())),
"setSelectedIndex");
mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
}

View File

@@ -42,8 +42,6 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.synth.SynthUI;
import sun.swing.DefaultLookup;
import sun.awt.AppContext;
import sun.swing.SwingUtilities2;
import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
/**
@@ -513,10 +511,6 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
km.clear();
if (accelerator != '\0') {
km.put(KeyStroke.getKeyStroke(accelerator, BasicLookAndFeel.getFocusAcceleratorKeyMask()), "requestFocus");
km.put(KeyStroke.getKeyStroke(accelerator,
SwingUtilities2.setAltGraphMask(
BasicLookAndFeel.getFocusAcceleratorKeyMask())),
"requestFocus");
}
}
}

View File

@@ -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.

View File

@@ -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,
@@ -421,8 +422,12 @@ public class FileFontStrike extends PhysicalStrike {
long getGlyphImageFromWindows(int glyphCode) {
String family = fileFont.getFamilyName(null);
FontFamily fontFamily = FontFamily.getFamily(family);
int style = desc.style & Font.BOLD | desc.style & Font.ITALIC
| fileFont.getStyle();
if (fontFamily != null && fontFamily.getFont(style) != fileFont) {
style = fileFont.getStyle();
}
int size = intPtSize;
byte charset = fileFont.getSupportedCharset();
long ptr = 0;
@@ -437,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);

View File

@@ -55,15 +55,16 @@ public abstract class Font2D {
public static final int DEFAULT_RANK = 4;
private static final String[] boldNames = {
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", };
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", "black", "coder-b"};
private static final String[] italicNames = {
"italic", "cursiva", "oblique", "inclined", };
"italic", "cursiva", "oblique", "inclined", "-it", "-lightit", "coder-i"};
private static final String[] boldItalicNames = {
"bolditalic", "bold-italic", "bold italic",
"boldoblique", "bold-oblique", "bold oblique",
"demibold italic", "negreta cursiva","demi oblique", };
"demibold italic", "negreta cursiva","demi oblique",
"-boldit", "-blackit", "coder-bi"};
private static final FontRenderContext DEFAULT_FRC =
new FontRenderContext(null, false, false);

View File

@@ -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();
}
}
}

View File

@@ -0,0 +1,5 @@
package sun.font;
interface FontWithDerivedItalic {
Font2D createItalic();
}

View File

@@ -329,10 +329,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
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 {

View File

@@ -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+

View File

@@ -2194,15 +2194,6 @@ public class SwingUtilities2 {
return -1;
}
/**
* Sets the InputEvent.ALT_GRAPH mask on any modifier passed to the function
* @param modifier the modifier passed
* @return the modifier retiurned with ALT_GRAPH flag set
*/
public static int setAltGraphMask(int modifier) {
return (modifier | InputEvent.ALT_GRAPH_DOWN_MASK);
}
@SuppressWarnings("deprecation")
public static int getSystemMnemonicKeyMask() {
Toolkit toolkit = Toolkit.getDefaultToolkit();

Binary file not shown.

View File

@@ -1,4 +1,4 @@
405
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
@@ -279,18 +279,62 @@ 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-Thin.ttf -misc-jetbrains mono thin-thin-r-normal--0-0-0-0-p-0-iso10646-1
JetBrainsMono520-Bold.ttf -misc-jetbrains mono 520-bold-r-normal--0-0-0-0-p-0-iso10646-1
JetBrainsMono520-Regular.ttf -misc-jetbrains mono 520-medium-r-normal--0-0-0-0-p-0-iso10646-1
JetBrainsMono520-Thin.ttf -misc-jetbrains mono 520 thin-thin-r-normal--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded-Bold.ttf -misc-jetbrains mono expanded exp-bold-r-expanded--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded-Regular.ttf -misc-jetbrains mono expanded exp-medium-r-expanded--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded-Thin.ttf -misc-jetbrains mono expanded th ex-thin-r-expanded--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded520-Bold.ttf -misc-jetbrains mono expanded 520 exp-bold-r-expanded--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded520-Regular.ttf -misc-jetbrains mono expanded 520 exp-medium-r-expanded--0-0-0-0-p-0-iso10646-1
JetBrainsMonoExpanded520-Thin.ttf -misc-jetbrains mono expanded 520 th e-thin-r-expanded--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

View File

@@ -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),

View File

@@ -25,23 +25,7 @@
package sun.awt.X11;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.SystemColor;
import java.awt.Window;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.InvocationEvent;
@@ -52,6 +36,7 @@ import java.io.UnsupportedEncodingException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
@@ -1302,9 +1287,20 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
*/
if (isSimpleWindow()) {
if (target == XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow()) {
Window owner = getDecoratedOwner((Window)target);
((XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(owner)).
requestWindowFocus(() -> {}, () -> {});
// fix for: JBR-1762 Flotating navigation bar closes on navigate
// Use the same logic as in MacOS (see LWWindowPeer, was introduced in:
// 54bb2dd097 'JBR-1417 JBR 11 does not support chain of popups)'
Window targetOwner = ((Window)target).getOwner();
while (targetOwner != null && (targetOwner.getOwner() != null && !targetOwner.isFocusableWindow())) {
targetOwner = targetOwner.getOwner();
}
if (targetOwner != null) {
final XWindowPeer xwndpeer = ((XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(targetOwner));
if (xwndpeer != null) {
xwndpeer.requestWindowFocus(() -> {}, () -> {});
}
}
}
}
}

View File

@@ -66,8 +66,8 @@ public final class X11GraphicsDevice extends GraphicsDevice
private boolean shutdownHookRegistered;
private int scale;
private final AtomicBoolean isScaleFactorDefault = new AtomicBoolean(false);
private static final int XRM_XFT_DPI;
private static volatile int XFT_DPI;
private static volatile int xrmXftDpi;
private static volatile int xftDpi;
private static final int GDK_SCALE;
private static final double GDK_DPI_SCALE;
private static final double GDK_SCALE_MULTIPLIER;
@@ -91,7 +91,7 @@ public final class X11GraphicsDevice extends GraphicsDevice
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
XRM_XFT_DPI = getXrmXftDpi(-1);
xrmXftDpi = getXrmXftDpi(-1);
GDK_SCALE = (int)getGdkScale("GDK_SCALE", -1);
GDK_DPI_SCALE = getGdkScale("GDK_DPI_SCALE", -1);
GDK_SCALE_MULTIPLIER = GDK_SCALE != -1 ? GDK_SCALE * (GDK_DPI_SCALE != -1 ? GDK_DPI_SCALE : 1) : 1;
@@ -505,6 +505,7 @@ public final class X11GraphicsDevice extends GraphicsDevice
* X11GraphicsEnvironment when the display mode has been changed.
*/
public synchronized void displayChanged() {
xrmXftDpi = getXrmXftDpi(-1);
scale = initScaleFactor(1);
// On X11 the visuals do not change, and therefore we don't need
// to reset the defaultConfig, config, doubleBufferVisuals,
@@ -540,9 +541,9 @@ public final class X11GraphicsDevice extends GraphicsDevice
}
public static void setXftDpi(int dpi) {
XFT_DPI = dpi;
xftDpi = dpi;
boolean uiScaleEnabled = SunGraphicsEnvironment.isUIScaleEnabled(dpi);
double xftDpiScale = uiScaleEnabled ? XFT_DPI / 96.0 : 1.0;
double xftDpiScale = uiScaleEnabled ? xftDpi / 96.0 : 1.0;
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
X11GraphicsDevice x11gd = (X11GraphicsDevice)gd;
synchronized (x11gd.isScaleFactorDefault) {
@@ -567,11 +568,11 @@ public final class X11GraphicsDevice extends GraphicsDevice
if (nativeScale > 0) {
return (int)Math.round(nativeScale * gdkScaleMult);
}
if (XRM_XFT_DPI > 0) {
return (int)Math.round((XRM_XFT_DPI / 96.0) * gdkScaleMult);
if (xrmXftDpi > 0) {
return (int)Math.round((xrmXftDpi / 96.0) * gdkScaleMult);
}
if (XFT_DPI > 0) {
return (int)Math.round((XFT_DPI / 96.0) * gdkScaleMult);
if (xftDpi > 0) {
return (int)Math.round((xftDpi / 96.0) * gdkScaleMult);
}
}
return defValue;
@@ -581,8 +582,8 @@ public final class X11GraphicsDevice extends GraphicsDevice
* Used externally for diagnostic purpose.
*/
public String[][] getDpiInfo() {
int xftDpi = XRM_XFT_DPI != -1 ? XRM_XFT_DPI : XFT_DPI;
String xftDpiStr = xftDpi != -1 ? String.valueOf(xftDpi) : "undefined";
int dpi = xrmXftDpi != -1 ? xrmXftDpi : xftDpi;
String xftDpiStr = dpi != -1 ? String.valueOf(dpi) : "undefined";
double gsettingsScale = getNativeScaleFactor(screen, -1);
String gsettingsScaleStr = gsettingsScale != -1 ? String.valueOf(gsettingsScale) : "undefined";
String gdkScaleStr = GDK_SCALE != -1 ? String.valueOf(GDK_SCALE) : "undefined";

View File

@@ -2776,9 +2776,11 @@ AwtComponent::GetJavaModifiers()
if (HIBYTE(::GetKeyState(VK_MENU)) != 0) {
modifiers |= java_awt_event_InputEvent_ALT_DOWN_MASK;
}
if (HIBYTE(::GetKeyState(VK_RMENU)) != 0) {
modifiers |= java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK;
}
// Reverted fix of JDK-8041928: MouseEvent.getModifiersEx gives wrong result
// Because it breaks AltGr shortcuts
// if (HIBYTE(::GetKeyState(VK_RMENU)) != 0) {
// modifiers |= java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK;
// }
if (HIBYTE(::GetKeyState(VK_MBUTTON)) != 0) {
modifiers |= java_awt_event_InputEvent_BUTTON2_DOWN_MASK;
}
@@ -3597,10 +3599,15 @@ UINT AwtComponent::WindowsKeyToJavaChar(UINT wkey, UINT modifiers, TransOps ops,
BOOL shiftIsDown = FALSE;
if (modifiers) {
shiftIsDown = modifiers & java_awt_event_InputEvent_SHIFT_DOWN_MASK;
BOOL altIsDown = ((modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK) ||
(modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK));
BOOL altIsDown = modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK;
BOOL ctrlIsDown = modifiers & java_awt_event_InputEvent_CTRL_DOWN_MASK;
// Windows treats AltGr as Ctrl+Alt
if (modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK) {
altIsDown = TRUE;
ctrlIsDown = TRUE;
}
if (shiftIsDown) {
keyboardState[VK_SHIFT] |= KEY_STATE_DOWN;
}

View File

@@ -30,6 +30,7 @@
#include "awt_IconCursor.h"
#include "awt_Win32GraphicsDevice.h"
#include "ComCtl32Util.h"
#include "shellapi.h"
#include <windowsx.h>
#include <uxtheme.h>
@@ -780,6 +781,24 @@ AwtFrame::Show()
} else {
::ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
// [tav] Workaround for unclear platform behaviour.
// When a custom decor frame is being shown maximized at the moment
// some another AWT window is still foreground - the frame can go
// in background when shown if:
// 1) the other AWT window is closed the moment after frame's show
// 2) some another maximized window is behind the frame, it steals activation
if (HasCustomDecoration()) {
HWND fgHWnd = ::GetForegroundWindow();
if (fgHWnd != NULL &&
GetComponent(fgHWnd) != NULL && // it's awt window
IsFocusableWindow() &&
IsAutoRequestFocus() &&
!::IsWindow(GetModalBlocker(GetHWnd())))
{
::SetForegroundWindow(GetHWnd());
}
}
}
else if (m_isInputMethodWindow) {
// Don't activate input methow window
@@ -1453,6 +1472,16 @@ void AwtFrame::__SetState(AwtFrame* f, int state, float factorX, float factorY)
f->setIconic(iconify);
f->setZoomed(zoom);
// [tav] With custom decor enabled, MS Win will send WM_SIZE msg w/o SIZE_MAXIMIZED param set
// before the frame will be shown. The msg handler will drop the maximized state in response.
// In order to prevent that, we set the maximized state on the native frame in advance.
if (zoom && f->HasCustomDecoration()) {
WINDOWPLACEMENT wp;
::GetWindowPlacement(f->GetHWnd(), &wp);
wp.showCmd = SW_SHOWMAXIMIZED;
::SetWindowPlacement(f->GetHWnd(), &wp);
}
}
}
}
@@ -1814,7 +1843,15 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
// [moklev] Workaround for RIDER-27069, IDEA-211327
if (!this->IsUndecorated()) {
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
// [tav] Decrement NC bottom only when taskbar is bottom/autohide (JBR-1786)
APPBARDATA abData;
abData.cbSize = sizeof(abData);
if (::SHAppBarMessage(ABM_GETTASKBARPOS, &abData) &&
abData.uEdge == ABE_BOTTOM &&
::SHAppBarMessage(ABM_GETSTATE, &abData) == ABS_AUTOHIDE)
{
rect->bottom -= 1;
}
}
}
else {

View File

@@ -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;

View File

@@ -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

View File

@@ -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");
}
}

View File

@@ -1,269 +0,0 @@
/*
* Copyright (c) 2018, 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.
*/
/*
* @test
* @key headful
* @bug 8194873
* @requires (os.family == "Windows")
* @summary Checks that right ALT (ALT_GRAPH) key works on Swing components
* @run main RightAltKeyTest
*/
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.KeyStroke;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.GridLayout;
import java.awt.Robot;
import java.lang.reflect.InvocationTargetException;
public class RightAltKeyTest {
boolean action = false;
JFrame frame;
void testJMenu() {
frame = new JFrame("Menu Frame");
JMenuBar mb = new JMenuBar();
JMenu m1 = new JMenu("File");
JMenuItem i1 = new JMenuItem("Save");
JMenuItem i2 = new JMenuItem("Load");
m1.setMnemonic(KeyEvent.VK_F);
m1.addMenuListener(new MenuListener() {
@Override
public void menuSelected(MenuEvent e) {
action = true;
disposeUI();
}
@Override
public void menuDeselected(MenuEvent e) {
}
@Override
public void menuCanceled(MenuEvent e) {
}
});
frame.setJMenuBar(mb);
mb.add(m1);
m1.add(i1);
m1.add(i2);
frame.setSize(200, 200);
frame.setVisible(true);
}
void testJMenuItem() {
frame = new JFrame("Menu Frame");
JMenuBar mb = new JMenuBar();
JMenu m1 = new JMenu("File");
JMenuItem i1 = new JMenuItem("Save");
i1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
InputEvent.ALT_GRAPH_DOWN_MASK));
i1.addActionListener((e) -> {
action = true;
disposeUI();
});
frame.setJMenuBar(mb);
mb.add(m1);
m1.add(i1);
frame.setSize(200, 200);
frame.setVisible(true);
}
void testJOptionPane() {
int selection = JOptionPane.showConfirmDialog(null, "Do you wish " +
"to save file?","Confirm", JOptionPane.YES_NO_CANCEL_OPTION);
//Pressed Yes
if (selection == 0) {
action = true;
}
}
void testJTabbedPane() {
frame =new JFrame();
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JTabbedPane tp=new JTabbedPane();
tp.add("Main",p1);
tp.add("Visit",p2);
tp.setMnemonicAt(0, KeyEvent.VK_M);
tp.setMnemonicAt(1, KeyEvent.VK_V);
tp.addChangeListener((e) -> {
if (tp.getSelectedIndex() == 1)
action = true;
disposeUI();
});
frame.add(tp);
frame.setSize(200,200);
frame.setVisible(true);
}
void testJTextArea() {
JTextField firstField = new JTextField(10);
JTextField lastField = new JTextField(10);
JLabel firstLabel = new JLabel("First Name", JLabel.RIGHT);
firstLabel.setDisplayedMnemonic('F');
firstLabel.setLabelFor(firstField);
JLabel lastLabel = new JLabel("Last Name", JLabel.RIGHT);
lastLabel.setDisplayedMnemonic('L');
lastLabel.setLabelFor(lastField);
JPanel p = new JPanel();
p.setLayout(new GridLayout(2, 2, 5, 5));
p.add(firstLabel);
p.add(firstField);
p.add(lastLabel);
p.add(lastField);
frame = new JFrame("MnemonicLabels");
lastField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
action = true;
disposeUI();
}
@Override
public void focusLost(FocusEvent e) {
}
});
frame.add(p);
frame.setSize(200,200);
frame.setVisible(true);
}
void test() throws Exception {
UIManager.LookAndFeelInfo[] lookAndFeels = UIManager
.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeel : lookAndFeels) {
UIManager.setLookAndFeel(lookAndFeel.getClassName());
Robot robot = new Robot();
robot.setAutoDelay(100);
robot.waitForIdle();
action = false;
SwingUtilities.invokeLater(this::testJMenu);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_ALT_GRAPH);
robot.keyPress(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_ALT_GRAPH);
robot.waitForIdle();
if (!action)
errLog("JMenu", lookAndFeel.getClassName());
action = false;
SwingUtilities.invokeLater(this::testJMenuItem);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_ALT_GRAPH);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_ALT_GRAPH);
robot.waitForIdle();
if (!action)
errLog("JMenuItem", lookAndFeel.getClassName());
action = false;
SwingUtilities.invokeLater(this::testJOptionPane);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_ALT_GRAPH);
robot.keyPress(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_ALT_GRAPH);
robot.waitForIdle();
if (!action)
errLog("JOptionPane", lookAndFeel.getClassName());
action = false;
SwingUtilities.invokeLater(this::testJTabbedPane);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_ALT_GRAPH);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_ALT_GRAPH);
robot.waitForIdle();
if (!action)
errLog("JTabbedPane", lookAndFeel.getClassName());
action = false;
SwingUtilities.invokeLater(this::testJTextArea);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_ALT_GRAPH);
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_ALT_GRAPH);
robot.waitForIdle();
if (!action)
errLog("JTextArea", lookAndFeel.getClassName());
}
System.out.println("Passed.");
}
void disposeUI() {
frame.setVisible(false);
frame.dispose();
}
void errLog(String componentName, String lookAndFeel)
throws InvocationTargetException, InterruptedException
{
SwingUtilities.invokeAndWait(this::disposeUI);
throw new RuntimeException("Actions are not performed for "+
componentName + " with " + lookAndFeel + " look and feel.");
}
public static void main(String[] args) throws Exception {
RightAltKeyTest t = new RightAltKeyTest();
t.test();
}
}

View 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;
}
}
}

View File

@@ -137,6 +137,8 @@ java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java
java/awt/Debug/DumpOnKey/DumpOnKey.java 8202667 windows-all,linux-all
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
@@ -197,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
@@ -207,27 +210,29 @@ 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
java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java 8169468 windows-all,macosx-all
java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 7188711 macosx-all
java/awt/Graphics/CopyScaledArea/CopyScaledAreaTest.java 8153299 windows-all
java/awt/Graphics/LineClipTest.java JRE-898 macosx-all
java/awt/Graphics2D/CopyAreaOOB.java 7001973 windows-all,macosx-all
java/awt/Graphics2D/CopyAreaOOB.java 7001973 windows-all,macosx-all,linux-all
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8197796 generic-all
java/awt/Graphics2D/DrawString/RotTransText.java 8197797 generic-all
java/awt/Graphics2D/DrawString/TextRenderingTest.java 8169464 windows-all
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
@@ -529,7 +534,7 @@ 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
@@ -547,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
@@ -559,6 +565,7 @@ java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java
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-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
java/awt/Toolkit/DesktopProperties/rfe4758438.java 8193547 linux-all
@@ -579,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
@@ -594,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
@@ -609,7 +617,7 @@ java/awt/datatransfer/SystemFlavorMap/AddFlavorTest.java
java/awt/dnd/BadSerializaionTest/BadSerializationTest.java 8039082 generic-all
java/awt/dnd/Button2DragTest/Button2DragTest.java 8157172 macosx-all,linux-all,windows-all
java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java 8202790 macosx-all,linux-all
java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html 8215538 windows-all
java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html 8215538 windows-all,macosx-all,linux-all (macosx-all,linux-all: commit)
java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java 8029680 macosx-all,linux-all,windows-all
java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java 8028998,8159694 macosx-all,windows-all,linux-all
java/awt/dnd/ImageTransferTest/ImageTransferTest.java 8176556 generic-all
@@ -917,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
@@ -937,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
@@ -954,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
@@ -961,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
@@ -976,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
@@ -1021,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,7 +1053,7 @@ javax/swing/Popup/TaskbarPositionTest.java
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
@@ -1065,7 +1075,7 @@ javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java
javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8194945 macosx-all,linux-all,windows-all
javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java 8196434 linux-all,solaris-all
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8198905,8137101 macosx-all,windows-all,linux-all
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8042383 macosx-all,windows-all
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8042383 macosx-all,windows-all,linux-all
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8196098 windows-all,linux-all
javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java 8172887 windows-all
javax/swing/plaf/basic/Test6984643.java 8198340 windows-all
@@ -1182,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

View File

@@ -2,12 +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/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
@@ -29,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
@@ -109,7 +110,6 @@ java/awt/datatransfer/Independence/IndependenceAWTTest.java
java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html nobug macosx-all,windows-all
java/awt/datatransfer/SystemSelection/SystemSelectionSwingTest.java nobug linux-all
java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java nobug macosx-all,windows-all,linux-all
java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html nobug macosx-all,linux-all,windows-all
java/awt/dnd/DnDTestWithHIDPI/DragTestWithHIDPI.java nobug macosx-all,windows-all,linux-all
java/awt/dnd/FileListBetweenJVMsTest/FileListBetweenJVMsTest.html nobug macosx-all,linux-all,windows-all
java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html nobug macosx-all,windows-all,linux-all
@@ -142,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
@@ -172,6 +173,7 @@ javax/swing/JLabel/7004134/bug7004134.java
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
@@ -184,11 +186,12 @@ javax/swing/JRadioButton/8041561/bug8041561.java
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/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
@@ -199,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

View File

@@ -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 {

View File

@@ -126,4 +126,14 @@ public class BundledFontTest {
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);
}
}

View File

@@ -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()));
}
}