mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-12 03:21:43 +01:00
Compare commits
7 Commits
mono/2.221
...
1216
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6682ead971 | ||
|
|
126eb156ea | ||
|
|
4e28354e07 | ||
|
|
a68a8e6683 | ||
|
|
973d13aa4f | ||
|
|
e8af4988bb | ||
|
|
47fcc05269 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,4 +24,3 @@ test/nashorn/lib
|
||||
NashornProfile.txt
|
||||
**/JTreport/**
|
||||
**/JTwork/**
|
||||
/jb/project/java-gradle/.idea/workspace.xml
|
||||
|
||||
29
README.md
29
README.md
@@ -13,7 +13,7 @@
|
||||
[github.com/JetBrains/JetBrainsRuntime](https://github.com/JetBrains/JetBrainsRuntime)
|
||||
|
||||
## Getting sources
|
||||
__macOS, Linux:__
|
||||
__OSX, Linux:__
|
||||
```
|
||||
git config --global core.autocrlf input
|
||||
git clone git@github.com:JetBrains/JetBrainsRuntime.git
|
||||
@@ -25,12 +25,12 @@ git config --global core.autocrlf false
|
||||
git clone git@github.com:JetBrains/JetBrainsRuntime.git
|
||||
```
|
||||
|
||||
# Configure local build environment
|
||||
# Configure Local Build Environment
|
||||
[OpenJDK build docs](http://hg.openjdk.java.net/jdk/jdk11/raw-file/tip/doc/building.html)
|
||||
Tip for all platforms: run `./configure` and check output.
|
||||
Tip for all platforms: run ./configure and check output.
|
||||
Usually, it has meaningful advice how to solve your problem.
|
||||
|
||||
## Linux (Docker)
|
||||
## Linux (docker)
|
||||
```
|
||||
$ cd jb/project/docker
|
||||
$ docker build .
|
||||
@@ -42,6 +42,7 @@ $ docker run -v `pwd`../../../../:/JetBrainsRuntime -it 942ea9900054
|
||||
# cd /JetBrainsRuntime
|
||||
# sh ./configure
|
||||
# make images CONF=linux-x86_64-normal-server-release
|
||||
|
||||
```
|
||||
|
||||
## Linux (Ubuntu 18.10 desktop)
|
||||
@@ -55,33 +56,35 @@ $ make images
|
||||
|
||||
## Windows
|
||||
Install:
|
||||
|
||||
* [Cygwin x64](http://www.cygwin.com/)
|
||||
Required packages: autoconf, binutils, cpio, diffutils, file, gawk, gcc-core, make, m4, unzip, zip.
|
||||
**Install them while installing Cygwin**.
|
||||
**Install them while installing cygwin**.
|
||||
* Visual Studio compiler toolset [Download](https://visualstudio.microsoft.com/downloads/)
|
||||
Visual Studio 2015 has support by default.
|
||||
**Install with desktop development kit, it includes Windows SDK and compilers**.
|
||||
* [Java 11](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
|
||||
If you have problems while configuring [read Java tips on Cygwin](http://horstmann.com/articles/cygwin-tips.html)
|
||||
If you have problems while configuring [read java tips on cygwin](http://horstmann.com/articles/cygwin-tips.html)
|
||||
|
||||
From command line:
|
||||
From command line
|
||||
```
|
||||
"c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
"c:\Program_Files\cygwin64\bin\mintty.exe" /bin/bash -l
|
||||
```
|
||||
First command will set env vars, the second will run Cygwin shell with proper environment.
|
||||
|
||||
In Cygwin shell:
|
||||
First command will set env vars, the second will run cygwin shell with proper environment.
|
||||
In cygwin shell
|
||||
```
|
||||
cd JetBrainsRuntime
|
||||
bash configure --enable-option-checking=fatal --with-toolchain-version=2015 --with-boot-jdk="/cygdrive/c/Program Files/Java/jdk-11.0.5" --disable-warnings-as-errors
|
||||
make images
|
||||
```
|
||||
|
||||
## macOS
|
||||
Install Xcode command line developer tools, autoconf (via Homebrew).
|
||||
## OSX
|
||||
|
||||
install Xcode console tools, autoconf (via homebrew)
|
||||
|
||||
run
|
||||
|
||||
Run:
|
||||
```
|
||||
sh ./configure --prefix=$(pwd)/build --disable-warnings-as-errors
|
||||
make images
|
||||
|
||||
@@ -32,7 +32,6 @@ sh configure \
|
||||
--with-debug-level=release \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
|
||||
@@ -120,7 +120,6 @@ sh configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
|
||||
@@ -32,7 +32,6 @@ linux32 bash configure \
|
||||
--with-debug-level=release \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
|
||||
@@ -39,18 +39,6 @@ architecture=${architecture:=x64}
|
||||
|
||||
source jb/project/tools/common.sh
|
||||
|
||||
function copyJNF {
|
||||
__contents_dir=$1
|
||||
# we can't notarize this library as usual framework (with headers and tbd-file)
|
||||
# but single library notarizes correctly
|
||||
mkdir -p ${__contents_dir}/Frameworks/JavaNativeFoundation.framework/Resources
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation \
|
||||
${__contents_dir}/Frameworks/JavaNativeFoundation.framework || do_exit $?
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/Resources/Info.plist \
|
||||
${__contents_dir}/Frameworks/JavaNativeFoundation.framework/Resources || do_exit $?
|
||||
# unsign JavaNativeFoundation binary (otherwise notarization will fail)
|
||||
codesign --remove-signature ${__contents_dir}/Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation || do_exit $?
|
||||
}
|
||||
function create_jbr {
|
||||
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
@@ -98,7 +86,13 @@ function create_jbr {
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
# we can't notarize this library as usual framework (with headers and tbd-file)
|
||||
# but single library notarizes correctly
|
||||
copyJNF ${JRE_CONTENTS}
|
||||
mkdir -p ${JRE_CONTENTS}/Frameworks/JavaNativeFoundation.framework/Resources
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation \
|
||||
${JRE_CONTENTS}/Frameworks/JavaNativeFoundation.framework || do_exit $?
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/Resources/Info.plist \
|
||||
${JRE_CONTENTS}/Frameworks/JavaNativeFoundation.framework/Resources || do_exit $?
|
||||
# unsign JavaNativeFoundation binary (otherwise notarization will fail)
|
||||
codesign --remove-signature ${JRE_CONTENTS}/Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation || do_exit $?
|
||||
fi
|
||||
if [[ "${bundle_type}" == *jcef* ]] || [[ "${bundle_type}" == *dcevm* ]] || [[ "${bundle_type}" == fd ]]; then
|
||||
cp -a ${JCEF_PATH}/Frameworks ${JRE_CONTENTS} || do_exit $?
|
||||
@@ -169,7 +163,6 @@ if [[ "${architecture}" == *aarch64* ]]; then
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
@@ -211,14 +204,11 @@ if [[ "${bundle_type}" == *jcef* ]] || [[ "${bundle_type}" == *dcevm* ]] || [[ "
|
||||
fi
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
copyJNF $BASE_DIR/$JBRSDK_BUNDLE/Contents
|
||||
fi
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release
|
||||
[ -f "${JBSDK}.tar.gz" ] && rm "${JBSDK}.tar.gz"
|
||||
COPYFILE_DISABLE=1 tar -pczf ${JBSDK}.tar.gz -C ${BASE_DIR} \
|
||||
--exclude='.DS_Store' --exclude='*~' \
|
||||
--exclude='._*' --exclude='.DS_Store' --exclude='*~' \
|
||||
--exclude='Home/demo' --exclude='Home/man' --exclude='Home/sample' \
|
||||
${JBRSDK_BUNDLE} || do_exit $?
|
||||
fi
|
||||
|
||||
@@ -125,7 +125,7 @@ log "Zipping $BUILD_NAME to $INPUT_FILE ..."
|
||||
mv $BACKUP_JMODS/jmods $EXPLODED/$BUILD_NAME/Contents/Home
|
||||
fi
|
||||
|
||||
tar -pczvf $INPUT_FILE --exclude='*.dSYM' --exclude='man' -C $EXPLODED $BUILD_NAME
|
||||
COPYFILE_DISABLE=1 tar -pczf $INPUT_FILE --exclude='*.dSYM' --exclude='man' -C $EXPLODED $BUILD_NAME
|
||||
log "Finished zipping"
|
||||
)
|
||||
rm -rf "$EXPLODED"
|
||||
|
||||
@@ -114,7 +114,6 @@ sh ./configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
|
||||
@@ -35,7 +35,6 @@ PATH="/usr/local/bin:/usr/bin:${PATH}"
|
||||
--with-target-bits=32 \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Red Hat Inc. 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
|
||||
@@ -63,9 +63,9 @@ int compare_immediate_pair(const void *i1, const void *i2)
|
||||
// helper functions used by expandLogicalImmediate
|
||||
|
||||
// for i = 1, ... N result<i-1> = 1 other bits are zero
|
||||
static inline u_int64_t ones(int N)
|
||||
static inline uint64_t ones(int N)
|
||||
{
|
||||
return (N == 64 ? (u_int64_t)-1UL : ((1UL << N) - 1));
|
||||
return (N == 64 ? -1ULL : (1ULL << N) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HWCAP_AES
|
||||
#define HWCAP_AES (1<<3)
|
||||
#endif
|
||||
@@ -57,17 +55,13 @@
|
||||
#define HWCAP_ATOMICS (1<<8)
|
||||
#endif
|
||||
|
||||
#ifndef HWCAP2_SVE2
|
||||
#define HWCAP2_SVE2 (1 << 1)
|
||||
#endif
|
||||
|
||||
int VM_Version::get_current_sve_vector_length() {
|
||||
assert(_features & CPU_SVE); // "should not call this"
|
||||
assert(_features & CPU_SVE, "should not call this");
|
||||
return prctl(PR_SVE_GET_VL);
|
||||
}
|
||||
|
||||
int VM_Version::set_and_get_current_sve_vector_lenght(int length) {
|
||||
assert(_features & CPU_SVE); // "should not call this"
|
||||
assert(_features & CPU_SVE, "should not call this");
|
||||
int new_length = prctl(PR_SVE_SET_VL, length);
|
||||
return new_length;
|
||||
}
|
||||
@@ -77,6 +71,18 @@ void VM_Version::get_os_cpu_info() {
|
||||
uint64_t auxv = getauxval(AT_HWCAP);
|
||||
uint64_t auxv2 = getauxval(AT_HWCAP2);
|
||||
|
||||
static_assert(CPU_FP == HWCAP_FP);
|
||||
static_assert(CPU_ASIMD == HWCAP_ASIMD);
|
||||
static_assert(CPU_EVTSTRM == HWCAP_EVTSTRM);
|
||||
static_assert(CPU_AES == HWCAP_AES);
|
||||
static_assert(CPU_PMULL == HWCAP_PMULL);
|
||||
static_assert(CPU_SHA1 == HWCAP_SHA1);
|
||||
static_assert(CPU_SHA2 == HWCAP_SHA2);
|
||||
static_assert(CPU_CRC32 == HWCAP_CRC32);
|
||||
static_assert(CPU_LSE == HWCAP_ATOMICS);
|
||||
static_assert(CPU_DCPOP == HWCAP_DCPOP);
|
||||
static_assert(CPU_SHA512 == HWCAP_SHA512);
|
||||
static_assert(CPU_SVE == HWCAP_SVE);
|
||||
_features = auxv & (
|
||||
HWCAP_FP |
|
||||
HWCAP_ASIMD |
|
||||
|
||||
@@ -654,12 +654,14 @@ class CAccessibility implements PropertyChangeListener {
|
||||
public static Object[] getChildrenAndRolesRecursive(final Accessible a, final Component c, final int whichChildren, final boolean allowIgnored, final int level) {
|
||||
if (a == null) return null;
|
||||
ArrayList<Object> currentLevelChildren = new ArrayList<Object>();
|
||||
currentLevelChildren.addAll(Arrays.asList(getChildrenAndRoles(a, c, JAVA_AX_ALL_CHILDREN, allowIgnored)));
|
||||
currentLevelChildren.addAll(Arrays.asList(getChildrenAndRoles(a, c, whichChildren, allowIgnored)));
|
||||
boolean isEmpty = currentLevelChildren.isEmpty();
|
||||
if (isEmpty && (whichChildren == JAVA_AX_SELECTED_CHILDREN)) {
|
||||
currentLevelChildren.addAll(Arrays.asList(getChildrenAndRoles(a, c, JAVA_AX_ALL_CHILDREN, allowIgnored)));
|
||||
}
|
||||
ArrayList<Object> allChildren = new ArrayList<Object>();
|
||||
for (int i = 0; i < currentLevelChildren.size(); i += 2) {
|
||||
if ((((Accessible) currentLevelChildren.get(i)).getAccessibleContext().getAccessibleStateSet().contains(AccessibleState.SELECTED) && (whichChildren == JAVA_AX_SELECTED_CHILDREN)) ||
|
||||
(((Accessible) currentLevelChildren.get(i)).getAccessibleContext().getAccessibleStateSet().contains(AccessibleState.VISIBLE) && (whichChildren == JAVA_AX_VISIBLE_CHILDREN)) ||
|
||||
(whichChildren == JAVA_AX_ALL_CHILDREN)) {
|
||||
if (!isEmpty) {
|
||||
allChildren.add(currentLevelChildren.get(i));
|
||||
allChildren.add(currentLevelChildren.get(i + 1));
|
||||
allChildren.add(String.valueOf(level));
|
||||
|
||||
@@ -300,10 +300,14 @@ final class CPlatformResponder {
|
||||
characterToGetKeyCode = checkedChar;
|
||||
}
|
||||
|
||||
char testCharIgnoringModifiers = nsEvent.getCharactersIgnoringModifiers() != null && nsEvent.getCharactersIgnoringModifiers().length() > 0 ?
|
||||
nsEvent.getCharactersIgnoringModifiers().charAt(0) : KeyEvent.CHAR_UNDEFINED;
|
||||
|
||||
|
||||
// We use char candidate if modifiers are not used
|
||||
// otherwise, we use char ignoring modifiers
|
||||
int[] in = new int[] {
|
||||
characterToGetKeyCode,
|
||||
testCharIgnoringModifiers,
|
||||
nsEvent.isHasDeadKey() ? 1 : 0,
|
||||
nsEvent.getModifierFlags(),
|
||||
nsEvent.getKeyCode(),
|
||||
|
||||
@@ -371,32 +371,17 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
if (owner != null) {
|
||||
hasOwnerPtr = 0L != owner.executeGet(ownerPtr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: owner=" + Long.toHexString(ownerPtr)
|
||||
+ ", styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
if (!hasOwnerPtr) {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeCreateNSWindow: styleBits=" + Integer.toHexString(styleBits)
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = nativeCreateNSWindow(viewPtr, 0, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
ref.set(windowPtr);
|
||||
ref.set(nativeCreateNSWindow(viewPtr, 0,
|
||||
styleBits, bounds.x, bounds.y,
|
||||
bounds.width, bounds.height));
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
@@ -596,13 +581,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
|
||||
private void setStyleBits(final int mask, final int value) {
|
||||
execute(ptr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeSetNSWindowStyleBits: window=" + Long.toHexString(ptr)
|
||||
+ ", mask=" + Integer.toHexString(mask) + ", value=" + Integer.toHexString(value));
|
||||
}
|
||||
nativeSetNSWindowStyleBits(ptr, mask, value);
|
||||
});
|
||||
execute(ptr -> nativeSetNSWindowStyleBits(ptr, mask, value));
|
||||
}
|
||||
|
||||
private native void _toggleFullScreenMode(final long model);
|
||||
@@ -751,10 +730,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(ptr);
|
||||
if (!isKeyWindow) {
|
||||
logger.fine("setVisible: makeKeyAndOrderFront");
|
||||
CWrapper.NSWindow.makeKeyAndOrderFront(ptr);
|
||||
} else {
|
||||
logger.fine("setVisible: orderFront");
|
||||
CWrapper.NSWindow.orderFront(ptr);
|
||||
}
|
||||
|
||||
@@ -1090,12 +1067,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
execute(ptr -> nativeSynthesizeMouseEnteredExitedEvents(ptr, CocoaConstants.NSMouseExited));
|
||||
}
|
||||
|
||||
execute(ptr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("nativeSetEnabled: window=" + Long.toHexString(ptr) + ", enabled=" + !blocked);
|
||||
}
|
||||
nativeSetEnabled(ptr, !blocked);
|
||||
});
|
||||
execute(ptr -> nativeSetEnabled(ptr, !blocked));
|
||||
checkBlockingAndOrder();
|
||||
}
|
||||
|
||||
@@ -1294,9 +1266,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
pWindow.orderAboveSiblings();
|
||||
|
||||
pWindow.execute(ptr -> {
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("Focus blocker " + Long.toHexString(ptr));
|
||||
}
|
||||
CWrapper.NSWindow.orderFrontRegardless(ptr);
|
||||
CWrapper.NSWindow.makeKeyAndOrderFront(ptr);
|
||||
CWrapper.NSWindow.makeMainWindow(ptr);
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
jint preFullScreenLevel;
|
||||
NSRect standardFrame;
|
||||
BOOL isMinimizing;
|
||||
NSWindowTabbingMode javaWindowTabbingMode;
|
||||
BOOL isEnterFullScreen;
|
||||
}
|
||||
|
||||
// An instance of either AWTWindow_Normal or AWTWindow_Panel
|
||||
@@ -64,8 +62,6 @@
|
||||
@property (nonatomic) jint preFullScreenLevel;
|
||||
@property (nonatomic) NSRect standardFrame;
|
||||
@property (nonatomic) BOOL isMinimizing;
|
||||
@property (nonatomic) NSWindowTabbingMode javaWindowTabbingMode;
|
||||
@property (nonatomic) BOOL isEnterFullScreen;
|
||||
|
||||
- (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
|
||||
ownerWindow:owner
|
||||
@@ -75,8 +71,6 @@
|
||||
|
||||
- (BOOL) isTopmostWindowUnderMouse;
|
||||
|
||||
- (NSWindowTabbingMode) getJavaWindowTabbingMode;
|
||||
|
||||
// NSWindow overrides delegate methods
|
||||
- (BOOL) canBecomeKeyWindow;
|
||||
- (void) becomeKeyWindow;
|
||||
|
||||
@@ -61,8 +61,6 @@ static AWTWindow* lastKeyWindow = nil;
|
||||
// It would be NSZeroPoint if 'Location by Platform' is not used.
|
||||
static NSPoint lastTopLeftPoint;
|
||||
|
||||
static BOOL ignoreResizeWindowDuringAnotherWindowEnd = NO;
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// NSWindow/NSPanel descendants implementation
|
||||
#define AWT_NS_WINDOW_IMPLEMENTATION \
|
||||
@@ -115,7 +113,7 @@ static BOOL ignoreResizeWindowDuringAnotherWindowEnd = NO;
|
||||
} \
|
||||
\
|
||||
- (NSWindowTabbingMode)tabbingMode { \
|
||||
return ((AWTWindow*)[self delegate]).javaWindowTabbingMode; \
|
||||
return NSWindowTabbingModeDisallowed; \
|
||||
}
|
||||
|
||||
@implementation AWTWindow_Normal
|
||||
@@ -158,35 +156,21 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)postPhaseEvent:(NSEvent *)event {
|
||||
// Consider changing API to reflect MacOS api
|
||||
// Gesture event should come with phase field
|
||||
// PhaseEvent should be removed
|
||||
const unsigned int NSEventPhaseBegan = 0x1 << 0;
|
||||
const unsigned int NSEventPhaseEnded = 0x1 << 3;
|
||||
const unsigned int NSEventPhaseCancelled = 0x1 << 4;
|
||||
- (void)beginGestureWithEvent:(NSEvent *)event {
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_PHASE
|
||||
a:-1.0
|
||||
b:0.0];
|
||||
}
|
||||
|
||||
if (event.phase == NSEventPhaseBegan) {
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_PHASE
|
||||
a:-1.0
|
||||
b:0.0];
|
||||
return true;
|
||||
} else if (event.phase == NSEventPhaseEnded ||
|
||||
event.phase == NSEventPhaseCancelled) {
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_PHASE
|
||||
a:1.0
|
||||
b:0.0];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
- (void)endGestureWithEvent:(NSEvent *)event {
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_PHASE
|
||||
a:1.0
|
||||
b:0.0];
|
||||
}
|
||||
|
||||
- (void)magnifyWithEvent:(NSEvent *)event {
|
||||
if ([self postPhaseEvent:event]) {
|
||||
return;
|
||||
}
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_MAGNIFY
|
||||
a:[event magnification]
|
||||
@@ -194,9 +178,6 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
}
|
||||
|
||||
- (void)rotateWithEvent:(NSEvent *)event {
|
||||
if ([self postPhaseEvent:event]) {
|
||||
return;
|
||||
}
|
||||
[self postGesture:event
|
||||
as:com_apple_eawt_event_GestureHandler_ROTATE
|
||||
a:[event rotation]
|
||||
@@ -219,67 +200,6 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
];
|
||||
}
|
||||
|
||||
- (void)moveTabToNewWindow:(id)sender {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
[super moveTabToNewWindow:sender];
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [((AWTWindow *)self.delegate).javaPlatformWindow jObjectWithEnv:env];
|
||||
if (platformWindow != NULL) {
|
||||
// extract the target AWT Window object out of the CPlatformWindow
|
||||
static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
|
||||
jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
|
||||
if (awtWindow != NULL) {
|
||||
static JNF_CLASS_CACHE(jc_Window, "java/awt/Window");
|
||||
static JNF_MEMBER_CACHE(jm_runMoveTabToNewWindowCallback, jc_Window, "runMoveTabToNewWindowCallback", "()V");
|
||||
JNFCallVoidMethod(env, awtWindow, jm_runMoveTabToNewWindowCallback);
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, platformWindow);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Move Tab to new Window ===");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Call over Foundation from Java
|
||||
- (CGFloat) getTabBarVisibleAndHeight {
|
||||
if ([self respondsToSelector:@selector(tabGroup)]) { // API_AVAILABLE(macos(10.13))
|
||||
id tabGroup = [self tabGroup];
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Window tabBar: %@ ===", tabGroup);
|
||||
#endif
|
||||
if ([tabGroup isTabBarVisible]) {
|
||||
if ([tabGroup respondsToSelector:@selector(_tabBar)]) { // private member
|
||||
CGFloat height = [[tabGroup _tabBar] frame].size.height;
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Window tabBar visible: %f ===", height);
|
||||
#endif
|
||||
return height;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== NsWindow.tabGroup._tabBar not found ===");
|
||||
#endif
|
||||
return -1; // if we don't get height return -1 and use default value in java without change native code
|
||||
}
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Window tabBar not visible ===");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Window tabBar not found ===");
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void)orderOut:(id)sender {
|
||||
ignoreResizeWindowDuringAnotherWindowEnd = YES;
|
||||
[super orderOut:sender];
|
||||
}
|
||||
|
||||
@end
|
||||
@implementation AWTWindow_Panel
|
||||
AWT_NS_WINDOW_IMPLEMENTATION
|
||||
@@ -301,8 +221,6 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
@synthesize preFullScreenLevel;
|
||||
@synthesize standardFrame;
|
||||
@synthesize isMinimizing;
|
||||
@synthesize javaWindowTabbingMode;
|
||||
@synthesize isEnterFullScreen;
|
||||
|
||||
- (void) updateMinMaxSize:(BOOL)resizable {
|
||||
if (resizable) {
|
||||
@@ -451,9 +369,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
|
||||
self.javaWindowTabbingMode = [self getJavaWindowTabbingMode];
|
||||
self.isEnterFullScreen = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -471,33 +386,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
return [self.nsWindow windowNumber] == [AWTWindow getTopmostWindowUnderMouseID];
|
||||
}
|
||||
|
||||
- (NSWindowTabbingMode) getJavaWindowTabbingMode {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
BOOL result = NO;
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
if (platformWindow != NULL) {
|
||||
// extract the target AWT Window object out of the CPlatformWindow
|
||||
static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
|
||||
jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
|
||||
if (awtWindow != NULL) {
|
||||
static JNF_CLASS_CACHE(jc_Window, "java/awt/Window");
|
||||
static JNF_MEMBER_CACHE(jm_hasTabbingMode, jc_Window, "hasTabbingMode", "()Z");
|
||||
result = JNFCallBooleanMethod(env, awtWindow, jm_hasTabbingMode) == JNI_TRUE ? YES : NO;
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, platformWindow);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== getJavaWindowTabbingMode: %d ===", result);
|
||||
#endif
|
||||
|
||||
return result ? NSWindowTabbingModeAutomatic : NSWindowTabbingModeDisallowed;
|
||||
}
|
||||
|
||||
+ (AWTWindow *) getTopmostWindowUnderMouse {
|
||||
NSEnumerator *windowEnumerator = [[NSApp windows] objectEnumerator];
|
||||
NSWindow *window;
|
||||
@@ -745,13 +633,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
- (void)windowDidResize:(NSNotification *)notification {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
if (self.isEnterFullScreen && ignoreResizeWindowDuringAnotherWindowEnd) {
|
||||
#ifdef DEBUG
|
||||
NSLog(@"=== Native.windowDidResize: %@ | ignored in transition to fullscreen ===", self.nsWindow.title);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[self _deliverMoveResizeEvent];
|
||||
}
|
||||
|
||||
@@ -998,8 +880,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
|
||||
- (void)windowWillEnterFullScreen:(NSNotification *)notification {
|
||||
self.isEnterFullScreen = YES;
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_windowWillEnterFullScreen, jc_CPlatformWindow, "windowWillEnterFullScreen", "()V");
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
@@ -1011,8 +891,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
}
|
||||
|
||||
- (void)windowDidEnterFullScreen:(NSNotification *)notification {
|
||||
self.isEnterFullScreen = YES;
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_windowDidEnterFullScreen, jc_CPlatformWindow, "windowDidEnterFullScreen", "()V");
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
@@ -1025,8 +903,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
}
|
||||
|
||||
- (void)windowWillExitFullScreen:(NSNotification *)notification {
|
||||
self.isEnterFullScreen = NO;
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_windowWillExitFullScreen, jc_CPlatformWindow, "windowWillExitFullScreen", "()V");
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
@@ -1038,8 +914,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
}
|
||||
|
||||
- (void)windowDidExitFullScreen:(NSNotification *)notification {
|
||||
self.isEnterFullScreen = NO;
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_windowDidExitFullScreen, jc_CPlatformWindow, "windowDidExitFullScreen", "()V");
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
@@ -1771,8 +1645,6 @@ JNF_COCOA_ENTER(env);
|
||||
[nsWindow setDelegate: nil];
|
||||
|
||||
[window release];
|
||||
|
||||
ignoreResizeWindowDuringAnotherWindowEnd = NO;
|
||||
}];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
@public
|
||||
NSFont *fFont;
|
||||
CGFontRef fNativeCGFont;
|
||||
NSFont *fFallbackBase; // used for system fonts
|
||||
BOOL fIsFakeItalic;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,20 +37,16 @@
|
||||
|
||||
@implementation AWTFont
|
||||
|
||||
- (id) initWithFont:(NSFont *)font fallbackBase:(NSFont *)fallbackBaseFont {
|
||||
- (id) initWithFont:(NSFont *)font {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
fFont = [font retain];
|
||||
fNativeCGFont = CTFontCopyGraphicsFont((CTFontRef)font, NULL);
|
||||
fFallbackBase = [fallbackBaseFont retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[fFallbackBase release];
|
||||
fFallbackBase = nil;
|
||||
|
||||
[fFont release];
|
||||
fFont = nil;
|
||||
|
||||
@@ -78,7 +74,6 @@ static NSString* uiBoldName = nil;
|
||||
{
|
||||
// create font with family & size
|
||||
NSFont *nsFont = nil;
|
||||
NSFont *nsFallbackBase = nil;
|
||||
|
||||
if ((uiName != nil && [name isEqualTo:uiName]) ||
|
||||
(uiBoldName != nil && [name isEqualTo:uiBoldName])) {
|
||||
@@ -87,7 +82,6 @@ static NSString* uiBoldName = nil;
|
||||
} else {
|
||||
nsFont = [NSFont systemFontOfSize:1.0];
|
||||
}
|
||||
nsFallbackBase = [NSFont fontWithName:@"Lucida Grande" size:1.0];
|
||||
#ifdef DEBUG
|
||||
NSLog(@"nsFont-name is : %@", nsFont.familyName);
|
||||
NSLog(@"nsFont-family is : %@", nsFont.fontName);
|
||||
@@ -117,7 +111,7 @@ static NSString* uiBoldName = nil;
|
||||
nsFont = [[NSFontManager sharedFontManager] convertFont:nsFont toHaveTrait:NSBoldFontMask];
|
||||
}
|
||||
|
||||
return [[[AWTFont alloc] initWithFont:nsFont fallbackBase:nsFallbackBase] autorelease];
|
||||
return [[[AWTFont alloc] initWithFont:nsFont] autorelease];
|
||||
}
|
||||
|
||||
+ (NSFont *) nsFontForJavaFont:(jobject)javaFont env:(JNIEnv *)env {
|
||||
|
||||
@@ -88,12 +88,11 @@ ReleaseCTStateDictionary(CFDictionaryRef ctStateDict)
|
||||
CFRelease(ctStateDict); // GC
|
||||
}
|
||||
|
||||
void GetFontsAndGlyphsForCharacters(CTFontRef font, CTFontRef fallbackBase,
|
||||
const UniChar unicodes[], CGGlyph glyphs[], jint glyphsAsInts[],
|
||||
void GetFontsAndGlyphsForCharacters(CTFontRef font, const UniChar unicodes[], CGGlyph glyphs[], jint glyphsAsInts[],
|
||||
CTFontRef actualFonts[], const size_t count)
|
||||
{
|
||||
CTFontGetGlyphsForCharacters(font, unicodes, glyphs, count);
|
||||
if (!fallbackBase) fallbackBase = font;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < count; i++) {
|
||||
UniChar unicode = unicodes[i];
|
||||
@@ -108,7 +107,7 @@ void GetFontsAndGlyphsForCharacters(CTFontRef font, CTFontRef fallbackBase,
|
||||
continue;
|
||||
}
|
||||
|
||||
const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters(fallbackBase, &unicodes[i], surrogatePair ? 2 : 1);
|
||||
const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters(font, &unicodes[i], surrogatePair ? 2 : 1);
|
||||
if (fallback) {
|
||||
CTFontGetGlyphsForCharacters(fallback, &unicodes[i], &glyphs[i], surrogatePair ? 2 : 1);
|
||||
glyph = glyphs[i];
|
||||
@@ -141,8 +140,7 @@ void GetFontsAndGlyphsForCharacters(CTFontRef font, CTFontRef fallbackBase,
|
||||
void CTS_GetGlyphsAsIntsForCharacters
|
||||
(const AWTFont *font, const UniChar unicodes[], CGGlyph glyphs[], jint glyphsAsInts[], const size_t count)
|
||||
{
|
||||
GetFontsAndGlyphsForCharacters((CTFontRef)font->fFont, (CTFontRef)font->fFallbackBase,
|
||||
unicodes, glyphs, glyphsAsInts, NULL, count);
|
||||
GetFontsAndGlyphsForCharacters((CTFontRef)font->fFont, unicodes, glyphs, glyphsAsInts, NULL, count);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -153,7 +151,6 @@ CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint
|
||||
(const AWTFont *font, const UnicodeScalarValue codePoint, CFStringRef fontNames[])
|
||||
{
|
||||
CTFontRef fontRef = (CTFontRef)font->fFont;
|
||||
CTFontRef fallbackBase = (CTFontRef)font->fFallbackBase;
|
||||
int count = codePoint >= 0x10000 ? 2 : 1;
|
||||
UTF16Char unicodes[count];
|
||||
if (count == 1) {
|
||||
@@ -164,7 +161,7 @@ CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint
|
||||
CGGlyph glyphs[count];
|
||||
jint glyphsAsInts[count];
|
||||
CTFontRef actualFonts[count];
|
||||
GetFontsAndGlyphsForCharacters(fontRef, fallbackBase, unicodes, glyphs, glyphsAsInts, actualFonts, count);
|
||||
GetFontsAndGlyphsForCharacters(fontRef, unicodes, glyphs, glyphsAsInts, actualFonts, count);
|
||||
CGGlyph glyph = glyphs[0];
|
||||
bool substitutionHappened = glyphsAsInts[0] < 0;
|
||||
if (glyph > 0 && substitutionHappened) {
|
||||
@@ -185,18 +182,7 @@ CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint
|
||||
*/
|
||||
CTFontRef CTS_CopyCTFallbackFontAndGlyphForUnicode
|
||||
(const AWTFont *font, const UTF16Char *charRef, CGGlyph *glyphRef, int count) {
|
||||
CTFontRef primary = (CTFontRef)font->fFont;
|
||||
CTFontRef fallbackBase = (CTFontRef)font->fFallbackBase;
|
||||
if (fallbackBase) {
|
||||
CTFontGetGlyphsForCharacters(primary, charRef, glyphRef, count);
|
||||
if (glyphRef[0] > 0) {
|
||||
CFRetain(primary);
|
||||
return primary;
|
||||
}
|
||||
} else {
|
||||
fallbackBase = primary;
|
||||
}
|
||||
CTFontRef fallback = JRSFontCreateFallbackFontForCharacters(fallbackBase, charRef, count);
|
||||
CTFontRef fallback = JRSFontCreateFallbackFontForCharacters((CTFontRef)font->fFont, charRef, count);
|
||||
if (fallback == NULL)
|
||||
{
|
||||
// use the original font if we somehow got duped into trying to fallback something we can't
|
||||
|
||||
@@ -427,7 +427,7 @@ public class Font implements java.io.Serializable
|
||||
* If the origin of a Font is a created font then this attribute
|
||||
* must be set on all derived fonts too.
|
||||
*/
|
||||
private boolean createdFont = false;
|
||||
private transient boolean createdFont = false;
|
||||
|
||||
/*
|
||||
* This is true if the font transform is not identity. It
|
||||
|
||||
@@ -4004,39 +4004,6 @@ public class Window extends Container implements Accessible {
|
||||
ignoreMouseEvents = ignore;
|
||||
}
|
||||
|
||||
private volatile boolean hasTabbingMode;
|
||||
|
||||
boolean hasTabbingMode() {
|
||||
return hasTabbingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set via reflection (JB JdkEx API).
|
||||
*/
|
||||
void setTabbingMode() {
|
||||
hasTabbingMode = true;
|
||||
}
|
||||
|
||||
private volatile Runnable moveTabToNewWindowCallback;
|
||||
|
||||
void runMoveTabToNewWindowCallback() {
|
||||
if (moveTabToNewWindowCallback != null) {
|
||||
Runnable callback = moveTabToNewWindowCallback;
|
||||
SunToolkit.executeOnEventHandlerThread(this, new Runnable() {
|
||||
public void run() {
|
||||
callback.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set via reflection (JB JdkEx API).
|
||||
*/
|
||||
void setMoveTabToNewWindowCallback(Runnable moveTabToNewWindowCallback) {
|
||||
this.moveTabToNewWindowCallback = moveTabToNewWindowCallback;
|
||||
}
|
||||
|
||||
// ************************** MIXING CODE *******************************
|
||||
|
||||
// A window has an owner, but it does NOT have a container
|
||||
|
||||
@@ -11,8 +11,7 @@ public class KeyEventProcessing {
|
||||
public final static String useNationalLayoutsOption = "com.sun.awt.use.national.layouts";
|
||||
@Native
|
||||
public final static boolean useNationalLayouts = "true".equals(
|
||||
Util.getProperty(useNationalLayoutsOption,
|
||||
FontUtilities.isMacOSX && !FontUtilities.isMacOSX_aarch64 ? "true" : "false"));
|
||||
Util.getProperty(useNationalLayoutsOption, FontUtilities.isMacOSX ? "true" : "false"));
|
||||
|
||||
// Used on windows to emulate latin OEM keys on cyrillic keyboards
|
||||
public final static String useLatinNonAlphaNumKeycodesOption = "com.sun.awt.useLatinNonAlphaNumKeycodes";
|
||||
|
||||
@@ -50,7 +50,6 @@ public final class FontUtilities {
|
||||
|
||||
public static boolean isMacOSX;
|
||||
public static boolean isMacOSX14;
|
||||
public static boolean isMacOSX_aarch64;
|
||||
|
||||
public static boolean useJDKScaler;
|
||||
|
||||
@@ -97,8 +96,6 @@ public final class FontUtilities {
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
String architecture = System.getProperty("os.arch");
|
||||
isMacOSX_aarch64 = "aarch64".equals(architecture);
|
||||
}
|
||||
/* If set to "jdk", use the JDK's scaler rather than
|
||||
* the platform one. This may be a no-op on platforms where
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1641,13 +1641,9 @@ static jlong
|
||||
FT_GlyphSlot_Embolden(ftglyph);
|
||||
}
|
||||
|
||||
/* After call to FT_Render_Glyph, glyph format will be changed from
|
||||
* FT_GLYPH_FORMAT_OUTLINE to FT_GLYPH_FORMAT_BITMAP, so save this value */
|
||||
int outlineGlyph = ftglyph->format == FT_GLYPH_FORMAT_OUTLINE;
|
||||
|
||||
/* generate bitmap if it is not done yet
|
||||
e.g. if algorithmic styling is performed and style was added to outline */
|
||||
if (renderImage && outlineGlyph) {
|
||||
if (renderImage && (ftglyph->format == FT_GLYPH_FORMAT_OUTLINE)) {
|
||||
FT_BBox bbox;
|
||||
FT_Outline_Get_CBox(&(ftglyph->outline), &bbox);
|
||||
int w = (int)((bbox.xMax>>6)-(bbox.xMin>>6));
|
||||
@@ -1736,7 +1732,8 @@ static jlong
|
||||
}
|
||||
}
|
||||
|
||||
if (context->fmType == TEXT_FM_ON && outlineGlyph) {
|
||||
if (context->fmType == TEXT_FM_ON &&
|
||||
ftglyph->format == FT_GLYPH_FORMAT_OUTLINE) {
|
||||
float advh = FTFixedToFloat(ftglyph->linearHoriAdvance);
|
||||
glyphInfo->advanceX =
|
||||
(float) (advh * FTFixedToFloat(context->transform.xx));
|
||||
|
||||
@@ -168,8 +168,6 @@ public class XBaseWindow {
|
||||
|
||||
// Set WM_CLIENT_LEADER property
|
||||
initClientLeader();
|
||||
|
||||
initUserTimeWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,13 +439,6 @@ public class XBaseWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private void initUserTimeWindow() {
|
||||
XNETProtocol netProtocol = XWM.getWM().getNETProtocol();
|
||||
if (netProtocol != null ) {
|
||||
netProtocol.setupUserTimeWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
static XRootWindow getXAWTRootWindow() {
|
||||
return XRootWindow.getInstance();
|
||||
}
|
||||
@@ -1316,8 +1307,8 @@ public class XBaseWindow {
|
||||
globalUserTime = time;
|
||||
}
|
||||
XNETProtocol netProtocol = XWM.getWM().getNETProtocol();
|
||||
if (netProtocol != null) {
|
||||
netProtocol.setUserTime(this, time);
|
||||
if (netProtocol != null && netProtocol.active()) {
|
||||
netProtocol.XA_NET_WM_USER_TIME.setCard32Property(this, time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -686,7 +686,6 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
||||
}
|
||||
|
||||
if (targetXWindow != null) {
|
||||
targetXWindow.setUserTime(xclient.get_data(2), true);
|
||||
notifyProtocolListener(targetXWindow, sourceX, sourceY, userAction,
|
||||
xclient, MouseEvent.MOUSE_RELEASED);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,6 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
XAtom XA_NET_WM_WINDOW_OPACITY = XAtom.get("_NET_WM_WINDOW_OPACITY");
|
||||
|
||||
XAtom XA_NET_WM_USER_TIME = XAtom.get("_NET_WM_USER_TIME");
|
||||
XAtom XA_NET_WM_USER_TIME_WINDOW = XAtom.get("_NET_WM_USER_TIME_WINDOW");
|
||||
|
||||
/* For _NET_WM_STATE ClientMessage requests */
|
||||
static final int _NET_WM_STATE_REMOVE =0; /* remove/unset property */
|
||||
@@ -459,21 +458,4 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
|
||||
XAtomList state = window.getNETWMState();
|
||||
return (state != null && state.size() != 0 && state.contains(XA_NET_WM_STATE_HIDDEN));
|
||||
}
|
||||
|
||||
private boolean isUserTimeWindowSupported() {
|
||||
return checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_USER_TIME_WINDOW);
|
||||
}
|
||||
|
||||
void setupUserTimeWindow(XBaseWindow window) {
|
||||
if (active() && isUserTimeWindowSupported()) {
|
||||
XA_NET_WM_USER_TIME_WINDOW.setWindowProperty(window, XRootWindow.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
void setUserTime(XBaseWindow window, long time) {
|
||||
if (active()) {
|
||||
XBaseWindow target = isUserTimeWindowSupported() ? XRootWindow.getInstance() : window;
|
||||
XA_NET_WM_USER_TIME.setCard32Property(target, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,6 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
|
||||
@@ -113,8 +111,7 @@ final class XWM
|
||||
UNITY_COMPIZ_WM = 16,
|
||||
XMONAD_WM = 17,
|
||||
AWESOME_WM = 18,
|
||||
I3_WM = 19,
|
||||
DWM_WM = 20;
|
||||
I3_WM = 19;
|
||||
|
||||
public String toString() {
|
||||
switch (WMID) {
|
||||
@@ -152,8 +149,6 @@ final class XWM
|
||||
return "XMonad";
|
||||
case AWESOME_WM:
|
||||
return "Awesome";
|
||||
case DWM_WM:
|
||||
return "DWM";
|
||||
case UNDETERMINED_WM:
|
||||
default:
|
||||
return "Undetermined WM";
|
||||
@@ -165,13 +160,6 @@ final class XWM
|
||||
static final Insets zeroInsets = new Insets(0, 0, 0, 0);
|
||||
static final Insets defaultInsets = new Insets(25, 5, 5, 5);
|
||||
|
||||
private static String gdmSession;
|
||||
|
||||
static {
|
||||
gdmSession = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getenv("GDMSESSION"));
|
||||
}
|
||||
|
||||
XWM(int WMID) {
|
||||
this.WMID = WMID;
|
||||
initializeProtocols();
|
||||
@@ -638,10 +626,6 @@ final class XWM
|
||||
return isNetWMName("i3");
|
||||
}
|
||||
|
||||
static boolean isDWM() {
|
||||
return "dwm".equals(gdmSession);
|
||||
}
|
||||
|
||||
static int awtWMNonReparenting = -1;
|
||||
static boolean isNonReparentingWM() {
|
||||
if (awtWMNonReparenting == -1) {
|
||||
@@ -649,7 +633,7 @@ final class XWM
|
||||
}
|
||||
return (awtWMNonReparenting == 1 || XWM.getWMID() == XWM.COMPIZ_WM
|
||||
|| XWM.getWMID() == XWM.LG3D_WM || XWM.getWMID() == XWM.CWM_WM ||
|
||||
XWM.getWMID() == XWM.XMONAD_WM || XWM.getWMID() == XWM.DWM_WM
|
||||
XWM.getWMID() == XWM.XMONAD_WM
|
||||
);
|
||||
}
|
||||
|
||||
@@ -847,8 +831,6 @@ final class XWM
|
||||
awt_wmgr = XWM.AWESOME_WM;
|
||||
} else if (isI3()) {
|
||||
awt_wmgr = XWM.I3_WM;
|
||||
} else if (isDWM()) {
|
||||
awt_wmgr = XWM.DWM_WM;
|
||||
}
|
||||
/*
|
||||
* We don't check for legacy WM when we already know that WM
|
||||
|
||||
@@ -29,6 +29,7 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
|
||||
+ "Press the arrow buttons to move through the tree.\n\n"
|
||||
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
|
||||
|
||||
String root = "Root";
|
||||
String[] nodes = new String[] {"One node", "Two node"};
|
||||
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
|
||||
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
|
||||
@@ -50,40 +51,14 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
|
||||
super.createUI(panel, "AccessibleJTreeTest");
|
||||
}
|
||||
|
||||
public void createSampleTreeInvisibleRoot() {
|
||||
INSTRUCTIONS = "INSTRUCTIONS:\n"
|
||||
+ "Check a11y of JTree with invisible root in a simple Window.\n\n"
|
||||
+ "Turn screen reader on, and Tab to the tree.\n"
|
||||
+ "Press the arrow buttons to move through the tree.\n\n"
|
||||
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
|
||||
|
||||
String[] nodes = new String[] {"One node", "Two node"};
|
||||
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
|
||||
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
|
||||
|
||||
Hashtable<String, String[]> data = new Hashtable<String, String[]>();
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
data.put(nodes[i], leafs[i]);
|
||||
}
|
||||
|
||||
JTree tree = new JTree(data);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new FlowLayout());
|
||||
JScrollPane scrollPane = new JScrollPane(tree);
|
||||
panel.add(scrollPane);
|
||||
panel.setFocusable(false);
|
||||
exceptionString = "AccessibleJTree sample item unvisable root test failed!";
|
||||
super.createUI(panel, "AccessibleJTreeTest");
|
||||
}
|
||||
|
||||
public void createRendererTree() {
|
||||
public void createRendererTree() {
|
||||
INSTRUCTIONS = "INSTRUCTIONS:\n"
|
||||
+ "Check a11y of JTree using renderer in a simple Window.\n\n"
|
||||
+ "Turn screen reader on, and Tab to the tree.\n"
|
||||
+ "Press the arrow buttons to move through the tree.\n\n"
|
||||
+ "If you can hear tree components tab further and press PASS, otherwise press FAIL.\n";
|
||||
|
||||
String root = "Root";
|
||||
String[] nodes = new String[] {"One node", "Two node"};
|
||||
String[][] leafs = new String[][]{{"leaf 1.1", "leaf 1.2", "leaf 1.3", "leaf 1.4"},
|
||||
{"leaf 2.1", "leaf 2.2", "leaf 2.3", "leaf 2.4"}};
|
||||
@@ -115,13 +90,6 @@ public class AccessibleJTreeTest extends AccessibleComponentTest {
|
||||
throw new RuntimeException(exceptionString);
|
||||
}
|
||||
|
||||
countDownLatch = test.createCountDownLatch();
|
||||
SwingUtilities.invokeAndWait(test::createSampleTreeInvisibleRoot);
|
||||
AccessibleComponentTest.countDownLatch.await(15, TimeUnit.MINUTES);
|
||||
if (!testResult) {
|
||||
throw new RuntimeException(exceptionString);
|
||||
}
|
||||
|
||||
countDownLatch = test.createCountDownLatch();
|
||||
SwingUtilities.invokeAndWait(test::createRendererTree);
|
||||
countDownLatch.await(15, TimeUnit.MINUTES);
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2020 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.awt.event.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-2977 Opening a recent project in a new window doesn't bring this window to the front
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class NewFrameAfterDialogTest {
|
||||
private static final CompletableFuture<Boolean> success = new CompletableFuture<>();
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
private static JDialog dialog;
|
||||
private static JFrame frame2;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(NewFrameAfterDialogTest::initUI);
|
||||
robot.delay(3000); // wait for the frame to appear
|
||||
clickOn(frame);
|
||||
robot.delay(3000); // wait for dialog to appear
|
||||
clickOn(dialog);
|
||||
robot.delay(3000); // wait for second frame to appear
|
||||
clickOn(frame2);
|
||||
success.get(10, TimeUnit.SECONDS);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(NewFrameAfterDialogTest::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("NewFrameAfterDialogTest");
|
||||
JButton button = new JButton("Open another frame");
|
||||
button.addActionListener(e -> {
|
||||
dialog = new JDialog(frame, true);
|
||||
JButton b = new JButton("Confirm");
|
||||
b.addActionListener(e2 -> dialog.dispose());
|
||||
dialog.add(b);
|
||||
dialog.setSize(300, 300);
|
||||
dialog.setLocationRelativeTo(null);
|
||||
dialog.setVisible(true);
|
||||
frame2 = new JFrame("Second frame");
|
||||
JButton b2 = new JButton("Close");
|
||||
b2.addActionListener(e3 -> success.complete(true));
|
||||
frame2.add(b2);
|
||||
frame2.setSize(300, 300);
|
||||
frame2.setLocationRelativeTo(null);
|
||||
frame2.setVisible(true);
|
||||
});
|
||||
frame.add(button);
|
||||
frame.setSize(300, 300);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
if (frame2 != null) frame2.dispose();
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user