mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-11 11:01:40 +01:00
Compare commits
3 Commits
2104
...
tav/JBR-41
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a1c3f1aed | ||
|
|
7aa7df1818 | ||
|
|
68897d92a6 |
@@ -1,7 +1,7 @@
|
||||
[general]
|
||||
project=jdk-updates
|
||||
jbs=JDK
|
||||
version=11.0.14.1
|
||||
version=11.0.14
|
||||
|
||||
[checks]
|
||||
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace
|
||||
|
||||
@@ -145,7 +145,7 @@ cp -r $JSDK $BASE_DIR/$JBRSDK_BUNDLE || do_exit $?
|
||||
if [[ "${bundle_type}" == *jcef* ]] || [[ "${bundle_type}" == *dcevm* ]] || [[ "${bundle_type}" == fd ]]; then
|
||||
rsync -av ${JCEF_PATH}/ $BASE_DIR/$JBRSDK_BUNDLE/lib --exclude="modular-sdk" || do_exit $?
|
||||
fi
|
||||
if [ "${bundle_type}" == "dcevm" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
|
||||
@@ -157,7 +157,7 @@ fi
|
||||
|
||||
create_jbr || do_exit $?
|
||||
|
||||
if [ "$bundle_type" == "dcevm" ]; then
|
||||
if [ "$bundle_type" == "jcef" ]; then
|
||||
make test-image CONF=$RELEASE_NAME || do_exit $?
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-test-x64-b$build_number
|
||||
|
||||
@@ -194,7 +194,7 @@ cp -a $JSDK/jdk-$JBSDK_VERSION_WITH_DOTS.jdk $BASE_DIR/$JBRSDK_BUNDLE || do_exit
|
||||
if [[ "${bundle_type}" == *jcef* ]] || [[ "${bundle_type}" == *dcevm* ]] || [[ "${bundle_type}" == fd ]]; then
|
||||
cp -a ${JCEF_PATH}/Frameworks $BASE_DIR/$JBRSDK_BUNDLE/Contents/
|
||||
fi
|
||||
if [ "${bundle_type}" == "dcevm" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release
|
||||
@@ -207,7 +207,7 @@ fi
|
||||
|
||||
create_jbr || do_exit $?
|
||||
|
||||
if [ "$bundle_type" == "dcevm" ]; then
|
||||
if [ "$bundle_type" == "jcef" ]; then
|
||||
make test-image CONF=$CONF_NAME || do_exit $?
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-osx-test-${architecture}-b$build_number
|
||||
|
||||
@@ -25,40 +25,16 @@ case "${unameOut}" in
|
||||
echo "Unknown machine: ${unameOut}"
|
||||
exit 1
|
||||
esac
|
||||
FILENAME=$(basename ${NEWFILEPATH})
|
||||
#
|
||||
# Get pattern of artifact name
|
||||
# Base filename pattern: <BUNDLE_TYPE>-<JDK_VERSION>-<OS>-<ARCH>-b<BUILD>.tar.gz: jbr_dcevm-17.0.2-osx-x64-b1234.tar.gz
|
||||
# BUNDLE_TYPE: jbr, jbrsdk, jbr_dcevm, jbrsdk_jcef etc.
|
||||
# OS_ARCH_PATTERN - <os_architecture>: osx-x64, linux-aarch64, windows-x64 etc.
|
||||
|
||||
BUNDLE_TYPE=jbrsdk
|
||||
OS_ARCH_PATTERN=""
|
||||
re='(jbr[a-z_]*)-[0-9_]+-(.+)-b.+\.tar\.gz'
|
||||
if [[ $FILENAME =~ $re ]]; then
|
||||
BUNDLE_TYPE=${BASH_REMATCH[1]}
|
||||
OS_ARCH_PATTERN=${BASH_REMATCH[2]}
|
||||
echo ${BASH_REMATCH[*]}
|
||||
fi
|
||||
echo "BUNDLE_TYPE: " $BUNDLE_TYPE
|
||||
echo "OS_ARCH_PATTERN: " $OS_ARCH_PATTERN
|
||||
echo "New size of $FILENAME = $NEWFILESIZE bytes."
|
||||
echo "New size of $NEWFILEPATH = $NEWFILESIZE bytes."
|
||||
|
||||
# example: IntellijCustomJdk_Jdk17_Master_LinuxX64jcef
|
||||
|
||||
#
|
||||
# Get previous successful build ID
|
||||
# Example:
|
||||
# CONFIGID=IntellijCustomJdk_Jdk17_Master_LinuxX64jcef
|
||||
# BUILDID=12345678
|
||||
#
|
||||
# expected return value
|
||||
# id="123".number="567"
|
||||
#
|
||||
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/?locator=buildType:(id:$CONFIGID),status:success,count:1,finishDate:(build:$BUILDID,condition:before)")
|
||||
re='id=\"([0-9]+)\".+number=\"([0-9\.]+)\"'
|
||||
|
||||
# ID: Previous successful build id
|
||||
re='id=\"([0-9]+)\".+number=\"([0-9]+)\"'
|
||||
ID=0
|
||||
|
||||
if [[ $CURL_RESPONSE =~ $re ]]; then
|
||||
ID=${BASH_REMATCH[1]}
|
||||
echo "BUILD Number: ${BASH_REMATCH[2]}"
|
||||
@@ -68,18 +44,13 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Get artifacts from previous successful build
|
||||
#
|
||||
# expected return value
|
||||
# name="jbrsdk_jcef*.tar.gz size="123'
|
||||
#
|
||||
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/$ID?fields=id,number,artifacts(file(name,size))")
|
||||
echo "Atrifacts of previous build of $CONFIGID :"
|
||||
|
||||
echo "Atrifacts of last pinned build of $CONFIGID :\n"
|
||||
echo $CURL_RESPONSE
|
||||
|
||||
# Find binary size (in response) with reg exp
|
||||
re='name=\"('$BUNDLE_TYPE'[^\"]+'${OS_ARCH_PATTERN}'[^\"]+\.tar\.gz)\" size=\"([0-9]+)\"'
|
||||
# Find size (in response) with reg exp
|
||||
re='name=\"(jbrsdk_jcef[^\"]+\.tar\.gz)\" size=\"([0-9]+)\"'
|
||||
|
||||
if [[ $CURL_RESPONSE =~ $re ]]; then
|
||||
OLDFILENAME=${BASH_REMATCH[1]}
|
||||
@@ -92,8 +63,6 @@ if [[ $CURL_RESPONSE =~ $re ]]; then
|
||||
if [[ "$NEWFILESIZE" -gt "$allowedSize" ]]; then
|
||||
echo "ERROR: new size is significally greater than prev size (need to investigate)"
|
||||
exit 1
|
||||
else
|
||||
echo "PASSED"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: can't find string with size in xml response:"
|
||||
|
||||
@@ -67,7 +67,7 @@ IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
BASE_DIR=.
|
||||
|
||||
if [ "${bundle_type}" == "dcevm" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
[ -f "$JBSDK.tar.gz" ] && rm "$JBSDK.tar.gz"
|
||||
@@ -76,7 +76,7 @@ fi
|
||||
|
||||
pack_jbr $bundle_type
|
||||
|
||||
if [ "$bundle_type" == "dcevm" ]; then
|
||||
if [ "$bundle_type" == "jcef" ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-windows-test-aarch64-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
|
||||
@@ -67,7 +67,7 @@ IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
BASE_DIR=.
|
||||
|
||||
if [ "${bundle_type}" == "dcevm" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
[ -f "$JBSDK.tar.gz" ] && rm "$JBSDK.tar.gz"
|
||||
@@ -76,7 +76,7 @@ fi
|
||||
|
||||
pack_jbr $bundle_type
|
||||
|
||||
if [ "$bundle_type" == "dcevm" ]; then
|
||||
if [ "$bundle_type" == "jcef" ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-windows-test-x64-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
DEFAULT_VERSION_FEATURE=11
|
||||
DEFAULT_VERSION_INTERIM=0
|
||||
DEFAULT_VERSION_UPDATE=14
|
||||
DEFAULT_VERSION_PATCH=1
|
||||
DEFAULT_VERSION_PATCH=0
|
||||
DEFAULT_VERSION_EXTRA1=0
|
||||
DEFAULT_VERSION_EXTRA2=0
|
||||
DEFAULT_VERSION_EXTRA3=0
|
||||
DEFAULT_VERSION_DATE=2022-02-08
|
||||
DEFAULT_VERSION_DATE=2022-01-18
|
||||
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
|
||||
DEFAULT_VERSION_CLASSFILE_MINOR=0
|
||||
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, JetBrains s.r.o.. All rights reserved.
|
||||
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -29,7 +29,6 @@ import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.ClosedWatchServiceException;
|
||||
import java.nio.file.DirectoryIteratorException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.LinkOption;
|
||||
@@ -619,8 +618,6 @@ class MacOSXWatchService extends AbstractWatchService {
|
||||
snapshot.files.put(file.getFileName(), entry);
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
} catch (DirectoryIteratorException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
@@ -687,7 +684,7 @@ class MacOSXWatchService extends AbstractWatchService {
|
||||
// simply skip the file we couldn't read; it'll get marked as deleted later.
|
||||
}
|
||||
}
|
||||
} catch (IOException | DirectoryIteratorException ignore) {
|
||||
} catch (IOException ignore) {
|
||||
// Most probably this directory has just been deleted; our parent will notice that
|
||||
}
|
||||
|
||||
|
||||
@@ -270,8 +270,9 @@ final class CPlatformResponder {
|
||||
LWCToolkit lwcToolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
|
||||
if ((lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
|
||||
Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) ||
|
||||
((testChar != testCharIgnoringModifiers) &&
|
||||
LWCToolkit.isCharModifierKeyInLocale(lwcToolkit.getDefaultKeyboardLocale(), testChar))) {
|
||||
(LWCToolkit.isLocaleUSInternationalPC(lwcToolkit.getDefaultKeyboardLocale()) &&
|
||||
LWCToolkit.isCharModifierKeyInUSInternationalPC(testChar) &&
|
||||
(testChar != testCharIgnoringModifiers))) {
|
||||
testChar = testCharIgnoringModifiers;
|
||||
}
|
||||
|
||||
|
||||
@@ -921,8 +921,21 @@ public final class LWCToolkit extends LWToolkit {
|
||||
return locale;
|
||||
}
|
||||
|
||||
public static boolean isCharModifierKeyInLocale(Locale locale, char ch) {
|
||||
return KeyboardCombiningCharacters.isCharacterCombiningInKeyboardLocale(ch, locale);
|
||||
public static boolean isLocaleUSInternationalPC(Locale locale) {
|
||||
return (locale != null ?
|
||||
locale.toString().equals("_US_UserDefined_15000") : false);
|
||||
}
|
||||
|
||||
public static boolean isCharModifierKeyInUSInternationalPC(char ch) {
|
||||
// 5 characters: APOSTROPHE, QUOTATION MARK, ACCENT GRAVE, SMALL TILDE,
|
||||
// CIRCUMFLEX ACCENT
|
||||
final char[] modifierKeys = {'\'', '"', '`', '\u02DC', '\u02C6'};
|
||||
for (char modKey : modifierKeys) {
|
||||
if (modKey == ch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1158,261 +1171,3 @@ public final class LWCToolkit extends LWToolkit {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final class KeyboardCombiningCharacters {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static boolean isCharacterCombiningInKeyboardLocale(final char ch, final Locale locale) {
|
||||
if (locale == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String localeStr = locale.toString();
|
||||
if (localeStr == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final char[] localeCombiningChars = keyboardCombiningCharacters.get(localeStr);
|
||||
if (localeCombiningChars == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final char combiningChar : localeCombiningChars) {
|
||||
if (ch == combiningChar) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static final Map<String, char[]> keyboardCombiningCharacters;
|
||||
|
||||
static {
|
||||
/*
|
||||
* All arrays the map contains MUST be sorted into ASCENDING order (for binary search).
|
||||
* (UPD: the binary search proved to be slower than linear on the such small arrays so the linear is used now)
|
||||
*
|
||||
* Also, the syntax '<backslash>u<hex-digits>' is not used to avoid the traps about
|
||||
* early parsing of the unicode sequences.
|
||||
*/
|
||||
|
||||
// [U+0027 ('''), U+0060 ('`'), U+02c6, U+0022 ('"'), U+02dc, U+00b4, U+00a8]
|
||||
final char[] ENGLISH_US_INTERNATIONAL_PC =
|
||||
{(char)0x0022, (char)0x0027, (char)0x0060, (char)0x00A8,
|
||||
(char)0x00B4, (char)0x02C6, (char)0x02DC};
|
||||
|
||||
|
||||
// [U+0027 ('''), U+00a8, U+00b0, U+005e ('^'), U+02c7,
|
||||
// U+002c (','), U+002d ('-'), U+0022 ('"'), U+007e ('~')]
|
||||
final char[] CZECH_CZECH =
|
||||
{(char)0x0022, (char)0x0027, (char)0x002C, (char)0x002D,
|
||||
(char)0x005E, (char)0x007E, (char)0x00A8, (char)0x00B0, (char)0x02C7};
|
||||
|
||||
// [U+0027 ('''), U+00a8, U+02c7, U+00b0, U+005e ('^'),
|
||||
// U+002c (','), U+002d ('-'), U+0022 ('"'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] CZECH_CZECH_QWERTY = CZECH_CZECH;
|
||||
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+005e ('^'), U+007e ('~')]
|
||||
final char[] DANISH_DANISH =
|
||||
{(char)0x005E, (char)0x0060, (char)0x007E, (char)0x00A8, (char)0x00B4};
|
||||
|
||||
|
||||
// [U+0060 ('`'), U+00b4, U+00a8, U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] DUTCH_DUTCH = DANISH_DANISH;
|
||||
|
||||
// [U+005e ('^'), U+0060 ('`'), U+00a8, U+007e ('~'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] DUTCH_BELGIAN = DUTCH_DUTCH;
|
||||
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FINNISH_FINNISH = DANISH_DANISH;
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+02c6, U+2038, U+02dd, U+002c (','),
|
||||
// U+02c7, U+02d8, U+02c0, U+02bc, U+02d9, U+02da, U+00af, U+002e ('.'),
|
||||
// U+02db, U+00a0, U+0330, U+02dc, U+002d ('-'), U+02cd, U+00b8, U+2116, U+0294]
|
||||
final char[] FINNISH_FINNISH_EXTENDED =
|
||||
{(char)0x002C, (char)0x002D, (char)0x002E, (char)0x0060,
|
||||
(char)0x00A0, (char)0x00A8, (char)0x00AF, (char)0x00B4, (char)0x00B8,
|
||||
(char)0x0294, (char)0x02BC, (char)0x02C0, (char)0x02C6,
|
||||
(char)0x02C7, (char)0x02CD, (char)0x02D8, (char)0x02D9,
|
||||
(char)0x02DA, (char)0x02DB, (char)0x02DC, (char)0x02DD,
|
||||
(char)0x0330, (char)0x2038, (char)0x2116};
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+02c6, U+2038, U+02dd, U+002c (','),
|
||||
// U+02c7, U+02d8, U+02c0, U+02d9, U+02da, U+02db, U+00a0, U+0330, U+002d ('-'), U+02cd]
|
||||
final char[] FINNISH_SAMI_PC =
|
||||
{(char)0x002C, (char)0x002D, (char)0x0060, (char)0x00A0, (char)0x00A8, (char)0x00B4,
|
||||
(char)0x02C0, (char)0x02C6, (char)0x02C7, (char)0x02CD,
|
||||
(char)0x02D8, (char)0x02D9, (char)0x02DA, (char)0x02DB, (char)0x02DD,
|
||||
(char)0x0330, (char)0x2038};
|
||||
|
||||
|
||||
// [U+005e ('^'), U+0060 ('`'), U+00a8, U+007e ('~'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_ABC_AZERTY = DANISH_DANISH;
|
||||
|
||||
// [U+005e ('^'), U+00a8, U+0060 ('`'), U+007e ('~'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_CANADIAN_FRENCH_CSA = FRENCH_ABC_AZERTY;
|
||||
|
||||
// [U+005e ('^'), U+0060 ('`'), U+00a8, U+007e ('~'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_FRENCH = FRENCH_ABC_AZERTY;
|
||||
|
||||
// [U+005e ('^'), U+0060 ('`'), U+00a8, U+007e ('~'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_FRENCH_NUMERICAL = FRENCH_ABC_AZERTY;
|
||||
|
||||
// [U+005e ('^'), U+00a8, U+007e ('~'), U+0060 ('`'), U+00b4]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_FRENCH_PC = FRENCH_ABC_AZERTY;
|
||||
|
||||
// [U+005e ('^'), U+00a8, U+0060 ('`'), U+00b4, U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] FRENCH_SWISS_FRENCH = FRENCH_ABC_AZERTY;
|
||||
|
||||
|
||||
// [U+00b4, U+0060 ('`'), U+00a8, U+007e ('~'), U+005e ('^')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] GERMAN_ABC_QWERTZ = DANISH_DANISH;
|
||||
|
||||
// [U+00b4, U+0060 ('`'), U+00a8, U+007e ('~'), U+005e ('^')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] GERMAN_AUSTRIAN = GERMAN_ABC_QWERTZ;
|
||||
|
||||
// [U+00b4, U+0060 ('`'), U+00a8, U+007e ('~'), U+005e ('^')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] GERMAN_GERMAN = GERMAN_ABC_QWERTZ;
|
||||
|
||||
// [U+00b4, U+0060 ('`'), U+02d9, U+02c7, U+02dd, U+007e ('~'),
|
||||
// U+00a8, U+02d8, U+00af, U+02da, U+02c0, U+02bc,
|
||||
// U+02cd, U+00b8, U+002c (','), U+02db, U+002e ('.'), U+002d ('-')]
|
||||
final char[] GERMAN_GERMAN_STANDARD =
|
||||
{(char)0x002C, (char)0x002D, (char)0x002E, (char)0x0060, (char)0x007E,
|
||||
(char)0x00A8, (char)0x00AF, (char)0x00B4, (char)0x00B8,
|
||||
(char)0x02BC, (char)0x02C0, (char)0x02C7, (char)0x02CD,
|
||||
(char)0x02D8, (char)0x02D9, (char)0x02DA, (char)0x02DB, (char)0x02DD};
|
||||
|
||||
// [U+005e ('^'), U+00a8, U+0060 ('`'), U+00b4, U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] GERMAN_SWISS_GERMAN = GERMAN_ABC_QWERTZ;
|
||||
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] NORWEGIAN_BOKMAL_NORWEGIAN = DANISH_DANISH;
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+02c6, U+2038, U+02dd, U+002c (','), U+02c7,
|
||||
// U+02d8, U+02c0, U+02bc, U+02d9, U+02da, U+00af, U+002e ('.'), U+02db, U+00a0,
|
||||
// U+0330, U+02dc, U+002d ('-'), U+02cd, U+00b8, U+2116, U+0294]
|
||||
final char[] NORWEGIAN_BOKMAL_NORWEGIAN_EXTENDED =
|
||||
{(char)0x002C, (char)0x002D, (char)0x002E,
|
||||
(char)0x0060, (char)0x00A0, (char)0x00A8, (char)0x00AF, (char)0x00B4, (char)0x00B8,
|
||||
(char)0x0294, (char)0x02BC, (char)0x02C0, (char)0x02C6, (char)0x02C7, (char)0x02CD,
|
||||
(char)0x02D8, (char)0x02D9, (char)0x02DA, (char)0x02DB, (char)0x02DC, (char)0x02DD,
|
||||
(char)0x0330, (char)0x2038, (char)0x2116};
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+02c6, U+2038, U+02dd, U+002c (','), U+02c7,
|
||||
// U+02d8, U+02c0, U+02d9, U+02da, U+02db, U+00a0, U+0330, U+002d ('-'), U+02cd]
|
||||
final char[] NORWEGIAN_BOKMAL_NORWEGIAN_PC =
|
||||
{(char)0x002C, (char)0x002D,
|
||||
(char)0x0060, (char)0x00A0, (char)0x00A8, (char)0x00B4,
|
||||
(char)0x02C0, (char)0x02C6, (char)0x02C7, (char)0x02CD,
|
||||
(char)0x02D8, (char)0x02D9, (char)0x02DA, (char)0x02DB, (char)0x02DD,
|
||||
(char)0x0330, (char)0x2038};
|
||||
|
||||
|
||||
// [U+00b4, U+007e ('~'), U+00a8, U+0060 ('`'), U+005e ('^')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] PORTUGUESE_BRAZILIAN_ABNT2 = DANISH_DANISH;
|
||||
|
||||
// [U+0060 ('`'), U+0027 ('''), U+02dc, U+02c6, U+0022 ('"'), U+00b4, U+00a8]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] PORTUGUESE_BRAZILIAN_PRO = ENGLISH_US_INTERNATIONAL_PC;
|
||||
|
||||
|
||||
// [U+00b4, U+00a8, U+007e ('~'), U+0060 ('`'), U+005e ('^')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] SPANISH_LATIN_AMERICA = DANISH_DANISH;
|
||||
|
||||
// [U+00b4, U+0060 ('`'), U+00a8, U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] SPANISH_SPANISH = SPANISH_LATIN_AMERICA;
|
||||
|
||||
// [U+0060 ('`'), U+00b4, U+005e ('^'), U+00a8, U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] SPANISH_SPANISH_ISO = SPANISH_LATIN_AMERICA;
|
||||
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] SWEDISH_SWEDISH = DANISH_DANISH;
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+005e ('^'), U+007e ('~')]
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
final char[] SWEDISH_SWEDISH_PRO = SWEDISH_SWEDISH;
|
||||
|
||||
// [U+00b4, U+00a8, U+0060 ('`'), U+02c6, U+2038, U+02dd, U+002c (','), U+02c7,
|
||||
// U+02d8, U+02c0, U+02d9, U+02da, U+02db, <U+00a0, U+0330>, U+002d ('-'), U+02cd]
|
||||
final char[] SWEDISH_SWEDISH_SAMI_PC =
|
||||
{(char)0x002C, (char)0x002D, (char)0x0060, (char)0x00A0, (char)0x00A8, (char)0x00B4,
|
||||
(char)0x02C0, (char)0x02C6, (char)0x02C7, (char)0x02CD,
|
||||
(char)0x02D8, (char)0x02D9, (char)0x02DA, (char)0x02DB, (char)0x02DD,
|
||||
(char)0x0330, (char)0x2038};
|
||||
|
||||
|
||||
final Map<String, char[]> keyboardCombiningCharactersInitializer = new HashMap<>();
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_15000", ENGLISH_US_INTERNATIONAL_PC);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "cs", CZECH_CZECH);
|
||||
keyboardCombiningCharactersInitializer.put( "cs__QWERTY", CZECH_CZECH_QWERTY);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "da", DANISH_DANISH);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "nl_BE", DUTCH_BELGIAN);
|
||||
keyboardCombiningCharactersInitializer.put( "nl", DUTCH_DUTCH);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "fi", FINNISH_FINNISH);
|
||||
keyboardCombiningCharactersInitializer.put( "fi__Extended", FINNISH_FINNISH_EXTENDED);
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_-18", FINNISH_SAMI_PC);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_251", FRENCH_ABC_AZERTY);
|
||||
keyboardCombiningCharactersInitializer.put( "fr_CA", FRENCH_CANADIAN_FRENCH_CSA);
|
||||
keyboardCombiningCharactersInitializer.put( "fr", FRENCH_FRENCH);
|
||||
keyboardCombiningCharactersInitializer.put( "fr__numerical", FRENCH_FRENCH_NUMERICAL);
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_60", FRENCH_FRENCH_PC);
|
||||
keyboardCombiningCharactersInitializer.put( "fr_CH", FRENCH_SWISS_FRENCH);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_253", GERMAN_ABC_QWERTZ);
|
||||
keyboardCombiningCharactersInitializer.put( "de_AT", GERMAN_AUSTRIAN);
|
||||
keyboardCombiningCharactersInitializer.put( "de", GERMAN_GERMAN);
|
||||
keyboardCombiningCharactersInitializer.put("_US_UserDefined_-18133", GERMAN_GERMAN_STANDARD);
|
||||
keyboardCombiningCharactersInitializer.put( "de_CH", GERMAN_SWISS_GERMAN);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "no", NORWEGIAN_BOKMAL_NORWEGIAN);
|
||||
keyboardCombiningCharactersInitializer.put( "no__Extended", NORWEGIAN_BOKMAL_NORWEGIAN_EXTENDED);
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_-13", NORWEGIAN_BOKMAL_NORWEGIAN_PC);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_128", PORTUGUESE_BRAZILIAN_ABNT2);
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_72", PORTUGUESE_BRAZILIAN_PRO);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_89", SPANISH_LATIN_AMERICA);
|
||||
keyboardCombiningCharactersInitializer.put( "es", SPANISH_SPANISH);
|
||||
keyboardCombiningCharactersInitializer.put( "es__ISO", SPANISH_SPANISH_ISO);
|
||||
|
||||
keyboardCombiningCharactersInitializer.put( "sv", SWEDISH_SWEDISH);
|
||||
keyboardCombiningCharactersInitializer.put( "sv__Pro", SWEDISH_SWEDISH_PRO);
|
||||
keyboardCombiningCharactersInitializer.put( "_US_UserDefined_-15", SWEDISH_SWEDISH_SAMI_PC);
|
||||
|
||||
|
||||
keyboardCombiningCharacters = keyboardCombiningCharactersInitializer;
|
||||
}
|
||||
}
|
||||
@@ -764,7 +764,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
// NSWindowDelegate methods
|
||||
|
||||
- (void) _deliverMoveResizeEvent {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// deliver the event if this is a user-initiated live resize or as a side-effect
|
||||
// of a Java initiated resize, because AppKit can override the bounds and force
|
||||
@@ -773,19 +773,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
|
||||
if (platformWindow == NULL) {
|
||||
NSLog(@"[AWTWindow _deliverMoveResizeEvent]: platformWindow == NULL");
|
||||
return;
|
||||
}
|
||||
NSRect frame;
|
||||
@try {
|
||||
frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
|
||||
} @catch (NSException *e) {
|
||||
NSLog(@"WARNING: suppressed exception from ConvertNSScreenRect() in [AWTWindow _deliverMoveResizeEvent]");
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
[NSApplicationAWT logException:e forProcess:processInfo];
|
||||
return;
|
||||
// TODO: create generic AWT assert
|
||||
}
|
||||
|
||||
NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
|
||||
|
||||
GET_CPLATFORM_WINDOW_CLASS();
|
||||
DECLARE_METHOD(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
|
||||
(*env)->CallVoidMethod(env, platformWindow, jm_deliverMoveResizeEvent,
|
||||
@@ -1019,9 +1011,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
// the new key window
|
||||
NSWindow *keyWindow = [NSApp keyWindow];
|
||||
AWTWindow *opposite = nil;
|
||||
if (keyWindow != self.nsWindow) {
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
}
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
[AWTWindow setLastKeyWindow: self];
|
||||
|
||||
[self _deliverWindowFocusEvent:NO oppositeWindow: opposite];
|
||||
@@ -1337,15 +1327,7 @@ JNI_COCOA_ENTER(env);
|
||||
|
||||
// resets the NSWindow's style mask if the mask intersects any of those bits
|
||||
if (mask & MASK(_STYLE_PROP_BITMASK)) {
|
||||
NSWindowStyleMask styleMask = [AWTWindow styleMaskForStyleBits:newBits];
|
||||
@try {
|
||||
[nsWindow setStyleMask:styleMask];
|
||||
} @catch (NSException *e) {
|
||||
NSLog(@"WARNING: suppressed exception from [NSWindow setStyleMask] in CPlatformWindow"
|
||||
".nativeSetNSWindowStyleBits");
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
[NSApplicationAWT logException:e forProcess:processInfo];
|
||||
}
|
||||
[nsWindow setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]];
|
||||
}
|
||||
|
||||
// calls methods on NSWindow to change other properties, based on the mask
|
||||
|
||||
@@ -237,7 +237,7 @@ static BOOL sNeedsEnter;
|
||||
jobject transferer = [self dataTransferer:env];
|
||||
jbyteArray data = nil;
|
||||
|
||||
if (transferer != NULL && fComponent != NULL) {
|
||||
if (transferer != NULL) {
|
||||
GET_DT_CLASS_RETURN(NULL);
|
||||
DECLARE_METHOD_RETURN(convertDataMethod, DataTransfererClass, "convertData", "(Ljava/lang/Object;Ljava/awt/datatransfer/Transferable;JLjava/util/Map;Z)[B", NULL);
|
||||
data = (*env)->CallObjectMethod(env, transferer, convertDataMethod, fComponent, fTransferable, format, fFormatMap, (jboolean) TRUE);
|
||||
|
||||
@@ -294,8 +294,16 @@ Java_sun_lwawt_macosx_CRobot_keyEvent
|
||||
{
|
||||
autoDelay(NO);
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||
CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
|
||||
CGPostKeyboardEvent(0, keyCode, keyPressed);
|
||||
CGEventRef event = CGEventCreateKeyboardEvent(source, keyCode, keyPressed);
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGHIDEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
if (source != NULL) {
|
||||
CFRelease(source);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -593,6 +593,8 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
jboolean result = JNI_TRUE;
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
if (ThreadUtilities.blockingEventDispatchThread) return JNI_FALSE;
|
||||
|
||||
AWTRunLoopObject* mediatorObject = (AWTRunLoopObject*)jlong_to_ptr(mediator);
|
||||
|
||||
if (mediatorObject == nil) return JNI_TRUE;
|
||||
|
||||
@@ -3381,7 +3381,7 @@ JNI_COCOA_ENTER(env);
|
||||
anotherBaseFont = true;
|
||||
}
|
||||
CTFontRef font = (CTFontRef)nsFont;
|
||||
CFArrayRef codes = CFLocaleCopyPreferredLanguages();
|
||||
CFArrayRef codes = CFLocaleCopyISOLanguageCodes();
|
||||
|
||||
CFArrayRef fds = CTFontCopyDefaultCascadeListForLanguages(font, codes);
|
||||
CFRelease(codes);
|
||||
|
||||
@@ -40,7 +40,9 @@ import sun.java2d.cmm.PCMM;
|
||||
import sun.java2d.cmm.CMSManager;
|
||||
import sun.java2d.cmm.Profile;
|
||||
import sun.java2d.cmm.ProfileDataVerifier;
|
||||
import sun.java2d.cmm.ProfileDeferralMgr;
|
||||
import sun.java2d.cmm.ProfileDeferralInfo;
|
||||
import sun.java2d.cmm.ProfileActivator;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@@ -95,8 +97,10 @@ public class ICC_Profile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3938515861990936766L;
|
||||
|
||||
private transient volatile Profile cmmProfile;
|
||||
private transient volatile ProfileDeferralInfo deferralInfo;
|
||||
private transient Profile cmmProfile;
|
||||
|
||||
private transient ProfileDeferralInfo deferralInfo;
|
||||
private transient ProfileActivator profileActivator;
|
||||
|
||||
// Registry of singleton profile objects for specific color spaces
|
||||
// defined in the ColorSpace class (e.g. CS_sRGB), see
|
||||
@@ -727,7 +731,7 @@ public class ICC_Profile implements Serializable {
|
||||
* Constructs an ICC_Profile object with a given ID.
|
||||
*/
|
||||
ICC_Profile(Profile p) {
|
||||
cmmProfile = p;
|
||||
this.cmmProfile = p;
|
||||
}
|
||||
|
||||
|
||||
@@ -736,7 +740,13 @@ public class ICC_Profile implements Serializable {
|
||||
* The ID will be 0 until the profile is loaded.
|
||||
*/
|
||||
ICC_Profile(ProfileDeferralInfo pdi) {
|
||||
deferralInfo = pdi;
|
||||
this.deferralInfo = pdi;
|
||||
this.profileActivator = new ProfileActivator() {
|
||||
public void activate() throws ProfileDataException {
|
||||
activateDeferredProfile();
|
||||
}
|
||||
};
|
||||
ProfileDeferralMgr.registerDeferral(this.profileActivator);
|
||||
}
|
||||
|
||||
|
||||
@@ -770,6 +780,10 @@ public class ICC_Profile implements Serializable {
|
||||
|
||||
Profile p = null;
|
||||
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
|
||||
ProfileDataVerifier.verify(data);
|
||||
|
||||
try {
|
||||
@@ -833,11 +847,11 @@ public class ICC_Profile implements Serializable {
|
||||
* Enabling the appropriate access privileges is handled
|
||||
* at a lower level.
|
||||
*/
|
||||
ProfileDeferralInfo pdi =
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("sRGB.pf",
|
||||
ColorSpace.TYPE_RGB, 3,
|
||||
CLASS_DISPLAY);
|
||||
sRGBprofile = new ICC_ProfileRGB(pdi);
|
||||
sRGBprofile = getDeferredInstance(pInfo);
|
||||
}
|
||||
thisProfile = sRGBprofile;
|
||||
}
|
||||
@@ -847,11 +861,11 @@ public class ICC_Profile implements Serializable {
|
||||
case ColorSpace.CS_CIEXYZ:
|
||||
synchronized(ICC_Profile.class) {
|
||||
if (XYZprofile == null) {
|
||||
ProfileDeferralInfo pdi =
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("CIEXYZ.pf",
|
||||
ColorSpace.TYPE_XYZ, 3,
|
||||
CLASS_DISPLAY);
|
||||
XYZprofile = new ICC_Profile(pdi);
|
||||
XYZprofile = getDeferredInstance(pInfo);
|
||||
}
|
||||
thisProfile = XYZprofile;
|
||||
}
|
||||
@@ -863,11 +877,11 @@ public class ICC_Profile implements Serializable {
|
||||
if (PYCCprofile == null) {
|
||||
if (standardProfileExists("PYCC.pf"))
|
||||
{
|
||||
ProfileDeferralInfo pdi =
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("PYCC.pf",
|
||||
ColorSpace.TYPE_3CLR, 3,
|
||||
CLASS_DISPLAY);
|
||||
PYCCprofile = new ICC_Profile(pdi);
|
||||
PYCCprofile = getDeferredInstance(pInfo);
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Can't load standard profile: PYCC.pf");
|
||||
@@ -881,11 +895,11 @@ public class ICC_Profile implements Serializable {
|
||||
case ColorSpace.CS_GRAY:
|
||||
synchronized(ICC_Profile.class) {
|
||||
if (GRAYprofile == null) {
|
||||
ProfileDeferralInfo pdi =
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("GRAY.pf",
|
||||
ColorSpace.TYPE_GRAY, 1,
|
||||
CLASS_DISPLAY);
|
||||
GRAYprofile = new ICC_ProfileGray(pdi);
|
||||
GRAYprofile = getDeferredInstance(pInfo);
|
||||
}
|
||||
thisProfile = GRAYprofile;
|
||||
}
|
||||
@@ -895,11 +909,11 @@ public class ICC_Profile implements Serializable {
|
||||
case ColorSpace.CS_LINEAR_RGB:
|
||||
synchronized(ICC_Profile.class) {
|
||||
if (LINEAR_RGBprofile == null) {
|
||||
ProfileDeferralInfo pdi =
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("LINEAR_RGB.pf",
|
||||
ColorSpace.TYPE_RGB, 3,
|
||||
CLASS_DISPLAY);
|
||||
LINEAR_RGBprofile = new ICC_ProfileRGB(pdi);
|
||||
LINEAR_RGBprofile = getDeferredInstance(pInfo);
|
||||
}
|
||||
thisProfile = LINEAR_RGBprofile;
|
||||
}
|
||||
@@ -998,7 +1012,13 @@ public class ICC_Profile implements Serializable {
|
||||
* contain valid ICC Profile data.
|
||||
*/
|
||||
public static ICC_Profile getInstance(InputStream s) throws IOException {
|
||||
byte[] profileData;
|
||||
byte profileData[];
|
||||
|
||||
if (s instanceof ProfileDeferralInfo) {
|
||||
/* hack to detect profiles whose loading can be deferred */
|
||||
return getDeferredInstance((ProfileDeferralInfo) s);
|
||||
}
|
||||
|
||||
if ((profileData = getProfileDataFromStream(s)) == null) {
|
||||
throw new IllegalArgumentException("Invalid ICC Profile Data");
|
||||
}
|
||||
@@ -1031,32 +1051,62 @@ public class ICC_Profile implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Activates the deferred standard profiles. Implementation of this method
|
||||
* mimics the old behaviour when the CMMException and IOException were
|
||||
* wrapped by the ProfileDataException, and the ProfileDataException itself
|
||||
* was ignored during activation.
|
||||
* Constructs an ICC_Profile for which the actual loading of the
|
||||
* profile data from a file and the initialization of the CMM should
|
||||
* be deferred as long as possible.
|
||||
* Deferral is only used for standard profiles.
|
||||
* If deferring is disabled, then getStandardProfile() ensures
|
||||
* that all of the appropriate access privileges are granted
|
||||
* when loading this profile.
|
||||
* If deferring is enabled, then the deferred activation
|
||||
* code will take care of access privileges.
|
||||
* @see #activateDeferredProfile()
|
||||
*/
|
||||
private void activate() {
|
||||
if (cmmProfile == null) {
|
||||
synchronized (this) {
|
||||
if (cmmProfile != null) {
|
||||
return;
|
||||
}
|
||||
var is = getStandardProfileInputStream(deferralInfo.filename);
|
||||
if (is == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
byte[] data = getProfileDataFromStream(is);
|
||||
if (data != null) {
|
||||
cmmProfile = CMSManager.getModule().loadProfile(data);
|
||||
// from now we cannot use the deferred value, drop it
|
||||
deferralInfo = null;
|
||||
}
|
||||
is.close(); /* close the stream */
|
||||
} catch (CMMException | IOException ignore) {
|
||||
}
|
||||
}
|
||||
static ICC_Profile getDeferredInstance(ProfileDeferralInfo pdi) {
|
||||
if (!ProfileDeferralMgr.deferring) {
|
||||
return getStandardProfile(pdi.filename);
|
||||
}
|
||||
if (pdi.colorSpaceType == ColorSpace.TYPE_RGB) {
|
||||
return new ICC_ProfileRGB(pdi);
|
||||
} else if (pdi.colorSpaceType == ColorSpace.TYPE_GRAY) {
|
||||
return new ICC_ProfileGray(pdi);
|
||||
} else {
|
||||
return new ICC_Profile(pdi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void activateDeferredProfile() throws ProfileDataException {
|
||||
byte profileData[];
|
||||
final String fileName = deferralInfo.filename;
|
||||
|
||||
profileActivator = null;
|
||||
deferralInfo = null;
|
||||
InputStream is = getStandardProfileInputStream(fileName);
|
||||
if (is == null) {
|
||||
throw new ProfileDataException("Cannot open file " + fileName);
|
||||
}
|
||||
try {
|
||||
profileData = getProfileDataFromStream(is);
|
||||
is.close(); /* close the file */
|
||||
}
|
||||
catch (IOException e) {
|
||||
ProfileDataException pde = new
|
||||
ProfileDataException("Invalid ICC Profile Data" + fileName);
|
||||
pde.initCause(e);
|
||||
throw pde;
|
||||
}
|
||||
if (profileData == null) {
|
||||
throw new ProfileDataException("Invalid ICC Profile Data" +
|
||||
fileName);
|
||||
}
|
||||
try {
|
||||
cmmProfile = CMSManager.getModule().loadProfile(profileData);
|
||||
} catch (CMMException c) {
|
||||
ProfileDataException pde = new
|
||||
ProfileDataException("Invalid ICC Profile Data" + fileName);
|
||||
pde.initCause(c);
|
||||
throw pde;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,9 +1145,11 @@ public class ICC_Profile implements Serializable {
|
||||
byte[] theHeader;
|
||||
int theClassSig, theClass;
|
||||
|
||||
ProfileDeferralInfo info = deferralInfo;
|
||||
if (info != null) {
|
||||
return info.profileClass;
|
||||
if (deferralInfo != null) {
|
||||
return deferralInfo.profileClass; /* Need to have this info for
|
||||
ICC_ColorSpace without
|
||||
causing a deferred profile
|
||||
to be loaded */
|
||||
}
|
||||
|
||||
theHeader = getData(icSigHead);
|
||||
@@ -1153,11 +1205,12 @@ public class ICC_Profile implements Serializable {
|
||||
* {@code ColorSpace} class.
|
||||
*/
|
||||
public int getColorSpaceType() {
|
||||
ProfileDeferralInfo info = deferralInfo;
|
||||
if (info != null) {
|
||||
return info.colorSpaceType;
|
||||
if (deferralInfo != null) {
|
||||
return deferralInfo.colorSpaceType; /* Need to have this info for
|
||||
ICC_ColorSpace without
|
||||
causing a deferred profile
|
||||
to be loaded */
|
||||
}
|
||||
activate();
|
||||
return getColorSpaceType(cmmProfile);
|
||||
}
|
||||
|
||||
@@ -1184,7 +1237,9 @@ public class ICC_Profile implements Serializable {
|
||||
* {@code ColorSpace} class.
|
||||
*/
|
||||
public int getPCSType() {
|
||||
activate();
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
return getPCSType(cmmProfile);
|
||||
}
|
||||
|
||||
@@ -1246,7 +1301,9 @@ public class ICC_Profile implements Serializable {
|
||||
int profileSize;
|
||||
byte[] profileData;
|
||||
|
||||
activate();
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
|
||||
PCMM mdl = CMSManager.getModule();
|
||||
|
||||
@@ -1279,7 +1336,9 @@ public class ICC_Profile implements Serializable {
|
||||
*/
|
||||
public byte[] getData(int tagSignature) {
|
||||
|
||||
activate();
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
|
||||
return getData(cmmProfile, tagSignature);
|
||||
}
|
||||
@@ -1325,7 +1384,9 @@ public class ICC_Profile implements Serializable {
|
||||
*/
|
||||
public void setData(int tagSignature, byte[] tagData) {
|
||||
|
||||
activate();
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
|
||||
CMSManager.getModule().setTagData(cmmProfile, tagSignature, tagData);
|
||||
}
|
||||
@@ -1383,9 +1444,11 @@ public class ICC_Profile implements Serializable {
|
||||
byte[] theHeader;
|
||||
int theColorSpaceSig, theNumComponents;
|
||||
|
||||
ProfileDeferralInfo info = deferralInfo;
|
||||
if (info != null) {
|
||||
return info.numComponents;
|
||||
if (deferralInfo != null) {
|
||||
return deferralInfo.numComponents; /* Need to have this info for
|
||||
ICC_ColorSpace without
|
||||
causing a deferred profile
|
||||
to be loaded */
|
||||
}
|
||||
theHeader = getData(icSigHead);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -36,18 +36,16 @@
|
||||
|
||||
package java.awt.image;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import sun.java2d.cmm.CMSManager;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.color.*;
|
||||
import sun.java2d.cmm.ColorTransform;
|
||||
import sun.java2d.cmm.CMSManager;
|
||||
import sun.java2d.cmm.ProfileDeferralMgr;
|
||||
import sun.java2d.cmm.PCMM;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.RenderingHints;
|
||||
|
||||
/**
|
||||
* This class performs a pixel-by-pixel color conversion of the data in
|
||||
@@ -79,6 +77,13 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp {
|
||||
boolean gotProfiles;
|
||||
float[] srcMinVals, srcMaxVals, dstMinVals, dstMaxVals;
|
||||
|
||||
/* the class initializer */
|
||||
static {
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ColorConvertOp which will convert
|
||||
* from a source color space to a destination color space.
|
||||
|
||||
@@ -1709,8 +1709,20 @@ public class BasicComboBoxUI extends ComboBoxUI {
|
||||
|
||||
@Override
|
||||
public boolean accept(Object c) {
|
||||
if (getName() == HIDE) {
|
||||
if (getName() == HIDE ) {
|
||||
return (c != null && ((JComboBox)c).isPopupVisible());
|
||||
} else if (getName() == ENTER) {
|
||||
JRootPane root = SwingUtilities.getRootPane((JComboBox)c);
|
||||
if (root != null) {
|
||||
InputMap im = root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
ActionMap am = root.getActionMap();
|
||||
if (im != null && am != null) {
|
||||
Object obj = im.get(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.java2d.cmm;
|
||||
|
||||
import java.awt.color.ProfileDataException;
|
||||
|
||||
/**
|
||||
* An interface to allow the ProfileDeferralMgr to activate a
|
||||
* deferred profile.
|
||||
*/
|
||||
public interface ProfileActivator {
|
||||
|
||||
/**
|
||||
* Activate a previously deferred ICC_Profile object.
|
||||
*/
|
||||
public void activate() throws ProfileDataException;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -25,28 +25,37 @@
|
||||
|
||||
package sun.java2d.cmm;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* A class to pass information about a profile to be loaded from a file to the
|
||||
* static getInstance(int cspace) method of ICC_Profile. Loading of the profile
|
||||
* data and initialization of the CMM is to be deferred as long as possible.
|
||||
* A class to pass information about a profile to be loaded from
|
||||
* a file to the static getInstance(InputStream) method of
|
||||
* ICC_Profile. Loading of the profile data and initialization
|
||||
* of the CMM is to be deferred as long as possible.
|
||||
*/
|
||||
public final class ProfileDeferralInfo {
|
||||
public class ProfileDeferralInfo extends InputStream {
|
||||
|
||||
/**
|
||||
* Need to have this info for ICC_ColorSpace without causing a deferred
|
||||
* profile to be loaded.
|
||||
*/
|
||||
public final int colorSpaceType, numComponents, profileClass;
|
||||
|
||||
/**
|
||||
* The profile file name, such as "CIEXYZ.pf", "sRGB.pf", etc.
|
||||
*/
|
||||
public final String filename;
|
||||
public int colorSpaceType, numComponents, profileClass;
|
||||
public String filename;
|
||||
|
||||
public ProfileDeferralInfo(String fn, int type, int ncomp, int pclass) {
|
||||
|
||||
super();
|
||||
filename = fn;
|
||||
colorSpaceType = type;
|
||||
numComponents = ncomp;
|
||||
profileClass = pclass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements the abstract read() method of InputStream.
|
||||
*/
|
||||
public int read() throws IOException {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.java2d.cmm;
|
||||
|
||||
import java.awt.color.ProfileDataException;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* A class to manage the deferral of CMM initialization of profile
|
||||
* data for internal ICC_Profile objects - i.e. when we "trust" that
|
||||
* the profile data is valid and we think it may not be needed. An
|
||||
* example is the sRGB profile which gets loaded by any program doing
|
||||
* graphics, but which may not be needed if the program does not need
|
||||
* high quality color conversion.
|
||||
*/
|
||||
public class ProfileDeferralMgr {
|
||||
|
||||
public static boolean deferring = true;
|
||||
private static Vector<ProfileActivator> aVector;
|
||||
|
||||
/**
|
||||
* Records a ProfileActivator object whose activate method will
|
||||
* be called if the CMM needs to be activated.
|
||||
*/
|
||||
public static void registerDeferral(ProfileActivator pa) {
|
||||
|
||||
if (!deferring) {
|
||||
return;
|
||||
}
|
||||
if (aVector == null) {
|
||||
aVector = new Vector<ProfileActivator>(3, 3);
|
||||
}
|
||||
aVector.addElement(pa);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a ProfileActivator object from the vector of ProfileActivator
|
||||
* objects whose activate method will be called if the CMM needs to be
|
||||
* activated.
|
||||
*/
|
||||
public static void unregisterDeferral(ProfileActivator pa) {
|
||||
|
||||
if (!deferring) {
|
||||
return;
|
||||
}
|
||||
if (aVector == null) {
|
||||
return;
|
||||
}
|
||||
aVector.removeElement(pa);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a ProfileActivator object from the vector of ProfileActivator
|
||||
* objects whose activate method will be called if the CMM needs to be
|
||||
* activated.
|
||||
*/
|
||||
public static void activateProfiles() {
|
||||
|
||||
int i, n;
|
||||
|
||||
deferring = false;
|
||||
if (aVector == null) {
|
||||
return;
|
||||
}
|
||||
n = aVector.size();
|
||||
for (ProfileActivator pa : aVector) {
|
||||
try {
|
||||
pa.activate();
|
||||
} catch (ProfileDataException e) {
|
||||
/*
|
||||
* Ignore profile activation error for now:
|
||||
* such exception is pssible due to absence
|
||||
* or corruption of standard color profile.
|
||||
* As for now we expect all profiles should
|
||||
* be shiped with jre and presence of this
|
||||
* exception is indication of some configuration
|
||||
* problem in jre installation.
|
||||
*
|
||||
* NB: we still are greedy loading deferred profiles
|
||||
* and load them all if any of them is needed.
|
||||
* Therefore broken profile (if any) might be never used.
|
||||
* If there will be attempt to use broken profile then
|
||||
* it will result in CMMException.
|
||||
*/
|
||||
}
|
||||
}
|
||||
aVector.removeAllElements();
|
||||
aVector = null;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -35,20 +35,20 @@
|
||||
|
||||
package sun.java2d.cmm.lcms;
|
||||
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.awt.color.CMMException;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
import sun.java2d.cmm.ColorTransform;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import sun.java2d.cmm.*;
|
||||
import sun.java2d.cmm.lcms.*;
|
||||
import static sun.java2d.cmm.lcms.LCMSImageLayout.ImageLayoutException;
|
||||
|
||||
|
||||
public class LCMSTransform implements ColorTransform {
|
||||
long ID;
|
||||
private int inFormatter = 0;
|
||||
@@ -66,6 +66,13 @@ public class LCMSTransform implements ColorTransform {
|
||||
|
||||
private Object disposerReferent = new Object();
|
||||
|
||||
/* the class initializer */
|
||||
static {
|
||||
if (ProfileDeferralMgr.deferring) {
|
||||
ProfileDeferralMgr.activateProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
public LCMSTransform(ICC_Profile profile, int renderType,
|
||||
int transformType)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -649,22 +649,9 @@ JNIEXPORT jobject JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileID
|
||||
if (pf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jclass pcls = (*env)->GetObjectClass(env, pf);
|
||||
if (pcls == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
jmethodID mid = (*env)->GetMethodID(env, pcls, "activate", "()V");
|
||||
if (mid == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
(*env)->CallVoidMethod(env, pf, mid);
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fid = (*env)->GetFieldID(env, pcls, "cmmProfile",
|
||||
"Lsun/java2d/cmm/Profile;");
|
||||
fid = (*env)->GetFieldID (env,
|
||||
(*env)->GetObjectClass(env, pf),
|
||||
"cmmProfile", "Lsun/java2d/cmm/Profile;");
|
||||
if (fid == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -781,12 +781,19 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some window managers configure before we are reparented and
|
||||
* the send event flag is set! ugh... (Enlighetenment for one,
|
||||
* possibly MWM as well). If we haven't been reparented yet
|
||||
* this is just the WM shuffling us into position. Ignore
|
||||
* it!!!! or we wind up in a bogus location.
|
||||
*/
|
||||
int runningWM = XWM.getWMID();
|
||||
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
|
||||
isReparented(), isVisible(), runningWM, getDecorations());
|
||||
}
|
||||
if (ENABLE_REPARENTING_CHECK && !isReparented() && isVisible() && runningWM != XWM.NO_WM
|
||||
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
|
||||
&& !XWM.isNonReparentingWM()
|
||||
&& getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
|
||||
insLog.fine("- visible but not reparented, skipping");
|
||||
|
||||
@@ -63,9 +63,6 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
private static final boolean X11_DISABLE_OVERRIDE_FLAG;
|
||||
private static final boolean X11_DISABLE_OVERRIDE_XWINDOWPEER;
|
||||
|
||||
static final boolean ENABLE_REPARENTING_CHECK
|
||||
= "true".equals(GetPropertyAction.privilegedGetProperty("reparenting.check"));
|
||||
|
||||
// should be synchronized on awtLock
|
||||
private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
|
||||
|
||||
@@ -760,8 +757,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
int runningWM = XWM.getWMID();
|
||||
Point newLocation = targetBounds.getLocation();
|
||||
if (xe.get_send_event() ||
|
||||
(ENABLE_REPARENTING_CHECK ? (runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) : !isReparented())) {
|
||||
if (xe.get_send_event() || runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) {
|
||||
// Location, Client size + insets
|
||||
newLocation = new Point(scaleDown(xe.get_x()) - leftInset,
|
||||
scaleDown(xe.get_y()) - topInset);
|
||||
@@ -1459,14 +1455,6 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
isUnhiding |= isWMStateNetHidden();
|
||||
|
||||
super.handleMapNotifyEvent(xev);
|
||||
|
||||
if (!ENABLE_REPARENTING_CHECK && delayedModalBlocking) {
|
||||
// case of non-re-parenting WM
|
||||
// (for a re-parenting WM this should have been already done on ReparentNotify processing)
|
||||
addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
|
||||
delayedModalBlocking = false;
|
||||
}
|
||||
|
||||
if (isBeforeFirstMapNotify && !winAttr.initialFocus && shouldSuppressWmTakeFocus()) {
|
||||
suppressWmTakeFocus(false); // restore the protocol.
|
||||
if (!XWM.isKDE2()) {
|
||||
@@ -1686,7 +1674,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
modalBlocker = d;
|
||||
|
||||
if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
|
||||
if (isReparented() || XWM.isNonReparentingWM()) {
|
||||
addToTransientFors(blockerPeer, javaToplevels);
|
||||
} else {
|
||||
delayedModalBlocking = true;
|
||||
@@ -1697,7 +1685,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
modalBlocker = null;
|
||||
|
||||
if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
|
||||
if (isReparented() || XWM.isNonReparentingWM()) {
|
||||
removeFromTransientFors();
|
||||
} else {
|
||||
delayedModalBlocking = false;
|
||||
|
||||
@@ -698,10 +698,8 @@ int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, u
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GLX_OML_sync_control extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/* JDK modification */
|
||||
#elif defined(__sun__)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__digital__)
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
|
||||
@@ -106,8 +106,8 @@ Java_sun_awt_windows_WMouseInfoPeer_fillPointWithCoords(JNIEnv *env, jclass cls,
|
||||
yID = env->GetFieldID(pointClass, "y", "I");
|
||||
CHECK_NULL_RETURN(yID, (jint)0);
|
||||
|
||||
pt.x = (device == NULL) ? pt.x : device->ScaleDownAbsX(pt.x);
|
||||
pt.y = (device == NULL) ? pt.y : device->ScaleDownAbsY(pt.y);
|
||||
int x = (device == NULL) ? pt.x : device->ScaleDownAbsX(pt.x);
|
||||
int y = (device == NULL) ? pt.y : device->ScaleDownAbsY(pt.y);
|
||||
|
||||
env->SetIntField(point, xID, pt.x);
|
||||
env->SetIntField(point, yID, pt.y);
|
||||
|
||||
@@ -263,6 +263,8 @@ void AwtDragSource::_DoDragDrop(void* param) {
|
||||
AwtDropTarget::SetCurrentDnDDataObject(dragSource);
|
||||
|
||||
::GetCursorPos(&dragSource->m_dragPoint);
|
||||
POINT dragPoint = {dragSource->m_dragPoint.x, dragSource->m_dragPoint.y};
|
||||
AwtWin32GraphicsDevice::ScaleDownDPoint(&dragPoint);
|
||||
|
||||
dragSource->Signal();
|
||||
|
||||
@@ -282,7 +284,7 @@ void AwtDragSource::_DoDragDrop(void* param) {
|
||||
|
||||
call_dSCddfinished(env, peer, res == DRAGDROP_S_DROP && effects != DROPEFFECT_NONE,
|
||||
convertDROPEFFECTToActions(effects),
|
||||
dragSource->m_dragPoint);
|
||||
dragPoint);
|
||||
|
||||
env->DeleteLocalRef(peer);
|
||||
|
||||
@@ -642,11 +644,13 @@ HRESULT __stdcall AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWOR
|
||||
POINT dragPoint;
|
||||
|
||||
::GetCursorPos(&dragPoint);
|
||||
POINT _dragPoint = {dragPoint.x, dragPoint.y};
|
||||
AwtWin32GraphicsDevice::ScaleDownDPoint(&_dragPoint);
|
||||
|
||||
if ( (dragPoint.x != m_dragPoint.x || dragPoint.y != m_dragPoint.y) &&
|
||||
m_lastmods == modifiers) {//cannot move before cursor change
|
||||
call_dSCmouseMoved(env, m_peer,
|
||||
m_actions, modifiers, dragPoint);
|
||||
m_actions, modifiers, _dragPoint);
|
||||
JNU_CHECK_EXCEPTION_RETURN(env, E_UNEXPECTED);
|
||||
m_dragPoint = dragPoint;
|
||||
}
|
||||
@@ -659,7 +663,7 @@ HRESULT __stdcall AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWOR
|
||||
return DRAGDROP_S_CANCEL;
|
||||
} else if (m_lastmods != modifiers) {
|
||||
call_dSCchanged(env, m_peer,
|
||||
m_actions, modifiers, dragPoint);
|
||||
m_actions, modifiers, _dragPoint);
|
||||
m_bRestoreNodropCustomCursor = TRUE;
|
||||
}
|
||||
|
||||
@@ -714,6 +718,8 @@ HRESULT __stdcall AwtDragSource::GiveFeedback(DWORD dwEffect) {
|
||||
POINT curs;
|
||||
|
||||
::GetCursorPos(&curs);
|
||||
POINT _curs = {curs.x, curs.y};
|
||||
AwtWin32GraphicsDevice::ScaleDownDPoint(&_curs);
|
||||
|
||||
m_droptarget = ::WindowFromPoint(curs);
|
||||
|
||||
@@ -722,13 +728,13 @@ HRESULT __stdcall AwtDragSource::GiveFeedback(DWORD dwEffect) {
|
||||
if (invalid) {
|
||||
// Don't call dragExit if dragEnter and dragOver haven't been called.
|
||||
if (!m_enterpending) {
|
||||
call_dSCexit(env, m_peer, curs);
|
||||
call_dSCexit(env, m_peer, _curs);
|
||||
}
|
||||
m_droptarget = (HWND)NULL;
|
||||
m_enterpending = TRUE;
|
||||
} else if (m_droptarget != NULL) {
|
||||
(*(m_enterpending ? call_dSCenter : call_dSCmotion))
|
||||
(env, m_peer, m_actions, modifiers, curs);
|
||||
(env, m_peer, m_actions, modifiers, _curs);
|
||||
|
||||
m_enterpending = FALSE;
|
||||
}
|
||||
|
||||
@@ -49,14 +49,13 @@ public interface CustomWindowDecoration {
|
||||
setCustomDecorationHitTestSpots,
|
||||
setCustomDecorationTitleBarHeight;
|
||||
private final Field peer;
|
||||
private final Class<?> wpeer;
|
||||
|
||||
__Fallback() throws Exception {
|
||||
hasCustomDecoration = Window.class.getDeclaredMethod("hasCustomDecoration");
|
||||
hasCustomDecoration.setAccessible(true);
|
||||
setHasCustomDecoration = Window.class.getDeclaredMethod("setHasCustomDecoration");
|
||||
setHasCustomDecoration.setAccessible(true);
|
||||
wpeer = Class.forName("sun.awt.windows.WWindowPeer");
|
||||
Class<?> wpeer = Class.forName("sun.awt.windows.WWindowPeer");
|
||||
setCustomDecorationHitTestSpots = wpeer.getDeclaredMethod("setCustomDecorationHitTestSpots", List.class);
|
||||
setCustomDecorationHitTestSpots.setAccessible(true);
|
||||
setCustomDecorationTitleBarHeight = wpeer.getDeclaredMethod("setCustomDecorationTitleBarHeight", int.class);
|
||||
@@ -90,10 +89,10 @@ public interface CustomWindowDecoration {
|
||||
public void setCustomDecorationHitTestSpots(Window window, List<Map.Entry<Shape, Integer>> spots) {
|
||||
List<Rectangle> hitTestSpots = spots.stream().map(e -> e.getKey().getBounds()).collect(Collectors.toList());
|
||||
try {
|
||||
setCustomDecorationHitTestSpots.invoke(wpeer.cast(peer.get(window)), hitTestSpots);
|
||||
setCustomDecorationHitTestSpots.invoke(peer.get(window), hitTestSpots);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch(ClassCastException | NullPointerException ignore) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,10 +103,10 @@ public interface CustomWindowDecoration {
|
||||
@Override
|
||||
public void setCustomDecorationTitleBarHeight(Window window, int height) {
|
||||
try {
|
||||
setCustomDecorationTitleBarHeight.invoke(wpeer.cast(peer.get(window)), height);
|
||||
setCustomDecorationTitleBarHeight.invoke(peer.get(window), height);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch(ClassCastException | NullPointerException ignore) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# 2. When only new API is added, or some existing API was @Deprecated - increment MINOR, reset PATCH to 0
|
||||
# 3. For major backwards incompatible API changes - increment MAJOR, reset MINOR and PATCH to 0
|
||||
|
||||
VERSION = 1.1.2
|
||||
VERSION = 1.1.1
|
||||
|
||||
# Hash is used to track changes to jetbrains.api, so you would not forget to update version when needed.
|
||||
# When you make any changes, "make jbr-api" will fail and ask you to update hash and version number here.
|
||||
|
||||
HASH = C6871CD21E54119BBB76A1E8D3BD1BBA
|
||||
HASH = 4BA3972B5BA25FEF7DAE5E4A922AC2
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.awt.color.ICC_ProfileRGB;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6986863
|
||||
* @summary Verifies MT safety of ICC_ProfileRGB#getMatrix method
|
||||
*/
|
||||
public final class MTMatrixAccess {
|
||||
|
||||
private static volatile boolean failed;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test((ICC_ProfileRGB) ICC_Profile.getInstance(ColorSpace.CS_sRGB));
|
||||
test((ICC_ProfileRGB) ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB));
|
||||
}
|
||||
|
||||
private static void test(ICC_ProfileRGB rgb) throws InterruptedException {
|
||||
Thread[] threads = new Thread[100];
|
||||
CountDownLatch go = new CountDownLatch(1);
|
||||
for (int i = 0; i < threads.length; i++) {
|
||||
threads[i] = new Thread(() -> {
|
||||
try {
|
||||
go.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
rgb.getMatrix();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
failed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Thread thread : threads) {
|
||||
thread.start();
|
||||
}
|
||||
go.countDown();
|
||||
for (Thread thread : threads) {
|
||||
thread.join();
|
||||
}
|
||||
if (failed) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6986863
|
||||
* @summary Verifies MT safety of profile activation while a profile is accessed
|
||||
*/
|
||||
public final class ProfileActivationDuringPropertyAccess {
|
||||
|
||||
private static volatile boolean failed;
|
||||
private static volatile boolean end;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(ICC_Profile.getInstance(ColorSpace.CS_sRGB));
|
||||
test(ICC_Profile.getInstance(ColorSpace.CS_GRAY));
|
||||
test(ICC_Profile.getInstance(ColorSpace.CS_CIEXYZ));
|
||||
test(ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB));
|
||||
test(ICC_Profile.getInstance(ColorSpace.CS_PYCC));
|
||||
}
|
||||
|
||||
private static void test(ICC_Profile profile) throws Exception {
|
||||
Thread[] ts = new Thread[100];
|
||||
CountDownLatch latch = new CountDownLatch(ts.length);
|
||||
for (int i = 0; i < ts.length; i++) {
|
||||
ts[i] = new Thread(() -> {
|
||||
latch.countDown();
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
try {
|
||||
while (!end) {
|
||||
profile.getColorSpaceType(); // try use deferred info
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
failed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Thread t : ts) {
|
||||
t.start();
|
||||
}
|
||||
Thread.sleep(1500);
|
||||
profile.getPCSType(); // activate profile
|
||||
end = true;
|
||||
for (Thread t : ts) {
|
||||
t.join();
|
||||
}
|
||||
if (failed) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, JetBrains s.r.o.. All rights reserved.
|
||||
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -66,17 +66,14 @@ public class Move {
|
||||
}
|
||||
}
|
||||
|
||||
static void assertHasEvent(final List<WatchEvent<?>> events, final Path path, final WatchEvent.Kind<Path> kind) {
|
||||
for (final WatchEvent<?> event : events) {
|
||||
if (event.context().equals(path) && event.kind().equals(kind)) {
|
||||
if (event.count() != 1) {
|
||||
throw new RuntimeException("Expected count 1 for event " + event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
static void assertHasEvent(final Iterator<WatchEvent<?>> eventIterator, final Path path, final WatchEvent.Kind<Path> kind) {
|
||||
final WatchEvent<?> event = eventIterator.next();
|
||||
if (!event.context().equals(path) || !event.kind().equals(kind)) {
|
||||
throw new RuntimeException("Didn't find event " + kind + " for path '" + path + "'");
|
||||
}
|
||||
if (event.count() != 1) {
|
||||
throw new RuntimeException("Expected count 1 for event " + event);
|
||||
}
|
||||
|
||||
throw new RuntimeException("Didn't find event " + kind + " for path '" + path + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,13 +125,14 @@ public class Move {
|
||||
final List<WatchEvent<?>> events = subtreeKey.pollEvents();
|
||||
dumpEvents(events);
|
||||
|
||||
assertHasEvent(events, Path.of("subdir").resolve("1").resolve("2").resolve("3").resolve("file3"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("1").resolve("2").resolve("3"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("1").resolve("2"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved"), ENTRY_CREATE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved").resolve("3"), ENTRY_CREATE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved").resolve("3").resolve("file3"), ENTRY_CREATE);
|
||||
if (events.size() > 6) {
|
||||
final Iterator<WatchEvent<?>> eventsIterator = events.iterator();
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("1").resolve("2").resolve("3").resolve("file3"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("1").resolve("2").resolve("3"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("1").resolve("2"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved"), ENTRY_CREATE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved").resolve("3"), ENTRY_CREATE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved").resolve("3").resolve("file3"), ENTRY_CREATE);
|
||||
if (eventsIterator.hasNext()) {
|
||||
throw new RuntimeException("Too many events");
|
||||
}
|
||||
}
|
||||
@@ -150,8 +148,9 @@ public class Move {
|
||||
takeExpectedKey(rootWatcher, rootKey);
|
||||
final List<WatchEvent<?>> events = rootKey.pollEvents();
|
||||
dumpEvents(events);
|
||||
assertHasEvent(events, Path.of("2"), ENTRY_CREATE);
|
||||
if (events.size() > 1) {
|
||||
final Iterator<WatchEvent<?>> eventsIterator = events.iterator();
|
||||
assertHasEvent(eventsIterator, Path.of("2"), ENTRY_CREATE);
|
||||
if (eventsIterator.hasNext()) {
|
||||
throw new RuntimeException("Too many events");
|
||||
}
|
||||
}
|
||||
@@ -162,13 +161,14 @@ public class Move {
|
||||
final List<WatchEvent<?>> events = subtreeKey.pollEvents();
|
||||
dumpEvents(events);
|
||||
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved").resolve("3").resolve("file3"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved").resolve("3"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("subdir").resolve("2.moved"), ENTRY_DELETE);
|
||||
assertHasEvent(events, Path.of("2"), ENTRY_CREATE);
|
||||
assertHasEvent(events, Path.of("2").resolve("3"), ENTRY_CREATE);
|
||||
assertHasEvent(events, Path.of("2").resolve("3").resolve("file3"), ENTRY_CREATE);
|
||||
if (events.size() > 6) {
|
||||
final Iterator<WatchEvent<?>> eventsIterator = events.iterator();
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved").resolve("3").resolve("file3"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved").resolve("3"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("subdir").resolve("2.moved"), ENTRY_DELETE);
|
||||
assertHasEvent(eventsIterator, Path.of("2"), ENTRY_CREATE);
|
||||
assertHasEvent(eventsIterator, Path.of("2").resolve("3"), ENTRY_CREATE);
|
||||
assertHasEvent(eventsIterator, Path.of("2").resolve("3").resolve("file3"), ENTRY_CREATE);
|
||||
if (eventsIterator.hasNext()) {
|
||||
throw new RuntimeException("Too many events");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.awt.event.KeyEvent;
|
||||
/*
|
||||
@test
|
||||
@key headful
|
||||
@bug 8031485 8058193
|
||||
@bug 8031485 8058193 8067986
|
||||
@summary Combo box consuming escape and enter key events
|
||||
@author Petr Pchelko
|
||||
@library ../../../../lib/testlibrary/
|
||||
@@ -36,8 +36,9 @@ import java.awt.event.KeyEvent;
|
||||
@run main ConsumedKeyTest
|
||||
*/
|
||||
public class ConsumedKeyTest {
|
||||
private static volatile JFrame frame;
|
||||
private static JFrame frame;
|
||||
private static volatile boolean passed;
|
||||
static ExtendedRobot robot;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
test(KeyEvent.VK_ESCAPE);
|
||||
@@ -46,6 +47,7 @@ public class ConsumedKeyTest {
|
||||
|
||||
private static void test(final int key) throws Exception {
|
||||
passed = false;
|
||||
robot = new ExtendedRobot();
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
frame = new JFrame();
|
||||
@@ -57,10 +59,11 @@ public class ConsumedKeyTest {
|
||||
addAction(panel, key);
|
||||
frame.add(panel);
|
||||
frame.setVisible(true);
|
||||
frame.setAlwaysOnTop(true);
|
||||
});
|
||||
|
||||
ExtendedRobot robot = new ExtendedRobot();
|
||||
robot.waitForIdle();
|
||||
robot.delay(500);
|
||||
robot.type(key);
|
||||
robot.waitForIdle();
|
||||
if (!passed) {
|
||||
@@ -71,7 +74,7 @@ public class ConsumedKeyTest {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
robot.delay(1000);
|
||||
}
|
||||
|
||||
private static void addAction(JComponent comp, final int key) {
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-4281 Window losing focus isn't detected in some cases on macOS
|
||||
* @key headful
|
||||
* @requires (os.family == "mac")
|
||||
*/
|
||||
|
||||
public class MacSpecialFocusLostCase {
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(MacSpecialFocusLostCase::initUI);
|
||||
checkFocusedStatus(true);
|
||||
pressCmdSpace(); // open Spotlight popup
|
||||
checkFocusedStatus(false);
|
||||
pressEsc(); // close Spotlight popup
|
||||
checkFocusedStatus(true);
|
||||
} finally {
|
||||
pressEsc(); // make sure popup is closed in any case
|
||||
SwingUtilities.invokeAndWait(MacSpecialFocusLostCase::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("MacSpecialFocusLostCase");
|
||||
frame.setBounds(200, 200, 300, 200);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void checkFocusedStatus(boolean expected) throws Exception {
|
||||
robot.delay(1000);
|
||||
boolean[] result = new boolean[1];
|
||||
SwingUtilities.invokeAndWait(() -> result[0] = frame.isFocused());
|
||||
if (result[0] != expected) {
|
||||
throw new RuntimeException(expected ? "Frame isn't focused" : "Frame is still focused");
|
||||
}
|
||||
}
|
||||
|
||||
private static void pressCmdSpace() {
|
||||
robot.keyPress(KeyEvent.VK_META);
|
||||
robot.keyPress(KeyEvent.VK_SPACE);
|
||||
robot.keyRelease(KeyEvent.VK_SPACE);
|
||||
robot.keyRelease(KeyEvent.VK_META);
|
||||
}
|
||||
|
||||
private static void pressEsc() {
|
||||
robot.keyPress(KeyEvent.VK_ESCAPE);
|
||||
robot.keyRelease(KeyEvent.VK_ESCAPE);
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2022 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
@test
|
||||
@key headful
|
||||
@summary a regression test for JBR-4303.
|
||||
@run main GetPointerInfoTest
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* The test checks <code>MouseInfo.getPointerInfo()</code> for all locations with the steps <code>X_STEP</code> and
|
||||
* <code>Y_STEP</code> on all graphic devices.
|
||||
* It moves mouse to the current location via <code>Robot.mouseMove()</code> and checks that
|
||||
* <code>MouseInfo.getPointerInfo()</code> is not NULL.
|
||||
* It also checks <code>MouseInfo.getPointerInfo().getLocation()</code> returns expected values.
|
||||
*/
|
||||
public class GetPointerInfoTest {
|
||||
|
||||
public static int X_STEP = 100;
|
||||
public static int Y_STEP = 100;
|
||||
|
||||
static boolean isPassed = true;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice[] graphicsDevices = ge.getScreenDevices();
|
||||
|
||||
for (GraphicsDevice gd : graphicsDevices) {
|
||||
String name = gd.getIDstring();
|
||||
int width = gd.getDisplayMode().getWidth();
|
||||
int height = gd.getDisplayMode().getHeight();
|
||||
System.out.println("Check for device: " + name + " " + width + "x" + height);
|
||||
|
||||
Robot robot = new Robot(gd);
|
||||
|
||||
robot.setAutoDelay(0);
|
||||
robot.setAutoWaitForIdle(true);
|
||||
robot.delay(10);
|
||||
robot.waitForIdle();
|
||||
|
||||
GraphicsConfiguration gc = gd.getDefaultConfiguration();
|
||||
|
||||
Rectangle bounds = gc.getBounds();
|
||||
|
||||
for (double y = bounds.getY(); y < bounds.getY() + bounds.getHeight(); y += Y_STEP) {
|
||||
|
||||
for (double x = bounds.getX(); x < bounds.getX() + bounds.getWidth(); x += X_STEP) {
|
||||
|
||||
Point p = new Point((int)x, (int)y);
|
||||
|
||||
System.out.println("\tmouse move to x=" + p.x + " y=" + p.y);
|
||||
robot.mouseMove(p.x, p.y);
|
||||
|
||||
System.out.print("\t\tMouseInfo.getPointerInfo.getLocation");
|
||||
PointerInfo pi = MouseInfo.getPointerInfo();
|
||||
if (pi == null) {
|
||||
throw new RuntimeException("Test failed. getPointerInfo() returned null value.");
|
||||
}
|
||||
|
||||
Point piLocation = pi.getLocation();
|
||||
if (piLocation.x != p.x || piLocation.y != p.y) {
|
||||
System.out.println(" - ***FAILED*** x=" + piLocation.x + " y=" + piLocation.y);
|
||||
isPassed = false;
|
||||
} else {
|
||||
System.out.println(" x=" + p.x + ", y=" + p.y + " - passed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !isPassed )
|
||||
throw new RuntimeException("PointerInfo.getLocation() returns unexpected value(s).");
|
||||
|
||||
System.out.println("Test PASSED.");
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,6 @@ java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,windows-all,linux-all
|
||||
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all,windows-all
|
||||
java/awt/Choice/GrabLockTest/GrabLockTest.java JRE-839 windows-all,macosx-all,linux-all
|
||||
java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java 8194045б generic-all
|
||||
java/awt/Choice/PopupPosTest/PopupPosTest.java 8192930 windows-all
|
||||
java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java 8047703 generic-all
|
||||
java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.html 8014503,8192929 windows-all,macosx-all,linux-all
|
||||
@@ -232,7 +231,6 @@ java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java
|
||||
java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java 8169461 windows-all
|
||||
java/awt/List/KeyEventsTest/KeyEventsTest.java 8047703 windows-all
|
||||
java/awt/List/SingleModeDeselect/SingleModeDeselect.java 8196367 windows-all
|
||||
java/awt/MenuBar/8007006/bug8007006.java 8202886 macosx-all
|
||||
java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all,windows-all,linux-all
|
||||
java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java 8158801 windows-all,macosx-all,linux-all
|
||||
java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java 8158801 windows-all,macosx-all,linux-all
|
||||
|
||||
Reference in New Issue
Block a user