mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-08 02:19:37 +01:00
Compare commits
38 Commits
312
...
system_hot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15f7368309 | ||
|
|
9dbcf194c9 | ||
|
|
6bbe7102e2 | ||
|
|
fe97147ea2 | ||
|
|
bdd52c4c89 | ||
|
|
5511e8eae8 | ||
|
|
f6fc65d014 | ||
|
|
eb493ef1bf | ||
|
|
da86fbacae | ||
|
|
4e7c0b5e50 | ||
|
|
b210facd6b | ||
|
|
3801db7e12 | ||
|
|
22efc1419c | ||
|
|
b7acd7f6f6 | ||
|
|
2646c8bb5b | ||
|
|
c276444bee | ||
|
|
4c7870a3b4 | ||
|
|
4e1330dfb2 | ||
|
|
2ca8f09c02 | ||
|
|
a71b0a3e0d | ||
|
|
cef29e8100 | ||
|
|
9e768377db | ||
|
|
68c2fd0e3b | ||
|
|
7967532f3f | ||
|
|
73f993d10c | ||
|
|
e838103a24 | ||
|
|
e7ca6db66b | ||
|
|
d9656a178b | ||
|
|
5f6351b0c4 | ||
|
|
c3a0ec902d | ||
|
|
567d96c428 | ||
|
|
1666f05b23 | ||
|
|
ae823a660b | ||
|
|
f6a31f444c | ||
|
|
a1b4cd964a | ||
|
|
5845719fe5 | ||
|
|
dae56a9e8b | ||
|
|
9cc97b0c00 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,6 +2,10 @@ JTwork
|
||||
JTreport
|
||||
*.class
|
||||
.idea/workspace.xml
|
||||
.idea/misc.xml
|
||||
.idea/modules.xml
|
||||
.idea/shelf/
|
||||
JetBrainsRuntime.iml
|
||||
build/
|
||||
# Project exclude paths
|
||||
/jb/project/java-gradle/.gradle/
|
||||
@@ -542,12 +542,9 @@ endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
|
||||
endif
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
endif
|
||||
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
|
||||
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ public class AquaImageFactory {
|
||||
}
|
||||
|
||||
static Image getGenericJavaIcon() {
|
||||
return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
|
||||
return checkValidOrStub(java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
|
||||
public Image run() {
|
||||
return com.apple.eawt.Application.getApplication().getDockIconImage();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
static String getPathToThisApplication() {
|
||||
@@ -496,4 +496,23 @@ public class AquaImageFactory {
|
||||
public static Color getSelectionInactiveForegroundColorUIResource() {
|
||||
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
|
||||
}
|
||||
|
||||
private static class EmptyImage {
|
||||
static final BufferedImage INSTANCE;
|
||||
static {
|
||||
INSTANCE = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics g = INSTANCE.createGraphics();
|
||||
g.setColor(new Color(0, 0, 0, 0));
|
||||
g.fillRect(0, 0, 16, 16);
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// [tav] a workaround for JBR-1492
|
||||
private static Image checkValidOrStub(Image image) {
|
||||
if (image == null || image.getWidth(null) <= 0 || image.getHeight(null) <= 0) {
|
||||
return EmptyImage.INSTANCE;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ final class ScreenMenu extends Menu
|
||||
final Component[] items = fInvoker.getMenuComponents();
|
||||
if (needsUpdate(items, childHashArray)) {
|
||||
removeAll();
|
||||
fItems.clear();
|
||||
if (count <= 0) return;
|
||||
|
||||
childHashArray = new int[count];
|
||||
@@ -246,7 +247,7 @@ final class ScreenMenu extends Menu
|
||||
synchronized (getTreeLock()) {
|
||||
super.addNotify();
|
||||
if (fModelPtr == 0) {
|
||||
fInvoker.addContainerListener(this);
|
||||
fInvoker.getPopupMenu().addContainerListener(this);
|
||||
fInvoker.addComponentListener(this);
|
||||
fPropertyListener = new ScreenMenuPropertyListener(this);
|
||||
fInvoker.addPropertyChangeListener(fPropertyListener);
|
||||
@@ -281,7 +282,7 @@ final class ScreenMenu extends Menu
|
||||
if (fModelPtr != 0) {
|
||||
removeMenuListeners(fModelPtr);
|
||||
fModelPtr = 0;
|
||||
fInvoker.removeContainerListener(this);
|
||||
fInvoker.getPopupMenu().removeContainerListener(this);
|
||||
fInvoker.removeComponentListener(this);
|
||||
fInvoker.removePropertyChangeListener(fPropertyListener);
|
||||
}
|
||||
@@ -302,11 +303,10 @@ final class ScreenMenu extends Menu
|
||||
@Override
|
||||
public void componentRemoved(final ContainerEvent e) {
|
||||
final Component child = e.getChild();
|
||||
final MenuItem sm = fItems.get(child);
|
||||
final MenuItem sm = fItems.remove(child);
|
||||
if (sm == null) return;
|
||||
|
||||
remove(sm);
|
||||
fItems.remove(sm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1262,9 +1262,10 @@ public class LWWindowPeer
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (platformWindow.rejectFocusRequest(cause)) {
|
||||
// return false;
|
||||
// }
|
||||
if (platformWindow.rejectFocusRequest(cause)) {
|
||||
rejectFocusRequest.run();
|
||||
return false;
|
||||
}
|
||||
|
||||
AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget());
|
||||
KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor()
|
||||
@@ -1307,7 +1308,7 @@ public class LWWindowPeer
|
||||
|
||||
// In case the toplevel is active but not focused, change focus directly,
|
||||
// as requesting native focus on it will not have effect.
|
||||
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {
|
||||
} else if (getTarget() == currentActive && !getTarget().isFocused()) {
|
||||
changeFocusedWindow(true, opposite, lightweightRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CImage extends CFRetainedResource {
|
||||
private static native long nativeCreateNSImageFromImageName(String name);
|
||||
private static native long nativeCreateNSImageFromIconSelector(int selector);
|
||||
private static native byte[] nativeGetPlatformImageBytes(int[] buffer, int w, int h);
|
||||
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int dw, int dh);
|
||||
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int sw, int sh, int dw, int dh);
|
||||
private static native Dimension2D nativeGetNSImageSize(long image);
|
||||
private static native void nativeSetNSImageSize(long image, double w, double h);
|
||||
private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
|
||||
@@ -274,40 +274,33 @@ public class CImage extends CFRetainedResource {
|
||||
|
||||
AtomicReference<Dimension2D> sizeRef = new AtomicReference<>();
|
||||
execute(ptr -> {
|
||||
// This size is in points (user space): [NSImage size]
|
||||
sizeRef.set(nativeGetNSImageSize(ptr));
|
||||
});
|
||||
final Dimension2D size = sizeRef.get();
|
||||
if (size == null) {
|
||||
return null;
|
||||
}
|
||||
int width = (int)size.getWidth();
|
||||
int height = (int)size.getHeight();
|
||||
final int w = (int)size.getWidth();
|
||||
final int h = (int)size.getHeight();
|
||||
AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
|
||||
execute(ptr -> {
|
||||
// These sizes are in pixels (device space): [NSImageRep pixelsWide/pixelsHigh].
|
||||
repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
|
||||
size.getHeight()));
|
||||
});
|
||||
Dimension2D[] sizes = repRef.get();
|
||||
|
||||
// The image may be represented in the only size (e.g. the app's dock icon is represented in a scaled
|
||||
// size on Retina). In this case the representation size should be used as the base image size.
|
||||
if (sizes != null && sizes.length == 1) {
|
||||
width = (int)sizes[0].getWidth();
|
||||
height = (int)sizes[0].getHeight();
|
||||
}
|
||||
|
||||
return sizes == null || sizes.length < 2 ?
|
||||
new MultiResolutionCachedImage(width, height, this::toImage)
|
||||
: new MultiResolutionCachedImage(width, height, sizes, this::toImage);
|
||||
new MultiResolutionCachedImage(w, h, (width, height)
|
||||
-> toImage(w, h, width, height))
|
||||
: new MultiResolutionCachedImage(w, h, sizes, (width, height)
|
||||
-> toImage(w, h, width, height));
|
||||
}
|
||||
|
||||
private BufferedImage toImage(int dstWidth, int dstHeight) {
|
||||
private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
|
||||
final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE);
|
||||
final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer();
|
||||
final int[] buffer = SunWritableRaster.stealData(dbi, 0);
|
||||
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, dstWidth, dstHeight));
|
||||
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, srcWidth, srcHeight, dstWidth, dstHeight));
|
||||
SunWritableRaster.markDirty(dbi);
|
||||
return bimg;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,12 @@ static BOOL shouldUsePressAndHold() {
|
||||
[self deliverJavaKeyEventHelper: event];
|
||||
}
|
||||
|
||||
return NO;
|
||||
NSUInteger deviceIndependentModifierFlagsMask =
|
||||
[event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
|
||||
|
||||
return ((deviceIndependentModifierFlagsMask == NSCommandKeyMask)
|
||||
|| (deviceIndependentModifierFlagsMask == (NSCommandKeyMask & NSShiftKeyMask)))
|
||||
&& [[event characters] isEqualToString:@"`"];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -684,7 +684,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
if (platformWindow != NULL) {
|
||||
jobject oppositeWindow = [opposite.javaPlatformWindow jObjectWithEnv:env];
|
||||
jobject oppositeWindow = [opposite respondsToSelector:@selector(javaPlatformWindow)] ? [opposite.javaPlatformWindow jObjectWithEnv:env] : NULL;
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_deliverWindowFocusEvent, jc_CPlatformWindow, "deliverWindowFocusEvent", "(ZLsun/lwawt/macosx/CPlatformWindow;)V");
|
||||
JNFCallVoidMethod(env, platformWindow, jm_deliverWindowFocusEvent, (jboolean)focused, oppositeWindow);
|
||||
@@ -772,20 +772,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
#ifdef DEBUG
|
||||
NSLog(@"resigned key: %d %@ %@", [self.nsWindow isMainWindow], [self.nsWindow title], [self menuBarForWindow]);
|
||||
#endif
|
||||
if (![self.nsWindow isMainWindow]) {
|
||||
[self deactivateWindow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) windowDidResignMain: (NSNotification *) notification {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
[AWTToolkit eventCountPlusPlus];
|
||||
#ifdef DEBUG
|
||||
NSLog(@"resigned main: %d %@ %@", [self.nsWindow isKeyWindow], [self.nsWindow title], [self menuBarForWindow]);
|
||||
#endif
|
||||
if (![self.nsWindow isKeyWindow]) {
|
||||
[self deactivateWindow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) deactivateWindow {
|
||||
@@ -798,12 +785,8 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
// the new key window
|
||||
NSWindow *keyWindow = [NSApp keyWindow];
|
||||
AWTWindow *opposite = nil;
|
||||
if ([AWTWindow isAWTWindow: keyWindow]) {
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
[AWTWindow setLastKeyWindow: self];
|
||||
} else {
|
||||
[AWTWindow setLastKeyWindow: nil];
|
||||
}
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
[AWTWindow setLastKeyWindow: self];
|
||||
|
||||
[self _deliverWindowFocusEvent:NO oppositeWindow: opposite];
|
||||
[self orderChildWindows:NO];
|
||||
|
||||
@@ -201,11 +201,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG];
|
||||
self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0];
|
||||
|
||||
|
||||
NSDockTile *dockTile = [NSApp dockTile];
|
||||
self.fProgressIndicator = [[NSProgressIndicator alloc]
|
||||
initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)];
|
||||
|
||||
|
||||
[fProgressIndicator setStyle:NSProgressIndicatorBarStyle];
|
||||
[fProgressIndicator setIndeterminate:NO];
|
||||
[[dockTile contentView] addSubview:fProgressIndicator];
|
||||
@@ -476,8 +476,20 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the app's icon instead to meet Retina.
|
||||
[NSApp setApplicationIconImage:image];
|
||||
// setup an image view for the dock tile
|
||||
NSRect frame = NSMakeRect(0, 0, dockTile.size.width, dockTile.size.height);
|
||||
NSImageView *dockImageView = [[NSImageView alloc] initWithFrame: frame];
|
||||
[dockImageView setImageScaling:NSImageScaleProportionallyUpOrDown];
|
||||
[dockImageView setImage:image];
|
||||
|
||||
[[ApplicationDelegate sharedDelegate].fProgressIndicator removeFromSuperview];
|
||||
[dockImageView addSubview:[ApplicationDelegate sharedDelegate].fProgressIndicator];
|
||||
|
||||
// add it to the NSDockTile
|
||||
[dockTile setContentView: dockImageView];
|
||||
[dockTile display];
|
||||
|
||||
[dockImageView release];
|
||||
}
|
||||
|
||||
+ (void)_setDockIconProgress:(NSNumber *)value {
|
||||
@@ -498,8 +510,25 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
+ (NSImage *)_dockIconImage {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// The app's dock icon defaults to the app's icon (see the spec) which is Retina-aware unlike the dock icon.
|
||||
return [NSApp applicationIconImage];
|
||||
NSDockTile *dockTile = [NSApp dockTile];
|
||||
NSView *view = [dockTile contentView];
|
||||
|
||||
if ([view isKindOfClass:[NSImageView class]]) {
|
||||
NSImage *img = [((NSImageView *)view) image];
|
||||
if (img) return img;
|
||||
}
|
||||
|
||||
if (view == nil) {
|
||||
return [NSImage imageNamed:@"NSApplicationIcon"];
|
||||
}
|
||||
|
||||
NSRect frame = [view frame];
|
||||
NSImage *image = [[NSImage alloc] initWithSize:frame.size];
|
||||
[image lockFocus];
|
||||
[view drawRect:frame];
|
||||
[image unlockFocus];
|
||||
[image autorelease];
|
||||
return image;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -257,24 +257,24 @@ JNF_COCOA_EXIT(env);
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CImage
|
||||
* Method: nativeCopyNSImageIntoArray
|
||||
* Signature: (J[III)V
|
||||
* Signature: (J[IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeCopyNSImageIntoArray
|
||||
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint dw, jint dh)
|
||||
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint sw, jint sh,
|
||||
jint dw, jint dh)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSImage *img = (NSImage *)jlong_to_ptr(nsImgPtr);
|
||||
jint *dst = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
|
||||
if (dst) {
|
||||
NSSize size = [(NSImage *)jlong_to_ptr(nsImgPtr) size];
|
||||
NSRect fromRect = NSMakeRect(0, 0, size.width, size.height);
|
||||
NSRect fromRect = NSMakeRect(0, 0, sw, sh);
|
||||
NSRect toRect = NSMakeRect(0, 0, dw, dh);
|
||||
CImage_CopyNSImageIntoArray(img, dst, fromRect, toRect);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, buffer, dst, JNI_ABORT);
|
||||
}
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#import "java_awt_event_InputEvent.h"
|
||||
#import "java_awt_event_KeyEvent.h"
|
||||
#import "sizecalc.h"
|
||||
#import "ThreadUtilities.h"
|
||||
|
||||
// Starting number for event numbers generated by Robot.
|
||||
// Apple docs don't mention at all what are the requirements
|
||||
@@ -94,46 +93,43 @@ JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CRobot_initRobot
|
||||
(JNIEnv *env, jobject peer)
|
||||
{
|
||||
// Set things up to let our app act like a synthetic keyboard and mouse.
|
||||
// Always set all states, in case Apple ever changes default behaviors.
|
||||
static int setupDone = 0;
|
||||
if (!setupDone) {
|
||||
int i;
|
||||
jint* tmp;
|
||||
jboolean copy = JNI_FALSE;
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
// Set things up to let our app act like a synthetic keyboard and mouse.
|
||||
// Always set all states, in case Apple ever changes default behaviors.
|
||||
static int setupDone = 0;
|
||||
if (!setupDone) {
|
||||
int i;
|
||||
jint* tmp;
|
||||
jboolean copy = JNI_FALSE;
|
||||
setupDone = 1;
|
||||
// Don't block local events after posting ours
|
||||
CGSetLocalEventsSuppressionInterval(0.0);
|
||||
|
||||
setupDone = 1;
|
||||
// Don't block local events after posting ours
|
||||
CGSetLocalEventsSuppressionInterval(0.0);
|
||||
// Let our event's modifier key state blend with local hardware events
|
||||
CGEnableEventStateCombining(TRUE);
|
||||
|
||||
// Let our event's modifier key state blend with local hardware events
|
||||
CGEnableEventStateCombining(TRUE);
|
||||
// Don't let our events block local hardware events
|
||||
CGSetLocalEventsFilterDuringSupressionState(
|
||||
kCGEventFilterMaskPermitAllEvents,
|
||||
kCGEventSupressionStateSupressionInterval);
|
||||
CGSetLocalEventsFilterDuringSupressionState(
|
||||
kCGEventFilterMaskPermitAllEvents,
|
||||
kCGEventSupressionStateRemoteMouseDrag);
|
||||
|
||||
// Don't let our events block local hardware events
|
||||
CGSetLocalEventsFilterDuringSupressionState(
|
||||
kCGEventFilterMaskPermitAllEvents,
|
||||
kCGEventSupressionStateSupressionInterval);
|
||||
CGSetLocalEventsFilterDuringSupressionState(
|
||||
kCGEventFilterMaskPermitAllEvents,
|
||||
kCGEventSupressionStateRemoteMouseDrag);
|
||||
gsClickCount = 0;
|
||||
gsLastClickTime = 0;
|
||||
gsEventNumber = ROBOT_EVENT_NUMBER_START;
|
||||
|
||||
gsClickCount = 0;
|
||||
gsLastClickTime = 0;
|
||||
gsEventNumber = ROBOT_EVENT_NUMBER_START;
|
||||
|
||||
gsButtonEventNumber = (int*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(int), gNumberOfButtons);
|
||||
if (gsButtonEventNumber == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < gNumberOfButtons; ++i) {
|
||||
gsButtonEventNumber[i] = ROBOT_EVENT_NUMBER_START;
|
||||
}
|
||||
gsButtonEventNumber = (int*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(int), gNumberOfButtons);
|
||||
if (gsButtonEventNumber == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||
return;
|
||||
}
|
||||
}];
|
||||
|
||||
for (i = 0; i < gNumberOfButtons; ++i) {
|
||||
gsButtonEventNumber[i] = ROBOT_EVENT_NUMBER_START;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -147,95 +143,90 @@ Java_sun_lwawt_macosx_CRobot_mouseEvent
|
||||
jint displayID, jint mouseLastX, jint mouseLastY, jint buttonsState,
|
||||
jboolean isButtonsDownState, jboolean isMouseMove)
|
||||
{
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
// This is the native method called when Robot mouse events occur.
|
||||
// The CRobot tracks the mouse position, and which button was
|
||||
// pressed. The peer also tracks the mouse button desired state,
|
||||
// the appropriate key modifier state, and whether the mouse action
|
||||
// is simply a mouse move with no mouse button state changes.
|
||||
|
||||
// This is the native method called when Robot mouse events occur.
|
||||
// The CRobot tracks the mouse position, and which button was
|
||||
// pressed. The peer also tracks the mouse button desired state,
|
||||
// the appropriate key modifier state, and whether the mouse action
|
||||
// is simply a mouse move with no mouse button state changes.
|
||||
// volatile, otherwise it warns that it might be clobbered by 'longjmp'
|
||||
volatile CGPoint point;
|
||||
|
||||
// volatile, otherwise it warns that it might be clobbered by 'longjmp'
|
||||
volatile CGPoint point;
|
||||
point.x = mouseLastX;
|
||||
point.y = mouseLastY;
|
||||
|
||||
point.x = mouseLastX;
|
||||
point.y = mouseLastY;
|
||||
__block CGMouseButton button = kCGMouseButtonLeft;
|
||||
__block CGEventType type = kCGEventMouseMoved;
|
||||
|
||||
__block CGMouseButton button = kCGMouseButtonLeft;
|
||||
__block CGEventType type = kCGEventMouseMoved;
|
||||
void (^HandleRobotButton)(CGMouseButton, CGEventType, CGEventType, CGEventType) =
|
||||
^(CGMouseButton cgButton, CGEventType cgButtonUp, CGEventType cgButtonDown,
|
||||
CGEventType cgButtonDragged) {
|
||||
|
||||
void (^HandleRobotButton)(CGMouseButton, CGEventType, CGEventType, CGEventType) =
|
||||
^(CGMouseButton cgButton, CGEventType cgButtonUp, CGEventType cgButtonDown,
|
||||
CGEventType cgButtonDragged) {
|
||||
|
||||
button = cgButton;
|
||||
type = cgButtonUp;
|
||||
|
||||
if (isButtonsDownState) {
|
||||
if (isMouseMove) {
|
||||
type = cgButtonDragged;
|
||||
} else {
|
||||
type = cgButtonDown;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Left
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON1_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON1_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonLeft, kCGEventLeftMouseUp,
|
||||
kCGEventLeftMouseDown, kCGEventLeftMouseDragged);
|
||||
}
|
||||
|
||||
// Other
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON2_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON2_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonCenter, kCGEventOtherMouseUp,
|
||||
kCGEventOtherMouseDown, kCGEventOtherMouseDragged);
|
||||
}
|
||||
|
||||
// Right
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON3_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON3_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonRight, kCGEventRightMouseUp,
|
||||
kCGEventRightMouseDown, kCGEventRightMouseDragged);
|
||||
}
|
||||
|
||||
// Extra
|
||||
if (gNumberOfButtons > 3) {
|
||||
int extraButton;
|
||||
for (extraButton = 3; extraButton < gNumberOfButtons; ++extraButton) {
|
||||
if ((buttonsState & gButtonDownMasks[extraButton])) {
|
||||
HandleRobotButton(extraButton, kCGEventOtherMouseUp,
|
||||
kCGEventOtherMouseDown, kCGEventOtherMouseDragged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int clickCount = 0;
|
||||
int eventNumber = gsEventNumber;
|
||||
|
||||
if (isMouseMove) {
|
||||
// any mouse movement resets click count
|
||||
gsLastClickTime = 0;
|
||||
} else {
|
||||
clickCount = GetClickCount(isButtonsDownState);
|
||||
button = cgButton;
|
||||
type = cgButtonUp;
|
||||
|
||||
if (isButtonsDownState) {
|
||||
gsButtonEventNumber[button] = gsEventNumber++;
|
||||
if (isMouseMove) {
|
||||
type = cgButtonDragged;
|
||||
} else {
|
||||
type = cgButtonDown;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Left
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON1_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON1_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonLeft, kCGEventLeftMouseUp,
|
||||
kCGEventLeftMouseDown, kCGEventLeftMouseDragged);
|
||||
}
|
||||
|
||||
// Other
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON2_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON2_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonCenter, kCGEventOtherMouseUp,
|
||||
kCGEventOtherMouseDown, kCGEventOtherMouseDragged);
|
||||
}
|
||||
|
||||
// Right
|
||||
if (buttonsState & java_awt_event_InputEvent_BUTTON3_MASK ||
|
||||
buttonsState & java_awt_event_InputEvent_BUTTON3_DOWN_MASK ) {
|
||||
|
||||
HandleRobotButton(kCGMouseButtonRight, kCGEventRightMouseUp,
|
||||
kCGEventRightMouseDown, kCGEventRightMouseDragged);
|
||||
}
|
||||
|
||||
// Extra
|
||||
if (gNumberOfButtons > 3) {
|
||||
int extraButton;
|
||||
for (extraButton = 3; extraButton < gNumberOfButtons; ++extraButton) {
|
||||
if ((buttonsState & gButtonDownMasks[extraButton])) {
|
||||
HandleRobotButton(extraButton, kCGEventOtherMouseUp,
|
||||
kCGEventOtherMouseDown, kCGEventOtherMouseDragged);
|
||||
}
|
||||
eventNumber = gsButtonEventNumber[button];
|
||||
}
|
||||
}
|
||||
|
||||
PostMouseEvent(point, button, type, clickCount, eventNumber);
|
||||
int clickCount = 0;
|
||||
int eventNumber = gsEventNumber;
|
||||
|
||||
}];
|
||||
if (isMouseMove) {
|
||||
// any mouse movement resets click count
|
||||
gsLastClickTime = 0;
|
||||
} else {
|
||||
clickCount = GetClickCount(isButtonsDownState);
|
||||
|
||||
if (isButtonsDownState) {
|
||||
gsButtonEventNumber[button] = gsEventNumber++;
|
||||
}
|
||||
eventNumber = gsButtonEventNumber[button];
|
||||
}
|
||||
|
||||
PostMouseEvent(point, button, type, clickCount, eventNumber);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
@@ -249,19 +240,14 @@ JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CRobot_mouseWheel
|
||||
(JNIEnv *env, jobject peer, jint wheelAmt)
|
||||
{
|
||||
CGEventRef event = CGEventCreateScrollWheelEvent(NULL,
|
||||
kCGScrollEventUnitLine,
|
||||
k_JAVA_ROBOT_WHEEL_COUNT, wheelAmt);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
|
||||
CGEventRef event = CGEventCreateScrollWheelEvent(NULL,
|
||||
kCGScrollEventUnitLine,
|
||||
k_JAVA_ROBOT_WHEEL_COUNT, wheelAmt);
|
||||
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
|
||||
}];
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -273,14 +259,13 @@ JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CRobot_keyEvent
|
||||
(JNIEnv *env, jobject peer, jint javaKeyCode, jboolean keyPressed)
|
||||
{
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
|
||||
CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
}];
|
||||
CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
|
||||
|
||||
CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
|
||||
if (event != NULL) {
|
||||
CGEventPost(kCGSessionEventTap, event);
|
||||
CFRelease(event);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -295,53 +280,49 @@ Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
jint picX = x;
|
||||
jint picY = y;
|
||||
jint picWidth = width;
|
||||
jint picHeight = height;
|
||||
|
||||
jint picX = x;
|
||||
jint picY = y;
|
||||
jint picWidth = width;
|
||||
jint picHeight = height;
|
||||
CGRect screenRect = CGRectMake(picX / scale, picY / scale,
|
||||
picWidth / scale, picHeight / scale);
|
||||
CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
|
||||
kCGWindowListOptionOnScreenOnly,
|
||||
kCGNullWindowID, kCGWindowImageBestResolution);
|
||||
|
||||
CGRect screenRect = CGRectMake(picX / scale, picY / scale,
|
||||
picWidth / scale, picHeight / scale);
|
||||
CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
|
||||
kCGWindowListOptionOnScreenOnly,
|
||||
kCGNullWindowID, kCGWindowImageBestResolution);
|
||||
if (screenPixelsImage == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (screenPixelsImage == NULL) {
|
||||
return;
|
||||
}
|
||||
// get a pointer to the Java int array
|
||||
void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
|
||||
CHECK_NULL(jPixelData);
|
||||
|
||||
// get a pointer to the Java int array
|
||||
void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
|
||||
CHECK_NULL(jPixelData);
|
||||
// create a graphics context around the Java int array
|
||||
CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
|
||||
kCGColorSpaceGenericRGB);
|
||||
CGContextRef jPicContextRef = CGBitmapContextCreate(
|
||||
jPixelData,
|
||||
picWidth, picHeight,
|
||||
8, picWidth * sizeof(jint),
|
||||
picColorSpace,
|
||||
kCGBitmapByteOrder32Host |
|
||||
kCGImageAlphaPremultipliedFirst);
|
||||
|
||||
// create a graphics context around the Java int array
|
||||
CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
|
||||
kCGColorSpaceGenericRGB);
|
||||
CGContextRef jPicContextRef = CGBitmapContextCreate(
|
||||
jPixelData,
|
||||
picWidth, picHeight,
|
||||
8, picWidth * sizeof(jint),
|
||||
picColorSpace,
|
||||
kCGBitmapByteOrder32Host |
|
||||
kCGImageAlphaPremultipliedFirst);
|
||||
CGColorSpaceRelease(picColorSpace);
|
||||
|
||||
CGColorSpaceRelease(picColorSpace);
|
||||
// flip, scale, and color correct the screen image into the Java pixels
|
||||
CGRect bounds = { { 0, 0 }, { picWidth, picHeight } };
|
||||
CGContextDrawImage(jPicContextRef, bounds, screenPixelsImage);
|
||||
CGContextFlush(jPicContextRef);
|
||||
|
||||
// flip, scale, and color correct the screen image into the Java pixels
|
||||
CGRect bounds = { { 0, 0 }, { picWidth, picHeight } };
|
||||
CGContextDrawImage(jPicContextRef, bounds, screenPixelsImage);
|
||||
CGContextFlush(jPicContextRef);
|
||||
// cleanup
|
||||
CGContextRelease(jPicContextRef);
|
||||
CGImageRelease(screenPixelsImage);
|
||||
|
||||
// cleanup
|
||||
CGContextRelease(jPicContextRef);
|
||||
CGImageRelease(screenPixelsImage);
|
||||
|
||||
// release the Java int array back up to the JVM
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, pixels, jPixelData, 0);
|
||||
|
||||
}];
|
||||
// release the Java int array back up to the JVM
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, pixels, jPixelData, 0);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
635
src/java.desktop/macosx/native/libawt_lwawt/awt/SystemHotkey.m
Normal file
635
src/java.desktop/macosx/native/libawt_lwawt/awt/SystemHotkey.m
Normal file
@@ -0,0 +1,635 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
#import "CRobotKeyCode.h"
|
||||
#import "java_awt_event_KeyEvent.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include "jni_util.h"
|
||||
|
||||
|
||||
extern JavaVM *jvm;
|
||||
|
||||
enum LOG_LEVEL {
|
||||
TRACE,
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR
|
||||
};
|
||||
|
||||
void plogImpl(jobject platformLogger, int logLevel, const char * msg) {
|
||||
if (!jvm)
|
||||
return;
|
||||
if (logLevel < TRACE || logLevel > ERROR || msg == NULL)
|
||||
return;
|
||||
|
||||
const char * methodName = "finest";
|
||||
switch (logLevel) {
|
||||
case DEBUG: methodName = "fine"; break;
|
||||
case INFO: methodName = "info"; break;
|
||||
case WARNING: methodName = "warning"; break;
|
||||
case ERROR: methodName = "severe"; break;
|
||||
}
|
||||
|
||||
JNIEnv* env;
|
||||
jstring jstr;
|
||||
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL);
|
||||
jstr = (*env)->NewStringUTF(env, msg);
|
||||
JNU_CallMethodByName(env, NULL, platformLogger, methodName, "(Ljava/lang/String;)V", jstr);
|
||||
(*env)->DeleteLocalRef(env, jstr);
|
||||
}
|
||||
|
||||
void plog(int logLevel, const char *formatMsg, ...) {
|
||||
// TODO: check whether current logLevel is enabled in PlatformLogger
|
||||
static jobject loggerObject = NULL;
|
||||
|
||||
if (loggerObject == NULL) {
|
||||
JNIEnv* env;
|
||||
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL);
|
||||
jclass shkClass = (*env)->FindClass(env, "java/awt/desktop/SystemHotkey");
|
||||
if (shkClass == NULL)
|
||||
return;
|
||||
jfieldID fieldId = (*env)->GetStaticFieldID(env, shkClass, "ourLog", "Lsun/util/logging/PlatformLogger;");
|
||||
if (fieldId == NULL)
|
||||
return;
|
||||
loggerObject = (*env)->GetStaticObjectField(env, shkClass, fieldId);
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, formatMsg);
|
||||
const int bufSize = 512;
|
||||
char buf[bufSize];
|
||||
vsnprintf(buf, bufSize, formatMsg, args);
|
||||
va_end(args);
|
||||
|
||||
plogImpl(loggerObject, logLevel, buf);
|
||||
}
|
||||
|
||||
static const char * toCString(id obj) {
|
||||
return obj == nil ? "nil" : [NSString stringWithFormat:@"%@", obj].UTF8String;
|
||||
}
|
||||
|
||||
// Copy of java.awt.event.KeyEvent.[MODIFIER]_DOWN_MASK
|
||||
static const int AWT_SHIFT_DOWN_MASK = 1 << 6;
|
||||
static const int AWT_CTRL_DOWN_MASK = 1 << 7;
|
||||
static const int AWT_META_DOWN_MASK = 1 << 8;
|
||||
static const int AWT_ALT_DOWN_MASK = 1 << 9;
|
||||
|
||||
static int symbolicHotKeysModifiers2java(int mask) {
|
||||
// NOTE: these masks doesn't coincide with macos events masks
|
||||
// and can be used only to parse data from settings domain "com.apple.symbolichotkeys"
|
||||
const int MACOS_SHIFT_MASK = 0x020000;
|
||||
const int MACOS_CONTROL_MASK = 0x040000;
|
||||
const int MACOS_OPTION_MASK = 0x080000;
|
||||
const int MACOS_CMD_MASK = 0x100000;
|
||||
|
||||
int result = 0;
|
||||
if (mask & MACOS_SHIFT_MASK)
|
||||
result |= AWT_SHIFT_DOWN_MASK;
|
||||
if (mask & MACOS_CONTROL_MASK)
|
||||
result |= AWT_CTRL_DOWN_MASK;
|
||||
if (mask & MACOS_OPTION_MASK)
|
||||
result |= AWT_ALT_DOWN_MASK;
|
||||
if (mask & MACOS_CMD_MASK)
|
||||
result |= AWT_META_DOWN_MASK;
|
||||
return result;
|
||||
}
|
||||
|
||||
static NSString * getAppleSymbolicHotKeysDescription(int hotKeyId) {
|
||||
static NSDictionary * hotkeyId2DescMap = nil;
|
||||
if (hotkeyId2DescMap == nil) {
|
||||
hotkeyId2DescMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Move focus to the menu bar", [NSNumber numberWithInt:7],
|
||||
@"Move focus to the Dock", [NSNumber numberWithInt:8],
|
||||
@"Move focus to active or next window", [NSNumber numberWithInt:9],
|
||||
@"Move focus to window toolbar", [NSNumber numberWithInt:10],
|
||||
@"Move focus to floating window", [NSNumber numberWithInt:11],
|
||||
@"Change the way Tab moves focus", [NSNumber numberWithInt:13],
|
||||
@"Turn zoom on or off", [NSNumber numberWithInt:15],
|
||||
@"Zoom in", [NSNumber numberWithInt:17],
|
||||
@"Zoom out", [NSNumber numberWithInt:19],
|
||||
@"Reverse Black and White", [NSNumber numberWithInt:21],
|
||||
@"Turn image smoothing on or off", [NSNumber numberWithInt:23],
|
||||
@"Increase Contrast", [NSNumber numberWithInt:25],
|
||||
@"Decrease Contrast", [NSNumber numberWithInt:26],
|
||||
@"Move focus to the next window in application", [NSNumber numberWithInt:27],
|
||||
@"Save picture of screen as file", [NSNumber numberWithInt:28],
|
||||
@"Copy picture of screen to clipboard", [NSNumber numberWithInt:29],
|
||||
@"Save picture of selected area as file", [NSNumber numberWithInt:30],
|
||||
@"Copy picture of selected area to clipboard", [NSNumber numberWithInt:31],
|
||||
@"All Windows", [NSNumber numberWithInt:32],
|
||||
@"Application Windows", [NSNumber numberWithInt:33],
|
||||
@"All Windows (Slow)", [NSNumber numberWithInt:34],
|
||||
@"Application Windows (Slow)", [NSNumber numberWithInt:35],
|
||||
@"Desktop", [NSNumber numberWithInt:36],
|
||||
@"Desktop (Slow)", [NSNumber numberWithInt:37],
|
||||
@"Move focus to the window drawer", [NSNumber numberWithInt:51],
|
||||
@"Turn Dock Hiding On/Off", [NSNumber numberWithInt:52],
|
||||
@"Move focus to the status menus", [NSNumber numberWithInt:57],
|
||||
@"Turn VoiceOver on / off", [NSNumber numberWithInt:59],
|
||||
@"Select the previous input source", [NSNumber numberWithInt:60],
|
||||
@"Select the next source in the Input Menu", [NSNumber numberWithInt:61],
|
||||
@"Dashboard", [NSNumber numberWithInt:62],
|
||||
@"Dashboard (Slow)", [NSNumber numberWithInt:63],
|
||||
@"Show Spotlight search field", [NSNumber numberWithInt:64],
|
||||
@"Show Spotlight window", [NSNumber numberWithInt:65],
|
||||
@"Dictionary MouseOver", [NSNumber numberWithInt:70],
|
||||
@"Hide and show Front Row", [NSNumber numberWithInt:73],
|
||||
@"Activate Spaces", [NSNumber numberWithInt:75],
|
||||
@"Activate Spaces (Slow)", [NSNumber numberWithInt:76],
|
||||
@"Spaces Left", [NSNumber numberWithInt:79],
|
||||
@"Spaces Right", [NSNumber numberWithInt:81],
|
||||
@"Spaces Down", [NSNumber numberWithInt:83],
|
||||
@"Spaces Up", [NSNumber numberWithInt:85],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:91],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:92],
|
||||
@"Show Help Menu", [NSNumber numberWithInt:98],
|
||||
@"Switch to Space 1", [NSNumber numberWithInt:118],
|
||||
@"Switch to Space 2", [NSNumber numberWithInt:119],
|
||||
@"Switch to Space 3", [NSNumber numberWithInt:120],
|
||||
@"Switch to Space 4", [NSNumber numberWithInt:121],
|
||||
@"Show Launchpad", [NSNumber numberWithInt:160],
|
||||
@"Show Accessibility Controls", [NSNumber numberWithInt:162],
|
||||
@"Show Notification Center", [NSNumber numberWithInt:163],
|
||||
@"Turn Do-Not-Disturb On/Off", [NSNumber numberWithInt:175],
|
||||
@"Turn focus following On/Off", [NSNumber numberWithInt:179],
|
||||
nil
|
||||
];
|
||||
|
||||
[hotkeyId2DescMap retain];
|
||||
}
|
||||
|
||||
return [hotkeyId2DescMap objectForKey : [NSNumber numberWithInt : hotKeyId]];
|
||||
}
|
||||
|
||||
static int NSModifiers2java(int mask) {
|
||||
int result = 0;
|
||||
if (mask & shiftKey)
|
||||
result |= AWT_SHIFT_DOWN_MASK;
|
||||
if (mask & controlKey)
|
||||
result |= AWT_CTRL_DOWN_MASK;
|
||||
if (mask & optionKey)
|
||||
result |= AWT_ALT_DOWN_MASK;
|
||||
if (mask & shiftKey)
|
||||
result |= AWT_META_DOWN_MASK;
|
||||
return result;
|
||||
}
|
||||
|
||||
void Java_java_awt_desktop_SystemHotkeyReader_readSystemHotkeys(JNIEnv* env, jobject reader) {
|
||||
jclass clsReader = (*env)->GetObjectClass(env, reader);
|
||||
jmethodID methodAdd = (*env)->GetMethodID(env, clsReader, "add", "(ILjava/lang/String;ILjava/lang/String;)V");
|
||||
|
||||
// 1. read from com.apple.symbolichotkeys.plist (domain with custom (user defined) shortcuts)
|
||||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary<NSString *,id> * shk = [defaults persistentDomainForName:@"com.apple.symbolichotkeys"];
|
||||
if (shk != nil) {
|
||||
// AppleSymbolicHotKeys = {
|
||||
// 10 = {
|
||||
// enabled = 1;
|
||||
// value = {
|
||||
// parameters = (
|
||||
// 65535,
|
||||
// 96,
|
||||
// 8650752
|
||||
// );
|
||||
// type = standard;
|
||||
// };
|
||||
// };
|
||||
// ......
|
||||
// }
|
||||
id hotkeys = [shk valueForKey:@"AppleSymbolicHotKeys"];
|
||||
if (hotkeys == nil)
|
||||
plog(DEBUG, "key AppleSymbolicHotKeys doesn't exist in domain com.apple.symbolichotkeys");
|
||||
else if (![hotkeys isKindOfClass:[NSDictionary class]])
|
||||
plog(DEBUG, "object for key 'AppleSymbolicHotKeys' isn't NSDictionary (class=%s)", [hotkeys className].UTF8String);
|
||||
else {
|
||||
for (id keyObj in hotkeys) {
|
||||
if (![keyObj isKindOfClass:[NSString class]]) {
|
||||
plog(DEBUG, "key '%s' isn't instance of NSString (class=%s)", toCString(keyObj), [keyObj className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
NSString *hkNumber = keyObj;
|
||||
id hkDesc = hotkeys[hkNumber];
|
||||
if (![hkDesc isKindOfClass:[NSDictionary class]]) {
|
||||
plog(DEBUG, "hotkey descriptor '%s' isn't instance of NSDictionary (class=%s)", toCString(hkDesc), [hkDesc className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
NSDictionary<id, id> *sdict = hkDesc;
|
||||
id objValue = sdict[@"value"];
|
||||
if (objValue == nil)
|
||||
continue;
|
||||
|
||||
if (![objValue isKindOfClass:[NSDictionary class]]) {
|
||||
plog(DEBUG, "property 'value' %s isn't instance of NSDictionary (class=%s)", toCString(objValue), [objValue className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
id objEnabled = sdict[@"enabled"];
|
||||
BOOL enabled = objEnabled != nil && [objEnabled boolValue] == YES;
|
||||
|
||||
if (!enabled)
|
||||
continue;
|
||||
|
||||
NSDictionary * value = objValue;
|
||||
id objParams = value[@"parameters"];
|
||||
if (![objParams isKindOfClass:[NSArray class]]) {
|
||||
plog(DEBUG, "property 'parameters' %s isn't instance of NSArray (class=%s)", toCString(objParams), [objParams className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
NSArray *parameters = objParams;
|
||||
id p0 = parameters[0];
|
||||
id p1 = parameters[1];
|
||||
id p2 = parameters[2];
|
||||
|
||||
if (![p0 isKindOfClass:[NSNumber class]] || ![p1 isKindOfClass:[NSNumber class]] || ![p2 isKindOfClass:[NSNumber class]]) {
|
||||
plog(DEBUG, "some of parameters isn't instance of NSNumber (%s, %s, %s)", [p0 className].UTF8String, [p1 className].UTF8String, [p2 className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
|
||||
//parameter 1: ASCII code of the character (or 65535 - hex 0xFFFF - for non-ASCII characters).
|
||||
//parameter 2: the keyboard key code for the character.
|
||||
//Parameter 3: the sum of the control, command, shift and option keys. these are bits 17-20 in binary: shift is bit 17, control is bit 18, option is bit 19, and command is bit 20.
|
||||
// 0x020000 => "Shift",
|
||||
// 0x040000 => "Control",
|
||||
// 0x080000 => "Option",
|
||||
// 0x100000 => "Command"
|
||||
|
||||
int asciiCode = p0 == nil ? 0xFFFF : [p0 intValue];
|
||||
int vkeyCode = p1 == nil ? -1 : [p1 intValue];
|
||||
int modifiers = p2 == nil ? 0 : [p2 intValue];
|
||||
|
||||
jstring jkeyChar = NULL;
|
||||
if (asciiCode >= 0 && asciiCode <= 0xFF) {
|
||||
char keyCharBuf[64];
|
||||
sprintf(keyCharBuf, "%c", asciiCode);
|
||||
jkeyChar = (*env)->NewStringUTF(env, keyCharBuf);
|
||||
}
|
||||
|
||||
NSString * description = getAppleSymbolicHotKeysDescription([hkNumber intValue]);
|
||||
jstring jdesc = description == nil ? NULL : (*env)->NewStringUTF(env, description.UTF8String);
|
||||
(*env)->CallVoidMethod(
|
||||
env, reader, methodAdd, (jint)vkeyCode,
|
||||
jkeyChar, (jint)symbolicHotKeysModifiers2java(modifiers),
|
||||
jdesc
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plog(DEBUG, "domain com.apple.symbolichotkeys doesn't exist");
|
||||
}
|
||||
|
||||
// 2. read from Pbs (domain with services shortcuts)
|
||||
NSDictionary<NSString *,id> * pbs = [defaults persistentDomainForName:@"pbs"];
|
||||
if (pbs) {
|
||||
// NSServicesStatus = {
|
||||
// "com.apple.Terminal - Open man Page in Terminal - openManPage" = {
|
||||
// "key_equivalent" = "@$m";
|
||||
// };
|
||||
// "com.apple.Terminal - Search man Page Index in Terminal - searchManPages" = {
|
||||
// "enabled_context_menu" = 0;
|
||||
// "enabled_services_menu" = 0;
|
||||
// "key_equivalent" = "@$a";
|
||||
// "presentation_modes" = {
|
||||
// ContextMenu = 0;
|
||||
// ServicesMenu = 0;
|
||||
// };
|
||||
// };
|
||||
// };
|
||||
// }
|
||||
NSDictionary<NSString *, id> *services = [pbs valueForKey:@"NSServicesStatus"];
|
||||
if (services) {
|
||||
for (NSString *key in services) {
|
||||
id value = services[key];
|
||||
if (![value isKindOfClass:[NSDictionary class]]) {
|
||||
plog(DEBUG, "'%s' isn't instance of NSDictionary (class=%s)", toCString(value), [value className].UTF8String);
|
||||
continue;
|
||||
}
|
||||
NSDictionary<NSString *, id> *sdict = value;
|
||||
NSString *key_equivalent = sdict[@"key_equivalent"];
|
||||
if (!key_equivalent)
|
||||
continue;
|
||||
|
||||
// @ - command
|
||||
// $ - shift
|
||||
// ^ - control
|
||||
// ~ - alt(option)
|
||||
const bool modIsSHIFT = [key_equivalent containsString:@"$"];
|
||||
const bool modIsCONTROL = [key_equivalent containsString:@"^"];
|
||||
const bool modIsOPTION = [key_equivalent containsString:@"~"];
|
||||
const bool modIsCMD = [key_equivalent containsString:@"@"];
|
||||
int modifiers = 0;
|
||||
if (modIsSHIFT)
|
||||
modifiers |= AWT_SHIFT_DOWN_MASK;
|
||||
if (modIsCONTROL)
|
||||
modifiers |= AWT_CTRL_DOWN_MASK;
|
||||
if (modIsOPTION)
|
||||
modifiers |= AWT_ALT_DOWN_MASK;
|
||||
if (modIsCMD)
|
||||
modifiers |= AWT_META_DOWN_MASK;
|
||||
|
||||
NSCharacterSet * excludeSet = [NSCharacterSet characterSetWithCharactersInString:@"@$^~"];
|
||||
NSString * keyChar = [key_equivalent stringByTrimmingCharactersInSet:excludeSet];
|
||||
|
||||
(*env)->CallVoidMethod(
|
||||
env, reader, methodAdd, -1,
|
||||
(*env)->NewStringUTF(env, keyChar.UTF8String), modifiers,
|
||||
(*env)->NewStringUTF(env, key.UTF8String)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CARBON_CopySymbolicHotKeys
|
||||
// 3. read from core services
|
||||
CFArrayRef registeredHotKeys;
|
||||
if(CopySymbolicHotKeys(®isteredHotKeys) == noErr) {
|
||||
CFIndex count = CFArrayGetCount(registeredHotKeys);
|
||||
for(CFIndex i = 0; i < count; i++) {
|
||||
CFDictionaryRef hotKeyInfo = CFArrayGetValueAtIndex(registeredHotKeys, i);
|
||||
CFNumberRef hotKeyCode = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode);
|
||||
CFNumberRef hotKeyModifiers = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers);
|
||||
CFBooleanRef hotKeyEnabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled);
|
||||
|
||||
int64_t vkeyCode = -1;
|
||||
CFNumberGetValue(hotKeyCode, kCFNumberSInt64Type, &vkeyCode);
|
||||
int64_t keyModifiers = 0;
|
||||
CFNumberGetValue(hotKeyModifiers, kCFNumberSInt64Type, &keyModifiers);
|
||||
Boolean enabled = CFBooleanGetValue(hotKeyEnabled);
|
||||
if (!enabled)
|
||||
continue;
|
||||
|
||||
(*env)->CallVoidMethod(
|
||||
env, reader, methodAdd, (int)vkeyCode,
|
||||
NULL, NSModifiers2java(keyModifiers),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
CFRelease(registeredHotKeys);
|
||||
}
|
||||
#endif // USE_CARBON_CopySymbolicHotKeys
|
||||
}
|
||||
|
||||
jint Java_java_awt_desktop_SystemHotkeyReader_osx2java(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osx2javaMap = nil;
|
||||
if (osx2javaMap == nil) {
|
||||
osx2javaMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_SPACE], [NSNumber numberWithInt:OSX_Delete],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_TAB], [NSNumber numberWithInt:OSX_kVK_Tab],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ENTER], [NSNumber numberWithInt:OSX_kVK_Return],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CLEAR], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadClear],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SHIFT], [NSNumber numberWithInt:OSX_Shift],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CONTROL], [NSNumber numberWithInt:OSX_Control],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ALT], [NSNumber numberWithInt:OSX_Option],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ALT_GRAPH], [NSNumber numberWithInt:OSX_RightOption],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CAPS_LOCK], [NSNumber numberWithInt:OSX_CapsLock],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ESCAPE], [NSNumber numberWithInt:OSX_Escape],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SPACE], [NSNumber numberWithInt:OSX_kVK_Space],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PAGE_UP], [NSNumber numberWithInt:OSX_PageUp],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PAGE_DOWN], [NSNumber numberWithInt:OSX_PageDown],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_END], [NSNumber numberWithInt:OSX_End],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_HOME], [NSNumber numberWithInt:OSX_Home],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_LEFT], [NSNumber numberWithInt:OSX_LeftArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_UP], [NSNumber numberWithInt:OSX_UpArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_RIGHT], [NSNumber numberWithInt:OSX_RightArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DOWN], [NSNumber numberWithInt:OSX_DownArrow],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_COMMA], [NSNumber numberWithInt:OSX_kVK_ANSI_Comma],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_MINUS], [NSNumber numberWithInt:OSX_kVK_ANSI_Minus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_PERIOD], [NSNumber numberWithInt:OSX_kVK_ANSI_Period],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SLASH], [NSNumber numberWithInt:OSX_kVK_ANSI_Slash],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_0], [NSNumber numberWithInt:OSX_kVK_ANSI_0],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_1], [NSNumber numberWithInt:OSX_kVK_ANSI_1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_2], [NSNumber numberWithInt:OSX_kVK_ANSI_2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_3], [NSNumber numberWithInt:OSX_kVK_ANSI_3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_4], [NSNumber numberWithInt:OSX_kVK_ANSI_4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_5], [NSNumber numberWithInt:OSX_kVK_ANSI_5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_6], [NSNumber numberWithInt:OSX_kVK_ANSI_6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_7], [NSNumber numberWithInt:OSX_kVK_ANSI_7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_8], [NSNumber numberWithInt:OSX_kVK_ANSI_8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_9], [NSNumber numberWithInt:OSX_kVK_ANSI_9],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SEMICOLON], [NSNumber numberWithInt:OSX_kVK_ANSI_Semicolon],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_EQUALS], [NSNumber numberWithInt:OSX_kVK_ANSI_Equal],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_A], [NSNumber numberWithInt:OSX_kVK_ANSI_A],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_B], [NSNumber numberWithInt:OSX_kVK_ANSI_B],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_C], [NSNumber numberWithInt:OSX_kVK_ANSI_C],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_D], [NSNumber numberWithInt:OSX_kVK_ANSI_D],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_E], [NSNumber numberWithInt:OSX_kVK_ANSI_E],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F], [NSNumber numberWithInt:OSX_kVK_ANSI_F],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_G], [NSNumber numberWithInt:OSX_kVK_ANSI_G],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_H], [NSNumber numberWithInt:OSX_kVK_ANSI_H],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_I], [NSNumber numberWithInt:OSX_kVK_ANSI_I],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_J], [NSNumber numberWithInt:OSX_kVK_ANSI_J],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_K], [NSNumber numberWithInt:OSX_kVK_ANSI_K],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_L], [NSNumber numberWithInt:OSX_kVK_ANSI_L],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_M], [NSNumber numberWithInt:OSX_kVK_ANSI_M],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_N], [NSNumber numberWithInt:OSX_kVK_ANSI_N],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_O], [NSNumber numberWithInt:OSX_kVK_ANSI_O],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_P], [NSNumber numberWithInt:OSX_kVK_ANSI_P],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Q], [NSNumber numberWithInt:OSX_kVK_ANSI_Q],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_R], [NSNumber numberWithInt:OSX_kVK_ANSI_R],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_S], [NSNumber numberWithInt:OSX_kVK_ANSI_S],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_T], [NSNumber numberWithInt:OSX_kVK_ANSI_T],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_U], [NSNumber numberWithInt:OSX_kVK_ANSI_U],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_V], [NSNumber numberWithInt:OSX_kVK_ANSI_V],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_W], [NSNumber numberWithInt:OSX_kVK_ANSI_W],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_X], [NSNumber numberWithInt:OSX_kVK_ANSI_X],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Y], [NSNumber numberWithInt:OSX_kVK_ANSI_Y],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_Z], [NSNumber numberWithInt:OSX_kVK_ANSI_Z],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_OPEN_BRACKET], [NSNumber numberWithInt:OSX_kVK_ANSI_LeftBracket],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_SLASH], [NSNumber numberWithInt:OSX_kVK_ANSI_Backslash],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_CLOSE_BRACKET], [NSNumber numberWithInt:OSX_kVK_ANSI_RightBracket],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD0], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad0],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD1], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD2], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD3], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD4], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD5], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD6], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD7], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD8], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_NUMPAD9], [NSNumber numberWithInt:OSX_kVK_ANSI_Keypad9],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_MULTIPLY], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadMultiply],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_ADD], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadPlus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_SUBTRACT], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadMinus],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DECIMAL], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadDecimal],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DIVIDE], [NSNumber numberWithInt:OSX_kVK_ANSI_KeypadDivide],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F1], [NSNumber numberWithInt:OSX_F1],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F2], [NSNumber numberWithInt:OSX_F2],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F3], [NSNumber numberWithInt:OSX_F3],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F4], [NSNumber numberWithInt:OSX_F4],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F5], [NSNumber numberWithInt:OSX_F5],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F6], [NSNumber numberWithInt:OSX_F6],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F7], [NSNumber numberWithInt:OSX_F7],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F8], [NSNumber numberWithInt:OSX_F8],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F9], [NSNumber numberWithInt:OSX_F9],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F10], [NSNumber numberWithInt:OSX_F10],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F11], [NSNumber numberWithInt:OSX_F11],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F12], [NSNumber numberWithInt:OSX_F12],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_DELETE], [NSNumber numberWithInt:OSX_ForwardDelete],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_HELP], [NSNumber numberWithInt:OSX_Help],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_META], [NSNumber numberWithInt:OSX_Command],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_BACK_QUOTE], [NSNumber numberWithInt:OSX_kVK_ANSI_Grave],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_QUOTE], [NSNumber numberWithInt:OSX_kVK_ANSI_Quote],
|
||||
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F13], [NSNumber numberWithInt:OSX_F13],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F14], [NSNumber numberWithInt:OSX_F14],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F15], [NSNumber numberWithInt:OSX_F15],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F16], [NSNumber numberWithInt:OSX_F16],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F17], [NSNumber numberWithInt:OSX_F17],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F18], [NSNumber numberWithInt:OSX_F18],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F19], [NSNumber numberWithInt:OSX_F19],
|
||||
[NSNumber numberWithInt:java_awt_event_KeyEvent_VK_F20], [NSNumber numberWithInt:OSX_F20],
|
||||
nil
|
||||
];
|
||||
|
||||
[osx2javaMap retain];
|
||||
}
|
||||
|
||||
id val = [osx2javaMap objectForKey : [NSNumber numberWithInt : osxKeyCode]];
|
||||
if (nil != val)
|
||||
return [val intValue];
|
||||
|
||||
return java_awt_event_KeyEvent_VK_UNDEFINED;
|
||||
}
|
||||
|
||||
jstring Java_java_awt_desktop_SystemHotkey_osxKeyCodeDescription(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osxCode2DescMap = nil;
|
||||
if (osxCode2DescMap == nil) {
|
||||
osxCode2DescMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"A", [NSNumber numberWithInt:kVK_ANSI_A],
|
||||
@"S", [NSNumber numberWithInt:kVK_ANSI_S],
|
||||
@"D", [NSNumber numberWithInt:kVK_ANSI_D],
|
||||
@"F", [NSNumber numberWithInt:kVK_ANSI_F],
|
||||
@"H", [NSNumber numberWithInt:kVK_ANSI_H],
|
||||
@"G", [NSNumber numberWithInt:kVK_ANSI_G],
|
||||
@"Z", [NSNumber numberWithInt:kVK_ANSI_Z],
|
||||
@"X", [NSNumber numberWithInt:kVK_ANSI_X],
|
||||
@"C", [NSNumber numberWithInt:kVK_ANSI_C],
|
||||
@"V", [NSNumber numberWithInt:kVK_ANSI_V],
|
||||
@"B", [NSNumber numberWithInt:kVK_ANSI_B],
|
||||
@"Q", [NSNumber numberWithInt:kVK_ANSI_Q],
|
||||
@"W", [NSNumber numberWithInt:kVK_ANSI_W],
|
||||
@"E", [NSNumber numberWithInt:kVK_ANSI_E],
|
||||
@"R", [NSNumber numberWithInt:kVK_ANSI_R],
|
||||
@"Y", [NSNumber numberWithInt:kVK_ANSI_Y],
|
||||
@"T", [NSNumber numberWithInt:kVK_ANSI_T],
|
||||
@"1", [NSNumber numberWithInt:kVK_ANSI_1],
|
||||
@"2", [NSNumber numberWithInt:kVK_ANSI_2],
|
||||
@"3", [NSNumber numberWithInt:kVK_ANSI_3],
|
||||
@"4", [NSNumber numberWithInt:kVK_ANSI_4],
|
||||
@"6", [NSNumber numberWithInt:kVK_ANSI_6],
|
||||
@"5", [NSNumber numberWithInt:kVK_ANSI_5],
|
||||
@"Equal", [NSNumber numberWithInt:kVK_ANSI_Equal],
|
||||
@"9", [NSNumber numberWithInt:kVK_ANSI_9],
|
||||
@"7", [NSNumber numberWithInt:kVK_ANSI_7],
|
||||
@"Minus", [NSNumber numberWithInt:kVK_ANSI_Minus],
|
||||
@"8", [NSNumber numberWithInt:kVK_ANSI_8],
|
||||
@"0", [NSNumber numberWithInt:kVK_ANSI_0],
|
||||
@"RightBracket", [NSNumber numberWithInt:kVK_ANSI_RightBracket],
|
||||
@"O", [NSNumber numberWithInt:kVK_ANSI_O],
|
||||
@"U", [NSNumber numberWithInt:kVK_ANSI_U],
|
||||
@"LeftBracket", [NSNumber numberWithInt:kVK_ANSI_LeftBracket],
|
||||
@"I", [NSNumber numberWithInt:kVK_ANSI_I],
|
||||
@"P", [NSNumber numberWithInt:kVK_ANSI_P],
|
||||
@"L", [NSNumber numberWithInt:kVK_ANSI_L],
|
||||
@"J", [NSNumber numberWithInt:kVK_ANSI_J],
|
||||
@"Quote", [NSNumber numberWithInt:kVK_ANSI_Quote],
|
||||
@"K", [NSNumber numberWithInt:kVK_ANSI_K],
|
||||
@"Semicolon", [NSNumber numberWithInt:kVK_ANSI_Semicolon],
|
||||
@"Backslash", [NSNumber numberWithInt:kVK_ANSI_Backslash],
|
||||
@"Comma", [NSNumber numberWithInt:kVK_ANSI_Comma],
|
||||
@"Slash", [NSNumber numberWithInt:kVK_ANSI_Slash],
|
||||
@"N", [NSNumber numberWithInt:kVK_ANSI_N],
|
||||
@"M", [NSNumber numberWithInt:kVK_ANSI_M],
|
||||
@"Period", [NSNumber numberWithInt:kVK_ANSI_Period],
|
||||
@"Grave", [NSNumber numberWithInt:kVK_ANSI_Grave],
|
||||
@"KeypadDecimal", [NSNumber numberWithInt:kVK_ANSI_KeypadDecimal],
|
||||
@"KeypadMultiply", [NSNumber numberWithInt:kVK_ANSI_KeypadMultiply],
|
||||
@"KeypadPlus", [NSNumber numberWithInt:kVK_ANSI_KeypadPlus],
|
||||
@"KeypadClear", [NSNumber numberWithInt:kVK_ANSI_KeypadClear],
|
||||
@"KeypadDivide", [NSNumber numberWithInt:kVK_ANSI_KeypadDivide],
|
||||
@"KeypadEnter", [NSNumber numberWithInt:kVK_ANSI_KeypadEnter],
|
||||
@"KeypadMinus", [NSNumber numberWithInt:kVK_ANSI_KeypadMinus],
|
||||
@"KeypadEquals", [NSNumber numberWithInt:kVK_ANSI_KeypadEquals],
|
||||
@"Keypad0", [NSNumber numberWithInt:kVK_ANSI_Keypad0],
|
||||
@"Keypad1", [NSNumber numberWithInt:kVK_ANSI_Keypad1],
|
||||
@"Keypad2", [NSNumber numberWithInt:kVK_ANSI_Keypad2],
|
||||
@"Keypad3", [NSNumber numberWithInt:kVK_ANSI_Keypad3],
|
||||
@"Keypad4", [NSNumber numberWithInt:kVK_ANSI_Keypad4],
|
||||
@"Keypad5", [NSNumber numberWithInt:kVK_ANSI_Keypad5],
|
||||
@"Keypad6", [NSNumber numberWithInt:kVK_ANSI_Keypad6],
|
||||
@"Keypad7", [NSNumber numberWithInt:kVK_ANSI_Keypad7],
|
||||
@"Keypad8", [NSNumber numberWithInt:kVK_ANSI_Keypad8],
|
||||
@"Keypad9", [NSNumber numberWithInt:kVK_ANSI_Keypad9],
|
||||
|
||||
/* keycodes for keys that are independent of keyboard layout*/
|
||||
@"Return", [NSNumber numberWithInt:kVK_Return],
|
||||
@"Tab", [NSNumber numberWithInt:kVK_Tab],
|
||||
@"Space", [NSNumber numberWithInt:kVK_Space],
|
||||
@"Delete", [NSNumber numberWithInt:kVK_Delete],
|
||||
@"Escape", [NSNumber numberWithInt:kVK_Escape],
|
||||
@"Command", [NSNumber numberWithInt:kVK_Command],
|
||||
@"Shift", [NSNumber numberWithInt:kVK_Shift],
|
||||
@"CapsLock", [NSNumber numberWithInt:kVK_CapsLock],
|
||||
@"Option", [NSNumber numberWithInt:kVK_Option],
|
||||
@"Control", [NSNumber numberWithInt:kVK_Control],
|
||||
@"RightCommand", [NSNumber numberWithInt:kVK_RightCommand],
|
||||
@"RightShift", [NSNumber numberWithInt:kVK_RightShift],
|
||||
@"RightOption", [NSNumber numberWithInt:kVK_RightOption],
|
||||
@"RightControl", [NSNumber numberWithInt:kVK_RightControl],
|
||||
@"Function", [NSNumber numberWithInt:kVK_Function],
|
||||
@"F17", [NSNumber numberWithInt:kVK_F17],
|
||||
@"VolumeUp", [NSNumber numberWithInt:kVK_VolumeUp],
|
||||
@"VolumeDown", [NSNumber numberWithInt:kVK_VolumeDown],
|
||||
@"Mute", [NSNumber numberWithInt:kVK_Mute],
|
||||
@"F18", [NSNumber numberWithInt:kVK_F18],
|
||||
@"F19", [NSNumber numberWithInt:kVK_F19],
|
||||
@"F20", [NSNumber numberWithInt:kVK_F20],
|
||||
@"F5", [NSNumber numberWithInt:kVK_F5],
|
||||
@"F6", [NSNumber numberWithInt:kVK_F6],
|
||||
@"F7", [NSNumber numberWithInt:kVK_F7],
|
||||
@"F3", [NSNumber numberWithInt:kVK_F3],
|
||||
@"F8", [NSNumber numberWithInt:kVK_F8],
|
||||
@"F9", [NSNumber numberWithInt:kVK_F9],
|
||||
@"F11", [NSNumber numberWithInt:kVK_F11],
|
||||
@"F13", [NSNumber numberWithInt:kVK_F13],
|
||||
@"F16", [NSNumber numberWithInt:kVK_F16],
|
||||
@"F14", [NSNumber numberWithInt:kVK_F14],
|
||||
@"F10", [NSNumber numberWithInt:kVK_F10],
|
||||
@"F12", [NSNumber numberWithInt:kVK_F12],
|
||||
@"F15", [NSNumber numberWithInt:kVK_F15],
|
||||
@"Help", [NSNumber numberWithInt:kVK_Help],
|
||||
@"Home", [NSNumber numberWithInt:kVK_Home],
|
||||
@"PageUp", [NSNumber numberWithInt:kVK_PageUp],
|
||||
@"ForwardDelete", [NSNumber numberWithInt:kVK_ForwardDelete],
|
||||
@"F4", [NSNumber numberWithInt:kVK_F4],
|
||||
@"End", [NSNumber numberWithInt:kVK_End],
|
||||
@"F2", [NSNumber numberWithInt:kVK_F2],
|
||||
@"PageDown", [NSNumber numberWithInt:kVK_PageDown],
|
||||
@"F1", [NSNumber numberWithInt:kVK_F1],
|
||||
@"LeftArrow", [NSNumber numberWithInt:kVK_LeftArrow],
|
||||
@"RightArrow", [NSNumber numberWithInt:kVK_RightArrow],
|
||||
@"DownArrow", [NSNumber numberWithInt:kVK_DownArrow],
|
||||
@"UpArrow", [NSNumber numberWithInt:kVK_UpArrow],
|
||||
nil
|
||||
];
|
||||
|
||||
[osxCode2DescMap retain];
|
||||
}
|
||||
|
||||
NSString * val = [osxCode2DescMap objectForKey : [NSNumber numberWithInt : osxKeyCode]];
|
||||
if (val == nil)
|
||||
return NULL;
|
||||
|
||||
return (*env)->NewStringUTF(env, val.UTF8String);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package java.awt.desktop;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collection;
|
||||
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
|
||||
/**
|
||||
* Provides info about system hotkeys
|
||||
*/
|
||||
public class SystemHotkey extends AWTKeyStroke {
|
||||
private static final PlatformLogger ourLog = PlatformLogger.getLogger(java.awt.desktop.SystemHotkey.class.getName());
|
||||
private static final Map<Integer, String> ourCodeDescriptionCache = new HashMap<>();
|
||||
|
||||
private final int myNativeKeyCode;
|
||||
private final String myDescription;
|
||||
|
||||
SystemHotkey(char keyChar, int javaKeyCode, int javaModifiers, String description, int nativeKeyCode) {
|
||||
super(keyChar, javaKeyCode, javaModifiers, true);
|
||||
this.myNativeKeyCode = nativeKeyCode;
|
||||
this.myDescription = description;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("desc='%s' char=%s mod='%s' nativeKeyCode=0x%X ['%s'] javaKeyCode=0x%X",
|
||||
String.valueOf(myDescription), String.valueOf(getKeyChar()), InputEvent.getModifiersExText(getModifiers()),
|
||||
myNativeKeyCode, getOsxKeyCodeDescription(myNativeKeyCode), getKeyCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets hotkey description
|
||||
* @return hotkey description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads all registered hotkeys
|
||||
* @return list of all registered hotkeys
|
||||
*/
|
||||
public static List<SystemHotkey> readSystemHotkeys() {
|
||||
final SystemHotkeyReader reader = new SystemHotkeyReader();
|
||||
reader.readSystemHotkeys();
|
||||
return reader.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets virtual code description
|
||||
* @param code (virtual keycode)
|
||||
* @return virtual keycode description
|
||||
*/
|
||||
private static String getOsxKeyCodeDescription(int code) {
|
||||
return ourCodeDescriptionCache.computeIfAbsent(code, (c)->{
|
||||
final String desc = osxKeyCodeDescription(c);
|
||||
return desc == null || desc.isEmpty() ? String.format("Unknown_key_code_0x%X", c) : desc;
|
||||
});
|
||||
}
|
||||
|
||||
private static native String osxKeyCodeDescription(int osxCode);
|
||||
}
|
||||
|
||||
class SystemHotkeyReader {
|
||||
private final List<SystemHotkey> myResult = new ArrayList<>();
|
||||
|
||||
void add(int keyCode, String keyChar, int modifiers, String desc) {
|
||||
myResult.add(new SystemHotkey(
|
||||
keyChar == null || keyChar.isEmpty() ? KeyEvent.CHAR_UNDEFINED : keyChar.charAt(0),
|
||||
keyCode == -1 ? KeyEvent.VK_UNDEFINED : osx2java(keyCode),
|
||||
modifiers, desc, keyCode
|
||||
));
|
||||
}
|
||||
|
||||
List<SystemHotkey> getResult() { return myResult; }
|
||||
|
||||
native void readSystemHotkeys();
|
||||
|
||||
private static native int osx2java(int osxCode);
|
||||
}
|
||||
@@ -1967,6 +1967,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
* @see DocumentListener#insertUpdate
|
||||
*/
|
||||
public final void insertUpdate(DocumentEvent e) {
|
||||
rootViewInitialized = false;
|
||||
Document doc = e.getDocument();
|
||||
Object o = doc.getProperty("i18n");
|
||||
if (o instanceof Boolean) {
|
||||
@@ -1995,6 +1996,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
* @see DocumentListener#removeUpdate
|
||||
*/
|
||||
public final void removeUpdate(DocumentEvent e) {
|
||||
rootViewInitialized = false;
|
||||
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
|
||||
rootView.removeUpdate(e, alloc, rootView.getViewFactory());
|
||||
}
|
||||
@@ -2010,6 +2012,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
* @see DocumentListener#changedUpdate(DocumentEvent)
|
||||
*/
|
||||
public final void changedUpdate(DocumentEvent e) {
|
||||
rootViewInitialized = false;
|
||||
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
|
||||
rootView.changedUpdate(e, alloc, rootView.getViewFactory());
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public abstract class Font2D {
|
||||
public static final int NATIVE_RANK = 5;
|
||||
public static final int UNKNOWN_RANK = 6;
|
||||
public static final int DEFAULT_RANK = 4;
|
||||
public static final int IDEA_RANK = 7;
|
||||
|
||||
private static final String[] boldNames = {
|
||||
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", };
|
||||
|
||||
@@ -219,7 +219,7 @@ public class FontFamily {
|
||||
case Font.PLAIN:
|
||||
case Font.ITALIC:
|
||||
return (newWeight <= Font2D.FWEIGHT_NORMAL &&
|
||||
newWeight > currFont.getWeight());
|
||||
newWeight >= currFont.getWeight());
|
||||
|
||||
case Font.BOLD:
|
||||
case Font.BOLD|Font.ITALIC:
|
||||
|
||||
@@ -82,6 +82,24 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TTFilterIdea extends TTFilter {
|
||||
final private boolean positive;
|
||||
final private HashSet<String> ideaSet;
|
||||
|
||||
public TTFilterIdea(boolean positive, HashSet<String> ideaSet) {
|
||||
this.positive = positive;
|
||||
this.ideaSet = ideaSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
if (super.accept(dir, name) && ideaSet.contains(name)) {
|
||||
return positive;
|
||||
}
|
||||
return !positive;
|
||||
}
|
||||
}
|
||||
|
||||
private static class T1Filter implements FilenameFilter {
|
||||
public boolean accept(File dir,String name) {
|
||||
if (noType1Font) {
|
||||
@@ -189,6 +207,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
boolean loadedAllFontFiles = false;
|
||||
HashMap<String,String> jreFontMap;
|
||||
HashSet<String> jreBundledFontFiles;
|
||||
HashSet<String> ideaFontSet;
|
||||
String[] jreOtherFontFiles;
|
||||
boolean noOtherJREFontFiles = false; // initial assumption.
|
||||
|
||||
@@ -224,6 +243,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private static final FilenameFilter ttFilter = new TTFilter();
|
||||
private static final FilenameFilter t1Filter = new T1Filter();
|
||||
|
||||
private FilenameFilter ttFilterIdea;
|
||||
private FilenameFilter ttFilterJre;
|
||||
private Font[] allFonts;
|
||||
private String[] allFamilies; // cache for default locale only
|
||||
private Locale lastDefaultLocale;
|
||||
@@ -318,6 +339,23 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("Roboto light", "Roboto-Light.ttf");
|
||||
jreFontMap.put("Roboto thin", "Roboto-Thin.ttf");
|
||||
|
||||
ideaFontSet = new HashSet<>();
|
||||
ideaFontSet.add("FiraCode-Bold.ttf");
|
||||
ideaFontSet.add("FiraCode-Light.ttf");
|
||||
ideaFontSet.add("FiraCode-Medium.ttf");
|
||||
ideaFontSet.add("FiraCode-Retina.ttf");
|
||||
ideaFontSet.add("FiraCode-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-BoldIt.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Regular.ttf");
|
||||
ideaFontSet.add("SourceCodePro-Bold.ttf");
|
||||
ideaFontSet.add("SourceCodePro-It.ttf");
|
||||
ideaFontSet.add("Inconsolata.ttf");
|
||||
ideaFontSet.add("Roboto-Light.ttf");
|
||||
ideaFontSet.add("Roboto-Thin.ttf");
|
||||
|
||||
ttFilterIdea = new TTFilterIdea(true, ideaFontSet);
|
||||
ttFilterJre = new TTFilterIdea(false, ideaFontSet);
|
||||
|
||||
for (String ffile : jreFontMap.values()) {
|
||||
jreBundledFontFiles.add(ffile);
|
||||
}
|
||||
@@ -421,8 +459,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
/* Linux font configuration uses these fonts */
|
||||
registerFontDir(jreFontDirName);
|
||||
}
|
||||
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
|
||||
true, false);
|
||||
registerJREFonts();
|
||||
|
||||
/* Create the font configuration and get any font path
|
||||
* that might be specified.
|
||||
@@ -3323,6 +3360,18 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
defer, resolveSymLinks);
|
||||
}
|
||||
|
||||
protected void registerJREFonts() {
|
||||
File pathFile = new File(jreFontDirName);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterIdea,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.IDEA_RANK,
|
||||
true, false);
|
||||
addDirFonts(jreFontDirName, pathFile, ttFilterJre,
|
||||
FONTFORMAT_TRUETYPE, true,
|
||||
Font2D.JRE_RANK,
|
||||
true, false);
|
||||
}
|
||||
|
||||
protected void registerFontDir(String path) {
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
|
||||
#include "hb.h"
|
||||
#include "hb-jdk.h"
|
||||
#ifdef MACOSX
|
||||
#include "hb-coretext.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
@@ -350,12 +347,6 @@ JNIEXPORT jlong JNICALL Java_sun_font_SunLayoutEngine_createFace(JNIEnv *env,
|
||||
jobject font2D,
|
||||
jboolean aat,
|
||||
jlong platformFontPtr) {
|
||||
#ifdef MACOSX
|
||||
if (aat && platformFontPtr) {
|
||||
hb_face_t *face = hb_coretext_face_create((CGFontRef)platformFontPtr);
|
||||
return ptr_to_jlong(face);
|
||||
}
|
||||
#endif
|
||||
Font2DPtr *fi = (Font2DPtr*)malloc(sizeof(Font2DPtr));
|
||||
if (!fi) {
|
||||
return 0;
|
||||
@@ -403,26 +394,8 @@ static hb_font_t* _hb_jdk_font_create(hb_face_t* face,
|
||||
return font;
|
||||
}
|
||||
|
||||
#ifdef MACOSX
|
||||
static hb_font_t* _hb_jdk_ct_font_create(hb_face_t* face,
|
||||
JDKFontInfo *jdkFontInfo) {
|
||||
|
||||
hb_font_t *font = NULL;
|
||||
font = hb_font_create(face);
|
||||
hb_font_set_scale(font,
|
||||
HBFloatToFixed(jdkFontInfo->ptSize),
|
||||
HBFloatToFixed(jdkFontInfo->ptSize));
|
||||
return font;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_font_t* hb_jdk_font_create(hb_face_t* hbFace,
|
||||
JDKFontInfo *jdkFontInfo,
|
||||
hb_destroy_func_t destroy) {
|
||||
#ifdef MACOSX
|
||||
if (jdkFontInfo->aat && jdkFontInfo->nativeFont) {
|
||||
return _hb_jdk_ct_font_create(hbFace, jdkFontInfo);
|
||||
}
|
||||
#endif
|
||||
return _hb_jdk_font_create(hbFace, jdkFontInfo, destroy);
|
||||
}
|
||||
|
||||
@@ -72,16 +72,16 @@ public class XInputMethod extends X11InputMethod {
|
||||
return createXICNative(peer.getContentWindow());
|
||||
}
|
||||
|
||||
protected boolean recreateXIC() {
|
||||
protected boolean recreateXIC(int ctxid) {
|
||||
final XComponentPeer peer = (XComponentPeer)getPeer(clientComponentWindow);
|
||||
if (peer == null || pData == 0)
|
||||
return true;
|
||||
return recreateXICNative(peer.getContentWindow(), pData);
|
||||
return recreateXICNative(peer.getContentWindow(), pData, ctxid);
|
||||
}
|
||||
protected void releaseXIC() {
|
||||
protected int releaseXIC() {
|
||||
if (pData == 0)
|
||||
return;
|
||||
releaseXICNative(pData);
|
||||
return 0;
|
||||
return releaseXICNative(pData);
|
||||
}
|
||||
|
||||
private static volatile long xicFocus = 0;
|
||||
@@ -161,8 +161,8 @@ public class XInputMethod extends X11InputMethod {
|
||||
*/
|
||||
private native boolean openXIMNative(long display);
|
||||
private native boolean createXICNative(long window);
|
||||
private native boolean recreateXICNative(long window, long px11data);
|
||||
private native void releaseXICNative(long px11data);
|
||||
private native boolean recreateXICNative(long window, long px11data, int ctxid);
|
||||
private native int releaseXICNative(long px11data);
|
||||
private native void setXICFocusNative(long window,
|
||||
boolean value, boolean active);
|
||||
private native void adjustStatusWindow(long window);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -34,6 +35,7 @@ import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.text.AttributedString;
|
||||
import java.util.Map;
|
||||
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
@@ -364,19 +366,21 @@ public abstract class X11InputMethod extends X11InputMethodBase {
|
||||
|
||||
static void recreateAllXIC() {
|
||||
// NOTE: called from native within AWT_LOCK
|
||||
for (X11InputMethod im : activeInputMethods)
|
||||
im.releaseXIC();
|
||||
Map<X11InputMethod, Integer> im2ctxid = new HashMap<>(activeInputMethods.size());
|
||||
for (X11InputMethod im : activeInputMethods) {
|
||||
im2ctxid.put(im, im.releaseXIC());
|
||||
}
|
||||
if (!recreateX11InputMethod()) {
|
||||
log.warning("can't recreate X11 InputMethod");
|
||||
return;
|
||||
}
|
||||
for (X11InputMethod im : activeInputMethods) {
|
||||
if (!im.recreateXIC())
|
||||
if (!im.recreateXIC(im2ctxid.get(im)))
|
||||
log.warning("can't recreate XIC for " + im.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean recreateXIC();
|
||||
protected abstract void releaseXIC();
|
||||
protected abstract boolean recreateXIC(int ctxid);
|
||||
protected abstract int releaseXIC();
|
||||
private static native boolean recreateX11InputMethod();
|
||||
}
|
||||
|
||||
@@ -1375,21 +1375,35 @@ finally:
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_recreateXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong window, jlong pData)
|
||||
jlong window, jlong pData, jint ctxid)
|
||||
{
|
||||
// NOTE: must be called under AWT_LOCK
|
||||
return createXIC(env, (X11InputMethodData *)pData, window);
|
||||
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
|
||||
jboolean result = createXIC(env, pX11IMData, window);
|
||||
if (result) {
|
||||
if (ctxid == 1)
|
||||
pX11IMData->current_ic = pX11IMData->ic_active;
|
||||
else if (ctxid == 2)
|
||||
pX11IMData->current_ic = pX11IMData->ic_passive;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JNIEXPORT int JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_releaseXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong pData)
|
||||
{
|
||||
// NOTE: must be called under AWT_LOCK
|
||||
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
|
||||
int result = 0;
|
||||
if (pX11IMData->current_ic == pX11IMData->ic_active)
|
||||
result = 1;
|
||||
else if (pX11IMData->current_ic == pX11IMData->ic_passive)
|
||||
result = 2;
|
||||
pX11IMData->current_ic = NULL;
|
||||
destroyXInputContexts(pX11IMData);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -324,8 +324,6 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
/* GDK */
|
||||
fp_gdk_get_default_root_window =
|
||||
dl_symbol("gdk_get_default_root_window");
|
||||
fp_gdk_window_get_scale_factor =
|
||||
dl_symbol("gdk_window_get_scale_factor");
|
||||
|
||||
/* Pixbuf */
|
||||
fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new");
|
||||
@@ -400,6 +398,8 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
} else {
|
||||
fp_gdk_window_create_similar_image_surface =
|
||||
dl_symbol("gdk_window_create_similar_image_surface");
|
||||
fp_gdk_window_get_scale_factor =
|
||||
dl_symbol("gdk_window_get_scale_factor");
|
||||
}
|
||||
gtk3_version_3_14 = !fp_gtk_check_version(3, 14, 0);
|
||||
|
||||
@@ -2871,9 +2871,13 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
|
||||
jint *ary;
|
||||
|
||||
GdkWindow *root = (*fp_gdk_get_default_root_window)();
|
||||
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
|
||||
root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5));
|
||||
if (gtk3_version_3_10) {
|
||||
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
|
||||
root, x, y, (int) (width / (float) win_scale + 0.5), (int) (height / (float) win_scale + 0.5));
|
||||
} else {
|
||||
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
|
||||
}
|
||||
|
||||
if (pixbuf && scale != 1) {
|
||||
GdkPixbuf *scaledPixbuf;
|
||||
|
||||
@@ -669,7 +669,7 @@ static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
|
||||
if (parsedVal > 0)
|
||||
filteredEventsThreshold = parsedVal;
|
||||
else if (strncmp(utf8string, "true", 4) == 0)
|
||||
filteredEventsThreshold = 10;
|
||||
filteredEventsThreshold = 5;
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
|
||||
}
|
||||
|
||||
@@ -1088,17 +1088,31 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
return err;
|
||||
}
|
||||
|
||||
private volatile List<Rectangle> hitTestSpots;
|
||||
private volatile List<Rectangle> customDecorHitTestSpots;
|
||||
private volatile int customDecorTitleBarHeight = -1; // 0 can be a legal value when no title bar is expected
|
||||
|
||||
// called from client via reflection
|
||||
private void setCustomDecorationHitTestSpots(List<Rectangle> hitTestSpots) {
|
||||
this.hitTestSpots = new CopyOnWriteArrayList<>(hitTestSpots);
|
||||
this.customDecorHitTestSpots = new CopyOnWriteArrayList<>(hitTestSpots);
|
||||
}
|
||||
|
||||
// called from client via reflection
|
||||
private void setCustomDecorationTitleBarHeight(int height) {
|
||||
if (height >= 0) customDecorTitleBarHeight = height;
|
||||
}
|
||||
|
||||
// called from native
|
||||
private boolean hitTestCustomDecoration(int x, int y) {
|
||||
if (hitTestSpots == null) return false;
|
||||
for (Rectangle spot : hitTestSpots) {
|
||||
List<Rectangle> spots = customDecorHitTestSpots;
|
||||
if (spots == null) return false;
|
||||
for (Rectangle spot : spots) {
|
||||
if (spot.contains(x, y)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// called from native
|
||||
private int getCustomDecorationTitleBarHeight() {
|
||||
return customDecorTitleBarHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1716,11 +1716,20 @@ void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
|
||||
return;
|
||||
}
|
||||
Devices::InstanceAccess devices;
|
||||
AwtWin32GraphicsDevice* device = devices->GetDevice(AwtWin32GraphicsDevice::DeviceIndexForWindow(pFrame->GetHWnd()));
|
||||
HMONITOR hmon;
|
||||
if (::IsZoomed(pFrame->GetHWnd())) {
|
||||
WINDOWPLACEMENT wp;
|
||||
::GetWindowPlacement(pFrame->GetHWnd(), &wp);
|
||||
hmon = ::MonitorFromRect(&wp.rcNormalPosition, MONITOR_DEFAULTTONEAREST);
|
||||
} else {
|
||||
// this method can return wrong monitor in a zoomed state in multi-dpi env
|
||||
hmon = ::MonitorFromWindow(pFrame->GetHWnd(), MONITOR_DEFAULTTONEAREST);
|
||||
}
|
||||
AwtWin32GraphicsDevice* device = devices->GetDevice(AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hmon));
|
||||
int dpi = device ? device->GetScaleX() * 96 : 96;
|
||||
|
||||
// GetSystemMetricsForDpi gives incorrect values, use AdjustWindowRectExForDpi for border metrics instead
|
||||
RECT rect = {0};
|
||||
RECT rect = {};
|
||||
DWORD style = pFrame->IsResizable() ? WS_OVERLAPPEDWINDOW : WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;
|
||||
AwtToolkit::AdjustWindowRectExForDpi(&rect, style, FALSE, NULL, dpi);
|
||||
::SetRect(insets, -rect.left, -rect.top, rect.right, rect.bottom);
|
||||
@@ -1734,9 +1743,19 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
|
||||
GetWindowRect(frame->GetHWnd(), &rcWindow);
|
||||
|
||||
// Get the frame rectangle, adjusted for the style without a caption.
|
||||
RECT rcFrame = {0};
|
||||
RECT rcFrame = {};
|
||||
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
|
||||
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
int titleHeight = (int)JNU_CallMethodByName(env, NULL, frame->GetPeer(env),
|
||||
"getCustomDecorationTitleBarHeight", "()I",
|
||||
frame->ScaleDownX(x - rcWindow.left),
|
||||
frame->ScaleDownY(y - rcWindow.top)).i;
|
||||
if (titleHeight >= 0) {
|
||||
titleHeight = frame->ScaleUpY(titleHeight);
|
||||
insets.top = titleHeight; // otherwise leave default
|
||||
}
|
||||
|
||||
USHORT uRow = 1;
|
||||
USHORT uCol = 1;
|
||||
BOOL fOnResizeBorder = FALSE;
|
||||
@@ -1744,7 +1763,6 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
|
||||
if (y >= rcWindow.top &&
|
||||
y < rcWindow.top + insets.top)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
if (JNU_CallMethodByName(env, NULL, frame->GetPeer(env),
|
||||
"hitTestCustomDecoration", "(II)Z",
|
||||
frame->ScaleDownX(x - rcWindow.left),
|
||||
|
||||
@@ -103,16 +103,21 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
|
||||
|
||||
Type findType(String signature) throws ClassNotLoadedException {
|
||||
List<ReferenceType> types = visibleClasses();
|
||||
Iterator<ReferenceType> iter = types.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ReferenceType type = iter.next();
|
||||
|
||||
// first check already loaded classes and possibly avoid massive signature retrieval later
|
||||
String typeName = new JNITypeParser(signature).typeName();
|
||||
for (ReferenceType type : vm.classesByName(typeName)) {
|
||||
if (types.contains(type)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
for (ReferenceType type : types) {
|
||||
if (type.signature().equals(signature)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
JNITypeParser parser = new JNITypeParser(signature);
|
||||
throw new ClassNotLoadedException(parser.typeName(),
|
||||
"Class " + parser.typeName() + " not loaded");
|
||||
throw new ClassNotLoadedException(typeName, "Class " + typeName + " not loaded");
|
||||
}
|
||||
|
||||
byte typeValueKey() {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary JBR-1604 Tooltip with package's info is cut
|
||||
*/
|
||||
public class JEditorPanePreferredSizeTest2 {
|
||||
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
|
||||
final Dimension size = new Dimension();
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
JEditorPane editorPane = new JEditorPane("text/html", "text");
|
||||
editorPane.setBorder(null);
|
||||
editorPane.getPreferredSize();
|
||||
editorPane.setText("another text");
|
||||
size.setSize(editorPane.getPreferredSize());
|
||||
});
|
||||
if (size.width <= 0 || size.height <= 0) {
|
||||
throw new RuntimeException("Test FAILED: bad preferred size: " + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ java/awt/BasicStroke/DashZeroWidth.java
|
||||
java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java 8169108 windows-all
|
||||
java/awt/Choice/ChoiceGeneratesItemEvents/ChoiceGeneratesItemEvents.html 8047703 generic-all
|
||||
java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.html 6849922 macosx-all,windows-all
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,windows-all
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,windows-all,linux-all
|
||||
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all,windows-all
|
||||
java/awt/Choice/GrabLockTest/GrabLockTest.java JRE-839 windows-all,macosx-all,linux-all
|
||||
java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html 8194045 generic-all
|
||||
@@ -179,7 +179,7 @@ java/awt/Focus/NoAutotransferToDisabledCompTest/NoAutotransferToDisabledCompTest
|
||||
java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html 7124275 macosx-all
|
||||
java/awt/Focus/NonFocusableWindowTest/NoEventsTest.java 8000171 windows-all
|
||||
java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java 8169110 macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java JRE-898 macosx-all,linux-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java JRE-898 macosx-all,linux-all,windows-all
|
||||
java/awt/Focus/RequestFocusToDisabledCompTest/RequestFocusToDisabledCompTest.java JRE-898 macosx-all
|
||||
java/awt/Focus/ResetMostRecentFocusOwnerTest/ResetMostRecentFocusOwnerTest.java 8168294 macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java JRE-898 macosx-all,linux-all
|
||||
@@ -535,7 +535,7 @@ java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
|
||||
java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all
|
||||
java/awt/Mouse/ExtraMouseClick/ExtraMouseClick.html 8169534 macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java 8168388 windows-all,macosx-all,linux-all
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 8196017 windows-all,linux-all (linux: NPE commit testing)
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 8196017 windows-all,macosx-all,linux-all (macosx,linux: NPE commit testing)
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java 8052166 linux-all
|
||||
java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676,8129775 generic-all
|
||||
java/awt/Mouse/MouseModifiersUnitTest/ExtraButtonDrag.java 8013428 generic-all
|
||||
@@ -557,7 +557,7 @@ java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java
|
||||
java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java 8196018 windows-all,linux-all
|
||||
java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java 8061235,8159592,8134231 macosx-all,windows-all,linux-all
|
||||
java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java 8203004 linux-all
|
||||
java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java 8213120 macosx-all,linux-4.15.0-45-generic (kubuntu)
|
||||
java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java 8213120 macosx-all,linux-all, windows-all (windows, linux - time out)
|
||||
java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java 8196300 windows-all
|
||||
java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java 8169533 macosx-all,windows-all
|
||||
java/awt/Toolkit/DesktopProperties/rfe4758438.java 8193547 linux-all
|
||||
@@ -904,7 +904,7 @@ javax/sound/midi/Sequencer/Recording.java
|
||||
# jdk_swing
|
||||
|
||||
com/sun/java/swing/plaf/windows/Test8173145.java 8198334 windows-all
|
||||
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all
|
||||
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all,linux-all
|
||||
javax/swing/Action/8133039/bug8133039.java 8196089 windows-all,macosx-all
|
||||
javax/swing/JButton/4368790/bug4368790.java 8065582 macosx-all
|
||||
javax/swing/JButton/8151303/PressedIconTest.java 8198689 macosx-all,windows-all (windows: commit testing)
|
||||
@@ -974,7 +974,7 @@ javax/swing/JMenuItem/4171437/bug4171437.java
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java 8172536 macosx-all,windows-all,linux-all
|
||||
javax/swing/JMenuItem/6209975/bug6209975.java 8204062 macosx-all,windows-all
|
||||
javax/swing/JMenuItem/6249972/bug6249972.java 8197552 macosx-all,windows-all,linux-all
|
||||
javax/swing/JPopupMenu/4458079/bug4458079.java 8040917 macosx-all
|
||||
javax/swing/JPopupMenu/4458079/bug4458079.java 8040917 macosx-all,windows-all
|
||||
javax/swing/JPopupMenu/4769039/bug4769039.java 8194045 generic-all
|
||||
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
|
||||
javax/swing/JPopupMenu/4966112/bug4966112.java 8064915,7151826 macosx-all,linux-all
|
||||
|
||||
@@ -29,7 +29,6 @@ java/awt/Focus/NonFocusableResizableTooSmall/NonFocusableResizableTooSmall.java
|
||||
java/awt/Focus/NonFocusableWindowTest/NonfocusableOwnerTest.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java nobug macosx-all
|
||||
java/awt/Focus/RequestFocusAndHideTest/RequestFocusAndHideTest.java nobug macosx-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java nobug linux-all,windows-all reproduced with Adopt, OpenJDK
|
||||
java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java nobug macosx-all,windows-all
|
||||
java/awt/Frame/8158918/SetExtendedState.java nobug linux-all
|
||||
java/awt/Frame/FrameLocation/FrameLocation.java nobug linux-all
|
||||
@@ -58,8 +57,6 @@ java/awt/List/ItemEventTest/ItemEventTest.java
|
||||
java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java nobug macosx-all,windows-all
|
||||
java/awt/List/ListGarbageCollectionTest/AwtListGarbageCollectionTest.java nobug linux-all
|
||||
java/awt/Menu/NullMenuLabelTest/NullMenuLabelTest.java nobug linux-all
|
||||
java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/HWDisappear.java nobug macosx-all,windows-all
|
||||
java/awt/Mixing/JButtonInGlassPane.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mixing/LWComboBox.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -70,6 +67,7 @@ java/awt/Mixing/Validating.java
|
||||
java/awt/Modal/LWModalTest/LWModalTest.java nobug macosx-all,windows-all
|
||||
java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java nobug macosx-all,windows-all
|
||||
java/awt/Modal/ToBack/ToBackModeless6Test.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.java nobug macosx-all,linux-all
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Mouse/MouseWheelAbsXY/MouseWheelAbsXY.java nobug macosx-all,windows-all
|
||||
@@ -95,14 +93,14 @@ java/awt/Toolkit/RealSync/Test.java
|
||||
java/awt/Toolkit/SunDisplayChangerLeakTest/SunDisplayChangerLeakTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java nobug macosx-all,windows-all
|
||||
java/awt/Window/ChangeWindowResizabilty/ChangeWindowResizabiltyTest.java nobug windows-all,linux-all
|
||||
java/awt/Window/FindOwner/FindOwnerTest.html nobug macosx-all,windows-all
|
||||
java/awt/Window/FindOwner/FindOwnerTest.html nobug macosx-all,windows-all,linux-all
|
||||
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java nobug macosx-all
|
||||
java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java nobug macosx-all,linux-all
|
||||
java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java nobug linux-all
|
||||
java/awt/Window/ScreenLocation/ScreenLocationTest.java nobug linux-all
|
||||
java/awt/Window/SetWindowLocationByPlatformTest/SetWindowLocationByPlatformTest.java nobug linux-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java nobug windows-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/Translucent.java nobug windows-all,macosx-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/WindowOpacity.java nobug windows-all
|
||||
java/awt/Window/TopLevelLocation/TopLevelLocation.java nobug linux-all,macosx-all
|
||||
java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java nobug macosx-all
|
||||
@@ -125,7 +123,6 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
|
||||
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java nobug macosx-all,windows-all
|
||||
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.html nobug linux-all,windows-all
|
||||
java/awt/event/KeyEvent/RobotCrash/RobotCrash.java nobug linux-all,windows-all
|
||||
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java nobug macosx-all,linux-all
|
||||
java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java nobug macosx-all,windows-all,linux-all
|
||||
java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java nobug macosx-all,windows-all
|
||||
java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -154,8 +151,9 @@ java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsT
|
||||
java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java nobug windows-all,linux-all
|
||||
|
||||
javax/swing/JComboBox/4199622/bug4199622.java nobug windows-all
|
||||
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all
|
||||
javax/swing/JDialog/Transparency/TransparencyTest.java nobug macosx-all,windows-all
|
||||
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all,linux-all
|
||||
javax/swing/JComponent/6989617/bug6989617.java nobug macosx-all
|
||||
javax/swing/JDialog/Transparency/TransparencyTest.java nobug linux-all,macosx-all,windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest.java nobug windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest_i18n.java nobug windows-all
|
||||
javax/swing/JFileChooser/6489130/bug6489130.java nobug macosx-all
|
||||
@@ -176,7 +174,6 @@ javax/swing/JMenu/6538132/bug6538132.java
|
||||
javax/swing/JMenuItem/8139169/ScreenMenuBarInputTwice.java nobug macosx-all
|
||||
javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java nobug windows-all
|
||||
javax/swing/JOptionPane/6428694/bug6428694.java nobug windows-all
|
||||
javax/swing/JPopupMenu/4458079/bug4458079.java nobug windows-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java nobug windows-all
|
||||
javax/swing/JPopupMenu/6544309/bug6544309.java nobug linux-all,windows-all
|
||||
javax/swing/JPopupMenu/6827786/bug6827786.java nobug windows-all
|
||||
@@ -186,6 +183,7 @@ javax/swing/JScrollBar/7163696/Test7163696.java
|
||||
javax/swing/JScrollBar/bug4202954/bug4202954.java nobug windows-all
|
||||
javax/swing/JSlider/6401380/bug6401380.java nobug windows-all
|
||||
javax/swing/JTabbedPane/7161568/bug7161568.java nobug windows-all
|
||||
javax/swing/JTabbedPane/7170310/bug7170310.java nobug macosx-all,linux-all
|
||||
javax/swing/JTextArea/8149849/DNDTextToScaledArea.java nobug windows-all
|
||||
javax/swing/JToolTip/6219960/bug6219960.java nobug macosx-all,windows-all
|
||||
javax/swing/JTree/4633594/JTreeFocusTest.java nobug macosx-all,windows-all
|
||||
|
||||
Reference in New Issue
Block a user