Compare commits

...

40 Commits

Author SHA1 Message Date
Alexey Ushakov
e309845093 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Screen rendering tests in progress
2019-06-25 01:55:17 +03:00
Alexey Ushakov
e838103a24 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)
2019-06-24 23:30:57 +03:00
Anton Tarasov
e7ca6db66b JBR-1492 Not able to start Intellij Idea 2017.2.5 with modified vmoptions 2019-06-24 14:29:50 +03:00
Vitaly Provodin
d9656a178b updated JTreg exclude list 2019-06-23 07:54:43 +07:00
Vitaly Provodin
5f6351b0c4 updated JTreg exclude list 2019-06-23 07:40:54 +07:00
Vitaly Provodin
c3a0ec902d updated JTreg exclude list 2019-06-22 06:01:31 +07:00
Anton Tarasov
567d96c428 Merge remote-tracking branch 'origin/master' 2019-06-20 21:02:12 +03:00
Anton Tarasov
1666f05b23 JBR-1617 revert fixes for app icon 2019-06-20 21:01:34 +03:00
Egor Ushakov
ae823a660b JBR-1615 Slow ClassLoaderReferenceImpl.findType 2019-06-20 17:52:15 +03:00
Denis Fokin
f6a31f444c Revert: JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message 2019-06-20 14:15:19 +03:00
Dmitry Batrak
a1b4cd964a JBR-1604 Tooltip with package's info is cut 2019-06-19 17:15:15 +03:00
Elena Sayapina
5845719fe5 updated JTreg exclude list 2019-06-17 16:49:18 +07:00
alexsch
dae56a9e8b JBR-1066: fixed ScreenMenuMemoryLeakTest
re-apply fix that was reverted in 2a92eec5:
8158325: [macosx] Memory leak in com.apple.laf.ScreenMenu
Reviewed-by: azvegint, alexsch
Contributed-by: Robin Stevens <robin.stevens@scz.be>

NOTE: fix 8158325 caused 'JBR-922 Actions from system menu does not work on jdk9 runtime', 'IDEA-183063 MacOS: popups are closing, main menu actions will not open when running under Oracle 1.8.152 JDK'. This fix was reapplied because it is correct and bugs aren't reproduced now.

(cherry picked from commit 0a4920f61d)
2019-06-14 16:36:53 +07:00
Anton Tarasov
9cc97b0c00 [followup] JBR-1351 Borderless UI: Bold frame around IDEA window appears on non-HiDPI display 2019-06-13 20:15:41 +03:00
Denis Fokin
936dc2c40b JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message
Crash is fixed
2019-06-11 12:59:53 +03:00
Anton Tarasov
db6c43b6f4 JBR-1414 DnD on linux (XToolkit) does not honor HIDPI scale 2019-06-10 19:11:43 +03:00
Artem Bochkarev
bd9a95d6fb JRE-220: fixed 'terminal Ctrl+C is not working'
cherry-picked from a8c7db34
2019-06-08 14:28:34 +07:00
Denis Fokin
8d9bac395e JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message 2019-06-07 16:27:58 +03:00
Anton Tarasov
f652c790f4 Merge remote-tracking branch 'origin/master' 2019-06-07 15:21:58 +03:00
Anton Tarasov
8e59bb2f09 JBR-1582 IDEA EAP icon has low resolution on Mac 2019-06-07 15:21:28 +03:00
Artem Bochkarev
c8533a1219 JBR-1573: fix resources cleanup
JBR-1573: fix resources cleanup
2019-06-07 10:48:13 +07:00
Denis Fokin
f35489e8ca JBR-1574 java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java: Test failed 2019-06-06 23:58:13 +03:00
Artem Bochkarev
3ad94911af JBR-1573: workaround for 'Sudden keyboard death on Ubuntu 18'
recreate instance of system InputMethod when starts filter all events
2019-06-06 17:53:25 +07:00
Denis Fokin
31629b719d Yet another forgotten file. 2019-06-05 13:02:45 +03:00
Denis Fokin
0e3ce4aa6a These files are generated by gradle. They prevent users from rebase. 2019-06-05 12:53:24 +03:00
Denis Fokin
4cef4a36c7 JBR-1569 Transparent title bars not working in JRE 11 2019-06-04 18:25:53 +03:00
Denis Fokin
7a05ec59e0 Revert: JBR-1414 DnD on linux  (XToolkit) does not honor HIDPI scale
Regression: JBR-1558 Drag'n'drop in trees doesn't work properly in master builds on HiDPI displays
2019-06-04 14:30:32 +03:00
Vitaly Provodin
26807f5975 updated JTreg exclude list 2019-06-04 10:36:07 +07:00
Vitaly Provodin
85dad30333 updated JTreg exclude list 2019-06-04 06:24:55 +07:00
Anton Tarasov
9f7289d5ef Merge remote-tracking branch 'origin/master' 2019-06-03 12:49:07 +03:00
Anton Tarasov
14d51243c6 JBR-1544 Robot cannot capture screen with scale other than 1:1 2019-06-03 12:48:45 +03:00
Alexey Ushakov
350a3fdef3 JBR-1399 Improve font discovery and loading by introducing font cache
Bundle IDEA fonts to improve startup performance
2019-05-31 20:24:27 +03:00
Denis Fokin
ae087bad40 JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS 2019-05-31 12:30:22 +03:00
Vitaly Provodin
74b2cb3607 updated JTreg exclude list 2019-05-31 15:09:00 +07:00
Denis Fokin
63f98e40a6 JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS
Forgotten change
2019-05-30 16:49:27 +03:00
Vyacheslav Moklev
5547701e2c JBR-1552 Invalid screen bounds in full screen mode
Check is window is not in undecorated state
2019-05-30 11:02:00 +03:00
Denis Fokin
1ca0a3f140 JBR-1522 JDK11 does not reset reused heavy-weight popup window min-size 2019-05-29 12:47:19 +03:00
Alexey Ushakov
194b2d939f Updated RenderPerfTest to use correct location of the frame marker 2019-05-28 15:14:20 +03:00
Alexey Ushakov
943b1472c7 Updated RenderUtil to get correct screenshots on linux 2019-05-28 14:50:29 +03:00
Alexey Ushakov
83c22de72e Added golden images for MixedTextTest and TextMetricsTest from Linux 2019-05-28 14:50:29 +03:00
72 changed files with 1087 additions and 466 deletions

