Merge
This commit is contained in:
commit
45f0337485
@ -44,7 +44,6 @@
|
|||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
#include <objc/objc-runtime.h>
|
#include <objc/objc-runtime.h>
|
||||||
#include <objc/objc-auto.h>
|
#include <objc/objc-auto.h>
|
||||||
#include <dispatch/dispatch.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
@ -1001,6 +1000,32 @@ SetXStartOnFirstThreadArg()
|
|||||||
setenv(envVar, "1", 1);
|
setenv(envVar, "1", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This class is made for performSelectorOnMainThread when java main
|
||||||
|
* should be launched on main thread.
|
||||||
|
* We cannot use dispatch_sync here, because it blocks the main dispatch queue
|
||||||
|
* which is used inside Cocoa
|
||||||
|
*/
|
||||||
|
@interface JavaLaunchHelper : NSObject {
|
||||||
|
int _returnValue;
|
||||||
|
}
|
||||||
|
- (void) launchJava:(NSValue*)argsValue;
|
||||||
|
- (int) getReturnValue;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation JavaLaunchHelper
|
||||||
|
|
||||||
|
- (void) launchJava:(NSValue*)argsValue
|
||||||
|
{
|
||||||
|
_returnValue = JavaMain([argsValue pointerValue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getReturnValue
|
||||||
|
{
|
||||||
|
return _returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
// MacOSX we may continue in the same thread
|
// MacOSX we may continue in the same thread
|
||||||
int
|
int
|
||||||
JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
||||||
@ -1010,16 +1035,22 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
|||||||
JLI_TraceLauncher("In same thread\n");
|
JLI_TraceLauncher("In same thread\n");
|
||||||
// need to block this thread against the main thread
|
// need to block this thread against the main thread
|
||||||
// so signals get caught correctly
|
// so signals get caught correctly
|
||||||
__block int rslt;
|
JavaMainArgs args;
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^(void) {
|
args.argc = argc;
|
||||||
JavaMainArgs args;
|
args.argv = argv;
|
||||||
args.argc = argc;
|
args.mode = mode;
|
||||||
args.argv = argv;
|
args.what = what;
|
||||||
args.mode = mode;
|
args.ifn = *ifn;
|
||||||
args.what = what;
|
int rslt;
|
||||||
args.ifn = *ifn;
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
rslt = JavaMain((void*)&args);
|
{
|
||||||
});
|
JavaLaunchHelper* launcher = [[[JavaLaunchHelper alloc] init] autorelease];
|
||||||
|
[launcher performSelectorOnMainThread:@selector(launchJava:)
|
||||||
|
withObject:[NSValue valueWithPointer:(void*)&args]
|
||||||
|
waitUntilDone:YES];
|
||||||
|
rslt = [launcher getReturnValue];
|
||||||
|
}
|
||||||
|
[pool drain];
|
||||||
return rslt;
|
return rslt;
|
||||||
} else {
|
} else {
|
||||||
return ContinueInNewThread(ifn, threadStackSize, argc, argv, mode, what, ret);
|
return ContinueInNewThread(ifn, threadStackSize, argc, argv, mode, what, ret);
|
||||||
|
@ -38,7 +38,7 @@ final class CDropTargetContextPeer extends SunDropTargetContextPeer {
|
|||||||
private long fNativeDropTransfer = 0;
|
private long fNativeDropTransfer = 0;
|
||||||
private long fNativeDataAvailable = 0;
|
private long fNativeDataAvailable = 0;
|
||||||
private Object fNativeData = null;
|
private Object fNativeData = null;
|
||||||
private boolean insideTarget = false;
|
private boolean insideTarget = true;
|
||||||
|
|
||||||
Object awtLockAccess = new Object();
|
Object awtLockAccess = new Object();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -115,6 +115,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
|
|
||||||
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
|
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
|
||||||
static final int NONACTIVATING = 1 << 24;
|
static final int NONACTIVATING = 1 << 24;
|
||||||
|
static final int IS_DIALOG = 1 << 25;
|
||||||
|
static final int IS_MODAL = 1 << 26;
|
||||||
|
|
||||||
static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
|
static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
|
||||||
|
|
||||||
@ -374,6 +376,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDialog) {
|
||||||
|
styleBits = SET(styleBits, IS_DIALOG, true);
|
||||||
|
if (((Dialog) target).isModal()) {
|
||||||
|
styleBits = SET(styleBits, IS_MODAL, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
peer.setTextured(IS(TEXTURED, styleBits));
|
peer.setTextured(IS(TEXTURED, styleBits));
|
||||||
|
|
||||||
return styleBits;
|
return styleBits;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -536,8 +536,12 @@ AWT_ASSERT_APPKIT_THREAD;
|
|||||||
- (void) windowDidBecomeKey: (NSNotification *) notification {
|
- (void) windowDidBecomeKey: (NSNotification *) notification {
|
||||||
AWT_ASSERT_APPKIT_THREAD;
|
AWT_ASSERT_APPKIT_THREAD;
|
||||||
[AWTToolkit eventCountPlusPlus];
|
[AWTToolkit eventCountPlusPlus];
|
||||||
[CMenuBar activate:self.javaMenuBar modallyDisabled:NO];
|
|
||||||
AWTWindow *opposite = [AWTWindow lastKeyWindow];
|
AWTWindow *opposite = [AWTWindow lastKeyWindow];
|
||||||
|
if (!IS(self.styleBits, IS_DIALOG)) {
|
||||||
|
[CMenuBar activate:self.javaMenuBar modallyDisabled:NO];
|
||||||
|
} else if (IS(self.styleBits, IS_MODAL)) {
|
||||||
|
[CMenuBar activate:opposite->javaMenuBar modallyDisabled:YES];
|
||||||
|
}
|
||||||
[AWTWindow setLastKeyWindow:nil];
|
[AWTWindow setLastKeyWindow:nil];
|
||||||
|
|
||||||
[self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
|
[self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,6 +24,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.sun.beans.finder;
|
package com.sun.beans.finder;
|
||||||
|
|
||||||
|
import java.lang.reflect.Executable;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -37,7 +40,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sergey A. Malenkov
|
* @author Sergey A. Malenkov
|
||||||
*/
|
*/
|
||||||
abstract class AbstractFinder<T> {
|
abstract class AbstractFinder<T extends Executable> {
|
||||||
private final Class<?>[] args;
|
private final Class<?>[] args;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,27 +55,6 @@ abstract class AbstractFinder<T> {
|
|||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of {@code Class} objects
|
|
||||||
* that represent the formal parameter types of the method.
|
|
||||||
* Returns an empty array if the method takes no parameters.
|
|
||||||
*
|
|
||||||
* @param method the object that represents method
|
|
||||||
* @return the parameter types of the method
|
|
||||||
*/
|
|
||||||
protected abstract Class<?>[] getParameters(T method);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns {@code true} if and only if the method
|
|
||||||
* was declared to take a variable number of arguments.
|
|
||||||
*
|
|
||||||
* @param method the object that represents method
|
|
||||||
* @return {@code true} if the method was declared
|
|
||||||
* to take a variable number of arguments;
|
|
||||||
* {@code false} otherwise
|
|
||||||
*/
|
|
||||||
protected abstract boolean isVarArgs(T method);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks validness of the method.
|
* Checks validness of the method.
|
||||||
* At least the valid method should be public.
|
* At least the valid method should be public.
|
||||||
@ -81,7 +63,9 @@ abstract class AbstractFinder<T> {
|
|||||||
* @return {@code true} if the method is valid,
|
* @return {@code true} if the method is valid,
|
||||||
* {@code false} otherwise
|
* {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
protected abstract boolean isValid(T method);
|
protected boolean isValid(T method) {
|
||||||
|
return Modifier.isPublic(method.getModifiers());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a search in the {@code methods} array.
|
* Performs a search in the {@code methods} array.
|
||||||
@ -109,7 +93,7 @@ abstract class AbstractFinder<T> {
|
|||||||
|
|
||||||
for (T newMethod : methods) {
|
for (T newMethod : methods) {
|
||||||
if (isValid(newMethod)) {
|
if (isValid(newMethod)) {
|
||||||
Class<?>[] newParams = getParameters(newMethod);
|
Class<?>[] newParams = newMethod.getParameterTypes();
|
||||||
if (newParams.length == this.args.length) {
|
if (newParams.length == this.args.length) {
|
||||||
PrimitiveWrapperMap.replacePrimitivesWithWrappers(newParams);
|
PrimitiveWrapperMap.replacePrimitivesWithWrappers(newParams);
|
||||||
if (isAssignable(newParams, this.args)) {
|
if (isAssignable(newParams, this.args)) {
|
||||||
@ -120,6 +104,11 @@ abstract class AbstractFinder<T> {
|
|||||||
boolean useNew = isAssignable(oldParams, newParams);
|
boolean useNew = isAssignable(oldParams, newParams);
|
||||||
boolean useOld = isAssignable(newParams, oldParams);
|
boolean useOld = isAssignable(newParams, oldParams);
|
||||||
|
|
||||||
|
if (useOld && useNew) {
|
||||||
|
// only if parameters are equal
|
||||||
|
useNew = !newMethod.isSynthetic();
|
||||||
|
useOld = !oldMethod.isSynthetic();
|
||||||
|
}
|
||||||
if (useOld == useNew) {
|
if (useOld == useNew) {
|
||||||
ambiguous = true;
|
ambiguous = true;
|
||||||
} else if (useNew) {
|
} else if (useNew) {
|
||||||
@ -130,7 +119,7 @@ abstract class AbstractFinder<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isVarArgs(newMethod)) {
|
if (newMethod.isVarArgs()) {
|
||||||
int length = newParams.length - 1;
|
int length = newParams.length - 1;
|
||||||
if (length <= this.args.length) {
|
if (length <= this.args.length) {
|
||||||
Class<?>[] array = new Class<?>[this.args.length];
|
Class<?>[] array = new Class<?>[this.args.length];
|
||||||
@ -160,6 +149,11 @@ abstract class AbstractFinder<T> {
|
|||||||
boolean useNew = isAssignable(oldParams, newParams);
|
boolean useNew = isAssignable(oldParams, newParams);
|
||||||
boolean useOld = isAssignable(newParams, oldParams);
|
boolean useOld = isAssignable(newParams, oldParams);
|
||||||
|
|
||||||
|
if (useOld && useNew) {
|
||||||
|
// only if parameters are equal
|
||||||
|
useNew = !newMethod.isSynthetic();
|
||||||
|
useOld = !oldMethod.isSynthetic();
|
||||||
|
}
|
||||||
if (useOld == useNew) {
|
if (useOld == useNew) {
|
||||||
if (oldParams == map.get(oldMethod)) {
|
if (oldParams == map.get(oldMethod)) {
|
||||||
ambiguous = true;
|
ambiguous = true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -86,44 +86,4 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
|
|||||||
private ConstructorFinder(Class<?>[] args) {
|
private ConstructorFinder(Class<?>[] args) {
|
||||||
super(args);
|
super(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of {@code Class} objects
|
|
||||||
* that represent the formal parameter types of the constructor.
|
|
||||||
* Returns an empty array if the constructor takes no parameters.
|
|
||||||
*
|
|
||||||
* @param constructor the object that represents constructor
|
|
||||||
* @return the parameter types of the constructor
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Class<?>[] getParameters(Constructor<?> constructor) {
|
|
||||||
return constructor.getParameterTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns {@code true} if and only if the constructor
|
|
||||||
* was declared to take a variable number of arguments.
|
|
||||||
*
|
|
||||||
* @param constructor the object that represents constructor
|
|
||||||
* @return {@code true} if the constructor was declared
|
|
||||||
* to take a variable number of arguments;
|
|
||||||
* {@code false} otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected boolean isVarArgs(Constructor<?> constructor) {
|
|
||||||
return constructor.isVarArgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks validness of the constructor.
|
|
||||||
* The valid constructor should be public.
|
|
||||||
*
|
|
||||||
* @param constructor the object that represents constructor
|
|
||||||
* @return {@code true} if the constructor is valid,
|
|
||||||
* {@code false} otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected boolean isValid(Constructor<?> constructor) {
|
|
||||||
return Modifier.isPublic(constructor.getModifiers());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -195,33 +195,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of {@code Class} objects
|
|
||||||
* that represent the formal parameter types of the method.
|
|
||||||
* Returns an empty array if the method takes no parameters.
|
|
||||||
*
|
|
||||||
* @param method the object that represents method
|
|
||||||
* @return the parameter types of the method
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Class<?>[] getParameters(Method method) {
|
|
||||||
return method.getParameterTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns {@code true} if and only if the method
|
|
||||||
* was declared to take a variable number of arguments.
|
|
||||||
*
|
|
||||||
* @param method the object that represents method
|
|
||||||
* @return {@code true} if the method was declared
|
|
||||||
* to take a variable number of arguments;
|
|
||||||
* {@code false} otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected boolean isVarArgs(Method method) {
|
|
||||||
return method.isVarArgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks validness of the method.
|
* Checks validness of the method.
|
||||||
* The valid method should be public and
|
* The valid method should be public and
|
||||||
@ -233,6 +206,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValid(Method method) {
|
protected boolean isValid(Method method) {
|
||||||
return !method.isBridge() && Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name);
|
return super.isValid(method) && method.getName().equals(this.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import javax.accessibility.*;
|
|||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,6 +129,11 @@ public class JToolTip extends JComponent implements Accessible {
|
|||||||
String oldValue = this.tipText;
|
String oldValue = this.tipText;
|
||||||
this.tipText = tipText;
|
this.tipText = tipText;
|
||||||
firePropertyChange("tiptext", oldValue, tipText);
|
firePropertyChange("tiptext", oldValue, tipText);
|
||||||
|
|
||||||
|
if (!Objects.equals(oldValue, tipText)) {
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1174,6 +1174,7 @@ public abstract class View implements SwingConstants {
|
|||||||
// formed by added elements (i.e. they will be updated
|
// formed by added elements (i.e. they will be updated
|
||||||
// by initialization.
|
// by initialization.
|
||||||
index0 = Math.max(index0, 0);
|
index0 = Math.max(index0, 0);
|
||||||
|
index1 = getViewIndex(elem.getDocument().getLength(), Position.Bias.Forward);
|
||||||
for (int i = index0; i <= index1; i++) {
|
for (int i = index0; i <= index1; i++) {
|
||||||
if (! ((i >= hole0) && (i <= hole1))) {
|
if (! ((i >= hole0) && (i <= hole1))) {
|
||||||
v = getView(i);
|
v = getView(i);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1980,11 +1980,12 @@ class Parser implements DTDConstants {
|
|||||||
|
|
||||||
void parseScript() throws IOException {
|
void parseScript() throws IOException {
|
||||||
char[] charsToAdd = new char[SCRIPT_END_TAG.length];
|
char[] charsToAdd = new char[SCRIPT_END_TAG.length];
|
||||||
|
boolean insideComment = false;
|
||||||
|
|
||||||
/* Here, ch should be the first character after <script> */
|
/* Here, ch should be the first character after <script> */
|
||||||
while (true) {
|
while (true) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < SCRIPT_END_TAG.length
|
while (!insideComment && i < SCRIPT_END_TAG.length
|
||||||
&& (SCRIPT_END_TAG[i] == ch
|
&& (SCRIPT_END_TAG[i] == ch
|
||||||
|| SCRIPT_END_TAG_UPPER_CASE[i] == ch)) {
|
|| SCRIPT_END_TAG_UPPER_CASE[i] == ch)) {
|
||||||
charsToAdd[i] = (char) ch;
|
charsToAdd[i] = (char) ch;
|
||||||
@ -2025,6 +2026,13 @@ class Parser implements DTDConstants {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
addString(ch);
|
addString(ch);
|
||||||
|
String str = new String(getChars(0, strpos));
|
||||||
|
if (!insideComment && str.endsWith(START_COMMENT)) {
|
||||||
|
insideComment = true;
|
||||||
|
}
|
||||||
|
if (insideComment && str.endsWith(END_COMMENT)) {
|
||||||
|
insideComment = false;
|
||||||
|
}
|
||||||
ch = readCh();
|
ch = readCh();
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -190,7 +190,7 @@ class MotifDnDConstants {
|
|||||||
try {
|
try {
|
||||||
Native.putLong(data, motifWindow);
|
Native.putLong(data, motifWindow);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
||||||
defaultRootWindow,
|
defaultRootWindow,
|
||||||
XA_MOTIF_DRAG_WINDOW.getAtom(),
|
XA_MOTIF_DRAG_WINDOW.getAtom(),
|
||||||
@ -198,10 +198,10 @@ class MotifDnDConstants {
|
|||||||
XConstants.PropModeReplace,
|
XConstants.PropModeReplace,
|
||||||
data, 1);
|
data, 1);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write motif drag window handle.");
|
throw new XException("Cannot write motif drag window handle.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ class MotifDnDConstants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
||||||
motifWindow,
|
motifWindow,
|
||||||
XA_MOTIF_DRAG_TARGETS.getAtom(),
|
XA_MOTIF_DRAG_TARGETS.getAtom(),
|
||||||
@ -402,15 +402,15 @@ class MotifDnDConstants {
|
|||||||
XConstants.PropModeReplace,
|
XConstants.PropModeReplace,
|
||||||
data, tableSize);
|
data, tableSize);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
|
|
||||||
// Create a new motif window and retry.
|
// Create a new motif window and retry.
|
||||||
motifWindow = createMotifWindow();
|
motifWindow = createMotifWindow();
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
|
||||||
motifWindow,
|
motifWindow,
|
||||||
XA_MOTIF_DRAG_TARGETS.getAtom(),
|
XA_MOTIF_DRAG_TARGETS.getAtom(),
|
||||||
@ -418,10 +418,10 @@ class MotifDnDConstants {
|
|||||||
XConstants.PropModeReplace,
|
XConstants.PropModeReplace,
|
||||||
data, tableSize);
|
data, tableSize);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write motif drag targets property.");
|
throw new XException("Cannot write motif drag targets property.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,16 +534,16 @@ class MotifDnDConstants {
|
|||||||
// CARD32 icc_handle
|
// CARD32 icc_handle
|
||||||
unsafe.putInt(structData + 4, (int)XA_MOTIF_ATOM_0.getAtom());
|
unsafe.putInt(structData + 4, (int)XA_MOTIF_ATOM_0.getAtom());
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
|
||||||
XA_MOTIF_ATOM_0.getAtom(),
|
XA_MOTIF_ATOM_0.getAtom(),
|
||||||
XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
|
XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
|
||||||
8, XConstants.PropModeReplace,
|
8, XConstants.PropModeReplace,
|
||||||
structData, MOTIF_INITIATOR_INFO_SIZE);
|
structData, MOTIF_INITIATOR_INFO_SIZE);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write drag initiator info");
|
throw new XException("Cannot write drag initiator info");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -567,16 +567,16 @@ class MotifDnDConstants {
|
|||||||
unsafe.putShort(data + 10, (short)0); /* pad */
|
unsafe.putShort(data + 10, (short)0); /* pad */
|
||||||
unsafe.putInt(data + 12, dataSize);
|
unsafe.putInt(data + 12, dataSize);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
|
||||||
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
8, XConstants.PropModeReplace,
|
8, XConstants.PropModeReplace,
|
||||||
data, dataSize);
|
data, dataSize);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write Motif receiver info property");
|
throw new XException("Cannot write Motif receiver info property");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -162,16 +162,16 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
unsafe.putInt(data + 12, dataSize);
|
unsafe.putInt(data + 12, dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
|
||||||
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
8, XConstants.PropModeReplace,
|
8, XConstants.PropModeReplace,
|
||||||
data, dataSize);
|
data, dataSize);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write Motif receiver info property");
|
throw new XException("Cannot write Motif receiver info property");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -236,16 +236,16 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
|
|
||||||
unsafe.putInt(data + 4, tproxy);
|
unsafe.putInt(data + 4, tproxy);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
|
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
|
||||||
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
|
||||||
8, XConstants.PropModeReplace,
|
8, XConstants.PropModeReplace,
|
||||||
data, dataSize);
|
data, dataSize);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write Motif receiver info property");
|
throw new XException("Cannot write Motif receiver info property");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,15 +412,15 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
*/
|
*/
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
source_win, wattr.pData);
|
source_win, wattr.pData);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
throw new XException("XGetWindowAttributes failed");
|
throw new XException("XGetWindowAttributes failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,15 +429,15 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
wattr.dispose();
|
wattr.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
|
||||||
source_win_mask |
|
source_win_mask |
|
||||||
XConstants.StructureNotifyMask);
|
XConstants.StructureNotifyMask);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("XSelectInput failed");
|
throw new XException("XSelectInput failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,10 +1024,10 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
if (sourceWindow != 0) {
|
if (sourceWindow != 0) {
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
|
||||||
sourceWindowMask);
|
sourceWindowMask);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
} finally {
|
} finally {
|
||||||
XToolkit.awtUnlock();
|
XToolkit.awtUnlock();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -99,7 +99,7 @@ public class WindowPropertyGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.WITH_XERROR_HANDLER(errorHandler);
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
|
||||||
}
|
}
|
||||||
Native.putLong(data, 0);
|
Native.putLong(data, 0);
|
||||||
int status = XlibWrapper.XGetWindowProperty(XToolkit.getDisplay(), window, property.getAtom(),
|
int status = XlibWrapper.XGetWindowProperty(XToolkit.getDisplay(), window, property.getAtom(),
|
||||||
@ -112,7 +112,7 @@ public class WindowPropertyGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -674,4 +674,9 @@ final public class XConstants {
|
|||||||
public static final long XkbModifierMapMask = (1L<<2);
|
public static final long XkbModifierMapMask = (1L<<2);
|
||||||
public static final long XkbVirtualModsMask = (1L<<6); //server map
|
public static final long XkbVirtualModsMask = (1L<<6); //server map
|
||||||
|
|
||||||
|
/*****************************************************************
|
||||||
|
* X SHARED MEMORY EXTENSION FUNCTIONS
|
||||||
|
*****************************************************************/
|
||||||
|
|
||||||
|
public static final int X_ShmAttach = 1;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -96,14 +96,14 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
|
|||||||
action_count++;
|
action_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndActionList.setAtomData(window,
|
XDnDConstants.XA_XdndActionList.setAtomData(window,
|
||||||
XAtom.XA_ATOM,
|
XAtom.XA_ATOM,
|
||||||
data, action_count);
|
data, action_count);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error) != null &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
cleanup();
|
cleanup();
|
||||||
throw new XException("Cannot write XdndActionList property");
|
throw new XException("Cannot write XdndActionList property");
|
||||||
}
|
}
|
||||||
@ -117,14 +117,14 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
|
|||||||
try {
|
try {
|
||||||
Native.put(data, formats);
|
Native.put(data, formats);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndTypeList.setAtomData(window,
|
XDnDConstants.XA_XdndTypeList.setAtomData(window,
|
||||||
XAtom.XA_ATOM,
|
XAtom.XA_ATOM,
|
||||||
data, formats.length);
|
data, formats.length);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
cleanup();
|
cleanup();
|
||||||
throw new XException("Cannot write XdndActionList property");
|
throw new XException("Cannot write XdndActionList property");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -88,12 +88,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
try {
|
try {
|
||||||
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
|
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1);
|
XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("Cannot write XdndAware property");
|
throw new XException("Cannot write XdndAware property");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -205,54 +205,50 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
|
|
||||||
/* The proxy window must have the XdndAware set, as XDnD protocol
|
/* The proxy window must have the XdndAware set, as XDnD protocol
|
||||||
prescribes to check the proxy window for XdndAware. */
|
prescribes to check the proxy window for XdndAware. */
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM,
|
XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndAware property");
|
throw new XException("Cannot write XdndAware property");
|
||||||
}
|
}
|
||||||
|
|
||||||
Native.putLong(data, 0, newProxy);
|
Native.putLong(data, 0, newProxy);
|
||||||
|
|
||||||
/* The proxy window must have the XdndProxy set to point to itself.*/
|
/* The proxy window must have the XdndProxy set to point to itself.*/
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW,
|
XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndProxy property");
|
throw new XException("Cannot write XdndProxy property");
|
||||||
}
|
}
|
||||||
|
|
||||||
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
|
Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
|
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndAware property");
|
throw new XException("Cannot write XdndAware property");
|
||||||
}
|
}
|
||||||
|
|
||||||
Native.putLong(data, 0, newProxy);
|
Native.putLong(data, 0, newProxy);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
|
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndProxy property");
|
throw new XException("Cannot write XdndProxy property");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -278,27 +274,25 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
try {
|
try {
|
||||||
Native.putLong(data, 0, entry.getVersion());
|
Native.putLong(data, 0, entry.getVersion());
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
|
XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndAware property");
|
throw new XException("Cannot write XdndAware property");
|
||||||
}
|
}
|
||||||
|
|
||||||
Native.putLong(data, 0, (int)entry.getProxy());
|
Native.putLong(data, 0, (int)entry.getProxy());
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
|
XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
|
||||||
data, 1);
|
data, 1);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() !=
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
XConstants.Success) {
|
|
||||||
throw new XException("Cannot write XdndProxy property");
|
throw new XException("Cannot write XdndProxy property");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -541,15 +535,15 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
*/
|
*/
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
source_win, wattr.pData);
|
source_win, wattr.pData);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
throw new XException("XGetWindowAttributes failed");
|
throw new XException("XGetWindowAttributes failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,15 +552,15 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
wattr.dispose();
|
wattr.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
|
||||||
source_win_mask |
|
source_win_mask |
|
||||||
XConstants.StructureNotifyMask);
|
XConstants.StructureNotifyMask);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("XSelectInput failed");
|
throw new XException("XSelectInput failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -963,10 +957,10 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
if (sourceWindow != 0) {
|
if (sourceWindow != 0) {
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
|
||||||
sourceWindowMask);
|
sourceWindowMask);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
} finally {
|
} finally {
|
||||||
XToolkit.awtUnlock();
|
XToolkit.awtUnlock();
|
||||||
}
|
}
|
||||||
@ -1111,15 +1105,15 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
|
|||||||
|
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(),
|
XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(),
|
||||||
XAtom.XA_ATOM,
|
XAtom.XA_ATOM,
|
||||||
wpg.getData(),
|
wpg.getData(),
|
||||||
wpg.getNumberOfItems());
|
wpg.getNumberOfItems());
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
if (logger.isLoggable(PlatformLogger.WARNING)) {
|
if (logger.isLoggable(PlatformLogger.WARNING)) {
|
||||||
logger.warning("Cannot set XdndTypeList on the proxy window");
|
logger.warning("Cannot set XdndTypeList on the proxy window");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -181,15 +181,15 @@ abstract class XDragSourceProtocol {
|
|||||||
long time) {
|
long time) {
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
targetWindow, wattr.pData);
|
targetWindow, wattr.pData);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
throw new XException("XGetWindowAttributes failed");
|
throw new XException("XGetWindowAttributes failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,15 +198,15 @@ abstract class XDragSourceProtocol {
|
|||||||
wattr.dispose();
|
wattr.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
|
||||||
targetWindowMask |
|
targetWindowMask |
|
||||||
XConstants.StructureNotifyMask);
|
XConstants.StructureNotifyMask);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("XSelectInput failed");
|
throw new XException("XSelectInput failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,10 +214,10 @@ abstract class XDragSourceProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected final void finalizeDrop() {
|
protected final void finalizeDrop() {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
|
||||||
targetWindowMask);
|
targetWindowMask);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean processProxyModeEvent(XClientMessageEvent xclient,
|
public abstract boolean processProxyModeEvent(XClientMessageEvent xclient,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -168,14 +168,14 @@ final class XDropTargetRegistry {
|
|||||||
if (dest_x >= 0 && dest_y >= 0) {
|
if (dest_x >= 0 && dest_y >= 0) {
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
window, wattr.pData);
|
window, wattr.pData);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,14 +222,14 @@ final class XDropTargetRegistry {
|
|||||||
long event_mask = 0;
|
long event_mask = 0;
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
embedder, wattr.pData);
|
embedder, wattr.pData);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
throw new XException("XGetWindowAttributes failed");
|
throw new XException("XGetWindowAttributes failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,13 +240,13 @@ final class XDropTargetRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
|
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
|
||||||
event_mask | XConstants.PropertyChangeMask);
|
event_mask | XConstants.PropertyChangeMask);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("XSelectInput failed");
|
throw new XException("XSelectInput failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,13 +394,13 @@ final class XDropTargetRegistry {
|
|||||||
|
|
||||||
/* Restore the original event mask for the embedder. */
|
/* Restore the original event mask for the embedder. */
|
||||||
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
|
if ((event_mask & XConstants.PropertyChangeMask) == 0) {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
|
||||||
event_mask);
|
event_mask);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null &&
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
throw new XException("XSelectInput failed");
|
throw new XException("XSelectInput failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -301,15 +301,15 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
|
|||||||
try {
|
try {
|
||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
xembed.handle, wattr.pData);
|
xembed.handle, wattr.pData);
|
||||||
|
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (status == 0 ||
|
if ((status == 0) ||
|
||||||
(XToolkit.saved_error != null &&
|
((XErrorHandlerUtil.saved_error != null) &&
|
||||||
XToolkit.saved_error.get_error_code() != XConstants.Success)) {
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -38,7 +38,30 @@ public abstract class XErrorHandler {
|
|||||||
public static class XBaseErrorHandler extends XErrorHandler {
|
public static class XBaseErrorHandler extends XErrorHandler {
|
||||||
@Override
|
@Override
|
||||||
public int handleError(long display, XErrorEvent err) {
|
public int handleError(long display, XErrorEvent err) {
|
||||||
return XToolkit.SAVED_ERROR_HANDLER(display, err);
|
return XErrorHandlerUtil.SAVED_XERROR_HANDLER(display, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a base synthetic error handler containing a boolean flag which allows
|
||||||
|
* to show that an error is handled or not.
|
||||||
|
*/
|
||||||
|
public static class XErrorHandlerWithFlag extends XBaseErrorHandler {
|
||||||
|
private volatile boolean errorOccurred = false;
|
||||||
|
|
||||||
|
public boolean getErrorOccurredFlag() {
|
||||||
|
return errorOccurred;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an internal boolean flag to a particular value. Should be always called with
|
||||||
|
* <code>false</code> value of the parameter <code>errorOccurred</code> before this
|
||||||
|
* error handler is set as current.
|
||||||
|
* @param errorOccurred <code>true</code> to indicate that an error was handled,
|
||||||
|
* <code>false</code> to reset the internal boolean flag
|
||||||
|
*/
|
||||||
|
public void setErrorOccurredFlag(boolean errorOccurred) {
|
||||||
|
this.errorOccurred = errorOccurred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,4 +99,51 @@ public abstract class XErrorHandler {
|
|||||||
return theInstance;
|
return theInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a synthetic error handler for errors generated by the native function
|
||||||
|
* <code>XShmAttach</code>. If an error is handled, an internal boolean flag of the
|
||||||
|
* handler is set to <code>true</code>.
|
||||||
|
*/
|
||||||
|
public static final class XShmAttachHandler extends XErrorHandlerWithFlag {
|
||||||
|
private XShmAttachHandler() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int handleError(long display, XErrorEvent err) {
|
||||||
|
if (err.get_minor_code() == XConstants.X_ShmAttach) {
|
||||||
|
setErrorOccurredFlag(true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return super.handleError(display, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shared instance
|
||||||
|
private static XShmAttachHandler theInstance = new XShmAttachHandler();
|
||||||
|
public static XShmAttachHandler getInstance() {
|
||||||
|
return theInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a synthetic error handler for <code>BadAlloc</code> errors generated by the
|
||||||
|
* native <code>glX*</code> functions. Its internal boolean flag is set to <code>true</code>,
|
||||||
|
* if an error is handled.
|
||||||
|
*/
|
||||||
|
public static final class GLXBadAllocHandler extends XErrorHandlerWithFlag {
|
||||||
|
private GLXBadAllocHandler() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int handleError(long display, XErrorEvent err) {
|
||||||
|
if (err.get_error_code() == XConstants.BadAlloc) {
|
||||||
|
setErrorOccurredFlag(true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return super.handleError(display, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static GLXBadAllocHandler theInstance = new GLXBadAllocHandler();
|
||||||
|
public static GLXBadAllocHandler getInstance() {
|
||||||
|
return theInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
162
jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
Normal file
162
jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
package sun.awt.X11;
|
||||||
|
|
||||||
|
import java.security.AccessController;
|
||||||
|
import sun.awt.SunToolkit;
|
||||||
|
import sun.security.action.GetBooleanAction;
|
||||||
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains code of the global toolkit error handler, exposes static
|
||||||
|
* methods which allow to set and unset synthetic error handlers.
|
||||||
|
*/
|
||||||
|
public final class XErrorHandlerUtil {
|
||||||
|
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XErrorHandlerUtil");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The connection to X11 window server.
|
||||||
|
*/
|
||||||
|
private static long display;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error handler at the moment of <code>XErrorHandlerUtil</code> initialization.
|
||||||
|
*/
|
||||||
|
private static long saved_error_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XErrorEvent being handled.
|
||||||
|
*/
|
||||||
|
static volatile XErrorEvent saved_error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current error handler or null if no error handler is set.
|
||||||
|
*/
|
||||||
|
private static XErrorHandler current_error_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value of sun.awt.noisyerrorhandler system property.
|
||||||
|
*/
|
||||||
|
private static boolean noisyAwtHandler = AccessController.doPrivileged(
|
||||||
|
new GetBooleanAction("sun.awt.noisyerrorhandler"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flag indicating that <code>init</code> was called already.
|
||||||
|
*/
|
||||||
|
private static boolean initPassed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guarantees that no instance of this class can be created.
|
||||||
|
*/
|
||||||
|
private XErrorHandlerUtil() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the toolkit global error handler, stores the connection to X11 server, which
|
||||||
|
* will be used during an error handling process. This method is called once from
|
||||||
|
* <code>awt_init_Display</code> function defined in <code>awt_GraphicsEnv.c</code>
|
||||||
|
* file immediately after the connection to X11 window server is opened.
|
||||||
|
* @param display the connection to X11 server which should be stored
|
||||||
|
*/
|
||||||
|
private static void init(long display) {
|
||||||
|
SunToolkit.awtLock();
|
||||||
|
try {
|
||||||
|
if (!initPassed) {
|
||||||
|
XErrorHandlerUtil.display = display;
|
||||||
|
saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
|
||||||
|
initPassed = true;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
SunToolkit.awtUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a synthetic error handler. Must be called with the acquired AWT lock.
|
||||||
|
* @param handler the synthetic error handler to set
|
||||||
|
*/
|
||||||
|
public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
|
||||||
|
saved_error = null;
|
||||||
|
current_error_handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
|
||||||
|
*/
|
||||||
|
public static void RESTORE_XERROR_HANDLER() {
|
||||||
|
// Wait until all requests are processed by the X server
|
||||||
|
// and only then uninstall the error handler.
|
||||||
|
XSync();
|
||||||
|
current_error_handler = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be called under LOCK.
|
||||||
|
*/
|
||||||
|
public static int SAVED_XERROR_HANDLER(long display, XErrorEvent error) {
|
||||||
|
if (saved_error_handler != 0) {
|
||||||
|
// Default XErrorHandler may just terminate the process. Don't call it.
|
||||||
|
// return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
|
||||||
|
}
|
||||||
|
if (log.isLoggable(PlatformLogger.FINE)) {
|
||||||
|
log.fine("Unhandled XErrorEvent: " +
|
||||||
|
"id=" + error.get_resourceid() + ", " +
|
||||||
|
"serial=" + error.get_serial() + ", " +
|
||||||
|
"ec=" + error.get_error_code() + ", " +
|
||||||
|
"rc=" + error.get_request_code() + ", " +
|
||||||
|
"mc=" + error.get_minor_code());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called from the native code when an error occurs.
|
||||||
|
*/
|
||||||
|
private static int globalErrorHandler(long display, long event_ptr) {
|
||||||
|
if (noisyAwtHandler) {
|
||||||
|
XlibWrapper.PrintXErrorEvent(display, event_ptr);
|
||||||
|
}
|
||||||
|
XErrorEvent event = new XErrorEvent(event_ptr);
|
||||||
|
saved_error = event;
|
||||||
|
try {
|
||||||
|
if (current_error_handler != null) {
|
||||||
|
return current_error_handler.handleError(display, event);
|
||||||
|
} else {
|
||||||
|
return SAVED_XERROR_HANDLER(display, event);
|
||||||
|
}
|
||||||
|
} catch (Throwable z) {
|
||||||
|
log.fine("Error in GlobalErrorHandler", z);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void XSync() {
|
||||||
|
SunToolkit.awtLock();
|
||||||
|
try {
|
||||||
|
XlibWrapper.XSync(display, 0);
|
||||||
|
} finally {
|
||||||
|
SunToolkit.awtUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -61,7 +61,7 @@ public class XQueryTree {
|
|||||||
}
|
}
|
||||||
__executed = true;
|
__executed = true;
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.WITH_XERROR_HANDLER(errorHandler);
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
|
||||||
}
|
}
|
||||||
Native.putLong(children_ptr, 0);
|
Native.putLong(children_ptr, 0);
|
||||||
int status =
|
int status =
|
||||||
@ -72,7 +72,7 @@ public class XQueryTree {
|
|||||||
children_ptr,
|
children_ptr,
|
||||||
nchildren_ptr );
|
nchildren_ptr );
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -128,7 +128,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
initIDs();
|
initIDs();
|
||||||
setBackingStoreType();
|
setBackingStoreType();
|
||||||
}
|
}
|
||||||
noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -137,78 +136,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
*/
|
*/
|
||||||
static native long getTrayIconDisplayTimeout();
|
static native long getTrayIconDisplayTimeout();
|
||||||
|
|
||||||
//---- ERROR HANDLER CODE ----//
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Error handler at the moment of XToolkit initialization
|
|
||||||
*/
|
|
||||||
private static long saved_error_handler;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XErrorEvent being handled
|
|
||||||
*/
|
|
||||||
static volatile XErrorEvent saved_error;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Current error handler or null if no error handler is set
|
|
||||||
*/
|
|
||||||
private static XErrorHandler current_error_handler;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Value of sun.awt.noisyerrorhandler system property
|
|
||||||
*/
|
|
||||||
private static boolean noisyAwtHandler;
|
|
||||||
|
|
||||||
public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
|
|
||||||
saved_error = null;
|
|
||||||
current_error_handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RESTORE_XERROR_HANDLER() {
|
|
||||||
// wait until all requests are processed by the X server
|
|
||||||
// and only then uninstall the error handler
|
|
||||||
XSync();
|
|
||||||
current_error_handler = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should be called under LOCK
|
|
||||||
public static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
|
|
||||||
if (saved_error_handler != 0) {
|
|
||||||
// Default XErrorHandler may just terminate the process. Don't call it.
|
|
||||||
// return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
|
|
||||||
}
|
|
||||||
if (log.isLoggable(PlatformLogger.FINE)) {
|
|
||||||
log.fine("Unhandled XErrorEvent: " +
|
|
||||||
"id=" + error.get_resourceid() + ", " +
|
|
||||||
"serial=" + error.get_serial() + ", " +
|
|
||||||
"ec=" + error.get_error_code() + ", " +
|
|
||||||
"rc=" + error.get_request_code() + ", " +
|
|
||||||
"mc=" + error.get_minor_code());
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from the native code when an error occurs
|
|
||||||
private static int globalErrorHandler(long display, long event_ptr) {
|
|
||||||
if (noisyAwtHandler) {
|
|
||||||
XlibWrapper.PrintXErrorEvent(display, event_ptr);
|
|
||||||
}
|
|
||||||
XErrorEvent event = new XErrorEvent(event_ptr);
|
|
||||||
saved_error = event;
|
|
||||||
try {
|
|
||||||
if (current_error_handler != null) {
|
|
||||||
return current_error_handler.handleError(display, event);
|
|
||||||
} else {
|
|
||||||
return SAVED_ERROR_HANDLER(display, event);
|
|
||||||
}
|
|
||||||
} catch (Throwable z) {
|
|
||||||
log.fine("Error in GlobalErrorHandler", z);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---- END OF ERROR HANDLER CODE ----//
|
|
||||||
|
|
||||||
private native static void initIDs();
|
private native static void initIDs();
|
||||||
native static void waitForEvents(long nextTaskTime);
|
native static void waitForEvents(long nextTaskTime);
|
||||||
static Thread toolkitThread;
|
static Thread toolkitThread;
|
||||||
@ -306,8 +233,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
//set system property if not yet assigned
|
//set system property if not yet assigned
|
||||||
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
|
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
|
||||||
|
|
||||||
saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
|
|
||||||
|
|
||||||
// Detect display mode changes
|
// Detect display mode changes
|
||||||
XlibWrapper.XSelectInput(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XConstants.StructureNotifyMask);
|
XlibWrapper.XSelectInput(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XConstants.StructureNotifyMask);
|
||||||
XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(), new XEventDispatcher() {
|
XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(), new XEventDispatcher() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -68,7 +68,7 @@ public class XTranslateCoordinates {
|
|||||||
}
|
}
|
||||||
__executed = true;
|
__executed = true;
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.WITH_XERROR_HANDLER(errorHandler);
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
|
||||||
}
|
}
|
||||||
int status =
|
int status =
|
||||||
XlibWrapper.XTranslateCoordinates(XToolkit.getDisplay(),
|
XlibWrapper.XTranslateCoordinates(XToolkit.getDisplay(),
|
||||||
@ -80,7 +80,7 @@ public class XTranslateCoordinates {
|
|||||||
dest_y_ptr,
|
dest_y_ptr,
|
||||||
child_ptr );
|
child_ptr );
|
||||||
if (errorHandler != null) {
|
if (errorHandler != null) {
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -284,12 +284,12 @@ final class XWM
|
|||||||
winmgr_running = false;
|
winmgr_running = false;
|
||||||
substruct.set_event_mask(XConstants.SubstructureRedirectMask);
|
substruct.set_event_mask(XConstants.SubstructureRedirectMask);
|
||||||
|
|
||||||
XToolkit.WITH_XERROR_HANDLER(detectWMHandler);
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(detectWMHandler);
|
||||||
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
|
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
|
||||||
XToolkit.getDefaultRootWindow(),
|
XToolkit.getDefaultRootWindow(),
|
||||||
XConstants.CWEventMask,
|
XConstants.CWEventMask,
|
||||||
substruct.pData);
|
substruct.pData);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no WM is running then our selection for SubstructureRedirect
|
* If no WM is running then our selection for SubstructureRedirect
|
||||||
@ -632,15 +632,16 @@ final class XWM
|
|||||||
|
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
|
||||||
XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
|
XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
|
||||||
XA_ICEWM_WINOPTHINT.getAtom(),
|
XA_ICEWM_WINOPTHINT.getAtom(),
|
||||||
XA_ICEWM_WINOPTHINT.getAtom(),
|
XA_ICEWM_WINOPTHINT.getAtom(),
|
||||||
8, XConstants.PropModeReplace,
|
8, XConstants.PropModeReplace,
|
||||||
new String(opt));
|
new String(opt));
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
|
|
||||||
if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XConstants.Success) {
|
if ((XErrorHandlerUtil.saved_error != null) &&
|
||||||
|
(XErrorHandlerUtil.saved_error.get_error_code() != XConstants.Success)) {
|
||||||
log.finer("Erorr getting XA_ICEWM_WINOPTHINT property");
|
log.finer("Erorr getting XA_ICEWM_WINOPTHINT property");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -151,8 +151,8 @@ public class XlibUtil
|
|||||||
{
|
{
|
||||||
int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
if ((status != 0) &&
|
if ((status != 0) &&
|
||||||
((XToolkit.saved_error == null) ||
|
((XErrorHandlerUtil.saved_error == null) ||
|
||||||
(XToolkit.saved_error.get_error_code() == XConstants.Success)))
|
(XErrorHandlerUtil.saved_error.get_error_code() == XConstants.Success)))
|
||||||
{
|
{
|
||||||
translated = new Point(xtc.get_dest_x(), xtc.get_dest_y());
|
translated = new Point(xtc.get_dest_x(), xtc.get_dest_y());
|
||||||
}
|
}
|
||||||
@ -345,13 +345,13 @@ public class XlibUtil
|
|||||||
XWindowAttributes wattr = new XWindowAttributes();
|
XWindowAttributes wattr = new XWindowAttributes();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
|
||||||
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
|
||||||
window, wattr.pData);
|
window, wattr.pData);
|
||||||
XToolkit.RESTORE_XERROR_HANDLER();
|
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
|
||||||
if ((status != 0) &&
|
if ((status != 0) &&
|
||||||
((XToolkit.saved_error == null) ||
|
((XErrorHandlerUtil.saved_error == null) ||
|
||||||
(XToolkit.saved_error.get_error_code() == XConstants.Success)))
|
(XErrorHandlerUtil.saved_error.get_error_code() == XConstants.Success)))
|
||||||
{
|
{
|
||||||
return wattr.get_map_state();
|
return wattr.get_map_state();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -996,7 +996,7 @@ public class WrapperGenerator {
|
|||||||
pw.println("\t\t\t}");
|
pw.println("\t\t\t}");
|
||||||
pw.println("\t\t\t__executed = true;");
|
pw.println("\t\t\t__executed = true;");
|
||||||
pw.println("\t\t\tif (errorHandler != null) {");
|
pw.println("\t\t\tif (errorHandler != null) {");
|
||||||
pw.println("\t\t\t XToolkit.WITH_XERROR_HANDLER(errorHandler);");
|
pw.println("\t\t\t XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);");
|
||||||
pw.println("\t\t\t}");
|
pw.println("\t\t\t}");
|
||||||
iter = ft.getArguments().iterator();
|
iter = ft.getArguments().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@ -1025,7 +1025,7 @@ public class WrapperGenerator {
|
|||||||
}
|
}
|
||||||
pw.println("\t\t\t);");
|
pw.println("\t\t\t);");
|
||||||
pw.println("\t\t\tif (errorHandler != null) {");
|
pw.println("\t\t\tif (errorHandler != null) {");
|
||||||
pw.println("\t\t\t XToolkit.RESTORE_XERROR_HANDLER();");
|
pw.println("\t\t\t XErrorHandlerUtil.RESTORE_XERROR_HANDLER();");
|
||||||
pw.println("\t\t\t}");
|
pw.println("\t\t\t}");
|
||||||
if (!ft.isVoid()) {
|
if (!ft.isVoid()) {
|
||||||
pw.println("\t\t\treturn status;");
|
pw.println("\t\t\treturn status;");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -758,6 +758,8 @@ awt_init_Display(JNIEnv *env, jobject this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XSetIOErrorHandler(xioerror_handler);
|
XSetIOErrorHandler(xioerror_handler);
|
||||||
|
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "init", "(J)V",
|
||||||
|
ptr_to_jlong(awt_display));
|
||||||
|
|
||||||
/* set awt_numScreens, and whether or not we're using Xinerama */
|
/* set awt_numScreens, and whether or not we're using Xinerama */
|
||||||
xineramaInit();
|
xineramaInit();
|
||||||
@ -904,28 +906,12 @@ Java_sun_awt_X11GraphicsDevice_getDisplay(JNIEnv *env, jobject this)
|
|||||||
|
|
||||||
static jint canUseShmExt = UNSET_MITSHM;
|
static jint canUseShmExt = UNSET_MITSHM;
|
||||||
static jint canUseShmExtPixmaps = UNSET_MITSHM;
|
static jint canUseShmExtPixmaps = UNSET_MITSHM;
|
||||||
static jboolean xshmAttachFailed = JNI_FALSE;
|
|
||||||
|
|
||||||
int J2DXErrHandler(Display *display, XErrorEvent *xerr) {
|
|
||||||
int ret = 0;
|
|
||||||
if (xerr->minor_code == X_ShmAttach) {
|
|
||||||
xshmAttachFailed = JNI_TRUE;
|
|
||||||
} else {
|
|
||||||
ret = (*xerror_saved_handler)(display, xerr);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
jboolean isXShmAttachFailed() {
|
|
||||||
return xshmAttachFailed;
|
|
||||||
}
|
|
||||||
void resetXShmAttachFailed() {
|
|
||||||
xshmAttachFailed = JNI_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
|
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
|
||||||
XShmSegmentInfo shminfo;
|
XShmSegmentInfo shminfo;
|
||||||
int XShmMajor, XShmMinor;
|
int XShmMajor, XShmMinor;
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
|
jboolean xShmAttachResult;
|
||||||
|
|
||||||
AWT_LOCK();
|
AWT_LOCK();
|
||||||
if (canUseShmExt != UNSET_MITSHM) {
|
if (canUseShmExt != UNSET_MITSHM) {
|
||||||
@ -963,21 +949,14 @@ void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
|
|||||||
}
|
}
|
||||||
shminfo.readOnly = True;
|
shminfo.readOnly = True;
|
||||||
|
|
||||||
resetXShmAttachFailed();
|
xShmAttachResult = TryXShmAttach(env, awt_display, &shminfo);
|
||||||
/**
|
|
||||||
* The J2DXErrHandler handler will set xshmAttachFailed
|
|
||||||
* to JNI_TRUE if any Shm error has occured.
|
|
||||||
*/
|
|
||||||
EXEC_WITH_XERROR_HANDLER(J2DXErrHandler,
|
|
||||||
XShmAttach(awt_display, &shminfo));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rid of the id now to reduce chances of leaking
|
* Get rid of the id now to reduce chances of leaking
|
||||||
* system resources.
|
* system resources.
|
||||||
*/
|
*/
|
||||||
shmctl(shminfo.shmid, IPC_RMID, 0);
|
shmctl(shminfo.shmid, IPC_RMID, 0);
|
||||||
|
|
||||||
if (isXShmAttachFailed() == JNI_FALSE) {
|
if (xShmAttachResult == JNI_TRUE) {
|
||||||
canUseShmExt = CAN_USE_MITSHM;
|
canUseShmExt = CAN_USE_MITSHM;
|
||||||
/* check if we can use shared pixmaps */
|
/* check if we can use shared pixmaps */
|
||||||
XShmQueryVersion(awt_display, &XShmMajor, &XShmMinor,
|
XShmQueryVersion(awt_display, &XShmMajor, &XShmMinor,
|
||||||
@ -992,6 +971,23 @@ void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
|
|||||||
}
|
}
|
||||||
AWT_UNLOCK();
|
AWT_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must be called with the acquired AWT lock.
|
||||||
|
*/
|
||||||
|
jboolean TryXShmAttach(JNIEnv *env, Display *display, XShmSegmentInfo *shminfo) {
|
||||||
|
jboolean errorOccurredFlag = JNI_FALSE;
|
||||||
|
jobject errorHandlerRef;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XShmAttachHandler will set its internal flag to JNI_TRUE, if any Shm error occurs.
|
||||||
|
*/
|
||||||
|
EXEC_WITH_XERROR_HANDLER(env, "sun/awt/X11/XErrorHandler$XShmAttachHandler",
|
||||||
|
"()Lsun/awt/X11/XErrorHandler$XShmAttachHandler;", JNI_TRUE,
|
||||||
|
errorHandlerRef, errorOccurredFlag,
|
||||||
|
XShmAttach(display, shminfo));
|
||||||
|
return errorOccurredFlag == JNI_FALSE ? JNI_TRUE : JNI_FALSE;
|
||||||
|
}
|
||||||
#endif /* MITSHM */
|
#endif /* MITSHM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -50,8 +50,7 @@
|
|||||||
extern int XShmQueryExtension();
|
extern int XShmQueryExtension();
|
||||||
|
|
||||||
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps);
|
void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps);
|
||||||
void resetXShmAttachFailed();
|
jboolean TryXShmAttach(JNIEnv *env, Display *display, XShmSegmentInfo *shminfo);
|
||||||
jboolean isXShmAttachFailed();
|
|
||||||
|
|
||||||
#endif /* MITSHM */
|
#endif /* MITSHM */
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -41,18 +41,6 @@
|
|||||||
|
|
||||||
#include "java_awt_event_MouseWheelEvent.h"
|
#include "java_awt_event_MouseWheelEvent.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Since X reports protocol errors asynchronously, we often need to
|
|
||||||
* install an error handler that acts like a callback. While that
|
|
||||||
* specialized handler is installed we save original handler here.
|
|
||||||
*/
|
|
||||||
XErrorHandler xerror_saved_handler;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A place for error handler to report the error code.
|
|
||||||
*/
|
|
||||||
unsigned char xerror_code;
|
|
||||||
|
|
||||||
extern jint getModifiers(uint32_t state, jint button, jint keyCode);
|
extern jint getModifiers(uint32_t state, jint button, jint keyCode);
|
||||||
extern jint getButton(uint32_t button);
|
extern jint getButton(uint32_t button);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,42 +29,47 @@
|
|||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
#include "gdefs.h"
|
#include "gdefs.h"
|
||||||
|
|
||||||
#define WITH_XERROR_HANDLER(f) do { \
|
/*
|
||||||
XSync(awt_display, False); \
|
* Expected types of arguments of the macro.
|
||||||
xerror_code = Success; \
|
* (JNIEnv*, const char*, const char*, jboolean, jobject)
|
||||||
xerror_saved_handler = XSetErrorHandler(f); \
|
*/
|
||||||
} while (0)
|
#define WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, \
|
||||||
|
handlerHasFlag, handlerRef) do { \
|
||||||
/* Convenience macro for handlers to use */
|
handlerRef = JNU_CallStaticMethodByName(env, NULL, handlerClassName, "getInstance", \
|
||||||
#define XERROR_SAVE(err) do { \
|
getInstanceSignature).l; \
|
||||||
xerror_code = (err)->error_code; \
|
if (handlerHasFlag == JNI_TRUE) { \
|
||||||
} while (0)
|
JNU_CallMethodByName(env, NULL, handlerRef, "setErrorOccurredFlag", "(Z)V", JNI_FALSE); \
|
||||||
|
} \
|
||||||
#define RESTORE_XERROR_HANDLER do { \
|
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "WITH_XERROR_HANDLER", \
|
||||||
XSync(awt_display, False); \
|
"(Lsun/awt/X11/XErrorHandler;)V", handlerRef); \
|
||||||
XSetErrorHandler(xerror_saved_handler); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define EXEC_WITH_XERROR_HANDLER(f, code) do { \
|
|
||||||
WITH_XERROR_HANDLER(f); \
|
|
||||||
do { \
|
|
||||||
code; \
|
|
||||||
} while (0); \
|
|
||||||
RESTORE_XERROR_HANDLER; \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since X reports protocol errors asynchronously, we often need to
|
* Expected types of arguments of the macro.
|
||||||
* install an error handler that acts like a callback. While that
|
* (JNIEnv*)
|
||||||
* specialized handler is installed we save original handler here.
|
|
||||||
*/
|
*/
|
||||||
extern XErrorHandler xerror_saved_handler;
|
#define RESTORE_XERROR_HANDLER(env) do { \
|
||||||
|
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", \
|
||||||
|
"RESTORE_XERROR_HANDLER", "()V"); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A place for error handler to report the error code.
|
* Expected types of arguments of the macro.
|
||||||
|
* (JNIEnv*, const char*, const char*, jboolean, jobject, jboolean, No type - C expression)
|
||||||
*/
|
*/
|
||||||
extern unsigned char xerror_code;
|
#define EXEC_WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag, \
|
||||||
|
handlerRef, errorOccurredFlag, code) do { \
|
||||||
|
handlerRef = NULL; \
|
||||||
|
WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag, handlerRef); \
|
||||||
|
do { \
|
||||||
|
code; \
|
||||||
|
} while (0); \
|
||||||
|
RESTORE_XERROR_HANDLER(env); \
|
||||||
|
if (handlerHasFlag == JNI_TRUE) { \
|
||||||
|
errorOccurredFlag = JNU_CallMethodByName(env, NULL, handlerRef, "getErrorOccurredFlag", \
|
||||||
|
"()Z").z; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
#endif /* !HEADLESS */
|
#endif /* !HEADLESS */
|
||||||
|
|
||||||
#ifndef INTERSECTS
|
#ifndef INTERSECTS
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -48,8 +48,6 @@ extern DisposeFunc OGLSD_Dispose;
|
|||||||
extern void
|
extern void
|
||||||
OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
|
OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
|
||||||
|
|
||||||
jboolean surfaceCreationFailed = JNI_FALSE;
|
|
||||||
|
|
||||||
#endif /* !HEADLESS */
|
#endif /* !HEADLESS */
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
@ -349,18 +347,6 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo)
|
|||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
GLXSD_BadAllocXErrHandler(Display *display, XErrorEvent *xerr)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
if (xerr->error_code == BadAlloc) {
|
|
||||||
surfaceCreationFailed = JNI_TRUE;
|
|
||||||
} else {
|
|
||||||
ret = (*xerror_saved_handler)(display, xerr);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
|
Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
|
||||||
(JNIEnv *env, jobject glxsd,
|
(JNIEnv *env, jobject glxsd,
|
||||||
@ -376,6 +362,8 @@ Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
|
|||||||
int attrlist[] = {GLX_PBUFFER_WIDTH, 0,
|
int attrlist[] = {GLX_PBUFFER_WIDTH, 0,
|
||||||
GLX_PBUFFER_HEIGHT, 0,
|
GLX_PBUFFER_HEIGHT, 0,
|
||||||
GLX_PRESERVED_CONTENTS, GL_FALSE, 0};
|
GLX_PRESERVED_CONTENTS, GL_FALSE, 0};
|
||||||
|
jboolean errorOccurredFlag;
|
||||||
|
jobject errorHandlerRef;
|
||||||
|
|
||||||
J2dTraceLn3(J2D_TRACE_INFO,
|
J2dTraceLn3(J2D_TRACE_INFO,
|
||||||
"GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d",
|
"GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d",
|
||||||
@ -403,12 +391,13 @@ Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
|
|||||||
attrlist[1] = width;
|
attrlist[1] = width;
|
||||||
attrlist[3] = height;
|
attrlist[3] = height;
|
||||||
|
|
||||||
surfaceCreationFailed = JNI_FALSE;
|
errorOccurredFlag = JNI_FALSE;
|
||||||
EXEC_WITH_XERROR_HANDLER(
|
EXEC_WITH_XERROR_HANDLER(env, "sun/awt/X11/XErrorHandler$GLXBadAllocHandler",
|
||||||
GLXSD_BadAllocXErrHandler,
|
"()Lsun/awt/X11/XErrorHandler$GLXBadAllocHandler;", JNI_TRUE,
|
||||||
pbuffer = j2d_glXCreatePbuffer(awt_display,
|
errorHandlerRef, errorOccurredFlag,
|
||||||
glxinfo->fbconfig, attrlist));
|
pbuffer = j2d_glXCreatePbuffer(awt_display, glxinfo->fbconfig, attrlist));
|
||||||
if ((pbuffer == 0) || surfaceCreationFailed) {
|
|
||||||
|
if ((pbuffer == 0) || errorOccurredFlag) {
|
||||||
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
||||||
"GLXSurfaceData_initPbuffer: could not create glx pbuffer");
|
"GLXSurfaceData_initPbuffer: could not create glx pbuffer");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -65,7 +65,6 @@ static UnlockFunc X11SD_Unlock;
|
|||||||
static DisposeFunc X11SD_Dispose;
|
static DisposeFunc X11SD_Dispose;
|
||||||
static GetPixmapBgFunc X11SD_GetPixmapWithBg;
|
static GetPixmapBgFunc X11SD_GetPixmapWithBg;
|
||||||
static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg;
|
static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg;
|
||||||
extern int J2DXErrHandler(Display *display, XErrorEvent *xerr);
|
|
||||||
extern AwtGraphicsConfigDataPtr
|
extern AwtGraphicsConfigDataPtr
|
||||||
getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
|
getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
|
||||||
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
||||||
@ -521,6 +520,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo,
|
|||||||
{
|
{
|
||||||
XImage *img = NULL;
|
XImage *img = NULL;
|
||||||
XShmSegmentInfo *shminfo;
|
XShmSegmentInfo *shminfo;
|
||||||
|
JNIEnv* env;
|
||||||
|
jboolean xShmAttachResult;
|
||||||
|
|
||||||
shminfo = malloc(sizeof(XShmSegmentInfo));
|
shminfo = malloc(sizeof(XShmSegmentInfo));
|
||||||
if (shminfo == NULL) {
|
if (shminfo == NULL) {
|
||||||
@ -559,9 +560,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo,
|
|||||||
|
|
||||||
shminfo->readOnly = False;
|
shminfo->readOnly = False;
|
||||||
|
|
||||||
resetXShmAttachFailed();
|
env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||||
EXEC_WITH_XERROR_HANDLER(J2DXErrHandler,
|
xShmAttachResult = TryXShmAttach(env, awt_display, shminfo);
|
||||||
XShmAttach(awt_display, shminfo));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Once the XSync round trip has finished then we
|
* Once the XSync round trip has finished then we
|
||||||
@ -570,7 +570,7 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo,
|
|||||||
*/
|
*/
|
||||||
shmctl(shminfo->shmid, IPC_RMID, 0);
|
shmctl(shminfo->shmid, IPC_RMID, 0);
|
||||||
|
|
||||||
if (isXShmAttachFailed() == JNI_TRUE) {
|
if (xShmAttachResult == JNI_FALSE) {
|
||||||
J2dRlsTraceLn1(J2D_TRACE_ERROR,
|
J2dRlsTraceLn1(J2D_TRACE_ERROR,
|
||||||
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
|
"X11SD_SetupSharedSegment XShmAttach has failed: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1264,8 +1264,8 @@ static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
|
|||||||
if (jvm != NULL) {
|
if (jvm != NULL) {
|
||||||
env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||||
if (env) {
|
if (env) {
|
||||||
return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "globalErrorHandler", "(JJ)I",
|
return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil",
|
||||||
ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
|
"globalErrorHandler", "(JJ)I", ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8012586
|
* @bug 8012586
|
||||||
* @summary verify that modal dialog will appeared above fullscreen window under Metacity WM.
|
* @summary verify that modal dialog will appeared above fullscreen window under Metacity WM.
|
||||||
|
* @library ../../regtesthelpers
|
||||||
|
* @build Util
|
||||||
* @run main FullscreenDialogModality
|
* @run main FullscreenDialogModality
|
||||||
* @run main/othervm FullscreenDialogModality
|
* @run main/othervm FullscreenDialogModality
|
||||||
* @author vkravets
|
* @author vkravets
|
||||||
|
@ -37,11 +37,12 @@ import javax.swing.*;
|
|||||||
|
|
||||||
public class TranslucentJAppletTest {
|
public class TranslucentJAppletTest {
|
||||||
|
|
||||||
|
private static volatile GraphicsConfiguration graphicsConfig = null;
|
||||||
private static JFrame frame;
|
private static JFrame frame;
|
||||||
private static volatile boolean paintComponentCalled = false;
|
private static volatile boolean paintComponentCalled = false;
|
||||||
|
|
||||||
private static void initAndShowGUI() {
|
private static void initAndShowGUI() {
|
||||||
frame = new JFrame();
|
frame = new JFrame(graphicsConfig);
|
||||||
JApplet applet = new JApplet();
|
JApplet applet = new JApplet();
|
||||||
applet.setBackground(new Color(0, 0, 0, 0));
|
applet.setBackground(new Color(0, 0, 0, 0));
|
||||||
JPanel panel = new JPanel() {
|
JPanel panel = new JPanel() {
|
||||||
@ -66,6 +67,27 @@ public class TranslucentJAppletTest {
|
|||||||
{
|
{
|
||||||
sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
|
sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
|
||||||
|
|
||||||
|
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
|
for (GraphicsDevice gd : ge.getScreenDevices()) {
|
||||||
|
if (gd.isWindowTranslucencySupported(
|
||||||
|
GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT))
|
||||||
|
{
|
||||||
|
for (GraphicsConfiguration gc : gd.getConfigurations()) {
|
||||||
|
if (gc.isTranslucencyCapable()) {
|
||||||
|
graphicsConfig = gc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (graphicsConfig != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (graphicsConfig == null) {
|
||||||
|
System.out.println("The system does not support translucency. Consider the test passed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Robot r = new Robot();
|
Robot r = new Robot();
|
||||||
Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
|
Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
|
||||||
|
|
||||||
|
90
jdk/test/java/beans/XMLEncoder/Test8013416.java
Normal file
90
jdk/test/java/beans/XMLEncoder/Test8013416.java
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8013416
|
||||||
|
* @summary Tests public synthetic methods
|
||||||
|
* @author Sergey Malenkov
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.beans.DefaultPersistenceDelegate;
|
||||||
|
import java.beans.Encoder;
|
||||||
|
import java.beans.Expression;
|
||||||
|
import java.beans.Statement;
|
||||||
|
import java.beans.XMLEncoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Test8013416 extends AbstractTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Test8013416().test(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Object getObject() {
|
||||||
|
Public<String, String> map = new Public<String, String>();
|
||||||
|
map.put(" pz1 ", " pz2 ");
|
||||||
|
map.put(" pz3 ", " pz4 ");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initialize(XMLEncoder encoder) {
|
||||||
|
super.initialize(encoder);
|
||||||
|
encoder.setPersistenceDelegate(Public.class, new PublicPersistenceDelegate());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class PublicPersistenceDelegate extends DefaultPersistenceDelegate {
|
||||||
|
@Override
|
||||||
|
protected Expression instantiate(Object oldInstance, Encoder out) {
|
||||||
|
return new Expression(oldInstance, oldInstance.getClass(), "new", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
|
||||||
|
super.initialize(type, oldInstance, newInstance, out);
|
||||||
|
|
||||||
|
Public<String, String> map = (Public) oldInstance;
|
||||||
|
for (Entry<String, String> entry : map.getAll()) {
|
||||||
|
String[] args = {entry.getKey(), entry.getValue()};
|
||||||
|
out.writeStatement(new Statement(oldInstance, "put", args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Public<K, V> extends Private<K, V> {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Private<K, V> {
|
||||||
|
private HashMap<K, V> map = new HashMap<K, V>();
|
||||||
|
|
||||||
|
public void put(K key, V value) {
|
||||||
|
this.map.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Entry<K, V>> getAll() {
|
||||||
|
return this.map.entrySet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
146
jdk/test/javax/swing/text/View/8014863/bug8014863.java
Normal file
146
jdk/test/javax/swing/text/View/8014863/bug8014863.java
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8014863
|
||||||
|
* @summary Tests the calculation of the line breaks when a text is inserted
|
||||||
|
* @author Dmitry Markov
|
||||||
|
* @library ../../../regtesthelpers
|
||||||
|
* @build Util
|
||||||
|
* @run main bug8014863
|
||||||
|
*/
|
||||||
|
|
||||||
|
import sun.awt.SunToolkit;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
public class bug8014863 {
|
||||||
|
|
||||||
|
private static JEditorPane editorPane;
|
||||||
|
private static Robot robot;
|
||||||
|
private static SunToolkit toolkit;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
||||||
|
robot = new Robot();
|
||||||
|
|
||||||
|
createAndShowGUI();
|
||||||
|
|
||||||
|
toolkit.realSync();
|
||||||
|
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_HOME);
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_O);
|
||||||
|
|
||||||
|
toolkit.realSync();
|
||||||
|
|
||||||
|
if (3 != getNumberOfTextLines()) {
|
||||||
|
throw new RuntimeException("The number of texts lines does not meet the expectation");
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_N);
|
||||||
|
|
||||||
|
toolkit.realSync();
|
||||||
|
|
||||||
|
if (3 != getNumberOfTextLines()) {
|
||||||
|
throw new RuntimeException("The number of texts lines does not meet the expectation");
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_E);
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_SPACE);
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_T);
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_W);
|
||||||
|
|
||||||
|
toolkit.realSync();
|
||||||
|
|
||||||
|
if (3 != getNumberOfTextLines()) {
|
||||||
|
throw new RuntimeException("The number of texts lines does not meet the expectation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getNumberOfTextLines() throws Exception {
|
||||||
|
int numberOfLines = 0;
|
||||||
|
int caretPosition = getCaretPosition();
|
||||||
|
int current = 1;
|
||||||
|
int previous;
|
||||||
|
|
||||||
|
setCaretPosition(current);
|
||||||
|
do {
|
||||||
|
previous = current;
|
||||||
|
Util.hitKeys(robot, KeyEvent.VK_DOWN);
|
||||||
|
toolkit.realSync();
|
||||||
|
current = getCaretPosition();
|
||||||
|
numberOfLines++;
|
||||||
|
} while (current != previous);
|
||||||
|
|
||||||
|
setCaretPosition(caretPosition);
|
||||||
|
return numberOfLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getCaretPosition() throws Exception {
|
||||||
|
final int[] result = new int[1];
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
result[0] = editorPane.getCaretPosition();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setCaretPosition(final int position) throws Exception {
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
editorPane.setCaretPosition(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createAndShowGUI() throws Exception {
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
JFrame frame = new JFrame();
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
editorPane = new JEditorPane();
|
||||||
|
HTMLEditorKit editorKit = new HTMLEditorKit();
|
||||||
|
editorPane.setEditorKit(editorKit);
|
||||||
|
editorPane.setText("<p>qqqq <em>pp</em> qqqq <em>pp</em> " +
|
||||||
|
"qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp" +
|
||||||
|
"</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>");
|
||||||
|
editorPane.setCaretPosition(1);
|
||||||
|
|
||||||
|
frame.add(editorPane);
|
||||||
|
frame.setSize(200, 200);
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 7011777
|
||||||
|
* @summary Tests correct parsing of a HTML comment inside 'script' tags
|
||||||
|
* @author Dmitry Markov
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
|
import javax.swing.text.html.parser.ParserDelegator;
|
||||||
|
import java.io.StringReader;
|
||||||
|
|
||||||
|
public class bug7011777 {
|
||||||
|
static String comment = "<!--\n" +
|
||||||
|
"function foo() {\n" +
|
||||||
|
" var tag1 = \"</script>\";\n" +
|
||||||
|
" var tag2 = \"<div>\";\n" +
|
||||||
|
" var tag3 = \"</div>\";\n" +
|
||||||
|
" var tag4 = \"<script>\";\n" +
|
||||||
|
"}\n" +
|
||||||
|
"// -->";
|
||||||
|
static String html = "<script>" + comment + "</script>";
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new ParserDelegator().parse(new StringReader(html), new MyParserCallback(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyParserCallback extends HTMLEditorKit.ParserCallback {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleComment(char[] data, int pos) {
|
||||||
|
String commentWithoutTags = comment.substring("<!--".length(), comment.length() - "-->".length());
|
||||||
|
String str = new String(data);
|
||||||
|
if (!commentWithoutTags.equals(str)) {
|
||||||
|
System.out.println("Sample string:\n" + commentWithoutTags);
|
||||||
|
System.out.println("Returned string:\n" + str);
|
||||||
|
throw new RuntimeException("Test Failed, sample and returned strings are mismatched!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -145,12 +145,6 @@ public class SuplementaryCharactersTransferTest {
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Image platformImageBytesOrStreamToImage(InputStream str,
|
|
||||||
byte[] bytes, long format) throws IOException {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected byte[] imageToPlatformBytes(Image image, long format)
|
protected byte[] imageToPlatformBytes(Image image, long format)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
@ -161,5 +155,10 @@ public class SuplementaryCharactersTransferTest {
|
|||||||
public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
|
public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user