2
jb/project/java-gradle/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="java-gradle.main" target="11" />
<module name="java-gradle.test" target="11" />
</bytecodeTargetLevel>
</component>
</project>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/share/gradle" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-image:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-image/3.3.2/9c975152864050c6dbb7226ca1100694f0aa099d/common-image-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-image/3.3.2/e6fb35a9825421ec5a634af328e22546992d536d/common-image-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-io:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-io/3.3.2/e00b1c744993864d3c8dc698ba7d356122019398/common-io-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-io/3.3.2/dbb242585fdfd353dc4c2c0e8b3d8b0383dffbb2/common-io-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-lang:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-lang/3.3.2/ffbc5e05208c5c9cb43052438294c3ec5546aecf/common-lang-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-lang/3.3.2/b695db345614a2b9344fd43a44d9ce722df4b39/common-lang-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-core:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-core/3.3.2/8def41c756831dde3c23f2d525e5667cfbfa1847/imageio-core-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-core/3.3.2/abcb2beaf21364467afe0e33824dce5730bef0c3/imageio-core-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-metadata:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-metadata/3.3.2/b8a31725bde0dc6f4e6b01711784f5ca0a2275f3/imageio-metadata-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-metadata/3.3.2/6fc3b223c81afbd4b829e2c924c096aab3ed0e9e/imageio-metadata-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-tiff:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-tiff/3.3.2/9bea1214eae7d287dc0c685fb6be75102318d080/imageio-tiff-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-tiff/3.3.2/cae5b3540dc01889dc9560db86f5f61bdc253107/imageio-tiff-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: junit:junit:4.12">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/a6c32b40bf3d76eca54e3c601e5d1470c86fcdfa/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: net.java.dev.jna:jna:4.4.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.4.0/cb208278274bf12ebdb56c61bd7407e6f774d65a/jna-4.4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.4.0/9d45d3dc35711eef7267d8b4fc2c0dc482ef9fd2/jna-4.4.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.apache.commons:commons-lang3:3.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.0/8873bd0bb5cb9ee37f1b04578eb7e26fcdd44cb0/commons-lang3-3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.0/d48f964b56a931ec2712ce5d411a40d114a69753/commons-lang3-3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-library:1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4785a3c21320980282f9f33d0d1264a69040538f/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/47a7ee46628ab7133129cd7cef1e92657bc275e/hamcrest-library-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/java-gradle.iml" filepath="$PROJECT_DIR$/java-gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.main.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.test.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.test.iml" />
</modules>
</component>
</project>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="java-gradle:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/../../out/production/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/main" />
<content url="file://$MODULE_DIR$/../../../../../src">
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.base/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.datatransfer/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.desktop/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.instrument/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.logging/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.management.rmi/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.management/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.naming/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.prefs/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.rmi/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.scripting/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.se/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.security.jgss/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.security.sasl/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.smartcardio/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.sql.rowset/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.sql/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.xml.crypto/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.base/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.datatransfer/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.desktop/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.prefs/macosx/classes" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="java-gradle:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test" />
<content url="file://$MODULE_DIR$/../../../../../test">
<sourceFolder url="file://$MODULE_DIR$/../../../../../test/jdk/jbu" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="java-gradle.main" />
<orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" name="Gradle: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-tiff:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.0" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-metadata:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-core:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-image:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-io:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-lang:3.3.2" level="project" />
</component>
<component name="TestModuleProperties" production-module="java-gradle.main" />
</module>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@@ -82,6 +82,7 @@ test {
// Enable Java2D logging (https://confluence.jetbrains.com/display/JRE/Java2D+Rendering+Logging)
// systemProperty "sun.java2d.trace", "log"
// systemProperty "sun.java2d.debugfonts", "warn"
// systemProperty "sun.java2d.trace", "log,pimpl"
outputs.upToDateWhen { false }

View File

@@ -82,11 +82,11 @@ public class AquaImageFactory {
}
static Image getGenericJavaIcon() {
return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
return checkValidOrStub(java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
public Image run() {
return com.apple.eawt.Application.getApplication().getDockIconImage();
}
});
}));
}
static String getPathToThisApplication() {
@@ -496,4 +496,23 @@ public class AquaImageFactory {
public static Color getSelectionInactiveForegroundColorUIResource() {
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
}
private static class EmptyImage {
static final BufferedImage INSTANCE;
static {
INSTANCE = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
Graphics g = INSTANCE.createGraphics();
g.setColor(new Color(0, 0, 0, 0));
g.fillRect(0, 0, 16, 16);
g.dispose();
}
}
// [tav] a workaround for JBR-1492
private static Image checkValidOrStub(Image image) {
if (image == null || image.getWidth(null) <= 0 || image.getHeight(null) <= 0) {
return EmptyImage.INSTANCE;
}
return image;
}
}

View File

@@ -110,6 +110,7 @@ final class ScreenMenu extends Menu
final Component[] items = fInvoker.getMenuComponents();
if (needsUpdate(items, childHashArray)) {
removeAll();
fItems.clear();
if (count <= 0) return;
childHashArray = new int[count];
@@ -246,7 +247,7 @@ final class ScreenMenu extends Menu
synchronized (getTreeLock()) {
super.addNotify();
if (fModelPtr == 0) {
fInvoker.addContainerListener(this);
fInvoker.getPopupMenu().addContainerListener(this);
fInvoker.addComponentListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fInvoker.addPropertyChangeListener(fPropertyListener);
@@ -281,7 +282,7 @@ final class ScreenMenu extends Menu
if (fModelPtr != 0) {
removeMenuListeners(fModelPtr);
fModelPtr = 0;
fInvoker.removeContainerListener(this);
fInvoker.getPopupMenu().removeContainerListener(this);
fInvoker.removeComponentListener(this);
fInvoker.removePropertyChangeListener(fPropertyListener);
}
@@ -302,11 +303,10 @@ final class ScreenMenu extends Menu
@Override
public void componentRemoved(final ContainerEvent e) {
final Component child = e.getChild();
final MenuItem sm = fItems.get(child);
final MenuItem sm = fItems.remove(child);
if (sm == null) return;
remove(sm);
fItems.remove(sm);
}
/**

View File

@@ -47,7 +47,7 @@ public class CImage extends CFRetainedResource {
private static native long nativeCreateNSImageFromImageName(String name);
private static native long nativeCreateNSImageFromIconSelector(int selector);
private static native byte[] nativeGetPlatformImageBytes(int[] buffer, int w, int h);
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int dw, int dh);
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int sw, int sh, int dw, int dh);
private static native Dimension2D nativeGetNSImageSize(long image);
private static native void nativeSetNSImageSize(long image, double w, double h);
private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
@@ -280,8 +280,8 @@ public class CImage extends CFRetainedResource {
if (size == null) {
return null;
}
final int baseWidth = (int)size.getWidth();
final int baseHeight = (int)size.getHeight();
final int w = (int)size.getWidth();
final int h = (int)size.getHeight();
AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
execute(ptr -> {
repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
@@ -289,31 +289,18 @@ public class CImage extends CFRetainedResource {
});
Dimension2D[] sizes = repRef.get();
// The image may be represented in the only size which differs from the base one.
// For instance, the app's dock icon is represented in a Retina-scaled size on Retina.
// Check if a single represenation has a bigger size and in that case use it as the dest size.
Dimension2D size0 = size;
if (sizes != null && sizes.length == 1 &&
(sizes[0].getWidth() > baseWidth && sizes[0].getHeight() > baseHeight))
{
size0 = sizes[0];
}
final int dstWidth = (int)size0.getWidth();
final int dstHeight = (int)size0.getHeight();
return sizes == null || sizes.length < 2 ?
new MultiResolutionCachedImage(baseWidth, baseHeight, (width, height)
-> toImage(dstWidth, dstHeight))
: new MultiResolutionCachedImage(baseWidth, baseHeight, sizes, (width, height)
-> toImage(width, height));
new MultiResolutionCachedImage(w, h, (width, height)
-> toImage(w, h, width, height))
: new MultiResolutionCachedImage(w, h, sizes, (width, height)
-> toImage(w, h, width, height));
}
private BufferedImage toImage(int dstWidth, int dstHeight) {
private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE);
final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer();
final int[] buffer = SunWritableRaster.stealData(dbi, 0);
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, dstWidth, dstHeight));
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, srcWidth, srcHeight, dstWidth, dstHeight));
SunWritableRaster.markDirty(dbi);
return bimg;
}

View File

@@ -325,9 +325,9 @@ final class CPlatformResponder {
if (isISOControl) {
characterToSendWithTheEvent = checkedChar;
}
characterToSendWithTheEvent = mapNsCharsToCompatibleWithJava(characterToSendWithTheEvent);
} else {
characterToSendWithTheEvent = mapNsCharsToCompatibleWithJava(characterToSendWithTheEvent);
}
String stringWithChar = NSEvent.nsToJavaChar(characterToSendWithTheEvent, nsEvent.getModifierFlags(), spaceKeyTyped);
characterToSendWithTheEvent = stringWithChar == null ? KeyEvent.CHAR_UNDEFINED : stringWithChar.charAt(0);
@@ -361,7 +361,11 @@ final class CPlatformResponder {
characterToSendWithTypedEvent = stringWithChar == null ? KeyEvent.CHAR_UNDEFINED : stringWithChar.charAt(0);
}
if (!nsEvent.isHasDeadKey()) {
boolean nonInputMethodsModifiersAreNotPressed = (jmodifiers &
(InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)
) == 0;
if (nonInputMethodsModifiersAreNotPressed) {
eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers,
jkeyCode, characterToSendWithTypedEvent,
KeyEvent.KEY_LOCATION_UNKNOWN);

View File

@@ -103,6 +103,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// for client properties
public static final String WINDOW_BRUSH_METAL_LOOK = "apple.awt.brushMetalLook";
public static final String WINDOW_DARK_APPEARANCE = "jetbrains.awt.windowDarkAppearance";
public static final String WINDOW_LIGHT_APPEARANCE = "jetbrains.awt.windowLightAppearance";
public static final String WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE = "jetbrains.awt.transparentTitleBarAppearance";
public static final String WINDOW_AQUA_APPEARANCE = "jetbrains.awt.windowAquaAppearance";
public static final String WINDOW_DRAGGABLE_BACKGROUND = "apple.awt.draggableWindowBackground";
public static final String WINDOW_ALPHA = "Window.alpha";
@@ -148,6 +151,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
static final int DARK = 1 << 28;
static final int LIGHT = 1 << 29;
static final int TRANSPARENT_TITLEBAR = 1 << 30;
static final int NONACTIVATING = 1 << 24;
static final int IS_DIALOG = 1 << 25;
static final int IS_MODAL = 1 << 26;
@@ -194,6 +199,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
new Property<CPlatformWindow>(WINDOW_DARK_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(DARK, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(TRANSPARENT_TITLEBAR, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_LIGHT_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(LIGHT, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_ALPHA) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.target.setOpacity(value == null ? 1.0f : Float.parseFloat(value.toString()));
}},
@@ -474,6 +485,16 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits = SET(styleBits, DARK, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE);
if (prop != null) {
styleBits = SET(styleBits, TRANSPARENT_TITLEBAR, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_LIGHT_APPEARANCE);
if (prop != null) {
styleBits = SET(styleBits, LIGHT, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_ZOOMABLE);
if (prop != null) {
styleBits = SET(styleBits, ZOOMABLE, Boolean.parseBoolean(prop.toString()));

View File

@@ -326,10 +326,7 @@ static BOOL shouldUsePressAndHold() {
}
}
NSString *eventCharacters = [event characters];
BOOL isDeadKey = (eventCharacters != nil && [eventCharacters length] == 0);
if ((![self hasMarkedText] && fKeyEventsNeeded) || isDeadKey) {
if ((![self hasMarkedText] && fKeyEventsNeeded)) {
[self deliverJavaKeyEventHelper: event];
}
@@ -507,7 +504,8 @@ static BOOL shouldUsePressAndHold() {
JNIEnv *env = [ThreadUtilities getJNIEnv];
TISInputSourceRef sourceRef = TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef keyLayoutPtr = (CFDataRef)TISGetInputSourceProperty(sourceRef, kTISPropertyUnicodeKeyLayoutData);
CFDataRef keyLayoutPtr = (CFDataRef)TISGetInputSourceProperty(
sourceRef, kTISPropertyUnicodeKeyLayoutData);
CFRelease( sourceRef);
const UCKeyboardLayout *keyboardLayout = (UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutPtr);
@@ -545,8 +543,6 @@ static BOOL shouldUsePressAndHold() {
if (status == noErr && isDeadKeyPressed != 0) {
UInt32 isDeadKeyPressedIgnore = 0;
status = UCKeyTranslate(
keyboardLayout,
kVK_Space,
@@ -554,7 +550,7 @@ static BOOL shouldUsePressAndHold() {
0,
LMGetKbdType(),
0,
&isDeadKeyPressedIgnore,
&isDeadKeyPressed,
lengthOfBuffer,
&actualLength,
stringWithChars);

View File

@@ -274,7 +274,14 @@ AWT_NS_WINDOW_IMPLEMENTATION
AWT_ASSERT_APPKIT_THREAD;
NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:bits];
NSRect contentRect = rect; //[NSWindow contentRectForFrameRect:rect styleMask:styleMask];
BOOL isTransparentTitleBar = IS(bits, TRANSPARENT_TITLEBAR);
if (isTransparentTitleBar) {
styleMask = styleMask | NSFullSizeContentViewWindowMask;
}
NSRect contentRect = isTransparentTitleBar ? [NSWindow contentRectForFrameRect:rect styleMask:styleMask] : rect;
if (contentRect.size.width <= 0.0) {
contentRect.size.width = 1.0;
}
@@ -319,6 +326,11 @@ AWT_ASSERT_APPKIT_THREAD;
[self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/];
}
self.nsWindow.titlebarAppearsTransparent = IS(bits, TRANSPARENT_TITLEBAR);
if (self.nsWindow.titlebarAppearsTransparent) {
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
}
if (IS(self.styleBits, DARK)) {
[self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
} else {

View File

@@ -201,11 +201,11 @@ AWT_ASSERT_APPKIT_THREAD;
self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG];
self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0];
NSDockTile *dockTile = [NSApp dockTile];
self.fProgressIndicator = [[NSProgressIndicator alloc]
initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)];
[fProgressIndicator setStyle:NSProgressIndicatorBarStyle];
[fProgressIndicator setIndeterminate:NO];
[[dockTile contentView] addSubview:fProgressIndicator];
@@ -476,8 +476,20 @@ AWT_ASSERT_APPKIT_THREAD;
return;
}
// Set the app's icon instead to meet Retina.
[NSApp setApplicationIconImage:image];
// setup an image view for the dock tile
NSRect frame = NSMakeRect(0, 0, dockTile.size.width, dockTile.size.height);
NSImageView *dockImageView = [[NSImageView alloc] initWithFrame: frame];
[dockImageView setImageScaling:NSImageScaleProportionallyUpOrDown];
[dockImageView setImage:image];
[[ApplicationDelegate sharedDelegate].fProgressIndicator removeFromSuperview];
[dockImageView addSubview:[ApplicationDelegate sharedDelegate].fProgressIndicator];
// add it to the NSDockTile
[dockTile setContentView: dockImageView];
[dockTile display];
[dockImageView release];
}
+ (void)_setDockIconProgress:(NSNumber *)value {
@@ -498,8 +510,25 @@ AWT_ASSERT_APPKIT_THREAD;
+ (NSImage *)_dockIconImage {
AWT_ASSERT_APPKIT_THREAD;
// The app's dock icon defaults to the app's icon (see the spec) which is Retina-aware unlike the dock icon.
return [NSApp applicationIconImage];
NSDockTile *dockTile = [NSApp dockTile];
NSView *view = [dockTile contentView];
if ([view isKindOfClass:[NSImageView class]]) {
NSImage *img = [((NSImageView *)view) image];
if (img) return img;
}
if (view == nil) {
return [NSImage imageNamed:@"NSApplicationIcon"];
}
NSRect frame = [view frame];
NSImage *image = [[NSImage alloc] initWithSize:frame.size];
[image lockFocus];
[view drawRect:frame];
[image unlockFocus];
[image autorelease];
return image;
}
@end

View File

@@ -257,24 +257,24 @@ JNF_COCOA_EXIT(env);
/*
* Class: sun_lwawt_macosx_CImage
* Method: nativeCopyNSImageIntoArray
* Signature: (J[III)V
* Signature: (J[IIIII)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeCopyNSImageIntoArray
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint dw, jint dh)
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint sw, jint sh,
jint dw, jint dh)
{
JNF_COCOA_ENTER(env);
JNF_COCOA_ENTER(env);
NSImage *img = (NSImage *)jlong_to_ptr(nsImgPtr);
jint *dst = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
if (dst) {
NSSize size = [(NSImage *)jlong_to_ptr(nsImgPtr) size];
NSRect fromRect = NSMakeRect(0, 0, size.width, size.height);
NSRect fromRect = NSMakeRect(0, 0, sw, sh);
NSRect toRect = NSMakeRect(0, 0, dw, dh);
CImage_CopyNSImageIntoArray(img, dst, fromRect, toRect);
(*env)->ReleasePrimitiveArrayCritical(env, buffer, dst, JNI_ABORT);
}
JNF_COCOA_EXIT(env);
JNF_COCOA_EXIT(env);
}
/*

View File

@@ -347,7 +347,7 @@ public class PopupFactory {
private static final Object heavyWeightPopupCacheKey =
new StringBuffer("PopupFactory.heavyWeightPopupCache");
private volatile boolean isCacheEnabled = true;
private volatile boolean isCacheEnabled = false;
/**
* Returns either a new or recycled <code>Popup</code> containing

View File

@@ -1967,6 +1967,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#insertUpdate
*/
public final void insertUpdate(DocumentEvent e) {
rootViewInitialized = false;
Document doc = e.getDocument();
Object o = doc.getProperty("i18n");
if (o instanceof Boolean) {
@@ -1995,6 +1996,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#removeUpdate
*/
public final void removeUpdate(DocumentEvent e) {
rootViewInitialized = false;
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.removeUpdate(e, alloc, rootView.getViewFactory());
}
@@ -2010,6 +2012,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#changedUpdate(DocumentEvent)
*/
public final void changedUpdate(DocumentEvent e) {
rootViewInitialized = false;
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.changedUpdate(e, alloc, rootView.getViewFactory());
}

View File

@@ -53,6 +53,7 @@ public abstract class Font2D {
public static final int NATIVE_RANK = 5;
public static final int UNKNOWN_RANK = 6;
public static final int DEFAULT_RANK = 4;
public static final int IDEA_RANK = 7;
private static final String[] boldNames = {
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", };

View File

@@ -219,7 +219,7 @@ public class FontFamily {
case Font.PLAIN:
case Font.ITALIC:
return (newWeight <= Font2D.FWEIGHT_NORMAL &&
newWeight > currFont.getWeight());
newWeight >= currFont.getWeight());
case Font.BOLD:
case Font.BOLD|Font.ITALIC:

View File

@@ -82,6 +82,24 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
}
private static class TTFilterIdea extends TTFilter {
final private boolean positive;
final private HashSet<String> ideaSet;
public TTFilterIdea(boolean positive, HashSet<String> ideaSet) {
this.positive = positive;
this.ideaSet = ideaSet;
}
@Override
public boolean accept(File dir, String name) {
if (super.accept(dir, name) && ideaSet.contains(name)) {
return positive;
}
return !positive;
}
}
private static class T1Filter implements FilenameFilter {
public boolean accept(File dir,String name) {
if (noType1Font) {
@@ -189,6 +207,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
boolean loadedAllFontFiles = false;
HashMap<String,String> jreFontMap;
HashSet<String> jreBundledFontFiles;
HashSet<String> ideaFontSet;
String[] jreOtherFontFiles;
boolean noOtherJREFontFiles = false; // initial assumption.
@@ -224,6 +243,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private static final FilenameFilter ttFilter = new TTFilter();
private static final FilenameFilter t1Filter = new T1Filter();
private FilenameFilter ttFilterIdea;
private FilenameFilter ttFilterJre;
private Font[] allFonts;
private String[] allFamilies; // cache for default locale only
private Locale lastDefaultLocale;
@@ -300,6 +321,41 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
jreFontMap.put("droid serif3", "DroidSerif-BoldItalic.ttf");
jreFontMap.put("droid serif bold1", "DroidSerif-Bold.ttf");
jreFontMap.put("droid serif bold italic3", "DroidSerif-BoldItalic.ttf");
/* Idea bundled fonts */
jreFontMap.put("FiraCode bold", "FiraCode-Bold.ttf");
jreFontMap.put("FiraCode light", "FiraCode-Light.ttf");
jreFontMap.put("FiraCode medium", "FiraCode-Medium.ttf");
jreFontMap.put("FiraCode retina", "FiraCode-Retina.ttf");
jreFontMap.put("FiraCode regular", "FiraCode-Regular.ttf");
jreFontMap.put("SourceCodePro bold italic", "SourceCodePro-BoldIt.ttf");
jreFontMap.put("SourceCodePro regular", "SourceCodePro-Regular.ttf");
jreFontMap.put("SourceCodePro bold", "SourceCodePro-Bold.ttf");
jreFontMap.put("SourceCodePro italic", "SourceCodePro-It.ttf");
jreFontMap.put("Inconsolata", "Inconsolata.ttf");
jreFontMap.put("Roboto light", "Roboto-Light.ttf");
jreFontMap.put("Roboto thin", "Roboto-Thin.ttf");
ideaFontSet = new HashSet<>();
ideaFontSet.add("FiraCode-Bold.ttf");
ideaFontSet.add("FiraCode-Light.ttf");
ideaFontSet.add("FiraCode-Medium.ttf");
ideaFontSet.add("FiraCode-Retina.ttf");
ideaFontSet.add("FiraCode-Regular.ttf");
ideaFontSet.add("SourceCodePro-BoldIt.ttf");
ideaFontSet.add("SourceCodePro-Regular.ttf");
ideaFontSet.add("SourceCodePro-Bold.ttf");
ideaFontSet.add("SourceCodePro-It.ttf");
ideaFontSet.add("Inconsolata.ttf");
ideaFontSet.add("Roboto-Light.ttf");
ideaFontSet.add("Roboto-Thin.ttf");
ttFilterIdea = new TTFilterIdea(true, ideaFontSet);
ttFilterJre = new TTFilterIdea(false, ideaFontSet);
for (String ffile : jreFontMap.values()) {
jreBundledFontFiles.add(ffile);
}
@@ -403,8 +459,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* Linux font configuration uses these fonts */
registerFontDir(jreFontDirName);
}
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
true, false);
registerJREFonts();
/* Create the font configuration and get any font path
* that might be specified.
@@ -3284,7 +3339,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* Called to register fall back fonts */
public void registerFontsInDir(String dirName) {
registerFontsInDir(dirName, true, Font2D.JRE_RANK, true, false);
registerJREFonts();
}
// MACOSX begin -- need to access this in subclass
@@ -3305,6 +3360,18 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
defer, resolveSymLinks);
}
protected void registerJREFonts() {
File pathFile = new File(jreFontDirName);
addDirFonts(jreFontDirName, pathFile, ttFilterIdea,
FONTFORMAT_TRUETYPE, true,
Font2D.IDEA_RANK,
true, false);
addDirFonts(jreFontDirName, pathFile, ttFilterJre,
FONTFORMAT_TRUETYPE, true,
Font2D.JRE_RANK,
true, false);
}
protected void registerFontDir(String path) {
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,102 @@
Copyright (c) 2014, Nikita Prokopov http://tonsky.me
with Reserved Font Name Fira Code.
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Mono.
Copyright (c) 2014, Telefonica S.A.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View File

@@ -0,0 +1,93 @@
Copyright (c) 2011, Raph Levien (firstname.lastname@gmail.com), Copyright (c) 2012, Cyreal (cyreal.org)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -594,12 +594,13 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XBaseWindow xbasewindow = XToolkit.windowToXWindow(xclient.get_window());
if (xbasewindow instanceof XWindow) {
xwindow = (XWindow)xbasewindow;
// xclient can be a system-generated or a sent event (see XDragSourceContextPeer)
// so x/y is expected to be presented in device space
x = xbasewindow.scaleDown(x);
y = xbasewindow.scaleDown(y);
}
}
if (xwindow == null) {
long receiver =
XDropTargetRegistry.getRegistry().getEmbeddedDropSite(

View File

@@ -524,8 +524,9 @@ public final class XDragSourceContextPeer
updateTargetWindow(xmotion);
if (dragProtocol != null) {
dragProtocol.sendMoveMessage(scaleDown(xmotion.get_x_root()),
scaleDown(xmotion.get_y_root()),
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
dragProtocol.sendMoveMessage(xmotion.get_x_root(),
xmotion.get_y_root(),
sourceAction, sourceActions,
xmotion.get_time());
}
@@ -533,8 +534,9 @@ public final class XDragSourceContextPeer
private void processDrop(XButtonEvent xbutton) {
try {
dragProtocol.initiateDrop(scaleDown(xbutton.get_x_root()),
scaleDown(xbutton.get_y_root()),
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
dragProtocol.initiateDrop(xbutton.get_x_root(),
xbutton.get_y_root(),
sourceAction, sourceActions,
xbutton.get_time());
} catch (XException e) {

View File

@@ -72,6 +72,17 @@ public class XInputMethod extends X11InputMethod {
return createXICNative(peer.getContentWindow());
}
protected boolean recreateXIC() {
final XComponentPeer peer = (XComponentPeer)getPeer(clientComponentWindow);
if (peer == null || pData == 0)
return true;
return recreateXICNative(peer.getContentWindow(), pData);
}
protected void releaseXIC() {
if (pData == 0)
return;
releaseXICNative(pData);
}
private static volatile long xicFocus = 0;
@@ -150,6 +161,8 @@ public class XInputMethod extends X11InputMethod {
*/
private native boolean openXIMNative(long display);
private native boolean createXICNative(long window);
private native boolean recreateXICNative(long window, long px11data);
private native void releaseXICNative(long px11data);
private native void setXICFocusNative(long window,
boolean value, boolean active);
private native void adjustStatusWindow(long window);

View File

@@ -25,6 +25,9 @@
package sun.awt;
import java.util.List;
import java.util.ArrayList;
import java.awt.AWTException;
import java.awt.event.InputMethodEvent;
import java.awt.font.TextAttribute;
@@ -40,6 +43,7 @@ import sun.util.logging.PlatformLogger;
* @author JavaSoft International
*/
public abstract class X11InputMethod extends X11InputMethodBase {
protected static final List<X11InputMethod> activeInputMethods = new ArrayList<X11InputMethod>();
/**
* Constructs an X11InputMethod instance. It initializes the XIM
@@ -85,6 +89,9 @@ public abstract class X11InputMethod extends X11InputMethodBase {
if (!createXIC()) {
return;
}
awtLock();
activeInputMethods.add(this);
awtUnlock();
disposed = false;
}
@@ -329,6 +336,7 @@ public abstract class X11InputMethod extends X11InputMethodBase {
protected synchronized void disposeImpl() {
disposeXIC();
awtLock();
activeInputMethods.remove(this);
composedText = null;
committedText = null;
rawFeedbacks = null;
@@ -353,4 +361,22 @@ public abstract class X11InputMethod extends X11InputMethodBase {
savedCompositionState = enable;
}
}
static void recreateAllXIC() {
// NOTE: called from native within AWT_LOCK
for (X11InputMethod im : activeInputMethods)
im.releaseXIC();
if (!recreateX11InputMethod()) {
log.warning("can't recreate X11 InputMethod");
return;
}
for (X11InputMethod im : activeInputMethods) {
if (!im.recreateXIC())
log.warning("can't recreate XIC for " + im.toString());
}
}
protected abstract boolean recreateXIC();
protected abstract void releaseXIC();
private static native boolean recreateX11InputMethod();
}

View File

@@ -342,13 +342,8 @@ static void setX11InputMethodData(JNIEnv * env, jobject imInstance, X11InputMeth
JNU_SetLongFieldFromPtr(env, imInstance, x11InputMethodIDs.pData, pX11IMData);
}
/* this function should be called within AWT_LOCK() */
static void
destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
{
/*
* Destroy XICs
*/
destroyXInputContexts(X11InputMethodData *pX11IMData) {
if (pX11IMData == NULL) {
return;
}
@@ -365,7 +360,20 @@ destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
pX11IMData->current_ic = (XIC)0;
}
}
}
/* this function should be called within AWT_LOCK() */
static void
destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
{
/*
* Destroy XICs
*/
if (pX11IMData == NULL) {
return;
}
destroyXInputContexts(pX11IMData);
freeX11InputMethodData(env, pX11IMData);
}
@@ -1364,6 +1372,27 @@ finally:
return (pX11IMData != NULL);
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11_XInputMethod_recreateXICNative(JNIEnv *env,
jobject this,
jlong window, jlong pData)
{
// NOTE: must be called under AWT_LOCK
return createXIC(env, (X11InputMethodData *)pData, window);
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XInputMethod_releaseXICNative(JNIEnv *env,
jobject this,
jlong pData)
{
// NOTE: must be called under AWT_LOCK
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
pX11IMData->current_ic = NULL;
destroyXInputContexts(pX11IMData);
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
jobject this,
@@ -1616,3 +1645,21 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
AWT_UNLOCK();
#endif
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11InputMethod_recreateX11InputMethod(JNIEnv *env, jclass cls)
{
if (X11im == NULL || dpy == NULL)
return JNI_FALSE;
Status retstat = XCloseIM(X11im);
X11im = XOpenIM(dpy, NULL, NULL, NULL);
if (X11im == NULL)
return JNI_FALSE;
XIMCallback ximCallback;
ximCallback.callback = (XIMProc)DestroyXIMCallback;
ximCallback.client_data = NULL;
XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
return JNI_TRUE;
}

View File

@@ -324,6 +324,8 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
/* GDK */
fp_gdk_get_default_root_window =
dl_symbol("gdk_get_default_root_window");
fp_gdk_window_get_scale_factor =
dl_symbol("gdk_window_get_scale_factor");
/* Pixbuf */
fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new");
@@ -2869,7 +2871,10 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
jint *ary;
GdkWindow *root = (*fp_gdk_get_default_root_window)();
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5));
if (pixbuf && scale != 1) {
GdkPixbuf *scaledPixbuf;
x /= scale;
@@ -2887,8 +2892,8 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
if (pixbuf) {
int nchan = (*fp_gdk_pixbuf_get_n_channels)(pixbuf);
int stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf);
if ((*fp_gdk_pixbuf_get_width)(pixbuf) == width
&& (*fp_gdk_pixbuf_get_height)(pixbuf) == height
if ((*fp_gdk_pixbuf_get_width)(pixbuf) >= width
&& (*fp_gdk_pixbuf_get_height)(pixbuf) >= height
&& (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf) == 8
&& (*fp_gdk_pixbuf_get_colorspace)(pixbuf) == GDK_COLORSPACE_RGB
&& nchan >= 3

View File

@@ -253,6 +253,7 @@ static gchar* (*fp_gtk_check_version)(guint required_major, guint
static void (*fp_g_free)(gpointer mem);
static void (*fp_g_object_unref)(gpointer object);
static GdkWindow *(*fp_gdk_get_default_root_window) (void);
static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window);
static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);

View File

@@ -644,6 +644,55 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XWindowEvent
XWindowEvent( (Display *) jlong_to_ptr(display), (Window)window, event_mask, (XEvent *) jlong_to_ptr(event_return));
}
static int filteredEventsCount = 0;
static int filteredEventsThreshold = -1;
#define KeyPressEventType 2
#define KeyReleaseEventType 3
static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
if (filteredEventsThreshold < 0) {
filteredEventsThreshold = 0;
// read from VM-property
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jclass systemCls = (*env)->FindClass(env, "java/lang/System");
CHECK_NULL(systemCls);
jmethodID mid = (*env)->GetStaticMethodID(env, systemCls, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;");
CHECK_NULL(mid);
jstring name = (*env)->NewStringUTF(env, "recreate.x11.input.method");
CHECK_NULL(name);
jstring jvalue = (*env)->CallStaticObjectMethod(env, systemCls, mid, name);
if (jvalue != NULL) {
const char * utf8string = (*env)->GetStringUTFChars(env, jvalue, NULL);
if (utf8string != NULL) {
const int parsedVal = atoi(utf8string);
if (parsedVal > 0)
filteredEventsThreshold = parsedVal;
else if (strncmp(utf8string, "true", 4) == 0)
filteredEventsThreshold = 10;
}
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
}
(*env)->DeleteLocalRef(env, name);
}
if (filteredEventsThreshold <= 0)
return;
if (event->type == KeyPressEventType || event->type == KeyReleaseEventType) {
if (isEventFiltered) {
filteredEventsCount++;
} else {
filteredEventsCount = 0;
}
if (filteredEventsCount > filteredEventsThreshold) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11InputMethod", "recreateAllXIC", "()V");
filteredEventsCount = 0;
}
}
}
/*
* Class: sun_awt_X11_XlibWrapper
* Method: XFilterEvent
@@ -658,7 +707,9 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent
return (jboolean)True;
}
#endif
return (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
jboolean isEventFiltered = (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
checkBrokenInputMethod((XEvent *)jlong_to_ptr(ptr), isEventFiltered);
return isEventFiltered;
}
/*

View File

@@ -1720,7 +1720,7 @@ void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
int dpi = device ? device->GetScaleX() * 96 : 96;
// GetSystemMetricsForDpi gives incorrect values, use AdjustWindowRectExForDpi for border metrics instead
RECT rect = {0};
RECT rect = {};
DWORD style = pFrame->IsResizable() ? WS_OVERLAPPEDWINDOW : WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;
AwtToolkit::AdjustWindowRectExForDpi(&rect, style, FALSE, NULL, dpi);
::SetRect(insets, -rect.left, -rect.top, rect.right, rect.bottom);
@@ -1734,7 +1734,7 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
GetWindowRect(frame->GetHWnd(), &rcWindow);
// Get the frame rectangle, adjusted for the style without a caption.
RECT rcFrame = {0};
RECT rcFrame = {};
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
USHORT uRow = 1;
@@ -1794,8 +1794,10 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
if (::IsZoomed(GetHWnd())) {
rect->top += insets.bottom;
// [moklev] Workaround for RIDER-27069, IDEA-211327
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
if (!this->IsUndecorated()) {
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
}
}
else {
// this makes the native caption go uncovered

View File

@@ -103,16 +103,21 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses();
Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceType type = iter.next();
// first check already loaded classes and possibly avoid massive signature retrieval later
String typeName = new JNITypeParser(signature).typeName();
for (ReferenceType type : vm.classesByName(typeName)) {
if (types.contains(type)) {
return type;
}
}
for (ReferenceType type : types) {
if (type.signature().equals(signature)) {
return type;
}
}
JNITypeParser parser = new JNITypeParser(signature);
throw new ClassNotLoadedException(parser.typeName(),
"Class " + parser.typeName() + " not loaded");
throw new ClassNotLoadedException(typeName, "Class " + typeName + " not loaded");
}
byte typeValueKey() {

View File

@@ -61,6 +61,9 @@ applications/ctw/modules/jdk_jconsole.java 8189604 windows-all
compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
compiler/uncommontrap/DeoptReallocFailure.java nobug generic-all causes Out of memory: Java heap space affects run status
compiler/uncommontrap/TestDeoptOOM.java nobug generic-all causes Out of memory: Java heap space affects run status
#############################################################################
# :hotspot_gc

View File

@@ -38,9 +38,12 @@ import javax.swing.UIManager;
* @bug 8073320
* @summary Windows HiDPI support
* @author Alexander Scherbatiy
* @requires (os.family == "windows")
* @requires (os.family == "linux" | os.family == "windows")
* @run main/othervm -Dsun.java2d.win.uiScaleX=3 -Dsun.java2d.win.uiScaleY=2
* HiDPIRobotScreenCaptureTest
HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=1 HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=2 HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=3 HiDPIRobotScreenCaptureTest
*/
public class HiDPIRobotScreenCaptureTest {
@@ -50,11 +53,13 @@ public class HiDPIRobotScreenCaptureTest {
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
return;
if (System.getProperty("os.name").toLowerCase().contains("win")) {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
return;
}
}
Frame frame = new Frame();

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.*;
import java.lang.reflect.InvocationTargetException;
/*
* @test
* @summary JBR-1604 Tooltip with package's info is cut
*/
public class JEditorPanePreferredSizeTest2 {
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
final Dimension size = new Dimension();
SwingUtilities.invokeAndWait(() -> {
JEditorPane editorPane = new JEditorPane("text/html", "text");
editorPane.setBorder(null);
editorPane.getPreferredSize();
editorPane.setText("another text");
size.setSize(editorPane.getPreferredSize());
});
if (size.width <= 0 || size.height <= 0) {
throw new RuntimeException("Test FAILED: bad preferred size: " + size);
}
}
}

View File

@@ -529,7 +529,7 @@ java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java
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/DragWindowTest.java 8023562 macosx-all,windows-all
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java JRE-898 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all
@@ -618,6 +618,7 @@ java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java
java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html 8214221 windows-all,linux-all,macosx-all
java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.html 8171510 macosx-all
java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html 8194947 generic-all
java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html 6511207 generic-all
java/awt/event/HierarchyEvent/AncestorResized/AncestorResized.java 6618538 generic-all
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
java/awt/event/KeyEvent/CorrectTime/CorrectTime.java 6626492 generic-all

View File

@@ -48,7 +48,7 @@ java/awt/Graphics/LineClipTest.java
java/awt/Graphics2D/ScaledTransform/ScaledTransform.java nobug macosx-all,linux-all,windows-all
java/awt/JAWT/JAWT.sh nobug linux-all,windows-all
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html nobug macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java nobug macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java nobug macosx-all,windows-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.html nobug windows-all reproduced with Adopt
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java nobug windows-all
java/awt/List/ActionAfterRemove/ActionAfterRemove.java nobug windows-all
@@ -125,7 +125,6 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java nobug macosx-all,windows-all
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.html nobug linux-all,windows-all
java/awt/event/KeyEvent/RobotCrash/RobotCrash.java nobug linux-all,windows-all
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java nobug macosx-all,linux-all
java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java nobug macosx-all,windows-all,linux-all
java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java nobug macosx-all,windows-all
java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java nobug macosx-all,linux-all,windows-all
@@ -155,7 +154,7 @@ java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
javax/swing/JComboBox/4199622/bug4199622.java nobug windows-all
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all
javax/swing/JDialog/Transparency/TransparencyTest.java nobug macosx-all,windows-all
javax/swing/JDialog/Transparency/TransparencyTest.java nobug linux-all,macosx-all,windows-all
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest.java nobug windows-all
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest_i18n.java nobug windows-all
javax/swing/JFileChooser/6489130/bug6489130.java nobug macosx-all

View File

@@ -24,42 +24,26 @@
package performance.rendering;
import org.junit.Test;
import util.Renderer;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.QuadCurve2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class RenderPerfTest {
private final static int N = 1000;
private final static float WIDTH = 800;
private final static float HEIGHT = 800;
private final static float R = 25;
private final static int BW = 50;
private final static int BH = 50;
private final static int COUNT = 300;
private final static int DELAY = 10;
private final static int RESOLUTION = 5;
private final static int COLOR_TOLERANCE = 10;
interface Renderable {
void render(Graphics2D g2d);
void update();
}
static class Particles {
private float[] bx;
private float[] by;
@@ -384,112 +368,7 @@ public class RenderPerfTest {
}
}
class PerfMeter {
private int frame = 0;
private JPanel panel;
private long time;
private double execTime = 0;
private Color expColor = Color.RED;
AtomicBoolean waiting = new AtomicBoolean(false);
double exec(final Renderable renderable) throws Exception {
final CountDownLatch latch = new CountDownLatch(COUNT);
final CountDownLatch latchFrame = new CountDownLatch(1);
final JFrame f = new JFrame();
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
latchFrame.countDown();
}
});
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
panel = new JPanel()
{
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
time = System.nanoTime();
Graphics2D g2d = (Graphics2D) g;
renderable.render(g2d);
g2d.setColor(expColor);
g.fillRect(0, 0, BW, BH);
}
};
panel.setPreferredSize(new Dimension((int)(WIDTH + BW), (int)(HEIGHT + BH)));
panel.setBackground(Color.BLACK);
f.add(panel);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
});
Robot robot = new Robot();
Timer timer = new Timer(DELAY, e -> {
if (waiting.compareAndSet(false, true)) {
Color c = robot.getPixelColor(panel.getTopLevelAncestor().getX() + 25,
panel.getTopLevelAncestor().getY() + 25);
if (isAlmostEqual(c, Color.BLUE)) {
expColor = Color.RED;
} else {
expColor = Color.BLUE;
}
renderable.update();
panel.getParent().repaint();
} else {
while (!isAlmostEqual(
robot.getPixelColor(
panel.getTopLevelAncestor().getX() + BW / 2,
panel.getTopLevelAncestor().getY() + BH / 2),
expColor))
{
try {
Thread.sleep(RESOLUTION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
time = System.nanoTime() - time;
execTime += time;
frame++;
waiting.set(false);
}
latch.countDown();
});
timer.start();
latch.await();
SwingUtilities.invokeAndWait(() -> {
timer.stop();
f.setVisible(false);
f.dispose();
});
latchFrame.await();
return 1e9/(execTime / frame);
}
private boolean isAlmostEqual(Color c1, Color c2) {
return Math.abs(c1.getRed() - c2.getRed()) < COLOR_TOLERANCE ||
Math.abs(c1.getGreen() - c2.getGreen()) < COLOR_TOLERANCE ||
Math.abs(c1.getBlue() - c2.getBlue()) < COLOR_TOLERANCE;
}
}
private static final Particles balls = new Particles(N, R, BW, BH, WIDTH, HEIGHT);
private static final Particles balls = new Particles(N, R, 0, 0, Renderer.WIDTH, Renderer.HEIGHT);
private static final ParticleRenderer flatRenderer = new FlatParticleRenderer(N, R);
private static final ParticleRenderer flatOvalRotRenderer = new FlatOvalRotParticleRenderer(N, R);
private static final ParticleRenderer flatBoxRenderer = new FlatBoxParticleRenderer(N, R);
@@ -519,7 +398,7 @@ public class RenderPerfTest {
@Test
public void testFlatBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.Renderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatRenderer);
@@ -529,6 +408,11 @@ public class RenderPerfTest {
public void update() {
balls.update();
}
@Override
public void screenShot(BufferedImage result) {
System.err.println();
}
});
report("FlatOval", fps);
@@ -537,7 +421,7 @@ public class RenderPerfTest {
@Test
public void testFlatBoxBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatBoxRenderer);
@@ -555,7 +439,7 @@ public class RenderPerfTest {
@Test
public void testImgBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, imgRenderer);
@@ -573,7 +457,7 @@ public class RenderPerfTest {
@Test
public void testFlatBoxRotBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatBoxRotRenderer);
@@ -591,7 +475,7 @@ public class RenderPerfTest {
@Test
public void testFlatOvalRotBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatOvalRotRenderer);
@@ -609,7 +493,7 @@ public class RenderPerfTest {
@Test
public void testLinGradOvalRotBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, linGradOvalRotRenderer);
@@ -628,7 +512,7 @@ public class RenderPerfTest {
@Test
public void testWiredBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredRenderer);
@@ -646,7 +530,7 @@ public class RenderPerfTest {
@Test
public void testWiredBoxBubbles() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredBoxRenderer);
@@ -664,7 +548,7 @@ public class RenderPerfTest {
@Test
public void testLines() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, segRenderer);
@@ -682,7 +566,7 @@ public class RenderPerfTest {
@Test
public void testFlatQuad() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatQuadRenderer);
@@ -700,7 +584,7 @@ public class RenderPerfTest {
@Test
public void testWiredQuad() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredQuadRenderer);
@@ -718,7 +602,7 @@ public class RenderPerfTest {
@Test
public void testTextBubblesNoAA() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererNoAA);
@@ -736,7 +620,7 @@ public class RenderPerfTest {
@Test
public void testTextBubblesLCD() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererLCD);
@@ -754,7 +638,7 @@ public class RenderPerfTest {
@Test
public void testTextBubblesGray() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererGray);
@@ -772,7 +656,7 @@ public class RenderPerfTest {
@Test
public void testWhiteTextBubblesNoAA() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererNoAA);
@@ -790,7 +674,7 @@ public class RenderPerfTest {
@Test
public void testWhiteTextBubblesLCD() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererLCD);
@@ -808,7 +692,7 @@ public class RenderPerfTest {
@Test
public void testWhiteTextBubblesGray() throws Exception {
double fps = (new PerfMeter()).exec(new Renderable() {
double fps = (new Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererGray);

View File

@@ -0,0 +1,37 @@
package quality.text;
import org.junit.Assert;
import org.junit.Test;
import quality.util.RenderUtil;
import util.Renderer;
import java.awt.*;
import java.awt.image.BufferedImage;
public class FiraCodeScrTest {
@Test
public void testRenderText() throws Exception {
String [] testResult = new String[] {null};
(new util.Renderer(2, 300, 30, true)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
g2d.setColor(Color.WHITE);
Font f = new Font("Fira Code", Font.PLAIN, 12);
g2d.setFont(f);
g2d.drawString("The quick brown fox jumps over the lazy dog", 0, 15);
}
@Override
public void screenShot(BufferedImage result) {
try {
RenderUtil.checkImage(result, "text", "firacode.png");
} catch (Exception e) {
testResult[0] = e.getMessage();
}
}
});
if (testResult[0] != null) Assert.fail(testResult[0]);
}
}

View File

@@ -33,7 +33,7 @@ public class RenderUtil {
throws Exception
{
JFrame[] f = new JFrame[1];
Point[] p = new Point[1];
int[] p = new int[2];
double[] scale = new double[2];
SwingUtilities.invokeAndWait(() -> {
f[0] = new JFrame();
@@ -47,19 +47,22 @@ public class RenderUtil {
// e.g. rounded frame
c.setLocation(50, 50);
f[0].setVisible(true);
p[0]= c.getLocationOnScreen();
p[0] = f[0].getLocationOnScreen().x + f[0].getInsets().left;
p[1] = f[0].getLocationOnScreen().y + f[0].getInsets().top;
scale[0] = f[0].getGraphicsConfiguration().getDefaultTransform().getScaleX();
scale[1] = f[0].getGraphicsConfiguration().getDefaultTransform().getScaleY();
});
Rectangle screenRect;
Robot r = new Robot();
while (!Color.black.equals(r.getPixelColor(p[0].x+1, p[0].y))) {
while (!Color.black.equals(r.getPixelColor(p[0] + 1, p[1] + 1))) {
p[0] = f[0].getLocationOnScreen().x + f[0].getInsets().left;
p[1] = f[0].getLocationOnScreen().y + f[0].getInsets().top;
Thread.sleep(100);
}
screenRect = new Rectangle(
p[0].x + 5,
p[0].y + 5,
p[0] + 5,
p[1] + 5,
(int)((width - 20) * scale[0]), (int)((height - 30) * scale[1]));
BufferedImage result = r.createScreenCapture(screenRect);

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,170 @@
package util;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
public class Renderer {
public final static int WIDTH = 800;
public final static int HEIGHT = 800;
public final static int BW = 50;
public final static int BH = 50;
private final static int RESOLUTION = 5;
private final static int COLOR_TOLERANCE = 10;
private final static int DELAY = 10;
private int frame = 0;
private final int count;
private final int width;
private final int height;
private final boolean capture;
private JPanel panel;
private long time;
private double execTime = 0;
private Color expColor = Color.RED;
AtomicBoolean waiting = new AtomicBoolean(false);
public Renderer(int count) {
this(count, WIDTH, HEIGHT, false);
}
public Renderer(int count, int width, int height, boolean capture) {
this.count = count;
this.width = width;
this.height = height;
this.capture = capture;
}
public double exec(final Renderable renderable) throws Exception {
final CountDownLatch latch = new CountDownLatch(count);
final CountDownLatch latchFrame = new CountDownLatch(1);
final JFrame f = new JFrame();
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
latchFrame.countDown();
}
});
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
panel = new JPanel()
{
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
time = System.nanoTime();
Graphics2D g2d = (Graphics2D) g;
g2d.translate(BW, BH);
renderable.render(g2d);
g2d.translate(-BW, -BH);
g2d.setColor(expColor);
g.fillRect(0, 0, BW, BH);
}
};
panel.setPreferredSize(new Dimension(width + BW, height + BH));
panel.setBackground(Color.BLACK);
f.add(panel);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
});
Robot robot = new Robot();
Timer timer = new Timer(DELAY, e -> {
if (waiting.compareAndSet(false, true)) {
Color c = robot.getPixelColor(
panel.getTopLevelAncestor().getX() + panel.getTopLevelAncestor().getInsets().left + BW / 2,
panel.getTopLevelAncestor().getY() + panel.getTopLevelAncestor().getInsets().top + BH / 2);
if (isAlmostEqual(c, Color.BLUE)) {
expColor = Color.RED;
} else {
expColor = Color.BLUE;
}
if (capture) {
renderable.screenShot(robot.createScreenCapture(
new Rectangle(
panel.getTopLevelAncestor().getX() + panel.getTopLevelAncestor().getInsets().left + BW,
panel.getTopLevelAncestor().getY() + panel.getTopLevelAncestor().getInsets().top + BH,
width, height)));
}
renderable.update();
panel.getParent().repaint();
} else {
while (!isAlmostEqual(
robot.getPixelColor(
panel.getTopLevelAncestor().getX() + panel.getTopLevelAncestor().getInsets().left + BW/2,
panel.getTopLevelAncestor().getY() + panel.getTopLevelAncestor().getInsets().top + BH/2),
expColor))
{
try {
Thread.sleep(RESOLUTION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
time = System.nanoTime() - time;
execTime += time;
frame++;
waiting.set(false);
}
latch.countDown();
});
timer.start();
latch.await();
SwingUtilities.invokeAndWait(() -> {
timer.stop();
f.setVisible(false);
f.dispose();
});
latchFrame.await();
return 1e9/(execTime / frame);
}
private boolean isAlmostEqual(Color c1, Color c2) {
return Math.abs(c1.getRed() - c2.getRed()) < COLOR_TOLERANCE ||
Math.abs(c1.getGreen() - c2.getGreen()) < COLOR_TOLERANCE ||
Math.abs(c1.getBlue() - c2.getBlue()) < COLOR_TOLERANCE;
}
public interface Renderable {
void render(Graphics2D g2d);
void update();
void screenShot(BufferedImage result);
}
public static class DefaultRenderable implements Renderable {
@Override
public void render(Graphics2D g2d) {
}
@Override
public void update() {
}
@Override
public void screenShot(BufferedImage result) {
}
}
}